/* ─────────────────────────────────────────────────────────────────────────────
   Auftragseingang – look and feel. BUTEUS brand: navy #003580, ink #0d0f14, Inter.
   Bootstrap stays underneath for grid and form basics; everything visible is set here.
   No inline styles anywhere: the content security policy blocks them.
   ───────────────────────────────────────────────────────────────────────────── */

@font-face {
  font-family: "Inter";
  src: url("../fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand: #003580;
  --brand-hover: #002a66;
  --brand-soft: #e8eef8;
  --brand-ring: rgba(0, 53, 128, .18);
  --ink: #0d0f14;
  --ink-2: #3b4250;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d4d8de;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --warn-bg: #fff8eb;
  --warn-line: #f3d9a4;
  --warn-ink: #8a5300;
  --ok: #0f7b5b;
  --ok-soft: #e7f6f0;
  --danger: #b42318;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .10);
  --topbar-h: 60px;
  --statusbar-h: 38px;

  --bs-body-font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--bg);
  --bs-border-color: var(--line);
  --bs-link-color: var(--brand);
  --bs-link-hover-color: var(--brand-hover);
  --bs-link-color-rgb: 0, 53, 128;
  --bs-link-hover-color-rgb: 0, 42, 102;
}

html { font-size: 15px; }
body { font-family: var(--bs-body-font-family); color: var(--ink); background: var(--bg); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
a:not(.btn) { text-decoration: none; }
a:not(.btn):hover { text-decoration: underline; }
h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5 { font-weight: 650; letter-spacing: -.01em; }
details > summary { cursor: pointer; }
.text-muted, .muted { color: var(--muted) !important; }

/* ── form controls ─────────────────────────────────────────────────── */
.form-control, .form-select { border-color: var(--line-strong); border-radius: var(--radius-sm); padding: .55rem .75rem; background-color: var(--surface); }
.form-control-sm, .form-select-sm { padding: .35rem .6rem; border-radius: 7px; }
.form-control-lg { padding: .7rem .9rem; font-size: 1.1rem; border-radius: 10px; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.field-label, .form-label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-2); margin-bottom: .35rem; }

/* ── buttons ──────────────────────────────────────────────────────────── */
.btn { border-radius: 10px; font-weight: 600; padding: .55rem 1rem; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; border-radius: 8px; }
.btn-lg { padding: .75rem 1.4rem; font-size: 1.02rem; }
.btn:focus-visible { box-shadow: 0 0 0 4px var(--brand-ring); outline: none; }
.btn-brand { background: var(--brand); border: 1px solid var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(0, 53, 128, .25); }
.btn-brand:hover, .btn-brand:active { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn-soft { background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink); }
.btn-soft:hover, .btn-soft:active { background: var(--surface-2); border-color: #c4c9d1; color: var(--ink); }
.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--ink-2); }
.btn-ghost:hover, .btn-ghost:active { background: #eef0f3; color: var(--ink); }
.btn-ghost-danger { background: transparent; border: 1px solid transparent; color: var(--danger); }
.btn-ghost-danger:hover, .btn-ghost-danger:active { background: #fdecea; color: var(--danger); }
.btn-ok { background: var(--ok-soft); border: 1px solid #bfe6d6; color: var(--ok); }
.btn-ok.active, .btn-ok:hover { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-off { background: #fdecea; border: 1px solid #f5c6c1; color: var(--danger); }
.btn-off.active, .btn-off:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ── notices and pills ───────────────────────────────────────────────── */
.notice { border-radius: 10px; padding: .7rem .9rem; font-size: .92rem; margin-bottom: 1rem; border: 1px solid; }
.notice ul { margin: 0; padding-left: 1.1rem; }
.notice-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.notice-ok { background: var(--ok-soft); border-color: #bfe6d6; color: var(--ok); }
.notice-danger { background: #fdecea; border-color: #f5c6c1; color: var(--danger); }
.pill { display: inline-block; font-size: .72rem; font-weight: 600; padding: .12rem .5rem; border-radius: 999px; background: #eef0f3; color: var(--ink-2); }
.pill-warn { background: #fff1d6; color: var(--warn-ink); }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-brand { background: var(--brand-soft); color: var(--brand); }

/* ── top bar and status bar ──────────────────────────────────────────── */
.topbar { height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: .85rem; color: var(--ink); }
.brand:hover { text-decoration: none !important; }
.brand-logo { height: 26px; width: auto; margin: 0 -10px; }
.brand-divider { width: 1px; height: 22px; background: var(--line-strong); }
.brand-product { font-weight: 600; font-size: 1rem; color: var(--ink-2); }
.topbar-actions { display: flex; align-items: center; gap: 1rem; }
.topbar .brand { flex: 0 0 auto; }
.top-nav { display: flex; align-items: center; gap: .25rem; margin-left: 2.5rem; margin-right: auto; }
.top-nav a { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .8rem; border-radius: 9px; color: var(--ink-2); font-weight: 600; font-size: .92rem; text-decoration: none; }
.top-nav a:hover { background: var(--surface-2); }
.top-nav a.active { background: var(--brand-soft); color: var(--brand); }
.top-nav .icon { width: 1.1em; height: 1.1em; }
@media (max-width: 900px) { .top-nav { margin-left: 1rem; } .top-nav a { padding: .4rem .5rem; font-size: .85rem; } }
.topbar-actions form { margin: 0; }
.segmented { display: inline-flex; background: #eef0f3; border-radius: 10px; padding: 3px; }
.segmented button { border: 0; background: transparent; color: var(--ink-2); font-size: .82rem; font-weight: 600; padding: .3rem .75rem; border-radius: 8px; }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.user-chip { display: inline-flex; align-items: center; gap: .5rem; font-size: .88rem; font-weight: 500; color: var(--ink-2); }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; }
.app-main { min-height: calc(100vh - var(--topbar-h) - var(--statusbar-h)); }
body.signed-out .app-main { min-height: calc(100vh - var(--statusbar-h)); }
.statusbar { height: var(--statusbar-h); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 1.5rem; background: var(--surface); border-top: 1px solid var(--line); font-size: .75rem; color: var(--muted); position: sticky; bottom: 0; z-index: 20; }
.statusbar .right { justify-self: end; }
.powered { display: inline-flex; align-items: center; gap: .45rem; font-size: .85rem; color: var(--ink-2); }
.powered img { height: 18px; width: auto; margin: 0 -6px; }

/* ── login ────────────────────────────────────────────────────────────── */
.login { min-height: calc(100vh - var(--statusbar-h)); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem;
  background: radial-gradient(1200px 600px at 50% -10%, #e3eaf6 0%, transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 2.25rem 2rem 2rem; }
.login-logo { height: 40px; width: auto; display: block; margin: 0 0 1.25rem -14px; }
.login-title { font-size: 1.45rem; font-weight: 700; margin: 0 0 .25rem; }
.login-subtitle { color: var(--muted); font-size: .92rem; margin-bottom: 1.5rem; }
.login-tagline { margin-top: 1.25rem; font-size: .82rem; color: var(--muted); }

/* ── master / detail ─────────────────────────────────────────────────── */
.master-detail { display: flex; min-height: calc(100vh - var(--topbar-h) - var(--statusbar-h)); }
.sidebar { flex: 0 0 340px; max-width: 340px; background: var(--surface); border-right: 1px solid var(--line);
  height: calc(100vh - var(--topbar-h) - var(--statusbar-h)); overflow: hidden; position: sticky; top: var(--topbar-h); display: flex; flex-direction: column; }
.detail { flex: 1; min-width: 0; padding: 1.75rem 2.5rem 3rem; }
.detail-inner { max-width: 860px; margin: 0 auto; }
@media (max-width: 767px) {
  .master-detail { flex-direction: column; }
  .sidebar { flex-basis: auto; max-width: none; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  .detail { padding: 1.25rem 1rem 2rem; }
}

.inbox { padding: 1rem .75rem 0; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.inbox-list { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -.75rem; padding: 0 .75rem 1.5rem; border-top: 1px solid var(--line); }
.inbox-stats { margin: 0 .25rem .5rem; padding: .75rem .9rem; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: .85rem; color: var(--ink-2); line-height: 1.5; }
.inbox-stats strong { color: var(--ink); }
.inbox-heading { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 1.1rem .6rem .45rem; }
.inbox-done > summary { list-style: none; }
.inbox-done > summary::-webkit-details-marker { display: none; }
.inbox-done > summary::after { content: " ▾"; }
.inbox-done:not([open]) > summary::after { content: " ▸"; }
.inbox-item { display: block; padding: .65rem .75rem; border-radius: 10px; color: inherit; margin-bottom: 2px; position: relative; }
.inbox-item:hover { background: var(--surface-2); text-decoration: none !important; }
.inbox-item.selected { background: var(--brand-soft); }
.inbox-item.open::before { content: ""; position: absolute; left: 0; top: .75rem; bottom: .75rem; width: 3px; border-radius: 3px; background: #f0a929; }
.inbox-item .who { font-weight: 600; font-size: .92rem; }
.inbox-item .when { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.inbox-item .snippet { font-size: .82rem; color: var(--muted); margin: .1rem 0 .3rem; }
.inbox-footer { margin: 1.25rem .6rem 0; font-size: .82rem; }

.empty-detail { text-align: center; margin: 16vh auto 0; max-width: 420px; }
.empty-detail .lead { font-weight: 500; color: var(--ink-2); }

/* ── case ─────────────────────────────────────────────────────────────── */
.case-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .9rem; }
.case-title { font-size: 1.2rem; font-weight: 650; margin: 0; }
.case-meta { font-size: .85rem; color: var(--muted); margin-top: .1rem; }
.message { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; box-shadow: var(--shadow); }
.message-subject { font-weight: 650; margin-bottom: .5rem; }
.message-body { white-space: pre-wrap; line-height: 1.6; }
.table { --bs-table-bg: transparent; }
audio { width: 100%; margin-bottom: .6rem; }
.card.task-card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); margin-top: 1.25rem; }
.card.task-card.needs-review { border-color: #e9d3a7; }
.task-card > .card-body { padding: 1.5rem 1.6rem; }

.summary { margin-bottom: 1.5rem; }
.summary dt { display: flex; align-items: baseline; gap: .6rem; font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-top: 1.15rem; }
.summary dt:first-child { margin-top: 0; }
.summary dt .edit { font-weight: 600; text-transform: none; letter-spacing: 0; font-size: .8rem; }
.summary dd { margin: .3rem 0 0; font-size: 1rem; }
.summary .table { margin: 0; }
.summary .table td { padding: .45rem 0; border-color: #f0f1f4; background: transparent; }
.summary .table tr:last-child td { border-bottom: 0; }
.amount { width: 3.5rem; text-align: right; padding-right: 1rem !important; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }

.decision { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.decision .spacer { flex: 1; }

.suggestions { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.25rem; }
.suggestion { text-align: left; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: .6rem .9rem; font-weight: 600; color: var(--ink); }
.suggestion:hover { border-color: var(--brand); background: var(--brand-soft); }
.suggestion small { display: block; font-weight: 400; color: var(--muted); font-size: .78rem; }

.lines-table { table-layout: fixed; margin-bottom: .5rem; }
.lines-table th { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom-color: var(--line); }
.lines-table td { vertical-align: top; border-color: #f0f1f4; padding-top: .55rem; padding-bottom: .55rem; }
.lines-table .num { width: 7rem; }
.lines-table .change { width: 9rem; }
.unit-label { font-size: .8rem; color: var(--muted); margin-top: .25rem; }

.more-actions { position: relative; }
.more-actions > summary { list-style: none; font-size: .85rem; font-weight: 600; color: var(--ink-2); padding: .35rem .7rem; border-radius: 8px; }
.more-actions > summary::-webkit-details-marker { display: none; }
.more-actions > summary:hover { background: #eef0f3; }
.more-actions-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .35rem; min-width: 17rem; box-shadow: var(--shadow-lg); }
.more-actions-menu form { margin: 0; }
.more-actions-menu .menu-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: .5rem .7rem; border-radius: 7px; font-size: .9rem; color: var(--ink); }
.more-actions-menu .menu-item:hover { background: var(--surface-2); text-decoration: none; }
.more-actions-menu .menu-note { padding: .5rem .7rem 0; font-size: .78rem; color: var(--muted); border-top: 1px solid var(--line); margin-top: .35rem; }
.history { margin-top: 1.25rem; font-size: .85rem; }
.history summary { color: var(--muted); font-weight: 500; }
.history ul { margin: .5rem 0 0; padding-left: 1.1rem; color: var(--ink-2); }

/* ── review ───────────────────────────────────────────────────────────── */
.review-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.review-item { display: flex; align-items: center; gap: 1rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); }
.review-item:last-child { border-bottom: 0; }
.review-item .what { flex: 1; min-width: 0; font-size: .88rem; }
.review-item form { display: flex; gap: .4rem; margin: 0; }
.rated-by { width: 7rem; text-align: right; white-space: nowrap; font-size: .78rem; color: var(--muted); }

/* ── playful variant: same flow, warmer and more rewarding ───────────── */
.day-progress { display: block; width: 100%; height: .5rem; margin: .5rem 0; appearance: none; border: none; border-radius: 1rem; background: #e6e9ee; overflow: hidden; }
.day-progress::-webkit-progress-bar { background: #e6e9ee; border-radius: 1rem; }
.day-progress::-webkit-progress-value { background: linear-gradient(90deg, #3b82f6, var(--brand)); border-radius: 1rem; }
.day-progress::-moz-progress-bar { background: linear-gradient(90deg, #3b82f6, var(--brand)); border-radius: 1rem; }
body.playful .inbox-stats { background: linear-gradient(135deg, #eef4ff 0%, #f3fbf7 100%); border-color: #dbe6f7; }
body.playful .btn { border-radius: 999px; }
body.playful .btn-brand.btn-lg { box-shadow: 0 6px 18px rgba(0, 53, 128, .28); }
body.playful .card.task-card { border-radius: 18px; }
body.playful .message { border-radius: 18px; }
/* ── icons, navigation, figures, feedback ────────────────────────────── */
.icon { width: 1.05em; height: 1.05em; flex: none; vertical-align: -.17em; }
.page-title { display: flex; align-items: center; gap: .5rem; }
.page-title .icon { width: 1.15em; height: 1.15em; color: var(--brand); }
.who .icon { color: var(--muted); margin-right: .15rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; }
.tile-hero { grid-column: 1 / -1; background: linear-gradient(135deg, var(--brand) 0%, #1d4f9c 100%); border-color: var(--brand); color: #fff; }
.tile-label { display: flex; align-items: center; gap: .45rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.tile-hero .tile-label, .tile-hero .tile-note { color: rgba(255, 255, 255, .8); }
.tile-value { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; margin: .35rem 0 .15rem; font-variant-numeric: tabular-nums; }
.tile-hero .tile-value { font-size: 2.6rem; }
.tile-note { font-size: .8rem; color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem 1.3rem; }
.panel-title { font-size: .95rem; font-weight: 650; margin-bottom: .9rem; }
.bar-row { display: grid; grid-template-columns: 11rem 1fr 2.5rem; align-items: center; gap: .75rem; margin-bottom: .55rem; font-size: .9rem; }
.bar { width: 100%; height: .55rem; appearance: none; border: none; border-radius: 1rem; background: #eef0f3; overflow: hidden; }
.bar::-webkit-progress-bar { background: #eef0f3; border-radius: 1rem; }
.bar::-webkit-progress-value { background: var(--brand); border-radius: 1rem; }
.bar::-moz-progress-bar { background: var(--brand); border-radius: 1rem; }
.bar-count { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

.feedback-item { padding: 1rem 1.15rem; border-bottom: 1px solid var(--line); }
.feedback-item:last-child { border-bottom: 0; }
.feedback-what { font-size: .9rem; margin-bottom: .7rem; }
.feedback-what .icon { color: var(--muted); }
.feedback-form { display: flex; flex-direction: column; gap: .55rem; margin: 0; }
.choices { display: flex; flex-wrap: wrap; gap: .4rem; }
.choice { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: .32rem .8rem; font-size: .84rem; font-weight: 600; }
.choice:hover { background: var(--surface-2); }
.choice-ok.active { background: var(--ok-soft); border-color: #9fd8c2; color: var(--ok); }
.choice-minor.active { background: #fff4e0; border-color: #f0cf8e; color: var(--warn-ink); }
.choice-off.active { background: #fdecea; border-color: #f2b8b2; color: var(--danger); }
.choice-none.active { background: #eef0f3; border-color: #c9ced6; color: var(--ink); }

/* ── case: split screen that fits the window (no page scroll for a regular order) ── */
.detail.case-detail { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - var(--statusbar-h)); overflow: hidden; padding: 1rem 1.5rem 1rem; }
.case-detail .case-head { margin-bottom: .75rem; align-items: center; }
.case-detail .case-title { font-size: 1.05rem; flex-wrap: wrap; }
.case-detail .case-title .case-meta { font-size: .85rem; font-weight: 400; margin: 0 0 0 .4rem; }
.split { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 1.25rem; }
.split-pane { min-height: 0; overflow-y: auto; padding: 2px 4px 4px 2px; }
.split-pane .card.task-card { margin-top: 0; }
@media (max-width: 1100px) {
  .detail.case-detail { height: auto; overflow: visible; }
  .split { grid-template-columns: 1fr; }
  .split-pane { overflow: visible; }
}

.view-tabs { display: flex; gap: .25rem; padding: .5rem .6rem 0; border-bottom: 1px solid var(--line); }
.view-tabs button { position: relative; border: 0; background: none; padding: .55rem .8rem .6rem; font-size: .88rem; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 6px 6px 0 0; }
.view-tabs button:hover { color: var(--ink); background: var(--surface-2); }
.view-tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #f0a929; margin-left: .35rem; vertical-align: .1em; }
.task-card > form > .card-body, .task-card > .card-body { padding: 1.1rem 1.25rem 1.1rem; }
.case-detail .summary dt { margin-top: .8rem; }
.case-detail .summary dt:first-child { margin-top: 0; }
.case-detail .summary { margin-bottom: 1rem; }
.case-detail .summary .table td { padding: .3rem 0; }
.case-detail .decision { padding-top: .9rem; }
.case-detail .notice { padding: .55rem .8rem; margin-bottom: .8rem; }
.case-detail .lines-table td { padding-top: .35rem; padding-bottom: .35rem; }
.case-detail .history { margin-top: .6rem; }
.case-detail audio { height: 40px; }

/* both halves fill the height; the decision bar sits at the bottom of the task card */
.split-pane { display: flex; flex-direction: column; }
.split-pane > .message { flex: 1; }
.split-pane > .card.task-card { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.task-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.task-form > .card-body { flex: 1; overflow-y: auto; }
.task-card > .card-body { flex: 1; }
.case-detail .decision { margin: 0; padding: .85rem 1.25rem; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.decision .btn .icon { width: 1.1em; height: 1.1em; }
.kbd-hint { font-size: .75rem; color: var(--muted); margin-right: .25rem; }
@media (max-width: 1100px) { .kbd-hint { display: none; } }

/* searchable choice box */
.combo { position: relative; }
.combo-input.is-invalid { border-color: var(--danger); }
.combo-list { position: fixed; z-index: 50; max-height: 320px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: .3rem; }
.combo-option { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .45rem .65rem; border-radius: 7px; cursor: pointer; }
.combo-option.active, .combo-option:hover { background: var(--brand-soft); }
.combo-title { font-size: .9rem; color: var(--ink); }
.combo-sub { font-size: .78rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.combo-empty { padding: .5rem .65rem; font-size: .85rem; color: var(--muted); }

/* delivery or pickup: a switch; each mode shows its own fields (CSS only) */
.mode-toggle { display: inline-flex; background: #eef0f3; border-radius: 10px; padding: 3px; }
.mode-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.mode-toggle label { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem 1rem; border-radius: 8px; font-weight: 600; font-size: .9rem; color: var(--ink-2); cursor: pointer; }
.mode-toggle input:checked + label { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.mode-toggle input:focus-visible + label { box-shadow: 0 0 0 4px var(--brand-ring); }
.delivery-form:has(#mode-delivery:checked) .only-pickup { display: none; }
.delivery-form:has(#mode-pickup:checked) .only-delivery { display: none; }
.time-range { display: flex; align-items: center; gap: .6rem; }
.time-range .form-control { max-width: 9rem; }
.time-sep { color: var(--muted); font-size: .9rem; }

/* lines: remove button; a removed line is struck through until saved */
.lines-table th.remove, .lines-table td.remove { width: 2.5rem; text-align: center; }
.row-remove { border: 0; background: none; color: var(--muted); padding: .35rem; border-radius: 7px; line-height: 0; }
.row-remove:hover { background: #fdecea; color: var(--danger); }
.lines-table tr.removed td:not(.remove) { opacity: .45; }
.lines-table tr.removed .combo-input { text-decoration: line-through; }
.lines-table tr.removed .row-remove { color: var(--brand); }

/* delivery: quick picks for the day */
.date-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .5rem; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: .15rem .6rem; font-size: .78rem; font-weight: 600; color: var(--ink-2); }
.chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.undo { font-size: .85rem; }

/* callback for callers we cannot place */
.callback { display: flex; align-items: center; gap: 1rem; justify-content: space-between; background: var(--brand-soft); border: 1px solid #cfdcf0; border-radius: 10px; padding: .75rem .9rem; margin-bottom: 1rem; font-size: .9rem; }
.callback .btn { white-space: nowrap; }

/* choice box: the chosen option is marked */
.combo-option.chosen .combo-title { font-weight: 650; color: var(--brand); }

/* date and time pickers */
.picker-field { position: relative; }
.picker-field .icon { position: absolute; right: .7rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.picker-field .form-control { padding-right: 2.2rem; }
.date-picker, .time-picker { position: fixed; z-index: 50; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: .6rem; }
.date-picker { width: 280px; }
.dp-head { display: flex; align-items: center; justify-content: space-between; font-weight: 650; margin-bottom: .4rem; }
.dp-head button { border: 0; background: none; font-size: 1.3rem; line-height: 1; width: 2rem; height: 2rem; border-radius: 8px; color: var(--ink-2); }
.dp-head button:hover { background: var(--surface-2); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.dp-weekday { font-size: .72rem; font-weight: 700; color: var(--muted); padding: .25rem 0; }
.dp-day { border: 0; background: none; border-radius: 8px; padding: .4rem 0; font-size: .88rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.dp-day:hover { background: var(--brand-soft); }
.dp-day.past { color: #b8bec8; }
.dp-day.sunday { color: #c0392b; }
.dp-day.today { box-shadow: inset 0 0 0 1.5px var(--brand); }
.dp-day.chosen { background: var(--brand); color: #fff; }
.time-picker { max-height: 260px; overflow-y: auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; width: 280px; }
.tp-time { border: 0; background: none; border-radius: 7px; padding: .4rem .2rem; font-size: .86rem; font-variant-numeric: tabular-nums; color: var(--ink); }
.tp-time:hover { background: var(--brand-soft); }
.tp-time.chosen { background: var(--brand); color: #fff; }
.time-range .picker-field { max-width: 9rem; }

/* dialog in the site look */
.dialog { border: 0; border-radius: 16px; padding: 1.5rem 1.5rem 1.25rem; width: min(420px, calc(100vw - 2rem)); box-shadow: 0 24px 64px rgba(16, 24, 40, .25); }
.dialog::backdrop { background: rgba(13, 15, 20, .35); backdrop-filter: blur(2px); }
.dialog h2 { font-size: 1.1rem; font-weight: 700; margin: 0 0 .5rem; }
.dialog p { color: var(--ink-2); margin: 0 0 1.25rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; }

/* Bootstrap's .btn:focus-visible / :active set their own colours (more specific than one class): keep ours */
.btn.btn-brand:focus-visible, .btn.btn-brand:active { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn.btn-soft:focus-visible, .btn.btn-soft:active { background: var(--surface-2); border-color: #c4c9d1; color: var(--ink); }
.btn.btn-ghost:focus-visible, .btn.btn-ghost:active { background: #eef0f3; color: var(--ink); }
.btn.btn-ghost-danger:focus-visible, .btn.btn-ghost-danger:active { background: #fdecea; color: var(--danger); }

/* ── unclear products: the person picks the article among the fitting ones ── */
tr.unclear .combo input, .combo.unclear input { border-color: var(--warn-line); background: var(--warn-bg); }
.combo-why { display: block; font-size: .75rem; font-weight: 500; color: var(--muted); margin-top: .1rem; }
.unclear-said { display: block; margin-top: .25rem; font-size: .75rem; color: var(--warn-ink); }
.combo-heading { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .4rem .65rem .2rem; }
.combo-all { padding: .5rem .65rem; margin-top: .2rem; border-top: 1px solid var(--line); font-size: .85rem; font-weight: 600; color: var(--brand); cursor: pointer; }
.combo-all:hover { background: var(--brand-soft); }

/* ── decided tasks: one banner says what happened ── */
.status-banner { display: flex; gap: .75rem; align-items: flex-start; border-radius: 12px; padding: .85rem 1rem; margin-bottom: 1.25rem; border: 1px solid transparent; }
.status-banner .icon { width: 1.35rem; height: 1.35rem; flex: none; margin-top: .1rem; }
.status-banner strong { display: block; font-size: 1rem; }
.banner-ok { background: var(--ok-soft); border-color: #9fd8c2; color: var(--ok); }
.banner-brand { background: var(--brand-soft); border-color: #c5d3ea; color: var(--brand); }
.banner-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.banner-muted { background: #eef0f3; border-color: #d4d8de; color: var(--ink-2); }
.status-banner .small { color: inherit; opacity: .85; }

/* ── "Kein Auftrag" dialog and bucket ── */
.reason-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.reason-chips .choice.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.dialog .btn-brand:disabled { opacity: .45; }
.inbox-note { font-size: .78rem; color: var(--muted); margin: 0 .6rem .5rem; }

/* ── Kunden ── */
.customer-search { position: relative; max-width: 640px; margin-bottom: 1rem; }
.customer-search .icon { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.customer-search input { padding-left: 2.6rem; }
.customer-results { display: flex; flex-direction: column; gap: .4rem; max-width: 900px; }
.customer-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .7rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; }
.customer-row:hover { border-color: var(--brand); background: var(--brand-soft); }
.customer-name { font-weight: 600; }
.customer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 1rem; }
.section-title { font-size: .95rem; font-weight: 700; margin: 0 0 .75rem; }
.contact-list { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: .35rem; }
.contact-list li { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 10px; }
.contact-list .icon { color: var(--muted); flex: none; }
.contact-value { font-weight: 600; }
.add-contact { display: flex; gap: .5rem; }

/* ── which request of the message (several per message) ── */
.request-switch { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin: 0 0 .75rem; }
.request-switch-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-right: .25rem; }
.request-switch a { display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .5rem .35rem .8rem; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: .85rem; font-weight: 600; text-decoration: none; }
.request-switch a:hover { border-color: var(--brand); }
.request-switch a.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.state-dot { font-size: .72rem; font-weight: 600; border-radius: 999px; padding: .05rem .5rem; }
.state-open { background: #fff1d6; color: var(--warn-ink); }
.state-done { background: var(--ok-soft); color: var(--ok); }
.state-none { background: #eef0f3; color: var(--ink-2); }
a[role=tab] { display: inline-block; text-decoration: none; padding: .55rem .8rem .6rem; font-size: .88rem; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
a[role=tab]:hover { color: var(--ink); }
a[role=tab].active { color: var(--brand); border-bottom-color: var(--brand); }

/* ── history ── */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.1rem; border-left: 2px solid var(--line); }
.timeline li { position: relative; display: grid; grid-template-columns: 11rem 1fr auto; gap: .15rem 1rem; padding: .55rem 0 .55rem .4rem; }
.timeline li::before { content: ""; position: absolute; left: -1.5rem; top: .95rem; width: .7rem; height: .7rem; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.timeline li:first-child::before { background: var(--brand); }
.timeline-when { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline-what { font-weight: 600; }
.timeline-who { font-size: .82rem; color: var(--muted); }
.timeline-detail { grid-column: 2 / -1; font-size: .85rem; color: var(--ink-2); }

/* ── a list page: the head stays, only the list scrolls ── */
.detail.list-page { height: calc(100vh - var(--topbar-h) - var(--statusbar-h)); display: flex; flex-direction: column; padding-bottom: 0; }
.detail.list-page > .detail-inner { width: 100%; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.detail.list-page .customer-results { flex: 1; min-height: 0; overflow-y: auto; max-width: none; padding-bottom: 1.5rem; }
.detail.list-page .customer-search { flex: none; max-width: none; }

/* ── request head: what the customer wants, which order it refers to ── */
.request-head { display: flex; align-items: center; gap: .75rem 1.25rem; flex-wrap: wrap; padding: .85rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.request-head .kind-toggle { flex: none; }
.refers-to { display: none; align-items: center; gap: .6rem; flex: 1; min-width: 260px; }
.refers-to select { max-width: 460px; }
.refers-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0; }
.refers-note { display: none; flex-basis: 100%; }
.task-form.refers .refers-to { display: flex; }
.task-form.refers .refers-note { display: block; }
.confirm-staff { display: none; }
.task-form.refers .confirm-create { display: none; }
.task-form.refers .confirm-staff { display: inline; }
.request-head.readonly { gap: .75rem; font-size: .92rem; }
.request-kind { font-weight: 700; }

/* ── the thread: everything one correspondent sent ── */
.split-pane.thread { gap: .75rem; }
.thread-msg { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: .85rem 1.1rem; box-shadow: var(--shadow); flex: none; }
.thread-msg.selected { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.thread-msg:not(.selected) .message-body { color: var(--ink-2); }
.thread-head { display: flex; align-items: center; gap: .45rem; font-weight: 600; font-size: .9rem; color: var(--ink); text-decoration: none; margin-bottom: .45rem; }
.thread-head .muted { font-weight: 500; }
.thread-head:hover { color: var(--brand); }
.thread-msg audio { width: 100%; margin-bottom: .5rem; }
.thread-requests { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; }
.thread-request { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 600; padding: .15rem .25rem .15rem .6rem; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink-2); text-decoration: none; }
.thread-request.active { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* ── which requests form one order ── */
.order-list { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .75rem; flex: none; }
.order-row { display: flex; align-items: center; gap: .75rem; padding: .5rem .8rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); text-decoration: none; font-size: .88rem; }
.order-row:hover { border-color: var(--brand); }
.order-row.active { border-color: var(--brand); background: var(--brand-soft); }
.order-row-kind { font-weight: 700; }
.order-row-meta { flex: 1; color: var(--muted); }

/* ── messages that belong to the selected order ── */
.thread-msg.member { border-color: var(--ok); box-shadow: 0 0 0 3px rgba(15, 123, 91, .15); }
.thread-msg.member.selected { box-shadow: 0 0 0 3px rgba(15, 123, 91, .25); }
.thread-msg.suggested { border-style: dashed; border-color: var(--brand); }
.thread-request.tick { cursor: pointer; background: var(--surface); }
.thread-request.tick:hover { border-color: var(--brand); }
.thread-request.ticked { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.tick-box { display: inline-flex; align-items: center; justify-content: center; width: 1rem; height: 1rem; border: 1.5px solid currentColor; border-radius: 4px; font-size: .7rem; line-height: 1; }
.order-hint { font-size: .78rem; color: var(--muted); margin: -.25rem 0 .6rem; flex: none; }

/* ── orders left (wider: the editor lives there), messages right; filters on both ── */
.split.orders-first { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.filter-row { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; margin-bottom: .6rem; flex: none; }
.filter { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem; border-radius: 999px; font-size: .82rem; font-weight: 600; color: var(--ink-2); background: #eef0f3; text-decoration: none; }
.filter:hover { color: var(--ink); }
.filter.active { background: var(--brand); color: #fff; }
.filter .count { font-size: .72rem; opacity: .75; }
.filter-alert { margin-left: auto; font-size: .8rem; font-weight: 600; color: var(--warn-ink); background: #fff1d6; padding: .3rem .7rem; border-radius: 999px; text-decoration: none; }
.thread-head .state-dot { margin-left: auto; }

/* ── unknown sender: who is it? ── */
.orders-body { display: contents; }
.funnel .card-body { display: flex; flex-direction: column; gap: 1rem; overflow-y: auto; }
.funnel-title { font-size: 1.15rem; font-weight: 700; margin: 0; }
.funnel-step { border: 1px solid var(--line); border-radius: 12px; padding: .85rem 1rem; display: flex; flex-direction: column; gap: .6rem; }
.funnel-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); cursor: default; }
details.funnel-step > summary { cursor: pointer; list-style: none; }
details.funnel-step > summary::after { content: " ▸"; }
details.funnel-step[open] > summary::after { content: " ▾"; }
.funnel-guesses { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }
.funnel-search, .funnel-new { display: flex; gap: .5rem; margin: 0; }
.funnel-search .combo { flex: 1; }
.funnel-new { flex-direction: column; margin-top: .6rem; }
.funnel-new .btn { align-self: flex-start; }
.funnel-zip { max-width: 7rem; }
.funnel-none { flex-direction: row; align-items: center; gap: .75rem; flex-wrap: wrap; margin: 0; }
.funnel-none .btn { margin-left: auto; }
.funnel-preview { display: flex; flex-direction: column; gap: .25rem; padding: 0 .25rem; }

/* ── the AI is working in the background ── */
.spinner { display: inline-block; width: .8em; height: .8em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -.1em; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice-busy { background: var(--brand-soft); border-color: #c5d3ea; color: var(--brand); }

/* ── suggestions: which messages probably belong to the order ── */
.suggest-bar { display: flex; align-items: center; gap: .6rem; flex: none; margin: 0 0 .6rem; padding: .55rem .8rem; border: 1px dashed var(--brand); border-radius: 12px; background: var(--brand-soft); font-size: .88rem; }
.suggest-text { flex: 1; min-width: 0; }
.suggest-text strong { color: var(--brand); display: inline-flex; align-items: center; gap: .3rem; }
.suggest-label { display: flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 600; color: var(--brand); margin-bottom: .4rem; }


/* ── the ERP order a request refers to ── */
.ref-card { flex: none; background: var(--surface); border: 1px solid #c5d3ea; border-left: 4px solid var(--brand); border-radius: 14px; padding: .75rem 1rem; margin-bottom: .75rem; box-shadow: var(--shadow); }
.ref-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .4rem; }
.ref-label { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); }

/* ── two views: the AI's suggestions, or every message placed by hand ── */
.view-mode { margin-left: auto; margin-right: 1rem; }
.view-mode a { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .85rem; border-radius: 8px; font-size: .85rem; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.view-mode a.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.mode-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.3rem; height: 1.3rem; padding: 0 .35rem; border-radius: 999px; background: var(--warn-ink); color: #fff; font-size: .72rem; }
.unplaced-note { display: flex; align-items: center; gap: .6rem; flex: none; margin: 0 0 .6rem; padding: .6rem .85rem; border-radius: 12px; border: 1px solid var(--warn-line); background: var(--warn-bg); color: var(--warn-ink); text-decoration: none; font-size: .9rem; }
.unplaced-note:hover { border-color: var(--warn-ink); }
.unplaced-go { margin-left: auto; font-weight: 700; white-space: nowrap; }
.message-desk { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: .75rem; max-width: 1100px; width: 100%; margin: 0 auto; padding: 2px 4px 1.5rem; }
.desk-msg.needs { border-color: var(--warn-line); box-shadow: 0 0 0 3px rgba(243, 217, 164, .5); }
.desk-assign { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: .6rem 0 0; padding-top: .6rem; border-top: 1px solid var(--line); }
.desk-req { flex: 1; min-width: 14rem; font-size: .88rem; color: var(--ink-2); }
.desk-assign select { width: auto; max-width: 26rem; }
.desk-done { font-size: .85rem; color: var(--ink-2); }
.desk-part { font-size: .85rem; color: var(--brand); }

/* ── outbox ── */
.outbox-detail { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1.25rem; overflow-y: auto; align-items: start; }
.outbox-side { display: flex; flex-direction: column; gap: 1rem; }
.outbox-docno { max-width: 14rem; }
.import-file > summary { cursor: pointer; padding: .8rem 1.1rem; font-weight: 600; }
.import-file pre { margin: 0; padding: .8rem 1.1rem 1rem; font-size: .78rem; white-space: pre-wrap; word-break: break-all; border-top: 1px solid var(--line); }
@media (max-width: 1100px) { .outbox-detail { grid-template-columns: 1fr; } }
