/* Digi AI 2630 — design tokens
   Brand: #112954 Digidelta navy (oficial), #3859D0 Digidelta blue (CTA)
   Fontes: Montserrat (display) + Inter local (UI) + JetBrains Mono
   Light is default; [data-theme="dark"] flips palette. */

/* Inter — local (licensed, variable font) */
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter-VariableFont_opsz_wght.ttf') format('truetype-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter-Italic-VariableFont_opsz_wght.ttf') format('truetype-variations');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

/* Montserrat (display) + JetBrains Mono — Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Brand — Digidelta official navy */
  --brand-900: #112954;         /* official navy — logo, dark surfaces */
  --brand-800: #1a3568;
  --brand-700: #1e3e7c;
  --brand-500: #3859a0;
  --brand-300: #7a9bc8;
  --brand-100: #d6e2f0;
  --brand-50:  #edf2f8;

  /* Accent — Digidelta official blue */
  --accent-700: #2640a0;
  --accent-500: #3859D0;        /* official blue — CTA, links */
  --accent-400: #5b78dc;
  --accent-100: #ccd4f5;
  --accent-50:  #e8ebfa;

  /* Digi AI — aligned with accent, cyan halo for live/streaming surfaces */
  --ai-700: #2640a0;
  --ai-500: #3859D0;
  --ai-400: #5b78dc;
  --ai-100: #ccd4f5;
  --ai-50:  #e8ebfa;
  --ai-halo: #00b3ff;           /* cyan — only for live/streaming glow */
  --ai-tint: color-mix(in oklch, var(--ai-500) 14%, transparent);
  --ai-glow: 0 0 0 1px color-mix(in oklch, var(--ai-halo) 35%, transparent), 0 8px 28px -10px color-mix(in oklch, var(--ai-halo) 55%, transparent);

  /* Semantic */
  --success: oklch(0.68 0.13 155);
  --warning: oklch(0.76 0.14 72);
  --danger:  oklch(0.62 0.20 27);
  --info:    oklch(0.65 0.13 240);

  /* Surfaces — dark-first default */
  --bg:         #000000;
  --bg-elev:    #000000;
  --bg-sunken:  #000000;
  --bg-hover:   #131f3a;
  --surface-muted: #0a1020;
  --border:     #1e2d52;
  --border-strong: #2d4078;
  --text:       #e6eef3;
  --text-muted: #92a6b3;
  --text-dim:   #6a7f8d;
  --text-inverse: #112954;

  /* Type */
  --font-display: 'Montserrat', 'Inter', system-ui, sans-serif;
  --font-ui: 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Rhythm */
  --r-1: 4px; --r-2: 6px; --r-3: 8px; --r-4: 12px; --r-5: 16px; --r-6: 20px;
  --shadow-sm: 0 1px 2px rgba(17,41,84,0.06);
  --shadow-md: 0 4px 12px -4px rgba(17,41,84,0.08), 0 2px 4px -2px rgba(17,41,84,0.04);
  --shadow-lg: 0 16px 40px -12px rgba(17,41,84,0.18), 0 4px 12px -6px rgba(17,41,84,0.08);

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h: 56px;

  /* Spacing scale (4px base) — use these for workspace padding/gaps */
  --pad-screen: 28px;       /* outer padding of screen content */
  --gap-section: 28px;      /* between major sections in a screen */
  --gap-cards: 16px;        /* between cards in a grid */
  --gap-head: 16px;         /* SectionHead → content below */
  --pad-card: 18px;         /* interior of standard cards */
  --pad-card-lg: 20px;      /* interior of hero cards */
  --pad-row-y: 12px;        /* table row vertical padding */
  --pad-row-x: 16px;        /* table row horizontal padding */

  /* ── UKO extended token set (Costa design system 2026-05-04) ── */
  /* Digidelta brand aliases — matches colors_and_type.css */
  --dd-primary-900:  #112954;
  --dd-primary-600:  #3859D0;
  --dd-blue-50:      #F9FAFF;
  --dd-blue-100:     #EBEFF9;
  --dd-blue-200:     #DFE7F9;
  --dd-blue-300:     #C6D1EA;
  --dd-blue-400:     #8FA8D6;
  --dd-ink:          #1D2E38;
  --dd-white:        #FFFFFF;
  --dd-paper:        #F1F3F5;
  --dd-stroke:       #E1E7F3;
  --dd-success:      #00A86B;
  --dd-error:        #CF2E2E;
  /* Legacy aliases for dashboard consumers */
  --dd-red-700:  #112954;  --dd-red-600:  #3859D0;  --dd-red-500: #8FA8D6;  --dd-red-100: #EBEFF9;
  --dd-navy-900: #112954;  --dd-navy-800: #1D2E38;  --dd-navy-700: #112954;
  --dd-navy-200: #C6D1EA;  --dd-navy-100: #DFE7F9;

  /* UKO Grey scale */
  --grey-900: #283252;  --grey-800: #2D375C;  --grey-700: #2F3A66;
  --grey-600: #313D70;  --grey-500: #34417A;  --grey-400: #94A4C4;
  --grey-300: #ECEFF5;  --grey-200: #F0F3F5;  --grey-100: #F5F6F8;  --grey-50: #FAFAFA;

  /* UKO Primary Blue scale */
  --primary-900: #122E7A;  --primary-800: #1E3A95;  --primary-700: #2940D3;
  --primary-600: #407BFF;  --primary-500: #61A9FF;  --primary-400: #5896E1;
  --primary-300: #7BB7FF;  --primary-200: #BDCCED;  --primary-100: #D9E5FA;  --primary-50: #ECF1FB;

  /* UKO Accent ramps — charts, badges */
  --pumpkin-900: #283252;  --pumpkin-700: #E96D17;  --pumpkin-500: #FF9A40;
  --pumpkin-300: #FFB8A1;  --pumpkin-100: #FFCFCA;
  --uko-red-900: #6E1414;  --uko-red-700: #B53B3B;  --uko-red-500: #FF8A8A;
  --uko-red-300: #F9BFBB;  --uko-red-100: #FFE3E0;
  --yellow-700:  #C99A2E;  --yellow-500:  #FFD54F;  --yellow-300: #FFE791;  --yellow-100: #FFF6D6;
  --green-700:   #1F8A52;  --green-500:   #2EBD68;  --green-300:  #8AE0A6;  --green-100:  #E1F7E6;
  --purple-700:  #5B43C5;  --purple-500:  #7B61FF;  --purple-300: #B8A8FF;  --purple-100: #ECE7FF;

  /* UKO Semantic foreground */
  --fg-1:        #283252;
  --fg-2:        #404968;
  --fg-3:        #94A4C4;
  --fg-on-dark:  #FFFFFF;
  --fg-link:     #61A9FF;
  --fg-success:  #1F8A52;
  --fg-warning:  #E96D17;
  --fg-danger:   #B53B3B;

  /* UKO Semantic backgrounds (light, for dashboard surfaces) */
  --bg-app:      #F5F6F8;
  --bg-surface:  #FFFFFF;
  --bg-subtle:   #FAFAFA;
  --bg-inverse:  #283252;
  --bg-selected: #ECF1FB;
  --dgd-bg-surface: #FFFFFF;

  /* UKO Borders */
  --border-1:     #ECEFF5;
  --border-2:     #E3E6EB;
  --border-focus: #61A9FF;

  /* UKO Actions */
  --action-primary:       #61A9FF;
  --action-primary-hover: #407BFF;
  --action-primary-press: #2940D3;
  --action-secondary:     #2940D3;
  --action-on-primary:    #FFFFFF;

  /* UKO Radii (named) */
  --radius-xs:   4px;   --radius-sm:  6px;   --radius-md:  8px;
  --radius-lg:   10px;  --radius-xl:  14px;  --radius-2xl: 20px;  --radius-pill: 999px;

  /* UKO Shadows (navy-tinted, never pure black) */
  --shadow-1:       0 1px 2px rgba(40,41,61,0.04);
  --shadow-form:    0 1px 4px rgba(40,41,61,0.04), 0 0 1px rgba(40,41,61,0.08);
  --shadow-medium:  0 2px 4px rgba(40,41,61,0.04), 0 4px 8px rgba(96,97,112,0.08);
  --shadow-card:    0 1px 4px rgba(40,41,61,0.04), 0 4px 16px rgba(96,97,112,0.08);
  --shadow-regular: 0 4px 8px rgba(40,41,61,0.04), 0 8px 16px rgba(96,97,112,0.10);
  --shadow-base:    0 8px 16px rgba(40,41,61,0.06), 0 16px 24px rgba(96,97,112,0.12);
  --shadow-huge:    0 16px 24px rgba(40,41,61,0.08), 0 24px 40px rgba(96,97,112,0.14);
  --shadow-large:   0 24px 32px rgba(40,41,61,0.10), 0 32px 56px rgba(96,97,112,0.16);
  --shadow-badge:   0 6px 16px rgba(97,169,255,0.32);

  /* UKO Spacing scale */
  --space-0: 0;    --space-1: 4px;   --space-2: 8px;   --space-3: 12px;
  --space-4: 16px; --space-5: 20px;  --space-6: 24px;  --space-7: 32px;
  --space-8: 40px; --space-9: 48px;  --space-10: 64px;

  /* UKO Typography scale vars */
  --display-1-size: 68px;  --display-1-weight: 700;
  --display-2-size: 32px;  --display-2-weight: 700;
  --h1-size: 28px;  --h1-weight: 700;
  --h2-size: 24px;  --h2-weight: 700;
  --h3-size: 18px;  --h3-weight: 700;
  --h4-size: 16px;  --h4-weight: 700;
  --body-lg-size: 14px;  --body-lg-weight: 500;
  --body-md-size: 13px;  --body-md-weight: 500;
  --body-sm-size: 12px;  --body-sm-weight: 500;
  --body-xs-size: 10px;  --body-xs-weight: 500;
  --button-size: 12px;   --button-weight: 700;
  --label-size:  13px;   --label-weight:  600;
  --caption-size: 10px;  --caption-weight: 600;
  --font-sans: var(--font-display);
  --font-text: var(--font-ui);

  /* ── --dgd-* aliases — usado pelo dashboard Comercial (Costa) ── */
  /* dark mode defaults (`:root` = dark) */
  --dgd-bg-app:     #0d0e14;
  --dgd-bg-surface: #141519;
  --dgd-fg-1: #e6eef3;
  --dgd-fg-2: #92a6b3;
  --dgd-fg-3: #4a5e7a;
  --dgd-border-1: #1e2d52;
  --dgd-border-2: #2d3a5a;
  --dgd-primary-50:  #ECF1FB;
  --dgd-primary-100: #D9E5FA;
  --dgd-primary-500: #61A9FF;
  --dgd-primary-600: #407BFF;
  --dgd-primary-700: #2940D3;
  --dgd-pumpkin-500: #FF9A40;
  --dgd-pumpkin-700: #E96D17;
  --dgd-red-500:     #FF8A8A;
  --dgd-red-700:     #B53B3B;
  --dgd-green-500:   #2EBD68;
  --dgd-green-700:   #1F8A52;
  --dgd-purple-700:  #5B43C5;
  --dgd-grey-200:    #F0F3F5;
  --dgd-radius-xs: 4px; --dgd-radius-sm: 6px; --dgd-radius-md: 8px;
  --dgd-radius-lg: 10px; --dgd-radius-xl: 14px; --dgd-radius-pill: 999px;
  --dgd-shadow-1:       0 1px 2px rgba(40,41,61,0.04);
  --dgd-shadow-card:    0 1px 4px rgba(40,41,61,0.04), 0 4px 16px rgba(96,97,112,0.08);
  --dgd-shadow-regular: 0 4px 8px rgba(40,41,61,0.04), 0 8px 16px rgba(96,97,112,0.10);
  --dgd-font-sans: 'Montserrat', 'Inter', system-ui, sans-serif;
  --dgd-font-text: 'Inter', system-ui, sans-serif;
  --dgd-font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --dgd-h1:      700 28px/1 'Montserrat', sans-serif;
  --dgd-h2:      700 24px/1.1 'Montserrat', sans-serif;
  --dgd-h3:      700 18px/1.25 'Montserrat', sans-serif;
  --dgd-h4:      700 16px/1.3 'Montserrat', sans-serif;
  --dgd-body-lg: 500 14px/1.5 'Inter', sans-serif;
  --dgd-body-md: 500 13px/1.5 'Inter', sans-serif;
  --dgd-body-sm: 500 12px/1.5 'Inter', sans-serif;
  --dgd-body-xs: 500 10px/1.4 'Inter', sans-serif;
  --dgd-button:  700 12px/1 'Inter', sans-serif;
  --dgd-label:   600 13px/1.3 'Inter', sans-serif;
  --dgd-caption: 600 10px/1.2 'Inter', sans-serif;
}

[data-theme="light"] {
  --bg:         #f5f7fa;
  --bg-elev:    #ffffff;
  --bg-sunken:  #eef1f6;
  --bg-hover:   #eef1f6;
  --surface-muted: #f3f5f9;
  --border:     #dde3ef;
  --border-strong: #bec9de;
  --text:       #112954;
  --text-muted: #4a5e7a;
  --text-dim:   #7a8fa8;
  --text-inverse: #ffffff;
  --shadow-sm: 0 1px 2px rgba(17,41,84,0.06);
  --shadow-md: 0 4px 12px -4px rgba(17,41,84,0.08), 0 2px 4px -2px rgba(17,41,84,0.04);
  --shadow-lg: 0 16px 40px -12px rgba(17,41,84,0.18), 0 4px 12px -6px rgba(17,41,84,0.08);
  /* dgd-* light mode overrides */
  --dgd-bg-app:     #F5F6F8;
  --dgd-bg-surface: #FFFFFF;
  --dgd-fg-1: #283252;
  --dgd-fg-2: #404968;
  --dgd-fg-3: #94A4C4;
  --dgd-border-1: #ECEFF5;
  --dgd-border-2: #E3E6EB;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv05", "ss01";
}

.font-display { font-family: var(--font-display); letter-spacing: -0.015em; font-weight: 600; }
.font-mono { font-family: var(--font-mono); }

button { font-family: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; padding: 0; }
input, select, textarea { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scrollbar::-webkit-scrollbar { width: 10px; height: 10px; }
.scrollbar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
.scrollbar::-webkit-scrollbar-track { background: transparent; }

/* Keyframes */
@keyframes ai-shimmer {
  0%,100% { opacity: 0.5; }
  50% { opacity: 1; }
}
@keyframes ai-dot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}
@keyframes slide-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.animate-in { animation: slide-up 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Digi AI surface — reserved treatment */
.ai-surface {
  background: linear-gradient(135deg, var(--ai-tint), transparent 60%), var(--bg-elev);
  border: 1px solid color-mix(in oklch, var(--ai-500) 35%, var(--border));
  position: relative;
}
.ai-surface::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(80% 40% at 0% 0%, color-mix(in oklch, var(--ai-500) 18%, transparent), transparent 60%);
  opacity: 0.9;
}
.ai-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--ai-700);
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--ai-tint);
  border: 1px solid color-mix(in oklch, var(--ai-500) 30%, transparent);
}
[data-theme="dark"] .ai-chip { color: var(--ai-400); }
.ai-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ai-500);
  box-shadow: 0 0 8px var(--ai-500);
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-3);
  font-weight: 500;
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn-primary {
  background: var(--brand-900);
  color: #fff;
  border-color: var(--brand-900);
}
[data-theme="dark"] .btn-primary { background: #fff; color: var(--brand-900); border-color: #fff; }
.btn-primary:hover { background: var(--brand-800); border-color: var(--brand-800); }
[data-theme="dark"] .btn-primary:hover { background: var(--brand-100); border-color: var(--brand-100); }
.btn-ai {
  background: var(--ai-500);
  color: #fff;
  border-color: transparent;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.btn-ai:hover { background: var(--ai-400); }
.btn-ai.live { box-shadow: var(--ai-glow); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-sm { padding: 5px 10px; font-size: 12px; gap: 6px; }
.btn-xs { padding: 3px 8px; font-size: 11px; gap: 4px; border-radius: var(--r-2); }

/* Card */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-4);
}

/* Badge */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--surface-muted);
  color: var(--text-muted);
}
.badge-danger { background: color-mix(in oklch, var(--danger) 12%, transparent); color: var(--danger); }
.badge-warning { background: color-mix(in oklch, var(--warning) 18%, transparent); color: color-mix(in oklch, var(--warning) 80%, #000); }
[data-theme="dark"] .badge-warning { color: var(--warning); }
.badge-success { background: color-mix(in oklch, var(--success) 14%, transparent); color: var(--success); }
.badge-info { background: color-mix(in oklch, var(--info) 14%, transparent); color: var(--info); }

/* KPI card */
.kpi { padding: 18px 20px; }
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; font-family: var(--font-display); }
.kpi-value { font-family: var(--font-display); font-weight: 600; font-size: 32px; letter-spacing: -0.02em; margin-top: 6px; line-height: 1.1; }
.kpi-delta { font-size: 12px; margin-top: 6px; display: inline-flex; align-items: center; gap: 4px; }

/* Focus */
:focus-visible { outline: 2px solid var(--ai-500); outline-offset: 2px; border-radius: 4px; }

/* Tweaks panel */
.tweaks-panel {
  position: fixed; right: 16px; bottom: 16px;
  width: 280px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-4);
  box-shadow: var(--shadow-lg);
  padding: 14px;
  z-index: 1000;
  font-size: 12px;
}
