/* Terry Cockpit — Área "Análise" (nutzt die Tokens aus style.css) */

.ta-main { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 0; background: var(--bg-base); }
.ta-main[hidden] { display: none !important; }

/* Seitenleiste */
.ta-side { background: var(--bg-panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: 14px 10px; gap: 18px; }
.ta-nav { display: flex; flex-direction: column; gap: 2px; }
.ta-nav-group { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); padding: 14px 10px 6px; }
.ta-nav-group:first-child { padding-top: 2px; }
.ta-nav-item { display: block; padding: 7px 10px; border-radius: 6px; color: var(--text-sec); text-decoration: none; font-size: 13px; font-weight: 500; border-left: 2px solid transparent; transition: background var(--t-fast), color var(--t-fast); }
.ta-nav-item:hover { background: var(--bg-raised); color: var(--text); }
.ta-nav-item.is-active { background: var(--rose-tint); color: var(--text); border-left-color: var(--rose); }
.ta-side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 12px 6px 0; border-top: 1px solid var(--border); }

/* Inhalt */
.ta-content { overflow-y: auto; min-height: 0; padding: 22px 26px 56px; }
.ta-view { max-width: 1280px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.ta-view[hidden] { display: none !important; }
.ta-page-head { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px 20px; }
.ta-page-title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.ta-page-sub { color: var(--text-sec); font-size: 13px; margin-top: 2px; }
.ta-page-head .ta-toolbar { margin-left: auto; }

.ta-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); align-items: start; }
.ta-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ta-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ta-grid-wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

/* Karten */
.ta-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px; min-width: 0; box-shadow: var(--sh-1); }
.ta-card-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px 0; }
.ta-card-titles { flex: 1; min-width: 0; }
.ta-card-title { font-size: 14px; font-weight: 600; }
.ta-card-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.ta-card-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.ta-card-body { padding: 14px 16px 16px; min-width: 0; }
.ta-chart-area { min-height: 60px; min-width: 0; }

/* Kennzahlen */
.ta-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: 12px; }
.ta-kpi { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; box-shadow: var(--sh-1); min-width: 0; }
.ta-kpi-label { font-size: 12px; color: var(--text-sec); }
.ta-kpi-value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ta-kpi-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.ta-kpi-ok .ta-kpi-value { color: var(--ok); }
.ta-kpi-warn .ta-kpi-value { color: var(--warn); }
.ta-kpi-err .ta-kpi-value { color: var(--err); }
.ta-kpi-accent .ta-kpi-value { color: var(--rose-hover); }

/* Bedienelemente */
.ta-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.ta-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ta-field-label { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.ta-select, .ta-input { height: 30px; background: var(--bg-raised); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 0 10px; font-size: 13px; min-width: 0; transition: border-color var(--t-fast); }
.ta-select:focus, .ta-input:focus { border-color: var(--rose); outline: none; }
.ta-input[type="search"] { min-width: 200px; }
.ta-input::placeholder { color: var(--text-muted); }
.ta-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--bg-raised); }
.ta-seg-btn { padding: 0 11px; height: 28px; font-size: 12px; font-weight: 600; color: var(--text-sec); }
.ta-seg-btn:hover { color: var(--text); background: var(--bg-hover); }
.ta-seg-btn.is-active { background: var(--rose); color: var(--text-invert); }

/* Tabellen */
.ta-table-wrap { overflow-x: auto; min-width: 0; }
.ta-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.ta-table th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; position: sticky; top: 0; background: var(--bg-panel); }
.ta-table th.is-sortable { cursor: pointer; }
.ta-table th.is-sortable:hover { color: var(--text); }
.ta-table th[aria-sort="ascending"]::after { content: ' ▴'; }
.ta-table th[aria-sort="descending"]::after { content: ' ▾'; }
.ta-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.ta-table tr:last-child td { border-bottom: none; }
.ta-table tr.is-clickable { cursor: pointer; }
.ta-table tr.is-clickable:hover td, .ta-table tr.is-clickable:focus-visible td { background: var(--bg-hover); }
.ta-r { text-align: right !important; }
.ta-c { text-align: center !important; }
.ta-wrap { white-space: normal; overflow-wrap: anywhere; }
.ta-muted { color: var(--text-muted); }
.ta-pager { display: flex; align-items: center; gap: 6px; justify-content: flex-end; padding-top: 10px; }
.ta-pager-info { color: var(--text-muted); font-size: 12px; margin-right: 6px; }
.ta-pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--bg-raised); color: var(--text-sec); border: 1px solid var(--border); white-space: nowrap; }
.ta-pill-ok { color: var(--ok); background: var(--ok-tint); border-color: var(--ok-line); }
.ta-pill-warn { color: var(--warn); background: var(--warn-tint); border-color: var(--warn-line); }
.ta-pill-err { color: var(--err); background: var(--err-tint); border-color: var(--err-line); }
.ta-pill-info { color: var(--info); background: rgba(109,168,232,.12); border-color: rgba(109,168,232,.38); }
.ta-link { color: var(--rose-hover); background: none; text-decoration: none; cursor: pointer; padding: 0; text-align: left; }
.ta-link:hover { text-decoration: underline; }

/* Zustände */
.ta-state { padding: 28px 12px; text-align: center; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ta-error { color: var(--err); }
.ta-error-detail { font-size: 12px; color: var(--text-muted); }
.ta-loading { flex-direction: row; justify-content: center; }
.ta-spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--rose); animation: ta-spin .8s linear infinite; }
@keyframes ta-spin { to { transform: rotate(360deg); } }
.ta-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Diagramme */
.ta-svg { display: block; overflow: visible; }
.ta-svg .ta-grid-line { stroke: var(--border); stroke-width: 1; }
.ta-svg .ta-baseline { stroke: var(--border-strong); stroke-width: 1; }
.ta-svg .ta-axis { fill: var(--text-muted); font-size: 11px; font-family: var(--font-ui); }
.ta-svg .ta-value-label { fill: var(--text); font-size: 11px; font-weight: 600; font-family: var(--font-ui); }
.ta-svg .ta-hover-band { fill: var(--bg-hover); }
.ta-svg .ta-hit:focus-visible { outline: none; stroke: var(--rose-hover); stroke-width: 1.5; }
.ta-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; font-size: 12px; color: var(--text-sec); }
.ta-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.ta-legend-key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ta-tip { position: fixed; z-index: 1000; pointer-events: none; background: var(--bg-raised); border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 10px; box-shadow: var(--sh-3); font-size: 12px; min-width: 120px; max-width: 280px; }
.ta-tip[hidden] { display: none; }
.ta-tip-title { color: var(--text-sec); font-weight: 600; margin-bottom: 4px; }
.ta-tip-row { display: flex; align-items: center; gap: 8px; line-height: 1.7; }
.ta-tip-key { width: 10px; height: 3px; border-radius: 2px; flex: none; }
.ta-tip-label { color: var(--text-sec); flex: 1; }
.ta-tip-value { color: var(--text); font-variant-numeric: tabular-nums; }

.ta-hbars { display: flex; flex-direction: column; gap: 6px; }
.ta-hbar { display: grid; grid-template-columns: minmax(90px, 34%) minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; padding: 3px 4px; border-radius: 6px; width: 100%; }
.ta-hbar.is-clickable:hover { background: var(--bg-hover); }
.ta-hbar-label { display: flex; flex-direction: column; min-width: 0; }
.ta-hbar-name { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ta-hbar-sub { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ta-hbar-track { height: 12px; }
.ta-hbar-bar { height: 12px; border-radius: 0 4px 4px 0; }
.ta-hbar-value { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; }

.ta-heat { display: grid; gap: 2px; font-size: 11px; overflow-x: auto; }
.ta-heat-col, .ta-heat-row { color: var(--text-muted); display: flex; align-items: center; }
.ta-heat-col { justify-content: center; padding-bottom: 4px; }
.ta-heat-row { padding-right: 10px; white-space: nowrap; }
.ta-heat-cell { height: 30px; border-radius: 4px; display: flex; align-items: center; justify-content: center; color: var(--text-sec); background: var(--bg-raised); font-variant-numeric: tabular-nums; border: 1px solid transparent; }
.ta-heat-cell.is-dark { color: var(--text-invert); font-weight: 600; }
.ta-heat-cell.is-empty { background: transparent; }
.ta-heat-cell.is-closed { background-image: repeating-linear-gradient(135deg, transparent 0 5px, rgba(255,255,255,.05) 5px 6px); }
.ta-heat-cell:hover, .ta-heat-cell:focus-visible { border-color: var(--rose-hover); outline: none; }

/* Mobil */
@media (max-width: 900px) {
  .ta-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .ta-content, .ta-views, .ta-view { min-width: 0; }
  .ta-side { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px 10px; gap: 8px 12px; border-right: none; border-bottom: 1px solid var(--border); overflow: visible; }
  .ta-nav { flex: 1 1 100%; flex-direction: row; gap: 4px; overflow-x: auto; scrollbar-width: thin; }
  .ta-nav-group { display: none; }
  .ta-nav-item { white-space: nowrap; border-left: none; border-bottom: 2px solid transparent; border-radius: 6px 6px 0 0; flex: none; }
  .ta-nav-item.is-active { border-bottom-color: var(--rose); }
  .ta-side-foot { flex: 1 1 100%; flex-direction: row; justify-content: space-between; margin: 0; border: none; padding: 0; }
  .ta-content { padding: 14px 12px 40px; }
  .ta-page-head .ta-toolbar { margin-left: 0; }
  .ta-grid, .ta-grid-2, .ta-grid-3, .ta-grid-wide { grid-template-columns: minmax(0, 1fr); }
  .ta-hbar { grid-template-columns: minmax(80px, 40%) minmax(0, 1fr) auto; }
}

/* Kopfleiste des Cockpits auf schmalen Bildschirmen: alle Reiter erreichbar (horizontal scrollbar) */
@media (max-width: 760px) {
  .topbar { gap: 6px; padding: 0 8px; }
  .brand { font-size: 0; gap: 0; }
  .brand-emoji { font-size: 20px; }
  .view-tabs { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .view-tabs::-webkit-scrollbar { display: none; }
  .view-tab { padding: 0 10px; white-space: nowrap; flex: none; }
  .topbar-spacer, .agent-name, .agent .avatar { display: none; }
  #toggle-side { display: none; }
}
