/* ============================================================
   BST — Bestellungen (Auswertung von public.v_order_log)
   Eigener Prefix bst-, damit nichts mit anderen Modulen kollidiert.
   ============================================================ */

.bst-wrap { padding: 16px 18px 26px; }

/* ---- Kopf + Hinweis ---- */
.bst-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.bst-head h2 { margin: 0; font-size: 18px; }
.bst-head .bst-sub { margin: 3px 0 0; font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.bst-head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* Der wichtigste Satz auf dieser Seite: die Liste belegt das Absenden, nicht
   das Ankommen. Ohne diesen Hinweis liest jemand sie als Lieferbestaetigung. */
.bst-note {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid #fcd34d; background: #fffbeb; border-radius: 10px;
  padding: 10px 13px; margin-bottom: 16px; font-size: 12.5px; line-height: 1.55; color: #7c4a04;
}
.bst-note b { color: #b45309; }
.bst-note svg { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 1px; }
/* Warnvariante: erreichte Ladegrenze, deutlicher als der Absenden-Hinweis */
.bst-note-warn { border-color: #fca5a5; background: #fef2f2; color: #991b1b; }
.bst-note-warn b { color: #b91c1c; }

/* ---- Kennzahlen ---- */
.bst-kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.bst-kpi { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 11px 13px; }
.bst-kpi .bst-kpi-l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); }
.bst-kpi .bst-kpi-v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.bst-kpi .bst-kpi-s { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* ---- Filter ---- */
.bst-filter {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  padding: 12px 13px; margin-bottom: 14px;
}
.bst-f { display: flex; flex-direction: column; gap: 4px; }
.bst-f label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); }
.bst-f input, .bst-f select {
  padding: 7px 9px; border: 1px solid var(--border-strong); border-radius: 7px;
  font-size: 13px; font-family: inherit; background: #fff; color: var(--text);
}
.bst-f input:focus, .bst-f select:focus { outline: none; border-color: var(--brand); }
.bst-f.bst-f-such { flex: 1 1 200px; min-width: 160px; }
.bst-f.bst-f-such input { width: 100%; }

.bst-btn {
  padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: 7px; background: #fff;
  font-size: 13px; font-family: inherit; cursor: pointer; color: var(--text); white-space: nowrap;
}
.bst-btn:hover { border-color: var(--brand); color: var(--brand-dark); }
.bst-btn.bst-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.bst-btn.bst-primary:hover { background: var(--brand-dark); }
.bst-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Tabelle ---- */
.bst-tablewrap { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; overflow: auto; max-height: calc(100vh - 380px); }
table.bst-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.bst-table thead th {
  position: sticky; top: 0; background: var(--bg); text-align: left;
  font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted);
  padding: 9px 10px; border-bottom: 1px solid var(--border); z-index: 1; white-space: nowrap;
}
table.bst-table thead th.bst-sortable { cursor: pointer; user-select: none; }
table.bst-table thead th.bst-sortable:hover, table.bst-table thead th.bst-sortable.on { color: var(--brand-dark); }
table.bst-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr.bst-row { cursor: pointer; }
tr.bst-row:hover { background: var(--brand-soft); }
tr.bst-row.on { background: var(--brand-soft); }
.bst-zeit { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
.bst-zeit small { display: block; font-size: 11px; color: var(--text-muted); }
.bst-dim { color: var(--text-dim); }
.bst-muted { color: var(--text-muted); font-size: 11.5px; }
.bst-strong { font-weight: 600; }
.bst-ktr { font-variant-numeric: tabular-nums; white-space: nowrap; }

.bst-pill {
  display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .3px; white-space: nowrap;
}
.bst-pill.k-whatsapp { background: #dcfce7; color: #166534; }
.bst-pill.k-sms      { background: #dbeafe; color: #1d4ed8; }
.bst-pill.k-mail     { background: #ede9fe; color: #5b21b6; }
.bst-pill.z-gps      { background: #fef3c7; color: #92400e; }
.bst-pill.z-platz    { background: #f1f5f9; color: #475569; }
.bst-pill.z-frei     { background: #ffe4e6; color: #9f1239; }

/* ---- Aufgeklappte Zeile: der gesendete Text ---- */
tr.bst-detail td { background: var(--bg); padding: 0 10px 12px; }
.bst-detail-in { display: grid; gap: 12px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  padding-top: 10px; align-items: start; }   /* start: kurzer Text zieht die Spalte nicht hoch */
@media (max-width: 900px) { .bst-detail-in { grid-template-columns: minmax(0, 1fr); } }
.bst-msg {
  margin: 0; background: #0f1b23; color: #e7eef3; border-radius: 9px; padding: 12px 14px;
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto;
}
.bst-meta { font-size: 12.5px; line-height: 1.6; }
.bst-meta dt { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); margin-top: 8px; }
.bst-meta dt:first-child { margin-top: 0; }
.bst-meta dd { margin: 1px 0 0; color: var(--text); word-break: break-word; }
.bst-meta a { color: var(--brand-dark); }

/* ---- Zustände ---- */
.bst-leer, .bst-fehler { text-align: center; padding: 34px 16px; font-size: 13.5px; line-height: 1.6; }
.bst-leer { color: var(--text-muted); }
.bst-fehler { color: #b91c1c; }
.bst-lade { padding: 30px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }
