@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;0,700;1,500&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --charcoal: #4D4D4D;
  --charcoal-dark: #3F3F3F;
  --gold: #C9A66B;
  --gold-hover: #B89454;
  --gold-glow: rgba(201,166,107,0.18);
  --paper: #F7F5EF;
  --card: #FFFFFF;
  --ink: #101828;
  --muted: #667085;
  --border: #E6E2DA;
  --input-border: #D8D2C7;
  --green: #2FA463;
  --warn: #B06A2C;
  --red: #C0392B;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', system-ui, 'Segoe UI', sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 100%;
  min-height: 100vh;
  margin: 0 auto;
}

/* ── Sticky header ── */
.hd {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, var(--charcoal-dark) 0%, var(--charcoal) 100%);
  border-bottom: 1px solid var(--gold);
}

.hd-top {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 16px 10px;
}

.hd-logo {
  display: block;
  height: 68px;
  width: auto;
  max-width: 286px;
  filter: brightness(0) invert(1);
  object-fit: contain;
}

/* Info strip — non-clickable */
.hd-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  row-gap: 4px;
  padding: 4px 16px 12px;
}

.hd-strip-break {
  flex-basis: 100%;
  height: 0;
}

.hd-strip-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: rgba(255,255,255,0.82);
  font-size: 11.5px;
  font-weight: 500;
  pointer-events: none;
  white-space: nowrap;
}

.hd-strip-item.trip {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.92);
  justify-content: center;
  width: 100%;
}

.hd-strip-icon {
  color: var(--gold);
  display: flex;
  align-items: center;
  flex: none;
}

.hd-strip-sep {
  width: 1px;
  height: 14px;
  background: rgba(201,166,107,0.4);
  margin: 0 10px;
  flex: none;
}

/* Bottom nav */
.nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: flex;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, var(--charcoal-dark), var(--charcoal));
  border-top: 1px solid var(--gold);
}

.nav:empty {
  display: none;
}

.nav .navback {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  border: 1px solid rgba(201,166,107,0.45);
  border-radius: 14px;
  background: rgba(201,166,107,0.12);
  color: var(--gold);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.nav .navback:active {
  background: rgba(201,166,107,0.22);
}

.nav .navback .ico {
  font-size: 22px;
  line-height: 1;
}

body.has-nav .body {
  padding-bottom: 92px;
}

/* ── Body content ── */
.body {
  padding: 20px 16px 24px;
}

/* Page header (in body) */
.page-hd {
  margin-bottom: 24px;
}

.page-hd .eb {
  display: block;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.page-hd h1 {
  margin: 0 0 4px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(36px, 10vw, 52px);
  font-weight: 600;
  line-height: 1.1;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.page-hd .page-sub {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
}

/* Progress bar */
.bar {
  height: 5px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--border);
}

.bar > i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--gold);
  transition: width 0.4s ease;
}

.barlbl {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--muted);
}

/* Section label */
h2.t {
  margin: 0 0 14px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
}

/* ── Form fields ── */
.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* Select wrapper */
.select-wrap {
  position: relative;
}

.proj-select {
  width: 100%;
  min-height: 50px;
  padding: 13px 40px 13px 14px;
  border: 1px solid var(--input-border);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
}

.proj-select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.select-chevron {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold);
  font-size: 18px;
  pointer-events: none;
  line-height: 1;
}

/* Text input */
input[type="text"] {
  width: 100%;
  min-height: 50px;
  padding: 13px 14px;
  border: 1px solid var(--input-border);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  outline: none;
}

input[type="text"]:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

/* CTA button */
.cta {
  width: 100%;
  min-height: 50px;
  padding: 15px;
  border: none;
  border-radius: 14px;
  background: var(--charcoal);
  color: var(--gold);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.15s;
}

.cta:hover {
  background: var(--charcoal-dark);
}

.cta:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Status dot (header strip) */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(47,164,99,0.25);
  flex: none;
  display: inline-block;
}

.dot.wait {
  background: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.dot.err {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(176,106,44,0.22);
}

/* ── Department cards ── */
.abt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  margin-bottom: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  text-align: left;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.abt:active {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-glow);
}

.abt .copy {
  min-width: 0;
  flex: 1;
}

.abt .nm {
  display: block;
  font-size: 16px;
  font-weight: 600;
}

.abt .mt {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
}

.pres {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
}

.pres::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(47,164,99,0.18);
}

.abt .ring {
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  flex: none;
}

.abt .arr {
  color: var(--gold);
  font-size: 20px;
  flex: none;
}

/* Secondary buttons */
.secondary {
  width: 100%;
  min-height: 50px;
  margin-top: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--charcoal);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s;
}

.secondary:active {
  border-color: var(--gold);
}

/* Subgroup heading */
.subh {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 9px;
  padding-left: 2px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.subh::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Item rows ── */
.item {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: 60px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  text-align: left;
}

.itemwrap {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 9px;
}

.tick {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 54px;
  border: none;
  background: none;
  cursor: pointer;
}

.tick .circ {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-radius: 50%;
  color: #fff;
  font-size: 17px;
}

.item.korb .circ {
  border-color: var(--gold);
  background: var(--gold);
}

.item.korb .nm {
  color: var(--muted);
  text-decoration: line-through;
}

.main {
  display: flex;
  flex: 1;
  align-items: center;
  min-width: 0;
  padding: 10px 12px 10px 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.main .nm {
  display: block;
  font-size: 16px;
  font-weight: 600;
}

.main .qty {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 13px;
}

.tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border: 1px solid var(--warn);
  border-radius: 5px;
  color: var(--warn);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

.acts {
  display: flex;
  flex: none;
  align-items: center;
  padding-right: 6px;
}

.acts button {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 17px;
  cursor: pointer;
}

.acts button.delbtn {
  font-size: 16px;
  font-weight: 700;
  opacity: 0.5;
}

.acts button.delbtn:active {
  opacity: 1;
  color: var(--red);
}

.prov {
  flex-basis: 100%;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 14px 14px;
  background: rgba(201,166,107,0.06);
  color: var(--muted);
  font-size: 13.5px;
}

.prov div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
}

.prov b {
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

.prov .fg {
  color: var(--gold-hover);
  font-style: normal;
  font-weight: 600;
}

/* Bought / deleted rows */
.gk {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
}

.gk > div {
  min-width: 0;
}

.gk .gnm {
  font-weight: 600;
}

.gk .meta {
  color: var(--muted);
  font-size: 12px;
}

.gk.rest-info {
  border-color: var(--gold);
  background: rgba(201,166,107,0.06);
}

.gk.del {
  opacity: 0.6;
}

.gk.del .gnm {
  text-decoration: line-through;
}

.gk .undo {
  margin-left: auto;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--charcoal);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.gk .undo:active {
  border-color: var(--gold);
  color: var(--gold-hover);
}

.grp-qty {
  margin-left: auto;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.grp-item {
  margin-bottom: 9px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
}

.grp-item .grp-nm {
  padding: 11px 14px 7px;
  font-weight: 600;
}

.grp-item .prov {
  border: none;
  border-radius: 0;
}

.done-h {
  margin: 22px 0 10px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.empty {
  padding: 30px 10px;
  color: var(--muted);
  font-style: italic;
  text-align: center;
}

/* ── Split / partial buy ── */
.splitbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 44px;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  opacity: 0.55;
  transition: opacity .15s, color .15s;
  border-radius: 8px;
}
.splitbtn:hover, .splitbtn.active {
  opacity: 1;
  color: var(--gold);
}

.split-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex-basis: 100%;
  padding: 9px 14px 11px 54px;
  border: 1px solid var(--gold);
  border-top: none;
  border-radius: 0 0 14px 14px;
  background: rgba(201,166,107,0.06);
  font-size: 13px;
}

.split-label, .split-unit {
  color: var(--muted);
  font-size: 12px;
}

.split-input {
  width: 60px;
  padding: 5px 8px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 600;
  text-align: center;
  background: var(--card);
  color: var(--ink);
}
.split-input:focus {
  outline: none;
  border-color: var(--gold);
}

.split-ok {
  padding: 5px 12px;
  border: none;
  border-radius: 8px;
  background: var(--charcoal);
  color: var(--gold);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.split-ok:hover { background: var(--charcoal-dark); }

.split-x {
  padding: 5px 8px;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  border-radius: 8px;
}
.split-x:hover { color: var(--red); }

.itemwrap.rest > .item {
  border-color: var(--gold);
}

.circ.rest {
  border-color: var(--gold);
  background: rgba(201,166,107,0.18);
}

.qty.rest-qty {
  color: var(--gold-hover);
  font-weight: 600;
}

/* Change-name link in page-sub */
.page-sub #changeName {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--gold);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Artikel hinzufügen (Formular) ── */
.secondary.add {
  color: var(--gold-hover);
  border-color: var(--gold);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .field {
  flex: 1;
}

.form-row .qty-field {
  flex: 0 0 38%;
}

.form-row input[type="number"] {
  width: 100%;
  min-height: 50px;
  padding: 13px 14px;
  border: 1px solid var(--input-border);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  outline: none;
}

.form-row input[type="number"]:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.ai-hint {
  margin-top: 12px;
  min-height: 18px;
  font-size: 13px;
  color: var(--muted);
}

.ai-hint.err {
  color: var(--warn);
}
