/* ============================================================
   ANTARESTAR — Design System (FASE 0)
   PT Antarestar Global Kreatifindo
   One source of truth: tokens + components.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  /* ---- Brand ---- */
  --orange:        #F05A28;
  --orange-hover:  #D94E20;
  --orange-soft:   #FFF1EB;
  --orange-700:    #B83E18;

  --blue:          #2563EB;
  --blue-hover:    #1D4FD8;
  --blue-soft:     #EFF4FF;

  --navy:          #1A2E3B;
  --navy-mid:      #243B4A;
  --navy-soft:     #5A6B78;

  /* ---- Surfaces ---- */
  --bg:            #FFFFFF;
  --surface:       #F7F8FC;
  --surface-2:     #EEF1F7;
  --border:        #E6EAF0;
  --border-strong: #D4DAE4;

  /* ---- Status ---- */
  --success:       #16A34A;  --success-soft:#E8F7EE;
  --warning:       #F59E0B;  --warning-soft:#FEF3E2;
  --danger:        #EF4444;  --danger-soft: #FDECEC;
  --info:          var(--blue);

  /* ---- Text ---- */
  --text:          #1A2E3B;
  --text-mid:      #475866;
  --text-soft:     #7A8a97;
  --text-invert:   #FFFFFF;

  /* ---- Spacing scale ---- */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  /* ---- Radius ---- */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-full: 999px;

  /* ---- Shadow ---- */
  --sh-sm: 0 1px 2px rgba(26,46,59,.06), 0 1px 3px rgba(26,46,59,.04);
  --sh-md: 0 2px 8px rgba(26,46,59,.07), 0 4px 16px rgba(26,46,59,.05);
  --sh-lg: 0 8px 24px rgba(26,46,59,.10), 0 16px 48px rgba(26,46,59,.08);
  --sh-orange: 0 6px 18px rgba(240,90,40,.28);

  /* ---- Type ---- */
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --t-display: 700 44px/1.05 var(--font);
  --t-h1: 700 30px/1.15 var(--font);
  --t-h2: 700 22px/1.2 var(--font);
  --t-h3: 600 17px/1.3 var(--font);
  --t-body: 400 15px/1.55 var(--font);
  --t-caption: 500 12.5px/1.4 var(--font);

  --ease: cubic-bezier(.4,0,.2,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: var(--t-body);
  color: var(--text);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1,h2,h3,h4,p { margin: 0; }
a { color: var(--blue); text-decoration: none; }
button { font-family: var(--font); }
::selection { background: var(--orange-soft); color: var(--orange-700); }

/* tabular numerals everywhere numbers matter */
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ============================================================
   LOGO
   ============================================================ */
.as-logo { display: inline-flex; align-items: center; gap: 10px; }
.as-logo svg { display: block; }
.as-logo .wordmark {
  font: 800 19px/1 var(--font);
  letter-spacing: .14em;
  color: var(--navy);
}
.as-logo.invert .wordmark { color: #fff; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 14.5px/1 var(--font);
  padding: 0 18px; height: 42px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer; user-select: none;
  transition: background .16s var(--ease), box-shadow .16s var(--ease), transform .1s var(--ease), border-color .16s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.35); }
.btn .ico { width: 18px; height: 18px; }

.btn-primary { background: var(--orange); color: #fff; box-shadow: var(--sh-orange); }
.btn-primary:hover { background: var(--orange-hover); }
.btn-primary:focus-visible { box-shadow: var(--sh-orange), 0 0 0 3px rgba(240,90,40,.4); }

.btn-secondary { background: var(--blue); color: #fff; }
.btn-secondary:hover { background: var(--blue-hover); }

.btn-ghost { background: transparent; color: var(--text-mid); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface); color: var(--text); border-color: var(--text-soft); }

.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 50px; padding: 0 26px; font-size: 16px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ============================================================
   SURFACE / CARD
   ============================================================ */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}
.card-pad { padding: var(--s5); }
.card-hover { transition: box-shadow .2s var(--ease), transform .2s var(--ease), border-color .2s var(--ease); }
.card-hover:hover { box-shadow: var(--sh-md); transform: translateY(-2px); border-color: var(--border-strong); }

.section-title { font: var(--t-h3); color: var(--text); display:flex; align-items:center; gap:10px; }
.muted { color: var(--text-soft); }

/* ============================================================
   KPI STAT CARD
   ============================================================ */
.kpi {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 8px;
  transition: box-shadow .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease);
  position: relative; overflow: hidden;
}
.kpi.clickable { cursor: pointer; }
.kpi.clickable:hover { box-shadow: var(--sh-md); border-color: var(--border-strong); transform: translateY(-2px); }
.kpi-label { font: var(--t-caption); color: var(--text-soft); text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font: 700 25px/1 var(--font); color: var(--navy); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.kpi-delta { display: inline-flex; align-items: center; gap: 4px; font: 600 12.5px/1 var(--font); padding: 3px 7px; border-radius: var(--r-full); }
.kpi-delta.up { color: var(--success); background: var(--success-soft); }
.kpi-delta.down { color: var(--danger); background: var(--danger-soft); }
.kpi-delta.flat { color: var(--text-mid); background: var(--surface-2); }
.kpi-spark { height: 30px; width: 100%; }

/* accent strip variants */
.kpi.accent-orange::before,
.kpi.accent-blue::before,
.kpi.accent-green::before { content:""; position:absolute; left:0; top:0; bottom:0; width:3px; }
.kpi.accent-orange::before { background: var(--orange); }
.kpi.accent-blue::before { background: var(--blue); }
.kpi.accent-green::before { background: var(--success); }

/* ============================================================
   BADGE / TAG / CHIP
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font: 600 12px/1 var(--font); padding: 5px 10px; border-radius: var(--r-full);
  background: var(--surface-2); color: var(--text-mid);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: #B45309; }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-info    { background: var(--blue-soft);    color: var(--blue); }
.badge-orange  { background: var(--orange-soft);  color: var(--orange-700); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 13px/1 var(--font); padding: 7px 13px; border-radius: var(--r-full);
  background: var(--bg); border: 1px solid var(--border-strong); color: var(--text-mid);
  cursor: pointer; transition: all .14s var(--ease);
}
.chip:hover { border-color: var(--text-soft); color: var(--text); }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip.active.orange { background: var(--orange); border-color: var(--orange); }

/* ============================================================
   TABS
   ============================================================ */
.tabbar { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: thin; }
.tab {
  appearance: none; background: none; border: none; cursor: pointer;
  font: 600 14px/1 var(--font); color: var(--text-soft);
  padding: 14px 16px; position: relative; white-space: nowrap;
  transition: color .15s var(--ease);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--orange); }
.tab.active::after { content:""; position:absolute; left:12px; right:12px; bottom:-1px; height:3px; background: var(--orange); border-radius: 3px 3px 0 0; }
.tab:focus-visible { outline: none; color: var(--text); box-shadow: inset 0 0 0 2px rgba(37,99,235,.3); border-radius: 6px; }

/* ============================================================
   TABLE
   ============================================================ */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface); color: var(--text-mid);
  font: 600 12.5px/1 var(--font); text-transform: uppercase; letter-spacing: .03em;
  text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.tbl thead th.sortable { cursor: pointer; user-select: none; }
table.tbl thead th.sortable:hover { color: var(--text); }
table.tbl thead th .arr { opacity: .35; margin-left: 4px; font-size: 10px; }
table.tbl thead th.sorted .arr { opacity: 1; color: var(--orange); }
table.tbl tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text); white-space: nowrap; }
table.tbl tbody tr:nth-child(even) { background: #FBFCFE; }
table.tbl tbody tr:hover { background: var(--blue-soft); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ============================================================
   FORM
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: var(--s4); }
.field label { font: 600 13px/1 var(--font); color: var(--text-mid); }
.input, .select {
  height: 46px; padding: 0 14px; width: 100%;
  font: 400 15px/1 var(--font); color: var(--text);
  background: var(--bg); border: 1.5px solid var(--border-strong); border-radius: var(--r-sm);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.input::placeholder { color: var(--text-soft); }
.input:hover, .select:hover { border-color: var(--text-soft); }
.input:focus, .select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.16); }
.input.invalid { border-color: var(--danger); }
.input.invalid:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.16); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237A8A97' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; cursor: pointer; }
.input-group { position: relative; }
.input-group .toggle-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 8px; border-radius: var(--r-sm); color: var(--text-soft);
  display: flex; align-items: center;
}
.input-group .toggle-eye:hover { color: var(--text-mid); background: var(--surface); }
.field .hint { font: 500 12px/1.3 var(--font); color: var(--text-soft); }
.field .error-msg { font: 500 12.5px/1.3 var(--font); color: var(--danger); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(26,46,59,.5); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 1000;
  opacity: 0; pointer-events: none; transition: opacity .2s var(--ease);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg); border-radius: var(--r-lg); box-shadow: var(--sh-lg);
  width: 100%; max-width: 440px; padding: var(--s6);
  transform: translateY(12px) scale(.98); transition: transform .2s var(--ease);
}
.modal-overlay.open .modal { transform: none; }
.modal h3 { font: var(--t-h2); margin-bottom: 6px; }
.modal .modal-sub { color: var(--text-soft); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ============================================================
   SKELETON / EMPTY / TOAST
   ============================================================ */
.skel { background: linear-gradient(90deg, var(--surface-2) 25%, #E4E8F0 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: skel 1.3s var(--ease) infinite; border-radius: 6px; }
@keyframes skel { 0%{background-position:100% 50%} 100%{background-position:0 50%} }

.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 24px; text-align: center; color: var(--text-soft); }
.empty .empty-ico { width: 52px; height: 52px; border-radius: 50%; background: var(--surface-2); display:flex; align-items:center; justify-content:center; color: var(--text-soft); }
.empty h4 { font: var(--t-h3); color: var(--text-mid); }

.toast-stack { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 1100; }
.toast {
  display: flex; align-items: center; gap: 12px; min-width: 280px;
  background: var(--navy); color: #fff; padding: 14px 16px; border-radius: var(--r-md); box-shadow: var(--sh-lg);
  font: 500 14px/1.4 var(--font);
  transform: translateX(120%); transition: transform .3s var(--ease);
}
.toast.show { transform: none; }
.toast .toast-ico { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.toast.success .toast-ico { background: var(--success); }
.toast.danger .toast-ico { background: var(--danger); }
.toast.info .toast-ico { background: var(--blue); }

/* ============================================================
   LAYOUT HELPERS
   ============================================================ */
.app-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 20px;
  padding: 0 24px; height: 64px;
}
.container { max-width: 1320px; margin: 0 auto; padding: 0 24px; }
.grid { display: grid; gap: 16px; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 12px; }

.progress-track { height: 8px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--orange), #FF7A4D); border-radius: var(--r-full); transition: width .6s var(--ease); }

/* focus ring utility for any interactive element */
.focusable:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.35); border-radius: var(--r-sm); }
