:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --text: #e8eef7;
  --muted: #8fa3bf;
  --accent: #3d8bfd;
  --border: #2b3b52;
  --good: #3ecf8e;
  --warn: #f5a524;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "SF Pro Text", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  padding: max(1.25rem, env(safe-area-inset-top)) max(1.5rem, env(safe-area-inset-right)) 1.25rem max(1.5rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--border);
  background: #121a24;
  position: sticky;
  top: 0;
  z-index: 10;
}
h1 { margin: 0 0 .25rem; font-size: 1.35rem; }
.topbar-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .78rem;
  font-weight: 600;
  padding: .35rem .6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(26, 35, 50, .85);
  color: var(--muted);
  white-space: nowrap;
  max-width: min(100%, 16rem);
  overflow: hidden;
  text-overflow: ellipsis;
}
.sync-badge::before {
  content: "◷";
  font-size: .72rem;
  opacity: .85;
}
.sync-badge.fresh {
  color: #b8f5d8;
  border-color: rgba(62, 207, 142, .45);
  background: rgba(62, 207, 142, .12);
}
.sync-badge.stale {
  color: #fde68a;
  border-color: rgba(245, 165, 36, .45);
  background: rgba(245, 165, 36, .12);
}
.sync-badge.old,
.sync-badge.never,
.sync-badge.error {
  color: #fecaca;
  border-color: rgba(248, 113, 113, .45);
  background: rgba(248, 113, 113, .1);
}
.sync-badge.running {
  color: #bfdbfe;
  border-color: rgba(61, 139, 253, .45);
  background: rgba(61, 139, 253, .12);
}
.logout-btn {
  font-size: .82rem;
  padding: .4rem .75rem;
  color: var(--muted);
  border-color: var(--border);
  background: transparent;
}
.logout-btn:hover { color: #fff; border-color: #64748b; }
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.login-shell { width: min(420px, 100%); }
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.75rem;
}
.login-card h1 { margin-bottom: .35rem; }
.login-sub { margin-bottom: 1.25rem; }
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.login-form label { font-size: .85rem; }
.login-form input[type=text],
.login-form input[type=password] {
  background: #0f1419;
  border: 1px solid var(--border);
  color: var(--text);
  padding: .55rem .7rem;
  border-radius: 8px;
  margin-top: .35rem;
  width: 100%;
}
.login-submit { width: 100%; margin-top: .25rem; }
.login-error {
  margin: 0 0 1rem;
  color: #f87171;
  font-size: .88rem;
}
.sso-block { margin-bottom: 1rem; }
.sso-btn {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  padding: .65rem .9rem;
  border-radius: 8px;
  border: 1px solid #3b82f6;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.12);
  font-weight: 600;
}
.sso-btn:hover { background: rgba(59, 130, 246, 0.22); color: #fff; }
.sso-btn-disabled {
  opacity: 0.85;
  border-color: #475569;
  color: #94a3b8;
  background: rgba(71, 85, 105, 0.2);
  cursor: pointer;
}
.sso-btn-disabled:hover { background: rgba(71, 85, 105, 0.35); color: #e2e8f0; }
.sso-or { text-align: center; margin: .85rem 0 .25rem; font-size: .82rem; }
.muted { color: var(--muted); margin: 0; font-size: .9rem; }
.user-line {
  margin: .2rem 0 0;
  font-size: .88rem;
  font-weight: 600;
  color: #c4b5fd;
}
.sync-line { color: var(--muted); margin: .35rem 0 0; font-size: .82rem; max-width: 42rem; }
.controls { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; }
.filter-toolbar {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  min-width: min(100%, 28rem);
}
.filter-compact {
  display: none;
  align-items: stretch;
  gap: .5rem;
  width: 100%;
}
.filter-toggle {
  flex: 1;
  display: flex;
  align-items: center;
  gap: .55rem;
  text-align: left;
  min-height: 44px;
  padding: .45rem .75rem;
}
.filter-toggle-text {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
}
.filter-toggle-label {
  font-size: .72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.filter-period-summary {
  font-weight: 600;
  font-size: .92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.filter-toggle-icon {
  flex-shrink: 0;
  font-size: .85rem;
  color: var(--muted);
  transition: transform .2s ease;
}
.filter-toolbar.is-expanded .filter-toggle-icon { transform: rotate(180deg); }
.filter-refresh {
  flex-shrink: 0;
  min-width: 6.5rem;
  min-height: 44px;
}
.filter-body { width: 100%; }
.interview-date-range {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .75rem;
  align-items: center;
  margin-bottom: .35rem;
}
.interview-date-range label { font-size: .85rem; }
.drhs-filter-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .5rem 1rem;
  margin-bottom: .65rem;
}
.drhs-filter-label {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.drhs-filter-hint { font-size: .82rem; }
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}
.filter-chip {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: .35rem .75rem;
  font-size: .82rem;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.filter-chip:hover {
  border-color: #7c6fd6;
  background: rgba(124, 111, 214, .12);
}
.filter-chip.is-active {
  border-color: #a78bfa;
  background: rgba(167, 139, 250, .22);
  color: #ede9fe;
  font-weight: 600;
}
.filter-chip.is-all.is-active {
  border-color: #64748b;
  background: rgba(100, 116, 139, .25);
  color: #e2e8f0;
}
.desktop-only-refresh { display: none; }
.topbar.has-filter-toolbar .sync-line { display: none; }
.topbar.has-filter-toolbar .sync-badge { max-width: none; }
label { display: flex; flex-direction: column; gap: .25rem; font-size: .8rem; color: var(--muted); }
input[type=date] {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .45rem .6rem;
  border-radius: 8px;
}
.presets { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.sprint-select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .5rem .8rem;
  cursor: pointer;
  min-width: 9rem;
}
.sprint-select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
button {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .5rem .8rem;
  cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); font-weight: 600; }
button.sync { border-color: var(--good); color: var(--good); }
.sync-loader { border-color: var(--good); background: rgba(62, 207, 142, .12); color: #b8f5d8; }

.sync-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-top: .55rem;
  max-width: 28rem;
}
.sync-progress-wrap.hidden,
.sync-progress-wrap[hidden] { display: none !important; }
.sync-progress-track {
  height: 10px;
  border-radius: 999px;
  background: #0f1419;
  border: 1px solid var(--border);
  overflow: hidden;
}
.sync-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--good), var(--accent));
  transition: width .35s ease;
}
.sync-progress-wrap.indeterminate .sync-progress-fill {
  width: 35% !important;
  animation: sync-progress-pulse 1.2s ease-in-out infinite;
}
@keyframes sync-progress-pulse {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
.sync-progress-label {
  font-size: .82rem;
  color: #b8f5d8;
}
.sync-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  margin-top: .85rem;
}
.sync-page-progress {
  margin-top: .9rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.sync-page-progress .sync-progress-track { height: 12px; }
.sync-page-progress.idle .sync-progress-label { color: var(--muted); }
.sync-page-progress.idle .sync-progress-fill { width: 0% !important; background: #3a4658; }
.sync-tab-status {
  margin: 0;
  padding: .45rem .7rem;
  border-radius: 8px;
  background: #0f1419;
  border: 1px solid var(--border);
  font-size: .9rem;
}
button:hover { filter: brightness(1.08); }
main { padding: 1.25rem 1.5rem 2rem; max-width: 1400px; margin: 0 auto; }
.main-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: .5rem;
}
.main-tab {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px 8px 0 0;
  color: var(--muted);
  padding: .55rem 1rem;
  font-weight: 600;
  cursor: pointer;
}
.main-tab:hover { color: #fff; background: rgba(61, 139, 253, .08); }
.main-tab.active {
  color: #fff;
  border-color: var(--border);
  border-bottom-color: #121a24;
  background: #1a2430;
}
.tab-badge {
  display: inline-block;
  margin-left: .35rem;
  padding: .1rem .45rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  background: rgba(62, 207, 142, .2);
  color: var(--good);
}
.tab-badge.running {
  background: rgba(61, 139, 253, .25);
  color: #8ec0ff;
}
.page-panel { display: none; }
.page-panel.active { display: block; }
.report-panel { display: none; }
.report-panel.active { display: block; }
.app-nav, .report-nav {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.app-nav::-webkit-scrollbar, .report-nav::-webkit-scrollbar { display: none; }
.report-nav {
  display: flex;
  gap: .4rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: .5rem;
}
.sub-tab {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  padding: .5rem .85rem;
  font-weight: 600;
  font-size: .85rem;
  white-space: nowrap;
  flex: 0 0 auto;
  cursor: pointer;
}
.sub-tab:hover { color: #fff; background: rgba(61, 139, 253, .08); }
.sub-tab.active {
  color: #fff;
  border-color: var(--border);
  background: #1a2430;
}
.deploy-inner-nav {
  margin-bottom: 1rem;
}
.welcome-hero h2 { margin-top: 0; }
.welcome-lead { font-size: 1rem; line-height: 1.5; max-width: 40rem; }
.welcome-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .75rem;
  margin: 1.25rem 0;
}
.welcome-card {
  text-align: left;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #121a24;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.welcome-card:hover { border-color: var(--accent); background: rgba(61, 139, 253, .08); }
.welcome-card-title { font-size: 1.05rem; font-weight: 700; color: #fff; }
.welcome-card-sub { font-size: .85rem; color: var(--muted); }
.welcome-hint { font-size: .82rem; }
.welcome-hint code, .sync-intro code {
  background: #0f1419;
  padding: .15rem .4rem;
  border-radius: 4px;
  font-size: .8rem;
}
.sync-intro h2 { margin-top: 0; }
.linkish {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}
.linkish:hover { color: #fff; }
.sync-tab-status {
  margin: .75rem 0 0;
  padding: .75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #121a24;
  font-size: .9rem;
}
.conversion-hero {
  margin-bottom: 1rem;
  padding: 1.25rem 1.5rem;
  border-radius: 16px;
  border: 2px solid rgba(168, 85, 247, .55);
  background: linear-gradient(135deg, rgba(88, 28, 135, .35) 0%, rgba(26, 42, 66, .9) 45%, #121a24 100%);
  box-shadow: 0 10px 32px rgba(88, 28, 135, .22);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}
.conversion-hero .conversion-main { flex: 1 1 220px; }
.conversion-hero .conversion-label {
  display: block;
  font-size: .95rem;
  font-weight: 600;
  color: #e9d5ff;
  margin-bottom: .35rem;
}
.conversion-hero .conversion-value {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  color: #e9b8ff;
  letter-spacing: -0.03em;
}
.conversion-hero .conversion-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f3e8ff;
  margin-top: .4rem;
}
.conversion-hero .conversion-sub {
  color: var(--muted);
  font-size: .9rem;
  margin-top: .35rem;
  max-width: 36rem;
}
.conversion-hero .conversion-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
}
.conversion-hero .conversion-stat {
  min-width: 5.5rem;
  text-align: center;
  padding: .65rem .9rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, .22);
  border: 1px solid rgba(168, 85, 247, .25);
}
.conversion-hero .conversion-stat .num {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
}
.conversion-hero .conversion-stat .lbl {
  font-size: .75rem;
  color: var(--muted);
  margin-top: .2rem;
}
.conversion-hero .conversion-stat .num.num-positive { color: #7dffc0; }
.conversion-hero .conversion-stat .num.num-negative { color: #ff8a8a; }
.ghir-top-hero {
  margin-bottom: .75rem;
}
.ghir-top-hero .ghir-hero-period {
  font-size: .68rem;
  margin-top: .35rem;
}
.hero-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 820px) {
  .hero-kpis { grid-template-columns: 1fr; }
}
.hero-kpi {
  background: linear-gradient(145deg, #1a2a42 0%, #121a24 100%);
  border: 1px solid rgba(61, 139, 253, .35);
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.hero-kpi .hero-value {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.hero-kpi .hero-sub {
  color: var(--muted);
  font-size: .85rem;
  margin-top: .35rem;
}
.hero-kpi .hero-label {
  color: #b8cfe8;
  font-size: .95rem;
  font-weight: 600;
  margin-top: .5rem;
}
.hero-kpi.accent-green { border-color: rgba(62, 207, 142, .45); }
.hero-kpi.accent-green .hero-value { color: #7dffc0; }
.hero-kpi.accent-red { border-color: rgba(229, 72, 77, .45); }
.hero-kpi.accent-red .hero-value { color: #ff9a9d; }
.hero-kpi.accent-blue .hero-value { color: #8ec0ff; }
.hero-kpi.accent-gold { border-color: rgba(245, 165, 36, .4); }
.hero-kpi.accent-gold .hero-value { color: #ffd080; }
.hero-kpi.accent-teal { border-color: rgba(62, 207, 180, .4); }
.hero-kpi.accent-teal .hero-value { color: #7dffe8; }
.lavka-util-hero {
  margin-bottom: 1rem;
  border-color: rgba(62, 207, 180, .35);
  background: linear-gradient(135deg, rgba(18, 42, 48, .95), rgba(22, 32, 44, .95));
}
.lavka-util-hero .util-value { color: #7dffe8; }
.hero-kpi.accent-purple .hero-value { color: #c4b5fd; }
.lavka-hero .conversion-sub { display: block; margin-top: .35rem; font-size: .82rem; }
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .9rem 1rem;
}
.card .value { font-size: 1.6rem; font-weight: 700; }
.card .label { color: var(--muted); font-size: .82rem; margin-top: .2rem; }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.panel h2 { margin: 0 0 .75rem; font-size: 1.05rem; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .55rem .6rem; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--panel); }
tbody tr:hover { background: rgba(61, 139, 253, .08); }
.loader, .error {
  padding: 1rem 1.25rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: 1rem;
}
.loader {
  background: rgba(61, 139, 253, .2);
  border: 1px solid var(--accent);
  color: #cfe3ff;
  font-weight: 600;
}
button.primary:disabled { opacity: .55; cursor: wait; }
.error { background: rgba(245, 165, 36, .12); border: 1px solid var(--warn); color: #ffdca8; }
.stale-banner {
  margin: .75rem 0;
  padding: .65rem .85rem;
  border-radius: 8px;
  background: rgba(61, 139, 253, .1);
  border: 1px solid rgba(61, 139, 253, .35);
  color: #b8d4ff;
  font-size: .92rem;
}
.hidden { display: none !important; }
.chunk-panel { border-color: rgba(62, 207, 142, .35); }
.chunk-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: baseline; justify-content: space-between; margin-bottom: .75rem; }
.chunk-head h2 { margin: 0; }
.chunk-summary { color: var(--muted); font-size: .9rem; }
.chunk-bar { height: 8px; background: #0f1419; border-radius: 999px; overflow: hidden; margin-bottom: .9rem; border: 1px solid var(--border); }
.chunk-bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--good), var(--accent)); transition: width .4s ease; }
.chunk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.chunk-item { display: grid; grid-template-columns: 1.4rem 1fr auto; gap: .6rem; align-items: center; padding: .55rem .65rem; border-radius: 8px; border: 1px solid var(--border); background: #121a24; font-size: .88rem; }
.chunk-item.done { border-color: rgba(62, 207, 142, .35); }
.chunk-item.running { border-color: rgba(61, 139, 253, .45); background: rgba(61, 139, 253, .08); }
.chunk-item.error { border-color: rgba(245, 165, 36, .45); }
.chunk-icon { text-align: center; font-size: 1rem; }
.chunk-meta { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.chart-panel canvas { max-height: 220px; }
.chart-panel.wide { grid-column: 1 / -1; }
.chart-caption {
  margin: -.25rem 0 .75rem;
  font-size: .82rem;
  line-height: 1.45;
  max-width: 52rem;
}
.chart-canvas-wrap {
  position: relative;
  width: 100%;
  min-height: 200px;
}
.coverage-chart-panel .chart-canvas-wrap canvas {
  max-height: none;
  height: 100% !important;
}
.chart-empty { margin: 1rem 0; }
.charts-inline { margin-bottom: .75rem; max-height: 180px; }
tbody tr.total-row { font-weight: 700; background: rgba(61, 139, 253, .12); }
tbody tr.total-row td { border-top: 2px solid var(--accent); }
a { color: #7eb8ff; text-decoration: none; }
a:hover { text-decoration: underline; }
.mini-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: .5rem;
  margin-bottom: .9rem;
}
.mini-card {
  background: #121a24;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .55rem .65rem;
}
.mini-value { display: block; font-size: 1.2rem; font-weight: 700; }
.mini-label { color: var(--muted); font-size: .75rem; }
.deploy-balance-banner { margin: .75rem 0 1rem; }
.mini-card.mini-loadings .mini-value { color: #ffd080; }
.mini-card.mini-removals .mini-value { color: #ff9a9d; }
.mini-card.mini-positive .mini-value { color: #7dffc0; }
.mini-card.mini-negative .mini-value { color: #ff9a9d; }

.lavka-hero { margin-bottom: 1rem; }
.lavka-offices-cards { margin-bottom: 1rem; }
.lavka-offices-cards .card { border-color: rgba(96, 165, 250, .25); }
.lavka-offices-cards .card .value { color: #93c5fd; }
.panel-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: .75rem 1rem;
  margin-bottom: .75rem;
}
.lavka-reconcile-hero { margin-bottom: 1rem; }
.lavka-reconcile-hero .reconcile-alert { color: #ff9a8b; }
.lavka-reconcile-hero .reconcile-ok { color: #9ef0d0; }

.lavka-matrix-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1rem;
  align-items: flex-end;
  margin-bottom: .85rem;
}
.lavka-matrix-filter {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .82rem;
  min-width: 9rem;
}
.lavka-matrix-filter-hint {
  font-size: .72rem;
  line-height: 1.2;
}
.lavka-matrix-filter select {
  padding: .35rem .45rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #121a24;
  color: var(--text);
  font-size: .82rem;
}
.lavka-matrix-filter select[multiple] {
  min-width: 10rem;
  max-width: 14rem;
}
.lavka-matrix-filter select[multiple] option:checked {
  background: rgba(255, 200, 87, .22);
  color: #ffc857;
}
.lavka-matrix-filter select:not([multiple]) {
  min-width: 8.5rem;
}
.lavka-matrix-axis {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .65rem;
  align-items: flex-end;
}
.lavka-matrix-axis button {
  padding: .35rem .65rem;
  font-size: .82rem;
  white-space: nowrap;
}
.lavka-matrix-summary {
  font-size: .85rem;
  text-align: right;
  white-space: nowrap;
}
.lavka-matrix-wrap {
  max-height: min(70vh, 640px);
  overflow: auto;
}
.lavka-matrix-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .84rem;
}
.lavka-matrix-table th,
.lavka-matrix-table td {
  padding: .4rem .55rem;
  border: 1px solid var(--border);
  text-align: center;
  min-width: 2.5rem;
}
.lavka-matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #1a2433;
  color: var(--muted);
  font-weight: 600;
  font-size: .78rem;
}
.lavka-matrix-table tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #151d28;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  max-width: 12rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lavka-matrix-table thead th.corner {
  left: 0;
  z-index: 3;
  min-width: 8rem;
}
.lavka-matrix-table .matrix-total-row th,
.lavka-matrix-table .matrix-total-row td {
  background: #1e2a3a;
  font-weight: 700;
  color: #ffc857;
}
.lavka-matrix-table td.matrix-empty {
  color: rgba(148, 163, 184, .35);
}
.lavka-matrix-table td.matrix-cell {
  font-weight: 600;
  color: #e2e8f0;
}
.lavka-matrix-table td.matrix-cell.has-value {
  color: #ffc857;
  cursor: help;
}

.lavka-matrix-tooltip {
  position: fixed;
  z-index: 1200;
  max-width: min(420px, 92vw);
  max-height: min(320px, 50vh);
  overflow: auto;
  padding: .55rem .65rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 200, 87, .35);
  background: #0f1620;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .45);
  pointer-events: none;
  font-size: .78rem;
  line-height: 1.35;
}
.lavka-matrix-tooltip.hidden { display: none; }
.lavka-matrix-tooltip-title {
  margin: 0 0 .45rem;
  font-weight: 600;
  color: #ffc857;
  font-size: .8rem;
}
.lavka-matrix-tooltip table {
  width: 100%;
  border-collapse: collapse;
}
.lavka-matrix-tooltip th,
.lavka-matrix-tooltip td {
  padding: .25rem .35rem;
  border-top: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.lavka-matrix-tooltip th {
  color: var(--muted);
  font-weight: 500;
  border-top: none;
}
.lavka-matrix-tooltip td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ——— Mobile / narrow screens ——— */
@media (max-width: 720px) {
  .topbar {
    padding: .85rem 1rem;
    gap: .75rem;
  }
  h1 { font-size: 1.1rem; }
  .topbar-brand { width: 100%; }
  .topbar.has-filter-toolbar .user-line,
  .topbar.has-filter-toolbar .muted#metaLine {
    display: none;
  }
  .filter-toolbar.staffing-only:not(.hidden) .filter-compact { display: flex; }
  .filter-toolbar:not(.is-expanded) .filter-body { display: none !important; }
  .filter-toolbar.is-expanded .filter-body {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
  }
  .filter-toolbar { width: 100%; min-width: 0; }
  .controls {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .controls label { width: 100%; }
  .controls input[type=date] { width: 100%; }
  .presets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .presets button, .presets .sprint-select, .controls > button {
    width: 100%;
    min-height: 44px;
  }
  main { padding: .85rem 1rem 1.5rem; }
  .main-tab, .sub-tab {
    min-height: 44px;
    padding: .6rem .75rem;
    font-size: .82rem;
  }
  .conversion-hero {
    padding: 1rem;
    flex-direction: column;
    align-items: stretch;
  }
  .conversion-hero .conversion-value { font-size: 2.2rem; }
  .conversion-hero .conversion-stats {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .conversion-hero .conversion-stat { min-width: 0; }
  .hero-kpi .hero-value { font-size: 1.9rem; }
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .card .value { font-size: 1.35rem; }
  .panel { padding: .85rem; }
  .panel h2 { font-size: .98rem; }
  table { font-size: .8rem; min-width: 520px; }
  th, td { padding: .45rem .5rem; }
  .table-wrap {
    margin: 0 -.25rem;
    border-radius: 8px;
    -webkit-overflow-scrolling: touch;
  }
  .chunk-item {
    grid-template-columns: 1.4rem 1fr;
    grid-template-rows: auto auto;
  }
  .chunk-meta {
    grid-column: 2;
    white-space: normal;
    font-size: .75rem;
  }
  .chart-panel canvas { max-height: 200px; }
  .sync-line { max-width: none; font-size: .78rem; }
  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }
  .sync-badge {
    flex: 1;
    min-width: 0;
    justify-content: center;
  }
  .welcome-cards { grid-template-columns: 1fr; }
  .main-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: .25rem;
  }
  .lavka-matrix-toolbar { flex-direction: column; align-items: stretch; }
  .lavka-matrix-filter select[multiple] { max-width: none; width: 100%; }
  .lavka-matrix-summary { text-align: left; white-space: normal; }
}

@media (min-width: 721px) {
  .filter-compact { display: none !important; }
  .filter-body { display: flex !important; }
  .desktop-only-refresh { display: inline-block; }
}

@media (max-width: 400px) {
  .cards { grid-template-columns: 1fr; }
  .presets { grid-template-columns: 1fr; }
  .conversion-hero .conversion-stats {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }
  .main-tab { flex: 0 0 auto; }
}

.alena-view-nav {
  margin-bottom: 1rem;
}
.alena-reportal-caption {
  margin: 0 0 .75rem;
}
.alena-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: .65rem;
  margin-bottom: 1.25rem;
}
.alena-kpis .kpi {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .85rem .75rem;
  text-align: center;
}
.alena-kpis .kpi-plan {
  border-color: #3b4f6b;
  background: #151d2a;
}
.alena-kpis .kpi-val {
  display: block;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.1;
}
.alena-kpis .kpi-label {
  display: block;
  margin-top: .35rem;
  font-size: .72rem;
  color: var(--muted);
  line-height: 1.25;
}
.alena-part-title {
  margin: 1.5rem 0 .75rem;
  font-size: 1.05rem;
  color: #b8d4ff;
  letter-spacing: .02em;
}
.alena-part-future { color: #9ee6c3; }
.alena-sections { display: flex; flex-direction: column; gap: .75rem; }
.alena-block { padding: 0; overflow: hidden; }
.alena-block > summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.1rem;
  font-weight: 600;
  border-bottom: 1px solid transparent;
}
.alena-block > summary::-webkit-details-marker { display: none; }
.alena-block[open] > summary {
  border-bottom-color: var(--border);
  background: #152033;
}
.alena-block-title::before {
  content: "▸ ";
  color: var(--muted);
}
.alena-block[open] .alena-block-title::before { content: "▾ "; }
.alena-block-body { padding: .85rem 1.1rem 1.1rem; }
.alena-subhead {
  margin: .75rem 0 .5rem;
  font-size: .88rem;
  color: var(--muted);
  font-weight: 600;
}
.alena-empty { margin: .5rem 0 1rem; }

/* Admin RBAC */
.admin-table-wrap { overflow-x: auto; margin: .75rem 0; }
.admin-matrix { width: 100%; border-collapse: collapse; font-size: .85rem; }
.admin-matrix th, .admin-matrix td {
  border: 1px solid var(--border);
  padding: .35rem .5rem;
  text-align: left;
}
.admin-matrix th { background: #152033; position: sticky; top: 0; }
.admin-check { text-align: center !important; }
.admin-actions { display: flex; gap: .75rem; align-items: center; }
.admin-user-add { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0 1rem; }
.admin-user-add input, .admin-user-add select { min-width: 12rem; }
.admin-user-row { cursor: pointer; }
.admin-user-row:hover { background: rgba(61, 139, 253, .08); }
.admin-user-detail { margin-top: 1rem; display: flex; flex-direction: column; gap: .65rem; }
.admin-preview {
  max-height: 16rem;
  overflow: auto;
  background: #0f1724;
  padding: .75rem;
  border-radius: 6px;
  font-size: .78rem;
}
.btn.secondary { background: transparent; border: 1px solid var(--border); }
