/* ================================================================
   CORRIDA DE CONTRATOS v2 — PIT WALL
   Carbon-fibre editorial racing aesthetic
   ================================================================ */

/* ---- Dark theme (default) ---- */
:root {
  --bg:    #0c0d0f;
  --panel: #141619;
  --panel-2:#181b1f;
  --inset: #101214;
  --line:  #24282e;
  --line-2:#31363d;
  --line-3:#41474f;
  --ink:   #eef0f2;
  --dim:   #969ca4;
  --faint: #5e646c;
  --accent:#ff4326;
  --accent-soft:rgba(255,67,38,.14);
  --go:    #3fd29a;
  --warn:  #f3b13a;
  --info:  #7aa2ff;
  --grid:  rgba(255,255,255,.025);
  --shadow:0 1px 0 rgba(255,255,255,.03), 0 24px 60px -32px rgba(0,0,0,.7);
  --font:  "Archivo", sans-serif;
  --mono:  "IBM Plex Mono", monospace;
  --transition: .2s ease;
}

/* ---- Light theme ---- */
[data-theme="light"] {
  --bg:    #e9e7e0;
  --panel: #f6f5f1;
  --panel-2:#f1efe9;
  --inset: #eae8e1;
  --line:  #dad7cd;
  --line-2:#cbc7bb;
  --line-3:#b6b1a3;
  --ink:   #181a1d;
  --dim:   #6c7178;
  --faint: #9a9890;
  --accent:#e03415;
  --accent-soft:rgba(224,52,21,.1);
  --go:    #1f9e6e;
  --warn:  #c98412;
  --info:  #3a63c4;
  --grid:  rgba(0,0,0,.025);
  --shadow:0 1px 0 rgba(255,255,255,.5), 0 24px 50px -34px rgba(60,55,40,.45);
}

/* ================================================================
   RESET & BASE
   ================================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  min-height: 100vh;
  line-height: 1.55;
  overflow-x: hidden;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  outline: none;
  transition: all var(--transition);
}

input, select, textarea {
  font-family: inherit;
  font-size: .95rem;
}

h1, h2, h3, h4 {
  font-family: var(--font);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.02em;
}

ul { list-style: none; }

/* ================================================================
   SCROLLBAR
   ================================================================ */

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--line-3); }

/* ================================================================
   HEADER
   ================================================================ */

#app-header {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  height: 62px;
  position: sticky;
  top: 0;
  z-index: 100;
  overflow: hidden;
}

#app-logo {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

/* Full original logo — CSS mask inherits var(--ink), adapts to dark/light */
.brand-logo-mask {
  display: block;
  height: 24px;
  width: 149px; /* 24 × (1727.71 ÷ 278.54) */
  background: var(--ink);
  -webkit-mask: url(/static/img/bl-logo.svg) left center / contain no-repeat;
  mask: url(/static/img/bl-logo.svg) left center / contain no-repeat;
  flex-shrink: 0;
}

/* System name — red mono text with left border separator */
.sysname {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .3em;
  color: var(--accent);
  text-transform: uppercase;
  padding-left: 16px;
  border-left: 1px solid var(--line-2);
  white-space: nowrap;
  font-feature-settings: "zero";
}

/* Legacy selectors */
.mark {
  width: 28px;
  height: 27px;
  background: var(--ink);
  -webkit-mask: url(/static/img/bl-mark.svg) center/contain no-repeat;
  mask: url(/static/img/bl-mark.svg) center/contain no-repeat;
  flex-shrink: 0;
}
#app-logo .logo-img { height: 28px; width: auto; opacity: .9; }
#app-logo .logo-text { display: flex; flex-direction: column; line-height: 1.1; }

#app-nav {
  display: flex;
  gap: .2rem;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
#app-nav::-webkit-scrollbar { display: none; }

.nav-btn {
  background: transparent;
  color: var(--dim);
  padding: .5rem .65rem;
  border-radius: 0;
  font-family: var(--font);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  border: none;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: .4rem;
  position: relative;
}

.nav-btn:hover {
  color: var(--ink);
}

.nav-btn.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

#app-user {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}

.user-badge {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .3rem .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
}

.user-badge .user-name {
  color: var(--ink);
  font-weight: 500;
  font-family: var(--mono);
  font-feature-settings: "zero";
}

.user-badge .user-role {
  color: var(--faint);
  font-size: .7rem;
  font-family: var(--mono);
  font-feature-settings: "zero";
}

/* Avatar initials circle */
.av {
  width: 28px;
  height: 28px;
  border-radius: 3px;
  background: var(--inset);
  border: 1px solid var(--line-2);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

/* Sync status indicator */
.sync-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
}
.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
  transition: background .3s;
}
.sync-dot.online  { background: var(--go); }
.sync-dot.offline { background: var(--accent); }
.sync-text {
  font-size: .7rem;
  color: var(--faint);
  font-family: var(--mono);
  font-feature-settings: "zero";
  white-space: nowrap;
}

/* Header action buttons */
.btn-header {
  background: var(--panel-2);
  color: var(--dim);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: 0 13px;
  height: 34px;
  font-size: 11px;
  font-family: var(--mono);
  font-feature-settings: "zero";
  letter-spacing: .06em;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-header svg { width: 13px; height: 13px; flex-shrink: 0; }
.btn-header:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-header:disabled {
  opacity: .5;
  cursor: wait;
}

.btn-logout {
  background: transparent;
  color: var(--faint);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: 0 13px;
  height: 34px;
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: .06em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-logout svg { width: 13px; height: 13px; }

.btn-logout:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Theme toggle button */
.btn-theme {
  background: transparent;
  color: var(--faint);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s;
}

.btn-theme svg { width: 15px; height: 15px; }
.btn-theme:hover {
  color: var(--warn);
  border-color: var(--warn);
}

/* Light-theme login logo */
[data-theme="light"] .login-logo-img {
  filter: brightness(.3);
}

[data-theme="light"] #login-overlay {
  background: var(--bg);
}

[data-theme="light"] #login-overlay::before {
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
}

[data-theme="light"] #login-overlay::after {
  display: none;
}

[data-theme="light"] .login-box {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

[data-theme="light"] .login-header h2 {
  color: var(--accent);
  -webkit-text-fill-color: var(--accent);
  background: none;
}

/* ================================================================
   MAIN CONTENT
   ================================================================ */

#app-main {
  max-width: 1680px;
  margin: 0 auto;
  padding: 30px 28px;
}

/* ================================================================
   LOGIN OVERLAY
   ================================================================ */

#login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  overflow: hidden;
}

#login-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.02) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, black 20%, transparent 70%);
  animation: gridPulse 8s ease-in-out infinite;
}

#login-overlay::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  animation: glowFloat 6s ease-in-out infinite;
}

@keyframes gridPulse {
  0%, 100% { opacity: .5; }
  50% { opacity: 1; }
}

@keyframes glowFloat {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: .6; }
  50% { transform: translateX(-50%) translateY(-20px); opacity: 1; }
}

.login-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2.75rem 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
  animation: loginBoxIn .6s cubic-bezier(.16, 1, .3, 1);
}

@keyframes loginBoxIn {
  from { opacity: 0; transform: translateY(20px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.login-header {
  text-align: center;
  margin-bottom: 2.25rem;
}

.login-header .login-logo {
  font-size: 2.5rem;
  margin-bottom: .5rem;
}

.login-header .login-logo-img {
  height: 36px;
  width: auto;
  margin-bottom: 1.25rem;
  opacity: .85;
}

/* Logo na tela de login — CSS mask, adapta ao tema */
.login-brand-mask {
  display: block;
  height: 32px;
  width: 198px; /* 32 × (1727.71 ÷ 278.54) */
  background: var(--ink);
  -webkit-mask: url(/static/img/bl-logo.svg) center / contain no-repeat;
  mask: url(/static/img/bl-logo.svg) center / contain no-repeat;
  margin: 0 auto 1.25rem;
  opacity: .9;
}

/* Ícones no login (lock, phone) */
.login-header .login-logo svg {
  width: 32px;
  height: 32px;
  color: var(--accent);
}

.login-header h2 {
  font-family: var(--font);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .1em;
}

.login-header p {
  color: var(--faint);
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: .72rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  margin-top: .35rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: .72rem;
  font-weight: 500;
  color: var(--dim);
  margin-bottom: .4rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  padding: .7rem 1rem;
  transition: border-color var(--transition);
  font-size: .9rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-group select option {
  background: var(--panel);
  color: var(--ink);
}

.form-error {
  color: var(--accent);
  font-size: .8rem;
  margin-top: .75rem;
  text-align: center;
  padding: .5rem;
  background: var(--accent-soft);
  border-radius: 3px;
  border: 1px solid rgba(255,67,38,.3);
}

.form-info {
  color: var(--info);
  font-size: .8rem;
  margin-top: .75rem;
  text-align: center;
  padding: .5rem;
  background: rgba(122,162,255,.1);
  border-radius: 3px;
  border: 1px solid rgba(122,162,255,.25);
}

/* ================================================================
   BUTTONS
   ================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .6rem 1.2rem;
  border-radius: 4px;
  font-size: .875rem;
  font-weight: 600;
  transition: all var(--transition);
  border: 1px solid transparent;
  height: 34px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  padding: .75rem;
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .04em;
  border-radius: 4px;
  height: 44px;
}

.btn-primary::after { display: none; }

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--panel-2);
  color: var(--dim);
  border-color: var(--line-2);
}

.btn-secondary:hover {
  color: var(--ink);
  border-color: var(--line-3);
}

.btn-success {
  background: rgba(63,210,154,.12);
  color: var(--go);
  border-color: rgba(63,210,154,.35);
}

.btn-success:hover {
  background: rgba(63,210,154,.2);
}

.btn-danger {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(255,67,38,.35);
}

.btn-danger:hover {
  background: rgba(255,67,38,.2);
}

.btn-ghost {
  background: transparent;
  color: var(--faint);
  border-color: transparent;
}

.btn-ghost:hover {
  color: var(--ink);
  background: var(--panel-2);
}

.btn-sm {
  padding: .35rem .75rem;
  font-size: .8rem;
  height: 28px;
}

.btn-icon {
  padding: .45rem;
  font-size: 1rem;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none !important;
}

/* ================================================================
   TOAST NOTIFICATIONS
   ================================================================ */

#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}

.toast {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .85rem 1.25rem;
  font-size: .85rem;
  min-width: 250px;
  max-width: 380px;
  box-shadow: var(--shadow);
  animation: toastIn .35s cubic-bezier(.16, 1, .3, 1), toastOut .3s ease 2.7s forwards;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.toast-success { border-left: 3px solid var(--go); }
.toast-error   { border-left: 3px solid var(--accent); }
.toast-info    { border-left: 3px solid var(--info); }
.toast-warning { border-left: 3px solid var(--warn); }

.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast-msg  { flex: 1; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ================================================================
   PAGE HEADER / VIEW TITLE
   ================================================================ */

.view-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 26px;
  gap: 20px;
  flex-wrap: wrap;
}

.view-title {
  display: flex;
  align-items: center;
  gap: 18px;
}

.view-title h1 {
  font-family: var(--font);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1;
}

.view-title .view-icon {
  font-size: 1.75rem;
}

.view-subtitle {
  color: var(--dim);
  font-size: 11px;
  margin-top: 7px;
  font-family: var(--mono);
  font-feature-settings: "zero";
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* Checkered flag icon for corrida view */
.flag {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  background-image:
    linear-gradient(45deg, var(--ink) 25%, transparent 25%),
    linear-gradient(-45deg, var(--ink) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--ink) 75%),
    linear-gradient(-45deg, transparent 75%, var(--ink) 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
  background-color: var(--panel);
  flex-shrink: 0;
}

/* ================================================================
   MONTH SELECTOR
   ================================================================ */

.month-selector {
  display: flex;
  align-items: center;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  overflow: hidden;
  background: var(--panel);
}

.month-selector .month-btn {
  background: none;
  border: 0;
  color: var(--dim);
  width: 38px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.month-selector .month-btn:hover {
  color: var(--ink);
  background: var(--panel-2);
}

.month-selector .month-label {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--ink);
  padding: 0 22px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  white-space: nowrap;
  text-transform: capitalize;
}

/* ================================================================
   SEARCH & FILTER BAR
   ================================================================ */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input-wrap .search-icon {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  font-family: var(--font);
  font-size: 13.5px;
  padding: 0 .9rem 0 2.4rem;
  transition: border-color var(--transition);
  height: 44px;
}

.search-input::placeholder { color: var(--faint); }

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.filter-tabs {
  display: flex;
  gap: .3rem;
}

.filter-tab {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--dim);
  border-radius: 4px;
  padding: 0 15px;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.filter-tab svg { width: 13px; height: 13px; }

.filter-tab:hover {
  border-color: var(--line-2);
  color: var(--ink);
}

.filter-tab.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.filter-tab.active-red {
  background: transparent;
  border-color: var(--warn);
  color: var(--warn);
}

.filter-tab.active-green {
  background: transparent;
  border-color: var(--go);
  color: var(--go);
}

/* Auto-avançar chip — accent color */
.filter-tab.chip-accent {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.filter-tab.chip-accent svg { color: var(--accent); }

/* ================================================================
   STATS BAR  (legacy — still rendered by JS)
   ================================================================ */

.stats-bar {
  /* Legacy container — just a block; .tower inside handles the grid */
  display: block;
  margin-bottom: 26px;
}

.stat-card {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 1.1rem 1.25rem;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}

.stat-card:last-child { border-right: none; }

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--line-2);
}

.stat-card::after { display: none; }

.stat-card.stat-total::before  { background: var(--info); }
.stat-card.stat-done::before   { background: var(--go); }
.stat-card.stat-progress::before { background: var(--accent); }
.stat-card.stat-overdue::before  { background: var(--accent); }
.stat-card.stat-pct::before    { background: var(--dim); }

.stat-card:hover {
  background: var(--panel-2);
}

.stat-value {
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: 2rem;
  font-weight: 600;
  line-height: 1;
  margin-bottom: .35rem;
  position: relative;
  z-index: 1;
  color: var(--ink);
}

.stat-card.stat-total .stat-value    { color: var(--info); }
.stat-card.stat-done .stat-value     { color: var(--go); }
.stat-card.stat-progress .stat-value { color: var(--accent); }
.stat-card.stat-overdue .stat-value  { color: var(--accent); }
.stat-card.stat-pct .stat-value      { color: var(--ink); }

.stat-label {
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: .65rem;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 500;
  position: relative;
  z-index: 1;
}

/* ================================================================
   KPI TOWER  (new 5-column grid)
   ================================================================ */

.tower {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  margin-bottom: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
  background: var(--panel);
}

.kpi {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 20px 16px;
  position: relative;
}

.kpi:last-child { border-right: none; }

/* Label (top) */
.kpi .lab,
.kpi .stat-label,
.kpi .kpi-label {
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: 9.5px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .22em;
  font-weight: 400;
}

/* Number */
.kpi .num,
.kpi .stat-value,
.kpi .kpi-value {
  font-family: var(--font);
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1;
  margin-top: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* % suffix in Progresso — visually smaller */
.kpi-pct { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }

/* Delta (bottom) */
.kpi .delta,
.kpi .kpi-delta {
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: 10px;
  color: var(--dim);
  margin-top: 8px;
  letter-spacing: .04em;
}

/* LIVE card */
.kpi.live {
  background: linear-gradient(180deg, var(--accent-soft), transparent 60%);
}

.kpi.live::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

.kpi.live .num,
.kpi.live .stat-value,
.kpi.live .kpi-value {
  color: var(--accent);
}

.kpi.live .lab::after,
.kpi.live .stat-label::after {
  content: " \25CF LIVE";
  color: var(--accent);
  letter-spacing: .1em;
  font-size: 9px;
}

/* ================================================================
   PHASE RULER
   ================================================================ */

.corrida-container {
  position: relative;
}

.phase-ruler {
  display: grid;
  grid-template-columns: 340px 1fr;
  margin: 0;
  position: relative;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}

.phase-ruler-item {
  flex: 1;
  text-align: center;
  padding: .5rem .25rem .4rem;
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: .55rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--faint);
  position: relative;
  background: transparent;
  border-right: 1px solid var(--line);
}

.phase-ruler-item:last-child { border-right: none; }

.phase-ruler-item .phase-icon {
  font-size: 1rem;
  display: block;
  margin-bottom: .15rem;
}

.phase-ruler-item .phase-type {
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: .44rem;
  font-weight: 500;
  opacity: .5;
  display: block;
  margin-top: .1rem;
  letter-spacing: .03em;
}

/* All phase ruler colors are now neutral */
.pr-0, .pr-1, .pr-2, .pr-3, .pr-4, .pr-5 {
  color: var(--faint);
  background: transparent;
  border-radius: 0;
}

/* Ruler dividers — all neutral now */
.phase-ruler-item::after { display: none; }

/* ================================================================
   GUIDE LINES
   ================================================================ */

.lanes-with-guides {
  position: relative;
}

.guide-lines {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 340px;
  right: 0;
  pointer-events: none;
  z-index: 3;
  display: flex;
}

.guide-segment {
  flex: 1;
  position: relative;
}

.guide-segment::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: -1px;
  width: 1px;
  background: var(--line);
  opacity: .6;
}

.guide-segment:last-child::after { display: none; }

[data-theme="light"] .guide-segment::after { opacity: .8; }
[data-theme="light"] .phase-ruler-item { background: transparent; }

/* ================================================================
   RACE LANES (legacy layout: info | track | meta)
   ================================================================ */

.lanes-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  z-index: 2;
}

.lane {
  background: var(--panel);
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  overflow: hidden;
  cursor: pointer;
  transition: background var(--transition);
  display: flex;
  flex-direction: column;
  opacity: 0;
  animation: fadeSlideIn .4s cubic-bezier(.16, 1, .3, 1) forwards;
}

.lane:nth-child(1)  { animation-delay: 0s; }
.lane:nth-child(2)  { animation-delay: .04s; }
.lane:nth-child(3)  { animation-delay: .08s; }
.lane:nth-child(4)  { animation-delay: .12s; }
.lane:nth-child(5)  { animation-delay: .16s; }
.lane:nth-child(6)  { animation-delay: .20s; }
.lane:nth-child(7)  { animation-delay: .24s; }
.lane:nth-child(8)  { animation-delay: .28s; }
.lane:nth-child(9)  { animation-delay: .32s; }
.lane:nth-child(10) { animation-delay: .36s; }
.lane:nth-child(n+11) { animation-delay: .4s; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lane:hover {
  background: var(--panel-2);
}

.lane.lane-active  { border-left: 3px solid var(--accent); }
.lane.lane-overdue { border-left: 3px solid var(--accent); }
.lane.lane-done    { border-left: 3px solid var(--go); opacity: .75; }

.lane-row {
  display: flex;
  align-items: stretch;
}

.lane-info {
  width: 340px;
  min-width: 340px;
  padding: .75rem 1.1rem;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.lane-contract-name {
  font-family: var(--font);
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -.01em;
}

.lane-contract-object {
  font-size: .68rem;
  color: var(--faint);
  margin-top: .15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lane-contract-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: .3rem;
  font-size: .6rem;
}

.lane-building { font-size: .6rem; color: var(--faint); }
.lane-dept     { font-size: .6rem; color: var(--faint); }
.lane-vigencia { font-size: .6rem; color: var(--faint); }

.lane-financial {
  display: flex;
  gap: 10px;
  margin-top: .25rem;
  font-size: .62rem;
  flex-wrap: wrap;
}

.lane-monthly     { color: var(--go); font-weight: 600; font-family: var(--mono); font-feature-settings: "zero"; font-size: .6rem; }
.lane-balance     { color: var(--dim); font-family: var(--mono); font-feature-settings: "zero"; font-size: .6rem; }
.lane-balance.zero { color: var(--accent); font-weight: 600; }
.lane-measurement { color: var(--info); font-family: var(--mono); font-feature-settings: "zero"; font-size: .6rem; }

.lane-track-area {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  min-height: 52px;
  background-image: repeating-linear-gradient(
    90deg,
    var(--grid),
    var(--grid) 1px,
    transparent 1px,
    transparent 16.6667%
  );
}

.track-bg {
  position: absolute;
  inset: 0;
  display: flex;
}

.track-bg-seg {
  flex: 1;
  transition: background .3s;
  position: relative;
}

.track-bg-seg::after {
  content: '';
  position: absolute;
  top: 4px;
  bottom: 4px;
  right: 0;
  width: 1px;
  background: var(--line);
  opacity: .5;
}

.track-bg-seg:last-child::after { display: none; }

[data-theme="light"] .track-bg-seg::after { opacity: .6; }

.track-bg-seg.seg-done         { background: rgba(63,210,154,.06); }
.track-bg-seg.seg-current      { background: var(--accent-soft); }
.track-bg-seg.seg-current-late { background: rgba(255,67,38,.06); }

[data-theme="light"] .track-bg-seg.seg-done         { background: rgba(31,158,110,.06); }
[data-theme="light"] .track-bg-seg.seg-current       { background: var(--accent-soft); }
[data-theme="light"] .track-bg-seg.seg-current-late  { background: rgba(224,52,21,.05); }

.lane-car {
  position: absolute;
  font-size: 1.4rem;
  z-index: 5;
  top: 50%;
  transform: translate(-50%, -50%);
  transition: left .8s cubic-bezier(.34, 1.56, .64, 1);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.4));
}

.lane-car.car-done    { animation: winPulse 2s ease infinite; }
.lane-car.car-overdue { animation: shake .5s ease infinite alternate; }

@keyframes shake {
  from { transform: translate(-50%, -50%) rotate(-5deg); }
  to   { transform: translate(-50%, -50%) rotate(5deg); }
}

@keyframes winPulse {
  0%, 100% { filter: drop-shadow(0 2px 6px rgba(63,210,154,.3)); }
  50%      { filter: drop-shadow(0 2px 16px rgba(63,210,154,.8)); }
}

.lane-meta {
  width: 120px;
  min-width: 120px;
  padding: .5rem .75rem;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: .25rem;
}

.lane-due           { font-size: .62rem; color: var(--faint); font-family: var(--mono); font-feature-settings: "zero"; }
.lane-due.due-late  { color: var(--accent); font-weight: 600; }
.lane-due.due-soon  { color: var(--warn); }

.lane-approval      { font-size: .6rem; color: var(--info); font-weight: 600; font-family: var(--mono); font-feature-settings: "zero"; }
.lane-amount        { font-size: .62rem; color: var(--warn); font-weight: 600; font-family: var(--mono); font-feature-settings: "zero"; }
.lane-days-phase    { font-size: .58rem; color: var(--faint); font-style: italic; font-family: var(--mono); font-feature-settings: "zero"; }

.lane-progress      { height: 3px; background: var(--inset); }
.lane-progress-fill { height: 100%; border-radius: 0 2px 2px 0; transition: width .8s ease; }
.lane-progress-fill.fill-normal { background: var(--accent); }
.lane-progress-fill.fill-late   { background: var(--accent); animation: glowPulse 2s ease infinite; }
.lane-progress-fill.fill-done   { background: var(--go); }

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 4px rgba(255,67,38,.3); }
  50%      { box-shadow: 0 0 10px rgba(255,67,38,.5); }
}

/* ================================================================
   NEW RACE LAYOUT (JS v2 — grid-based)
   ================================================================ */

.race {
  display: grid;
  grid-template-columns: 340px 1fr;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
  background: var(--panel);
  margin-top: 0;
}

.race-cols {
  display: contents;
}

.race-cols .ident {
  background: var(--panel-2);
  padding: .75rem 1rem;
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: .55rem;
  font-weight: 500;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-right: 1px solid var(--line);
  display: flex;
  align-items: center;
}

/* Phase header grid */
.phases {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  padding: 0 !important;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}

.ph {
  padding: 10px 12px;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ph:first-child { border-left: none; }

.pi {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pi svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--dim);
}

.pn {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--ink);
}

.ph .meta { margin-top: 2px; }

.ph .mode {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .14em;
  color: var(--faint);
  text-transform: uppercase;
}

.ph .mode.man { color: var(--warn); }

.ph .cnt {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim);
  letter-spacing: .04em;
}

.ph .cnt b { color: var(--ink); font-weight: 600; }

.ph .lim {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--faint);
  letter-spacing: .06em;
}

/* Global SVG icon sizing for inline icons */
.nav-btn svg, .btn svg, .chip svg, .icbtn svg,
.toast-icon svg, .search-icon svg, .filter-tab svg,
.view-icon svg { width: 15px; height: 15px; }

.view-icon { display: flex; align-items: center; }

.row {
  display: contents;
}

.row:hover .ident,
.row:hover .track {
  background: var(--panel-2);
}

.ident {
  padding: .65rem 1rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
}

.ct-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.ct-code {
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: .02em;
  flex-shrink: 0;
}

.ct-name {
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ct-desc {
  font-size: .68rem;
  color: var(--faint);
  margin-top: .1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: .3rem;
}

.tag {
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: .58rem;
  font-weight: 500;
  padding: .1rem .45rem;
  border-radius: 2px;
  border: 1px solid var(--line-2);
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: .03em;
  line-height: 1.5;
}

.tag.warn {
  border-color: rgba(243,177,58,.35);
  color: var(--warn);
  background: rgba(243,177,58,.08);
}

.tag.dept {
  border-color: rgba(122,162,255,.3);
  color: var(--info);
  background: rgba(122,162,255,.08);
}

.tag.go {
  border-color: rgba(63,210,154,.3);
  color: var(--go);
  background: rgba(63,210,154,.08);
}

.tag.accent {
  border-color: rgba(255,67,38,.3);
  color: var(--accent);
  background: var(--accent-soft);
}

.ct-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 11px;
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: 11px;
}

.saldo {
  color: var(--ink);
  font-weight: 500;
}

.saldo span {
  color: var(--faint);
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-right: 3px;
}

.saldo.zero {
  color: var(--accent);
}

.prazo {
  color: var(--dim);
  font-size: 9.5px;
  letter-spacing: .04em;
}

.prazo.late {
  color: var(--accent);
  font-weight: 600;
}

.prazo.soon {
  color: var(--warn);
}

/* Track area in new grid */
.track {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  min-height: 56px;
  cursor: pointer;
  background-image: repeating-linear-gradient(
    90deg,
    var(--grid),
    var(--grid) 1px,
    transparent 1px,
    transparent 16.6667%
  );
}

.track .lane {
  border: none;
  border-right: 1px solid var(--line);
  border-bottom: none;
  background: transparent;
  border-radius: 0;
  opacity: 1;
  animation: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  min-height: auto;
  flex-direction: row;
}

.track .lane:last-child { border-right: none; }

/* Bar overlay (progress marker) — stretches full track width */
.bar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  pointer-events: none;
}

/* Rail — horizontal baseline */
.rail {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--line-2);
  z-index: 1;
  transform: translateY(-50%);
}

/* Trail — gradient leading to node */
.trail {
  position: absolute;
  top: 50%;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 100%);
  z-index: 3;
  transform: translateY(-50%);
  transition: width .6s cubic-bezier(.34, 1.56, .64, 1);
}

/* Node — triangular position marker */
.node {
  position: absolute;
  top: 50%;
  z-index: 4;
  transform: translate(-100%, -50%);
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 14px solid var(--accent);
  transition: left .6s cubic-bezier(.34, 1.56, .64, 1);
}

/* Position label — small label above the node */
.poslabel {
  position: absolute;
  top: 5px;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: 8px;
  font-weight: 500;
  color: var(--faint);
  letter-spacing: .06em;
  text-transform: uppercase;
  z-index: 5;
  white-space: nowrap;
}

/* Leader tag — shown below the node for leading contracts */
.leader-tag {
  position: absolute;
  bottom: 5px;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: 8px;
  font-weight: 600;
  color: var(--go);
  text-transform: uppercase;
  letter-spacing: .1em;
  z-index: 5;
  white-space: nowrap;
}

/* Checkered finish line */
.finish {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 8px;
  z-index: 1;
  background-image:
    linear-gradient(45deg, var(--line-2) 25%, transparent 25%),
    linear-gradient(-45deg, var(--line-2) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--line-2) 75%),
    linear-gradient(-45deg, transparent 75%, var(--line-2) 75%);
  background-size: 4px 4px;
  background-position: 0 0, 0 2px, 2px -2px, -2px 0;
}

/* State colors for track elements */
.trail.go, .node.go  { --accent: var(--go); }
.trail.go   { background: linear-gradient(90deg, transparent 0%, var(--go) 100%); }
.node.go    { border-left-color: var(--go); }
.poslabel.go { color: var(--go); }

.trail.warn, .node.warn  { --accent: var(--warn); }
.trail.warn  { background: linear-gradient(90deg, transparent 0%, var(--warn) 100%); }
.node.warn   { border-left-color: var(--warn); }
.poslabel.warn { color: var(--warn); }

/* Pulse animation for leading contracts */
@keyframes nodePulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .6; }
}

.node.lead { animation: nodePulse 1.5s ease infinite; }

/* ================================================================
   BADGES (legacy)
   ================================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .55rem;
  border-radius: 2px;
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: .62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  border: 1px solid var(--line-2);
  color: var(--dim);
}

.badge-blue   { border-color: rgba(122,162,255,.35); color: var(--info); background: rgba(122,162,255,.08); }
.badge-green  { border-color: rgba(63,210,154,.35); color: var(--go); background: rgba(63,210,154,.08); }
.badge-red    { border-color: rgba(255,67,38,.35); color: var(--accent); background: var(--accent-soft); }
.badge-orange { border-color: rgba(243,177,58,.35); color: var(--warn); background: rgba(243,177,58,.08); }
.badge-purple { border-color: rgba(122,162,255,.35); color: var(--info); background: rgba(122,162,255,.08); }
.badge-gray   { border-color: var(--line-2); color: var(--dim); background: transparent; }

/* ================================================================
   CONFETTI
   ================================================================ */

.confetti-container {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9000;
  overflow: hidden;
}

.confetti-particle {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 2px;
  top: -10px;
  animation: confettiFall 2.5s ease-in forwards;
}

@keyframes confettiFall {
  0%   { transform: translateY(0)    rotate(0deg)   scale(1);   opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg) scale(.3); opacity: 0; }
}

@keyframes badgeBounce {
  0%   { transform: scale(.8); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.badge-bounce { animation: badgeBounce .4s ease; }

@keyframes syncPulse {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%      { transform: scale(1.4); opacity: .7; }
}

.sync-dot.syncing { animation: syncPulse 1.5s ease infinite; }

/* ================================================================
   EMPTY STATE
   ================================================================ */

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--faint);
}

.empty-state .empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: .4;
  display: flex;
  justify-content: center;
}

.empty-state .empty-icon svg { width: 48px; height: 48px; }

.empty-state h3 {
  font-size: 1.1rem;
  color: var(--dim);
  margin-bottom: .5rem;
}

.empty-state p {
  font-size: .85rem;
}

/* ================================================================
   LOADING
   ================================================================ */

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  gap: 1rem;
  color: var(--faint);
}

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ================================================================
   MODAL
   ================================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 1rem;
  animation: overlayIn .2s ease;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: modalIn .35s cubic-bezier(.16, 1, .3, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(24px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.modal-title {
  font-family: var(--font);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.01em;
}

.modal-subtitle {
  font-size: .8rem;
  color: var(--faint);
  margin-top: .2rem;
  font-family: var(--mono);
  font-feature-settings: "zero";
}

.modal-close {
  background: transparent;
  color: var(--faint);
  font-size: 1.3rem;
  line-height: 1;
  border-radius: 3px;
  padding: .2rem .4rem;
}

.modal-close:hover {
  color: var(--ink);
  background: var(--inset);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ================================================================
   PHASE TIMELINE (in modal)
   ================================================================ */

.phase-timeline {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
  position: relative;
}

.phase-timeline::before {
  content: '';
  position: absolute;
  top: 20px; left: 20px; right: 20px;
  height: 2px;
  background: var(--line);
  z-index: 0;
}

.phase-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
}

.phase-step-dot {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border: 2px solid var(--line);
  background: var(--bg);
  margin-bottom: .4rem;
  transition: all var(--transition);
}

.phase-step.completed .phase-step-dot {
  background: rgba(63,210,154,.15);
  border-color: var(--go);
}

.phase-step.current .phase-step-dot {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.phase-step-name {
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: .6rem;
  color: var(--faint);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 500;
}

.phase-step.current .phase-step-name {
  color: var(--accent);
  font-weight: 600;
}

.phase-step.completed .phase-step-name {
  color: var(--go);
}

/* ================================================================
   CHECKLIST
   ================================================================ */

.checklist-section {
  margin-bottom: 1.5rem;
}

.checklist-title {
  font-family: var(--font);
  font-size: .82rem;
  font-weight: 600;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.checklist-items {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .9rem;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition);
}

.checklist-item:hover {
  border-color: var(--line-2);
}

.checklist-item.checked {
  background: rgba(63,210,154,.05);
  border-color: rgba(63,210,154,.25);
}

.checklist-checkbox {
  width: 20px; height: 20px;
  border-radius: 3px;
  border: 2px solid var(--line-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  flex-shrink: 0;
  transition: all var(--transition);
}

.checklist-item.checked .checklist-checkbox {
  background: var(--go);
  border-color: var(--go);
  color: white;
}

.checklist-label {
  font-size: .875rem;
  color: var(--ink);
  flex: 1;
}

.checklist-item.checked .checklist-label {
  text-decoration: line-through;
  color: var(--faint);
}

.checklist-progress {
  font-size: .75rem;
  color: var(--faint);
  margin-top: .5rem;
  text-align: right;
  font-family: var(--mono);
  font-feature-settings: "zero";
}

/* ================================================================
   MODAL FORM FIELDS
   ================================================================ */

.modal-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.modal-fields .form-group {
  margin-bottom: 0;
}

.modal-fields .form-group.full-width {
  grid-column: 1 / -1;
}

/* ================================================================
   DASHBOARD
   ================================================================ */

.dashboard-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0;
  margin-bottom: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}

.overview-card {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 1.25rem;
  text-align: center;
  transition: all var(--transition);
}

.overview-card:last-child { border-right: none; }

.overview-card:hover {
  background: var(--panel-2);
}

.overview-num {
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: 2.5rem;
  font-weight: 600;
  line-height: 1;
  margin-bottom: .35rem;
}

.overview-lbl {
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: .65rem;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 500;
}

.ranking-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.ranking-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ranking-header h3 {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ranking-header h3 svg { width: 15px; height: 15px; }

.ranking-table {
  width: 100%;
}

.ranking-row {
  display: flex;
  align-items: center;
  padding: .85rem 1.5rem;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  transition: background var(--transition);
  cursor: pointer;
}

.ranking-row:last-child { border-bottom: none; }
.ranking-row:hover      { background: var(--panel-2); }

.ranking-pos {
  width: 28px; height: 28px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
  font-family: var(--mono);
  font-feature-settings: "zero";
}

.ranking-pos.pos-1     { background: rgba(243,177,58,.15); color: var(--warn); border: 1px solid rgba(243,177,58,.35); }
.ranking-pos.pos-2     { background: rgba(150,156,164,.12); color: var(--dim); border: 1px solid var(--line-2); }
.ranking-pos.pos-3     { background: rgba(205,127,50,.12); color: #cd7f32; border: 1px solid rgba(205,127,50,.3); }
.ranking-pos.pos-other { background: var(--inset); color: var(--faint); border: 1px solid var(--line); }

.ranking-name {
  flex: 1;
  font-size: .9rem;
  font-weight: 500;
}

.ranking-bar-wrap {
  width: 150px;
  height: 6px;
  background: var(--inset);
  border-radius: 3px;
  overflow: hidden;
}

.ranking-bar {
  height: 100%;
  border-radius: 3px;
  transition: width .6s ease;
}

.ranking-pct {
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: .85rem;
  font-weight: 600;
  min-width: 45px;
  text-align: right;
}

.ranking-count {
  font-size: .75rem;
  color: var(--faint);
  min-width: 60px;
  text-align: right;
  font-family: var(--mono);
  font-feature-settings: "zero";
}

/* ================================================================
   ADMIN PANEL
   ================================================================ */

.admin-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
}

.admin-tab {
  background: transparent;
  color: var(--faint);
  padding: .6rem 1.2rem;
  font-family: var(--font);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .02em;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.admin-tab svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.admin-tab:hover {
  color: var(--dim);
}

.admin-tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block;
}

.admin-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
}

.admin-form-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1.25rem;
}

.admin-form-card h3 {
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.admin-list-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}

.admin-list-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-list-header h3 {
  font-size: .95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.admin-list-items {
  display: flex;
  flex-direction: column;
}

.admin-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  transition: background var(--transition);
}

.admin-item:last-child { border-bottom: none; }
.admin-item:hover      { background: var(--panel-2); }

.admin-item-info {
  flex: 1;
  min-width: 0;
}

.admin-item-name {
  font-size: .9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-item-sub {
  font-size: .75rem;
  color: var(--faint);
  margin-top: .1rem;
}

.admin-item-actions {
  display: flex;
  gap: .4rem;
  flex-shrink: 0;
}

/* ================================================================
   TOTP / 2FA SETUP
   ================================================================ */

.totp-setup {
  text-align: center;
}

.qr-placeholder {
  background: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  border-radius: 4px;
  margin: 1rem auto;
  font-size: .75rem;
  color: #333;
  word-break: break-all;
  max-width: 300px;
}

.recovery-codes {
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1rem;
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: .85rem;
  color: var(--go);
  text-align: left;
  margin: 1rem 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .3rem;
}

/* ================================================================
   SECTION DIVIDER
   ================================================================ */

.section-divider {
  height: 1px;
  background: var(--line);
  margin: 1.5rem 0;
}

.section-label {
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: .65rem;
  font-weight: 500;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ================================================================
   ALERTS
   ================================================================ */

.alert-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.alert-item:last-child { border-bottom: none; }

.alert-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: .1rem; }
.alert-icon svg { width: 16px; height: 16px; }
.alert-text { flex: 1; font-size: .875rem; }
.alert-time { font-size: .75rem; color: var(--faint); flex-shrink: 0; font-family: var(--mono); font-feature-settings: "zero"; }

/* ================================================================
   PROGRESS BAR (generic)
   ================================================================ */

.progress-bar-wrap {
  background: var(--inset);
  border-radius: 3px;
  height: 6px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width .6s cubic-bezier(.4, 0, .2, 1);
}

/* ================================================================
   MODAL CONTRACT DETAILS
   ================================================================ */

.modal-contract-details {
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .9rem 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.contract-detail-row {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  font-size: .85rem;
}

.contract-detail-label {
  font-size: .72rem;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .04em;
  flex-shrink: 0;
  min-width: 90px;
  font-family: var(--mono);
  font-feature-settings: "zero";
}

.contract-detail-val {
  color: var(--ink);
  flex: 1;
}

.contract-detail-value {
  color: var(--warn);
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-weight: 600;
}

/* ================================================================
   PAINEL GESTOR
   ================================================================ */

.painel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.painel-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}

.painel-card-header {
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.painel-card-header h3 {
  font-size: .95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.painel-card-header h3 svg { width: 15px; height: 15px; flex-shrink: 0; }

.painel-card-body {
  max-height: 400px;
  overflow-y: auto;
}

.empty-panel-msg {
  padding: 2rem;
  text-align: center;
  color: var(--faint);
  font-size: .85rem;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .8rem 1.25rem;
  border-bottom: 1px solid var(--line);
  transition: background var(--transition);
}

.activity-item:last-child { border-bottom: none; }
.activity-item:hover      { background: var(--panel-2); }

.activity-icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: .1rem;
  display: flex;
  align-items: center;
}

.activity-icon svg { width: 15px; height: 15px; color: var(--faint); }

.activity-text { flex: 1; min-width: 0; }

/* ================================================================
   RESPONSIVE
   ================================================================ */

@media (max-width: 1100px) {
  .phase-ruler {
    margin-left: 260px;
    margin-right: 0;
  }
  .guide-lines {
    left: 260px;
    right: 0;
  }
  .lane-info {
    width: 260px;
    min-width: 260px;
  }
  .lane-meta {
    width: 100px;
    min-width: 100px;
  }
  .race {
    grid-template-columns: 260px 1fr;
  }
  .ident { min-width: 0; }
}

@media (max-width: 900px) {
  #app-main { padding: 1rem; }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .painel-grid {
    grid-template-columns: 1fr;
  }

  .phase-ruler   { display: none; }
  .guide-lines   { display: none; }

  .lane-row {
    flex-direction: column;
  }

  .lane-info {
    width: 100%;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .lane-track-area {
    min-height: 44px;
  }

  .lane-meta {
    display: none;
  }

  .modal-fields {
    grid-template-columns: 1fr;
  }

  .race {
    grid-template-columns: 1fr;
  }

  .ident {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .track {
    min-height: 44px;
  }

  .tower {
    grid-template-columns: repeat(3, 1fr);
  }

  .tower .kpi:nth-child(4),
  .tower .kpi:nth-child(5) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  #app-header {
    height: auto;
    padding: .75rem;
    flex-wrap: wrap;
    gap: .75rem;
  }

  #app-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: .25rem;
  }

  .stats-bar {
    grid-template-columns: repeat(3, 1fr);
  }

  .dashboard-overview {
    grid-template-columns: repeat(2, 1fr);
  }

  .tower {
    grid-template-columns: repeat(2, 1fr);
  }

  .ranking-bar-wrap { display: none; }
}

/* ================================================================
   Approval levels (alcadas ZEPP)
   ================================================================ */
.approval-section {
  margin: 1rem 0;
  padding: 1rem;
  background: rgba(122,162,255,.06);
  border: 1px solid rgba(122,162,255,.15);
  border-radius: 4px;
}
.approval-section .section-title {
  font-weight: 700;
  margin-bottom: .75rem;
  color: var(--info);
}
.approval-levels {
  display: flex;
  gap: .5rem;
  margin-bottom: .75rem;
}
.approval-level {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .75rem .5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all .2s;
  border: 1px solid var(--line);
  font-size: .8rem;
}
.approval-level:hover { background: rgba(122,162,255,.08); }
.approval-level.approved {
  background: rgba(63,210,154,.08);
  border-color: var(--go);
}
.approval-level.current {
  background: rgba(243,177,58,.08);
  border-color: var(--warn);
}
.approval-level.pending { opacity: .5; }
.approval-dot { font-size: 1.2rem; margin-bottom: .25rem; }
.approval-status {
  font-size: .8rem;
  text-align: center;
  padding-top: .5rem;
  font-family: var(--mono);
  font-feature-settings: "zero";
}
.lane-approval {
  font-size: .7rem;
  color: var(--info);
  font-weight: 600;
  font-family: var(--mono);
  font-feature-settings: "zero";
}

/* ----------------------------------------------------------------
   Stalled process indicators
   ---------------------------------------------------------------- */
.lane-stalled {
  border-left-color: var(--warn) !important;
  animation: pulse-warn 2s infinite;
}
.lane-stalled-critical {
  border-left-color: var(--accent) !important;
  animation: pulse-accent 1.5s infinite;
}
@keyframes pulse-warn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(243,177,58,0); }
  50%      { box-shadow: 0 0 8px 2px rgba(243,177,58,.2); }
}
@keyframes pulse-accent {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,67,38,0); }
  50%      { box-shadow: 0 0 8px 2px rgba(255,67,38,.3); }
}

/* ----------------------------------------------------------------
   Drag & drop zones (admin)
   ---------------------------------------------------------------- */
.drop-zone {
  cursor: move;
  transition: background .2s;
}
.drop-zone.drop-hover {
  background: var(--accent-soft);
  border: 1px dashed var(--accent);
  border-radius: 3px;
}
.lane-car[draggable="true"] {
  cursor: grab;
}
.lane-car[draggable="true"]:active {
  cursor: grabbing;
}

/* ================================================================
   TOGGLE SWITCH (iOS style)
   ================================================================ */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px; height: 26px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0; height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--line-2);
  border-radius: 26px;
  transition: .3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px; width: 20px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: .3s;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--go);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}
.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 0 2px rgba(63,210,154,.3);
}

/* ================================================================
   REGRAS (Admin rules cards)
   ================================================================ */
.regra-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  margin-bottom: 1rem;
  overflow: hidden;
}
.regra-header {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.regra-header .regra-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  margin-top: .1rem;
  display: flex;
  align-items: center;
}

.regra-header .regra-icon svg { width: 20px; height: 20px; }
.regra-header h4 {
  font-size: .95rem;
  margin-bottom: .15rem;
}
.regra-header p {
  color: var(--faint);
  font-size: .8rem;
  line-height: 1.4;
}
.regra-body {
  padding: 1rem 1.25rem;
}
.regra-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.regra-table th {
  text-align: left;
  color: var(--faint);
  font-family: var(--mono);
  font-feature-settings: "zero";
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--line);
}
.regra-table td {
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--line);
  font-size: .85rem;
  vertical-align: middle;
}

.regra-table tr:last-child td { border-bottom: none; }

/* Ícones de fase dentro da tabela de regras */
.regra-table td svg { width: 14px; height: 14px; vertical-align: middle; margin-right: 5px; flex-shrink: 0; }

/* Garantia geral: todo SVG dentro de regra-body */
.regra-body svg { max-width: 20px; max-height: 20px; }
.regra-input {
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink);
  padding: .4rem .6rem;
  font-size: .85rem;
  font-family: var(--mono);
  font-feature-settings: "zero";
  width: 70px;
  text-align: center;
}
.regra-input:focus {
  outline: none;
  border-color: var(--accent);
}
.regra-input:disabled {
  opacity: .4;
  cursor: not-allowed;
}
.regra-toggle-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.regra-toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .85rem;
  color: var(--dim);
}
.regra-toggle-item:last-child {
  border-bottom: none;
}

/* ================================================================
   GLOBAL SVG SIZE GUARD
   Prevents any inline SVG icon from rendering at full/default size
   in contexts not explicitly covered above.
   ================================================================ */

/* Card/section headings */
.admin-form-card h3 svg,
.admin-list-header h3 svg,
.checklist-title svg,
.section-title svg,
.approval-section .section-title svg { width: 15px; height: 15px; flex-shrink: 0; }

/* Modal header area */
.modal-subtitle svg { width: 14px; height: 14px; vertical-align: middle; }

/* Toast icon */
.toast-icon svg { width: 16px; height: 16px; }

/* View icon (page title) — keep at 30px for visual weight */
.view-icon svg { width: 28px; height: 28px; }

/* Login logo icon (lock, phone) */
.login-logo svg { width: 32px; height: 32px; color: var(--accent); }

/* ================================================================
   CONTRATOS — lista + drawer
   ================================================================ */

.contratos-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 0;
  height: calc(100vh - 62px);
  overflow: hidden;
}

.contratos-list {
  border-right: 1px solid var(--line);
  overflow-y: auto;
  background: var(--panel);
}

.contratos-list-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 2;
}

.contratos-list-header h2 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink);
}

.contratos-list-header .sub {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .14em;
  color: var(--faint);
  text-transform: uppercase;
  margin-top: 3px;
}

.ct-group { border-bottom: 1px solid var(--line); }

.ct-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  cursor: pointer;
  background: var(--panel-2);
  user-select: none;
  gap: 8px;
}

.ct-group-header:hover { background: var(--inset); }

.ct-group-name {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim);
  flex: 1;
}

.ct-group-count {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--faint);
  background: var(--inset);
  padding: 2px 6px;
  border-radius: 2px;
  border: 1px solid var(--line);
}

.ct-group-chevron {
  width: 12px;
  height: 12px;
  color: var(--faint);
  transition: transform .2s;
}

.ct-group.collapsed .ct-group-chevron { transform: rotate(-90deg); }
.ct-group.collapsed .ct-group-items { display: none; }

.ct-list-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background var(--transition);
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-left: 3px solid transparent;
}

.ct-list-item:hover { background: var(--panel-2); }

.ct-list-item.selected {
  background: var(--panel-2);
  border-left-color: var(--accent);
}

.ct-item-top { display: flex; align-items: baseline; gap: 7px; }

.ct-item-code {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

.ct-item-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ct-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.ct-item-saldo { font-family: var(--mono); font-size: 10px; font-weight: 500; }
.ct-item-saldo.saldo-ok   { color: var(--go); }
.ct-item-saldo.saldo-warn { color: var(--warn); }
.ct-item-saldo.saldo-low  { color: var(--accent); }
.ct-item-tags { display: flex; gap: 4px; flex-wrap: wrap; }

/* Drawer */
.contratos-drawer {
  overflow-y: auto;
  background: var(--bg);
  position: relative;
}

.contratos-drawer-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--faint);
}

.contratos-drawer-empty svg { width: 40px; height: 40px; opacity: .4; }
.contratos-drawer-empty p { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }

/* Zona 1 — Identidade sticky */
.ct-drawer-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 16px 24px 12px;
}

.ct-drawer-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.ct-drawer-code {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: .04em;
}

.ct-drawer-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.025em;
  color: var(--ink);
  line-height: 1.1;
  margin-top: 2px;
}

.ct-drawer-object { font-size: 12px; color: var(--dim); margin-top: 3px; }

.ct-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 12px;
}

.ct-kpi { padding: 10px 14px; border-right: 1px solid var(--line); }
.ct-kpi:last-child { border-right: none; }

.ct-kpi-label {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 4px;
}

.ct-kpi-value {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--ink);
}

.ct-kpi-value.ok   { color: var(--go); }
.ct-kpi-value.warn { color: var(--warn); }
.ct-kpi-value.low  { color: var(--accent); }

.ct-vigencia-bar-wrap { margin-top: 12px; }

.ct-vigencia-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 8.5px;
  color: var(--faint);
  margin-bottom: 4px;
}

.ct-vigencia-track {
  height: 4px;
  background: var(--inset);
  border-radius: 2px;
  position: relative;
  overflow: visible;
}

.ct-vigencia-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .4s;
}

.ct-vigencia-today {
  position: absolute;
  top: -4px;
  width: 2px;
  height: 12px;
  background: var(--ink);
  border-radius: 1px;
  transform: translateX(-50%);
}

/* Zona 2 — Gráfico */
.ct-section { padding: 20px 24px; border-bottom: 1px solid var(--line); }

.ct-section-title {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ct-section-title svg { width: 13px; height: 13px; }
.ct-chart-wrap { position: relative; height: 180px; }
.ct-chart-wrap svg { width: 100%; height: 100%; overflow: visible; }

.ct-chart-tooltip {
  position: absolute;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 3px;
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink);
  pointer-events: none;
  white-space: nowrap;
  z-index: 20;
  display: none;
}

.ct-chart-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 12px;
}

.ct-chart-stat { padding: 8px 12px; border-right: 1px solid var(--line); text-align: center; }
.ct-chart-stat:last-child { border-right: none; }

.ct-chart-stat-label {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 3px;
}

.ct-chart-stat-value { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--ink); }

/* Zona 3 — 3 colunas */
.ct-panels-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  border-bottom: 1px solid var(--line);
}

.ct-panel { padding: 16px 20px; border-right: 1px solid var(--line); }
.ct-panel:last-child { border-right: none; }

.ct-gauge-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ct-gauge-wrap svg { width: 100px; height: 60px; overflow: visible; }

.ct-addenda-list { display: flex; flex-direction: column; gap: 6px; }

.ct-addendum-item {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 8px 10px;
  cursor: pointer;
  transition: background var(--transition);
}

.ct-addendum-item:hover { background: var(--inset); }

.ct-addendum-header { display: flex; justify-content: space-between; align-items: baseline; }

.ct-addendum-num {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
}

.ct-addendum-value { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--warn); }
.ct-addendum-date { font-family: var(--mono); font-size: 9px; color: var(--faint); margin-top: 2px; }

.ct-items-table { width: 100%; font-size: 11px; border-collapse: collapse; }

.ct-items-table th {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 0 0 6px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.ct-items-table td {
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  vertical-align: middle;
}

.ct-items-table td:last-child { text-align: right; font-family: var(--mono); color: var(--ink); }

/* Zona 4 — Heatmap + Feed */
.ct-zone4 { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }

.ct-heatmap-wrap { padding: 16px 20px; border-right: 1px solid var(--line); overflow-x: auto; }
.ct-heatmap { display: grid; gap: 2px; }
.ct-heatmap-row { display: flex; align-items: center; gap: 2px; }

.ct-heatmap-phase-label {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
  width: 70px;
  flex-shrink: 0;
  text-align: right;
  padding-right: 6px;
}

.ct-heatmap-cell {
  width: 22px;
  height: 22px;
  border-radius: 2px;
  background: var(--inset);
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.ct-heatmap-cell.phase-done   { background: var(--go); border-color: var(--go); }
.ct-heatmap-cell.phase-late   { background: var(--accent); border-color: var(--accent); }
.ct-heatmap-cell.phase-slow   { background: var(--warn); border-color: var(--warn); }
.ct-heatmap-cell.phase-active { background: var(--info); border-color: var(--info); opacity: .6; }

.ct-heatmap-month-labels { display: flex; gap: 2px; padding-left: 76px; margin-bottom: 4px; }

.ct-heatmap-month-label {
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .04em;
  color: var(--faint);
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.ct-activity-feed { padding: 16px 20px; overflow-y: auto; max-height: 300px; }

.ct-activity-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.ct-activity-item:last-child { border-bottom: none; }

.ct-activity-av {
  width: 24px;
  height: 24px;
  border-radius: 3px;
  background: var(--inset);
  border: 1px solid var(--line-2);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

.ct-activity-body { flex: 1; min-width: 0; }
.ct-activity-msg { font-size: 11.5px; color: var(--ink); line-height: 1.3; }
.ct-activity-meta { font-family: var(--mono); font-size: 9px; color: var(--faint); margin-top: 2px; }

.ct-sienge-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--faint);
  letter-spacing: .1em;
}

.ct-sienge-error {
  padding: 12px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: .08em;
}
