/* LAVRIELLE – Admin-Bereich. Baut auf base.css (Farben, Knöpfe, Formulare, Statusmarken) auf. */
[hidden] { display: none !important; }
body.admin { font-size: 15px; overflow-x: hidden; }
body.admin main { min-height: 0; padding-bottom: 64px; }
body.admin h1 { font-size: clamp(1.7rem, 3vw, 2.2rem); margin-bottom: .2em; }
body.admin p { margin-bottom: .7em; }

/* Lade- und Sperrzustand */
.admin-state { max-width: 520px; margin: 0 auto; padding: 96px 16px; text-align: center; }
.state { padding: 20px 0; margin: 0; }

/* Grundgerüst */
.admin-shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--paper); border-right: 1px solid var(--line); }
.side-head { display: flex; align-items: baseline; gap: 10px; padding: 22px 20px 14px; }
.side-logo { font-family: var(--serif); font-size: 1.1rem; letter-spacing: .14em; text-decoration: none; font-weight: 500; overflow-wrap: anywhere; }
.side-tag { font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
.side-toggle { display: none; margin-left: auto; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); background: transparent; font: inherit; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: inherit; cursor: pointer; }
.side-nav { display: flex; flex-direction: column; padding: 4px 0 20px; position: sticky; top: 0; }
.side-nav > a { padding: 9px 20px; text-decoration: none; font-size: .9rem; border-left: 3px solid transparent; }
.side-nav > a:hover { background: var(--ivory); }
.side-nav > a[aria-current="page"] { border-left-color: var(--gold); background: var(--ivory); font-weight: 600; }
.side-foot { margin-top: 18px; padding: 16px 20px 0; border-top: 1px solid var(--line); display: grid; gap: 10px; justify-items: start; font-size: .9rem; }
.side-user { margin: 0; overflow-wrap: anywhere; }
.side-out { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.view { min-width: 0; padding: 28px 32px 64px; outline: none; }
.section { max-width: 1280px; }

@media (max-width: 900px) {
  .admin-shell { display: block; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
  .side-head { align-items: center; padding: 10px 16px; }
  .side-logo { font-size: 1.1rem; letter-spacing: .16em; }
  .side-toggle { display: block; }
  .side-nav { display: none; position: static; max-height: calc(100vh - 62px); overflow-y: auto; padding-top: 0; }
  .side-nav.is-open { display: flex; }
  .side-nav > a { padding: 12px 16px; border-top: 1px solid var(--line); }
  .side-foot { padding: 16px; margin-top: 0; }
  .view { padding: 20px 16px 56px; }
  body.admin .panel { padding: 16px; }
}

/* Kopf einer Ansicht, Filter */
.sec-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 20px; margin-bottom: 18px; }
.sec-head h1 { margin-bottom: 0; overflow-wrap: anywhere; }
.sec-head p { margin: 6px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.crumb { margin-bottom: 10px; font-size: .88rem; }
.filters { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin-bottom: 4px; }
.filters .field { margin-bottom: 0; min-width: 160px; }
.filters .grow, .grow { flex: 1 1 220px; }
.filters input, .filters select { min-height: 40px; padding: 7px 10px; }
.filter-check { min-height: 40px; align-items: center; margin-bottom: 0; }
.filter-check input { margin-top: 0; }
.form-error:empty { min-height: 0; margin: 0; }
.form-error { margin: 8px 0; }
.error-list { margin: 0; padding-left: 18px; }
.btn-danger { border-color: var(--error); color: var(--error); }
.btn-danger:hover { background: var(--error); border-color: var(--error); color: #fff; }
.upper { text-transform: uppercase; }
.narrow { max-width: 640px; }
.wrap-row { flex-wrap: wrap; }

/* Blöcke und Raster */
.block { margin-bottom: 20px; }
.block-title { font-family: var(--sans); font-size: .78rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 14px; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.mini { font-family: var(--sans); font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 6px; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 16px; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.detail > *, .split > *, .cols-2 > *, .cols-3 > * { min-width: 0; }
@media (max-width: 1100px) {
  .detail, .split, .cols-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) { .cols-3 { grid-template-columns: minmax(0, 1fr); gap: 12px; } }

/* Tabellen */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); background: var(--paper); margin-bottom: 12px; }
.panel .table-wrap { border-width: 1px 0; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .7rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--ivory); }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; line-height: 1.4; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fbf8f2; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table td a { text-underline-offset: 3px; }
.cell-text { min-width: 180px; max-width: 320px; overflow-wrap: anywhere; }
.row-actions { white-space: nowrap; }
.row-actions .link { font-size: .85rem; margin-left: 10px; }
.thumb-cell { width: 60px; }
.thumb { width: 44px; height: 55px; object-fit: cover; background: var(--gold-soft); display: block; }
.thumb-empty { border: 1px dashed var(--line); background: transparent; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px 14px; }
.pager .muted { margin-right: auto; }
.stock-num { font-variant-numeric: tabular-nums; font-weight: 600; }
.stock-num.is-low { color: var(--gold); }
.stock-num.is-out { color: var(--error); }
.delta-plus { color: var(--ok); font-weight: 600; }
.delta-minus { color: var(--error); font-weight: 600; }

/* Eingaben in Tabellen */
.in-sm, body.admin .table-form input[type=text] { min-height: 36px; padding: 5px 8px; font-size: .9rem; }
.in-sku { min-width: 170px; }
.in-size { min-width: 84px; }
.in-color { min-width: 110px; }
.in-name { min-width: 180px; }
.in-reason { min-width: 170px; }
.in-num { min-width: 76px; max-width: 110px; }
.in-qty { width: 56px; min-width: 56px; text-align: center; }
.in-swatch { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; }
.field-num { flex: 0 0 120px; }
.field-swatch { flex: 0 0 auto; }
.stepper { display: flex; align-items: center; gap: 4px; }
.icon-btn { width: 36px; height: 36px; flex: none; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: inherit; font-size: 1.05rem; line-height: 1; cursor: pointer; }
.icon-btn:hover { border-color: var(--ink); }
.icon-btn[disabled] { opacity: .35; cursor: not-allowed; }

/* Status-Ergänzungen (Produkte, Versand, Gutscheine) */
.status-active { border-color: var(--ok); color: var(--ok); }
.status-draft { border-color: var(--gold); color: var(--gold); }
.status-archived { color: var(--ink-soft); }
.status-shipped { border-color: var(--ink); }

/* Dashboard */
.seg { display: inline-flex; border: 1px solid var(--ink); }
.seg-btn { min-height: 38px; padding: 0 14px; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: .78rem; letter-spacing: .08em; cursor: pointer; }
.seg-btn + .seg-btn { border-left: 1px solid var(--ink); }
.seg-btn[aria-pressed="true"] { background: var(--ink); color: var(--ivory); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.tiles > .state { grid-column: 1 / -1; }
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .tiles { gap: 10px; } }
.tile { background: var(--paper); border: 1px solid var(--line); padding: 16px 18px; min-width: 0; }
.tile-label { margin: 0 0 4px; font-size: .7rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.tile-value { margin: 0; font-family: var(--serif); font-size: clamp(1.5rem, 2.6vw, 2.1rem); line-height: 1.15; font-variant-numeric: tabular-nums lining-nums; overflow-wrap: anywhere; }
.tile-hint { margin: 2px 0 0; }
.chart { position: relative; overflow: hidden; min-height: 240px; }
.chart-svg { display: block; max-width: 100%; touch-action: pan-y; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-base { stroke: var(--ink-soft); stroke-width: 1; }
.chart-axis { fill: var(--ink-soft); font: 11px var(--sans); font-variant-numeric: tabular-nums; }
.chart-bar { fill: var(--gold); }
.chart-band:hover .chart-bar { fill: var(--ink); }
.chart-band:hover .chart-hit { fill: rgba(23, 19, 15, .05); }
.chart-tip { position: absolute; left: 0; top: 0; z-index: 2; display: grid; gap: 2px; padding: 8px 12px; background: var(--ink); color: var(--ivory); font-size: .8rem; line-height: 1.35; white-space: nowrap; pointer-events: none; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); }
.chart-details { margin-top: 10px; font-size: .88rem; }
.chart-details summary { cursor: pointer; color: var(--ink-soft); }
.chart-details .table-wrap { margin-top: 10px; max-height: 320px; overflow-y: auto; }
.plain-list { list-style: none; margin: 0 0 8px; padding: 0; }
.plain-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }
.plain-list .stock-num { margin-left: auto; }

/* Bestelldetails */
.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 24px; margin: 14px 0 0 auto; max-width: 380px; font-variant-numeric: tabular-nums; }
.totals dt { margin: 0; }
.totals dd { margin: 0; text-align: right; }
.totals .total { font-weight: 600; font-size: 1.05rem; padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--line); }
.address { margin: 0 0 8px; line-height: 1.5; overflow-wrap: anywhere; }
.note { margin: 0; padding: 10px 14px; background: var(--gold-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.events { list-style: none; margin: 0; padding: 0; }
.events li { padding: 7px 0 7px 14px; border-left: 2px solid var(--line); }
.events li .muted { display: block; }

/* Produkteditor */
.images { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; }
.image-item { display: flex; gap: 10px; padding: 8px; border: 1px solid var(--line); background: var(--ivory); }
.image-item img { width: 88px; height: 110px; object-fit: cover; background: var(--gold-soft); }
.image-tools { display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }
.image-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
input[type=file] { max-width: 100%; font: inherit; font-size: .88rem; }
.gen { border: 1px dashed var(--line); padding: 14px 16px 16px; margin: 16px 0 0; min-width: 0; }
.gen legend, .checks legend { padding: 0 6px; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.gen-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }
.checks { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.checks legend { padding: 0; margin-bottom: 6px; }
.checks .check { margin-bottom: 6px; }

/* Rückfrage */
.dialog { width: min(92vw, 440px); padding: 24px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
.dialog::backdrop { background: rgba(23, 19, 15, .45); }
.dialog h2 { font-size: 1.5rem; }
.dialog p { color: var(--ink-soft); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* Lieferschein: nur im Druck sichtbar */
#print-area { display: none; }
@media print {
  body.admin { background: #fff; color: #000; font-size: 11pt; overflow: visible; }
  body.admin > *:not(#print-area) { display: none !important; }
  #print-area { display: block; }
  .slip { padding: 0; }
  .slip-shop { font-family: var(--serif); font-size: 20pt; letter-spacing: .24em; margin: 0 0 18pt; }
  .slip h1 { font-family: var(--sans); font-size: 14pt; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin: 0 0 14pt; }
  .slip h2 { font-family: var(--sans); font-size: 8pt; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #555; margin: 0 0 4pt; }
  .slip-meta { display: flex; gap: 28pt; margin-bottom: 20pt; }
  .slip-meta > div { flex: 1; }
  .slip-meta p { margin: 0; line-height: 1.45; }
  .slip-table { width: 100%; border-collapse: collapse; }
  .slip-table th { text-align: left; font-size: 8pt; letter-spacing: .08em; text-transform: uppercase; padding: 5pt 6pt; border-bottom: 1pt solid #000; }
  .slip-table td { padding: 6pt; border-bottom: .5pt solid #999; }
  .slip-table .num { text-align: right; }
  .slip-table tr { break-inside: avoid; }
  .slip-foot { margin-top: 20pt; font-size: 9pt; color: #444; }
  @page { margin: 18mm; }
}
