@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ─── Design Tokens ──────────────────────────────────────────────────── */
:root {
  --blue:       #0f5884;
  --blue-light: #1a78b4;
  --blue-dim:   #0a3d5c;
  --petrol:     #17574f;
  --petrol-lt:  #1d6e64;
  --cream:      #fff3bd;
  --ink:        #0d1b26;
  --ink-soft:   #1e2f3c;
  --muted:      #5a6e7a;
  --muted-lt:   #8fa5b2;
  --line:       #d2dde2;
  --surface:    #ffffff;
  --surface-2:  #f6f9fa;
  --soft:       #eef3f5;
  --danger:     #b03535;
  --danger-bg:  #fdf0f0;
  --ok:         #1f7a52;
  --ok-bg:      #e6f7ee;
  --warn:       #9e6406;
  --warn-bg:    #fef9e7;
  --purple:     #6b4fbb;
  --purple-bg:  #f0ecfb;

  /* ── Sidebar DNA — compartilhado com os painéis ── */
  --sidebar-bg:    #0d1e2c;
  --sidebar-card:  #112233;
  --sidebar-edge:  rgba(15,88,132,.18);
  --panel-head-bg: linear-gradient(135deg, #0d1e2c 0%, #0f2a3d 100%);
  --panel-head-txt: #c8dde8;
  --kpi-bg:        linear-gradient(135deg, #0e2236 0%, #0f2d42 100%);
  --kpi-accent:    linear-gradient(90deg, #1a78b4, #17574f);

  /* ── Sombras ultra-difusas (Apple style) ── */
  --shadow-sm:  0 2px 12px rgba(13,27,38,.04);
  --shadow-md:  0 12px 32px rgba(13,27,38,.07), 0 2px 6px rgba(13,27,38,.03);
  --shadow-lg:  0 24px 64px rgba(13,27,38,.10), 0 8px 16px rgba(13,27,38,.04);
  --shadow-xl:  0 40px 90px rgba(13,27,38,.12), 0 12px 24px rgba(13,27,38,.05);

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;

  --sidebar-w:  260px;
  --transition: 250ms cubic-bezier(0.25, 1, 0.5, 1);
  --transition-slow: 500ms cubic-bezier(0.25, 1, 0.5, 1);
}

/* ─── Dark Mode ──────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --ink:        #e8f0f5;
    --ink-soft:   #c5d4de;
    --muted:      #7a9bb0;
    --muted-lt:   #5a7a8a;
    --line:       #1e3040;
    --surface:    #0d1b26;
    --surface-2:  #111f2c;
    --soft:       #162330;
    --cream:      #2a2410;
    --shadow-sm:  0 2px 8px rgba(0,0,0,.3);
    --shadow-md:  0 8px 28px rgba(0,0,0,.4);
    --shadow-lg:  0 20px 56px rgba(0,0,0,.5);
    --danger-bg:  #3a1515;
    --warn-bg:    #3b2f15;
    --ok-bg:      #123623;
    --purple-bg:  #231d36;
  }
  /* ── Dark Mode - Bordas Hairline & Sombras ── */
  html { background: #04090e; }
  body { background: linear-gradient(160deg, #071018 0%, #0a1723 50%, #04080c 100%); }
  .sidebar { background: rgba(8,18,28,.80); border-color: rgba(255,255,255,.04); }
  .topbar { background: rgba(8,18,28,.65); border-color: rgba(255,255,255,.03); }
  input, select, textarea { background: rgba(13,27,38,.6); border-color: rgba(255,255,255,.06); color: var(--ink); }
  th { background: rgba(11,22,34,.6); }
  .drawer { background: #0a1520; }
  .kpi  { background: var(--kpi-bg) !important; border-color: rgba(255,255,255,.04) !important; }
  .panel { background: rgba(11,22,34,.7); border-color: rgba(255,255,255,.04); }
  .client-card, .registry-card { background: rgba(11,22,34,.7); border-color: rgba(255,255,255,.04); }
  .panel-head { background: rgba(8,18,28,.5) !important; border-color: rgba(255,255,255,.04) !important; }
  .panel-head h2 { color: #c8dde8 !important; }
}

/* ─── Reset & Base ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  background: #edf2f5;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(ellipse at top right, rgba(255,243,189,.35) 0%, transparent 50%),
    radial-gradient(ellipse at bottom left, rgba(23,87,79,.08) 0%, transparent 50%),
    linear-gradient(160deg, #f5f8fa 0%, #edf2f5 50%, #e8f4f2 100%);
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}
button { cursor: pointer; border: none; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ─── Sidebar ────────────────────────────────────────────────────────── */
.sidebar {
  height: 100vh;
  position: sticky;
  top: 0;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 1px 0 24px rgba(0,0,0,.02);
}

.logo-wrap {
  padding: 0 4px 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.logo { width: 160px; height: auto; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.nav-item {
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  padding: 11px 14px;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
}
.nav-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--blue), var(--petrol));
  border-radius: 0 3px 3px 0;
  opacity: 0;
  transition: opacity var(--transition);
}
.nav-item:hover {
  background: var(--soft);
  color: var(--ink);
  transform: translateX(2px);
}
.nav-item.active {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dim) 100%);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 18px rgba(15,88,132,.35);
}
.nav-item.active::before { opacity: 1; }

.nav-icon { font-size: 16px; min-width: 20px; text-align: center; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
}

.role-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted-lt);
  margin-bottom: 6px;
  display: block;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  padding: 9px 10px;
  appearance: auto;
}

.db-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 11px;
  font-weight: 700;
  background: var(--ok-bg);
  color: var(--ok);
}
.db-status::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse 2s infinite;
}
.db-status.local::before { background: var(--warn); }
.db-status.local { color: var(--warn); background: var(--warn-bg); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.8); }
}

/* ─── Main Shell ─────────────────────────────────────────────────────── */
.shell {
  padding: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ─── Topbar ─────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 28px 40px;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 1px 24px rgba(0,0,0,.015);
}
.eyebrow { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 4px; }
.topbar h1 { font-size: 28px; font-weight: 800; letter-spacing: -.03em; margin: 0; color: var(--ink); line-height: 1.1; }
.period {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.period label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  display: grid;
  gap: 5px;
}
.period input[type="date"] {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 7px 10px;
  font-size: 12px;
  width: 150px;
}

/* ─── Content area ───────────────────────────────────────────────────── */
.content { padding: 28px 32px; flex: 1; }

/* ─── Views ──────────────────────────────────────────────────────────── */
.view { display: none; animation: fadeIn .25s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity:0; transform: translateY(6px); } to { opacity:1; transform: translateY(0); } }

/* ─── KPIs ───────────────────────────────────────────────────────────── */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.kpi {
  background: var(--kpi-bg, var(--surface));
  border: 1px solid var(--sidebar-edge, var(--line));
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(0,0,0,.03), inset 0 1px 0 rgba(255,255,255,.05);
  padding: 20px 18px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.kpi:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.kpi::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top left, rgba(26,120,180,.08) 0%, transparent 60%);
  pointer-events: none;
}
.kpi::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--kpi-accent, linear-gradient(90deg, var(--blue), var(--petrol)));
}
.kpi strong {
  display: block;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -.03em;
  color: #7ec8f0;
  line-height: 1;
  margin-bottom: 6px;
}
.kpi span {
  font-size: 11px;
  font-weight: 600;
  color: #6a8fa8;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.kpi-icon {
  position: absolute;
  right: 14px; top: 14px;
  font-size: 22px;
  opacity: .12;
}

/* ─── Grid layouts ───────────────────────────────────────────────────── */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1.15fr 1fr .95fr; }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

/* ─── Panel ──────────────────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--sidebar-edge, var(--line));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}
.panel:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.panel-body { padding: 20px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: var(--panel-head-bg, var(--surface-2));
  border-bottom: 1px solid var(--sidebar-edge, var(--line));
}
.panel-head h2 {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  color: var(--panel-head-txt, var(--ink));
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-head h3 { font-size: 13px; font-weight: 700; margin: 0; color: var(--muted); }
.panel-scroll { padding: 12px; overflow-y: auto; max-height: 360px; }

/* ─── Badges ─────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
  background: var(--soft);
  color: var(--muted);
}
.badge.ok      { background: var(--ok-bg);      color: var(--ok); }
.badge.warn    { background: var(--warn-bg);     color: var(--warn); }
.badge.danger  { background: var(--danger-bg);   color: var(--danger); }
.badge.blue    { background: rgba(15,88,132,.1); color: var(--blue); }
.badge.purple  { background: var(--purple-bg);   color: var(--purple); }
.badge.petrol  { background: rgba(23,87,79,.1);  color: var(--petrol); }

/* ─── Score bar & gauge ──────────────────────────────────────────────── */
.score { display: grid; gap: 5px; min-width: 110px; }
.score-num { font-size: 15px; font-weight: 800; color: var(--blue); letter-spacing: -.02em; }
.score-bar {
  height: 7px;
  background: var(--soft);
  border-radius: 999px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--petrol), var(--blue));
  transition: width .8s cubic-bezier(.4,0,.2,1);
}
.score-bar-fill.high { background: linear-gradient(90deg, var(--ok), #34d399); }
.score-bar-fill.low  { background: linear-gradient(90deg, var(--danger), #f87171); }

/* Circular gauge (SVG) */
.gauge-wrap { display: flex; align-items: center; gap: 16px; }
.gauge { position: relative; width: 72px; height: 72px; flex-shrink: 0; }
.gauge svg { transform: rotate(-90deg); }
.gauge-bg  { fill: none; stroke: var(--soft); stroke-width: 8; }
.gauge-arc { fill: none; stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset .8s cubic-bezier(.4,0,.2,1); }
.gauge-arc.high { stroke: var(--ok); }
.gauge-arc.mid  { stroke: var(--blue); }
.gauge-arc.low  { stroke: var(--danger); }
.gauge-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 900;
  color: var(--ink);
}

/* ─── Queue / Stack items ────────────────────────────────────────────── */
.stack { display: grid; gap: 10px; }
.queue-item {
  padding: 13px 15px;
  border-radius: var(--radius-md);
  background: var(--soft);
  border-left: 3px solid var(--blue);
  display: grid;
  gap: 4px;
  transition: transform var(--transition), box-shadow var(--transition);
}
.queue-item:hover { transform: translateX(3px); box-shadow: var(--shadow-sm); }
.queue-item strong { font-size: 13.5px; font-weight: 700; }
.queue-item p { font-size: 12px; color: var(--muted); margin: 0; }
.queue-item.urgent { border-color: var(--danger); background: var(--danger-bg); }
.queue-item.waiting { border-color: var(--warn); background: var(--warn-bg); }

/* ─── Pipeline / Kanban ──────────────────────────────────────────────── */
.pipeline-mini { display: grid; gap: 8px; }
.pipeline-row {
  display: grid;
  grid-template-columns: 150px 1fr 36px;
  gap: 10px;
  align-items: center;
}
.pipeline-label { font-size: 12px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 10px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--petrol), var(--blue)); transition: width .8s cubic-bezier(.4,0,.2,1); }
.bar-count { font-size: 13px; font-weight: 800; color: var(--blue); text-align: right; }

/* ─── Recommendation cards ───────────────────────────────────────────── */
.recommendation {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--soft);
  border-left: 3px solid var(--petrol);
  transition: transform var(--transition);
  cursor: pointer;
}
.recommendation:hover { transform: translateX(3px); }
.recommendation strong { font-size: 13.5px; font-weight: 700; }
.recommendation p { font-size: 12px; color: var(--muted); margin: 4px 0 0; }

/* ─── Toolbar ────────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar input[type="search"] {
  flex: 1 1 260px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 10px 14px;
  font-size: 13.5px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.toolbar input[type="search"]:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(15,88,132,.12); }
.toolbar select { flex: 0 1 200px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); padding: 10px 12px; font-size: 13px; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.toggle input { width: auto; cursor: pointer; accent-color: var(--blue); }

/* ─── Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  padding: 9px 16px;
  min-height: 38px;
  cursor: pointer;
  transition: filter var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(0); filter: brightness(.96); }
.btn-primary   { background: linear-gradient(135deg, var(--blue), var(--blue-dim)); color: #fff; box-shadow: 0 3px 12px rgba(15,88,132,.3); }
.btn-secondary { background: rgba(23,87,79,.1); color: var(--petrol); }
.btn-ghost     { background: var(--soft); color: var(--ink-soft); }
.btn-danger    { background: var(--danger-bg); color: var(--danger); }
.btn-sm        { font-size: 12px; padding: 6px 11px; min-height: 30px; border-radius: var(--radius-sm); }
.btn-icon      { padding: 9px; min-width: 38px; justify-content: center; }
.btn-wa        { background: #25d366; color: #fff; box-shadow: 0 3px 12px rgba(37,211,102,.3); }

/* Legacy compat */
.primary   { background: linear-gradient(135deg, var(--blue), var(--blue-dim)); color: #fff; border-radius: var(--radius-md); font-weight: 700; padding: 9px 16px; min-height: 38px; box-shadow: 0 3px 12px rgba(15,88,132,.25); transition: filter var(--transition); }
.secondary { background: rgba(23,87,79,.1); color: var(--petrol); border-radius: var(--radius-md); font-weight: 700; padding: 9px 16px; min-height: 38px; }
.mini      { background: var(--soft); color: var(--ink-soft); border-radius: var(--radius-sm); font-weight: 700; padding: 5px 10px; min-height: 28px; font-size: 12px; }
.danger    { background: var(--danger-bg); color: var(--danger); border-radius: var(--radius-md); font-weight: 700; padding: 9px 16px; min-height: 38px; }
.primary:hover, .secondary:hover, .mini:hover, .danger:hover { filter: brightness(1.07); }

/* ─── Table ──────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--line); }
table { width: 100%; min-width: 1040px; border-collapse: collapse; background: var(--surface); }
thead th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}
thead th:hover { background: var(--soft); }
thead th .sort-icon { margin-left: 4px; opacity: .4; font-size: 10px; }
thead th.sort-asc .sort-icon,
thead th.sort-desc .sort-icon { opacity: 1; color: var(--blue); }
tbody tr {
  border-bottom: 1px solid var(--line);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--soft); }
td { padding: 12px 14px; font-size: 13.5px; vertical-align: middle; }
.td-name { font-weight: 700; color: var(--ink); }
.td-sub  { font-size: 12px; color: var(--muted); margin-top: 2px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ─── Drawer ─────────────────────────────────────────────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,27,38,.45);
  z-index: 19;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
  backdrop-filter: blur(3px);
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(640px, 100vw);
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  transform: translateX(105%);
  transition: transform var(--transition-slow);
  display: flex;
  flex-direction: column;
  z-index: 20;
  overflow: hidden;
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  flex-shrink: 0;
}
.drawer-header h2 { font-size: 16px; font-weight: 800; margin: 0; }

.drawer-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 20px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.drawer-close:hover { background: var(--soft); }

.drawer-body { flex: 1; overflow-y: auto; padding: 24px; display: grid; gap: 20px; align-content: start; }

.drawer-section { display: grid; gap: 14px; }
.drawer-section h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted-lt);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail {
  background: var(--soft);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: grid;
  gap: 4px;
}
.detail-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-lt); }
.detail-value { font-size: 13.5px; font-weight: 600; color: var(--ink); }

.criteria { display: flex; flex-wrap: wrap; gap: 7px; }
.criteria-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 600;
}
.criteria-item.pass { background: var(--ok-bg); color: var(--ok); }
.criteria-item.fail { background: var(--warn-bg); color: var(--warn); }

.history { display: grid; gap: 10px; }
.history-item {
  display: grid;
  gap: 3px;
  border-left: 3px solid var(--line);
  padding-left: 12px;
}
.history-item.recent { border-color: var(--petrol); }
.history-item-text { font-size: 13px; color: var(--ink-soft); }
.history-item-meta { font-size: 11px; color: var(--muted-lt); }

.drawer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  flex-shrink: 0;
}

/* Edit fields inside drawer */
.edit-field {
  display: grid;
  gap: 5px;
}
.edit-field label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-lt); }
.edit-field input,
.edit-field select,
.edit-field textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 9px 12px;
  font-size: 13.5px;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.edit-field input:focus,
.edit-field select:focus,
.edit-field textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(15,88,132,.1);
}

/* ─── CV / Leitor ────────────────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius-lg);
  background: var(--soft);
  padding: 32px 24px;
  text-align: center;
  display: grid;
  gap: 8px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.dropzone:hover, .dropzone.dragover { border-color: var(--blue); background: rgba(15,88,132,.04); }
.dropzone input[type="file"] { display: none; }
.dropzone-icon { font-size: 36px; }
.dropzone strong { font-size: 15px; font-weight: 700; }
.dropzone span { font-size: 12.5px; color: var(--muted); }

.form-label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}
.form-label input,
.form-label select,
.form-label textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 10px 13px;
  font-size: 13.5px;
  width: 100%;
  transition: border-color var(--transition);
}
.form-label input:focus, .form-label select:focus, .form-label textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(15,88,132,.1); }
textarea { resize: vertical; }

.privacy-note {
  border-left: 3px solid var(--petrol);
  background: rgba(23,87,79,.06);
  padding: 12px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12.5px;
  color: var(--petrol);
  font-weight: 500;
}

/* ─── CV result ──────────────────────────────────────────────────────── */
.cv-result-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.cv-result-empty .cv-empty-icon { font-size: 48px; display: block; margin-bottom: 12px; }
.result-card {
  background: var(--soft);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
}
.result-card h2 { font-size: 20px; font-weight: 800; margin: 0; }

/* ─── Jobs ───────────────────────────────────────────────────────────── */
.job-item {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--soft);
  border: 1px solid var(--line);
  display: grid;
  gap: 8px;
  transition: box-shadow var(--transition), transform var(--transition);
}
.job-item:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.job-item-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.job-code { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--petrol); }
.job-title { font-size: 15px; font-weight: 800; }
.job-meta { font-size: 12.5px; color: var(--muted); }
.job-actions { display: flex; gap: 8px; }

/* ─── Job form ───────────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* ─── Client cards ───────────────────────────────────────────────────── */
.client-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.client-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.client-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.client-card-top {
  padding: 20px;
  background: linear-gradient(135deg, var(--petrol), var(--blue-dim));
  color: #fff;
}
.client-card-top h2 { font-size: 16px; font-weight: 800; margin: 0 0 4px; }
.client-card-body { padding: 16px 20px; display: grid; gap: 10px; }

/* ─── Registries ─────────────────────────────────────────────────────── */
.registry-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.registry-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
}
.registry-card h3 { font-size: 13px; font-weight: 800; margin-bottom: 10px; }
.registry-card ul { padding-left: 16px; display: grid; gap: 3px; }
.registry-card li { font-size: 12.5px; color: var(--ink-soft); }

.brief {
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink-soft);
}
code { background: rgba(15,88,132,.08); color: var(--blue); padding: 2px 6px; border-radius: 4px; font-size: 12px; }

/* ─── Modal ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,27,38,.55);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 32px;
  max-width: 480px;
  width: 100%;
  transform: scale(.94) translateY(12px);
  transition: transform var(--transition-slow);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal h2 { font-size: 20px; font-weight: 800; margin-bottom: 10px; }
.modal p  { font-size: 14px; color: var(--muted); margin-bottom: 24px; line-height: 1.65; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ─── Toast ──────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 13px 18px;
  box-shadow: var(--shadow-xl);
  z-index: 50;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 340px;
  transform: translateY(12px);
  opacity: 0;
  transition: transform .25s cubic-bezier(.4,0,.2,1), opacity .25s ease;
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.toast.ok   { background: var(--ok); }
.toast.warn { background: var(--warn); }
.toast.err  { background: var(--danger); }

/* ─── Misc helpers ───────────────────────────────────────────────────── */
.muted       { color: var(--muted); }
.txt-sm      { font-size: 12px; }
.fw-bold     { font-weight: 700; }
.fw-black    { font-weight: 900; }
.txt-blue    { color: var(--blue); }
.txt-petrol  { color: var(--petrol); }
.txt-danger  { color: var(--danger); }
.txt-ok      { color: var(--ok); }
.gap-8       { display: flex; gap: 8px; flex-wrap: wrap; }
.gap-10      { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.mt-auto     { margin-top: auto; }
.section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted-lt);
  margin-bottom: 12px;
}
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
  font-size: 14px;
}
.empty-icon { font-size: 40px; display: block; margin-bottom: 12px; }
.sync-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ok);
  display: inline-block;
  animation: pulse 1.5s infinite;
}
.sync-dot.syncing { background: var(--warn); animation: pulse .6s infinite; }

/* ─── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1080px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  body { grid-template-columns: 1fr; }
  .sidebar { height: auto; position: static; flex-direction: row; flex-wrap: wrap; padding: 16px; gap: 12px; }
  .logo-wrap { border: none; padding: 0; margin: 0; }
  .nav { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .nav-item { font-size: 12px; padding: 8px 12px; }
  .sidebar-footer { flex-direction: row; border: none; padding: 0; }
  .content { padding: 20px 16px; }
  .topbar { padding: 14px 16px; flex-direction: column; align-items: flex-start; gap: 10px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .registry-grid { grid-template-columns: 1fr; }
  .client-cards { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 22px; }
  .drawer { width: 100vw; }
}

/* ─── Empty state animado (Jobs) ────────────────────────────────── */
.empty-state-animated {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  text-align: center;
  gap: 8px;
  color: var(--muted);
  animation: fadeUp .5s ease both;
}
.empty-anim-icon {
  font-size: 36px;
  animation: bounce 2s ease infinite;
  margin-bottom: 4px;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-7px); }
}
.empty-state-animated strong { color: var(--ink); font-size: 15px; }
.empty-state-animated p      { font-size: 13px; line-height: 1.6; max-width: 240px; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Sub-eyebrow conversão (Bezos) ─────────────────────────────── */
.sub-eyebrow {
  font-size: 11.5px;
  color: #5a8fa8;
  margin: 2px 0 0;
  font-weight: 500;
  letter-spacing: .01em;
}

/* ─── Assinatura ─────────────────────────────────────────────────── */
.signature {
  position: fixed;
  bottom: 14px;
  right: 18px;
  font-size: 11px;
  letter-spacing: .06em;
  color: rgba(90, 110, 122, .28);
  pointer-events: none;
  user-select: none;
  z-index: 5;
  font-weight: 500;
}


.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-right .period {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 0;
}
.topbar-right .btn-outline {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
}
.topbar-right .btn-outline:hover {
  background: var(--surface-hover);
}

.topbar-right {
  align-items: flex-end !important;
}
.topbar-right .period label {
  display: flex;
  flex-direction: column;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  gap: 4px;
}
.topbar-right .btn {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.topbar-right {
  align-items: flex-end !important;
}
.topbar-right .period label {
  display: flex;
  flex-direction: column;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  gap: 4px;
}
.topbar-right .btn {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}
