:root {
  --bg0: #0c1118;
  --bg1: #121a24;
  --bg2: #182333;
  --line: rgba(148, 183, 210, 0.14);
  --text: #e7eef6;
  --muted: #8fa3b8;
  --amber: #f0b429;
  --teal: #2ec4b6;
  --teal-dim: rgba(46, 196, 182, 0.16);
  --amber-dim: rgba(240, 180, 41, 0.14);
  --danger: #ff6b6b;
  --ok: #3dd68c;
  --radius: 14px;
  --font: "Manrope", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(46, 196, 182, 0.12), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(240, 180, 41, 0.08), transparent 50%),
    linear-gradient(180deg, var(--bg0), #0a0e14 80%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  opacity: 0.35;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  width: min(1280px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

/* Header */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  animation: rise 0.55s ease both;
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.brand-mark {
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal);
  font-weight: 700;
}
.brand h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.brand h1 span { color: var(--amber); }
.brand p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 36rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}
.controls label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.controls input[type="date"] {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  outline: none;
}
.controls input[type="date"]:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-dim);
}
.dp-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
}
.dp-field { position: relative; }
.dp { position: relative; }
.dp.is-open { z-index: 50; }
.dp-trigger {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  min-width: 16.5rem;
  min-height: 44px;
  padding: 0.45rem 0.75rem;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.dp-trigger:focus-visible,
.dp.is-open .dp-trigger {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-dim);
  outline: none;
}
.dp-main {
  font-weight: 700;
  font-size: 0.98rem;
}
.dp-sub {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: none;
}
.dp-sub:empty { display: none; }
.dp-chev {
  margin-left: auto;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
  flex: none;
}
.dp.is-open .dp-chev { transform: rotate(225deg) translateY(-1px); }
.dp-pop {
  position: fixed;
  z-index: 80;
  width: 20.5rem;
  padding: 0.85rem;
  background: #121a24;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.dp-head {
  display: grid;
  grid-template-columns: 2.4rem 1fr 2.4rem;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.7rem;
}
.dp-title {
  text-align: center;
  font-weight: 800;
  font-size: 1.05rem;
  text-transform: none;
  letter-spacing: 0;
}
.dp-nav,
.dp-today,
.dp-day {
  font-family: var(--font);
  color: var(--text);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.dp-nav {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 1.35rem;
  line-height: 1;
}
.dp-nav:hover:not(:disabled),
.dp-day:hover:not(:disabled),
.dp-today:hover:not(:disabled) { background: var(--teal-dim); }
.dp-nav:disabled,
.dp-day:disabled { opacity: 0.28; cursor: default; }
.dp-week,
.dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.dp-week {
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  text-align: center;
}
.dp-day {
  height: 2.45rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.92rem;
}
.dp-day.is-out { color: var(--muted); }
.dp-day.is-today { box-shadow: inset 0 0 0 1px var(--teal); }
.dp-day.is-on {
  background: var(--teal);
  color: #04201c;
}
.dp-day.is-on.is-today { box-shadow: none; }
.dp-foot { margin-top: 0.65rem; }
.dp-today {
  width: 100%;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}
.dp-hint {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: 0;
}
.dp-hint[hidden] { display: none; }
.btn {
  font-family: var(--font);
  font-weight: 700;
  border: 0;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  cursor: pointer;
  background: linear-gradient(135deg, var(--teal), #1aa896);
  color: #04201c;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn:disabled { opacity: 0.55; cursor: wait; transform: none; }

.meta-line {
  margin: -0.5rem 0 1.25rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-family: var(--mono);
  min-height: 1.2em;
}

/* Retrospective */
.retro {
  background: linear-gradient(180deg, rgba(24, 35, 51, 0.92), rgba(14, 20, 30, 0.92));
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 1rem 1.15rem 1.1rem;
  margin-bottom: 1.15rem;
  box-shadow: var(--shadow);
}
.retro-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.retro-head h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.retro-note {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
  max-width: 46rem;
}
.retro-kpi-title {
  margin: 0.15rem 0 0.4rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.retro-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}
.retro-kpis.is-status,
.retro-kpis.is-moves {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.retro-kpi {
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
}
.retro-kpi .label {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.retro-kpi .value {
  font-family: var(--mono);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.retro-foot {
  display: block;
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0;
  text-transform: none;
}
.retro-now {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0 0 0.7rem;
}
.retro-now-card {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--line);
  border-top: 2px solid var(--teal);
  border-radius: 10px;
  padding: 0.45rem 0.7rem 0.5rem;
}
.retro-now-card .label {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.retro-now-card .value {
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 0.1rem;
}
.retro-now-card .retro-foot { margin-top: 0.2rem; }
.retro-toolbar {
  margin-bottom: 0.7rem;
}
.retro-stack-note {
  margin: 0.55rem 0 0;
  max-width: 46rem;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}
.retro-chart {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 3px;
  align-items: end;
  height: 236px;
}
.retro-col {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
  gap: 4px;
  cursor: pointer;
}
.retro-plot {
  flex: 1;
  display: flex;
  align-items: flex-end;
  min-height: 0;
  width: 100%;
}
.retro-plot.is-group { height: 100%; }
.retro-group {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 100%;
  height: 100%;
}
.retro-bar {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 3px 3px 1px 1px;
}
.retro-stack {
  width: 100%;
  display: flex;
  flex-direction: column-reverse;
  border-radius: 4px 4px 2px 2px;
  overflow: hidden;
  min-height: 2px;
}
.retro-seg { min-height: 0; }
.retro-lbl {
  font-size: 0.58rem;
  color: var(--muted);
  font-family: var(--mono);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
}
.retro-lbl.is-hidden { visibility: hidden; }
.retro-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.1rem;
  margin-top: 0.7rem;
}
.retro-legend.is-moves {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.retro-legend-item {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.75rem;
  min-width: 0;
}
.retro-legend-item b {
  display: block;
  color: var(--text);
  font-weight: 700;
}
.retro-legend-item .retro-foot { margin-top: 0.15rem; }
.retro-swatch {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 3px;
  flex-shrink: 0;
}
.retro-status {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.4rem 0;
}
.retro-chart.is-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: rgba(8, 12, 18, 0.35);
}
.retro-loader {
  width: min(440px, calc(100% - 2rem));
  text-align: center;
}
.retro-spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 0.75rem;
  border: 3px solid var(--line);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.retro-loader-stage {
  color: var(--teal);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.retro-loader-text {
  margin-top: 0.4rem;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.35;
}
.retro-loader-track {
  margin: 0.85rem auto 0;
  height: 4px;
  border-radius: 99px;
  background: rgba(148, 183, 210, 0.16);
  overflow: hidden;
}
.retro-loader-track > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--amber));
  transition: width 0.35s ease;
}

/* Nav pipes */
.pipe-nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  animation: rise 0.6s ease 0.05s both;
}
.pipe-nav a {
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(18, 26, 36, 0.75);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  transition: 0.15s ease;
}
.pipe-nav a:hover, .pipe-nav a.active {
  color: var(--text);
  border-color: rgba(46, 196, 182, 0.45);
  background: var(--teal-dim);
}

/* Sections / accordion */
.section {
  background: linear-gradient(180deg, rgba(24, 35, 51, 0.92), rgba(14, 20, 30, 0.92));
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 0.35rem 1.2rem 0.35rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  animation: rise 0.55s ease both;
}
.section.is-open { padding-bottom: 1.25rem; }
.section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  padding: 0.75rem 0;
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius);
  list-style: none;
  width: 100%;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
}
.section-head::-webkit-details-marker { display: none; }
.section-head:hover h2 { color: var(--teal); }
.section-head .head-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.section-head .chev {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--teal);
  transition: transform 0.2s ease, background 0.15s ease;
  flex-shrink: 0;
  background: rgba(0,0,0,0.2);
}
.chev-icon {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
}
.section.is-open > .section-head .chev { transform: rotate(90deg); background: var(--teal-dim); }
.section-head h2 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}
.section-head .hint {
  color: var(--muted);
  font-size: 0.85rem;
  font-family: var(--mono);
}
.section-body {
  display: none;
  padding-top: 0.25rem;
}
.section.is-open .section-body { display: block; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}
.kpi {
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 0.95rem;
  overflow: hidden;
  position: relative;
}
.kpi::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--teal-dim);
  pointer-events: none;
}
.kpi:nth-child(2)::after { background: var(--amber-dim); }
.kpi .label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}
.kpi .value {
  font-family: var(--mono);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  animation: pop 0.45s ease both;
}
.kpi .sub {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.panels {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.9rem;
  margin-bottom: 1rem;
}
.panel {
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem;
}
.panel h3 {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

/* Hours */
.hours-chart { position: relative; }
.hours {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 3px;
  align-items: end;
  height: 110px;
}
.hour {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  gap: 4px;
  cursor: pointer;
}
.hour-tip-src { display: none; }
.hours-chart > .hour-tip,
.retro-chart > .hour-tip {
  position: absolute;
  z-index: 30;
  width: max-content;
  max-width: 240px;
  padding: 0.55rem 0.65rem 0.5rem;
  border-radius: 10px;
  background: #0e1622;
  border: 1px solid rgba(46, 196, 182, 0.35);
  box-shadow: var(--shadow);
  pointer-events: none;
  text-align: left;
}
.hours-chart > .hour-tip[hidden],
.retro-chart > .hour-tip[hidden] { display: none; }
.hour-tip-title {
  color: var(--muted);
  font-size: 0.68rem;
  font-family: var(--mono);
  letter-spacing: 0.02em;
}
.hour-tip-value {
  margin: 0.15rem 0 0.35rem;
  font-size: 0.92rem;
  font-weight: 800;
}
.hour-tip-tag {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.72rem;
  line-height: 1.35;
  padding: 0.08rem 0;
}
.hour-tip-tag span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hour-tip-tag b {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--teal);
}
.hour-tip-empty {
  color: var(--muted);
  font-size: 0.72rem;
}
.retro-chart > .hour-tip { max-width: 320px; }
.hour-tip-note {
  margin: -0.05rem 0 0.28rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 1.35;
}
.hour .bar {
  width: 100%;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, var(--teal), #178f84);
  min-height: 2px;
  transform-origin: bottom;
  animation: grow 0.55s ease both;
}
.hour .lbl {
  font-size: 0.58rem;
  color: var(--muted);
  font-family: var(--mono);
}

/* Status board */
.status-board-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.status-board-head h3 { margin: 0; }
.tumbler {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--line);
  gap: 2px;
}
.tumbler-btn {
  position: relative;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 700;
  border: 0;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  transition: 0.15s ease;
}
.mode-tip {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 360px;
  max-width: 70vw;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: #0e1622;
  border: 1px solid rgba(46, 196, 182, 0.35);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  z-index: 8;
}
.tumbler-btn:hover .mode-tip,
.tumbler-btn:focus-visible .mode-tip { display: block; }
.retro-toolbar .mode-tip {
  left: 0;
  right: auto;
  width: min(420px, 70vw);
}
.mode-hint {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}
.tumbler-btn:hover { color: var(--text); }
.tumbler-btn.is-active {
  background: linear-gradient(135deg, var(--teal), #1aa896);
  color: #04201c;
}
.tumbler-btn[data-mode="moved"].is-active {
  background: linear-gradient(135deg, var(--amber), #d97706);
  color: #2a1a00;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}
.chip {
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.25);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  cursor: pointer;
  transition: 0.15s ease;
}
.chip span {
  font-family: var(--mono);
  opacity: 0.75;
  margin-left: 0.2rem;
}
.chip:hover { color: var(--text); border-color: rgba(46,196,182,0.4); }
.chip.is-active {
  color: var(--text);
  border-color: rgba(240,180,41,0.55);
  background: var(--amber-dim);
}
.status-list { display: flex; flex-direction: column; gap: 0.35rem; }
.status-row {
  display: grid;
  grid-template-columns: 1.85rem minmax(0, 1fr) 42px;
  gap: 0.45rem;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 0.15rem 0;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.status-chev {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--teal);
  background: rgba(0,0,0,0.25);
  transition: transform 0.2s ease, background 0.15s ease;
}
.status-chev .chev-icon { width: 1.15rem; height: 1.15rem; }
.status-item.is-open .status-chev { transform: rotate(90deg); background: var(--teal-dim); }
.status-deals { display: none; padding: 0.15rem 0 0.55rem 2.2rem; }
.status-item.is-open .status-deals { display: block; }
table.status-deals { font-size: 0.82rem; }
table.status-deals th:nth-child(1),
table.status-deals td:nth-child(1) { width: auto; }
table.status-deals th:nth-child(2),
table.status-deals td:nth-child(2) { width: 5.2rem; }
table.status-deals th:nth-child(3),
table.status-deals td:nth-child(3) { width: 9.2rem; }
table.status-deals th:nth-child(4),
table.status-deals td:nth-child(4) { width: 11rem; }
.status-track {
  height: 22px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}
.status-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(46,196,182,0.85), rgba(46,196,182,0.35));
  width: 0;
  transition: width 0.55s ease;
}
.status-name {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 16px);
  text-shadow: 0 1px 2px rgba(0,0,0,0.75);
}
.status-count {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
  text-align: right;
}
.status-foot {
  margin-top: 0.65rem;
  font-size: 0.78rem;
  font-family: var(--mono);
}

/* Managers */
.mgr-list { display: flex; flex-direction: column; gap: 0.2rem; }
.mgr-head, .mgr-row {
  display: grid;
  grid-template-columns: 1.85rem minmax(0, 1.4fr) repeat(5, minmax(3.2rem, 0.7fr));
  gap: 0.35rem;
  align-items: center;
}
.mgr-head {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 0.15rem 0 0.35rem;
}
.mgr-row {
  width: 100%;
  margin: 0;
  padding: 0.35rem 0;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.mgr-row span:not(.status-chev):not(.mgr-name) {
  font-family: var(--mono);
  font-size: 0.82rem;
}
.mgr-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.mgr-body { display: none; padding: 0.15rem 0 0.55rem 1.85rem; }
.mgr-item.is-open .mgr-body { display: block; }
.mgr-item.is-open .status-chev { transform: rotate(90deg); background: var(--teal-dim); }
table.mgr-calls { font-size: 0.82rem; }
table.mgr-calls th:nth-child(1),
table.mgr-calls td:nth-child(1) { width: 7.2rem; }
table.mgr-calls th:nth-child(2),
table.mgr-calls td:nth-child(2) { width: 6.2rem; }
table.mgr-calls th:nth-child(3),
table.mgr-calls td:nth-child(3) { width: auto; }
table.mgr-calls th:nth-child(4),
table.mgr-calls td:nth-child(4) { width: 11rem; }

/* Tags */
.tag-list { display: flex; flex-direction: column; gap: 0.45rem; }
.tag-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 0.5rem;
  align-items: center;
}
.tag-track {
  height: 22px;
  background: rgba(255,255,255,0.05);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.tag-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--amber), #d97706);
  width: 0;
  transition: width 0.6s ease;
}
.tag-name {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 16px);
  text-shadow: 0 1px 2px rgba(0,0,0,0.7);
}
.tag-count {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  text-align: right;
}

/* Managers + table */
.table-wrap { overflow-x: hidden; border-radius: var(--radius); border: 1px solid var(--line); }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  table-layout: fixed;
}
th, td {
  padding: 0.55rem 0.55rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
table.deals-table th:nth-child(1),
table.deals-table td:nth-child(1) { width: 4.2rem; }
table.deals-table th:nth-child(2),
table.deals-table td:nth-child(2) { width: 8.2rem; }
table.deals-table th:nth-child(3),
table.deals-table td:nth-child(3) { width: 12.5rem; white-space: normal; }
table.deals-table th:nth-child(4),
table.deals-table td:nth-child(4) { width: 3.2rem; }
table.deals-table th:nth-child(5),
table.deals-table td:nth-child(5) { width: 9rem; }
table.deals-table th:nth-child(6),
table.deals-table td:nth-child(6) { width: 5.5rem; }
table.deals-table th:nth-child(7),
table.deals-table td:nth-child(7) { width: 4.5rem; }
.deal-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
th {
  background: rgba(0,0,0,0.25);
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}
td { background: rgba(10, 14, 20, 0.35); }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(46, 196, 182, 0.06); }
a.deal {
  color: var(--teal);
  text-decoration: none;
  font-weight: 600;
}
a.deal:hover { text-decoration: underline; }
.pill {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: var(--amber-dim);
  color: var(--amber);
  font-size: 0.72rem;
  margin: 0 0.15rem 0.15rem 0;
  font-weight: 600;
}
.muted { color: var(--muted); }
.warn { color: var(--danger); }
.ok { color: var(--ok); }

.empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
}

.loading {
  display: none;
  margin: 1.5rem auto 2rem;
  width: 36px;
  height: 36px;
  border: 3px solid var(--line);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loading.on { display: block; }

.error-box {
  display: none;
  margin: 1rem 0;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255,107,107,0.35);
  background: rgba(255,107,107,0.08);
  color: #ffb4b4;
}
.error-box.on { display: block; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes pop {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes grow {
  from { transform: scaleY(0.15); opacity: 0.4; }
  to { transform: scaleY(1); opacity: 1; }
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .retro-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .retro-now { grid-template-columns: 1fr; }
  .retro-legend.is-moves { grid-template-columns: 1fr; }
  .panels { grid-template-columns: 1fr; }
  .hour .lbl { display: none; }
  .hour:nth-child(3n) .lbl { display: block; }
}
@media (max-width: 560px) {
  .wrap { width: calc(100% - 1.2rem); }
  .kpi .value { font-size: 1.25rem; }
  .retro-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .retro-kpi .value { font-size: 1.15rem; }
}

a.inline-link {
  color: var(--teal);
  font-weight: 700;
  text-decoration: none;
}
a.inline-link:hover { text-decoration: underline; }

.tr-list { display: flex; flex-direction: column; gap: 0.85rem; }
.tr-card {
  background: linear-gradient(180deg, rgba(24, 35, 51, 0.92), rgba(14, 20, 30, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.05rem;
  box-shadow: var(--shadow);
}
.tr-card.is-active { border-color: rgba(46, 196, 182, 0.45); }
.tr-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}
.tr-pos {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.8rem;
}
.tr-title {
  margin: 0.15rem 0 0;
  font-size: 1.02rem;
  font-weight: 700;
}
.tr-sub { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.86rem; }
.tr-sub a { color: var(--teal); text-decoration: none; }
.tr-pill {
  flex: none;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.28rem 0.6rem;
  background: rgba(143, 163, 184, 0.14);
  color: var(--muted);
}
.tr-pill.downloading, .tr-pill.transcribing { background: var(--teal-dim); color: var(--teal); }
.tr-pill.done { background: rgba(61, 214, 140, 0.14); color: var(--ok); }
.tr-pill.error { background: rgba(255, 107, 107, 0.14); color: var(--danger); }
.tr-bar {
  margin-top: 0.75rem;
  height: 6px;
  border-radius: 99px;
  background: rgba(143, 163, 184, 0.16);
  overflow: hidden;
}
.tr-bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--teal), #7ee0d6);
  transition: width 0.35s ease;
}
.tr-detail { margin: 0.45rem 0 0; color: var(--muted); font-size: 0.82rem; }
.tr-text {
  margin: 0.75rem 0 0;
  white-space: pre-wrap;
  line-height: 1.45;
  font-size: 0.95rem;
}
.tr-text p { margin: 0.35rem 0; }
.role {
  font-weight: 800;
  letter-spacing: 0.01em;
}
.role.op { color: var(--teal); }
.role.cand { color: var(--amber); }
.tr-error { margin: 0.55rem 0 0; color: #ffb4b4; font-size: 0.86rem; }

.header-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}
.screen-nav {
  display: flex;
  gap: 0.2rem;
  padding: 0.22rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(12, 17, 24, 0.72);
}
.screen-nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 700;
  padding: 0.42rem 0.9rem;
  border-radius: 999px;
}
.screen-nav a.is-on {
  color: var(--text);
  background: var(--teal-dim);
}
.tr-tools {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: -0.4rem 0 0.85rem;
}
.tr-tools input,
.tr-tools select {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.62rem 0.75rem;
}
.tr-tools input { flex: 1; min-width: 16rem; }
.tr-deal {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(24, 35, 51, 0.92), rgba(14, 20, 30, 0.92));
  box-shadow: var(--shadow);
}
.tr-deal + .tr-deal { margin-top: 0.75rem; }
.tr-deal-head,
.tr-call-head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: transparent;
  color: inherit;
  border: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  padding: 0.9rem 1rem;
}
.tr-deal-head strong { display: block; font-size: 1.02rem; }
.tr-deal-body,
.tr-call-body { display: none; padding: 0 1rem 1rem; }
.tr-deal.is-open > .tr-deal-body,
.tr-call.is-open > .tr-call-body { display: block; }
.tr-chevron { color: var(--muted); transition: transform 0.15s ease; }
.tr-deal.is-open > .tr-deal-head .tr-chevron { transform: rotate(90deg); }
.tr-call { border-top: 1px solid var(--line); }
.tr-call-head span:first-child { font-weight: 650; }
.tr-download { display: inline-flex; margin-top: 0.75rem; text-decoration: none; }
@media (max-width: 720px) {
  html, body { overflow-x: clip; }
  .wrap {
    width: min(1280px, calc(100% - 1rem - env(safe-area-inset-left) - env(safe-area-inset-right)));
    padding-top: 1rem;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
  }
  .top { align-items: stretch; gap: 0.9rem; margin-bottom: 1.1rem; }
  .brand h1 { font-size: 1.65rem; }
  .brand p { font-size: 0.88rem; max-width: none; }
  .header-side { align-items: stretch; width: 100%; }
  .screen-nav { width: 100%; }
  .screen-nav a {
    flex: 1;
    text-align: center;
    padding: 0.72rem 0.4rem;
  }
  .controls { width: 100%; }
  .controls label { flex: 1 1 100%; }
  .controls input[type="date"],
  .tr-tools input,
  .tr-tools select,
  .dp-trigger,
  .dp-pop {
    width: 100%;
    min-height: 44px;
    font-size: 16px;
  }
  .dp-trigger { min-width: 0; }
  .dp-pop { min-height: 0; }
  .controls .btn { flex: 1; min-height: 44px; }
  .meta-line { line-height: 1.4; }

  .retro, .section { padding-left: 0.75rem; padding-right: 0.75rem; }
  .retro-kpis,
  .retro-kpis.is-status,
  .retro-kpis.is-moves,
  .retro-now { grid-template-columns: 1fr 1fr; }
  .tumbler { display: flex; flex-wrap: wrap; width: 100%; }
  .tumbler-btn { flex: 1 1 45%; text-align: center; min-height: 40px; }
  .mode-tip { display: none !important; }
  .retro-chart:not(.is-loading) {
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    grid-auto-columns: minmax(2.4rem, 1fr);
    padding-bottom: 0.2rem;
    -webkit-overflow-scrolling: touch;
  }
  .hours-chart { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .hours { min-width: 28rem; }
  .pipe-nav a { padding: 0.55rem 0.75rem; }
  .section-head { flex-wrap: nowrap; align-items: center; }
  .section-head h2 { font-size: 1rem; }
  .section-head .hint {
    flex: 0 1 9.2rem;
    text-align: right;
    line-height: 1.3;
    font-size: 0.75rem;
  }
  .kpi .value { font-size: 1.35rem; }

  .table-wrap,
  .status-deals-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table.deals-table { min-width: 46rem; }
  table.status-deals { min-width: 32rem; }
  table.mgr-calls { min-width: 28rem; }
  .status-deals, .mgr-body { padding-left: 0; }

  .mgr-head { display: none; }
  .mgr-row {
    grid-template-columns: 1.85rem repeat(3, minmax(0, 1fr));
    row-gap: 0.35rem;
    align-items: start;
  }
  .mgr-row .status-chev { grid-row: 1 / span 3; align-self: center; }
  .mgr-row .mgr-name {
    grid-column: 2 / -1;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
  .mgr-row span:nth-child(n + 3)::before {
    content: "";
    display: block;
    color: var(--muted);
    font-family: var(--font);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .mgr-row span:nth-child(3)::before { content: "Исх."; }
  .mgr-row span:nth-child(4)::before { content: "Вх."; }
  .mgr-row span:nth-child(5)::before { content: "Первых"; }
  .mgr-row span:nth-child(6)::before { content: "Мед."; }
  .mgr-row span:nth-child(7)::before { content: "Ср."; }

  .tr-tools { flex-direction: column; }
  .tr-tools input { min-width: 0; }
  .tr-deal-head, .tr-call-head {
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.85rem 0.75rem;
  }
  .tr-call-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }
  .tr-call-head .tr-pill { align-self: flex-start; }
  .tr-deal-head > span:first-child { flex: 1 1 auto; min-width: 0; }
  .tr-chevron { flex: none; margin-top: 0.15rem; }
  .tr-deal-head strong,
  .tr-sub,
  .tr-call-head span:first-child {
    white-space: normal;
    overflow-wrap: break-word;
    line-height: 1.35;
  }
  .tr-call-head span:first-child { width: 100%; }
  .tr-deal-body, .tr-call-body { padding: 0 0.75rem 0.85rem; }
  .tr-text { font-size: 0.92rem; }
  .tr-download { width: 100%; justify-content: center; min-height: 44px; }
}

@media (max-width: 420px) {
  .retro-kpis,
  .retro-kpis.is-status,
  .retro-kpis.is-moves,
  .retro-now,
  .kpi-grid { grid-template-columns: 1fr; }
  .hour:nth-child(3n) .lbl { display: none; }
  .hour:nth-child(6n) .lbl { display: block; }
}
