/* ==========================================================================
   Dashboards der KI-Assistenten (Demo): Telefon und E-Mail.
   Arbeitsoberfläche statt Kachelwand: Tagesbilanz als Textzeile, links die
   Liste, rechts die Details. Farben aus dem Holt.Tec-Designsystem, Status als
   Punkt + Wort. Keine Inline-Styles (CSP), Holt.Tec-Leiste: css/demo-bar.css.
   ========================================================================== */

@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/ibm-plex-mono-latin-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  color-scheme: light;
  --page: #F4F0EA;
  --surface: #FDFCFA;
  --surface-2: #F1ECE4;
  --ink: #17191C;
  --ink-2: #50555C;
  --ink-3: #6B7076;
  --line: rgba(23, 25, 28, 0.12);
  --line-strong: rgba(23, 25, 28, 0.24);
  --accent: #B9622A;       /* Markierungen */
  --accent-text: #9A4F1F;  /* kleiner Akzenttext, 5,9:1 */
  --button: #E08A4F;
  --ok: #2F6B4F;
  --crit: #A63D2A;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --r: 6px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.app {
  max-width: 1360px;
  margin: 0 auto;
  padding: 28px clamp(16px, 3vw, 32px) 40px;
}

/* ---------- Kopf ---------- */

.app-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-strong);
}

.app-head h1 {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.app-head h1 .dot { color: var(--accent); }

.app-sub {
  margin-top: 4px;
  color: var(--ink-2);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}

.stamp {
  color: var(--ink-2);
  font-size: 13px;
  text-align: right;
}

.stamp b {
  display: block;
  color: var(--ink);
  font-size: 15px;
}

@media (max-width: 620px) {
  .stamp { text-align: left; }
}

/* ---------- Tagesbilanz ---------- */

.tally {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 20px 0 24px;
  border-bottom: 1px solid var(--line);
}

.tally > div {
  padding: 4px 16px 18px;
  border-left: 1px solid var(--line);
}

.tally > div:first-child {
  padding-left: 0;
  border-left: 0;
}

.tally b {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.tally span {
  color: var(--ink-2);
  font-size: 13.5px;
}

.tally .is-crit b { color: var(--crit); }
.tally .is-attn b { color: var(--accent-text); }

@media (max-width: 860px) {
  .tally { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tally > div:nth-child(4) { padding-left: 0; border-left: 0; }
}

@media (max-width: 520px) {
  .tally { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tally > div:nth-child(4) { padding-left: 16px; border-left: 1px solid var(--line); }
  .tally > div:nth-child(odd) { padding-left: 0; border-left: 0; }
}

/* ---------- Arbeitsbereich ---------- */

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 980px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
}

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.panel-head p {
  color: var(--ink-3);
  font-size: 13px;
}

.panel-body { padding: 16px 18px; }

/* Filter (E-Mail) */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.filter {
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.filter span { color: var(--ink-3); font-weight: 500; }

.filter[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

.filter[aria-pressed="true"] span { color: inherit; opacity: 0.75; }

/* Liste */
.day {
  padding: 8px 18px;
  background: var(--page);
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 700;
}

.entry {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 2px 14px;
  width: 100%;
  padding: 12px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.entry:hover { background: var(--surface-2); }

.entry[aria-current="true"] {
  background: var(--surface-2);
  box-shadow: inset 3px 0 0 var(--ink);
}

.entry-time {
  grid-row: 1 / span 2;
  padding-top: 1px;
  color: var(--ink-2);
  font-size: 13px;
}

.entry-title {
  overflow: hidden;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.entry-title small {
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
}

.entry-text {
  grid-column: 2 / -1;
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 13.5px;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Status: Punkt + Wort */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}

.tag::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-3);
}

.tag.ok { color: var(--ok); }
.tag.ok::before { background: var(--ok); }
.tag.attn { color: var(--accent-text); }
.tag.attn::before { background: var(--accent); }
.tag.crit { color: var(--crit); }
.tag.crit::before { background: var(--crit); }

/* ---------- Details ---------- */

.detail {
  position: sticky;
  top: 16px;
}

@media (max-width: 980px) {
  .detail { position: static; }
}

.detail-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.detail-head h2 {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 13px;
}

.detail-section {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.detail-section:last-child { border-bottom: 0; }

.label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 700;
}

.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 16px;
}

.facts dt { color: var(--ink-2); }
.facts dd { font-weight: 600; }

/* Gesprächsverlauf wie ein Protokoll, nicht als Chatblasen */
.transcript {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px 12px;
  font-size: 13.5px;
}

.transcript dt {
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 700;
  padding-top: 1px;
}

.transcript dt.is-agent { color: var(--accent-text); }

.reasons-list li {
  position: relative;
  padding-left: 16px;
}

.reasons-list li + li { margin-top: 4px; }

.reasons-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--crit);
}

/* Antwortentwurf */
.draft {
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #FFFFFF;
  font-size: 13.5px;
  white-space: pre-wrap;
}

.original {
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 13.5px;
}

.original summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
}

.original p {
  margin-top: 8px;
  padding-left: 12px;
  border-left: 2px solid var(--line-strong);
  white-space: pre-wrap;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.btn {
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
}

.btn:hover { border-color: var(--ink); }

.btn.primary {
  background: var(--button);
  border-color: var(--button);
  color: var(--ink);
}

.btn.primary:hover { border-color: var(--ink); }

.btn[disabled] {
  cursor: default;
  opacity: 0.6;
}

.demo-note {
  color: var(--ink-2);
  font-size: 13px;
}

/* ---------- Unterer Bereich ---------- */

.lower {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

@media (max-width: 980px) {
  .lower { grid-template-columns: minmax(0, 1fr); }
}

table.plain {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.plain th {
  padding: 0 10px 8px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 700;
  text-align: left;
}

table.plain td {
  padding: 9px 10px 9px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.plain tr:last-child td { border-bottom: 0; }

.table-scroll { overflow-x: auto; }

/* Balken (Nutzung) */
.bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line-strong);
}

.bar {
  flex: 1 1 0;
  min-width: 6px;
  background: var(--ink);
  border-radius: 2px 2px 0 0;
}

.bar.is-today { background: var(--accent); }

.bar-labels {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  color: var(--ink-3);
  font-size: 11px;
}

.bar-labels span {
  flex: 1 1 0;
  min-width: 6px;
  text-align: center;
}

.usage-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.usage-facts b {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.usage-facts span {
  color: var(--ink-2);
  font-size: 12.5px;
}

/* Morgenübersicht (E-Mail) */
.digest {
  font-size: 13.5px;
}

.digest p + p,
.digest p + ul,
.digest ul + p { margin-top: 10px; }

.digest li {
  position: relative;
  padding-left: 14px;
}

.digest li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-3);
}

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 24px;
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12.5px;
}
