@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700&family=Geist+Mono:wght@450&display=swap');

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--canvas);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
button { font-family: inherit; cursor: pointer; }

/* ---------- typography ---------- */
.t-display    { font-size: 56px; font-weight: 700; line-height: .94; letter-spacing: -.035em; font-stretch: 115%; }
.t-h1         { font-size: 34px; font-weight: 700; line-height: 1.05; letter-spacing: -.025em; font-stretch: 110%; margin: 0; }
.t-h2         { font-size: 24px; font-weight: 600; line-height: 1.2; letter-spacing: -.018em; margin: 0; }
.t-h3         { font-size: 17px; font-weight: 600; line-height: 1.3; margin: 0; }
.t-body-lg    { font-size: 17px; line-height: 1.62; }
.t-label      { font-size: 13px; font-weight: 500; line-height: 1.35; }
.t-caption    { font-size: 12px; color: var(--text-tertiary); line-height: 1.45; }
.t-overline   { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--text-tertiary); font-stretch: 95%; }
.t-numeric    { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1, "zero" 1; font-weight: 500; }
.t-numeric-lg { font-size: 32px; font-weight: 700; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1, "zero" 1; }
.t-numeric-xl { font-size: 64px; font-weight: 700; line-height: .9; letter-spacing: -.04em; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1, "zero" 1; font-stretch: 112%; }
.t-mono       { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .01em; color: var(--text-secondary); }
.t-secondary  { color: var(--text-secondary); }
.t-tertiary   { color: var(--text-tertiary); }

/* ---------- app shell ---------- */
.app-shell { min-height: 100vh; padding-left: var(--sidebar-w); }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--sidebar-bg); color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column; z-index: 40;
}
.sidebar__brand { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-5) var(--sp-5) var(--sp-4); }
.sidebar__brand img { height: 22px; }
.sidebar__scope { padding: 0 var(--sp-5) var(--sp-4); }
.sidebar__nav { flex: 1; overflow-y: auto; padding: var(--sp-2) var(--sp-3) var(--sp-6); }
.sidebar__section { margin-top: var(--sp-4); }
.sidebar__section-label { padding: 0 var(--sp-3); margin-bottom: var(--sp-1); color: var(--sidebar-text-muted); }
.nav-item {
  display: flex; align-items: center; gap: var(--sp-2);
  height: 36px; padding: 0 var(--sp-3); border-radius: var(--radius-sm);
  color: var(--sidebar-text-muted); font-size: 13px; font-weight: 500;
}
.nav-item:hover { background: var(--sidebar-active-bg); color: var(--sidebar-text); }
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.nav-item.is-active { background: var(--sidebar-active-bg); color: var(--sidebar-text); box-shadow: inset 3px 0 0 var(--sidebar-accent); }
.sidebar__footer { padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--sidebar-border); }
.sidebar__profile { display: flex; align-items: center; gap: var(--sp-2); }
.sidebar__avatar {
  width: 30px; height: 30px; border-radius: var(--radius-full);
  background: var(--accent); color: var(--on-accent); display: flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.sidebar__profile-name { font-size: 12.5px; font-weight: 600; color: var(--sidebar-text); }
.sidebar__profile-role { font-size: 11px; color: var(--sidebar-text-muted); }
.sidebar__exit { margin-top: var(--sp-3); }

.ticker-rail {
  position: fixed; top: 0; left: var(--sidebar-w); right: 0; height: var(--ticker-h);
  background: var(--surface-sunken); color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; overflow: hidden; z-index: 30;
  font-family: var(--font-mono); font-size: 12px;
}
.ticker-rail__track { display: flex; align-items: center; gap: var(--sp-10); white-space: nowrap; animation: ticker-scroll 32s linear infinite; padding-left: var(--sp-5); }
.ticker-rail__item b { color: var(--text-primary); font-weight: 500; margin-left: var(--sp-1); }
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-rail__track { animation: none; } }

.topbar {
  position: fixed; top: var(--ticker-h); left: var(--sidebar-w); right: 0; height: var(--topbar-h);
  background: var(--topbar-bg); color: var(--topbar-text);
  border-bottom: 1px solid var(--topbar-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--sp-6); z-index: 30;
}
.topbar__title { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.topbar__crumb { font-size: 11.5px; color: var(--topbar-text-secondary); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 2px; }
.topbar__actions { display: flex; align-items: center; gap: var(--sp-3); }
.theme-toggle {
  display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 var(--sp-3);
  border-radius: var(--radius-sm); border: 1px solid var(--topbar-border); background: transparent;
  color: var(--topbar-text); font-size: 12px; font-weight: 500;
}

.content { margin-top: calc(var(--ticker-h) + var(--topbar-h)); padding: var(--sp-6); max-width: 1480px; }
.content--wide { padding: var(--sp-10) var(--sp-16); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: var(--sp-6); gap: var(--sp-4); flex-wrap: wrap; }
.page-head p { margin: var(--sp-1) 0 0; max-width: 60ch; }

/* ---------- grid helpers ---------- */
.grid { display: grid; gap: var(--sp-4); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) { .grid-3, .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.row { display: flex; align-items: center; gap: var(--sp-3); }
.row--between { display: flex; align-items: center; justify-content: space-between; }
.spacer { flex: 1; }

/* ---------- surfaces ---------- */
.plate { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: var(--sp-6); }
.plate-ruled { position: relative; }
.plate-ruled::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--accent); border-radius: var(--radius-md) var(--radius-md) 0 0; }
.plate-bezel { background: var(--surface-sunken); border-radius: var(--radius-lg); padding: var(--sp-1); }
.plate-bezel__inner { background: var(--surface); border-radius: var(--radius-md); padding: var(--sp-5); }

.kpi-tile { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: var(--sp-5); min-height: 116px; display: flex; flex-direction: column; justify-content: space-between; }
.kpi-tile__value { margin-top: var(--sp-2); }
.kpi-tile__sub { margin-top: var(--sp-1); }

.headline-figure { position: relative; background: var(--surface); border-radius: var(--radius-md); padding: var(--sp-8); border-left: 3px solid var(--accent); }
.headline-figure__value { margin-top: var(--sp-2); }
.headline-figure__ctx { margin-top: var(--sp-2); }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; height: 22px; padding: 3px 10px; border-radius: var(--radius-full); font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.pill-neutral  { background: var(--surface-hover); color: var(--text-secondary); }
.pill-positive { background: var(--positive-muted); color: var(--positive); }
.pill-warning  { background: var(--warning-muted); color: var(--warning); }
.pill-critical { background: var(--critical-muted); color: var(--critical); }
.pill-info     { background: var(--info-muted); color: var(--info); }
.pill-accent   { background: var(--accent-muted); color: var(--on-accent-muted); }

.tenant-chip { display: inline-flex; align-items: center; height: 20px; padding: 3px 8px; border-radius: var(--radius-xs); background: var(--accent); color: var(--on-accent); font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 18px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; border: 1px solid transparent; white-space: nowrap; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-hover); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text-primary); }
.btn-block { width: 100%; }
.btn[disabled] { background: var(--surface-hover); color: var(--text-disabled); cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field input { height: 38px; padding: 0 var(--sp-3); border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-sunken); color: var(--text-primary); font-size: 14px; font-family: inherit; }
.field input:focus { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
table.data-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.data-table thead th { text-align: left; height: 34px; padding: 0 var(--sp-3); font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-tertiary); background: var(--canvas); border-bottom: 1px solid var(--border-subtle); }
.data-table tbody td { height: 46px; padding: 0 var(--sp-3); border-bottom: 1px solid var(--border-subtle); font-size: 13.5px; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-hover); }
.data-table td.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.data-table td.id { font-family: var(--font-mono); color: var(--text-secondary); font-size: 12px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: var(--sp-5); border-bottom: 1px solid var(--border-subtle); margin-bottom: var(--sp-5); }
.tab-item { height: 40px; display: flex; align-items: center; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-tertiary); border-bottom: 2px solid transparent; }
.tab-item.is-active { color: var(--text-primary); border-color: var(--accent); }

/* ---------- 72h clock ---------- */
.clock72 { display: flex; flex-direction: column; gap: var(--sp-3); }
.clock72__bar { height: 10px; border-radius: var(--radius-none); background: var(--surface-sunken); display: flex; overflow: hidden; border: 1px solid var(--border-subtle); }
.clock72__seg--interno { background: var(--accent); }
.clock72__seg--fundo { background: var(--info); }
.clock72__seg--folga { background: transparent; }
.clock72__seg--over { background: var(--critical); }
.clock72__legend { display: flex; gap: var(--sp-6); flex-wrap: wrap; }
.clock72__legend-item { display: flex; align-items: center; gap: 6px; }
.clock72__dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.clock72__number { display: flex; align-items: baseline; gap: var(--sp-2); }

.sla-clock { background: var(--surface); border-radius: var(--radius-md); padding: var(--sp-5); }

/* ---------- alerts ---------- */
.alert { border-radius: var(--radius-md); padding: var(--sp-5); display: flex; gap: var(--sp-3); align-items: flex-start; }
.alert-critical { background: var(--critical-muted); color: var(--text-primary); }
.alert-warning { background: var(--warning-muted); color: var(--text-primary); }
.alert-info { background: var(--info-muted); color: var(--text-primary); }

/* ---------- empty state ---------- */
.empty-state { background: var(--surface); border-radius: var(--radius-md); padding: var(--sp-16); text-align: center; color: var(--text-secondary); }

/* ---------- login ---------- */
.login-screen { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: #FCFBF8; }
.login-screen__side {
  background: radial-gradient(circle at 30% 20%, #1c2410 0%, #0C0B09 55%), #0C0B09;
  color: #F4F1E9; padding: var(--sp-16) var(--sp-10); display: flex; flex-direction: column; justify-content: space-between;
}
.login-screen__brand { display: flex; align-items: center; gap: var(--sp-2); }
.login-screen__brand img { height: 26px; }
.login-screen__pitch h1 { font-size: 30px; color: #F4F1E9; }
.login-screen__pitch p { color: #A8A296; max-width: 46ch; }
.login-screen__list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.login-screen__list li { display: flex; align-items: center; gap: var(--sp-2); font-size: 12.5px; color: #C9C4B6; }
.login-screen__list li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.login-screen__main { display: flex; align-items: center; justify-content: center; padding: var(--sp-8); background: #FCFBF8; }
/* login card is intentionally fixed-light (not theme-reactive), matching the reference visual */
.login-card { width: 100%; max-width: 380px; background: #FFFFFF; border: 1px solid #DCDAD2; border-radius: var(--radius-lg); padding: var(--sp-8); box-shadow: 0 24px 48px -24px rgba(11,11,9,.35); }
.login-card__brand { display: flex; justify-content: center; margin-bottom: var(--sp-5); }
.login-card__brand img { height: 30px; }
.login-card h2 { text-align: center; margin: 0 0 4px; color: #0B0B09; }
.login-card p.t-caption { text-align: center; margin: 0 0 var(--sp-6); color: #6E6A5F; }
.login-card hr { border: none; border-top: 1px solid #DCDAD2; margin: var(--sp-6) 0; }
.login-card__security { display: flex; gap: 8px; align-items: flex-start; color: #6E6A5F; margin-top: var(--sp-4); }
.login-card__security svg { width: 14px; height: 14px; margin-top: 2px; flex-shrink: 0; stroke: #6E6A5F; fill: none; stroke-width: 1.6; }
.login-footer { text-align: center; margin-top: var(--sp-6); color: #4A473F; }
.login-footer .t-caption { color: #6E6A5F; }
.login-card .field label { color: #4A473F; }
.login-card .field input { background: #F2F1EC; border-color: #C4C1B7; color: #0B0B09; }
.mstile { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 18px; height: 18px; }
.mstile span { display: block; }
.mstile span:nth-child(1) { background: #F35325; }
.mstile span:nth-child(2) { background: #81BC06; }
.mstile span:nth-child(3) { background: #05A6F0; }
.mstile span:nth-child(4) { background: #FFBA08; }

/* ---------- portal switcher ---------- */
.switcher { min-height: 100vh; background: var(--canvas); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-10); padding: var(--sp-10); }
.switcher__cards { display: grid; grid-template-columns: repeat(3, minmax(240px, 300px)); gap: var(--sp-5); }
.switcher-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-8) var(--sp-6); text-align: left; transition: border-color .15s ease; }
.switcher-card:hover { border-color: var(--accent); }
.switcher-card .t-overline { color: var(--accent); margin-bottom: var(--sp-3); display: block; }
@media (max-width: 900px) { .switcher__cards { grid-template-columns: 1fr; } }

/* ---------- onboarding ---------- */
.onboarding-hero { padding: var(--sp-10) 0 var(--sp-8); }
.product-card { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-3); }
.product-card__badge { align-self: flex-start; }
.product-card ul { margin: 0; padding-left: 18px; color: var(--text-secondary); font-size: 13px; display: flex; flex-direction: column; gap: 4px; }

/* ---------- tooltip global (hover any [data-tooltip]) ---------- */
.app-tooltip {
  position: fixed; z-index: 1000; pointer-events: none; display: none;
  background: var(--surface-raised); color: var(--text-primary); border: 1px solid var(--border);
  font-family: var(--font-ui); font-size: 12px; line-height: 1.4; white-space: nowrap;
  padding: 8px 10px; border-radius: var(--radius-sm); box-shadow: 0 8px 20px -6px rgba(0,0,0,.4);
}
[data-tooltip] { cursor: default; }

/* ---------- fixed-light chart card (matches a supplied reference document's colors, not theme-reactive) ---------- */
.chart-card-fixed { background: #FCFBF8; border: 1px solid #DCDAD2; border-radius: var(--radius-md); padding: var(--sp-6); position: relative; }
.chart-card-fixed::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--accent); border-radius: var(--radius-md) var(--radius-md) 0 0; }
.chart-card-fixed .t-overline { color: #6E6A5F; }
.chart-card-fixed .t-caption { color: #6E6A5F; }
.chart-card-fixed .clock72__legend-item { color: #4A473F; }

@media (max-width: 900px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-screen__side { display: none; }
}
