/* Vagas Tech Brasil — app shell (sidebar + topbar) and shared page primitives.
 *
 * Load after theme.css; shell.js fills the sidebar and the topbar tools.
 *
 *   <head> ... theme.css, theme.js, shell.css, <script src="/static/shell.js"></script>
 *   <body data-page="painel|vagas|candidaturas|status|anunciar">
 *     <div class="shell">
 *       <aside class="sidebar" id="sidebar" aria-label="Navegação"></aside>
 *       <div class="shell-main">
 *         <header class="topbar" id="topbar">
 *           <div class="topbar-slot"> page title / breadcrumb / actions </div>
 *         </header>
 *         <main id="main" class="shell-content"> ... </main>
 *       </div>
 *     </div>
 *
 * State hooks (set by shell.js on <html>):
 *   [data-sidebar="collapsed"]  desktop icon rail (72px), persisted in localStorage "sidebar"
 *   [data-drawer="open"]        mobile (<900px) off-canvas drawer is open
 *
 * Topbar slot helpers
 *   .topbar-title            compact page title in the topbar
 *   .crumbs > a, span        breadcrumb ("Carreira / Candidaturas"); last item = current; "/" separators
 *                            are added automatically unless the markup has its own .crumb-sep elements
 *
 * Page primitives (use inside .shell-content, or anywhere)
 *   .page-head               header row: .page-head-text (+ .page-eyebrow, h1/.page-title, p/.page-sub)
 *                            and .page-actions (buttons, right-aligned; wraps under on mobile)
 *   .kpi-grid                responsive grid of KPI tiles (auto-fit, min 200px; 2 cols on phones)
 *   .kpi                     glass tile: .kpi-label, .kpi-value, .kpi-foot (.delta.up|.down|.flat, .kpi-sub),
 *                            optional .kpi-icon (top-right) and .kpi-spark (svg slot, full width)
 *                            tone modifiers: .kpi.is-ok | .is-warn | .is-err | .is-accent (color the value + icon)
 *   .panel                   glass card: .panel-head (.panel-title, .panel-sub, .panel-actions) + .panel-body
 *                            .panel-body.flush removes padding (tables, lists)
 *   .segmented               pill group of <button>s; selected = aria-pressed="true" | aria-selected="true" | .is-active
 *   .empty-state             centered placeholder: .empty-icon (svg), h3, p, .empty-actions
 *   .dot / .dot.ok|warn|err|off   small status dot (.dot.run = accent dot, "coletando agora"; add .pulse)
 *
 * Motion utilities (all disabled under prefers-reduced-motion; see docs/DESIGN.md)
 *   .reveal                  fades/slides in when scrolled into view (shell.js adds .is-in);
 *                            stagger with style="--i: 3" (delay = --i * --stagger)
 *   .count-up[data-value]    number counts up from 0 when visible (pt-BR format); data-decimals,
 *                            data-prefix, data-suffix; or call Shell.countUp(el, value)
 *   .shimmer                 skeleton block with a moving sheen (give it a width/height)
 *   .pulse                   soft infinite pulse ring (status dots)
 *   .pop                     one-shot "bump" (a count that changed); Shell.pop(el) replays it
 *
 * Toasts: window.Toast.show(message, {type, action, timeout}) (shell.js) render in .toast-region.
 */

:root {
  --sb-w: 248px;
  --sb-rail: 72px;
  --topbar-h: 60px;
  --shell-pad: 32px;
  --sb-bg: linear-gradient(180deg, rgba(14, 24, 48, .78) 0%, rgba(7, 13, 28, .86) 100%);
  --sb-item-hover: rgba(122, 162, 255, .07);
  --topbar-bg: rgba(5, 10, 24, .62);
  --topbar-border: var(--glass-border);
  --sb-card-bg: color-mix(in srgb, var(--surface-2) 70%, transparent);
  --sb-card-border: var(--glass-border);
  --pop-bg: linear-gradient(180deg, rgba(22, 36, 68, .97) 0%, rgba(11, 20, 40, .98) 100%);
  --pop-shadow: 0 18px 50px -12px rgba(0, 0, 0, .7), 0 0 0 1px var(--glass-border);
}
:root[data-theme="light"] {
  --sb-bg: linear-gradient(180deg, rgba(255, 255, 255, .9) 0%, rgba(250, 251, 254, .9) 100%);
  --sb-item-hover: rgba(15, 21, 32, .045);
  --topbar-bg: rgba(246, 247, 251, .8);
  --topbar-border: var(--line);
  --sb-card-bg: #f2f4f9;
  --sb-card-border: var(--line);
  --pop-bg: #ffffff;
  --pop-shadow: 0 18px 44px -14px rgba(15, 21, 32, .25), 0 0 0 1px var(--line);
  /* green text on --ok-bg / white: --ok (#059669) is ~3.4:1 there; this keeps >= 4.5:1 */
  --ok-ink: #047857;
}
:root[data-sidebar="collapsed"] { --sb-w: var(--sb-rail); }

/* ---------- layout ---------- */
body { min-height: 100vh; }
.shell { display: grid; grid-template-columns: var(--sb-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns 220ms var(--ease); }
.shell-main { min-width: 0; display: flex; flex-direction: column; }
.shell-content { width: 100%; max-width: 1440px; margin: 0 auto; padding: 28px var(--shell-pad) 56px; flex: 1; min-width: 0; }

/* ---------- sidebar ---------- */
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; z-index: 45;
  display: flex; flex-direction: column; min-width: 0;
  background: var(--sb-bg); border-right: 1px solid var(--topbar-border);
  box-shadow: var(--glass-highlight);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.sb-head { display: flex; align-items: center; gap: 8px; height: var(--topbar-h); padding: 0 16px 0 18px; flex: none; }
.sb-brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); font-weight: 700; letter-spacing: -.015em; font-size: 15px; }
.sb-brand:hover { text-decoration: none; }
.sb-brand img { width: 30px; height: 30px; flex: none; border-radius: 8px; box-shadow: 0 0 0 1px var(--glass-border), 0 6px 18px -6px rgba(99, 102, 241, .55); }
.sb-brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .sb-close { display: none; margin-left: auto; }

.sb-nav { position: relative; flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 12px 12px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.sb-section + .sb-section { margin-top: 14px; }
.sb-label { margin: 0; padding: 8px 12px 6px; font: 600 10.5px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }
.sb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sb-item {
  position: relative; display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 10px 0 12px;
  border-radius: var(--radius); color: var(--muted); font-size: var(--fs); font-weight: 500; white-space: nowrap;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.sb-item:hover { color: var(--text); background: var(--sb-item-hover); text-decoration: none; }
.sb-item:hover .sb-ic { color: var(--accent); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 55%, transparent)); }
.sb-item .sb-ic { width: 18px; height: 18px; flex: none; opacity: .9; transition: color var(--dur) var(--ease), filter var(--dur) var(--ease); }
.sb-item .sb-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sb-item[aria-current="page"] {
  color: var(--text); font-weight: 600;
  background: linear-gradient(90deg, var(--accent-bg), color-mix(in srgb, var(--accent-bg) 35%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-ring) 45%, transparent);
}
.sb-item[aria-current="page"] .sb-ic { color: var(--accent); opacity: 1; }
.sb-item[aria-current="page"]::before,
.sb-indicator {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--brand-gradient); box-shadow: 0 0 12px rgba(59, 130, 246, .7);
}
/* sliding active bar: one element moved by shell.js (the per-item ::before is the no-JS fallback) */
.sb-nav.has-indicator .sb-item[aria-current="page"]::before { display: none; }
.sb-indicator {
  left: 0; top: 0; bottom: auto; height: 20px; pointer-events: none; opacity: 0;
  transform: translateY(var(--sb-ind-y, 0px));
  transition: transform var(--dur-slow) var(--ease-out), height var(--dur-slow) var(--ease-out), opacity var(--dur) var(--ease);
}
.sb-indicator.is-on { opacity: 1; }
.sb-indicator.no-anim { transition: none; }
.sb-badge {
  min-width: 22px; padding: 0 7px; height: 20px; display: inline-grid; place-items: center; border-radius: var(--radius-pill);
  font: 600 11px/1 var(--font-mono); font-variant-numeric: tabular-nums;
  color: var(--accent); background: var(--accent-bg); border: 1px solid color-mix(in srgb, var(--accent-ring) 50%, transparent);
}
.sb-badge.is-ok { color: var(--ok-ink, var(--ok)); background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.sb-badge.is-dot { min-width: 0; width: 8px; height: 8px; padding: 0; border: 0; }
.sb-badge.is-dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.sb-badge.is-dot.err { background: var(--err); box-shadow: 0 0 0 3px var(--err-bg); }
.sb-badge.is-dot.run { background: var(--accent); color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }

/* footer card */
.sb-foot { position: relative; flex: none; padding: 12px; border-top: 1px solid var(--topbar-border); display: grid; gap: 8px; }
.sb-card { display: grid; gap: 2px; padding: 4px; border-radius: var(--radius); background: var(--sb-card-bg); border: 1px solid var(--sb-card-border); }
.sb-row { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: var(--fs-sm); color: var(--text); }
button.sb-row {
  position: relative; width: 100%; padding: 8px; border: 0; border-radius: 7px; background: transparent; font: inherit; text-align: left; cursor: pointer;
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
button.sb-row:hover, button.sb-row[aria-expanded="true"] { background: var(--sb-item-hover); box-shadow: inset 0 0 0 1px var(--glass-border); }
button.sb-row:hover .sb-ic, button.sb-row[aria-expanded="true"] .sb-ic { color: var(--accent); }
button.sb-row.is-off .sb-row-text small { color: var(--warn); }
.sb-row .sb-ic { width: 16px; height: 16px; flex: none; color: var(--muted); }
.sb-row-text { display: grid; min-width: 0; line-height: 1.25; }
.sb-row-text b { font-weight: 600; font-size: var(--fs-sm); }
.sb-row-text small { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-row-text a { font-size: var(--fs-xs); font-weight: 600; }
.sb-row .dot { margin-left: auto; }
.sb-collapse {
  display: flex; align-items: center; gap: 12px; width: 100%; height: 36px; padding: 0 12px; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--faint); font: 500 var(--fs-sm) var(--font); cursor: pointer; white-space: nowrap;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.sb-collapse:hover { color: var(--text); background: var(--sb-item-hover); }
.sb-collapse .sb-ic { width: 18px; height: 18px; flex: none; transition: transform 220ms var(--ease); }

.dot { display: inline-block; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--faint); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg), 0 0 10px color-mix(in srgb, var(--ok) 60%, transparent); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.dot.err { background: var(--err); box-shadow: 0 0 0 3px var(--err-bg); }
.dot.off { background: var(--faint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--faint) 18%, transparent); }
.dot.run { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }

/* collapsed rail (desktop only) */
@media (min-width: 900px) {
  :root[data-sidebar="collapsed"] .sb-head { padding: 0; justify-content: center; }
  :root[data-sidebar="collapsed"] .sb-brand span,
  :root[data-sidebar="collapsed"] .sb-item .sb-text,
  :root[data-sidebar="collapsed"] .sb-collapse .sb-text,
  :root[data-sidebar="collapsed"] .sb-row-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  :root[data-sidebar="collapsed"] .sb-nav { padding: 6px 12px 12px; }
  :root[data-sidebar="collapsed"] .sb-label { height: 1px; padding: 0; margin: 10px 8px; overflow: hidden; color: transparent; background: var(--glass-border); }
  :root[data-sidebar="collapsed"] .sb-section:first-child .sb-label { display: none; }
  :root[data-sidebar="collapsed"] .sb-item { justify-content: center; padding: 0; height: 42px; }
  :root[data-sidebar="collapsed"] .sb-item[aria-current="page"]::before { left: -12px; }
  :root[data-sidebar="collapsed"] .sb-pop { left: calc(100% + 10px); right: auto; bottom: 12px; width: 280px; transform-origin: left bottom; }
  :root[data-sidebar="collapsed"] .sb-badge { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 9.5px; }
  :root[data-sidebar="collapsed"] .sb-badge.is-dot { top: 8px; right: 10px; width: 7px; height: 7px; padding: 0; min-width: 0; }
  :root[data-sidebar="collapsed"] .sb-foot { padding: 12px 8px; }
  :root[data-sidebar="collapsed"] .sb-card { padding: 4px 0; justify-items: center; background: transparent; border-color: transparent; }
  :root[data-sidebar="collapsed"] button.sb-row { width: 40px; height: 40px; padding: 0; justify-content: center; }
  :root[data-sidebar="collapsed"] .sb-row { justify-content: center; position: relative; }
  :root[data-sidebar="collapsed"] .sb-row .dot { position: absolute; right: 5px; top: 7px; width: 7px; height: 7px; margin: 0; }
  :root[data-sidebar="collapsed"] .sb-collapse { justify-content: center; padding: 0; }
  :root[data-sidebar="collapsed"] .sb-collapse .sb-ic { transform: rotate(180deg); }
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 12px; padding: 0 var(--shell-pad);
  background: var(--topbar-bg); border-bottom: 1px solid var(--topbar-border);
  -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%);
}
.topbar-slot { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.topbar-title { margin: 0; font-size: var(--fs-md); font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--fs-sm); color: var(--faint); white-space: nowrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); text-decoration: none; }
.crumbs:not(:has(.crumb-sep)) > * + *::before { content: "/"; margin-right: 8px; color: var(--line-strong); }
.crumbs > :last-child { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.topbar-tools { display: flex; align-items: center; gap: 8px; flex: none; }

.icon-btn-s {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--glass-border); border-radius: var(--radius); background: color-mix(in srgb, var(--surface-2) 60%, transparent);
  color: var(--muted); cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.icon-btn-s:hover { color: var(--text); border-color: var(--accent-ring); background: var(--surface-2); box-shadow: var(--glow-hover); }
.shell-theme svg { transition: transform var(--dur-slow) var(--ease-spring); }
.shell-theme:hover svg { transform: rotate(-18deg) scale(1.08); }
.icon-btn-s svg { width: 18px; height: 18px; }
.shell-burger { display: none; margin-left: -6px; }
.shell-theme .i-moon, :root[data-theme="light"] .shell-theme .i-sun { display: none; }
:root[data-theme="light"] .shell-theme .i-moon { display: block; }

.shell-search { position: relative; display: flex; align-items: center; }
.shell-search .s-ic { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.shell-search input {
  width: 280px; height: 38px; padding: 0 52px 0 36px; border: 1px solid var(--glass-border); border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 60%, transparent); color: var(--text); font: inherit; font-size: var(--fs-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), width 220ms var(--ease), background var(--dur) var(--ease);
}
.shell-search input::placeholder { color: var(--faint); }
.shell-search input:focus { outline: none; width: 340px; border-color: var(--accent); background: var(--surface-2); box-shadow: 0 0 0 3px var(--accent-bg); }
.shell-search input::-webkit-search-cancel-button { display: none; }
.shell-search > kbd {
  position: absolute; right: 8px; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line-strong);
  font: 500 10.5px/1.3 var(--font-mono); color: var(--faint); background: var(--surface-3); pointer-events: none;
}
.shell-search input:focus ~ kbd { opacity: 0; }
.shell-search-btn { display: none; }

.shell-avatar {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: var(--brand-gradient); color: #fff; font: 700 13px/1 var(--font); letter-spacing: .02em;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--glass-border), 0 6px 18px -6px rgba(59, 130, 246, .6);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.shell-avatar:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--accent-ring), 0 8px 22px -6px rgba(59, 130, 246, .75); }
.shell-avatar svg { width: 18px; height: 18px; }
.shell-avatar.is-generic { background: var(--surface-3); color: var(--muted); box-shadow: 0 0 0 1px var(--glass-border); }
.shell-avatar.is-generic:hover { color: var(--text); box-shadow: 0 0 0 1px var(--accent-ring); }

.shell-avatar { padding: 0; border: 0; cursor: pointer; }
.shell-avatar:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.shell-avatar[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--accent); }

/* account menu (avatar) */
.av-wrap { position: relative; flex: none; }
.av-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 210px; padding: 5px;
  display: flex; flex-direction: column; gap: 1px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface-2); box-shadow: 0 18px 40px -14px rgba(0, 0, 0, .7), var(--glass-highlight); transform-origin: top right;
}
:root[data-theme="light"] .av-menu { background: var(--surface-1); box-shadow: 0 16px 36px -14px rgba(15, 21, 32, .3); }
.av-menu[hidden] { display: none; }
.av-item { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--text); font-size: var(--fs-sm); font-weight: 500; }
.av-item svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.av-item:hover, .av-item:focus { outline: none; text-decoration: none; background: var(--accent-bg); }
.av-item:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .av-menu:not([hidden]) { animation: sh-menu-in .14s var(--ease-out, ease-out); }
  @keyframes sh-menu-in { from { opacity: 0; transform: scale(.96) translateY(-3px); } }
}

.sb-backdrop { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  :root { --shell-pad: 24px; }
  .shell-search input { width: 220px; }
  .shell-search input:focus { width: 260px; }
}
@media (max-width: 899.98px) {
  :root { --sb-w: 0px; --shell-pad: 16px; --topbar-h: 56px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 70;
    transform: translateX(-102%); visibility: hidden;
    transition: transform 260ms var(--ease), visibility 0s linear 260ms;
    background: var(--sb-bg), var(--bg); box-shadow: 0 0 0 1px var(--glass-border), 24px 0 60px -20px rgba(0, 0, 0, .6);
  }
  :root[data-drawer="open"] .sidebar { transform: none; visibility: visible; transition: transform 260ms var(--ease), visibility 0s; }
  .sidebar .sb-close { display: grid; }
  .sb-collapse { display: none; }
  .sb-backdrop {
    display: block; position: fixed; inset: 0; z-index: 65; background: rgba(2, 6, 18, .55);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity 260ms var(--ease);
  }
  :root[data-drawer="open"] .sb-backdrop { opacity: 1; pointer-events: auto; }
  :root[data-drawer="open"] body { overflow: hidden; }
  .shell-burger { display: grid; }
  .topbar { gap: 8px; }
  .shell-content { padding-top: 20px; padding-bottom: 40px; }
}
@media (max-width: 640px) {
  .shell-search-btn { display: grid; }
  .shell-search { display: none; }
  .topbar.is-searching .shell-search { display: flex; position: absolute; inset: 8px 12px; z-index: 2; }
  .topbar.is-searching .shell-search input, .topbar.is-searching .shell-search input:focus { width: 100%; height: 40px; background: var(--surface-2); }
  .topbar.is-searching .shell-search > kbd { display: none; }
  .topbar-tools { gap: 6px; }
  .icon-btn-s, .shell-avatar { width: 36px; height: 36px; }
}
/* touch: 44 px hit areas for the topbar and menu controls (visual size unchanged where possible) */
@media (pointer: coarse) {
  .icon-btn-s, .shell-avatar { width: 44px; height: 44px; }
  .topbar-tools { gap: 2px; }
  .av-item, .sb-item, .sb-row, .sb-collapse { min-height: 44px; }
  .toast-close, .toast-action { min-width: 44px; min-height: 44px; }
}

/* ======================================================================
 * Shared page primitives
 * ====================================================================== */

/* page head */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin: 4px 0 24px; }
.page-head-text { min-width: 0; max-width: 760px; }
.page-eyebrow { margin: 0 0 8px; font: 600 var(--fs-xs)/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.page-head h1, .page-title { margin: 0; font-size: var(--fs-xl); line-height: 1.15; letter-spacing: -.028em; font-weight: 700; }
.page-head-text > p:not(.page-eyebrow), .page-sub { margin: 6px 0 0; color: var(--muted); font-size: var(--fs); }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (max-width: 640px) {
  .page-head { margin-bottom: 18px; }
  .page-head h1, .page-title { font-size: 24px; }
}

/* KPI tiles */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi {
  --kpi-c: var(--accent);
  position: relative; overflow: hidden; min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 18px 18px 16px;
  background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  box-shadow: var(--glass-highlight), var(--shadow-1);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.kpi::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--kpi-c) 20%, transparent), transparent 70%); opacity: .8;
}
.kpi:hover { border-color: color-mix(in srgb, var(--kpi-c) 35%, var(--glass-border)); }
.kpi.is-ok { --kpi-c: var(--ok); }
.kpi.is-warn { --kpi-c: var(--warn); }
.kpi.is-err { --kpi-c: var(--err); }
.kpi.is-accent { --kpi-c: var(--brand-2); }
.kpi-label { position: relative; font: 600 var(--fs-xs)/1.3 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-right: 44px; }
.kpi-icon {
  position: absolute; top: 14px; right: 14px; z-index: 1; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px;
  color: var(--kpi-c); background: color-mix(in srgb, var(--kpi-c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--kpi-c) 25%, transparent);
}
.kpi-icon svg { width: 18px; height: 18px; }
.kpi-value { position: relative; font-size: 30px; line-height: 1.1; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--text); }
.kpi.is-ok .kpi-value, .kpi.is-warn .kpi-value, .kpi.is-err .kpi-value { color: var(--kpi-c); }
.kpi-value small { font-size: .55em; font-weight: 600; color: var(--muted); margin-left: 2px; letter-spacing: 0; }
.kpi-foot { position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; font-size: var(--fs-xs); color: var(--faint); min-height: 20px; }
.kpi-sub { color: var(--faint); }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: var(--radius-pill); font: 600 11px/1.4 var(--font-mono); color: var(--muted); background: var(--surface-3); }
.delta.up { color: var(--ok-ink, var(--ok)); background: var(--ok-bg); }
.delta.up::before { content: "↑"; }
.delta.down { color: var(--err); background: var(--err-bg); }
.delta.down::before { content: "↓"; }
.kpi-spark { position: relative; margin-top: 6px; height: 36px; }
.kpi-spark svg { display: block; width: 100%; height: 100%; overflow: visible; }
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px 14px 12px; }
  .kpi-value { font-size: 24px; }
  .kpi-icon { width: 30px; height: 30px; top: 10px; right: 10px; }
  .kpi-icon svg { width: 15px; height: 15px; }
  .kpi-label { padding-right: 34px; }
}

/* panel (glass card with header) */
.panel {
  min-width: 0; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  box-shadow: var(--glass-highlight), var(--shadow-1);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; padding: 16px 20px; border-bottom: 1px solid var(--glass-border); }
.panel-head > div:first-child { min-width: 0; }
.panel-title { margin: 0; font-size: var(--fs-md); font-weight: 600; letter-spacing: -.01em; }
.panel-sub { margin: 2px 0 0; font-size: var(--fs-sm); color: var(--muted); }
.panel-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.panel-body { padding: 20px; }
.panel-body.flush { padding: 0; }
@media (max-width: 640px) {
  .panel-head { padding: 14px 16px; }
  .panel-body { padding: 16px; }
}

/* segmented control */
.segmented { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: var(--radius); background: color-mix(in srgb, var(--surface-2) 70%, transparent); border: 1px solid var(--glass-border); }
.segmented > button, .segmented > a {
  height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted);
  font: 500 var(--fs-sm) var(--font); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.segmented > :hover { color: var(--text); text-decoration: none; }
.segmented > [aria-pressed="true"], .segmented > [aria-selected="true"], .segmented > .is-active {
  color: var(--text); background: var(--surface-3); box-shadow: 0 1px 2px rgba(0, 0, 0, .25), inset 0 0 0 1px var(--line-strong);
}

/* empty state */
.empty-state { display: grid; justify-items: center; gap: 6px; padding: 48px 24px; text-align: center; color: var(--muted);
  border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--surface-1) 40%, transparent); }
.empty-state .empty-icon { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 6px; border-radius: 14px;
  color: var(--accent); background: var(--accent-bg); border: 1px solid color-mix(in srgb, var(--accent-ring) 50%, transparent); }
.empty-state .empty-icon svg { width: 22px; height: 22px; }
.empty-state h3 { margin: 0; color: var(--text); font-size: var(--fs-md); font-weight: 600; }
.empty-state p { margin: 0; max-width: 46ch; font-size: var(--fs-sm); }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }

/* ======================================================================
 * Shell components: footer popovers, recent searches, toasts
 * ====================================================================== */

/* sidebar footer popover (IA local / Currículo) */
.sb-pop {
  position: absolute; left: 12px; right: 12px; bottom: calc(100% - 4px); z-index: 5;
  display: grid; gap: 10px; padding: 14px; border-radius: var(--radius-lg);
  background: var(--pop-bg); box-shadow: var(--pop-shadow); color: var(--text); font-size: var(--fs-sm);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  transform-origin: center bottom; animation: sh-pop-in var(--dur-slow) var(--ease-out) both;
}
.sb-pop:focus { outline: none; }
.sb-pop-head { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.sb-pop-head .dot { margin: 0; }
.sb-pop p { margin: 0; color: var(--muted); line-height: 1.45; }
.sb-pop code { padding: 1px 5px; border-radius: 5px; background: var(--surface-3); color: var(--text); font-size: .9em; overflow-wrap: anywhere; }
.sb-pop-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sb-pop-actions .btn { flex: 1 1 auto; }
.sb-pop .sb-pop-note { font-size: var(--fs-xs); color: var(--faint); min-height: 1.2em; }
.sb-pop .sb-pop-note:empty { display: none; }
.btn .spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: sh-spin .7s linear infinite; }

/* topbar search: recent searches */
.search-pop {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50; min-width: 240px;
  padding: 6px; border-radius: var(--radius); background: var(--pop-bg); box-shadow: var(--pop-shadow);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  animation: sh-drop-in var(--dur) var(--ease-out) both;
}
.search-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px 6px; font: 600 10.5px/1.2 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.search-pop-head button { padding: 2px 6px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font: 500 var(--fs-xs) var(--font); letter-spacing: 0; text-transform: none; cursor: pointer; }
.search-pop-head button:hover { color: var(--text); background: var(--sb-item-hover); }
.search-pop ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.search-pop li {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--text); font-size: var(--fs-sm); cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.search-pop li svg { width: 15px; height: 15px; flex: none; color: var(--faint); }
.search-pop li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-pop li:hover, .search-pop li[aria-selected="true"] { background: var(--accent-bg); }
.search-pop li[aria-selected="true"] { box-shadow: inset 2px 0 0 var(--accent); }
.search-pop li[aria-selected="true"] svg { color: var(--accent); }
.search-pop kbd { font: 500 10px/1.3 var(--font-mono); color: var(--faint); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line-strong); }
.search-pop li:not([aria-selected="true"]) kbd { visibility: hidden; }

/* toasts */
.toast-region {
  position: fixed; z-index: 90; right: 20px; bottom: 20px; width: min(380px, calc(100vw - 32px));
  display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; pointer-events: none;
}
.toast {
  --t-c: var(--accent);
  position: relative; overflow: hidden; pointer-events: auto;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 10px;
  padding: 12px 10px 14px 14px; border-radius: var(--radius-lg);
  background: var(--pop-bg); color: var(--text); font-size: var(--fs-sm); line-height: 1.45;
  box-shadow: var(--pop-shadow), 0 0 0 1px color-mix(in srgb, var(--t-c) 22%, transparent), 0 10px 40px -18px color-mix(in srgb, var(--t-c) 70%, transparent);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  animation: sh-toast-in var(--dur-enter) var(--ease-out) both;
}
.toast.is-ok { --t-c: var(--ok); }
.toast.is-err { --t-c: var(--err); }
.toast.is-warn { --t-c: var(--warn); }
.toast.is-leaving { animation: sh-toast-out 220ms var(--ease-in) both; }
.toast-ic { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; color: var(--t-c); background: color-mix(in srgb, var(--t-c) 15%, transparent); }
.toast-ic svg { width: 16px; height: 16px; }
.toast-msg { margin: 3px 0 0; min-width: 0; overflow-wrap: anywhere; }
.toast-side { display: flex; align-items: center; gap: 4px; }
.toast-action {
  padding: 4px 10px; border: 1px solid color-mix(in srgb, var(--t-c) 40%, transparent); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--t-c) 12%, transparent); color: var(--t-c); font: 600 var(--fs-xs) var(--font); cursor: pointer; white-space: nowrap;
  transition: background var(--dur) var(--ease);
}
.toast-action:hover { background: color-mix(in srgb, var(--t-c) 22%, transparent); }
.toast-close { width: 26px; height: 26px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--faint); cursor: pointer; }
.toast-close:hover { color: var(--text); background: var(--sb-item-hover); }
.toast-close svg { width: 15px; height: 15px; }
.toast-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: color-mix(in srgb, var(--t-c) 15%, transparent); }
.toast-bar i { display: block; height: 100%; background: var(--t-c); transform-origin: left; animation: sh-toast-bar var(--toast-t, 3500ms) linear both; }
.toast.is-paused .toast-bar i { animation-play-state: paused; }
@media (max-width: 640px) {
  .toast-region { left: 16px; right: 16px; bottom: 16px; width: auto; max-width: 420px; margin: 0 auto; }
}

/* ======================================================================
 * Motion: page enter, view transitions, utilities
 * ====================================================================== */
@keyframes sh-enter { from { opacity: 0; transform: translateY(var(--enter-y)); } }
@keyframes sh-pop-in { from { opacity: 0; transform: translateY(6px) scale(.97); } }
@keyframes sh-drop-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes sh-toast-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes sh-toast-out { to { opacity: 0; transform: translateX(24px) scale(.97); } }
@keyframes sh-toast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes sh-spin { to { transform: rotate(360deg); } }
@keyframes sh-shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
@keyframes sh-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 8px transparent; } }
@keyframes sh-pop { 40% { transform: scale(1.22); } }

/* the sidebar/topbar stay put during a cross-page view transition; only the content fades */
.topbar { view-transition-name: shell-topbar; }
@media (min-width: 900px) { .sidebar { view-transition-name: shell-sidebar; } }

@media (prefers-reduced-motion: no-preference) {
  /* page enter (fallback when the browser did not run a view transition; shell.js sets data-vt) */
  :root:not([data-vt]) .shell-content > :not(dialog) { animation: sh-enter var(--dur-enter) var(--ease-out) backwards; }
  :root:not([data-vt]) .shell-content > :nth-child(2) { animation-delay: 40ms; }
  :root:not([data-vt]) .shell-content > :nth-child(3) { animation-delay: 80ms; }
  :root:not([data-vt]) .shell-content > :nth-child(n+4) { animation-delay: 120ms; }

  /* .reveal: hidden until shell.js marks it .is-in (only when the script runs: html.motion) */
  .motion .reveal:not(.is-in) { opacity: 0; transform: translateY(var(--enter-y)); }
  .motion .reveal {
    transition: opacity var(--dur-enter) var(--ease-out), transform var(--dur-enter) var(--ease-out);
    transition-delay: calc(min(var(--i, 0), 12) * var(--stagger));
  }
  .pulse { animation: sh-pulse 1.8s var(--ease-out) infinite; }
  .dot.pulse { color: var(--accent); }
  .pop { animation: sh-pop 420ms var(--ease-spring); }

  .kpi:hover { transform: translateY(-2px); box-shadow: var(--glass-highlight), 0 14px 34px -18px color-mix(in srgb, var(--kpi-c) 70%, transparent); }
}
.kpi { transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur-slow) var(--ease); }
.panel { transition: border-color var(--dur) var(--ease); }
.panel:hover { border-color: color-mix(in srgb, var(--accent-ring) 30%, var(--glass-border)); }
.count-up { font-variant-numeric: tabular-nums; }

/* .shimmer skeleton */
.shimmer {
  display: block; min-height: 1em; border-radius: var(--radius-sm); color: transparent !important; user-select: none; pointer-events: none;
  background: linear-gradient(100deg, var(--surface-2) 30%, color-mix(in srgb, var(--surface-3) 70%, var(--text) 6%) 50%, var(--surface-2) 70%);
  background-size: 250% 100%; animation: sh-shimmer 1.4s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .shimmer { animation: none; background: var(--surface-2); }
}

/* ======================================================================
 * Account (hosted mode): login button, avatar plan badge, lock on items,
 * modal dialogs (paywall / login / consent) — see Shell.handlePaywall
 * ====================================================================== */
.sb-lock { display: inline-grid; place-items: center; width: 22px; height: 20px; margin-left: auto; color: var(--faint); flex: none; }
.sb-lock svg { width: 14px; height: 14px; }
.sb-item:hover .sb-lock { color: var(--accent); }
@media (min-width: 900px) {
  :root[data-sidebar="collapsed"] .sb-lock { position: absolute; right: 4px; top: 4px; width: 14px; height: 14px; margin: 0; }
  :root[data-sidebar="collapsed"] .sb-lock svg { width: 11px; height: 11px; }
}
.shell-login { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; min-height: 36px; padding: 0 14px; }
.shell-login svg { width: 16px; height: 16px; flex: none; }
.shell-login[hidden], .av-wrap[hidden] { display: none; }
.av-pro {
  position: absolute; right: -6px; bottom: -4px; padding: 1px 5px; border-radius: var(--radius-pill); pointer-events: none;
  font: 700 9px/1.3 var(--font-mono); letter-spacing: .06em; color: #fff; background: var(--brand-gradient);
  box-shadow: 0 0 0 2px var(--bg);
}
.av-pro[hidden] { display: none; }
.av-list { display: flex; flex-direction: column; gap: 1px; }
.av-head { display: grid; gap: 2px; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); min-width: 0; }
.av-head b { font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.av-head small { color: var(--muted); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.av-plan { justify-self: start; margin-top: 4px; padding: 2px 8px; border-radius: var(--radius-pill); font: 600 11px/1.4 var(--font-mono); color: var(--muted); background: var(--surface-3); }
.av-plan.is-pro { color: var(--accent); background: var(--accent-bg); }
.av-sep { height: 1px; margin: 4px 6px; background: var(--line); }
button.av-item { width: 100%; border: 0; background: transparent; font: inherit; font-size: var(--fs-sm); font-weight: 500; text-align: left; cursor: pointer; }
@media (max-width: 640px) {
  .shell-login { padding: 0 10px; }
}

.sh-dialog {
  width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; overflow: auto;
  border: 1px solid var(--glass-border); border-radius: var(--radius-lg); color: var(--text);
  background: var(--pop-bg); box-shadow: var(--pop-shadow), var(--glass-highlight);
}
.sh-dialog::backdrop { background: rgba(2, 6, 18, .62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
:root[data-theme="light"] .sh-dialog::backdrop { background: rgba(15, 21, 32, .35); }
.sh-dialog-in { position: relative; padding: 26px 24px 22px; display: grid; gap: 12px; }
.sh-dialog-x { position: absolute; top: 10px; right: 10px; }
.sh-dialog-ic { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; color: var(--accent); background: var(--accent-bg); box-shadow: inset 0 0 0 1px var(--accent-ring); }
.sh-dialog-ic.is-brand { color: #fff; background: var(--brand-gradient); box-shadow: var(--glow); }
.sh-dialog-ic svg { width: 22px; height: 22px; }
.sh-dialog h2 { margin: 2px 40px 0 0; font-size: var(--fs-lg); line-height: 1.25; letter-spacing: -.015em; }
.sh-dialog-text { margin: 0; color: var(--muted); font-size: var(--fs); line-height: 1.55; }
.sh-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.sh-dialog-actions .btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; }
.sh-dialog-actions .btn svg { width: 16px; height: 16px; }
.sh-dialog-err { margin: 4px 0 0; color: var(--err); font-size: var(--fs-sm); }
.sh-dialog-err:empty { display: none; }
.sh-usage { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-3); border: 1px solid var(--line); }
.sh-usage-row { display: flex; justify-content: space-between; gap: 12px; font-size: var(--fs-sm); color: var(--muted); }
.sh-usage-row b { color: var(--text); font-family: var(--font-mono); font-weight: 600; }
.sh-meter { height: 8px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--line-strong) 70%, transparent); overflow: hidden; }
.sh-meter i { display: block; height: 100%; border-radius: inherit; background: var(--brand-gradient); }
.sh-check { display: flex; gap: 10px; align-items: flex-start; font-size: var(--fs-sm); line-height: 1.5; cursor: pointer; }
.sh-check input { margin-top: 3px; width: 18px; height: 18px; flex: none; accent-color: var(--accent-strong); }
@media (prefers-reduced-motion: no-preference) {
  .sh-dialog[open] { animation: sh-dialog-in var(--dur-slow) var(--ease-out); }
  @keyframes sh-dialog-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
}
@media (max-width: 480px) {
  .sh-dialog-in { padding: 22px 18px 18px; }
  .sh-dialog-actions .btn { flex: 1 1 auto; justify-content: center; }
}
.shell-avatar[data-ini]::before { content: attr(data-ini); }
/* copy that depends on the mode (html[data-mode] is set by shell.js from /api/auth/me) */
:root[data-mode="hosted"] .only-local { display: none !important; }
:root:not([data-mode="hosted"]) .only-hosted { display: none !important; }
