/* Fit and motion. Colour is deep cayenne: wine ground, cayenne light. */

html { scroll-padding-bottom: 88px; }
body {
  background:
    radial-gradient(900px 480px at 0% -10%, rgba(226, 59, 50, 0.2), transparent 60%),
    radial-gradient(820px 460px at 100% 0%, rgba(110, 16, 40, 0.32), transparent 58%),
    radial-gradient(700px 420px at 80% 110%, rgba(255, 90, 54, 0.14), transparent 55%),
    radial-gradient(900px 500px at 20% -8%, rgba(226, 59, 50, 0.16), transparent 62%),
    var(--bg);
}

.go-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 12px;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid rgba(226, 59, 50, 0.35);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(226, 59, 50, 0.12), rgba(20, 8, 12, 0.4));
}
.go-kicker {
  align-self: center;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ffb4a2;
}
.go-form label { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 12px; color: var(--muted); }
.go-form input, .go-form select { min-width: 220px; max-width: 100%; }
#go-status { align-self: center; font-size: 13px; color: #ffd0c4; }

.login-page {
  min-height: 100dvh;
  background:
    radial-gradient(520px 320px at 15% 20%, rgba(226, 59, 50, 0.28), transparent 70%),
    radial-gradient(560px 340px at 85% 15%, rgba(110, 16, 40, 0.4), transparent 70%),
    radial-gradient(640px 380px at 50% 110%, rgba(255, 90, 54, 0.16), transparent 70%),
    var(--bg);
}
.login-card { animation: mek-card-in 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.login-card::before {
  height: 3px;
  background: linear-gradient(90deg, #ffd0c4, #e23b32 42%, #8e1d2c 78%, #ff5a36);
}
.login-card .btn.primary { min-height: 48px; font-size: 15px; }
.login-form input { min-height: 48px; font-size: 16px; }

@keyframes mek-card-in {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.grid > .stack:first-child .panel { box-shadow: inset 0 2px 0 #ff8f78, var(--shadow); }
.grid > .stack:nth-child(2) .panel { box-shadow: inset 0 2px 0 #e23b32, var(--shadow); }
.map-panel { box-shadow: inset 0 2px 0 #c45c7a, var(--shadow); }

.dim .bar span {
  background: var(--dim, var(--grad));
  box-shadow: 0 0 12px var(--dim, transparent);
}
.tab[aria-selected="true"] { box-shadow: inset 0 -2px 0 var(--gold); }

.kpi[data-tone="gold"] { border-top: 3px solid #e23b32; }
.kpi[data-tone="cyan"] { border-top: 3px solid #4de8c5; }
.kpi[data-tone="green"] { border-top: 3px solid #34d399; }
.kpi[data-tone="ember"] { border-top: 3px solid #ff6b1a; }
.kpi[data-tone="violet"] { border-top: 3px solid #9b7bff; }
.kpi[data-tone="amber"] { border-top: 3px solid #f0a93a; }
.kpi[data-tone="gold"] strong { color: #ffb4a2; text-shadow: 0 0 16px rgba(255, 180, 162, 0.45); }
.kpi[data-tone="cyan"] strong { color: #4de8c5; text-shadow: 0 0 16px rgba(77, 232, 197, 0.45); }
.kpi[data-tone="green"] strong { color: #34d399; text-shadow: 0 0 16px rgba(52, 211, 153, 0.4); }
.kpi[data-tone="ember"] strong { color: #ff8a4d; text-shadow: 0 0 16px rgba(255, 107, 26, 0.45); }
.kpi[data-tone="violet"] strong { color: #c4b2ff; text-shadow: 0 0 16px rgba(155, 123, 255, 0.5); }
.kpi[data-tone="amber"] strong { color: #f0a93a; text-shadow: 0 0 16px rgba(240, 169, 58, 0.4); }

.live-chart, .mek-pulse { min-width: 0; }
.live-chart { padding: 8px 12px 4px; }
.mek-chart { display: block; width: 100%; height: auto; }
.mek-donut-track { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 11; }
.mek-arc { fill: none; stroke-width: 11; stroke-linecap: butt; }
.mek-donut-pct { fill: #f4f4f1; font-size: 18px; font-weight: 750; font-family: var(--sans); }
.mek-donut-cap { fill: #8a8e95; font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; font-family: var(--sans); }
.mek-col-bg { opacity: 0.28; }
.mek-col {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: mek-rise 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes mek-rise {
  from { transform: scaleY(0.2); opacity: 0.35; }
  to { transform: scaleY(1); opacity: 1; }
}
.mek-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  padding: 2px 4px 8px;
  font-size: 12px;
  color: var(--muted);
}
.mek-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mek-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.mek-chart-note { flex-basis: 100%; font-size: 12px; }

.record-btn[data-state="idle"] {
  background: radial-gradient(circle at 32% 28%, #ffd0a8, #ff6b1a 42%, #e23d4d 78%);
}
.session-pill[data-state="active"] {
  border-color: rgba(255, 107, 26, 0.7);
  box-shadow: 0 0 0 4px rgba(255, 107, 26, 0.12), 0 0 24px -8px #ff6b1a;
}

@media (max-width: 820px) {
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    align-items: center;
    padding: calc(8px + env(safe-area-inset-top)) 2px 8px;
  }
  .brand { min-width: 0; }
  .product i, .system .model, .system .state { display: none; }
  .account { justify-self: end; }
  .session-pill { grid-column: 1 / -1; justify-self: start; }
  .systems {
    grid-column: 1 / -1;
    margin-left: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
  }
  .app-nav {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 80;
    display: flex;
    justify-content: space-between;
    gap: 2px;
    padding: 4px;
    border-radius: 18px;
    background: rgba(8, 9, 11, 0.94);
    border: 1px solid rgba(226, 59, 50, 0.35);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(77, 232, 197, 0.08);
    backdrop-filter: blur(16px);
  }
  .app-nav a {
    flex: 1;
    min-height: 44px;
    display: grid;
    place-items: center;
    padding: 8px 2px;
    font-size: 11px;
    text-align: center;
  }
  #app { padding: 0 12px calc(84px + env(safe-area-inset-bottom)); }
  .rec-dock, .rec-other { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .setup .second > .switch,
  .setup .second > .btn { margin-top: 0; width: 100%; justify-content: center; }
  input, select, textarea { font-size: 16px; }
  .projects-split, .scaffold-grid, .dash-graph-body, .dash-grid.two { grid-template-columns: 1fr; }
  .projects-nav { border-right: 0; border-bottom: 1px solid var(--line); max-height: none; flex-direction: row; overflow-x: auto; }
  .dash-tools { margin-left: 0; width: 100%; }
  .dash-tools input[type="search"] { min-width: 0; width: 100%; }
  .dash-body { padding: 14px 12px 28px; }
  .statusbar { gap: 8px; }
  dialog { max-height: calc(100dvh - 24px); overflow: auto; }
  .btn, .app-nav a, .tab, .filter { min-height: 44px; }
}

@media (min-width: 821px) and (max-width: 1180px) {
  .systems { max-width: 100%; }
  .product i { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .login-card, .mek-col, .record-btn[data-state="active"]::after { animation: none; }
  .mek-arc { transition: none; }
}
