:root{
  /* Einheitlicher Dark Mode – Buttons #ec0016 */
  --bg: #0b0d10;           /* dunkles Grau für Hintergrund */
  --card: #151a21;         /* dunkle Kartenfläche */
  --ink: #e5e7eb;          /* Primärtext hell */
  --accent: #ec0016;       /* Button-/Akzentrot */
  --accent-weak: #2a2f36;  /* dezente Linien/Borders */
  --shadow: rgba(0,0,0,.45);/* neutrale Schatten */
  --muted: #9aa4b2;        /* Sekundärtext */
}
html, body{ height:100%; }
body{ margin:0; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji"; color:var(--ink); background: linear-gradient(#0b0d10, var(--bg)); }
.wrap{ max-width:1100px; margin-inline:auto; padding:16px; }
header.appbar{ position:sticky; top:0; z-index:20; backdrop-filter:saturate(180%) blur(8px); background:rgba(18,21,27,.85); border-bottom:1px solid var(--accent-weak); }
.row{ display:grid; grid-template-columns:1fr; gap:20px; }
@media(min-width:992px){ .row{ grid-template-columns: 1.15fr .85fr; } }

.card{ background:var(--card) !important; border:1px solid var(--accent-weak) !important; border-radius:16px; box-shadow:0 8px 20px var(--shadow) !important; padding:16px; }
h1{ font-size:20px; margin:0; letter-spacing:.3px; color:#fff; }
h2{ font-size:18px; margin:0 0 10px; letter-spacing:.2px; color:#fff; }
.muted{ color:var(--muted); }

label.block{ display:block; font-size:13px; margin:0 0 10px; }
label.block span{ display:block; color:#cbd5e1; margin-bottom:6px; }
input[type="text"], input[type="tel"], input[type="password"], input[type="datetime-local"], input[type="date"], input[type="number"], select{
  width:100%; box-sizing:border-box; padding:10px 12px; border-radius:12px; border:1px solid #2a2f36; font-size:14px; outline:none; background:#0b0f14; color:#e5e7eb;
}
input:focus, select:focus{ box-shadow:0 0 0 3px rgba(255,255,255,.06); border-color:#3b4252; }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator{ filter:invert(.8); }
.controls{ display:flex; gap:10px; flex-wrap:wrap; }
.btn{ appearance:none; cursor:pointer; border-radius:12px; border:1px solid var(--accent); background:var(--accent); color:#fff; padding:10px 14px; font-weight:700; letter-spacing:.2px; }
.btn.alt{ background:#1b2028; color:#e5e7eb; border-color:#2a2f36; }
.btn.danger{ background:#1b2028; color:#fca5a5; border-color:#442628; }
.btn:disabled{ opacity:.5; cursor:not-allowed; }

.grid2{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.grid3{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:12px; }

.sumline{ display:flex; justify-content:space-between; font-weight:800; font-size:16px; margin-top:8px; color:#fff; }
.sep{ height:1px; background:#2a2f36; margin:8px 0; }

/* --- Positionen-Editor --- */
.items-head, .item-row{ display:grid; grid-template-columns: 1fr 84px 110px 110px 40px; gap:8px; align-items:center; }
.items-head{ font-size:12px; color:#cbd5e1; margin-bottom:6px; }
.items-head .num, .item-row .line-total{ text-align:right; }
.item-row{ margin-bottom:8px; }
.item-row .line-total{ font-variant-numeric:tabular-nums; font-size:14px; color:#e5e7eb; white-space:nowrap; }
.item-row .btn.remove{ padding:8px 0; text-align:center; font-size:16px; line-height:1; }
@media(max-width:560px){
  .items-head{ display:none; }
  .item-row{ grid-template-columns: 1fr 64px 84px 40px; }
  .item-row .line-total{ display:none; }
}

/* --- Hinweise / Toast --- */
.warn{ display:none; margin-top:8px; padding:10px 12px; border-radius:12px; border:1px solid #7c2d12; background:#1f1310; color:#fdba74; font-size:13px; }
.warn.show{ display:block; }
#toast{ position:fixed; left:50%; bottom:24px; transform:translateX(-50%); z-index:100; background:#1b2028; color:#e5e7eb; border:1px solid #2a2f36; border-radius:12px; padding:12px 18px; font-size:14px; box-shadow:0 12px 30px rgba(0,0,0,.5); opacity:0; pointer-events:none; transition:opacity .25s; max-width:90vw; }
#toast.show{ opacity:1; }
#toast.error{ border-color:#7f1d1d; color:#fca5a5; }

/* --- Login-Overlay --- */
#loginOverlay{ position:fixed; inset:0; z-index:50; display:none; align-items:center; justify-content:center; background:rgba(6,8,10,.92); backdrop-filter:blur(6px); }
#loginOverlay.show{ display:flex; }
#loginOverlay .card{ width:min(360px, calc(100vw - 40px)); }
#loginError{ display:none; color:#fca5a5; font-size:13px; margin-top:8px; }
#loginError.show{ display:block; }

/* --- Archiv --- */
.archive-filters{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.archive-filters input[type="text"]{ min-width:220px; flex:1 1 220px; }
.archive-filters input[type="date"]{ width:150px; }
#archive{ margin-top:10px; display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:10px; }
#archiveEmpty{ color:var(--muted); font-size:14px; margin-top:10px; }

/* --- Belegfläche – echte Millimeter --- */
.sheet{
  width:100mm; height:150mm; box-sizing:border-box; padding:8mm; background:#fff; color:#000; border-radius:12px; box-shadow:0 12px 30px rgba(0,0,0,.25);
  display:flex; flex-direction:column; gap:2mm; margin-inline:auto;
  font-size:11pt; line-height:1.25; overflow:auto; scrollbar-width:none; -ms-overflow-style:none;
}
.sheet::-webkit-scrollbar{ display:none; }
.center{ text-align:center; }
.logo-box{ display:flex; justify-content:center; }
.logo-box img{ height:18mm; object-fit:contain; }
.fallback-logo{ width:18mm; height:18mm; background:#1f2937; color:#fff; display:flex; align-items:center; justify-content:center; border-radius:5mm; font-weight:900; border:2px solid #fff; }
.tnums{ font-variant-numeric: tabular-nums; }

table.items{ width:100%; border-collapse:collapse; }
table.items th, table.items td{ padding:1.5mm 0; font-size:10pt; }
table.items thead th{ text-align:left; color:#334155; border-bottom:1px dashed #cbd5e1; }
table.items td.qty, table.items td.amount{ text-align:right; }

.note{ font-size:9pt; color:#475569; }

/* --- DRUCK --- */
@page{ size:100mm 150mm; margin:0; }
#printArea{ display:none; position:fixed; left:0; top:0; width:100mm; height:150mm; }
@media print{
  html, body{ background:#fff !important; margin:0 !important; padding:0 !important; }
  #app{ display:none !important; }
  #loginOverlay{ display:none !important; }
  #toast{ display:none !important; }
  #printArea{ display:block !important; }
  #printArea .sheet{ width:100mm !important; height:150mm !important; padding:8mm !important; box-shadow:none !important; border-radius:0 !important; background:#fff !important; overflow:visible !important; }
  #printArea .sheet, #printArea .sheet *{ color:#000 !important; text-shadow:none !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #printArea .sheet .sep{ background:#000 !important; }
  #printArea .sheet table.items thead th{ color:#000 !important; border-bottom-color:#000 !important; }
}
