/* =====================================================
   VARIABLES.CSS — Design tokens, :root, tema, font
   Menerapkan Palet #EFF0F4, #6192FC, #11358B, #C7EF66
   ===================================================== */
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../fonts/ibm-plex-sans-latin-700-normal.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  /* Lebar konten halaman */
  --page: min(100vw - 24px, 1680px);

  /* ---------- NEW PALETTE (Base) ---------- */
  --color-white: #FFFFFF;
  --color-bg: #EFF0F4;
  --color-blue-light: #6192FC;
  --color-blue-dark: #11358B;
  --color-lime: #C7EF66;

  /* Red colors for Unplanned & Minor Stops (DO NOT CHANGE) */
  --danger-600:  #DC2626;
  --danger-bg:   #FDEAEA;

  /* ---------- Light Theme Mappings ---------- */
  --bg-page:          var(--color-bg);
  --bg-surface:       var(--color-white);
  --bg-surface-hover: #E4E7F0; /* Sedikit lebih gelap dari bg */
  --bg-selected:      #EBF1FF; /* Biru sangat tipis */
  
  --border-default:   #DCE0E8;
  --border-strong:    #BCC4D4;
  
  --text-primary:     var(--color-blue-dark);
  --text-secondary:   #2E4A7D;
  --text-muted:       #6C7D9E;
  --text-on-brand:    var(--color-white);

  /* Brand Accents */
  --brand-900: var(--color-blue-dark);
  --brand-700: var(--color-blue-dark);
  --brand-600: var(--color-blue-light); /* Dipakai untuk primary actions / buttons */
  --brand-500: #4B7AF2; /* Hover state dari blue-light */
  --brand-100: #D8E5FF;
  --brand-50:  #EBF1FF;

  /* Semantic Status */
  --success-600: #8CA948; /* Lime digelapkan sedikit untuk teks agar terbaca di background terang */
  --success-bg:  #F7FCE5; /* Background sangat tipis dari lime */
  --warning-700: #B45309; /* Tetap amber/oranye untuk planned downtime */
  --warning-bg:  #FEF3E2;

  /* Kategori kode downtime (Log Sheet) */
  --dt-unplanned:     var(--danger-600);
  --dt-unplanned-bg:  var(--danger-bg);
  --dt-planned:       var(--warning-700);
  --dt-planned-bg:    var(--warning-bg);
  --dt-produksi:      var(--success-600);
  --dt-produksi-bg:   var(--success-bg);

  /* OEE Status */
  --oee-tercapai:   var(--success-600);
  --oee-mendekati:  var(--warning-700);
  --oee-dibawah:    var(--danger-600);

  /* ---------- Tipografi, Spacing, Radius ---------- */
  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --fs-h1: 26px; --fs-h2: 19px; --fs-h3: 15px; --fs-body: 14px; --fs-label: 12px; --fs-caption: 11px;
  --fs-num-lg: 30px; --fs-num-md: 20px; --fs-num-table: 13px;
  --lh-body: 1.5;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --space-8: 32px;
  --radius-card: 12px; --radius-control: 8px; --radius-badge: 6px; --radius-pill: 999px;
  --transition-fast: 150ms ease; --transition-base: 200ms ease;

  --shadow-overlay: 0 8px 30px rgba(17, 53, 139, 0.15);

  /* ALIAS MUNDUR-KOMPATIBEL (Menimpa hardcode warna-warni lama) */
  --ink: var(--text-primary); --ink2: var(--text-secondary); --mut: var(--text-muted);
  --paper: var(--bg-page); --card: var(--bg-surface); --line: var(--border-default); --line2: var(--border-strong);
  --navy: var(--brand-900); --blue: var(--brand-600);
  --green: var(--success-600); --green-d: var(--success-600); --green-bg: var(--success-bg);
  --amber: var(--warning-700); --red: var(--danger-600);
  --mono: var(--font-sans); --disp: var(--font-sans); --body: var(--font-sans);
}

/* ---------- Mode Gelap (Harmonis dengan palet biru) ---------- */
[data-theme="dark"] {
  --bg-page:          #0A1224; /* Biru sangat sangat gelap */
  --bg-surface:       #111D36; /* Permukaan kartu */
  --bg-surface-hover: #182846;
  --bg-selected:      #1C3361;
  
  --border-default:   rgba(97, 146, 252, 0.15);
  --border-strong:    rgba(97, 146, 252, 0.25);
  
  --text-primary:     #EFF0F4;
  --text-secondary:   #B1C4E6;
  --text-muted:       #748EBB;

  --brand-900: #EFF0F4;
  --brand-700: #6192FC;
  --brand-600: #6192FC;
  --brand-500: #88AEFC;
  --brand-100: #1C3361;
  --brand-50:  #142444;

  --success-600: var(--color-lime); /* Lime cerah sangat cocok di dark mode */
  --success-bg:  rgba(199, 239, 102, 0.12);
  --warning-700: #FBBF24;
  --warning-bg:  rgba(251, 191, 36, 0.12);
  --danger-600:  #FF6B6B; /* Merah untuk unplanned (tetap ada) */
  --danger-bg:   rgba(255, 107, 107, 0.12);

  --shadow-overlay: 0 8px 32px rgba(0, 0, 0, 0.5);

  --ink: var(--text-primary); --ink2: var(--text-secondary); --mut: var(--text-muted);
  --paper: var(--bg-page); --card: var(--bg-surface); --line: var(--border-default); --line2: var(--border-strong);
  --navy: var(--text-primary); --blue: var(--brand-600);
  --green: var(--success-600); --green-d: var(--success-600); --green-bg: var(--success-bg);
  --amber: var(--warning-700); --red: var(--danger-600);
}

/* ---------- Mode Profesional (Hanya alias untuk light mode di palet baru) ---------- */
[data-theme="professional"] {
  --bg-page: var(--color-white);
  --bg-surface: var(--color-bg);
  --bg-surface-hover: #E4E7F0;
  --bg-selected: #EBF1FF;
  --border-default: #DCE0E8;
  --border-strong: #BCC4D4;
  --text-primary: var(--color-blue-dark);
  --text-secondary: #2E4A7D;
  --text-muted: #6C7D9E;
  
  --ink: var(--text-primary); --ink2: var(--text-secondary); --mut: var(--text-muted);
  --paper: var(--bg-page); --card: var(--bg-surface); --line: var(--border-default); --line2: var(--border-strong);
  --navy: var(--color-blue-dark); --blue: var(--color-blue-light);
}

:root { --pro-blue: var(--color-blue-light); --pro-blue-d: var(--color-blue-dark); --pro-blue-lt: var(--color-bg); --pro-navy: var(--color-blue-dark); }

.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: -3px; }
.tabular-nums, .fig-num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }
:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; } }