:root {
  --bg: #f4f6f5;
  --card: #ffffff;
  --ink: #17201b;
  --muted: #5d6b63;
  --line: #dde3df;
  --brand: #1f6f43;
  --brand-ink: #ffffff;
  --brand-soft: #e3f1e9;
  --warn: #9a5b00;
  --warn-soft: #fff3dc;
  --bad: #b3261e;
  --bad-soft: #fde8e6;
  --good: #1f6f43;
  --good-soft: #e3f1e9;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101512;
    --card: #19211c;
    --ink: #e8eee9;
    --muted: #9aa8a0;
    --line: #2b3630;
    --brand: #4cb37a;
    --brand-ink: #08130c;
    --brand-soft: #1d3326;
    --warn: #f0b45a;
    --warn-soft: #33270f;
    --bad: #ff8a80;
    --bad-soft: #3a1b18;
    --good: #6fd09a;
    --good-soft: #1d3326;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(68px + env(safe-area-inset-bottom));
}
a { color: var(--brand); text-decoration: none; }
h1 { font-size: 1.25rem; margin: 0 0 .75rem; }
h2 { font-size: 1.05rem; margin: 1.25rem 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-variant-numeric: tabular-nums; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  background: var(--brand); color: var(--brand-ink);
  padding: .7rem 1rem calc(.7rem);
  padding-top: calc(.7rem + env(safe-area-inset-top));
}
.topbar .title { font-weight: 700; letter-spacing: .2px; }
.topbar a, .topbar button { color: var(--brand-ink); }
.topbar .user { font-size: .85rem; opacity: .9; display: flex; gap: .6rem; align-items: center; }
.topbar form { margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }

main { max-width: 760px; margin: 0 auto; padding: 1rem; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .9rem 1rem; margin-bottom: .75rem;
}
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.row-link { display: block; padding: .75rem 0; color: inherit; }
.row-top { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.row-sub { color: var(--muted); font-size: .88rem; }

.pill {
  display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: var(--brand-soft); color: var(--good); white-space: nowrap;
}
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.gray { background: var(--line); color: var(--muted); }

.msg { border-radius: 10px; padding: .7rem .9rem; margin-bottom: .75rem; font-size: .95rem; }
.msg.success { background: var(--good-soft); color: var(--good); }
.msg.info { background: var(--brand-soft); color: var(--ink); }
.msg.warning { background: var(--warn-soft); color: var(--warn); }
.msg.error { background: var(--bad-soft); color: var(--bad); }

label { display: block; font-weight: 600; font-size: .9rem; margin: .7rem 0 .25rem; }
input[type=text], input[type=search], input[type=number], input[type=date], input[type=password], input[type=email],
input:not([type]), select, textarea {
  width: 100%; padding: .7rem .75rem; font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; min-height: 46px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.help, .errorlist { font-size: .82rem; color: var(--muted); margin: .25rem 0 0; padding: 0; list-style: none; }
.errorlist { color: var(--bad); }
.check { display: flex; align-items: center; gap: .55rem; font-weight: 500; margin: .45rem 0; }
.check input { width: 22px; height: 22px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 46px; padding: .6rem 1.1rem; border-radius: 10px; border: 1px solid var(--brand);
  background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 600; cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--brand); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { min-height: 36px; padding: .3rem .75rem; font-size: .88rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btns { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .1rem .75rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem .9rem; font-size: .93rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.line { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line.short { background: linear-gradient(90deg, var(--bad-soft), transparent 70%); margin: 0 -1rem; padding: .7rem 1rem; }
.qty { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .88rem; color: var(--muted); margin-top: .2rem; }
.qty b { color: var(--ink); font-weight: 600; }

.picker { position: relative; }
.picker-results { list-style: none; margin: .25rem 0 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--card); max-height: 280px; overflow: auto; }
.picker-results:empty { display: none; }
.picker-results li { padding: .6rem .75rem; border-bottom: 1px solid var(--line); cursor: pointer; }
.picker-results li:last-child { border-bottom: 0; }
.picker-results li:hover, .picker-results li:focus { background: var(--brand-soft); outline: none; }
.chosen { margin-top: .35rem; font-size: .9rem; color: var(--good); }

.tabs { display: flex; gap: .4rem; overflow-x: auto; margin-bottom: .75rem; padding-bottom: .2rem; }
.tabs a { white-space: nowrap; padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); font-size: .88rem; background: var(--card); }
.tabs a.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

table.simple { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.simple th, table.simple td { text-align: left; padding: .45rem .3rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.simple th { color: var(--muted); font-weight: 600; }
.right { text-align: right; }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: .1rem;
  padding: .45rem 0 .5rem; color: var(--muted); font-size: .72rem; font-weight: 600;
}
.bottomnav a.on { color: var(--brand); }
.bottomnav svg { width: 24px; height: 24px; }

.tiles { display: grid; grid-template-columns: 1fr; gap: .6rem; margin-bottom: .5rem; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile {
  display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1rem;
  background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--brand);
  border-radius: var(--radius); color: var(--ink);
}
.tile b { font-size: 1.05rem; color: var(--brand); }
.tile span { color: var(--muted); font-size: .9rem; }
.tile:active { background: var(--brand-soft); }

/* Order progress: Made -> approval levels -> In SAP */
.steps { list-style: none; margin: 0 0 .9rem; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem .2rem; align-items: center; }
.steps li { display: flex; align-items: center; gap: .3rem; font-size: .82rem; color: var(--muted); }
.steps li + li::before { content: "›"; color: var(--line); font-size: 1.1rem; margin-right: .2rem; }
.steps .dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); flex: 0 0 auto; }
.steps .done { color: var(--ink); }
.steps .done .dot { background: var(--brand); border-color: var(--brand); }
.steps .now { color: var(--warn); font-weight: 700; }
.steps .now .dot { border-color: var(--warn); background: var(--warn-soft); }
.steps .stop { color: var(--bad); font-weight: 700; }
.steps .stop .dot { border-color: var(--bad); background: var(--bad); }

.sapsel-filter { margin-bottom: .4rem; }
.sapsel-note:empty { display: none; }

.empty { text-align: center; color: var(--muted); padding: 1.5rem .5rem; }
.banner { background: var(--warn-soft); color: var(--warn); font-size: .85rem; text-align: center; padding: .4rem .75rem; }
details > summary { cursor: pointer; color: var(--brand); font-weight: 600; }
