/* =============================================
   ULTRACALC — Global Design System
   ============================================= */

/* ---------- Design Tokens ---------- */
:root {
  /* Brand Colors */
  --clr-primary: #7C3AED;
  --clr-primary-light: #A855F7;
  --clr-primary-glow: rgba(124, 58, 237, 0.4);
  --clr-cyan: #06B6D4;
  --clr-cyan-glow: rgba(6, 182, 212, 0.4);
  --clr-amber: #F59E0B;
  --clr-emerald: #10B981;
  --clr-red: #EF4444;
  --clr-mode: #7C3AED; /* dynamic */
  --sem-active: #0EA5E9;
  --sem-active-soft: rgba(14, 165, 233, 0.14);
  --sem-active-border: rgba(14, 165, 233, 0.42);
  --sem-confirm: #10B981;
  --sem-confirm-soft: rgba(16, 185, 129, 0.14);
  --sem-confirm-border: rgba(16, 185, 129, 0.42);
  --sem-off: #64748B;
  --sem-off-soft: rgba(100, 116, 139, 0.10);
  --sem-off-border: rgba(148, 163, 184, 0.22);
  --sem-warn: #F59E0B;
  --sem-warn-soft: rgba(245, 158, 11, 0.14);
  --sem-warn-border: rgba(245, 158, 11, 0.42);

  /* Backgrounds */
  --bg-base: #07070F;
  --bg-surface: rgba(255, 255, 255, 0.04);
  --bg-glass: rgba(255, 255, 255, 0.06);
  --bg-glass-hover: rgba(255, 255, 255, 0.10);
  --bg-glass-active: rgba(255, 255, 255, 0.14);

  /* Text */
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #475569;

  /* Borders */
  --border: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(255, 255, 255, 0.16);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.4);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-lg: 0 24px 64px rgba(0,0,0,0.6);

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 9999px;

  /* Sidebar */
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 84px;

  /* Transitions */
  --ease: cubic-bezier(0.175, 0.885, 0.32, 1.1); /* Efeito elástico spring sutil */
}

html[data-theme="light"] {
  --bg-base: #f4f7fb;
  --bg-surface: rgba(15, 23, 42, 0.05);
  --bg-glass: rgba(255, 255, 255, 0.82);
  --bg-glass-hover: rgba(255, 255, 255, 0.95);
  --bg-glass-active: rgba(124, 58, 237, 0.10);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border: rgba(15, 23, 42, 0.10);
  --border-bright: rgba(15, 23, 42, 0.18);
  --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 14px 36px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 24px 64px rgba(15, 23, 42, 0.14);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Outfit', system-ui, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

html[data-theme="light"] body {
  background:
    radial-gradient(circle at top left, rgba(124, 58, 237, 0.10), transparent 30%),
    radial-gradient(circle at right bottom, rgba(6, 182, 212, 0.10), transparent 28%),
    var(--bg-base);
}

button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea { font-family: inherit; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }

/* ---------- Ambient Background ---------- */
.ambient-bg {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
}
.ambient-orb {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.22;
  animation: orbFloat 16s ease-in-out infinite alternate;
}
.orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--clr-primary), transparent 70%);
  top: -200px; left: -100px; animation-delay: 0s;
}
.orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, var(--clr-cyan), transparent 70%);
  bottom: -100px; right: 10%; animation-delay: -4s; animation-duration: 16s;
}
.orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, var(--clr-amber), transparent 70%);
  top: 40%; right: -50px; animation-delay: -8s; animation-duration: 20s;
}
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
  33% { transform: translate(40px, -30px) scale(1.1) rotate(5deg); }
  66% { transform: translate(-30px, 40px) scale(0.9) rotate(-5deg); }
}

/* ---------- Glass Card ---------- */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  padding: 28px;
  transition: all 0.4s var(--ease);
}
.glass-card:hover { 
  border-color: var(--border-bright); 
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.standalone-card-shell {
  max-width: 1040px;
  margin: 0 auto;
}

.labor-card,
.material-card,
.travel-card {
  display: grid;
  gap: 20px;
}

.labor-result-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.optional-blocks-card {
  margin-bottom: 18px;
}

.optional-blocks-row,
.official-source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.official-source-item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
}

.official-source-item small {
  color: var(--text-secondary);
  font-size: 11px;
}

.official-source-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.official-source-inline a {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text-secondary);
  font-size: 12px;
}

.calc-note {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
}

.calc-note strong {
  font-size: 13px;
  color: var(--text-primary);
}

.calc-note span {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.calc-note--warning {
  background: linear-gradient(135deg, var(--sem-warn-soft), rgba(249,115,22,0.08));
  border-color: var(--sem-warn-border);
}

.calc-note--info {
  background: linear-gradient(135deg, var(--sem-active-soft), rgba(6,182,212,0.08));
  border-color: var(--sem-active-border);
}

.card-title {
  font-size: 13px; font-weight: 700; letter-spacing: 0.01em;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: rgba(10, 8, 20, 0.85);
  backdrop-filter: blur(30px);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 100; flex-shrink: 0;
  transition: width 0.35s var(--ease);
  overflow: hidden;
}
html[data-theme="light"] .sidebar {
  background: rgba(255, 255, 255, 0.82);
}
html[data-theme="light"] .converter-result-card {
  background: linear-gradient(180deg, rgba(14,165,233,0.12), rgba(255,255,255,0.96));
  border-color: rgba(14,165,233,0.24);
}
html[data-theme="light"] .converter-result-value {
  color: #0f172a;
}
html[data-theme="light"] .food-calc-card {
  background: linear-gradient(180deg, rgba(245,158,11,0.08), rgba(255,255,255,0.98));
  border-color: rgba(245,158,11,0.18);
}
html[data-theme="light"] .interest-stat-card,
html[data-theme="light"] .interest-insight-card,
html[data-theme="light"] .future-stat,
html[data-theme="light"] .future-macro-card,
html[data-theme="light"] .future-event,
html[data-theme="light"] .future-history-item,
html[data-theme="light"] .loan-table-shell {
  background: rgba(255,255,255,0.96);
  border-color: rgba(15,23,42,0.10);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}
html[data-theme="light"] .finance-switch-btn.active,
html[data-theme="light"] .converter-quick-btn.active {
  color: #0b3b52;
}

/* ── Light mode: logo gradient (white text becomes invisible) ── */
html[data-theme="light"] .logo-text {
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Light mode: keyboard keys ── */
html[data-theme="light"] .key {
  background: rgba(255,255,255,0.88);
  border-color: rgba(15,23,42,0.12);
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(15,23,42,0.10), inset 0 1px 0 rgba(255,255,255,0.9);
}
html[data-theme="light"] .key:hover {
  background: rgba(255,255,255,0.98);
  border-color: rgba(15,23,42,0.20);
  box-shadow: 0 4px 12px rgba(15,23,42,0.12);
}
html[data-theme="light"] .key--num {
  background: rgba(255,255,255,0.75);
}
html[data-theme="light"] .key--soft {
  color: #6d28d9;
  background: rgba(124,58,237,0.08);
  border-color: rgba(124,58,237,0.22);
}
html[data-theme="light"] .key--const {
  color: #065f46;
  background: rgba(16,185,129,0.08);
  border-color: rgba(16,185,129,0.22);
}
html[data-theme="light"] .key--op {
  color: #0369a1;
}
html[data-theme="light"] .key--back {
  color: #b45309;
}
html[data-theme="light"] .key--primary {
  background: rgba(6,182,212,0.10);
  border-color: rgba(6,182,212,0.28);
  color: #0369a1;
}
html[data-theme="light"] .key--clear {
  color: #dc2626;
}

/* ── Light mode: sidebar link buttons ── */
html[data-theme="light"] .sidebar-link-btn {
  color: var(--text-secondary);
  border-color: var(--border);
}
html[data-theme="light"] .sidebar-link-btn:hover {
  color: var(--text-primary);
}
html[data-theme="light"] .sidebar-link-btn--install:hover  { color: #0369a1; }
html[data-theme="light"] .sidebar-link-btn--finance:hover  { color: #047857; }
html[data-theme="light"] .sidebar-link-btn--brand:hover    { color: #1e40af; }
html[data-theme="light"] .sidebar-link-btn--youtube:hover  { color: #dc2626; }

/* ── Light mode: interest / financing stats ── */
html[data-theme="light"] .interest-highlight-card {
  background: linear-gradient(135deg, rgba(124,58,237,0.08), rgba(6,182,212,0.06));
  border-color: rgba(124,58,237,0.18);
}

/* ── Light mode: glass card shadow ── */
html[data-theme="light"] .glass-card {
  box-shadow: 0 4px 24px rgba(15,23,42,0.08), inset 0 1px 0 rgba(255,255,255,0.95);
}

/* ── Light mode: input fields ── */
html[data-theme="light"] .input-modern,
html[data-theme="light"] .input-prefix-group input {
  background: rgba(255,255,255,0.88);
  border-color: rgba(15,23,42,0.14);
  color: var(--text-primary);
}
html[data-theme="light"] .input-prefix-group .prefix {
  background: rgba(15,23,42,0.04);
  border-color: rgba(15,23,42,0.10);
  color: var(--text-secondary);
}

/* ── Light mode: btn-icon-sm ── */
html[data-theme="light"] .btn-icon-sm {
  background: rgba(255,255,255,0.82);
  border-color: rgba(15,23,42,0.14);
  color: var(--text-secondary);
}
html[data-theme="light"] .btn-icon-sm:hover {
  background: rgba(255,255,255,0.98);
  color: var(--text-primary);
  border-color: rgba(15,23,42,0.22);
}

/* ── Light mode: mode badge ── */
html[data-theme="light"] .mode-badge {
  background: rgba(255,255,255,0.80);
  border-color: rgba(15,23,42,0.12);
  color: var(--text-secondary);
}

/* ── Light mode: finance switcher buttons ── */
html[data-theme="light"] .finance-switch-btn {
  background: rgba(255,255,255,0.75);
  border-color: rgba(15,23,42,0.14);
  color: var(--text-secondary);
}

/* ── Light mode: converter quick buttons ── */
html[data-theme="light"] .converter-quick-btn {
  background: rgba(255,255,255,0.75);
  border-color: rgba(15,23,42,0.14);
  color: var(--text-secondary);
}
html[data-theme="light"] .converter-quick-btn:hover {
  background: rgba(255,255,255,0.95);
  color: var(--text-primary);
}

/* ── Light mode: mobile nav fab ── */
html[data-theme="light"] .mobile-nav-fab {
  background: var(--clr-primary);
  color: #fff;
}

/* ── Light mode: mobile nav panel ── */
html[data-theme="light"] .mobile-nav-panel {
  background: rgba(255,255,255,0.96);
  border-color: rgba(15,23,42,0.10);
}
html[data-theme="light"] .mobile-nav-item {
  background: rgba(15,23,42,0.04);
  border-color: rgba(15,23,42,0.08);
  color: var(--text-primary);
}
html[data-theme="light"] .mobile-nav-item.active {
  background: rgba(124,58,237,0.10);
  border-color: rgba(124,58,237,0.20);
}
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 16px; border-bottom: 1px solid var(--border);
  min-height: 72px;
}
.logo { display: flex; align-items: center; gap: 12px; overflow: hidden; min-width: 0; flex: 1; }
.logo-icon {
  width: 38px; height: 38px; border-radius: var(--r-md);
  flex-shrink: 0; box-shadow: 0 4px 16px var(--clr-primary-glow);
  object-fit: cover;
}
.logo-text {
  font-size: clamp(14px, 1.2vw, 17px); font-weight: 800; white-space: nowrap;
  background: linear-gradient(135deg, #fff, var(--clr-primary-light));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  transition: opacity 0.3s;
  min-width: 0;
  overflow: hidden;
  text-overflow: clip;
  max-width: none;
}
.sidebar.collapsed .logo-text { opacity: 0; pointer-events: none; }
.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 16px 10px;
  position: relative;
}
.sidebar.collapsed .logo {
  flex: 0 0 auto;
  width: 40px;
  justify-content: center;
  overflow: visible;
}
.sidebar.collapsed .logo-icon {
  width: 40px;
  height: 40px;
}
.sidebar.collapsed .sidebar-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}

.sidebar-toggle {
  width: 32px; height: 32px; border-radius: var(--r-sm); padding: 6px;
  color: var(--text-secondary); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.sidebar-toggle:hover { background: var(--bg-glass-hover); color: var(--text-primary); }

/* Nav List */
.nav-list { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 4px; overflow: hidden; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-md);
  cursor: pointer; position: relative; overflow: hidden;
  transition: background 0.2s var(--ease);
  white-space: nowrap;
}
.nav-item:hover { background: var(--bg-glass-hover); }
.nav-item.active { background: var(--bg-glass-active); }
.nav-item:focus-visible { outline: 2px solid var(--clr-primary); outline-offset: 2px; }

.nav-icon { font-size: 20px; flex-shrink: 0; width: 28px; text-align: center; }
.nav-info { flex: 1; overflow: hidden; transition: opacity 0.3s; }
.sidebar.collapsed .nav-info { opacity: 0; pointer-events: none; }
.nav-name { display: block; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.nav-desc { display: block; font-size: 11px; color: var(--text-secondary); margin-top: 1px; }

.nav-indicator {
  width: 3px; height: 24px; border-radius: var(--r-full);
  background: linear-gradient(to bottom, var(--clr-primary), var(--clr-cyan));
  opacity: 0; transition: opacity 0.3s; margin-left: auto; flex-shrink: 0;
}
.nav-item.active .nav-indicator { opacity: 1; }

.sidebar-footer {
  padding: 16px; border-top: 1px solid var(--border);
  display: grid; align-items: stretch; gap: 10px;
}
.sidebar-footer > * { min-width: 0; }
.language-select { width: 100%; min-width: 0; }
.native-select-hidden {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 1px !important;
  height: 1px !important;
}
.ui-select { position: relative; width: 100%; }
.ui-select-button {
  width: 100%;
  min-height: 42px;
  padding: 0 42px 0 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03)), var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  transition: border-color 0.2s var(--ease), transform 0.18s var(--ease), background 0.2s var(--ease);
}
.ui-select-button::after {
  content: '⌄';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-54%);
  color: var(--text-muted);
  font-size: 14px;
}
.ui-select.open .ui-select-button {
  border-color: rgba(124,58,237,0.42);
  background: linear-gradient(180deg, rgba(124,58,237,0.14), rgba(6,182,212,0.07)), var(--bg-surface);
}
.ui-select-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  padding: 8px;
  border-radius: 16px;
  border: 1px solid var(--border-bright);
  background: rgba(10, 8, 20, 0.96);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(22px);
  display: none;
  z-index: 80;
  max-height: 260px;
  overflow: auto;
}
html[data-theme="light"] .ui-select-menu { background: rgba(255,255,255,0.96); }
.ui-select.open .ui-select-menu { display: grid; gap: 6px; }
.ui-select-option {
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.ui-select-option:hover { background: rgba(124,58,237,0.10); color: var(--text-primary); }
.ui-select-option.active {
  background: linear-gradient(135deg, rgba(124,58,237,0.22), rgba(6,182,212,0.12));
  color: var(--text-primary);
  border: 1px solid rgba(124,58,237,0.18);
}
.version-tag { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.sidebar.collapsed .version-tag { display: none; }
.sidebar.collapsed .language-select,
.sidebar.collapsed .ui-select { display: none; }

html[data-theme="light"] .ambient-orb {
  opacity: 0.12;
}

html[data-theme="light"] .message-bubble,
html[data-theme="light"] .glass-card,
html[data-theme="light"] .toast,
html[data-theme="light"] .chat-input-area {
  backdrop-filter: blur(20px) saturate(160%);
}

/* ---------- Main ---------- */
.main {
  flex: 1; position: relative; z-index: 1;
  overflow-y: auto; height: 100vh;
  padding: 32px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.main::-webkit-scrollbar { width: 6px; }
.main::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--r-full); }

/* ---------- Mode Section ---------- */
.mode { display: none; animation: modeFadeIn 0.4s var(--ease); max-width: 1200px; margin: 0 auto; }
.mode.active { display: block; }

@keyframes modeFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mode Header */
.mode-header { margin-bottom: 28px; }
.mode-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 700; letter-spacing: 0.05em;
  background: color-mix(in srgb, var(--badge-color) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--badge-color) 40%, transparent);
  color: var(--badge-color);
  margin-bottom: 12px;
}
.mode-title {
  font-size: 28px; font-weight: 800; line-height: 1.2;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--text-secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}
.mode-subtitle { font-size: 15px; color: var(--text-secondary); line-height: 1.6; }

/* ---------- Shared Inputs / Buttons ---------- */
.field-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); letter-spacing: 0.01em; display: block; margin-bottom: 8px; }
.field-label--mini { font-size: 10px; margin-bottom: 6px; }

.input-prefix-group {
  display: flex; align-items: center; border-radius: var(--r-md);
  border: 1px solid var(--border); overflow: hidden;
  transition: border-color 0.2s;
}
.input-prefix-group:focus-within { border-color: var(--clr-primary); }
.input-prefix {
  padding: 10px 14px; background: rgba(255,255,255,0.04);
  color: var(--text-muted); font-size: 14px; border-right: 1px solid var(--border);
  flex-shrink: 0;
}
.input-prefix-group input {
  flex: 1; padding: 10px 14px; background: transparent; border: none;
  color: var(--text-primary); font-size: 16px; font-weight: 600;
}
.input-prefix-group input:focus { outline: none; }
.input-prefix-group input::placeholder { color: var(--text-muted); font-weight: 400; }

.btn-icon-sm {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  background: var(--bg-surface); border: 1px solid var(--border);
  transition: all 0.2s var(--ease);
}
.btn-icon-sm:hover { background: var(--bg-glass-hover); color: var(--text-primary); border-color: var(--border-bright); }
.btn-icon-sm.btn-danger:hover { background: rgba(239,68,68,0.15); color: var(--clr-red); border-color: rgba(239,68,68,0.3); }
.btn-icon-sm.btn-secondary:hover { background: rgba(6,182,212,0.15); color: var(--clr-cyan); border-color: rgba(6,182,212,0.3); }

.btn-secondary {
  padding: 8px 16px; border-radius: var(--r-sm); font-size: 13px; font-weight: 500;
  background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-secondary);
  transition: all 0.2s;
}
.btn-secondary:hover { background: var(--bg-glass-hover); color: var(--text-primary); }

/* Chart container */
.chart-container { position: relative; }
.chart-container canvas { width: 100% !important; }

/* ---------- Toast ---------- */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  padding: 12px 20px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 500;
  background: rgba(30,30,50,0.95); backdrop-filter: blur(20px);
  border: 1px solid var(--border); color: var(--text-primary);
  box-shadow: var(--shadow-md); pointer-events: all;
  transform: translateX(120%); opacity: 0; transition: all 0.35s var(--ease);
}
.toast.visible { transform: translateX(0); opacity: 1; }
.toast--success { border-color: var(--sem-confirm-border); box-shadow: 0 0 20px rgba(16,185,129,0.15); }
.toast--error { border-color: rgba(239,68,68,0.4); }
.toast--info { border-color: rgba(124,58,237,0.4); }

/* ================================================
   FLOWCALC
   ================================================ */
.flow-layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  max-width: 680px; margin: 0 auto;
}

/* Result area */
.flow-result-area { padding: 20px 24px; }
.flow-expr-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.flow-expression {
  font-size: 15px; color: var(--text-secondary); letter-spacing: 0.02em;
  min-height: 22px; word-break: break-all; line-height: 1.5;
}
.flow-result-row { display: flex; align-items: baseline; gap: 12px; margin-top: 8px; }
.flow-equals { font-size: 28px; color: var(--text-muted); font-weight: 300; }
.flow-result {
  font-size: 40px; font-weight: 800; letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 30%, var(--clr-primary-light));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  transition: color 0.2s;
}
.flow-result.has-error { background: none; -webkit-text-fill-color: var(--clr-red); }
.flow-top-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* Blocks area */
.flow-blocks-wrapper { padding: 16px 20px; }
.flow-blocks-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.flow-blocks-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.flow-hint { font-size: 11px; color: var(--text-muted); font-weight: 400; }

.flow-blocks {
  display: flex; flex-wrap: wrap; gap: 8px; min-height: 60px;
  align-content: flex-start;
}
.flow-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; min-height: 60px; gap: 8px; color: var(--text-muted); font-size: 13px;
  text-align: center; line-height: 1.5;
}
.placeholder-icon { font-size: 28px; opacity: 0.4; }

/* Chips */
.flow-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 10px; border-radius: var(--r-md);
  font-size: 15px; font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  cursor: grab; user-select: none;
  animation: chipIn 0.25s var(--ease) backwards;
  transition: all 0.3s var(--ease);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.05);
}
.flow-chip:active { cursor: grabbing; transform: scale(0.96) !important; }
.flow-chip:hover { 
  border-color: var(--border-bright); 
  background: var(--bg-glass-hover);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 12px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}
.flow-chip.dragging { opacity: 0.4; transform: scale(0.95); }
.flow-chip.drag-over { border-color: var(--clr-cyan); box-shadow: 0 0 16px var(--clr-cyan-glow); transform: scale(1.05); }
.flow-chip.selected { border-color: var(--clr-primary); background: rgba(124,58,237,0.15); box-shadow: 0 0 12px var(--clr-primary-glow); }

.flow-chip--operator {
  background: rgba(6,182,212,0.1); border-color: rgba(6,182,212,0.25);
  color: var(--clr-cyan); font-size: 18px;
}
.flow-chip--number { color: var(--text-primary); }
.flow-chip--paren { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.25); color: var(--clr-amber); }
.flow-chip--function {
  background: rgba(124,58,237,0.12);
  border-color: rgba(124,58,237,0.26);
  color: #dccdff;
}
.flow-chip--constant {
  background: rgba(16,185,129,0.12);
  border-color: rgba(16,185,129,0.26);
  color: #9ff5d1;
}

@keyframes chipIn {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}

.chip-drag { font-size: 14px; color: var(--text-muted); cursor: grab; opacity: 0.6; }
.chip-value { display: block; }
.chip-delete {
  width: 18px; height: 18px; border-radius: 50%; background: rgba(255,255,255,0.06);
  color: var(--text-muted); font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.chip-delete:hover { background: var(--clr-red); color: #fff; }

/* Keyboard */
.flow-keyboard {
  padding: 18px;
  display: grid;
  gap: 14px;
}
.flow-keyboard-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.flow-calc-modes {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
  flex: 1;
  min-width: 0;
}
.flow-calc-modes::-webkit-scrollbar { display: none; }
.flow-eval-toggle {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  flex-shrink: 0;
}
.flow-keyboard-hint {
  width: 100%;
}
.flow-mode-btn {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s var(--ease);
}
.flow-mode-btn:hover {
  border-color: rgba(124,58,237,0.35);
  color: var(--text-primary);
  background: rgba(124,58,237,0.12);
}
.flow-mode-btn.active {
  background: linear-gradient(135deg, rgba(124,58,237,0.28), rgba(6,182,212,0.16));
  border-color: rgba(124,58,237,0.55);
  color: #fff;
  box-shadow: 0 10px 22px rgba(124,58,237,0.18);
}
.flow-eval-btn {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-surface) 88%, transparent);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: all .2s var(--ease);
}
.flow-eval-btn.active {
  border-color: color-mix(in srgb, var(--clr-primary) 55%, var(--border));
  background: color-mix(in srgb, var(--clr-primary) 14%, var(--bg-surface));
  color: var(--text-primary);
  box-shadow: 0 8px 18px rgba(124,58,237,0.14);
}
.flow-eval-btn:hover {
  transform: translateY(-1px);
  color: var(--text-primary);
}
.flow-eval-btn[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--clr-primary) 55%, var(--border));
  background: color-mix(in srgb, var(--clr-primary) 14%, var(--bg-surface));
  color: var(--text-primary);
  box-shadow: 0 8px 18px rgba(124,58,237,0.14);
}
.flow-keyboard-hint {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}
.flow-result-area--inline {
  padding: 16px 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03));
  border: 1px solid var(--border);
}
.flow-result-area--inline .flow-top-actions {
  margin-top: 14px;
}
.flow-result-area--inline .flow-result {
  font-size: clamp(28px, 5vw, 46px);
}
.flow-result-area--inline .flow-expression {
  max-height: 78px;
  overflow-y: auto;
  padding-right: 4px;
}
.flow-result-area--inline .flow-expression::-webkit-scrollbar {
  width: 4px;
}
.flow-result-area--inline .flow-expression::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}
.flow-quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.flow-quick-btn {
  display: grid;
  gap: 4px;
  padding: 13px 14px;
  text-align: left;
  border-radius: var(--r-md);
  border: 1px solid rgba(16,185,129,0.18);
  background: linear-gradient(180deg, rgba(16,185,129,0.12), rgba(16,185,129,0.05));
  color: var(--text-primary);
  transition: transform 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.flow-quick-btn strong {
  font-size: 13px;
  font-weight: 700;
}
.flow-quick-btn span {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-muted);
}
.flow-quick-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(16,185,129,0.36);
  box-shadow: 0 14px 26px rgba(16,185,129,0.12);
}
.keyboard-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.key {
  height: 58px; border-radius: var(--r-md); font-size: 18px; font-weight: 600;
  background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-primary);
  transition: all 0.25s var(--ease); display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3), inset 0 1px 1px rgba(255,255,255,0.06);
}
.key::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at center, rgba(255,255,255,0.2), transparent 70%);
  opacity: 0; transition: opacity 0.2s;
}
.key:active::after { opacity: 1; }
.key:hover { 
  background: var(--bg-glass-hover); 
  border-color: var(--border-bright); 
  transform: translateY(-2px) scale(1.02); 
  box-shadow: 0 8px 16px rgba(0,0,0,0.4), inset 0 1px 1px rgba(255,255,255,0.15); 
}
.key:active { 
  transform: translateY(2px) scale(0.96); 
  box-shadow: 0 2px 4px rgba(0,0,0,0.3), inset 0 2px 4px rgba(0,0,0,0.2); 
}

.key--num { background: rgba(255,255,255,0.05); }
.key--op { color: var(--clr-cyan); }
.key--primary { background: rgba(6,182,212,0.1); border-color: rgba(6,182,212,0.2); }
.key--clear { background: var(--bg-surface); border-color: var(--border); color: var(--clr-red); font-size: 14px; }
.key--clear:hover { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.35); }
.key--back { background: var(--bg-surface); border-color: var(--border); color: var(--clr-amber); }
.key--soft { background: rgba(124,58,237,0.10); border-color: rgba(124,58,237,0.24); color: #d5c3ff; }
.key--const { background: rgba(16,185,129,0.10); border-color: rgba(16,185,129,0.24); color: #9ff5d1; }
.key--equal {
  background: linear-gradient(135deg, var(--clr-primary), #A855F7);
  border-color: transparent; color: #fff;
  box-shadow: 0 4px 20px var(--clr-primary-glow);
}
.key--equal:hover { box-shadow: 0 6px 28px var(--clr-primary-glow); filter: brightness(1.1); }
.key--wide { grid-column: span 2; }

/* ================================================
   LIFECALC
   ================================================ */
.life-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  align-items: start;
}
.life-left-col, .life-right-col { display: flex; flex-direction: column; gap: 16px; }

.life-salary-card .salary-meta {
  display: flex; flex-direction: column; gap: 8px; margin-top: 16px;
  padding-top: 16px; border-top: 1px solid var(--border);
}
.salary-meta-item { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.salary-meta-item span { color: var(--text-muted); }
.salary-meta-item strong { color: var(--clr-cyan); font-weight: 700; }

/* Life numpad */
.life-value-display {
  display: flex; align-items: baseline; gap: 8px; padding: 16px 0;
  border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
.life-prefix { font-size: 18px; color: var(--text-muted); font-weight: 500; }
.life-value-num {
  font-size: 36px; font-weight: 800; letter-spacing: -0.02em;
  color: var(--text-primary);
}
.life-numpad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.lkey {
  height: 50px; border-radius: var(--r-md); font-size: 17px; font-weight: 600;
  background: var(--bg-surface); border: 1px solid var(--border);
  color: var(--text-primary); transition: all 0.15s var(--ease);
}
.lkey:hover { background: var(--bg-glass-hover); border-color: var(--border-bright); transform: translateY(-1px); }
.lkey:active { transform: translateY(1px); }
.lkey--back { color: var(--text-secondary); }
.lkey--wide { grid-column: span 2; }

/* Impact card */
.impact-main { text-align: center; padding: 16px 0; }
.impact-placeholder { color: var(--text-muted); font-size: 14px; line-height: 1.6; }
.impact-time { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.time-value {
  font-size: 26px; font-weight: 800; letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--clr-cyan), var(--clr-primary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.time-label { font-size: 14px; color: var(--text-secondary); }

.impact-stats { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; border-top: 1px solid var(--border); padding-top: 20px; }
.impact-stat {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: var(--r-md); background: var(--bg-surface); border: 1px solid var(--border);
}
.impact-stat--highlight { border-color: rgba(6,182,212,0.3); background: rgba(6,182,212,0.06); }
.istat-icon { font-size: 20px; }
.istat-body { display: flex; flex-direction: column; gap: 2px; }
.istat-label { font-size: 12px; color: var(--text-muted); }
.istat-val { font-size: 16px; font-weight: 700; color: var(--text-primary); }

/* Invest card */
.rate-row { margin-bottom: 16px; }
.rate-buttons { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.rate-btn {
  padding: 6px 12px; border-radius: var(--r-full); font-size: 13px; font-weight: 600;
  background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-secondary);
  transition: all 0.2s;
}
.rate-btn:hover { border-color: var(--border-bright); color: var(--text-primary); }
.rate-btn.active { background: var(--sem-active-soft); border-color: var(--sem-active-border); color: #7dd3fc; }

.time-btn {
  padding: 6px 12px; border-radius: var(--r-full); font-size: 13px; font-weight: 600;
  background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-secondary);
  transition: all 0.2s;
}
.time-btn:hover { border-color: var(--border-bright); color: var(--text-primary); }
.time-btn.active { background: var(--sem-active-soft); border-color: var(--sem-active-border); color: #7dd3fc; }

.rate-slider-row { display: flex; align-items: center; gap: 12px; }
.rate-slider-row input[type="range"] { flex: 1; accent-color: var(--clr-primary); }
.rate-label { font-size: 13px; font-weight: 700; color: var(--clr-primary-light); min-width: 60px; }

.invest-summary {
  margin-top: 12px; text-align: center; font-size: 14px; color: var(--text-secondary); line-height: 1.6;
  padding: 14px; background: var(--bg-surface); border-radius: var(--r-md); border: 1px solid var(--border);
}
.invest-summary .highlight-value { color: var(--clr-emerald); font-weight: 700; font-size: 17px; }
.invest-summary strong { color: var(--text-primary); }

/* ================================================
   ASKCALC
   ================================================ */
.ask-layout { max-width: 720px; margin: 0 auto; }

.ask-chat-card {
  padding: 0; overflow: hidden;
  display: flex; flex-direction: column;
  height: calc(100vh - 260px); min-height: 480px;
}

.chat-messages {
  flex: 1; overflow-y: auto; padding: 24px;
  display: flex; flex-direction: column; gap: 16px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--r-full); }

/* Welcome */
.chat-welcome { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 24px 16px; }
.welcome-avatar { font-size: 40px; margin-bottom: 12px; }
.welcome-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.welcome-sub { font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; }
.example-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.example-chip {
  padding: 8px 14px; border-radius: var(--r-full); font-size: 13px; font-weight: 500;
  background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-secondary);
  transition: all 0.2s; cursor: pointer;
}
.example-chip:hover { background: rgba(16,185,129,0.15); border-color: rgba(16,185,129,0.4); color: var(--clr-emerald); transform: translateY(-1px); }

/* Messages */
.chat-message {
  display: flex; gap: 10px; opacity: 0; transform: translateY(10px);
  transition: all 0.35s var(--ease);
}
.chat-message.visible { opacity: 1; transform: translateY(0); }
.chat-message--user { flex-direction: row-reverse; }

.message-bubble {
  padding: 12px 16px; border-radius: var(--r-lg); font-size: 14px; line-height: 1.6;
  max-width: 80%;
}
.chat-message--user .message-bubble {
  background: linear-gradient(135deg, var(--clr-primary), #A855F7);
  color: #fff; border-bottom-right-radius: 4px;
}
.chat-message--bot .message-bubble {
  background: var(--bg-glass); border: 1px solid var(--border);
  color: var(--text-primary); border-bottom-left-radius: 4px;
}

.bot-avatar { font-size: 24px; flex-shrink: 0; margin-top: 4px; }
.message-content { display: flex; flex-direction: column; gap: 10px; max-width: 85%; }

/* Recipe steps */
.recipe {
  background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.2);
  border-radius: var(--r-md); padding: 14px 16px;
}
.recipe-title { font-size: 12px; font-weight: 700; color: var(--clr-emerald); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.recipe-step { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.recipe-step:last-child { margin-bottom: 0; }
.step-num {
  width: 20px; height: 20px; border-radius: 50%; background: var(--clr-emerald);
  color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}

.bot-result {
  font-size: 22px; font-weight: 800; text-align: center; padding: 14px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(16,185,129,0.1), rgba(6,182,212,0.1));
  color: var(--clr-emerald);
}

/* Chat input */
.chat-input-area {
  padding: 16px 24px; border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}
.chat-input-wrap { display: flex; gap: 10px; align-items: flex-end; }
.chat-textarea {
  flex: 1; padding: 12px 16px; border-radius: var(--r-md);
  background: var(--bg-surface); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 15px; resize: none; line-height: 1.5;
  transition: border-color 0.2s;
}
.chat-textarea:focus { outline: none; border-color: var(--clr-emerald); }
.chat-textarea::placeholder { color: var(--text-muted); }

.btn-send {
  width: 46px; height: 46px; border-radius: var(--r-md); flex-shrink: 0;
  background: linear-gradient(135deg, var(--clr-emerald), #059669);
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(16,185,129,0.35); transition: all 0.2s;
}
.btn-send:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(16,185,129,0.5); }
.btn-send:active { transform: translateY(0); }
.chat-hint { font-size: 11px; color: var(--text-muted); margin-top: 8px; }

/* ================================================
   CHOICECALC
   ================================================ */
.choice-layout {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: start;
}
.choice-center-col { min-width: 320px; }

/* Scenario card */
.scenario-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.scenario-badge-letter {
  width: 36px; height: 36px; border-radius: 50%; font-size: 16px; font-weight: 900;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.badge-a { background: rgba(124,58,237,0.2); color: var(--clr-primary-light); border: 2px solid rgba(124,58,237,0.4); }
.badge-b { background: rgba(6,182,212,0.2); color: var(--clr-cyan); border: 2px solid rgba(6,182,212,0.4); }

.scenario-name-input {
  flex: 1; background: transparent; border: none; border-bottom: 1px solid var(--border);
  color: var(--text-primary); font-size: 17px; font-weight: 700; padding: 4px 0;
  transition: border-color 0.2s;
}
.scenario-name-input:focus { outline: none; border-color: var(--clr-primary); }

.scenario-fields { display: flex; flex-direction: column; gap: 12px; }
.sfield label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.curr-input {
  display: flex; align-items: center; border-radius: var(--r-sm);
  border: 1px solid var(--border); overflow: hidden; transition: border-color 0.2s;
}
.curr-input:focus-within { border-color: var(--clr-primary); }
.curr-input span { padding: 9px 10px; color: var(--text-muted); font-size: 13px; background: rgba(255,255,255,0.03); border-right: 1px solid var(--border); }
.sinput { flex: 1; padding: 9px 10px; background: transparent; border: none; color: var(--text-primary); font-size: 14px; font-weight: 600; }
.sinput:focus { outline: none; }
.sinput::placeholder { color: var(--text-muted); font-weight: 400; }

.scenario-total-row {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-secondary);
}
.total-a { color: var(--clr-primary-light); font-size: 17px; font-weight: 800; }
.total-b { color: var(--clr-cyan); font-size: 17px; font-weight: 800; }

/* Choice chart */
.choice-chart-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.chart-title-text { font-size: 13px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.tf-buttons { display: flex; gap: 6px; }
.tf-btn {
  padding: 5px 12px; border-radius: var(--r-full); font-size: 12px; font-weight: 600;
  background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-secondary);
  transition: all 0.2s;
}
.tf-btn:hover { border-color: var(--border-bright); color: var(--text-primary); }
.tf-btn.active { background: var(--sem-active-soft); border-color: var(--sem-active-border); color: #7dd3fc; }

.crossover-info { margin-top: 16px; }
.crossover-badge {
  padding: 10px 16px; border-radius: var(--r-md); font-size: 13px;
  background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.25);
  color: var(--clr-amber); line-height: 1.5;
}
.crossover-badge strong { color: var(--text-primary); }

/* ================================================
   FUTURECALC
   ================================================ */
.future-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.future-input-card,
.future-summary-card,
.future-chart-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.future-system-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.future-system-btn {
  padding: 12px 14px;
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 700;
  transition: all 0.2s var(--ease);
}
.future-system-btn:hover {
  border-color: var(--border-bright);
  color: var(--text-primary);
}
.future-system-btn.active {
  background: rgba(20,184,166,0.14);
  border-color: rgba(20,184,166,0.35);
  color: #99F6E4;
}

.future-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.future-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.future-head-actions .btn-secondary {
  white-space: nowrap;
  border-radius: 14px;
  padding: 9px 14px;
}

.future-textarea {
  width: 100%;
  resize: vertical;
  min-height: 92px;
  padding: 14px 16px;
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
}
.future-textarea:focus {
  outline: none;
  border-color: #14B8A6;
  box-shadow: 0 0 0 2px rgba(20,184,166,0.18);
}
.future-textarea::placeholder { color: var(--text-muted); }

#future-business-panel,
#future-life-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#future-business-type {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23C4B5FD' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 14px center;
  padding-right: 44px;
  border: 1px solid rgba(124,58,237,0.45);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 8px 24px rgba(0,0,0,0.18);
  color: var(--text-primary);
  font-weight: 700;
}

#future-business-type:focus {
  border-color: #A78BFA;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.18), 0 12px 28px rgba(0,0,0,0.22);
}

#future-business-type option {
  background: #171326;
  color: #F8FAFC;
}

.future-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.future-slider-box {
  padding: 14px 16px;
  border-radius: var(--r-lg);
  background: rgba(20,184,166,0.08);
  border: 1px solid rgba(20,184,166,0.22);
}
.future-slider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.future-slider-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
#future-extra-sales-label {
  color: #5EEAD4;
  font-size: 14px;
}
#future-extra-sales {
  width: 100%;
  accent-color: #14B8A6;
}

.future-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.future-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: var(--r-lg);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
}

.future-op-status {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(20,184,166,0.14);
  color: #99F6E4;
}

.future-op-status.is-loading {
  background: rgba(245,158,11,0.16);
  color: #FCD34D;
}

.future-op-status.is-error {
  background: rgba(239,68,68,0.16);
  color: #FCA5A5;
}

.future-op-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.future-run-btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, #0F766E, #14B8A6);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(20,184,166,0.25);
  transition: transform 0.2s, filter 0.2s, box-shadow 0.2s;
}

.future-save-btn {
  min-width: 160px;
  border-radius: var(--r-lg);
  border-color: rgba(20,184,166,0.3);
}
.future-run-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(20,184,166,0.3);
}

.future-output-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.future-macro-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.future-macro-card {
  padding: 14px;
  border-radius: var(--r-lg);
  background: rgba(20,184,166,0.08);
  border: 1px solid rgba(20,184,166,0.22);
}

.future-macro-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.future-macro-value {
  display: block;
  font-size: 19px;
  color: #CCFBF1;
}
.future-macro-input-label {
  display: block;
  margin-top: 12px;
  margin-bottom: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.future-macro-input-wrap {
  min-width: 0;
}
.future-macro-input-wrap span {
  white-space: nowrap;
}
.future-macro-input {
  min-width: 0;
}

.future-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.future-stat {
  padding: 14px;
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  min-height: 88px;
}
.future-stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.future-stat-value {
  display: block;
  font-size: 20px;
  line-height: 1.2;
  color: var(--text-primary);
}

.future-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.future-event {
  padding: 14px 16px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--bg-surface);
}
.future-event-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.future-event-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.future-event-chance {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--r-full);
}
.future-event p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}
.future-event strong { color: var(--text-primary); }

.future-event--optimistic {
  background: rgba(16,185,129,0.08);
  border-color: rgba(16,185,129,0.25);
}
.future-event--optimistic .future-event-chance {
  background: rgba(16,185,129,0.18);
  color: #6EE7B7;
}

.future-event--realistic {
  background: rgba(245,158,11,0.08);
  border-color: rgba(245,158,11,0.25);
}
.future-event--realistic .future-event-chance {
  background: rgba(245,158,11,0.18);
  color: #FCD34D;
}

.future-event--pessimistic {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.24);
}
.future-event--pessimistic .future-event-chance {
  background: rgba(239,68,68,0.16);
  color: #FDA4AF;
}

.future-chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.future-chart-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.future-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.future-history-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.future-history-filter {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.future-history-filter.active {
  background: rgba(20,184,166,0.16);
  border-color: rgba(20,184,166,0.34);
  color: #99F6E4;
}

.future-history-item {
  padding: 12px 14px;
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.future-history-item strong {
  color: var(--text-primary);
}

.future-history-item p {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.future-history-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.future-history-btn {
  padding: 7px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.future-history-btn:hover {
  border-color: var(--border-bright);
  color: var(--text-primary);
}

.future-history-btn.delete:hover {
  border-color: rgba(239,68,68,0.4);
  color: #FCA5A5;
}

.welcome-modal {
  width: 100%;
  max-width: 680px;
  padding: 0;
  overflow: hidden;
}

.welcome-copy {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
}

.welcome-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.welcome-card {
  text-align: left;
  padding: 16px;
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03));
  border: 1px solid var(--border);
  color: var(--text-primary);
  transition: all 0.2s var(--ease);
}

.welcome-card strong {
  display: block;
  font-size: 15px;
  margin-bottom: 6px;
}

.welcome-card span {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.welcome-card:hover {
  transform: translateY(-1px);
  border-color: rgba(124,58,237,0.35);
  box-shadow: 0 10px 26px rgba(0,0,0,0.2);
}

/* ================================================
   CONVERTERS
   ================================================ */
.converter-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
  max-width: 1040px;
  margin: 0 auto;
}
.converter-main-card,
.converter-area-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.converter-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.converter-copy {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}
.converter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.input-modern {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
}
.input-modern:focus {
  outline: none;
  border-color: rgba(14,165,233,0.45);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.14);
}
.input-modern + .ui-select,
.pf-input + .ui-select {
  width: 100%;
}
.input-modern + .ui-select .ui-select-button,
.pf-input + .ui-select .ui-select-button {
  min-height: 48px;
  border-radius: var(--r-md);
}
.input-modern + .ui-select .ui-select-menu,
.pf-input + .ui-select .ui-select-menu {
  border-radius: 18px;
}
.converter-quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.converter-quick-btn {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--sem-off-border);
  background: var(--sem-off-soft);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s var(--ease);
}
.converter-quick-btn:hover {
  border-color: rgba(148,163,184,0.38);
  color: var(--text-primary);
}
.converter-quick-btn.active {
  border-color: var(--sem-active-border);
  background: linear-gradient(135deg, rgba(14,165,233,0.22), rgba(37,99,235,0.10));
  color: #dff4ff;
  box-shadow: 0 10px 24px rgba(14,165,233,0.12);
}
.converter-quick-btn.is-muted-by-parent {
  opacity: 0.48;
  filter: saturate(0.55);
}
.converter-result-card {
  padding: 18px;
  border-radius: var(--r-lg);
  border: 1px solid rgba(14,165,233,0.18);
  background: linear-gradient(180deg, rgba(14,165,233,0.12), rgba(14,165,233,0.05));
}
.converter-result-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.converter-result-value {
  display: block;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #dff4ff;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.converter-result-meta {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
  }
.food-calc-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px;
    border-radius: var(--r-lg);
    border: 1px solid rgba(245,158,11,0.18);
    background: linear-gradient(180deg, rgba(245,158,11,0.10), rgba(249,115,22,0.05));
  }
.food-calc-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
.food-result-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
.food-result-main {
    grid-column: 1 / -1;
  }
.food-reference-card {
    grid-column: 1 / -1;
  }
.converter-area-workspace {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
.converter-area-zone {
  position: relative;
  min-height: 320px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: crosshair;
}
.converter-area-zone canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.converter-area-points-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.converter-area-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 32px;
}
.converter-area-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.area-instructions {
  display: grid;
  gap: 10px;
}
.area-point-status {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.converter-area-point {
  background: #0EA5E9;
  box-shadow: 0 0 16px rgba(14,165,233,0.45);
}
.converter-area-point--reference {
  background: #F97316;
  box-shadow: 0 0 16px rgba(249,115,22,0.45);
}

/* ================================================
   SNAPCALC
   ================================================ */
.snap-layout { display: flex; flex-direction: column; gap: 16px; max-width: 900px; margin: 0 auto; }
.snap-guide-card { padding: 14px; }
.snap-guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.snap-guide-step {
  padding: 14px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: rgba(239,68,68,0.06);
  display: grid;
  gap: 6px;
}
.snap-guide-step strong { font-size: 14px; color: var(--text-primary); }
.snap-guide-step span { font-size: 13px; line-height: 1.5; color: var(--text-secondary); }

.snap-toggle-card {
  padding: 12px; display: flex; gap: 10px; align-items: center;
}
.snap-mode-btn {
  flex: 1; padding: 12px 16px; border-radius: var(--r-md); font-size: 14px; font-weight: 600;
  background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.2s;
}
.snap-mode-btn:hover { background: var(--bg-glass-hover); color: var(--text-primary); }
.snap-mode-btn.active {
  background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.4); color: var(--clr-red);
}

.snap-main-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Camera */
.snap-camera-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.camera-zone {
  position: relative; border-radius: var(--r-md); overflow: hidden;
  background: rgba(0,0,0,0.3); border: 1px solid var(--border);
  min-height: 300px; display: flex; align-items: center; justify-content: center;
  cursor: crosshair;
}
.camera-zone video, .camera-zone canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
#snap-canvas { display: none; }
.snap-crop-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  cursor: crosshair;
}
.snap-crop-box {
  position: absolute;
  border: 2px solid rgba(34, 211, 238, 0.95);
  background: rgba(34, 211, 238, 0.12);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.28);
  border-radius: 12px;
}

.cam-placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 32px; }
.cam-placeholder-icon { font-size: 36px; opacity: 0.4; }
.cam-placeholder p { color: var(--text-secondary); font-size: 14px; }
.cam-placeholder small { color: var(--text-muted); font-size: 12px; }

/* Scanning overlay */
.scanning-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
}
.scan-line {
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--clr-red), transparent);
  animation: scanMove 2s linear infinite;
}
@keyframes scanMove {
  0% { top: 0; }
  50% { top: calc(100% - 2px); }
  100% { top: 0; }
}
.scan-label { color: var(--clr-red); font-size: 14px; font-weight: 600; text-shadow: 0 0 20px currentColor; }

/* Area points */
.area-points-layer { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
.area-point {
  position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px;
  border-radius: 50%; background: var(--clr-red); color: #fff;
  font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 16px rgba(239,68,68,0.6); animation: pointPop 0.3s var(--ease) backwards;
  pointer-events: all; cursor: pointer;
}
@keyframes pointPop { from { transform: scale(0); } to { transform: scale(1); } }

.cam-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.cam-btn {
  flex: 1; min-width: 80px; padding: 10px 12px; border-radius: var(--r-md);
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  background: var(--bg-surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all 0.2s; cursor: pointer;
}
.cam-btn:hover { background: var(--bg-glass-hover); color: var(--text-primary); border-color: var(--border-bright); }
.snap-crop-help {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Results panel */
.snap-results-card { padding: 24px; }
.snap-placeholder { color: var(--text-muted); font-size: 14px; text-align: center; padding: 40px 20px; }

/* OCR results */
.ocr-text-raw { background: var(--bg-surface); border-radius: var(--r-md); padding: 12px; margin-bottom: 14px; }
.ocr-text-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; margin-bottom: 8px; }
.ocr-text-content { font-size: 13px; color: var(--text-secondary); line-height: 1.5; white-space: pre-wrap; word-break: break-word; }

.ocr-expression-card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--clr-red) 12%, var(--bg-surface)) 0%, var(--bg-surface) 100%);
  border: 1px solid color-mix(in srgb, var(--clr-red) 22%, var(--border));
  border-radius: var(--r-lg);
  padding: 14px;
  margin-bottom: 14px;
}
.ocr-expression-text {
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--text-primary);
  word-break: break-word;
}
.ocr-expression-result {
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 13px;
}

.ocr-numbers-label { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.ocr-edit-hint { font-size: 12px; color: var(--text-secondary); margin-bottom: 10px; line-height: 1.5; }
.number-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.number-chip {
  padding: 5px 10px; border-radius: var(--r-full); font-size: 13px; font-weight: 600;
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25); color: var(--clr-red);
}
.ocr-manual-editor { display: grid; gap: 10px; margin-bottom: 14px; }
.ocr-manual-input { min-height: 92px; resize: vertical; }

.ocr-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ocr-stat {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 10px; text-align: center;
}
.ocr-stat-label { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.ocr-stat-value { display: block; font-size: 14px; font-weight: 700; color: var(--text-primary); }
.snap-actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* Area mode results */
.area-instructions p { font-size: 14px; color: var(--text-secondary); margin-bottom: 12px; line-height: 1.5; }
.area-point-status { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.apt {
  padding: 5px 10px; border-radius: var(--r-full); font-size: 13px;
  background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-muted);
  transition: all 0.2s;
}
.apt.marked { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.4); color: var(--clr-red); }

.scale-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.scale-input {
  width: 80px; padding: 7px 10px; border-radius: var(--r-sm);
  background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-primary);
  font-size: 14px; font-weight: 600; text-align: center;
}
.scale-input:focus { outline: none; border-color: var(--clr-red); }
.scale-unit { color: var(--text-secondary); font-size: 13px; }

.area-result-display { text-align: center; padding: 24px; background: var(--bg-surface); border-radius: var(--r-lg); border: 1px solid var(--border); }
.area-result-val {
  font-size: 48px; font-weight: 900; line-height: 1;
  background: linear-gradient(135deg, var(--clr-red), var(--clr-amber));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.area-result-unit { font-size: 16px; color: var(--text-secondary); margin-top: 6px; }
.area-result-display small {
  display: block;
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 12px;
}

/* OCR Loader */
.ocr-loader { padding: 24px; text-align: center; }
.loader-text { font-size: 14px; color: var(--text-secondary); margin-bottom: 12px; }
.loader-track { height: 4px; background: var(--bg-surface); border-radius: var(--r-full); overflow: hidden; }
.loader-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--clr-red), var(--clr-amber)); border-radius: var(--r-full); transition: width 0.3s var(--ease); }

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 1100px) {
  .choice-layout {
    grid-template-columns: 1fr;
  }
  .choice-center-col { min-width: unset; order: 3; }

  .future-layout {
    grid-template-columns: 1fr;
  }

  .converter-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .life-layout { grid-template-columns: 1fr; }
  .converter-grid { grid-template-columns: 1fr; }
  .food-calc-grid { grid-template-columns: 1fr; }
  .food-result-grid { grid-template-columns: 1fr; }
  .interest-highlight-row { grid-template-columns: 1fr; }
  .converter-interest-grid { grid-template-columns: 1fr 1fr; }
  .interest-result-grid { grid-template-columns: 1fr; }
  .interest-result-card { grid-column: auto; }
  .interest-insights-grid { grid-template-columns: 1fr; }
  .financing-results-grid .interest-result-card { grid-column: auto; }
  .snap-guide-grid { grid-template-columns: 1fr; }
  .snap-main-row { grid-template-columns: 1fr; }
  .future-grid,
  .future-stat-grid,
  .future-macro-strip { grid-template-columns: 1fr; }

  .future-action-row {
    grid-template-columns: 1fr;
  }

  .welcome-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  html { font-size: 13px; }
  body { width: 100%; max-width: 100vw; }
  .main {
    width: 100%;
    min-width: 0;
    padding: 10px 8px 76px;
    height: 100dvh;
    overflow-x: hidden;
  }
  .sidebar { position: fixed; z-index: 200; height: 100%; transform: translateX(-100%); width: var(--sidebar-w); transition: transform 0.35s var(--ease); }
  .sidebar.mobile-open { transform: translateX(0); }
  .mode {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .mode-header { margin-bottom: 10px; }
  .mode-badge {
    max-width: 100%;
    white-space: normal;
    line-height: 1.25;
  }
    padding: 5px 10px;
    font-size: 10px;
  }
  .mode-title { font-size: clamp(18px, 6vw, 22px); line-height: 1.1; }
  .mode-subtitle { font-size: 12px; line-height: 1.35; }
  .glass-card {
    padding: 12px;
    border-radius: 16px;
  }
  .glass-card:hover {
    transform: none;
  }
  .standalone-card-shell,
  .ask-layout,
  .converter-card-shell,
  .flow-layout,
  .flow-keyboard,
  .flow-blocks-wrapper {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .flow-result-area {
    padding: 12px;
    border-radius: 14px;
  }
  .flow-result { font-size: clamp(28px, 12vw, 38px); overflow-wrap: anywhere; }
  .flow-keyboard-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .flow-calc-modes,
  .flow-eval-toggle {
    width: 100%;
    min-width: 0;
  }
  .flow-eval-toggle {
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .flow-expression,
  .converter-result-value,
  .impact-value,
  .future-main-result {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  /* Stat values: never break mid-number; truncate if needed */
  .interest-stat-value {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: normal;
    overflow-wrap: normal;
  }
  .keyboard-grid { gap: 7px; }
  .key {
    height: 44px;
    font-size: 15px;
    border-radius: 12px;
    min-width: 0;
    padding-inline: 0;
  }
  .life-layout { grid-template-columns: 1fr; }
  .choice-layout { grid-template-columns: 1fr; }
  .converter-result-value { font-size: 26px; }
  .snap-main-row { grid-template-columns: 1fr; }
  .converter-interest-grid,
  .converter-grid,
  .food-calc-grid,
  .food-result-grid,
  .interest-result-grid,
  .labor-result-grid,
  .financing-results-grid,
  .future-grid,
  .future-stat-grid,
  .material-view-grid,
  .travel-view-grid {
    grid-template-columns: 1fr !important;
  }
  .interest-result-card,
  .financing-results-grid .interest-result-card,
  .food-result-main,
  .food-reference-card {
    grid-column: auto / span 1 !important;
  }
  .glass-card,
  .travel-card,
  .converter-main-card,
  .optional-blocks-card,
  .finance-view,
  .interest-stat-card,
  .interest-insight-card,
  .travel-extra-field,
  .converter-result-card,
  .keyboard-grid {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  .optional-blocks-row,
  .converter-quick-row,
  .finance-switcher {
    gap: 8px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
  }
  .converter-quick-btn,
  .finance-switch-btn {
    flex: 0 0 auto;
    max-width: min(78vw, 260px);
    min-height: 32px;
    padding-inline: 11px;
    font-size: 12px;
    white-space: nowrap;
    scroll-snap-align: start;
  }
  .input-modern,
  .input-prefix-group input,
  textarea {
    font-size: 16px;
    min-width: 0;
  }
  .interest-stat-card,
  .converter-result-card,
  .future-stat,
  .future-macro-card {
    padding: 14px;
  }
  .interest-stat-value {
    font-size: clamp(18px, 7vw, 24px);
  }
  .toast-container {
    left: 10px;
    right: 10px;
    bottom: 80px;
  }
  .toast {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 420px) {
  html { font-size: 12px; }
  .main { padding-inline: 7px; }
  .glass-card { padding: 10px; }
  .mode-title { font-size: 18px; }
  .mode-subtitle { display: none; }
  .card-title { margin-bottom: 10px; }
  .flow-keyboard-toolbar,
  .flow-templates-wrap,
  .flow-blocks-wrapper,
  .optional-blocks-card,
  .converter-main-card,
  .food-calc-card {
    gap: 10px;
  }
  .flow-result { font-size: 28px; }
  .converter-result-value { font-size: 22px; }
  .flow-mode-btn,
  .flow-eval-btn {
    min-height: 36px;
    padding-inline: 12px;
    font-size: 11px;
  }
  .flow-keyboard-toolbar {
    gap: 10px;
  }
  .interest-stat-value {
    font-size: clamp(13px, 3.8vw, 17px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .interest-stat-label,
  .converter-result-label,
  .future-stat-label {
    font-size: 10px;
  }
  .optional-blocks-row,
  .converter-quick-row {
    overflow-x: visible;
    flex-wrap: wrap;
    padding-bottom: 0;
  }
  .converter-quick-btn {
    max-width: 100%;
  }
  .interest-stat-card {
    padding: 12px;
    border-radius: 16px;
  }
  .interest-result-grid,
  .food-result-grid,
  .labor-result-grid {
    gap: 10px;
  }
  .keyboard-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .finance-switch-btn {
    min-height: 40px;
    padding-inline: 14px;
    font-size: 13px;
  }
  .input-modern {
    min-height: 42px;
    padding: 9px 10px;
  }
  .flow-top-actions,
  .converter-area-controls,
  .future-action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .btn-icon-sm,
  .btn-secondary,
  .cam-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ================================================
   NEW v2 FEATURES
   ================================================ */

/* ---------- Sidebar Footer Buttons (v3 — unified) ---------- */
.sidebar-footer {
  padding: 12px 10px; border-top: 1px solid var(--border);
  display: grid; gap: 6px;
}
/* Profile icon — mesmo estilo dos link-btns, mas horizontal com ícone + label */
.sidebar-icon-btn {
  width: 100%; height: 36px; border-radius: 10px;
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--bg-surface); border: 1px solid var(--border);
  color: var(--text-secondary); transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.sidebar-icon-btn:hover {
  background: var(--bg-glass-hover); border-color: rgba(124,58,237,0.45);
  color: var(--clr-primary-light);
}
.sidebar-profile-label {
  font-size: 12px; font-weight: 600;
}
.sidebar.collapsed .sidebar-profile-label { display: none; }

/* Todos os link-btns compartilham um único estilo neutro */
.sidebar-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-direction: column;
  width: 100%;
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}
.sidebar-link-btn small {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.2;
}
.brand-link-kicker {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
/* Hover unificado */
.sidebar-link-btn:hover {
  transform: translateY(-1px);
  background: var(--bg-glass-hover);
  border-color: var(--border-bright);
  color: var(--text-primary);
}
/* Variantes: toque de cor na marca no hover */
.sidebar-link-btn--install:hover  { border-color: rgba(56,189,248,0.45); color: #93c5fd; }
.sidebar-link-btn--finance:hover  { border-color: rgba(45,212,191,0.45); color: #6ee7b7; }
.sidebar-link-btn--brand:hover    { border-color: rgba(96,165,250,0.45); color: #93c5fd; }
.sidebar-link-btn--brand:hover .brand-link-icon { border-color: rgba(96,165,250,0.45); color: #93c5fd; }
.sidebar-link-btn--brand:hover .brand-link-kicker { color: rgba(147,197,253,0.7); }
.sidebar-link-btn--youtube:hover  { border-color: rgba(239,68,68,0.45); color: #fca5a5; }

.brand-link-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand-link-icon {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}
.version-tag { font-size: 10px; color: var(--text-muted); white-space: nowrap; text-align: center; opacity: 0.7; }
.sidebar.collapsed .version-tag { display: none; }
.sidebar.collapsed .sidebar-icon-btn { display: none; }
.sidebar.collapsed .sidebar-link-btn { display: none; }

/* ---------- Templates ---------- */
.flow-templates-wrap {
  margin-bottom: 20px; max-width: 680px; margin-left: auto; margin-right: auto;
}
.templates-header {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap;
}
.templates-toggle {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  padding: 0;
}
.templates-title { font-size: 13px; font-weight: 700; color: var(--text-secondary); }
.templates-hint { font-size: 11px; color: var(--text-muted); }
.templates-caret {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 16px;
  transition: transform 0.2s var(--ease);
}
.flow-templates-wrap.collapsed .templates-caret {
  transform: rotate(-180deg);
}

.flow-templates-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  width: 100%;
}
.flow-templates-wrap.collapsed .flow-templates-list {
  display: none;
}

.tpl-card {
  width: 100%;
  min-width: 0;
  padding: 12px 16px; border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--tpl-color, #7C3AED) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--tpl-color, #7C3AED) 25%, transparent);
  display: flex; flex-direction: column; gap: 4px; text-align: left;
  cursor: pointer; transition: all 0.25s var(--ease);
}
.tpl-card:hover {
  background: color-mix(in srgb, var(--tpl-color, #7C3AED) 18%, transparent);
  border-color: color-mix(in srgb, var(--tpl-color, #7C3AED) 50%, transparent);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--tpl-color, #7C3AED) 20%, transparent);
}
.tpl-card:active { transform: translateY(0); }
.tpl-icon { font-size: 22px; line-height: 1; }
.tpl-name { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.tpl-desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; }

@media (max-width: 560px) {
  .flow-templates-wrap {
    margin-bottom: 12px;
  }

  .flow-templates-list {
    grid-template-columns: 1fr;
  }
}

/* ---------- Share Button ---------- */
.btn-share {
  background: rgba(168,85,247,0.1); border-color: rgba(168,85,247,0.3) !important;
}
.btn-share:hover {
  background: rgba(168,85,247,0.2) !important;
  border-color: rgba(168,85,247,0.5) !important;
  color: #c084fc !important;
}

/* ---------- Chip Label (Template chips) ---------- */
.flow-chip {
  flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 6px 10px;
}
/* Override inline-flex to allow labels above value */
.flow-chip:not(.has-label) { flex-direction: row; align-items: center; gap: 6px; }

.chip-label {
  font-size: 9px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text-muted); white-space: nowrap;
  line-height: 1;
}
.chip-inner-row { display: flex; align-items: center; gap: 6px; width: 100%; }

/* Re-style chip when it has a label */
.flow-chip { flex-direction: column; align-items: flex-start; }
.chip-value-row { display: flex; align-items: center; gap: 6px; }

/* ---------- Chip Inline Edit ---------- */
.chip-edit-input {
  width: 80px; padding: 2px 6px; border-radius: var(--r-sm);
  background: rgba(255,255,255,0.12); border: 1px solid var(--clr-primary);
  color: var(--text-primary); font-size: 15px; font-weight: 600;
  font-family: inherit; text-align: center;
}
.chip-edit-input:focus { outline: none; box-shadow: 0 0 0 2px var(--clr-primary-glow); }
.chip-edit-select {
  min-width: 78px;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--clr-primary);
  background: rgba(21,18,38,0.96);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
}
.chip-edit-select:focus { outline: none; box-shadow: 0 0 0 2px var(--clr-primary-glow); }
.chip-label-input {
  min-width: 90px;
  padding: 3px 6px;
  border-radius: var(--r-sm);
  border: 1px solid var(--clr-primary);
  background: rgba(255,255,255,0.10);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: inherit;
}
.chip-label-input:focus { outline: none; box-shadow: 0 0 0 2px var(--clr-primary-glow); }
.flow-chip.editing { border-color: var(--clr-primary); box-shadow: 0 0 12px var(--clr-primary-glow); }

/* ---------- Flow Result Impact Animation ---------- */
@keyframes resultImpact {
  0%   { transform: scale(1); filter: brightness(1); }
  15%  { transform: scale(1.12); filter: brightness(1.6) drop-shadow(0 0 20px var(--clr-primary)); }
  35%  { transform: scale(0.94); filter: brightness(1.2); }
  55%  { transform: scale(1.05); }
  75%  { transform: scale(0.98); }
  100% { transform: scale(1); filter: brightness(1); }
}
.flow-result.impact {
  animation: resultImpact 0.55s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes bigResultShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* ---------- Suggestion Bubbles ---------- */
.flow-suggestion {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 10px; padding: 10px 14px; border-radius: var(--r-md);
  background: rgba(6,182,212,0.08); border: 1px solid rgba(6,182,212,0.2);
  font-size: 13px; color: var(--text-secondary); line-height: 1.5;
  animation: modeFadeIn 0.4s var(--ease);
}
.flow-suggestion strong { color: var(--clr-cyan); }
.flow-suggestion button {
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(6,182,212,0.2); border: 1px solid rgba(6,182,212,0.3);
  color: var(--clr-cyan); font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.flow-suggestion button:hover { background: rgba(6,182,212,0.4); transform: scale(1.15); }

.life-suggestion {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 12px; padding: 10px 14px; border-radius: var(--r-md);
  background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.2);
  font-size: 13px; color: var(--text-secondary); line-height: 1.5;
  animation: modeFadeIn 0.4s var(--ease);
}
.life-suggestion strong { color: var(--clr-amber); }

/* ---------- Impact Warning (LifeCalc) ---------- */
.impact-big .time-value {
  background: linear-gradient(135deg, var(--clr-red), var(--clr-amber));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.impact-warning {
  margin-top: 8px; padding: 8px 14px; border-radius: var(--r-md);
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25);
  color: #fca5a5; font-size: 13px;
}

/* ---------- Profile Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  padding: 16px; opacity: 0; transition: opacity 0.3s var(--ease);
}
.modal-backdrop.visible { opacity: 1; }

.profile-modal {
  width: 100%; max-width: 440px; max-height: min(88vh, 920px); padding: 0; overflow: hidden;
  border-radius: var(--r-xl);
  display: flex;
  flex-direction: column;
  transform: scale(0.92); transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-backdrop.visible .profile-modal { transform: scale(1); }
.install-modal {
  width: min(1040px, 100%);
  max-height: min(88vh, 920px);
  padding: 0;
  overflow: hidden;
  border-radius: var(--r-xl);
  transform: scale(0.94);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-backdrop.visible .install-modal { transform: scale(1); }
.install-subtitle {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}
.install-modal-body {
  gap: 18px;
}
.install-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.install-choice {
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 700;
  transition: all 0.2s var(--ease);
}
.install-choice:hover {
  border-color: var(--border-bright);
  color: var(--text-primary);
  transform: translateY(-1px);
}
.install-choice.active {
  color: #fff;
  border-color: rgba(124,58,237,0.45);
  background: linear-gradient(135deg, rgba(124,58,237,0.28), rgba(6,182,212,0.18));
  box-shadow: 0 16px 36px rgba(124,58,237,0.18);
}
.install-frame-shell {
  min-height: 60vh;
  height: min(68vh, 720px);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(5, 5, 12, 0.72);
}
.install-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #09070f;
}

.converter-interest-card {
  grid-column: 1 / -1;
}
.finance-switcher {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  margin-bottom: 18px;
}
.finance-switch-btn {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--sem-off-border);
  background: var(--sem-off-soft);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 800;
  transition: all 0.2s var(--ease);
}
.finance-switch-btn:hover {
  color: var(--text-primary);
  border-color: rgba(148,163,184,0.34);
}
.finance-switch-btn.active {
  color: #fff;
  border-color: var(--sem-active-border);
  background: linear-gradient(135deg, rgba(14,165,233,0.24), rgba(6,182,212,0.14));
  box-shadow: 0 14px 28px rgba(14,165,233,0.14);
}
.finance-view {
  display: none;
}
.finance-view.active {
  display: block;
}
.interest-highlight-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.interest-highlight-card {
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid rgba(124,58,237,0.22);
  background: linear-gradient(135deg, rgba(124,58,237,0.14), rgba(6,182,212,0.08));
  display: grid;
  gap: 6px;
}
.interest-highlight-card--soft {
  border-color: var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
}
.interest-highlight-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}
.converter-interest-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.interest-inline {
  position: relative;
}
.interest-inline .input-modern {
  padding-right: 48px;
}
.interest-inline .input-modern:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.interest-suffix {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
}
.interest-result-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}
.interest-result-card {
  min-height: 100%;
  grid-column: span 3;
}
.interest-stat-card {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
}
.interest-stat-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.interest-stat-value {
  font-size: clamp(16px, 2.6vw, 34px);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  min-width: 0;
}
.interest-insights-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.interest-insight-card {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  display: grid;
  gap: 10px;
}
.interest-financing-block {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 16px;
}
.financing-results-grid .interest-result-card {
  grid-column: span 3;
}
.financing-chart-shell {
  height: 280px;
}
.loan-table-shell {
  max-height: 280px;
  overflow: auto;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
}
.loan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.loan-table th,
.loan-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.loan-table th {
  position: sticky;
  top: 0;
  background: rgba(10, 8, 20, 0.94);
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
html[data-theme="light"] .loan-table th {
  background: rgba(255,255,255,0.96);
}
.loan-table td {
  color: var(--text-primary);
}
.loan-table tr:last-child td {
  border-bottom: none;
}
.interest-compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.interest-compare-item {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  display: grid;
  gap: 6px;
}
.interest-compare-item span {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 700;
}
.interest-compare-item strong {
  font-size: 20px;
  color: var(--text-primary);
}
.mobile-nav-link {
  grid-column: 1 / -1;
  min-width: 0;
  min-height: 60px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 18px;
  border: 1px solid rgba(45,212,191,0.24);
  background: linear-gradient(135deg, rgba(16,185,129,0.18), rgba(6,182,212,0.10));
  color: var(--text-primary);
  text-align: left;
}
.mobile-nav-link:hover {
  border-color: rgba(45,212,191,0.42);
}
.mobile-nav-link--install {
  border-color: rgba(56,189,248,0.28);
  background: linear-gradient(135deg, rgba(14,165,233,0.16), rgba(37,99,235,0.10));
}
.mobile-nav-link--install:hover {
  border-color: rgba(56,189,248,0.46);
}
.mobile-nav-link--finance .nav-icon {
  width: 36px;
  height: 36px;
  font-size: 18px;
  border-radius: 12px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mobile-nav-link--finance .nav-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mobile-nav-link--profile {
  border-color: rgba(124,58,237,0.24);
  background: linear-gradient(135deg, rgba(124,58,237,0.14), rgba(59,130,246,0.08));
}
.mobile-nav-link--profile:hover {
  border-color: rgba(124,58,237,0.42);
}
.mobile-nav-link--brand {
  border-color: rgba(148,163,184,0.24);
  background: linear-gradient(135deg, rgba(148,163,184,0.14), rgba(51,65,85,0.10));
}
.mobile-nav-link--brand:hover {
  border-color: rgba(148,163,184,0.42);
}
.mobile-nav-link--brand .nav-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mobile-nav-link--brand .nav-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.nav-icon--brand {
  width: 36px;
  height: 36px;
  font-size: 16px;
  font-weight: 800;
  border-radius: 12px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(99,102,241,0.32), rgba(56,189,248,0.18));
  color: #eef2ff;
  border: 1px solid rgba(129,140,248,0.28);
}
.mobile-nav-link--youtube {
  border-color: rgba(239,68,68,0.28);
  background: linear-gradient(135deg, rgba(239,68,68,0.18), rgba(127,29,29,0.10));
}
.mobile-nav-link--youtube:hover {
  border-color: rgba(239,68,68,0.46);
}

@media (max-width: 700px) {
  .profile-pref-grid {
      grid-template-columns: 1fr;
    }
  .modal-backdrop {
    align-items: flex-start;
    padding: 12px 10px;
    overflow-y: auto;
  }
  .profile-modal {
    max-height: calc(100dvh - 24px);
    margin: 0 auto;
    border-radius: 20px;
  }
  .modal-header {
    padding: 16px 18px 14px;
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(14,12,24,0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }
  .modal-body {
    padding: 16px 18px 18px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .profile-section {
    padding: 14px;
    border-radius: 18px;
  }
  .profile-section-title {
    font-size: 14px;
  }
  .toggle-row {
    align-items: flex-start;
  }
}

@media (max-width: 860px) {
  .install-switcher {
    grid-template-columns: 1fr;
  }

  .install-frame-shell {
    height: 62vh;
  }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 18px; font-weight: 800; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-surface); border: 1px solid var(--border);
  color: var(--text-secondary); font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.modal-close:hover { background: rgba(239,68,68,0.2); border-color: rgba(239,68,68,0.4); color: var(--clr-red); }

.modal-body {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow-y: auto;
}
.profile-layout { gap: 14px; }
.profile-section {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
  border-radius: 20px;
  padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.profile-section-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
.profile-section-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.profile-section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.profile-section-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-group { display: flex; flex-direction: column; gap: 6px; }
.profile-pref-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.profile-pref-item {
  min-width: 0;
}
.profile-pref-item .language-select,
.profile-pref-item .ui-select {
  width: 100%;
}
.pf-input {
    padding: 10px 14px; border-radius: var(--r-md);
    background: var(--bg-surface); border: 1px solid var(--border);
    color: var(--text-primary); font-size: 15px; font-weight: 600; font-family: inherit;
    transition: border-color 0.2s;
}
.pf-input:focus { outline: none; border-color: var(--clr-primary); }
.pf-input::placeholder { color: var(--text-muted); font-weight: 400; }
.field-hint { font-size: 11px; color: var(--text-muted); line-height: 1.4; }

.modal-toggles { display: flex; flex-direction: column; gap: 12px; }

.toggle-row {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }
.toggle-row:last-child { border-bottom: none; padding-bottom: 0; }
.toggle-info { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.toggle-label { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.toggle-desc { font-size: 12px; color: var(--text-muted); }

/* Toggle Switch */
.toggle-btn {
  width: 44px; height: 24px; border-radius: var(--r-full); padding: 2px;
  background: rgba(255,255,255,0.08); border: 1px solid var(--border);
  cursor: pointer; transition: all 0.3s var(--ease); flex-shrink: 0;
  display: flex; align-items: center;
}
.toggle-btn.on { background: var(--sem-confirm); border-color: var(--sem-confirm); }
.toggle-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: rgba(255,255,255,0.5);
  transition: transform 0.3s var(--ease);
}
.toggle-btn.on .toggle-thumb { transform: translateX(20px); background: #fff; }

.btn-save-profile {
  width: 100%; padding: 13px; border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--clr-primary), #A855F7);
  color: #fff; font-size: 15px; font-weight: 700; font-family: inherit;
  border: none; cursor: pointer; transition: all 0.2s;
  box-shadow: 0 4px 20px var(--clr-primary-glow);
}
.btn-save-profile:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 8px 28px var(--clr-primary-glow); }
.btn-save-profile:active { transform: translateY(0); }
.profile-modal .modal-body {
  flex: 1 1 auto;
  padding-bottom: 96px;
}
.profile-modal .btn-save-profile {
  flex-shrink: 0;
  margin: 0 24px 24px;
}

.mobile-nav-fab,
.mobile-nav-panel {
  display: none;
}

@media (max-width: 700px) {
  html,
  body {
    min-height: 100%;
    display: block;
    overflow-x: hidden;
  }

  .sidebar {
    display: none !important;
  }

  .mobile-nav-fab {
    display: inline-flex;
    position: fixed;
    right: 12px;
    bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    z-index: 420;
    width: 56px;
    height: 56px;
    border-radius: 18px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: rgba(8, 8, 18, 0.94);
    color: var(--text-primary);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    font-size: 30px;
    line-height: 1;
  }
  .mobile-nav-fab span {
    display: block;
    transform: translateY(-2px);
    color: currentColor;
    font-weight: 700;
  }

  html[data-theme="light"] .mobile-nav-fab {
    background: rgba(255, 255, 255, 0.96);
    color: #111827;
    border-color: rgba(15, 23, 42, 0.14);
  }

  .mobile-nav-panel {
    position: fixed;
    inset: 0;
    z-index: 419;
    background: rgba(7, 7, 16, 0.3);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 16px;
  }

  .mobile-nav-panel.open {
    display: block;
  }

  .mobile-nav-sheet {
    position: absolute;
    right: 12px;
    bottom: 80px;
    width: min(320px, calc(100vw - 24px));
    max-height: calc(100dvh - 116px);
    min-height: min(520px, calc(100dvh - 140px));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px;
    border-radius: 24px;
    border: 1px solid var(--border);
    background: rgba(8, 8, 18, 0.96);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 22px 46px rgba(0, 0, 0, 0.34);
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  html[data-theme="light"] .mobile-nav-sheet {
    background: rgba(255, 255, 255, 0.97);
  }

  .mobile-nav-item {
    min-width: 0;
    padding: 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    color: var(--text-primary);
    text-align: left;
  }

  .mobile-nav-item.active {
    border-color: rgba(124, 58, 237, 0.28);
    background: rgba(124, 58, 237, 0.12);
  }

  .mobile-nav-item .nav-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
    border-radius: 12px;
    flex-shrink: 0;
  }

  .mobile-nav-item .nav-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 1 !important;
    pointer-events: auto !important;
    text-align: left;
    min-width: 0;
    flex: 1;
  }

  .mobile-nav-item .nav-name {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    white-space: normal;
    word-break: break-word;
  }

  .mobile-nav-item .nav-desc {
    display: block !important;
    font-size: 12px;
    line-height: 1.25;
    white-space: normal;
    word-break: break-word;
  }

  .main {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    padding: 16px 16px calc(92px + env(safe-area-inset-bottom, 0px));
  }

  .converter-interest-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .interest-compare-grid {
    grid-template-columns: 1fr;
  }

  .mobile-nav-link {
    min-height: 72px;
  }

  .mode {
    padding-bottom: 12px;
  }
}

@media (min-width: 430px) and (max-width: 700px) {
  .mobile-nav-sheet {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-nav-item {
    min-height: 88px;
  }
}

/* ═══════════════════════════════════════════════
   EXTRA DEFENSIVE RESPONSIVE RULES
   Garante layout 1 coluna em telas muito pequenas
   e evita quebra de números em stat cards.
   ═══════════════════════════════════════════════ */
@media (max-width: 600px) {
  /* Force single-column grids on very small screens */
  .interest-result-grid,
  .financing-results-grid,
  .converter-interest-grid,
  .interest-insights-grid,
  .interest-compare-grid,
  .interest-highlight-row,
  .food-result-grid,
  .food-calc-grid,
  .labor-result-grid,
  .future-stat-grid {
    grid-template-columns: 1fr !important;
  }

  /* Stat values: never break mid-number */
  .interest-stat-value,
  .converter-result-value {
    font-size: clamp(14px, 4.5vw, 22px) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: normal;
    overflow-wrap: normal;
  }

  /* Ensure cards don't overflow their container */
  .interest-stat-card,
  .converter-result-card,
  .future-stat,
  .future-macro-card {
    min-width: 0;
    overflow: hidden;
  }

  /* Back button visible on mobile */
  .mobile-back-btn {
    display: inline-flex !important;
  }
}

/* Mobile back button style */
.mobile-back-btn {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  transition: all 0.2s;
  cursor: pointer;
}
.mobile-back-btn:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  border-color: var(--border-bright);
}
.mobile-back-btn svg {
  flex-shrink: 0;
}
html[data-theme="light"] .mobile-back-btn {
  background: rgba(255,255,255,0.82);
  border-color: rgba(15,23,42,0.14);
  color: var(--text-secondary);
}

@media (max-width: 700px) {
  .modal-backdrop {
    align-items: flex-start;
    padding: 12px 10px;
    overflow-y: auto;
  }

  .profile-modal {
    max-height: calc(100dvh - 24px);
    margin: 0 auto;
    border-radius: 20px;
  }

  .profile-modal .modal-header {
    padding: 16px 18px 14px;
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(14,12,24,0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .profile-modal .modal-body {
    padding: 16px 18px 96px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .profile-modal .btn-save-profile {
    margin: 0 18px 18px;
  }
}
