/* =============================================================
   BASE — tokens de design, reset, tipografia, botões, pills
   ============================================================= */
:root {
  /* Cores neutras */
  --bg:        #f5f6f8;
  --surface:   #ffffff;
  --surface-2: #fbfbfd;
  --border:    #e8eaef;
  --border-2:  #eef0f4;
  --text:      #1a1d24;
  --text-2:    #545a66;
  --text-3:    #8a909c;

  /* Cor principal (violeta/azul) */
  --primary:      #6366f1;
  --primary-600:  #5457e0;
  --primary-700:  #4649c9;
  --primary-weak: #eef0fe;
  --primary-soft: #f3f4ff;

  /* Semânticas */
  --success: #16a34a;
  --success-weak: #e7f6ec;
  --info:    #0ea5e9;
  --info-weak: #e6f5fd;
  --warning: #f59e0b;
  --warning-weak: #fdf3e0;
  --danger:  #ef4444;
  --danger-weak: #fdeaea;

  /* Sombras sutis */
  --sh-sm: 0 1px 2px rgba(24,28,40,.05), 0 1px 3px rgba(24,28,40,.04);
  --sh-md: 0 2px 6px rgba(24,28,40,.06), 0 6px 16px rgba(24,28,40,.06);
  --sh-lg: 0 10px 30px rgba(24,28,40,.12), 0 4px 10px rgba(24,28,40,.06);
  --sh-xl: 0 20px 50px rgba(24,28,40,.18);

  /* Geometria */
  --r-sm: 7px;
  --r:    10px;
  --r-md: 13px;
  --r-lg: 18px;
  --sidebar-w: 244px;
  --topbar-h: 66px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}

h1, h2, h3, h4 { font-weight: 650; letter-spacing: -0.021em; color: var(--text); text-wrap: balance; }
h1 { font-size: 20px; letter-spacing: -0.028em; }
h2 { font-size: 16px; letter-spacing: -0.022em; }
h3 { font-size: 14.5px; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--text); }
::placeholder { color: var(--text-3); }
svg.ic { flex: none; }

/* Scrollbars discretas */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d5d8e0; border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #c2c6d1; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Utilidades de texto ---------- */
.muted { color: var(--text-3); display: inline-flex; align-items: center; gap: 5px; }
.danger-text { color: var(--danger); font-weight: 600; }
.warn-text { color: var(--warning); font-weight: 600; }
.ok-text { color: var(--success); font-weight: 600; }
.link { color: var(--primary); font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.link:hover { color: var(--primary-700); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 15px;
  border-radius: var(--r); font-weight: 600; font-size: 13.5px;
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border);
  transition: all .16s ease; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: #dcdfe6; color: var(--text); }
.btn-primary { background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 90%, white), var(--primary)); color: #fff; border-color: var(--primary-600); box-shadow: 0 1px 2px rgba(70,73,201,.35), inset 0 1px 0 rgba(255,255,255,.2); }
.btn-primary:hover { background: linear-gradient(180deg, var(--primary), var(--primary-600)); border-color: var(--primary-700); color: #fff; }
.btn-primary:active { transform: translateY(.5px); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--border-2); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; margin-top: 6px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--r);
  color: var(--text-2); position: relative; transition: background .15s;
}
.icon-btn:hover { background: var(--border-2); color: var(--text); }

/* ---------- Pills / chips / badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, white);
}
.pill.xs { height: 18px; font-size: 10px; padding: 0 6px; gap: 3px; }
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }

.chip {
  display: inline-flex; align-items: center;
  height: 20px; padding: 0 8px; border-radius: 6px;
  font-size: 11px; font-weight: 600;
  color: var(--c); background: color-mix(in srgb, var(--c) 11%, white);
  border: 1px solid color-mix(in srgb, var(--c) 22%, white);
}

.count-pill {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text-2); background: var(--border-2);
}
.count-pill.danger { color: var(--danger); background: var(--danger-weak); }
.count-pill.warning { color: #b8790a; background: var(--warning-weak); }

.risk { display: inline-flex; align-items: center; gap: 6px; }
.risk-dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 8%, transparent); }
.risk-txt { font-size: 12px; font-weight: 600; color: var(--text-2); }

/* ---------- Avatar ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff; font-weight: 650; font-size: 11px;
  flex: none; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.18); letter-spacing: .2px;
}

/* ---------- Progress ---------- */
.progress { height: 7px; border-radius: 20px; background: var(--border-2); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 20px; transition: width .4s ease; }

/* ---------- Animações ---------- */
.fade-in { animation: fadeIn .28s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card-hover { transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--sh-md); border-color: #dde0e8; }

.empty-mini { color: var(--text-3); font-size: 13px; padding: 10px 2px; }

/* ---------- Empty state ---------- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 60px 20px; text-align: center; color: var(--text-3);
}
.empty-state svg { color: var(--text-3); opacity: .6; }
.empty-state h3 { color: var(--text-2); }

/* =============================================================
   CRAFT — superfícies do navegador, foco, numerais tabulares
   (aplicação dos princípios "impeccable" para modo Operate)
   ============================================================= */

/* Seleção de texto e cursor tematizados a partir da paleta */
::selection { background: color-mix(in srgb, var(--primary) 22%, white); color: var(--text); }
input, textarea, [contenteditable] { caret-color: var(--primary); }

/* Anel de foco visível e consistente (acessibilidade + craft) */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
a:focus-visible, .btn:focus-visible, .icon-btn:focus-visible, .nav-item:focus-visible,
.seg-btn:focus-visible, .vt-btn:focus-visible { outline-offset: 3px; }
/* campos já têm anel próprio via box-shadow */
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; }
:focus:not(:focus-visible) { outline: none; }

/* Numerais tabulares em dados e indicadores — alinhamento de dígitos */
.stat-value, .ms-value, .tm-val, .im strong, .hstat strong, .sc-sum-v,
.tl2-dnum, .kb-count, .count-pill, .badge-count, .sc-day-count,
.cell-progress span, .camp-progress-head strong, .camp-progress span,
.data-table td, .result-count, .ms-days, .ms-date, .tl2-month {
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
}

/* Respeita quem prefere menos movimento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}
