/* VETEXPERT ERP – pine & mint, built for long days at the warehouse desk and a tablet on the shelf */
:root {
  --pine: #17433F;
  --pine-2: #20564F;
  --mint: #E6F0EC;
  --mint-2: #D3E5DE;
  --paper: #F5F8F7;
  --surface: #FFFFFF;
  --ink: #1C2623;
  --muted: #5D6C67;
  --line: #DCE4E1;
  --amber: #A35F00;
  --amber-bg: #FFF3DE;
  --red: #B42318;
  --red-bg: #FDECEA;
  --sky: #2B6A99;
  --sky-bg: #E7F0F7;
  --ok: #1E7A4C;
  --ok-bg: #E5F4EC;
  --radius: 6px;
  --font: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--paper); line-height: 1.45; font-variant-numeric: tabular-nums; }
a { color: var(--pine); }
a:hover { color: var(--pine-2); }
:focus-visible { outline: 3px solid #7FB8A7; outline-offset: 2px; border-radius: 3px; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; font-weight: 650; margin-bottom: .75rem; }
small, .muted { color: var(--muted); }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .92em; }

/* shell */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--pine); color: #DDEBE6; padding: 22px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; color: #fff; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: #fff; color: var(--pine); display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.brand b { display: block; font-size: 1rem; letter-spacing: .01em; }
.brand span { font-size: .78rem; color: #A9C9BF; }
.nav a { display: flex; align-items: center; gap: 10px; color: #DDEBE6; text-decoration: none; padding: 8px 10px; border-radius: var(--radius); font-size: .95rem; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.on { background: #fff; color: var(--pine); font-weight: 650; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav .group { margin: 18px 10px 6px; font-size: .78rem; color: #93B8AD; }
.nav .soon { color: #8AAFA4; cursor: default; }
.nav .soon:hover { background: none; color: #8AAFA4; }
.nav .soon em { margin-left: auto; font-style: normal; font-size: .72rem; border: 1px solid #4F7D74; border-radius: 99px; padding: 0 7px; }
.side-foot { margin-top: 26px; padding: 14px 10px 0; border-top: 1px solid rgba(255,255,255,.12); font-size: .85rem; }
.side-foot form { display: inline; }
.side-foot button { background: none; border: 0; color: #CFE3DC; padding: 0; cursor: pointer; font: inherit; text-decoration: underline; }
.main { padding: 28px 34px 60px; max-width: 1320px; width: 100%; min-width: 0; }
.topbar { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 8px 14px; border-radius: var(--radius); font: inherit; font-size: .93rem; font-weight: 550; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #B7C8C2; color: var(--ink); }
.btn.primary { background: var(--pine); border-color: var(--pine); color: #fff; }
.btn.primary:hover { background: var(--pine-2); }
.btn.danger { color: var(--red); }
.btn.small { padding: 4px 10px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; color: var(--red); cursor: pointer; font: inherit; padding: 0; }

/* panels & tables */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; margin-bottom: 20px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush > h2 { padding: 16px 20px 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: .83rem; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #FAFCFB; position: sticky; top: 0; white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid #EDF2F0; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #F8FBFA; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.neg { color: var(--red); }
td.pos { color: var(--ok); }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.sku { font-weight: 600; white-space: nowrap; }

/* warehouse chips – the one visual thread through the app */
.wh { display: inline-block; font-size: .78rem; font-weight: 700; padding: 1px 7px; border-radius: 4px; letter-spacing: .02em; white-space: nowrap; }
.wh-VET-01 { background: var(--pine); color: #fff; }
.wh-RIC-02 { background: var(--sky-bg); color: var(--sky); box-shadow: inset 0 0 0 1px #B9D2E6; }

/* MHD pills */
.mhd { display: inline-flex; gap: 6px; align-items: baseline; font-size: .86rem; padding: 1px 8px; border-radius: 99px; white-space: nowrap; background: #F1F4F3; }
.mhd i { font-style: normal; font-size: .78rem; color: var(--muted); }
.mhd.l-abgelaufen { background: var(--red-bg); color: var(--red); }
.mhd.l-30 { background: var(--red-bg); color: var(--red); }
.mhd.l-60 { background: var(--amber-bg); color: var(--amber); }
.mhd.l-90 { background: #FBF6E9; color: #7A5A12; }
.mhd.l-abgelaufen i, .mhd.l-30 i, .mhd.l-60 i, .mhd.l-90 i { color: inherit; opacity: .8; }

.badge { display: inline-block; font-size: .78rem; padding: 1px 8px; border-radius: 99px; font-weight: 600; }
.badge.Entwurf { background: var(--amber-bg); color: var(--amber); }
.badge.Gebucht { background: var(--ok-bg); color: var(--ok); }
.badge.set { background: var(--sky-bg); color: var(--sky); }
.badge.probe, .badge.inaktiv { background: #EEF1F0; color: var(--muted); }

/* dashboard */
.shelves { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; margin-bottom: 20px; }
.shelf { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px 16px; position: relative; overflow: hidden; }
.shelf::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--pine); }
.shelf.kommission::before { background: var(--sky); }
.shelf h2 { display: flex; gap: 10px; align-items: center; margin: 0 0 14px; font-size: 1rem; }
.shelf .figures { display: flex; gap: 28px; flex-wrap: wrap; }
.shelf .figure b { display: block; font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.shelf .figure span { color: var(--muted); font-size: .85rem; }
.shelf .note { margin: 14px 0 0; font-size: .85rem; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.grid2 > *, .shelves > * { min-width: 0; }
.mhd-strip { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: #EEF2F1; margin: 4px 0 12px; }
.mhd-strip span { display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }
.steps { margin: 0; padding-left: 1.3rem; }
.steps li { margin: 0 0 12px; }
.steps li b { display: block; }

/* forms */
form.stack { display: grid; gap: 14px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 18px; }
label { display: grid; gap: 5px; font-size: .88rem; font-weight: 600; color: #34413D; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
input, select, textarea { font: inherit; font-size: .95rem; color: var(--ink); background: #fff; border: 1px solid #C9D6D1; border-radius: var(--radius); padding: 8px 10px; width: 100%; }
input[type=checkbox] { width: auto; }
input:focus, select:focus, textarea:focus { border-color: var(--pine); outline: 2px solid #CFE4DC; outline-offset: 0; }
textarea { min-height: 70px; }
.hint { font-weight: 400; color: var(--muted); font-size: .82rem; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters label { font-size: .8rem; }
.filters input, .filters select { padding: 7px 9px; min-width: 150px; }
.lines td { padding: 6px 6px; }
.lines input { padding: 7px 8px; }
.lines .c-sku { min-width: 150px; }
.lines .c-name { color: var(--muted); font-size: .85rem; min-width: 180px; padding-top: 13px; }
.lines .c-qty { width: 90px; }
.lines .c-mhd { width: 140px; }
.lines .c-del button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1.2rem; padding: 4px 8px; }
.lines .c-del button:hover { color: var(--red); }

/* messages */
.flash { padding: 11px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: .93rem; border: 1px solid; }
.flash.ok { background: var(--ok-bg); border-color: #B5DCC6; color: #145A37; }
.flash.error { background: var(--red-bg); border-color: #F1B8B2; color: #8A1C12; }
.errors { background: var(--red-bg); border: 1px solid #F1B8B2; color: #8A1C12; border-radius: var(--radius); padding: 10px 14px 10px 30px; margin: 0 0 16px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 16px; font-size: .88rem; color: var(--muted); }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: .93rem; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--pine); padding: 20px; }
.login .card { background: #fff; border-radius: 10px; padding: 32px 30px; width: 100%; max-width: 380px; }
.login h1 { font-size: 1.35rem; margin-bottom: 4px; }
.login p { margin: 0 0 22px; color: var(--muted); }

/* print: delivery note */
.print-only { display: none; }
@media print {
  .side, .no-print, .flash { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  .panel { border: 0; padding: 0; }
  .print-only { display: block; }
  body { background: #fff; font-size: 11pt; }
  th { background: #fff; }
}

/* tablet & phone */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 30% 0 0; max-width: 300px; z-index: 20; transform: translateX(-102%); transition: transform .18s ease; height: 100%; }
  body.nav-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .topbar { display: flex; align-items: center; gap: 12px; background: var(--pine); color: #fff; padding: 10px 16px; position: sticky; top: 0; z-index: 10; }
  .topbar button { background: none; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 6px; padding: 5px 10px; font: inherit; }
  .main { padding: 18px 16px 50px; }
  .grid2 { grid-template-columns: 1fr; }
  h1 { font-size: 1.35rem; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }

/* deliveries: upload, checks, review */
.drop { position: relative; display: grid; justify-items: center; text-align: center; gap: 6px; min-height: 170px; border: 2px dashed #A9C4BB; border-radius: 10px; background: var(--mint); padding: 28px 20px; color: var(--pine); font-weight: 400; cursor: pointer; }
.drop.over { background: var(--mint-2); border-color: var(--pine); }
.drop svg { width: 34px; height: 34px; }
.drop b { font-size: 1.1rem; }
.drop input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop:focus-within { outline: 3px solid #7FB8A7; outline-offset: 2px; }
.drop-files { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: .9rem; color: var(--ink); text-align: left; }
.drop-files li { display: flex; gap: 8px; align-items: baseline; }
.drop-files em { font-style: normal; font-size: .75rem; font-weight: 700; padding: 0 7px; border-radius: 4px; background: #fff; color: var(--pine); box-shadow: inset 0 0 0 1px #A9C4BB; }
.stats { display: flex; flex-wrap: wrap; gap: 12px 36px; }
.stats b { display: block; font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.stats span { color: var(--muted); font-size: .85rem; }
.docs { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.docs a { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.docs svg { width: 16px; height: 16px; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; font-size: .93rem; }
.checks li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; }
.checks li::before { content: "✓"; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 800; background: var(--ok-bg); color: var(--ok); }
.checks li.hinweis::before { content: "!"; background: var(--amber-bg); color: var(--amber); }
.checks li.fehler::before { content: "×"; background: var(--red-bg); color: var(--red); font-size: 1rem; }
.checks .src { font-weight: 650; margin-right: 8px; }
.badge.Offen { background: var(--amber-bg); color: var(--amber); }
.badge.Übernommen { background: var(--ok-bg); color: var(--ok); }
.badge.Verworfen { background: #EEF1F0; color: var(--muted); }
.badge.fehler { background: var(--red-bg); color: var(--red); }
tr.unmatched td { background: #FFF7F6; }
.diff-up { color: var(--red); font-weight: 600; }
.diff-down { color: var(--ok); font-weight: 600; }
details.invoice > summary { cursor: pointer; padding: 15px 20px; display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; list-style: none; }
details.invoice > summary::-webkit-details-marker { display: none; }
details.invoice > summary h2 { margin: 0; }
details.invoice > summary::before { content: "▸"; color: var(--muted); }
details.invoice[open] > summary::before { content: "▾"; }
details.invoice[open] > summary { border-bottom: 1px solid var(--line); }
.checklist td.box span { display: inline-block; width: 16px; height: 16px; border: 1.5px solid #7D8C87; border-radius: 3px; vertical-align: middle; }
.checklist th.box, .checklist td.box { width: 30px; }
.checklist td.ist, .checklist th.ist { width: 90px; border-left: 1px solid var(--line); }
@media print {
  .checklist { break-inside: auto; margin-bottom: 18px; }
  .checklist h2 { padding: 0 0 6px !important; }
  .checklist td { padding: 5px 6px; }
}
.mhd-sum { margin: 0 0 10px; font-size: .93rem; }

/* statistics */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; min-width: 0; }
.tile h2 { font-size: .85rem; font-weight: 600; color: var(--muted); margin: 0 0 6px; }
.tile b { display: block; font-size: 1.45rem; letter-spacing: -0.02em; line-height: 1.2; }
.tile b.neg { color: var(--red); }
.tile span { font-size: .85rem; color: var(--muted); }
.tile.wide { grid-column: span 2; }
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #EDF2F0; stroke-width: 1; }
.chart .axis { stroke: #B7C8C2; stroke-width: 1; }
.chart .tick { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.chart .bar { cursor: default; }
.s-in { fill: #1F8A6E; background: #1F8A6E; }
.s-out { fill: #C46A1E; background: #C46A1E; }
.chart .bar:hover, .chart .bar.on { opacity: .82; }
.chart-legend i { border-radius: 2px; }
.chart-tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: .82rem; padding: 5px 9px; border-radius: 5px; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -8px; }
.shelf .figures.values { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); gap: 22px; }
.shelf .figures.values b { font-size: 1.2rem; }
@media (max-width: 900px) { .tile.wide { grid-column: auto; } }
