
/* ============ base ============ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
h1,h2,h3,h4 { font-family: var(--font-heading); margin: 0; }

/* ============ app shell ============ */
.app-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.app-sidebar {
  background: oklch(0.216 0.006 56);
  color: oklch(0.97 0.002 90);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--primary); color: var(--primary-foreground);
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.brand-text { display: flex; flex-direction: column; font-weight: 600; line-height: 1.2; }
.brand-text small { font-weight: 400; opacity: .55; font-size: 11px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px; font-weight: 500;
  color: oklch(0.85 0.005 56); transition: background .15s, color .15s;
}
.nav-item:hover { background: oklch(0.30 0.006 56); color: #fff; }
.nav-item.active { background: var(--primary); color: var(--primary-foreground); }
.sidebar-foot { border-top: 1px solid oklch(0.35 0.006 56); padding-top: 12px; }

.app-main { display: flex; flex-direction: column; min-width: 0; }
.app-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: var(--card);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.topbar-brand { font-weight: 600; }
.topbar-brand span { color: var(--primary); }
.topbar-user { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted-foreground); }
.app-content { padding: 24px; max-width: 1200px; width: 100%; }

/* ============ page head ============ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 700; margin-top: 6px; }
.page-sub { color: var(--muted-foreground); font-size: 13px; margin-top: 4px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.head-badges { display: flex; gap: 8px; align-items: center; }

/* ============ KPI cards ============ */
/* 6 kartu muat 1 baris di desktop; perkecil padding & teks agar ringkas. */
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.kpi { gap: 8px; padding-block: 12px; }
.kpi > header, .kpi > section { padding-inline: 14px; }
.kpi .kpi-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 0; gap: 6px; }
.kpi-label { font-size: 11.5px; color: var(--muted-foreground); font-weight: 500; line-height: 1.2; }
.kpi-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.tone-amber { background: oklch(0.95 0.05 70); color: oklch(0.55 0.15 55); }
.tone-blue { background: oklch(0.94 0.04 250); color: oklch(0.5 0.15 255); }
.tone-red { background: oklch(0.94 0.04 25); color: var(--destructive); }
.tone-yellow { background: oklch(0.95 0.06 95); color: oklch(0.55 0.13 80); }
.tone-green { background: oklch(0.94 0.05 150); color: oklch(0.5 0.13 150); }
.kpi-value { font-size: 19px; font-weight: 700; margin-top: 4px; line-height: 1.15; }
.kpi-hint { font-size: 10px; color: var(--muted-foreground); margin-top: 1px; line-height: 1.2; }

/* ============ table ============ */
.table-card { padding: 0; overflow: hidden; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.input-group { position: relative; display: inline-flex; align-items: center; }
.input-icon { position: absolute; left: 10px; color: var(--muted-foreground); display: grid; place-items: center; pointer-events: none; }
.input-group .input { padding-left: 32px; min-width: 240px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-size: 12px; font-weight: 600; color: var(--muted-foreground); background: oklch(0.985 0.002 90); text-transform: uppercase; letter-spacing: .02em; }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tfoot td { border-top: 2px solid var(--border); font-weight: 600; background: oklch(0.985 0.002 90); }
.table-empty { text-align: center !important; color: var(--muted-foreground); padding: 32px 16px !important; }
.code-link { font-weight: 600; color: var(--primary); }
.code-link:hover { text-decoration: underline; }
.cell-customer { display: flex; flex-direction: column; }
.cell-name { font-weight: 500; }
.cell-email { font-size: 12px; color: var(--muted-foreground); }
.badge-sub { margin-top: 4px; }
.ok { color: oklch(0.5 0.13 150); }
.due { color: var(--destructive); }
.muted { color: var(--muted-foreground); font-size: 12px; }
.row-action { text-align: right; }

/* ============ forms ============ */
.stack { display: flex; flex-direction: column; gap: 18px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.form-card header { display: block; padding-bottom: 12px; }
.form-card header h3 { font-size: 16px; }
.form-card header p { font-size: 12.5px; color: var(--muted-foreground); margin-top: 3px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-wide { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; }
.card-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.item-table td, .item-table th { padding: 8px 10px; }
.item-table .input { width: 100%; }
.total-label { font-weight: 600; }
.total-cell { font-weight: 700; }
.pb-2 { padding-bottom: 2px; }

/* ============ detail ============ */
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.detail-main, .detail-side { display: flex; flex-direction: column; gap: 18px; }
.summary-list { display: flex; flex-direction: column; gap: 8px; }
.summary-row { display: flex; justify-content: space-between; font-size: 14px; }
.summary-row.strong { font-weight: 700; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }

/* ============ pipeline ============ */
.pipeline { display: flex; align-items: flex-start; justify-content: space-between; gap: 4px; margin: 4px 0; }
.pl-step { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; position: relative; }
.pl-step:not(:last-child)::after {
  content: ""; position: absolute; top: 12px; left: 60%; width: 80%; height: 2px; background: var(--border);
}
.pl-step.pl-done:not(:last-child)::after { background: var(--primary); }
.pl-dot {
  width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center;
  font-size: 12px; font-weight: 600; z-index: 1;
  background: var(--muted); color: var(--muted-foreground); border: 2px solid var(--border);
}
.pl-done .pl-dot { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.pl-current .pl-dot { background: var(--card); color: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 4px oklch(0.95 0.05 70); }
.pl-label { font-size: 10.5px; color: var(--muted-foreground); text-align: center; }
.pl-current .pl-label { color: var(--primary); font-weight: 600; }
.pipeline.is-cancelled { opacity: .5; }

/* ============ public / hero ============ */
.public-shell { min-height: 100vh; display: flex; flex-direction: column; }
.hero { flex: 1; display: grid; place-items: center; padding: 40px 20px; }
.hero-inner { width: 100%; max-width: 460px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.hero-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 999px; background: oklch(0.95 0.05 70); color: oklch(0.5 0.15 55); }
.hero-title { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.hero-title span { color: var(--primary); }
.hero-sub { color: var(--muted-foreground); font-size: 14px; max-width: 340px; }
/* Kartu lookup berdiri sendiri (isi form bukan section Basecoat),
   jadi padding kanan-kiri diatur eksplisit agar tidak mepet ke tepi kartu.
   Basecoat hanya memberi padding-block (24px) + overflow:hidden. */
.lookup-card { width: 100%; text-align: left; padding: 28px 28px; }
.lookup-form { display: flex; flex-direction: column; gap: 14px; }
.lookup-form .btn { justify-content: center; }
.hero-foot { font-size: 12px; color: var(--muted-foreground); }
.hero-foot a { color: var(--primary); font-weight: 500; }

/* ============ /cek ============ */
.cek-shell { max-width: 720px; margin: 0 auto; padding: 28px 20px 60px; width: 100%; }
.cek-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.cek-title { display: flex; flex-direction: column; gap: 6px; }
.cek-title h1 { font-size: 15px; color: var(--muted-foreground); font-weight: 500; }
.email-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 18px; font-weight: 700;
  padding: 8px 16px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--border);
  width: fit-content; max-width: 100%; word-break: break-word;
}
.order-cards { display: flex; flex-direction: column; gap: 16px; }
.order-card { display: flex; flex-direction: column; gap: 16px; }
.order-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.order-code { font-size: 16px; font-weight: 700; }
.order-date { font-size: 12px; color: var(--muted-foreground); display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.order-badges { display: flex; gap: 6px; flex-wrap: wrap; }
/* padding-block saja: jangan timpa padding-inline yang diberikan Basecoat
   (.card>section = 24px). Sebelumnya 'padding: 12px 0' membuat konten
   rata ke tepi kartu (mepet kanan-kiri). */
.order-money { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding-block: 12px; }
.money-row { display: flex; justify-content: space-between; font-size: 14px; }
.money-row.highlight { font-weight: 700; font-size: 15px; }
.money-label { color: var(--muted-foreground); }
.money-row.highlight .money-label { color: var(--foreground); }
.money-val { font-variant-numeric: tabular-nums; }
.order-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted-foreground); flex-wrap: wrap; gap: 8px; }
.order-foot span { display: inline-flex; align-items: center; gap: 5px; }
.empty-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 24px; color: var(--muted-foreground); }
.empty-card h3 { color: var(--foreground); }

/* ============ toast ============ */
.toast-region { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.gt-toast {
  min-width: 240px; max-width: 360px; padding: 12px 14px; border-radius: 10px;
  background: var(--foreground); color: var(--background); font-size: 13.5px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18); display: flex; align-items: center; gap: 10px;
  animation: toast-in .18s ease-out;
}
.gt-toast.gt-success { background: oklch(0.45 0.13 150); color: #fff; }
.gt-toast.gt-error { background: var(--destructive); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============ misc ============ */
.btn { cursor: pointer; line-height: 1.25; }
/* Icon di dalam btn sejajar teks */
.btn svg { display: block; }
.textarea { width: 100%; font-family: inherit; font-size: 14px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--input); background: var(--card); color: var(--foreground); resize: vertical; }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { border: none; padding: 0; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .app-content { padding: 16px; }
  .pl-label { display: none; }
}
