/* File path: frontend/css/theme.css
   Version: 1.1.2
   What will be changed in this version:
   - Add tiny, self-contained styles for the outlets treemap (light editorial-style labels).
   - No other selectors altered to avoid regressions. */

body::before, body::after { content:""; display:block; height:2px; background:var(--fg); opacity:.85 }
body::after { height:1px; background:var(--rule) }
header.appbar { position:sticky; top:0; background:var(--bg); z-index:10; border-bottom:1px solid var(--rule) }
.appbar .row { display:flex; align-items:center; justify-content:space-between; height:56px }
.title { font-family: var(--font-serif); font-size:24px; font-weight:500; letter-spacing:.2px }
.main { display:grid; grid-template-columns:180px 1fr; gap:var(--gap-24); align-items:start; margin-top:var(--gap-16) }
.section-nav { position:sticky; top:72px; padding-top:var(--gap-8); border-top:1px solid var(--rule) }
.nav-link { display:block; padding:6px 0; color:var(--accent); font-size:var(--size-14) }
.nav-link:hover { text-decoration: underline }
.section { scroll-margin-top:72px; padding:var(--gap-16); border:1px solid var(--rule); border-radius:var(--radius-12); background:var(--card) }
.section + .section { margin-top:var(--gap-16) }
.runbar { display:flex; justify-content:space-between; align-items:center; padding:var(--gap-12) var(--gap-16); border:1px solid var(--rule); border-radius:var(--radius-12); background:var(--card) }
.form-row { display:grid; grid-template-columns:repeat(3,1fr); gap:var(--gap-16) }
.mapbox { height:260px; border:1px solid var(--rule); border-radius:var(--radius-12); overflow:hidden }
.editorial-figure { margin:6px 0 10px 0 }
.editorial-figure img {
  width:100%;
  height: var(--figure-h);
  object-fit: cover;
  object-position: 50% 50%;
  border:1px solid var(--rule);
  border-radius:var(--radius-12);
}

@media (max-width: 640px){
  :root{ --figure-h: 140px; }
}
.editorial-figure figcaption { margin-top:6px; color:var(--muted); font-size:var(--size-13) }
.clock-icon, .radio-icon { color:#6b7280 }
.heatmap svg { display:block; width:100%; height:auto; border:1px solid var(--rule); border-radius:12px; background:#fff }

/* Heatmap rows */
.heatrow{ display:grid; grid-template-columns:56px 1fr; align-items:center; gap:8px }
.heatrow-label{ color:var(--muted); font-size:13px; text-align:right; padding-right:4px }

/* Container border (not on SVG) */
.heatrow-svg{ position:relative; border:1px solid var(--rule); border-radius:8px; background:#fff }
.heatrow-svg svg{ display:block; width:100%; height:auto; border:none; border-radius:8px }

/* ---- Hour tick frames (outside the strips) ---- */
.heatframe{ display:grid; grid-template-columns:56px 1fr; align-items:center }
.heatframe > div:first-child{ height:16px } /* left spacer to align with day labels */
.heatframe .heatframe-track{ position:relative; height:16px }

/* Outside tick labels (colon aligned on the guide line) */
.heatrow-ticks{
  position:absolute; left:0; right:0; top:0; height:16px;
  pointer-events:none;
}
.heatrow-ticks .tick{ position:absolute; left:0; top:0; width:0; height:16px; }
.heatrow-ticks .tick .hh,
.heatrow-ticks .tick .col,
.heatrow-ticks .tick .mm{
  position:absolute; top:0; line-height:16px; font-size:11px; color:#6B7280; white-space:nowrap;
}
/* place the colon exactly on the guide line */
.heatrow-ticks .tick .col{ left:0; transform:translateX(-50%); font-weight:500 }
/* nudge hour/min either side */
.heatrow-ticks .tick .hh{ left:-8px; transform:translateX(-100%); padding-right:2px }
.heatrow-ticks .tick .mm{ left:8px; padding-left:2px }

/* faint rules to “cap” the grid */
.heatframe.top .heatframe-track{ border-bottom:1px solid var(--rule) }
.heatframe.bottom .heatframe-track{ border-top:1px solid var(--rule) }

/* Tabs */
.tabs{ display:flex; gap:6px; border-bottom:1px solid var(--rule); margin:6px 0 8px 0; flex-wrap:wrap }
.tab{
  appearance:none; background:transparent; border:none; cursor:pointer;
  padding:6px 10px; border-radius:10px 10px 0 0; color:var(--fg);
  border:1px solid transparent; border-bottom:1px solid transparent;
  display:flex; align-items:center; gap:8px;
}
.tab:hover{ background:rgba(0,0,0,.03) }
.tab.active{ border-color:var(--rule); border-bottom-color:transparent; background:var(--card) }
.tab-dot{ width:8px; height:8px; border-radius:50%; background:var(--tab-dot,#666) }

/* Swatches & dots */
.swatch{ width:18px; height:18px; border-radius:50%; border:1px solid var(--rule); background:var(--c); cursor:pointer; box-shadow:0 1px 0 rgba(0,0,0,.04) }
.swatch.active{ outline:2px solid var(--fg) }
.list-dot{ display:inline-block; width:10px; height:10px; border-radius:50%; background:var(--dot,#333); margin-right:8px; vertical-align:middle }

/* Tree map */
.treemap-card{ border:1px solid var(--rule); border-radius:12px; padding:10px; background:#fff }
.treemap{ display:block }
.tm-label{
  font-size:12px;
  font-weight:400;          /* not bold */
  fill:#ffffff;             /* light label on colour */
  opacity:.92;
  paint-order: stroke;      /* subtle outline for contrast */
  stroke: rgba(0,0,0,.18);
  stroke-width:.6px;
}

/* --- Global pill buttons (editorial style) --- */
button.pill {
  appearance: none;
  border: 1px solid #E5E7EB;
  background: #fff;
  color: #111827;
  border-radius: 9999px;
  padding: 6px 14px;
  line-height: 1.2;
  font: inherit;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
  box-shadow: 0 1px 0 rgba(17,24,39,0.04);
}

button.pill:hover {
  background: #F9FAFB;
  border-color: #D1D5DB;
}

button.pill:focus-visible {
  outline: 2px solid #111827;
  outline-offset: 2px;
}

/* Softer editorial-style selected state for pills */
button.pill.active,
button.pill[aria-pressed="true"] {
  background: #F3F4F6;   /* gentle gray fill */
  color: #111827;        /* keep dark text (no white inversion) */
  border-color: #D1D5DB; /* subtle selected border */
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05); /* slight pressed feel */
}
.pillbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;       /* add spacing between pills */
  align-items: center;
}

/* ---------------------------------------------
   Authentication UI
---------------------------------------------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #F8FAFC 0%, #EFF6FF 100%);
  padding: 48px 16px;
}

.auth-card {
  width: min(520px, 100%);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.auth-card__header {
  padding: 32px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.auth-card__title {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.2;
  color: #0f172a;
}

.auth-card__subtitle {
  margin: 0;
  color: #475569;
  font-size: 15px;
  line-height: 1.6;
}

.auth-card__body {
  padding: 32px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-field__label {
  font-weight: 600;
  font-size: 14px;
  color: #1f2937;
}

.auth-field input {
  height: 44px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  padding: 0 14px;
  font-size: 15px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.auth-field select {
  height: 44px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  padding: 0 12px;
  font-size: 15px;
  background: #ffffff;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.auth-field input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  outline: none;
}

.auth-field select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  outline: none;
}

.auth-error {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.4);
  color: #991b1b;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
}

.auth-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

.auth-hint {
  margin-top: 16px;
  font-size: 14px;
  color: #475569;
}

.link-button {
  background: none;
  border: none;
  color: #2563eb;
  font-weight: 600;
  cursor: pointer;
  padding: 0 4px;
  transition: color .15s ease;
}

.link-button:hover {
  color: #1d4ed8;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 10px 18px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.btn:disabled {
  cursor: progress;
  opacity: 0.7;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.21);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.24);
}

.btn-secondary {
  background: #ffffff;
  border-color: #cbd5f5;
  color: #1f2937;
}

.btn-secondary:hover:not(:disabled) {
  background: #f8fafc;
}

.btn-small {
  padding: 8px 12px;
  font-size: 13px;
}

.qr-code {
  display: block;
  width: min(100%, var(--qr-size, 220px));
  height: auto;
  aspect-ratio: 1;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.qr-code svg {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.qr-code-placeholder {
  width: min(100%, var(--qr-size, 220px));
  aspect-ratio: 1;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(226, 232, 240, 0.6);
  color: #475569;
  text-align: center;
  padding: 16px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.qr-code-placeholder.error {
  background: rgba(254, 215, 215, 0.7);
  color: #7f1d1d;
}


.auth-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  border-radius: 9999px;
  background: rgba(241, 245, 249, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.26);
  margin-left: 8px;
}

.auth-user-chip__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.auth-user-chip__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.auth-user-chip__name {
  font-weight: 600;
  font-size: 14px;
  color: #111827;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-user-chip__role {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
}

/* ---------------------------------------------
   Landing page styles
---------------------------------------------- */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, #f8fafc 0%, #e0f2fe 100%);
  color: #0f172a;
}

.landing__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px clamp(24px, 6vw, 64px);
}

.landing__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.landing__mark {
  font-size: 22px;
}

.landing__cta-group {
  display: inline-flex;
  gap: 12px;
}

.landing__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 48px;
  padding: 0 clamp(24px, 6vw, 80px) 72px;
}

.landing__account {
  width: 100%;
  display: flex;
  justify-content: center;
}

.landing__account-inner {
  width: min(960px, 100%);
  display: flex;
  justify-content: center;
}

.landing__account-inner > * {
  width: 100%;
}

.landing__hero {
  display: grid;
  gap: 48px;
  align-items: center;
}

@media (min-width: 960px) {
  .landing__hero {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  }
}

.landing__hero-copy h1 {
  font-size: clamp(36px, 4vw, 52px);
  line-height: 1.1;
  margin: 16px 0;
}

.landing__hero-copy p {
  font-size: 17px;
  line-height: 1.6;
  color: #334155;
  max-width: 560px;
}

.landing__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.12em;
}

.landing__actions {
  display: inline-flex;
  gap: 16px;
  margin: 24px 0;
}

.landing__customers {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 0;
  margin: 0;
  color: #475569;
  font-size: 14px;
}

.landing__hero-visual {
  display: flex;
  justify-content: center;
  padding: 16px;
}

.landing__device {
  position: relative;
  width: clamp(280px, 40vw, 360px);
  border-radius: 28px;
  background: linear-gradient(160deg, #1d4ed8 0%, #1e3a8a 100%);
  box-shadow: 0 32px 60px rgba(15, 23, 42, 0.26);
  overflow: hidden;
}

.landing__device-top {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.landing__device-indicator {
  width: 64px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
}

.landing__device-body {
  padding: 32px;
  display: grid;
  gap: 24px;
}

.landing__device-chart {
  height: 140px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.92) 0%, rgba(240, 249, 255, 0.6) 100%);
  position: relative;
  overflow: hidden;
}

.landing__device-chart::after {
  content: '';
  position: absolute;
  inset: 20px;
  background: conic-gradient(from 90deg, #2563eb, #38bdf8, #a855f7);
  mask: linear-gradient(#000, transparent);
  opacity: 0.4;
}

.landing__device-lines {
  display: grid;
  gap: 12px;
}

.landing__device-lines::before,
.landing__device-lines::after {
  content: '';
  height: 12px;
  border-radius: 999px;
  background: rgba(241, 245, 249, 0.9);
  box-shadow: 0 8px 24px rgba(8, 47, 73, 0.22);
}

.landing__device-lines::after {
  width: 60%;
}

.landing__features {
  display: grid;
  gap: 24px;
}

@media (min-width: 960px) {
  .landing__features {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.landing-feature {
  background: rgba(255, 255, 255, 0.82);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.landing-feature h3 {
  margin: 0 0 12px;
  font-size: 20px;
  color: #0f172a;
}

.landing-feature p {
  margin: 0;
  color: #475569;
  line-height: 1.5;
}

.account-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  width: 100%;
}

.account-grid--extras {
  display: contents;
}

.account-card {
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.account-card__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #0f172a;
}

.account-card__copy {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: #475569;
}

.account-summary {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.account-summary__avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: #dbeafe;
  color: #1d4ed8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.account-summary__name {
  font-size: 20px;
  font-weight: 600;
  color: #0f172a;
}

.account-summary__email {
  font-size: 14px;
  color: #475569;
  margin-top: 4px;
}

.account-summary__meta {
  font-size: 14px;
  color: #64748b;
  margin-top: 6px;
}

.account-summary__meta span {
  font-weight: 600;
}

.account-alert {
  font-size: 14px;
  line-height: 1.5;
  padding: 12px 16px;
  border-radius: 10px;
}

.account-alert--success {
  background: #ecfdf5;
  color: #047857;
}

.account-alert--error {
  background: #fee2e2;
  color: #b91c1c;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}

.account-actions--form {
  justify-content: flex-end;
  margin-top: 8px;
}

.account-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.account-form__cluster {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.account-form__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.account-form__label {
  font-size: 14px;
  font-weight: 500;
  color: #0f172a;
}

.account-form__field input {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: #0f172a;
}

.account-form__field input:disabled {
  background: #e2e8f0;
  color: #475569;
  cursor: not-allowed;
}

.account-hint {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
}

.account-hint--warning {
  background: #fef3c7;
  color: #92400e;
}

.account-hint--info {
  background: #dbeafe;
  color: #1d4ed8;
}

.account-hint--error {
  background: #fee2e2;
  color: #b91c1c;
}

.account-signin-preview {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px dashed rgba(148, 163, 184, 0.6);
  border-radius: 12px;
  padding: 16px;
  background: #f8fafc;
}

.account-signin-preview__providers {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.account-signin-preview__password-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.account-signin-preview__providers .btn {
  background: #ffffff;
  color: #1f2937;
  border-color: #cbd5f5;
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.15);
}

.account-placeholder {
  border: 1px dashed rgba(148, 163, 184, 0.6);
  border-radius: 12px;
  padding: 20px;
  color: #94a3b8;
  font-style: italic;
  text-align: center;
  background: #f8fafc;
}

.account-toggle {
  display: flex;
  gap: 12px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 999px;
  padding: 4px;
  background: #f8fafc;
  margin-bottom: 12px;
}

.account-toggle__option {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 600;
  color: #475569;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.account-toggle__option span {
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
}

.account-toggle__option:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.account-toggle__option--active {
  background: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(29, 78, 216, 0.25);
}

.account-toggle__option--active span {
  color: rgba(255, 255, 255, 0.82);
}

.account-card--mfa {
  background: linear-gradient(135deg, rgba(224, 242, 254, 0.9) 0%, rgba(237, 233, 254, 0.88) 100%);
  border-color: rgba(129, 140, 248, 0.32);
}

.account-mfa-steps {
  display: grid;
  gap: 16px;
}

.account-mfa-step {
  display: flex;
  gap: 16px;
  align-items: center;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 14px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  flex-wrap: wrap;
}

.account-mfa-step__badge {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #1d4ed8;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.account-mfa-step__content {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.account-mfa-step__title {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 4px;
}

.account-mfa-step__body {
  font-size: 14px;
  color: #475569;
  line-height: 1.6;
}

.account-mfa-step--code {
  justify-content: space-between;
  flex-wrap: wrap;
}

.account-mfa-step--code input {
  width: 140px;
  text-align: center;
  letter-spacing: 4px;
  font-size: 16px;
  border: 1px dashed rgba(148, 163, 184, 0.6);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.9);
  color: #1f2937;
}

.account-mfa-step--code input:disabled {
  background: rgba(226, 232, 240, 0.8);
  color: #475569;
}

.account-mfa-step__qr {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.account-mfa-step__qr .qr-code {
  width: min(100%, var(--qr-size, 220px));
}

.account-mfa-preview {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
