/* ==========================================================================
   RUKIA F10 — base.css
   --------------------------------------------------------------------------
   Camada base da blindagem modular do frontend.

   Responsabilidade:
   - Tokens globais light/dark
   - Reset estrutural
   - Body/base document
   - Acessibilidade mínima
   - Helpers utilitários globais
   - Preferência de redução de movimento

   NÃO contém:
   - Login CP-01
   - Cliente Público
   - Grid operacional
   - KPIs
   - Modal
   - Importação
   - Toast
   - Mobile Cliente Público

   Ordem recomendada no index.html:
   <link rel="stylesheet" href="./css/base.css" />
   <link rel="stylesheet" href="./css/styles.css" />
   <link rel="stylesheet" href="./css/styles.cliente-publico-mobile.css" />
   ========================================================================== */

/* ==========================================================================
   Tokens globais — Light
   ========================================================================== */

:root {
  color-scheme: light;

  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --bg-page: #f7f9fc;
  --bg-page-soft: #eef2f8;
  --bg-shell: rgba(255, 255, 255, 0.84);
  --bg-surface: #ffffff;
  --bg-surface-soft: #f8fafc;
  --bg-surface-raised: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #f1f5f9;

  --text-strong: #0f172a;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-soft: #94a3b8;
  --text-inverted: #ffffff;

  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-focus: #4f46e5;

  --brand: #4f46e5;
  --brand-strong: #4338ca;
  --brand-soft: #eef2ff;
  --brand-glow: rgba(79, 70, 229, 0.22);

  --system-purple: #6d28d9;
  --system-purple-soft: #f3e8ff;

  --success: #22c55e;
  --success-soft: #dcfce7;
  --success-text: #166534;

  --warning: #f59e0b;
  --warning-soft: #fef3c7;
  --warning-text: #92400e;

  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --danger-text: #991b1b;

  --info: #3b82f6;
  --info-soft: #dbeafe;
  --info-text: #1e40af;

  --neutral: #64748b;
  --neutral-soft: #f1f5f9;
  --neutral-text: #334155;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 18px 48px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 26px 70px rgba(15, 23, 42, 0.18);

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  --container-max: 1920px;
  --header-height: 58px;
  --footer-height: 38px;

  --transition-fast: 140ms ease;
  --transition-base: 220ms ease;
}

/* ==========================================================================
   Tokens globais — Dark
   ========================================================================== */

html[data-theme="dark"] {
  color-scheme: dark;

  --bg-page: #020617;
  --bg-page-soft: #050816;
  --bg-shell: rgba(3, 7, 18, 0.88);
  --bg-surface: #0b1220;
  --bg-surface-soft: #08111f;
  --bg-surface-raised: #111827;
  --bg-input: #050816;
  --bg-hover: rgba(148, 163, 184, 0.10);

  --text-strong: #f8fafc;
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --text-soft: #64748b;
  --text-inverted: #ffffff;

  --border-subtle: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.30);
  --border-focus: #818cf8;

  --brand: #818cf8;
  --brand-strong: #6366f1;
  --brand-soft: rgba(99, 102, 241, 0.16);
  --brand-glow: rgba(129, 140, 248, 0.22);

  --system-purple: #a78bfa;
  --system-purple-soft: rgba(167, 139, 250, 0.14);

  --success-soft: rgba(34, 197, 94, 0.16);
  --success-text: #86efac;

  --warning-soft: rgba(245, 158, 11, 0.17);
  --warning-text: #fcd34d;

  --danger-soft: rgba(239, 68, 68, 0.16);
  --danger-text: #fca5a5;

  --info-soft: rgba(59, 130, 246, 0.16);
  --info-text: #93c5fd;

  --neutral-soft: rgba(148, 163, 184, 0.12);
  --neutral-text: #cbd5e1;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-sm: 0 10px 28px rgba(0, 0, 0, 0.34);
  --shadow-md: 0 18px 54px rgba(0, 0, 0, 0.44);
  --shadow-lg: 0 28px 90px rgba(0, 0, 0, 0.56);
}

/* ==========================================================================
   Reset estrutural
   ========================================================================== */

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

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, rgba(79, 70, 229, 0.10), transparent 32rem),
    radial-gradient(circle at top right, rgba(109, 40, 217, 0.08), transparent 34rem),
    linear-gradient(135deg, var(--bg-page) 0%, var(--bg-page-soft) 100%);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

a {
  color: inherit;
}

::selection {
  color: var(--text-inverted);
  background: var(--brand);
}

/* ==========================================================================
   Acessibilidade e raiz da aplicação
   ========================================================================== */

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 9999;
  padding: 10px 14px;
  color: var(--text-inverted);
  text-decoration: none;
  background: var(--brand);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transform: translateY(-160%);
  transition: transform var(--transition-fast);
}

.skip-link:focus {
  transform: translateY(0);
}

.noscript-panel {
  max-width: 980px;
  margin: 18px auto 0;
  padding: 14px 18px;
  color: var(--danger-text);
  background: var(--danger-soft);
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: var(--radius-md);
}

.app-root {
  width: 100%;
  min-height: 100vh;
  outline: none;
}

/* ==========================================================================
   Helpers utilitários globais
   ========================================================================== */

.hidden {
  display: none !important;
}

.invisible {
  visibility: hidden !important;
}

.text-muted {
  color: var(--text-muted) !important;
}

.text-strong {
  color: var(--text-strong) !important;
}

.text-right {
  text-align: right !important;
}

.text-center {
  text-align: center !important;
}

.nowrap {
  white-space: nowrap !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

/* ==========================================================================
   Preferências de acessibilidade
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}