/* Zimac Finn — service styles layered on the shared kit (/zimac-ui.css).
   Finn's sub-accent is his agent amber (#fbbf24); the indigo spine and every
   other token comes from the kit. Charts use the kit's series cycle
   --zui-c1..c6, read from CSS by the JS that draws the SVG plots. */

/* The UA's [hidden] rule ties with class-selector specificity — without this,
   any later `.foo { display: … }` silently un-hides "hidden" elements. All
   show/hide in this SPA is via the hidden attribute. */
[hidden] {
  display: none !important;
}

:root {
  --finn: #fbbf24;
  --finn-dim: rgba(251, 191, 36, 0.14);
  /* Dark ink for text sitting ON amber (white fails contrast there). */
  --finn-ink: #231c0b;
}

/* ---------- the Finn theme ----------
   This surface is an extension of the agent: his amber (#fbbf24, the desktop's
   --c-finn) becomes the accent the whole kit keys off, and his ¤ glyph is the
   mark. Charts keep the validated kit series cycle — the theme recolors
   chrome, not data. */

.finn-page {
  --zui-accent: #fbbf24;
  --zui-accent-2: #fcd34d;
  --zui-accent-dim: #d97706;
  --zui-grad-accent: linear-gradient(150deg, #fcd34d, #fbbf24 55%, #f59e0b);
  --zui-glow: 0 0 0 3px rgba(251, 191, 36, 0.18);
  --zui-glow-strong: 0 6px 18px -6px rgba(251, 191, 36, 0.5);
}

/* Amber CTA needs dark ink, not the kit's white-on-indigo. */
.finn-page .btn {
  color: var(--finn-ink);
}

.finn-page .btn.ghost {
  color: var(--zui-text-muted);
}

.finn-page .btn.ghost:hover {
  color: var(--zui-text);
}

.finn-page .btn.link {
  color: var(--zui-accent);
}

.finn-page .btn.danger {
  color: #fff;
}

/* Finn's mark: his ¤ in the amber gradient box, dark ink, warm glow. */
.finn-page .brand-mark {
  color: var(--finn-ink);
  font-weight: 700;
  box-shadow: 0 6px 16px -5px rgba(251, 191, 36, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Warm wordmark instead of the sage→indigo ink. */
.finn-page .gradient-text,
.finn-page .brand-name.gradient {
  background-image: linear-gradient(90deg, #fcd34d, #f59e0b);
}

/* Active nav wears his color. */
.finn-page .nav-item.active {
  background: var(--finn-dim);
}

.finn-page .nav-item.active::before {
  background: linear-gradient(#fcd34d, #f59e0b);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

.finn-sub {
  color: var(--finn);
}

/* ---------- sign-in ---------- */

.signin-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.signin-card {
  max-width: 460px;
  width: 100%;
  padding: 34px 34px 26px;
  text-align: center;
}

.signin-brand {
  justify-content: center;
  margin-bottom: 18px;
}

.signin-title {
  font-size: 26px;
  line-height: 1.25;
  margin: 0 0 10px;
}

.signin-lede {
  color: var(--zui-text-muted);
  margin: 0 0 20px;
}

.signin-btn {
  width: 100%;
}

.token-fallback {
  margin-top: 14px;
  text-align: left;
}

.token-fallback summary {
  color: var(--zui-text-muted);
  cursor: pointer;
  font-size: 13px;
}

.token-fallback form {
  margin-top: 10px;
}

/* ---------- shell ---------- */

.nav-item svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.workspace {
  margin-top: auto;
  padding: 10px 0 6px;
  border-top: 1px solid var(--zui-border);
}

.workspace + .side-foot {
  margin-top: 8px;
}

.ws-name {
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.org-field .optional {
  color: var(--zui-text-faint);
  font-weight: 400;
}

.org-hint {
  text-align: left;
  margin-top: 6px;
}

.who {
  color: var(--zui-text-faint);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.view-sub {
  color: var(--zui-text-muted);
  font-size: 13px;
  margin-top: 2px;
}

/* ---------- controls row (explorer + tile editor) ---------- */

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 14px;
}

.controls .field {
  margin: 0;
  min-width: 130px;
}

/* ---------- receipts ---------- */

.receipt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 12px;
  color: var(--zui-text-muted);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--zui-border);
}

.receipt .sep {
  color: var(--zui-text-faint);
}

.badge.evidence-observed {
  color: var(--zui-ok);
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.08);
}

.badge.evidence-modeled {
  color: var(--finn);
  border-color: rgba(251, 191, 36, 0.35);
  background: var(--finn-dim);
}

/* ---------- charts ---------- */

.chart-card {
  padding: 18px;
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-svg text {
  font-family: var(--zui-font);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--zui-text-muted);
}

.legend .key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend .swatch {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex: none;
}

.chart-tooltip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  background: var(--zui-surface-2);
  border: 1px solid var(--zui-border-strong);
  border-radius: var(--zui-radius-sm);
  box-shadow: var(--zui-shadow-2);
  padding: 8px 10px;
  font-size: 12px;
  max-width: 320px;
}

.chart-tooltip .tt-date {
  color: var(--zui-text);
  font-weight: 600;
  margin-bottom: 4px;
}

.chart-tooltip .tt-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--zui-text-muted);
}

.chart-tooltip .tt-row .v {
  font-variant-numeric: tabular-nums;
  color: var(--zui-text);
}

/* ---------- dashboards ---------- */

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}

.tile-grid .tile-wide {
  grid-column: 1 / -1;
}

.tile-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.tile-head h3 {
  margin: 0;
  font-size: 14px;
}

.tile-head .btn {
  flex: none;
}

.stat-big {
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-sub {
  color: var(--zui-text-muted);
  font-size: 12px;
  margin-top: 4px;
}

.dash-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

/* ---------- tables ---------- */

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.share-bar {
  display: inline-block;
  height: 6px;
  border-radius: 3px;
  background: var(--zui-accent);
  vertical-align: middle;
  min-width: 2px;
}

/* ---------- connections ---------- */

.conn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.conn-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.conn-head h3 {
  margin: 0;
  font-size: 15px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conn-meta {
  color: var(--zui-text-muted);
  font-size: 12px;
  margin: 2px 0;
}

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

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag-chips .pill {
  cursor: pointer;
  user-select: none;
}

.tag-chips .pill.on {
  border-color: var(--finn);
  color: var(--finn);
}

.setup-steps {
  counter-reset: step;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.setup-steps li {
  position: relative;
  padding: 0 0 16px 34px;
}

.setup-steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--finn-dim);
  color: var(--finn);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.code-block {
  position: relative;
  background: var(--zui-bg);
  border: 1px solid var(--zui-border);
  border-radius: var(--zui-radius-sm);
  padding: 10px 12px;
  margin-top: 8px;
  font-family: var(--zui-mono);
  font-size: 11.5px;
  line-height: 1.5;
  white-space: pre;
  overflow-x: auto;
  color: var(--zui-text-muted);
}

.code-block .copy {
  position: absolute;
  top: 6px;
  right: 6px;
}

.provider-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex: none;
}

.provider-mark.aws {
  background: rgba(255, 153, 0, 0.14);
  color: #ff9900;
}

.provider-mark.demo {
  background: var(--finn-dim);
  color: var(--finn);
}

/* ---------- misc ---------- */

.error-note {
  color: var(--zui-danger);
  font-size: 12px;
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
  z-index: 100;
  background: var(--zui-surface-2);
  padding: 8px 12px;
  border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 760px) {
  .app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .side-nav {
    flex-direction: row;
  }

  .side-foot {
    margin-left: auto;
  }

  .workspace {
    margin-top: 0;
    border-top: none;
    padding: 0 8px;
    flex: none;
  }
}
