/* SPT Sales Cockpit - Swiss Prime Taste Design System
   Schwarz dominiert, Gold ist der einzige Akzent, Creme ist Text. */

:root {
  --bg:          #0E0D0B;
  --surface:     #16150F;
  --overlay:     #080807;
  --border:      #262521;
  --hover-ghost: #1E1D18;

  --gold:        #D9B44A;
  --gold-hover:  #C79E33;
  --gold-light:  #E3CD86;

  --text:        #FDFBF7;
  --text-muted:  #9A948A;

  --ok:          #4EA46A;
  --error:       #D9584E;
  --warn:        #D9A13C;

  --font-display: 'Plus Jakarta Sans', 'Helvetica Neue', Arial, sans-serif;
  --font-body:    'Plus Jakarta Sans', 'Helvetica Neue', Arial, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --r: 2px;
  --t: 150ms cubic-bezier(.2, 0, 0, 1);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; text-wrap: balance; }
h1 { font-size: 40px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 28px; line-height: 1.3; font-weight: 600; }
h3 { font-size: 20px; line-height: 1.4; font-weight: 600; }

p { margin: 0 0 12px; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-hover); }

.gold { color: var(--gold-light); }
.muted { color: var(--text-muted); }
.num { font-family: var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }

.mono-label {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--gold);
  margin: 0 0 8px;
}

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Buttons ---------- */

.btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: var(--r);
  cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary { background: var(--gold); color: var(--bg); }
.btn-primary:hover { background: var(--gold-hover); }
.btn-secondary { background: transparent; border-color: var(--gold); color: var(--gold); }
.btn-secondary:hover { background: var(--hover-ghost); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--hover-ghost); }
.btn-danger { background: transparent; border-color: var(--error); color: var(--error); }
.btn-danger:hover { background: var(--hover-ghost); }
.btn-sm { padding: 7px 12px; font-size: 12px; min-height: 34px; }

/* ---------- Felder ---------- */

label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }

input, select, textarea {
  width: 100%;
  margin-top: 5px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  transition: border-color var(--t);
}
input:hover, select:hover, textarea:hover { border-color: #35332C; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: none; }
textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
input[type="date"] { font-family: var(--font-mono); }

/* ---------- Login / Setup ---------- */

.auth-page { display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 32px 28px;
}
.auth-card h1 { font-size: 32px; margin-bottom: 8px; }
.auth-card .btn { width: 100%; margin-top: 8px; }
.alert {
  background: var(--overlay);
  border: 1px solid var(--error);
  border-radius: var(--r);
  color: var(--error);
  padding: 10px 12px;
  font-size: 14px;
}

/* ---------- Rahmen der App ---------- */

.app { display: flex; flex-direction: column; min-height: 100%; }

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}
/* Wortmarke. Als Bild, sobald assets/img/spt-logo.* vorhanden ist -
   sonst das typografische Lockup aus dem Design System. */
.lockup {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.32em;
  color: var(--text);
  white-space: nowrap;
}
.lockup--header { font-size: 11px; }
.lockup--footer { font-size: 13px; }

.brand-logo { display: block; width: auto; }
.brand-logo--header { height: 30px; }
.brand-logo--footer { height: 42px; }

.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 9px 14px;
  cursor: pointer;
  transition: color var(--t), background var(--t), border-color var(--t);
  min-height: 38px;
}
.nav button:hover { background: var(--hover-ghost); color: var(--text); }
.nav button[aria-selected="true"] { color: var(--gold); border-color: var(--gold); }

.who { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }

main { flex: 1; padding: 20px; }
.view[hidden] { display: none !important; }

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}
.badge.gruen { border-color: var(--ok); color: var(--ok); }
.badge.gelb  { border-color: var(--warn); color: var(--warn); }
.badge.rot   { border-color: var(--error); color: var(--error); }
.badge.gold  { border-color: var(--gold); color: var(--gold); }

/* ---------- Tabellen ---------- */

.toolbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar label { margin-bottom: 0; flex: 1 1 150px; min-width: 0; }
.toolbar .grow { flex: 2 1 240px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
thead th {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface);
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--t); }
tbody tr:hover { background: var(--hover-ghost); }
tbody tr.is-due td { border-left: 2px solid var(--warn); }
.cell-name { font-weight: 600; }
.cell-sub { color: var(--text-muted); font-size: 12px; }

/* ---------- Gesprächsmodus ---------- */

.call-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .call-grid { grid-template-columns: 1fr; } }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 18px; }
.panel + .panel { margin-top: 16px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; }

/* Der Satz, den er sagt - grösstes Element der Seite */
.say {
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  text-wrap: pretty;
}
@media (max-width: 600px) { .say { font-size: 21px; } }
.say .slot { color: var(--gold-light); }

.note {
  border-left: 2px solid var(--gold);
  padding: 8px 0 8px 14px;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 18px;
}

.options { display: grid; gap: 8px; }
.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  padding: 14px 16px;
  min-height: 52px;
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
}
.opt:hover { background: var(--hover-ghost); border-color: #35332C; }
.opt .dot { width: 8px; height: 8px; border-radius: 9999px; flex: 0 0 auto; background: var(--text-muted); }
.opt.go .dot { background: var(--ok); }
.opt.hold .dot { background: var(--warn); }
.opt.stop .dot { background: var(--error); }
.opt kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 2px 6px;
}

.capture { margin: 16px 0 4px; }
.capture label { color: var(--gold); font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; }

.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.breadcrumb span {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 2px 8px;
}

.outcome-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }

/* ---------- Einwand-Drawer ---------- */

.obj-bar { position: sticky; bottom: 0; z-index: 15; }
.drawer {
  position: fixed;
  inset: auto 0 0 0;
  background: var(--surface);
  border-top: 1px solid var(--gold);
  padding: 18px 20px calc(18px + env(safe-area-inset-bottom, 0px));
  max-height: 72vh;
  overflow-y: auto;
  z-index: 40;
}
.drawer[hidden] { display: none !important; }
.drawer-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.drawer-head .mono-label { margin: 0; }
.drawer-head button { margin-left: auto; }
.obj-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.obj-answer { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 16px; }

/* ---------- Kennzahlen ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px 18px; }
.stat .k { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--gold); }
.stat .v { font-family: var(--font-mono); font-size: 30px; font-variant-numeric: tabular-nums; margin-top: 6px; }

/* ---------- Dialog ---------- */

dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  padding: 24px;
  width: min(620px, calc(100vw - 32px));
  max-height: 86vh;
}
dialog::backdrop { background: rgba(8, 8, 7, 0.72); }
.dialog-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.dialog-head h3 { margin: 0; }
.dialog-head button { margin-left: auto; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .form-2 { grid-template-columns: 1fr; } }
.dialog-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border: 1px solid var(--gold);
  border-radius: var(--r);
  padding: 11px 18px;
  font-size: 14px;
  z-index: 60;
}
.toast[hidden] { display: none !important; }

.empty { color: var(--text-muted); padding: 32px 16px; text-align: center; font-size: 14px; }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 40px;
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom, 0px));
}
.footer-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 28px;
  align-items: start;
  max-width: 1400px;
  margin: 0 auto;
}
@media (max-width: 760px) {
  .footer-inner { grid-template-columns: 1fr; gap: 20px; }
}
.footer-brand { display: grid; gap: 10px; }
.site-footer p { margin: 0; font-size: 13px; line-height: 1.5; }
.site-footer .mono-label { margin-bottom: 5px; }

/* Auf der Login- und Einrichtungsseite sitzt der Footer unter der Karte */
.auth-page { align-content: center; }
.auth-page .site-footer { width: 100%; background: transparent; border-top: none; margin-top: 28px; }
.auth-page .footer-inner { grid-template-columns: 1fr; text-align: center; justify-items: center; }
.auth-brand { margin-bottom: 20px; }
.auth-page .auth-brand { display: flex; justify-content: flex-start; }
.brand-link { display: inline-flex; align-items: center; }
.brand-link:hover { opacity: 0.85; }
