/* ─── Tokens ─────────────────────────────────────────────────────────────── */

:root {
  --bg: #f4f3ee;
  --ink: #141920;
  --muted: #68737c;
  --line: #e3e6e4;
  --panel: #ffffff;
  --brand: #f5cf3e;
  --brand-dark: #141920;
  --accent: #0d9488;

  /* Semantic status */
  --red:   #be123c;
  --amber: #eab308;
  --green: #047857;

  /* Status badge tokens */
  --green-bg:  #ecfdf5;  --green-fg:  #047857;
  --amber-bg:  #fefce8;  --amber-fg:  #854d0e;
  --red-bg:    #fff1f2;  --red-fg:    #be123c;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Entry screen ───────────────────────────────────────────────────────── */

.entry-view {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  padding: 40px clamp(28px, 6vw, 80px);
  background:
    radial-gradient(circle, rgba(20, 25, 32, 0.9) 1.3px, transparent 1.7px) 0 0 / 80px 72px,
    var(--brand);
  overflow: hidden;
}

.entry-top,
.entry-foot {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  font-family: 'DM Mono', ui-monospace, Menlo, Monaco, monospace;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: rgba(20, 25, 32, 0.65);
}

.entry-content {
  position: relative;
  z-index: 1;
  align-self: center;
  max-width: 820px;
  padding: 60px 0;
}

.entry-kicker {
  margin: 0 0 20px;
  font-family: 'DM Mono', ui-monospace, Menlo, Monaco, monospace;
  font-size: 12px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(20, 25, 32, 0.6);
}

.entry-content h1 {
  margin: 0;
  font-size: clamp(64px, 13vw, 160px);
  font-weight: 700;
  line-height: 0.88;
  letter-spacing: -0.02em;
}

.entry-copy {
  max-width: 480px;
  margin: 32px 0 40px;
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.4;
  color: rgba(20, 25, 32, 0.7);
}

.dashboard-view[hidden],
.entry-view[hidden] {
  display: none;
}

/* ─── Topbar ─────────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 32px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 3px 0 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-identity {
  min-width: 160px;
  max-width: 240px;
  padding-right: 12px;
  border-right: 1px solid var(--line);
  text-align: right;
}

.user-identity strong,
.user-identity span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-identity strong { font-size: 13px; font-weight: 600; }
.user-identity span   { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* ─── Buttons ────────────────────────────────────────────────────────────── */

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  min-width: 80px;
  gap: 6px;
  border: 0;
  border-radius: 7px;
  padding: 0 14px;
  background: var(--brand-dark);
  color: white;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}

button:hover { background: #232c38; }

button.secondary {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

button.secondary:hover { background: var(--bg); }

/* ─── Layout ─────────────────────────────────────────────────────────────── */

main {
  padding: 24px 32px 48px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 16px;
}

/* ─── Tabs ───────────────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tab {
  min-width: auto;
  min-height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  padding: 0 13px;
  transition: all 0.1s;
}

.tab:hover {
  border-color: color-mix(in srgb, var(--brand) 80%, transparent);
  background: color-mix(in srgb, var(--brand) 15%, white);
  color: var(--ink);
}

.tab.active {
  border-color: color-mix(in srgb, var(--brand) 60%, transparent);
  background: var(--brand);
  color: var(--ink);
  font-weight: 600;
}

.tab-view { display: none; }
.tab-view.active { display: block; }

/* ─── Status message ─────────────────────────────────────────────────────── */

.status-message {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 16px;
  background: var(--panel);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.status-message.success {
  background: var(--green-bg);
  border-color: color-mix(in srgb, var(--green) 25%, transparent);
  color: var(--green-fg);
}

.status-message.error {
  background: var(--red-bg);
  border-color: color-mix(in srgb, var(--red) 25%, transparent);
  color: var(--red-fg);
}

.status-message.loading {
  background: var(--amber-bg);
  border-color: color-mix(in srgb, var(--amber) 30%, transparent);
  color: var(--amber-fg);
}

/* ─── Empty state ────────────────────────────────────────────────────────── */

.empty-state {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  padding: 20px;
}

td.empty-state { text-align: center; }

/* ─── Status strip (KPI bar) ─────────────────────────────────────────────── */

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.status-strip div {
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.status-strip span {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.status-strip strong {
  display: block;
  margin-top: 10px;
  font-family: 'DM Mono', ui-monospace, Menlo, Monaco, monospace;
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

/* ─── Mini metrics ───────────────────────────────────────────────────────── */

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.mini-metrics article {
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.mini-metrics span {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.mini-metrics strong {
  display: block;
  margin-top: 10px;
  font-family: 'DM Mono', ui-monospace, Menlo, Monaco, monospace;
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

/* ─── Panels ─────────────────────────────────────────────────────────────── */

.panel {
  min-width: 0;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.panel.wide {
  grid-row: span 2;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-head span {
  font-family: 'DM Mono', ui-monospace, Menlo, Monaco, monospace;
  font-size: 11px;
  color: var(--muted);
}

/* ─── Table ──────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

th, td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

/* Projeto column wraps and constrains width */
.col-projeto {
  white-space: normal;
  min-width: 140px;
  max-width: 220px;
}

th {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  background: color-mix(in srgb, var(--bg) 40%, white);
}

tbody tr { transition: background 0.08s; }
tbody tr:hover { background: color-mix(in srgb, var(--bg) 50%, white); }

/* RAG row left-border indicator */
tbody tr.rag-green td:first-child { box-shadow: inset 3px 0 0 var(--green); }
tbody tr.rag-amber td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
tbody tr.rag-red   td:first-child { box-shadow: inset 3px 0 0 var(--red);   }

/* ─── Semantic color base (for track bars, intel-card tops) ──────────────── */

.red   { background: var(--red);   }
.amber { background: var(--amber); }
.green { background: var(--green); }

/* ─── Pills ──────────────────────────────────────────────────────────────── */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 5px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.015em;
  white-space: nowrap;
}

.pill::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.65;
  flex-shrink: 0;
}

.pill.red   { background: var(--red-bg);   color: var(--red-fg);   }
.pill.amber { background: var(--amber-bg); color: var(--amber-fg); }
.pill.green { background: var(--green-bg); color: var(--green-fg); }

/* ─── Soft pill / project tag ────────────────────────────────────────────── */

.soft-pill,
.project-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 5px;
  padding: 3px 8px;
  background: #fdf5d0;
  color: #6b4d00;
  font-size: 11px;
  font-weight: 600;
}

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

/* ─── Inline progress (Avanço column) ───────────────────────────────────── */

.progress-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'DM Mono', ui-monospace, Menlo, Monaco, monospace;
  font-size: 12px;
  color: var(--muted);
}

.progress-cell .mini-bar {
  width: 52px;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
  flex-shrink: 0;
}

.progress-cell .mini-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
}

/* ─── Go-live dates ──────────────────────────────────────────────────────── */

.golive-val {
  font-family: 'DM Mono', ui-monospace, Menlo, Monaco, monospace;
  font-size: 12.5px;
}

.golive-days {
  font-size: 10.5px;
  display: block;
  margin-top: 1px;
}

.golive-days.ok     { color: var(--muted); }
.golive-days.soon   { color: var(--amber); font-weight: 600; }
.golive-days.urgent { color: var(--red);   font-weight: 700; }

/* ─── Misc text ──────────────────────────────────────────────────────────── */

.subtext {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

/* ─── Lists ──────────────────────────────────────────────────────────────── */

.list {
  margin: 0;
  padding: 6px 20px 16px;
  list-style: none;
}

.list li {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.list li:last-child { border-bottom: 0; }

.risk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}

.list strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.list span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

/* ─── Capacity bars ──────────────────────────────────────────────────────── */

.bars { padding: 16px 20px 20px; }

.bar-row { margin-bottom: 14px; }

.bar-row:last-child { margin-bottom: 0; }

.bar-row header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12.5px;
}

.bar-row header span {
  font-family: 'DM Mono', ui-monospace, Menlo, Monaco, monospace;
  font-size: 12px;
  color: var(--muted);
}

.bar-row.healthy header span    { color: var(--green); }
.bar-row.caution header span    { color: #eab308;      font-weight: 600; }
.bar-row.near-limit header span { color: #ea580c;      font-weight: 600; }
.bar-row.overload header span   { color: var(--red);   font-weight: 700; }

.track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.bar-row.healthy .track span    { background: var(--green); }
.bar-row.caution .track span    { background: #eab308; }
.bar-row.near-limit .track span { background: #ea580c; }
.bar-row.overload .track span   { background: var(--red);   }

/* ─── Timeline ───────────────────────────────────────────────────────────── */

.timeline-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.timeline-track span {
  display: block;
  height: 100%;
}

.timeline-track .green, .track .green { background: var(--green); }
.timeline-track .amber, .track .amber { background: var(--amber); }
.timeline-track .red,   .track .red   { background: var(--red);   }

/* ─── Row lists (people, timeline, compact, history) ─────────────────────── */

.people-list,
.timeline-list,
.compact-list,
.history-list,
.alert-list,
.health-list {
  padding: 12px 20px 16px;
}

.person-row,
.timeline-row,
.compact-row,
.history-row {
  display: grid;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.person-row { grid-template-columns: minmax(180px, 1fr) 60px minmax(200px, 1fr); }
.person-row > span {
  font-family: 'DM Mono', ui-monospace, Menlo, Monaco, monospace;
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.person-row small {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.person-row.healthy .track span    { background: var(--green); }
.person-row.caution .track span    { background: #eab308; }
.person-row.near-limit .track span { background: #ea580c; }
.person-row.overload .track span   { background: var(--red);   }

.person-row.healthy > span         { color: var(--green); }
.person-row.caution > span         { color: #eab308;      }
.person-row.near-limit > span      { color: #ea580c;      }
.person-row.overload > span,
.person-row.overload small         { color: var(--red);   }

.timeline-row { grid-template-columns: minmax(180px, 1fr) minmax(220px, 2fr) 100px; }

.timeline-row span,
.history-row span,
.compact-row span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
}

.compact-row,
.history-row { grid-template-columns: minmax(0, 1fr) auto; }

.compact-row > span,
.history-row > strong { font-weight: 700; }

/* ─── Score colors (text, not bg) ────────────────────────────────────────── */

.score.green,
.compact-row .green,
.history-row .green { color: var(--green); background: none; }

.score.amber,
.compact-row .amber { color: var(--amber); background: none; }

.score.red,
.compact-row .red,
.history-row .red   { color: var(--red);   background: none; }

/* ─── Alert chips ────────────────────────────────────────────────────────── */

.alert-chip {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  padding: 12px 14px;
  background: var(--panel);
}

.alert-chip.red   { border-color: color-mix(in srgb, var(--red)   25%, transparent); background: var(--red-bg);   }
.alert-chip.amber { border-color: color-mix(in srgb, var(--amber) 25%, transparent); background: var(--amber-bg); }

.alert-chip span {
  font-size: 12.5px;
  color: var(--muted);
}

/* ─── Health rows ────────────────────────────────────────────────────────── */

.health-row { margin-bottom: 14px; }

.health-row:last-child { margin-bottom: 0; }

.health-row header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12.5px;
}

/* ─── Intel cards ────────────────────────────────────────────────────────── */

.intel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.intel-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  background: var(--panel);
}

.intel-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  content: "";
}

.intel-card.green::before { background: var(--green); }
.intel-card.amber::before { background: var(--amber); }
.intel-card.red::before   { background: var(--red);   }

.intel-card > span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.intel-card .score {
  margin: 14px 0 6px;
  font-family: 'DM Mono', ui-monospace, Menlo, Monaco, monospace;
  font-size: 42px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}

.intel-card p {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

/* ─── Spillover tag ──────────────────────────────────────────────────────── */

.compact-list .amber {
  background: none;
  color: var(--amber);
  font-size: 11px;
  font-weight: 700;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 1080px) {
  .topbar { align-items: flex-start; }
  .actions { flex-wrap: wrap; justify-content: flex-end; }
  .status-strip,
  .mini-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: 1fr; }
  .intel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel.wide { grid-row: auto; }
}

@media (max-width: 700px) {
  .entry-view {
    padding: 28px 20px;
    background:
      radial-gradient(circle, rgba(20, 25, 32, 0.9) 1.1px, transparent 1.5px) 0 0 / 48px 44px,
      var(--brand);
  }

  .entry-top,
  .entry-foot { flex-direction: column; gap: 4px; }

  .topbar,
  .actions { align-items: stretch; flex-direction: column; }

  .topbar { padding: 18px 20px; }

  .subtitle { font-size: 12px; }

  .user-identity {
    max-width: none;
    min-width: 0;
    padding-right: 0;
    border-right: 0;
    text-align: left;
  }

  main { padding: 14px 16px 40px; }

  .status-strip,
  .mini-metrics,
  .intel-grid { grid-template-columns: 1fr; }

  .tabs {
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .panel-head { align-items: flex-start; flex-direction: column; gap: 4px; }

  button { width: 100%; }
  .tab { width: auto; }

  .person-row,
  .timeline-row,
  .compact-row,
  .history-row { grid-template-columns: 1fr; }

  .person-row > span { text-align: left; }
}
