/* VICEWAR'S — componentes reutilizáveis. Usar só tokens semânticos de tokens.css. */

/* ---------- Ícone (sprite Lucide) ---------- */
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: inline-block; vertical-align: middle; }
.icon-sm { width: 16px; height: 16px; } .icon-lg { width: 24px; height: 24px; } .icon-xl { width: 32px; height: 32px; }
.icon-spin { animation: vw-spin 900ms linear infinite; }
@keyframes vw-spin { to { transform: rotate(360deg); } }

/* ---------- Logótipo ---------- */
.logo { height: 48px; width: auto; }
.logo-lg { height: clamp(96px, 14vw, 180px); filter: drop-shadow(0 8px 30px rgba(255, 0, 110, .35)); }
.logo-icon { width: 40px; height: 40px; display: none; }

/* ---------- Botões ---------- */
.btn {
  --btn-bg: var(--color-surface-2); --btn-fg: var(--color-text); --btn-border: var(--color-line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 42px; padding: 0 var(--space-5); border-radius: var(--radius-md); border: 1px solid var(--btn-border);
  background: var(--btn-bg); color: var(--btn-fg); cursor: pointer; text-decoration: none; white-space: nowrap;
  font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-md); letter-spacing: var(--tracking-ui); text-transform: uppercase;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur) var(--ease-out), background var(--dur), border-color var(--dur), color var(--dur);
  font-variant-numeric: tabular-nums;
}
.btn:hover:not(:disabled):not([aria-disabled="true"]) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-primary { --btn-bg: var(--grad-neon); --btn-fg: #fff; --btn-border: transparent; background: var(--grad-neon); box-shadow: 0 6px 20px rgba(255, 0, 110, .28); }
.btn-primary:hover:not(:disabled) { background: var(--grad-neon-hover); box-shadow: var(--glow-pink); }
.btn-secondary { --btn-bg: transparent; --btn-border: var(--color-primary); --btn-fg: var(--color-text); }
.btn-secondary:hover:not(:disabled) { --btn-bg: rgba(255, 0, 110, .12); box-shadow: var(--glow-pink); }
.btn-ghost { --btn-bg: transparent; --btn-border: var(--color-line-strong); --btn-fg: var(--color-text-2); }
.btn-ghost:hover:not(:disabled) { --btn-fg: var(--color-text); --btn-border: var(--color-text-3); }
.btn-danger { --btn-bg: rgba(255, 59, 92, .14); --btn-border: rgba(255, 59, 92, .6); --btn-fg: #FFD6DE; }
.btn-danger:hover:not(:disabled) { --btn-bg: rgba(255, 59, 92, .26); }
.btn-police { --btn-bg: rgba(0, 229, 255, .10); --btn-border: rgba(0, 229, 255, .6); --btn-fg: #D6FAFF; }
.btn-police:hover:not(:disabled) { box-shadow: var(--glow-cyan); }
.btn-sm { min-height: 34px; padding: 0 var(--space-3); font-size: var(--fs-sm); border-radius: var(--radius-sm); }
.btn-lg { min-height: 52px; padding: 0 var(--space-7); font-size: var(--fs-lg); }
.btn-block { width: 100%; }
.btn-icon { padding: 0; width: 42px; }
.btn[data-loading="true"] { pointer-events: none; }
.btn-timer { font-family: var(--font-body); font-weight: 600; letter-spacing: .02em; }

/* ---------- Cartões e painéis ---------- */
.card {
  position: relative; background: linear-gradient(180deg, var(--color-surface-2), var(--color-surface)); border: 1px solid var(--color-line);
  border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-1); min-width: 0;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.card-interactive:hover { border-color: var(--color-line-strong); box-shadow: var(--shadow-2); }
.card-highlight { background: var(--grad-card-highlight), linear-gradient(180deg, var(--color-surface-2), var(--color-surface)); border-color: rgba(255, 0, 110, .45); box-shadow: var(--glow-pink); }
.card-police { border-color: rgba(0, 229, 255, .4); }
.card-crime { border-color: rgba(255, 0, 110, .4); }
.card-locked { opacity: .55; }
.card-locked::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: repeating-linear-gradient(135deg, transparent 0 10px, rgba(255, 255, 255, .02) 10px 20px); pointer-events: none; }
.card-media { margin: calc(var(--space-5) * -1) calc(var(--space-5) * -1) var(--space-4); height: 120px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; overflow: hidden; background: var(--grad-sunset); }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-title { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-xl); text-transform: uppercase; line-height: 1.1; margin-bottom: var(--space-2); }
.card-text { color: var(--color-text-2); font-size: var(--fs-sm); }
.card-foot { margin-top: var(--space-4); display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.panel { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-lg); min-width: 0; box-shadow: var(--shadow-1); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--color-line); }
.panel-head h2 { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-xl); text-transform: uppercase; letter-spacing: .01em; }
.panel-body { padding: var(--space-4) var(--space-5); }

/* ---------- Distintivos (carreira, estado) e etiquetas ---------- */
.badge {
  --badge-c: var(--color-text-2);
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-pill);
  border: 1px solid color-mix(in srgb, var(--badge-c) 55%, transparent); background: color-mix(in srgb, var(--badge-c) 12%, transparent); color: var(--badge-c);
  font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
}
.badge .icon { width: 14px; height: 14px; }
.badge-civil { --badge-c: var(--color-civil); } .badge-police { --badge-c: var(--color-police); } .badge-crime { --badge-c: var(--color-crime); }
.badge-jail { --badge-c: var(--color-jail); } .badge-fired { --badge-c: var(--vw-orange); } .badge-success { --badge-c: var(--color-success); }
.badge-info { --badge-c: var(--vw-blue); } .badge-vip { --badge-c: var(--vw-yellow); } .badge-soon { --badge-c: var(--color-text-3); }

/* ---------- HUD e StatChip ---------- */
.hud { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; justify-content: flex-end; }
.stat-chip { display: inline-flex; align-items: center; gap: var(--space-2); padding: 6px 12px 6px 10px; border-radius: var(--radius-md); background: var(--color-surface); border: 1px solid var(--color-line); line-height: 1.15; min-width: 0; }
.stat-chip .icon { color: var(--chip-c, var(--color-text-3)); width: 18px; height: 18px; }
.stat-chip .stat-label { display: block; font-family: var(--font-ui); font-size: 10px; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--color-text-3); }
.stat-chip .stat-value { display: block; font-weight: 700; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; color: var(--chip-c, var(--color-text)); white-space: nowrap; }
.stat-chip.legal { --chip-c: var(--color-legal); } .stat-chip.illicit { --chip-c: var(--color-illicit); } .stat-chip.energy { --chip-c: var(--color-success); }
.stat-chip.location { --chip-c: var(--color-police); } .stat-chip.wanted { --chip-c: var(--color-crime); }
.stars { display: inline-flex; gap: 2px; }
.stars .icon { width: 14px; height: 14px; color: var(--color-line-strong); }
.stars .icon.on { color: var(--vw-yellow); fill: var(--vw-yellow); filter: drop-shadow(0 0 4px rgba(255, 196, 0, .6)); }
.stat-tile { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); }
.stat-tile .stat-label { font-family: var(--font-ui); font-size: var(--fs-xs); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--color-text-3); display: flex; align-items: center; gap: 6px; }
.stat-tile .stat-value { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-2xl); font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat-tile .stat-note { font-size: var(--fs-xs); color: var(--color-text-3); }

/* ---------- Barras de progresso ---------- */
.progress { --p: 0%; --bar: var(--grad-neon-hover); position: relative; height: 8px; border-radius: var(--radius-pill); background: var(--color-bg); border: 1px solid var(--color-line); overflow: hidden; }
.progress > span { display: block; height: 100%; width: var(--p); background: var(--bar); border-radius: inherit; transition: width var(--dur-slow) var(--ease-out); }
.progress-energy { --bar: linear-gradient(90deg, var(--vw-green), var(--vw-cyan)); }
.progress-xp { --bar: linear-gradient(90deg, var(--vw-blue), var(--vw-purple)); }
.progress-heat { --bar: linear-gradient(90deg, var(--vw-yellow), var(--vw-orange), var(--vw-pink)); }
.progress-skill { --bar: var(--grad-sunset); }
.progress-lg { height: 12px; }
.progress-segmented > span { -webkit-mask: repeating-linear-gradient(90deg, #000 0 calc(10% - 2px), transparent calc(10% - 2px) 10%); mask: repeating-linear-gradient(90deg, #000 0 calc(10% - 2px), transparent calc(10% - 2px) 10%); }
.progress-label { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--color-text-3); margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.progress-label strong { color: var(--color-text); font-weight: 600; }

/* ---------- Indicador de segurança ---------- */
.security { --v: 50; --c: var(--security-mid); display: inline-flex; flex-direction: column; gap: 6px; min-width: 140px; }
.security-value { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-2xl); line-height: 1; color: var(--c); text-shadow: 0 0 18px color-mix(in srgb, var(--c) 50%, transparent); font-variant-numeric: tabular-nums; }
.security-track { position: relative; height: 8px; border-radius: var(--radius-pill); background: var(--grad-security); opacity: .9; }
.security-track::after { content: ""; position: absolute; top: 50%; left: calc(var(--v) * 1%); width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--c); transform: translate(-50%, -50%); box-shadow: 0 0 10px var(--c); }
.security-caption { font-size: var(--fs-xs); color: var(--color-text-3); }
.security-ring { --v: 50; --c: var(--security-mid); width: 112px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(closest-side, var(--color-surface) 78%, transparent 79% 100%), conic-gradient(var(--c) calc(var(--v) * 1%), var(--color-line) 0); }
.security-ring .security-value { font-size: var(--fs-xl); }

/* ---------- Estado do território ---------- */
.territory { display: grid; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-md); background: var(--color-bg); border: 1px solid var(--color-line); }
.territory-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); font-size: var(--fs-sm); }
.territory-row > span { color: var(--color-text-3); display: inline-flex; align-items: center; gap: 6px; }
.territory-state { --c: var(--color-text-3); display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--c); }
.territory-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.territory-state.safe { --c: var(--security-high); } .territory-state.tense { --c: var(--security-mid); } .territory-state.danger { --c: var(--security-low); }
.territory-state.neutral { --c: var(--color-text-3); } .territory-state.contested { --c: var(--vw-orange); }

/* ---------- Separadores / controlo segmentado ---------- */
.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-md); background: var(--color-bg); border: 1px solid var(--color-line); max-width: 100%; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 0; border-radius: var(--radius-sm); background: transparent; cursor: pointer; white-space: nowrap;
  font-family: var(--font-ui); font-weight: 500; font-size: var(--fs-sm); letter-spacing: .05em; text-transform: uppercase; color: var(--color-text-3); transition: color var(--dur), background var(--dur); }
.tab:hover { color: var(--color-text); }
.tab[aria-selected="true"] { background: var(--color-surface-2); color: var(--color-text); box-shadow: inset 0 -2px 0 var(--color-primary); }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--color-line); border-radius: var(--radius-md); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { position: sticky; top: 0; background: var(--color-surface-2); text-align: left; font-family: var(--font-ui); font-weight: 500; font-size: var(--fs-xs); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--color-text-3); padding: 10px 14px; border-bottom: 1px solid var(--color-line); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--color-line); color: var(--color-text-2); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(255, 255, 255, .02); }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--color-text); }
.pos { color: var(--color-success); } .neg { color: var(--vw-pink-light); }
@media (max-width: 640px) {
  .table-stack thead { display: none; }
  .table-stack tr { display: grid; gap: 2px; padding: 10px 14px; border-bottom: 1px solid var(--color-line); }
  .table-stack td { padding: 0; border: 0; display: flex; justify-content: space-between; gap: var(--space-3); }
  .table-stack td::before { content: attr(data-label); color: var(--color-text-3); font-size: var(--fs-xs); }
}
/* lista de detalhes (pares rótulo/valor) */
.dl { display: grid; }
.dl > div { display: flex; justify-content: space-between; gap: var(--space-3); padding: 9px 0; border-bottom: 1px solid var(--color-line); font-size: var(--fs-sm); }
.dl > div:last-child { border-bottom: 0; }
.dl dt { color: var(--color-text-3); } .dl dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Notificações (toast) ---------- */
.toast-region { position: fixed; right: var(--space-5); bottom: var(--space-5); z-index: var(--z-toast); display: grid; gap: var(--space-2); width: min(420px, calc(100vw - 2 * var(--space-4))); pointer-events: none; }
.toast { --c: var(--color-info); pointer-events: auto; display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-surface-2) 92%, var(--c)); border: 1px solid color-mix(in srgb, var(--c) 60%, transparent); box-shadow: var(--shadow-2), 0 0 24px color-mix(in srgb, var(--c) 22%, transparent);
  animation: vw-toast-in var(--dur-slow) var(--ease-out); font-size: var(--fs-sm); }
.toast .icon { color: var(--c); margin-top: 1px; }
.toast-title { font-weight: 700; display: block; }
.toast-success { --c: var(--color-success); } .toast-error { --c: var(--color-danger); } .toast-crime { --c: var(--color-crime); } .toast-police { --c: var(--color-police); }
.toast-close { margin-left: auto; background: none; border: 0; color: var(--color-text-3); cursor: pointer; padding: 2px; border-radius: var(--radius-sm); }
@keyframes vw-toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@media (max-width: 640px) { .toast-region { right: var(--space-3); bottom: calc(var(--bottomnav-h) + var(--space-3)); } }

/* ---------- Modal / diálogo de confirmação ---------- */
.modal { border: 1px solid var(--color-line-strong); border-radius: var(--radius-xl); padding: 0; width: min(480px, calc(100vw - 32px)); background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-2), var(--glow-purple); }
.modal::backdrop { background: rgba(5, 5, 10, .72); backdrop-filter: blur(4px); }
.modal[open] { animation: vw-modal-in var(--dur-slow) var(--ease-out); }
.modal-head { padding: var(--space-5) var(--space-6) 0; }
.modal-body { padding: var(--space-3) var(--space-6) var(--space-5); color: var(--color-text-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-4) var(--space-6); border-top: 1px solid var(--color-line); flex-wrap: wrap; }
@keyframes vw-modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* ---------- Formulários ---------- */
.field { display: grid; gap: 6px; }
.field-label { font-family: var(--font-ui); font-weight: 500; font-size: var(--fs-xs); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--color-text-2); }
.field-hint { font-size: var(--fs-xs); color: var(--color-text-3); }
.field-error { font-size: var(--fs-xs); color: var(--vw-pink-light); min-height: 1em; }
.input, .select { width: 100%; min-height: 44px; padding: 0 var(--space-4); border-radius: var(--radius-md); border: 1px solid var(--color-line-strong); background: var(--color-bg); color: var(--color-text); transition: border-color var(--dur), box-shadow var(--dur); }
.input::placeholder { color: var(--color-text-3); }
.input:hover, .select:hover { border-color: var(--color-text-3); }
.input:focus-visible, .select:focus-visible { border-color: var(--color-focus); box-shadow: var(--ring-focus); border-radius: var(--radius-md); }
.input[aria-invalid="true"] { border-color: var(--color-danger); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--color-text-3) 50%), linear-gradient(135deg, var(--color-text-3) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 40px; }
.stepper { justify-self: start; display: inline-flex; align-items: stretch; border: 1px solid var(--color-line-strong); border-radius: var(--radius-md); overflow: hidden; background: var(--color-bg); }
.stepper button { width: 38px; border: 0; background: var(--color-surface-2); cursor: pointer; color: var(--color-text-2); display: grid; place-items: center; }
.stepper button:hover { color: var(--color-primary); }
.stepper input { width: 64px; border: 0; background: transparent; text-align: center; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.toggle { display: inline-flex; align-items: center; gap: var(--space-3); cursor: pointer; font-size: var(--fs-sm); }
.toggle input { appearance: none; width: 44px; height: 24px; border-radius: var(--radius-pill); background: var(--color-card); border: 1px solid var(--color-line-strong); position: relative; cursor: pointer; transition: background var(--dur); margin: 0; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--color-text-2); transition: transform var(--dur) var(--ease-out), background var(--dur); }
.toggle input:checked { background: var(--color-primary-strong); border-color: var(--color-primary); }
.toggle input:checked::after { transform: translateX(20px); background: #fff; }
.toggle input:focus-visible { box-shadow: var(--ring-focus); }
.check { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; font-size: var(--fs-sm); }
.check input { appearance: none; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--color-line-strong); background: var(--color-bg); display: grid; place-items: center; margin: 0; cursor: pointer; }
.check input:checked { background: var(--color-primary-strong); border-color: var(--color-primary); }
.check input:checked::after { content: ""; width: 10px; height: 6px; border: solid #fff; border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg); }
.check input:focus-visible { box-shadow: var(--ring-focus); }

/* ---------- Estados: vazio, a carregar, erro ---------- */
.state { display: grid; justify-items: center; text-align: center; gap: var(--space-2); padding: var(--space-7) var(--space-5); color: var(--color-text-3); }
.state > .icon { width: 36px; height: 36px; color: var(--color-line-strong); }
.state-title { color: var(--color-text); font-weight: 700; }
.state-error > .icon { color: var(--color-danger); }
.skeleton { border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--color-surface-2) 25%, var(--color-card) 50%, var(--color-surface-2) 75%); background-size: 200% 100%; animation: vw-shimmer 1.4s infinite linear; min-height: 14px; }
@keyframes vw-shimmer { to { background-position: -200% 0; } }

/* ---------- Feed (notícias da cidade) ---------- */
.feed { display: grid; }
.feed-item { display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-3); align-items: start; padding: var(--space-3) 0; border-bottom: 1px solid var(--color-line); font-size: var(--fs-sm); }
.feed-item:last-child { border-bottom: 0; }
.feed-dot { --c: var(--color-info); width: 32px; height: 32px; border-radius: var(--radius-sm); display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.feed-dot.crime { --c: var(--color-crime); } .feed-dot.police { --c: var(--color-police); } .feed-dot.money { --c: var(--color-legal); }
.feed-time { color: var(--color-text-3); font-size: var(--fs-xs); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Hero / cenas ---------- */
.hero { position: relative; overflow: hidden; border-radius: var(--radius-xl); border: 1px solid rgba(255, 0, 110, .35); min-height: 280px; isolation: isolate; }
.hero-scene { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(11, 11, 15, .92) 0%, rgba(11, 11, 15, .55) 55%, rgba(11, 11, 15, .1) 100%); }
.hero-body { padding: var(--space-8) var(--space-7); max-width: 640px; }
.scene-strip { height: 120px; background: url(/assets/scenes/skyline.svg) bottom / cover no-repeat; border-radius: var(--radius-lg); }

/* divisor com o traço curvo da marca */
.swoosh { height: 10px; border-radius: 50%; background: var(--color-primary); transform: skewX(-12deg); box-shadow: 0 0 18px rgba(255, 0, 110, .5); width: 140px; }
