:root {
  color-scheme: dark;
  --bg: #0c0e13;
  --surface: #14171f;
  --surface-2: #1b1f2a;
  --surface-3: #242938;
  --border: #272c3b;
  --text: #e8eaf1;
  --muted: #8d93a8;
  --accent: #8aa4ff;
  --accent-ink: #0c1230;
  --green: #45d09a;
  --amber: #f2b758;
  --red: #f47c93;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* Kopf */
.top { position: sticky; top: 0; z-index: 20; background: rgba(12, 14, 19, .88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.top-in { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.brand { font-weight: 700; letter-spacing: .2px; color: var(--text); }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 4px; }
.nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); }
.nav a:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.nav a.on { color: var(--text); background: var(--surface-2); }
.top-total { margin-left: auto; text-align: right; line-height: 1.2; }
.top-total small { display: block; color: var(--muted); font-size: 12px; }
.top-total b { font-size: 17px; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px 16px 80px; }

/* Bausteine */
.btn { border: 1px solid var(--border); background: var(--surface-2); padding: 8px 14px; border-radius: 9px; white-space: nowrap; }
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 6px 8px; }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: .5; cursor: default; }
.field { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 8px 11px; min-width: 0; }
.field::placeholder { color: #666d82; }
.field:focus { border-color: var(--accent); outline: none; }
select.field { padding-right: 6px; }

/* Zimmer-Reiter */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 10px; margin: 0 -16px; scrollbar-width: thin; }
.tab { flex: none; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 14px; min-width: 132px; }
.tab:hover { background: var(--surface-2); }
.tab.on { border-color: var(--accent); background: var(--surface-2); }
.tab-name { font-weight: 600; white-space: nowrap; }
.tab-meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.tab.add { min-width: 0; color: var(--muted); align-self: stretch; display: grid; place-items: center; border-style: dashed; }

.room-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 10px 0 12px; }
.room-head h1 { font-size: 22px; margin: 0; }
.room-sum { margin-left: auto; text-align: right; }
.room-sum b { font-size: 20px; }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-bottom: 14px; }
.progress i { display: block; height: 100%; background: var(--green); border-radius: 99px; transition: width .3s; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: transparent; color: var(--muted); border-radius: 99px; padding: 5px 12px; font-size: 13.5px; }
.chip:hover { color: var(--text); }
.chip.on { background: var(--surface-3); color: var(--text); border-color: var(--surface-3); }
.sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }

.add-form { display: flex; gap: 8px; margin-bottom: 14px; }
.add-form .field:first-child { flex: 1; }

/* Listenpunkte */
.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 7px 12px;
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto auto auto; align-items: center; gap: 4px 10px;
  grid-template-areas: "grip check main prio qty price more" "panel panel panel panel panel panel panel"; }
.item.done { opacity: .62; }
.item.done .name { text-decoration: line-through; text-decoration-color: var(--muted); }
.item.dragging { opacity: .35; }
.item.drop-before { box-shadow: 0 -2px 0 var(--accent); }
.item.drop-after { box-shadow: 0 2px 0 var(--accent); }
.grip { grid-area: grip; border: 0; background: none; color: #555c70; cursor: grab; padding: 4px 2px; font-size: 16px; line-height: 1; touch-action: none; }
.grip:disabled { visibility: hidden; }
.check { grid-area: check; width: 20px; height: 20px; accent-color: var(--green); cursor: pointer; margin: 0; }
.main { grid-area: main; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.name { flex: 0 1 36%; min-width: 0; background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 2px 6px; margin-left: -6px; font-weight: 600; font-size: 15.5px; text-overflow: ellipsis; }
.name:hover { border-color: var(--border); }
.name:focus { border-color: var(--accent); background: var(--surface-2); outline: none; }

.product { display: flex; align-items: center; gap: 10px; flex: 1 1 0; min-width: 0; font-size: 13.5px; }
.thumb { flex: none; width: 38px; height: 38px; border-radius: 8px; object-fit: contain; background: #fff; }
.thumb.empty { background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.p-info { min-width: 0; flex: 1; }
.p-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.p-meta { color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link-in { flex: 1; font-size: 13.5px; padding: 6px 10px; border-style: dashed; background: transparent; }
.note { flex: 1 1 100%; font-size: 13px; border-radius: 8px; padding: 6px 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.note.warn { background: rgba(242, 183, 88, .1); color: var(--amber); }
.note.err { background: rgba(244, 124, 147, .1); color: var(--red); }
.note .btn { padding: 3px 10px; font-size: 12.5px; color: var(--text); }
.spin { width: 14px; height: 14px; border: 2px solid var(--surface-3); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.prio { grid-area: prio; min-width: 104px; border: 0; border-radius: 99px; padding: 4px 8px; font-size: 12.5px; font-weight: 600; appearance: none; text-align: center; cursor: pointer; }
.prio option { background: var(--surface-2); color: var(--text); }
.prio-muss, .tag-muss { background: rgba(244, 124, 147, .16); color: var(--red); }
.prio-bald, .tag-bald { background: rgba(242, 183, 88, .15); color: var(--amber); }
.prio-spaeter, .tag-spaeter { background: rgba(141, 147, 168, .16); color: #b3b8c9; }
.qty { grid-area: qty; display: flex; align-items: center; gap: 3px; color: var(--muted); font-size: 13px; }
.qty input { width: 46px; padding: 4px 6px; text-align: center; }
.price { grid-area: price; text-align: right; min-width: 104px; }
.price-btn { background: none; border: 1px solid transparent; border-radius: 8px; padding: 3px 8px; font-weight: 700; font-size: 16px; }
.price-btn:hover { border-color: var(--border); background: var(--surface-2); }
.price-btn.none { font-weight: 400; font-size: 13.5px; color: var(--muted); border-style: dashed; border-color: var(--border); }
.price-in { width: 104px; text-align: right; padding: 4px 8px; }
.price small { display: block; color: var(--muted); font-size: 12px; padding-right: 8px; }
.old { text-decoration: line-through; }
.more { grid-area: more; }
.panel { grid-area: panel; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 10px; margin-top: 6px; border-top: 1px solid var(--border); }
.panel .url { flex: 1 1 260px; }
.panel label { color: var(--muted); font-size: 13px; }
.empty-state { text-align: center; color: var(--muted); padding: 40px 16px; border: 1px dashed var(--border); border-radius: var(--radius); }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--surface-3); border: 1px solid var(--border); padding: 10px 16px; border-radius: 10px; z-index: 50; max-width: calc(100vw - 32px); box-shadow: 0 8px 30px rgba(0, 0, 0, .5); }
.toast.err { border-color: var(--red); }

/* Statistik */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.tile small { color: var(--muted); display: block; margin-bottom: 2px; }
.tile b { font-size: 24px; display: block; }
.tile .sub { color: var(--muted); font-size: 12.5px; }
.tile.hero { border-color: var(--accent); }
.tile .pos { color: var(--green); }
.tile .neg { color: var(--red); }
.budget-in { width: 100%; font-size: 20px; font-weight: 700; padding: 4px 8px; margin: 2px 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card h2 { margin: 0 0 12px; font-size: 16px; }
.card-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 3fr 2fr; gap: 14px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 { margin-bottom: 14px; }
.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(96px, 150px) 1fr auto; gap: 10px; align-items: center; }
.bar-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .lbl small { display: block; color: var(--muted); font-size: 12px; }
.bar { height: 14px; background: var(--surface-2); border-radius: 5px; display: flex; overflow: hidden; gap: 2px; }
.bar i { display: block; height: 100%; }
.b-done { background: var(--green); }
.b-open { background: var(--accent); }
.bar-row .val { text-align: right; min-width: 92px; font-weight: 600; }
.legend { display: flex; gap: 16px; color: var(--muted); font-size: 12.5px; margin-top: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.notice { border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; background: rgba(242, 183, 88, .09); color: var(--amber); border: 1px solid rgba(242, 183, 88, .25); }
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12.5px; padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th button { background: none; border: 0; color: inherit; padding: 0; font: inherit; }
th button:hover, th button.on { color: var(--text); }
td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
.tag { display: inline-block; border-radius: 99px; padding: 1px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag-ok { background: rgba(69, 208, 154, .15); color: var(--green); }
.tag-open { background: rgba(138, 164, 255, .15); color: var(--accent); }
.tag-warn { background: rgba(242, 183, 88, .15); color: var(--amber); }
.missing { display: flex; flex-wrap: wrap; gap: 6px; }
.missing-room { margin: 14px 0 8px; font-size: 13.5px; color: var(--muted); font-weight: 500; }
.missing-room:first-of-type { margin-top: 0; }
.missing a { background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 3px 11px; font-size: 13px; color: var(--text); }
.missing a small { color: var(--muted); }
.changes { margin: 10px 0 0; padding: 0; list-style: none; font-size: 13.5px; display: grid; gap: 4px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: 100%; max-width: 340px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; display: grid; gap: 12px; }
.login h1 { margin: 0 0 4px; font-size: 24px; }
.login h1 span { color: var(--accent); }
.login p { margin: 0 0 6px; color: var(--muted); }
.login .err { color: var(--red); font-size: 13.5px; min-height: 20px; margin: 0; }

@media (max-width: 760px) {
  .top-in { gap: 8px; padding: 8px 12px; }
  .nav a { padding: 6px 9px; }
  .logout { display: none; }
  .item { grid-template-columns: 24px auto auto minmax(0, 1fr) 36px; padding: 10px;
    grid-template-areas: "check main main main more" "prio prio qty price price" "panel panel panel panel panel"; }
  .more { padding: 6px 0; justify-self: end; width: 36px; }
  .grip { display: none; }
  .main { flex-direction: column; align-items: stretch; }
  .name { flex: none; width: 100%; }
  .product { flex: none; }
  .sep { display: none; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
  .chip { flex: none; }
  .toolbar { display: grid; }
  .room-sum { margin-left: 0; text-align: left; flex-basis: 100%; }
  .room-head .btn { padding: 4px 6px; font-size: 13.5px; }
  .prio { justify-self: start; }
  .room-head h1 { font-size: 19px; }
  .grid-2 { grid-template-columns: 1fr; }
  .add-form { flex-wrap: wrap; }
  .add-form .field:first-child { flex: 1 1 100%; }
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-row .bar { grid-column: 1 / -1; grid-row: 2; }
}

/* Import und Screenshot */
.shot { padding: 4px 6px; flex: none; filter: grayscale(1); opacity: .75; }
.shot:hover { filter: none; opacity: 1; }
.note a.btn { padding: 3px 10px; font-size: 12.5px; color: var(--text); }
.note a.btn:hover { text-decoration: none; }
.page-title { font-size: 22px; margin: 6px 0 6px; }
.lead { margin: 0 0 16px; max-width: 640px; }
.steps { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 8px; }
.bm { display: inline-block; cursor: grab; margin-left: 6px; }
.bm:hover { text-decoration: none; }
.import-card { max-width: 560px; display: grid; gap: 14px; }
.import-head { display: flex; gap: 14px; align-items: center; min-width: 0; }
.import-head b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.thumb.big { width: 72px; height: 72px; }
.form-row { display: grid; gap: 5px; }
.form-row span { color: var(--muted); font-size: 13px; }
.import-price { font-size: 28px; font-weight: 700; }
.import-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.import-card .btn.primary { display: inline-flex; gap: 8px; align-items: center; justify-content: center; }
.ki-box { display: flex; gap: 10px; align-items: center; background: rgba(138, 164, 255, .1); border: 1px solid rgba(138, 164, 255, .25); border-radius: 9px; padding: 9px 12px; font-size: 14px; }
