/*!
 * SAW Calculator Engine — gaya tampilan (indigo, seri Decision Lab)
 * (c) 2026 Alfredo Garcia — MIT License
 */

@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;

  /* indigo */
  --brand-950: #1e1b4b;
  --brand-900: #312e81;
  --brand-800: #3730a3;
  --brand-700: #4338ca;
  --brand-600: #4f46e5;
  --brand-500: #6366f1;
  --brand-200: #c7d2fe;
  --brand-100: #e0e7ff;
  --brand-50: #eef2ff;

  /* slate */
  --ink: #182230;
  --ink-2: #475569;
  --muted: #657184;
  --line: #e4e9f1;
  --line-2: #eef1f6;
  --input-line: #cbd5e1;
  --canvas: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --soft: #f1f5f9;
  --soft-hover: #e2e8f0;

  /* status */
  --good: #047857;
  --good-soft: #ecfdf5;
  --good-line: #a7f3d0;
  --bad: #e11d48;
  --bad-ink: #be123c;
  --bad-soft: #fff1f2;
  --bad-line: #fecdd3;
  --warn-soft: #fffbeb;
  --warn-line: #fde68a;
  --warn-ink: #92400e;

  --focus: rgba(99, 102, 241, .27);
  --side-a: var(--brand-600);
  --side-b: #047857;

  --radius-card: 18px;
  --r: 12px;
  --r-sm: 8px;
  --gutter: 32px;
  --shadow-card: 0 8px 26px rgba(15, 23, 42, .045);
  --shadow-card-hover: 0 12px 32px rgba(15, 23, 42, .075);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -.012em;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 88% 2%, rgba(199, 210, 254, .4), transparent 30rem),
    var(--canvas);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -.025em; }
h3 { font-size: 14.5px; font-weight: 600; }
h4 { font-size: 13.5px; font-weight: 600; }
p { margin: 0; }
a { color: var(--brand-600); }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { -webkit-tap-highlight-color: transparent; }
::selection { color: #fff; background: var(--brand-600); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.strong { font-weight: 700; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 8px 12px; background: var(--surface); border-radius: var(--r-sm); }
.skip:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------- Header (gradasi indigo) ---------------- */

.hero {
  background: linear-gradient(118deg, #24205e 0%, #3730a3 52%, #5145d8 100%);
  color: #fff;
  box-shadow: 0 12px 34px rgba(49, 46, 129, .18);
  border-bottom: 1px solid rgba(255, 255, 255, .18);
  margin-bottom: 8px;
}
.hero-row { max-width: 1320px; margin: 0 auto; padding: 26px var(--gutter) 0; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.hero-title { font-size: clamp(27px, 4vw, 38px); font-weight: 700; letter-spacing: -.045em; line-height: 1.15; }
.hero-sub { margin-top: 8px; color: var(--brand-100); max-width: 46rem; line-height: 1.65; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-project { padding-top: 18px; gap: 12px; justify-content: flex-start; }
.title-field { display: flex; align-items: center; gap: 10px; flex: 1 1 320px; max-width: 560px; min-width: 0; }
.title-field > span { font-size: 13px; font-weight: 500; color: var(--brand-200); flex: none; }
.hero .title-field input[type="text"] {
  width: 100%; min-height: 38px; padding: 7px 12px;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .28); border-radius: var(--r-sm);
  color: #fff; font-weight: 600; text-overflow: ellipsis; box-shadow: none;
}
.hero .title-field input[type="text"]:hover { border-color: rgba(255, 255, 255, .45); }
.hero .title-field input[type="text"]:focus { background: rgba(255, 255, 255, .18); border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .25); outline: none; }
.hero .title-field input[readonly] { pointer-events: none; }
.save-state { color: var(--brand-200); font-size: 12.5px; white-space: nowrap; }

.steps { max-width: 1320px; margin: 0 auto; padding: 16px var(--gutter) 18px; }
.steps ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.steps ol::-webkit-scrollbar { display: none; }
.step {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid transparent; background: none; cursor: pointer;
  padding: 7px 16px 7px 8px; border-radius: 999px;
  color: var(--brand-100); font-weight: 500; font-size: 14px; white-space: nowrap;
  transition: background-color .16s ease, color .16s ease;
}
.step-no {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .45); font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.step:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.step.on { background: #fff; color: var(--brand-900); font-weight: 600; box-shadow: 0 4px 14px rgba(30, 27, 75, .25); }
.step.on .step-no { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.resp-badge { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: rgba(255, 255, 255, .15); border: 1px solid rgba(255, 255, 255, .35); font-weight: 600; color: #fff; }

/* ---------------- Tata letak ---------------- */

main { flex: 1; width: 100%; max-width: 1320px; margin: 0 auto; padding: 24px var(--gutter) 56px; display: flex; flex-direction: column; gap: 24px; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { display: flex; align-items: center; gap: 12px; }
.page-head p { color: var(--muted); margin-top: 6px; max-width: 72ch; font-size: 14.5px; }
.step-badge { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand-600); color: #fff; font-size: 15px; font-weight: 700; flex: none; letter-spacing: 0; }
.head-ctrls { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px 22px;
  min-width: 0;
  transition: box-shadow .2s ease;
}
.panel:hover { box-shadow: var(--shadow-card-hover); }
.panel > .panel-head:first-child {
  margin: -20px -22px 18px;
  padding: 15px 22px;
  background: linear-gradient(90deg, #fafbff 0%, #f5f6ff 100%);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 12.5px; }
.note { color: var(--ink-2); font-size: 13.5px; margin-top: 10px; max-width: 90ch; }
.note .ic { width: 16px; height: 16px; vertical-align: -3px; margin-right: 6px; }
.note.warn { color: var(--bad-ink); }
.empty { color: var(--muted); padding: 10px 0; list-style: none; }
.empty-state { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.step-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 4px; }

/* ---------------- Tombol & isian ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; min-height: 40px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: var(--soft); color: #334155;
  font-weight: 500; font-size: 14px; line-height: 1.2;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { background: var(--soft-hover); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand-600); color: #fff; box-shadow: 0 4px 10px -2px rgba(79, 70, 229, .35); }
.btn.primary:hover { background: var(--brand-700); }
.btn.danger { background: #f43f5e; color: #fff; }
.btn.danger:hover { background: var(--bad); }
.btn.ghost { background: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--soft); color: var(--ink); }
.btn.glass { background: rgba(255, 255, 255, .2); border-color: rgba(255, 255, 255, .4); color: #fff; font-weight: 600; box-shadow: none; backdrop-filter: blur(4px); }
.btn.glass:hover { background: rgba(255, 255, 255, .3); }
.btn.sm { min-height: 32px; padding: 5px 11px; font-size: 13px; }
.btn.sm .ic { width: 15px; height: 15px; }
.btn.lg { min-height: 46px; padding: 11px 22px; font-size: 15px; }
.btn.icon-only { padding: 8px; min-width: 40px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border: 1px solid transparent; border-radius: var(--r-sm); background: none; color: #94a3b8; cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.icon-btn:hover:not(:disabled) { background: var(--soft); color: var(--ink); }
.icon-btn.danger:hover:not(:disabled) { color: var(--bad); background: var(--bad-soft); border-color: var(--bad-line); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn .ic { width: 17px; height: 17px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--brand-600); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; font-size: inherit; }
.row-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.field.inline { min-width: 190px; }
input[type="text"], select, textarea {
  width: 100%;
  border: 1px solid var(--input-line);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 9px 12px;
  min-height: 40px;
  font-size: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  transition: border-color .16s ease, box-shadow .16s ease;
}
textarea { resize: vertical; }
select { cursor: pointer; padding-right: 30px; }
input[type="text"]:hover, select:hover, textarea:hover { border-color: #a5b4fc; }
input[type="text"]:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--focus); }
input.invalid { border-color: var(--bad) !important; box-shadow: 0 0 0 3px rgba(225, 29, 72, .18) !important; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.check input { width: 16px; height: 16px; accent-color: var(--brand-600); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--soft); color: var(--ink-2); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tag.bad { color: var(--bad-ink); background: var(--bad-soft); }

.seg { display: inline-flex; border-radius: 10px; padding: 3px; background: var(--soft); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 13px; border-radius: 8px; font-weight: 500; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--brand-700); font-weight: 600; box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }


/* ---------------- Diagram ---------------- */

.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.chart-card {
  margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card); padding: 18px 18px 14px; min-width: 0; transition: box-shadow .2s ease;
}
.chart-card:hover { box-shadow: var(--shadow-card-hover); }
.chart-card.wide { grid-column: 1 / -1; }
.chart-card figcaption { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line-2); }
.chart-cap h3 { font-size: 14.5px; }
.chart-cap p { color: var(--muted); font-size: 12.5px; margin-top: 3px; max-width: 70ch; }
.chart-tools { display: flex; gap: 2px; }
.chart-svg { width: 100%; }
.chart-svg svg { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.chart-svg.scroll { overflow-x: auto; }
.chart-svg.scroll svg { max-width: none; }
.chart-svg [data-tip] { cursor: default; }
.chart-table { margin-top: 12px; }

.table-wrap { position: relative; overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: var(--r); }
table.data { border-collapse: collapse; width: 100%; font-size: 13.5px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
table.data tr:last-child th, table.data tr:last-child td { border-bottom: 0; }
table.data thead th { font-size: 12px; color: #334155; font-weight: 600; border-bottom: 1px solid var(--line); background: var(--soft); }
table.data tbody th { font-weight: 600; color: var(--ink); }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.num { text-align: right; }


/* Panel hidup */
.live { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 14px; }
.prio-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.prio-bars li { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: 13.5px; }
.prio-bars.big li { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) 58px; font-size: 14px; }
.pb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.pb-bar { height: 10px; background: var(--brand-50); border-radius: 5px; overflow: hidden; }
.pb-bar i { display: block; height: 100%; background: var(--brand-600); border-radius: 0 5px 5px 0; transition: width .2s ease; }
.pb-val { text-align: right; font-weight: 700; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }

.cr-box { border-radius: var(--r); padding: 14px 16px; border: 1px solid; }
.cr-box.ok { background: var(--good-soft); border-color: var(--good-line); }
.cr-box.bad { background: var(--bad-soft); border-color: var(--bad-line); }
.cr-main { display: flex; align-items: baseline; justify-content: space-between; }
.cr-label { font-weight: 600; font-size: 13px; color: var(--ink-2); }
.cr-val { font-size: 24px; font-weight: 700; letter-spacing: -.03em; }
.cr-box.ok .cr-val, .cr-box.ok .cr-status { color: var(--good); }
.cr-box.bad .cr-val, .cr-box.bad .cr-status { color: var(--bad-ink); }
.cr-status { display: flex; gap: 6px; font-size: 13px; margin-top: 2px; }
.cr-status .ic { width: 16px; height: 16px; margin-top: 2px; }
.cr-detail { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 0; font-size: 12.5px; }
.cr-detail dt, .cr-detail dd { white-space: nowrap; }
.cr-detail div { display: flex; gap: 5px; }
.cr-detail dt { color: var(--muted); }
.cr-detail dd { margin: 0; font-weight: 600; }

.suggest h4 { margin-bottom: 8px; }
.suggest ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.suggest li span { display: block; }
.suggest li .btn { margin-top: 5px; }


/* ---------------- Langkah 3: Hasil ---------------- */

.verdict { border-radius: var(--r); border: 1px solid var(--good-line); background: var(--good-soft); padding: 20px 22px; color: #064e3b; }
.verdict-kicker { font-weight: 600; font-size: 13.5px; color: #065f46; }
.verdict-main { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-top: 2px; }
.verdict-name { font-size: clamp(26px, 3.6vw, 36px); font-weight: 700; letter-spacing: -.04em; line-height: 1.15; color: var(--ink); }
.verdict-val { font-size: clamp(20px, 2.6vw, 26px); font-weight: 700; color: var(--good); }
.verdict-sub { color: #065f46; margin-top: 6px; max-width: 75ch; font-size: 14px; }

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; border-radius: var(--r); border: 1px solid; font-size: 14px; }
.banner .ic { margin-top: 2px; }
.banner ul { margin: 6px 0 0; padding-left: 18px; }
.banner.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-ink); }
.banner.info { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-900); }

/* ---------------- Langkah 4: Sensitivitas ---------------- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 16px; font-weight: 500; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--brand-700); font-weight: 600; border-bottom-color: var(--brand-600); }
.sens-body { display: flex; flex-direction: column; gap: 14px; }
.sens-body .chart-card { border: 0; padding: 0; box-shadow: none; }
.ctrl-row { display: flex; gap: 12px; flex-wrap: wrap; }
.lead { font-size: 15px; max-width: 80ch; }
.dyn { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.dyn-col h3 { margin-bottom: 12px; }
.dyn-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 58px; gap: 10px; align-items: center; padding: 6px 0; }
.dyn-row label { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dyn-row .num { text-align: right; font-weight: 700; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--brand-600) var(--v, 0%), var(--brand-100) var(--v, 0%)); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--brand-600) var(--v, 0%), var(--brand-100) var(--v, 0%)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand-600); box-shadow: 0 1px 4px rgba(79, 70, 229, .35); }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand-600); }

/* ---------------- Langkah 5: Laporan ---------------- */

.dl-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.dl-card {
  display: flex; flex-direction: column; gap: 12px; align-items: flex-start; text-align: left;
  padding: 18px; border-radius: var(--radius-card); border: 1px solid var(--line); background: var(--surface);
  box-shadow: var(--shadow-card); cursor: pointer; color: var(--ink); transition: box-shadow .2s, border-color .2s;
}
.dl-card:hover { box-shadow: var(--shadow-card-hover); border-color: var(--brand-200); }
.dl-card:disabled { opacity: .6; cursor: progress; }
.dl-card.primary { border: 2px solid var(--brand-500); }
.dl-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--brand-50); color: var(--brand-600); }
.dl-card.primary .dl-ic { background: var(--brand-600); color: #fff; }
.dl-ic .ic { width: 22px; height: 22px; }
.dl-text { display: flex; flex-direction: column; gap: 4px; }
.dl-text b { font-size: 15px; font-weight: 600; }
.dl-text span { color: var(--muted); font-size: 13px; line-height: 1.5; }
.howto { margin: 0 0 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; color: var(--ink-2); max-width: 80ch; }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.share-row input { flex: 1 1 260px; font-size: 13px; color: var(--ink-2); }
.import-box { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line-2); }
.cite blockquote { margin: 10px 0 12px; padding: 14px 18px; border-left: 4px solid var(--brand-500); background: var(--brand-50); border-radius: 0 var(--r) var(--r) 0; font-size: 14px; overflow-wrap: anywhere; color: var(--brand-950); }


/* ---------------- Modal, toast, tooltip ---------------- */

.modal { position: fixed; inset: 0; z-index: 60; background: rgba(15, 23, 42, .6); backdrop-filter: blur(8px); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .3s; }
.modal.open { opacity: 1; }
.modal-card { position: relative; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; background: var(--surface); border-radius: 18px; padding: 24px; border: 1px solid rgba(255, 255, 255, .65); box-shadow: 0 25px 50px -12px rgba(15, 23, 42, .35); transform: scale(.97); transition: transform .3s; }
.modal.open .modal-card { transform: none; }
.modal-card.wide { max-width: 860px; }
.modal-x { position: absolute; top: 14px; right: 14px; }
.modal-title { font-size: 20px; font-weight: 700; margin-right: 40px; letter-spacing: -.03em; }
.modal-text { margin-top: 10px; color: var(--ink-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-2); }
.help { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.help h3 { margin-top: 10px; color: var(--ink); }
.help p, .help li { color: var(--ink-2); max-width: 78ch; font-size: 14px; }
.help ol { margin: 0; padding-left: 20px; }
.sample-list { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sample { display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; color: var(--ink); transition: border-color .15s, background-color .15s; }
.sample:hover { border-color: var(--brand-500); background: var(--brand-50); }
.sample b { font-weight: 600; }
.sample span { color: var(--muted); font-size: 13.5px; }

.toasts { position: fixed; top: 20px; right: 20px; z-index: 80; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; width: min(30rem, calc(100vw - 2rem)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r-sm); background: #10b981; color: #fff; font-size: 14px; font-weight: 500; box-shadow: 0 10px 15px -3px rgba(15, 23, 42, .2); pointer-events: auto; animation: toast-in .3s ease; transition: opacity .3s, transform .3s; }
.toast.error { background: #f43f5e; }
.toast.out { opacity: 0; transform: translateX(110%); }
.toast-act { border: 1px solid rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .15); color: #fff; border-radius: 6px; padding: 3px 10px; font-weight: 600; cursor: pointer; margin-left: 6px; }
@keyframes toast-in { from { opacity: 0; transform: translateX(110%); } to { opacity: 1; transform: none; } }

.tip { position: fixed; z-index: 90; max-width: 300px; padding: 8px 11px; border-radius: var(--r-sm); background: #0f172a; color: #fff; font-size: 12.5px; line-height: 1.45; pointer-events: none; white-space: pre-line; box-shadow: 0 6px 18px rgba(15, 23, 42, .25); font-variant-numeric: tabular-nums; }

body.dropping::after { content: 'Lepaskan berkas proyek (.json), CSV, atau Excel (.xlsx) di sini'; position: fixed; inset: 12px; z-index: 95; display: grid; place-items: center; border: 3px dashed var(--brand-500); border-radius: 18px; background: rgba(238, 242, 255, .92); color: var(--brand-900); font-weight: 700; font-size: 18px; }

.foot { max-width: 1320px; width: 100%; margin: 0 auto; padding: 18px var(--gutter) 28px; color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.foot a { color: var(--ink-2); }


/* ---------------- Elemen khas versi pertama ---------------- */

.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 700; color: var(--brand-200); margin-bottom: 8px; }
.notice { padding: 14px 16px; border-radius: 12px; background: var(--brand-50); border: 1px solid #dbe3ff; color: var(--brand-900); font-size: 13.5px; line-height: 1.65; }
.small { font-size: 12.5px; color: var(--muted); line-height: 1.65; margin-top: 12px; }
.bad-text { color: var(--bad-ink); font-weight: 600; }
.ok-text { color: var(--good); }
.note.ok-text { color: var(--good); }
.btn.soft { background: var(--brand-50); color: var(--brand-800); box-shadow: none; font-weight: 600; }
.btn.soft:hover { background: var(--brand-100); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.toolbar.first { margin-top: 0; }
.side-col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings > .field:first-child { grid-column: 1 / -1; }
.settings.two > .field:first-child { grid-column: auto; }
.field .static { min-height: 40px; display: flex; align-items: center; color: var(--ink-2); font-weight: 500; }
.row-no { min-width: 26px; text-align: right; color: #94a3b8; font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 700; }
.row-actions { display: flex; gap: 2px; align-items: center; }
.steps .step.has-warn .step-no { border-color: #fcd34d; }
.steps .step.has-warn:not(.on) .step-no { background: rgba(252, 211, 77, .25); }

/* ---------------- Langkah 1: Kriteria & bobot ---------------- */

.crit-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.crit-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; }
.item {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; background: var(--surface);
  display: grid; grid-template-columns: 32px minmax(150px, 2fr) 124px minmax(78px, 1fr) 122px auto; gap: 10px; align-items: end;
  transition: border-color .15s, box-shadow .15s;
}
.item:focus-within { border-color: var(--brand-200); box-shadow: 0 0 0 3px rgba(99, 102, 241, .08); }
.idx { width: 30px; height: 30px; border-radius: 8px; background: var(--brand-50); color: var(--brand-700); display: grid; place-items: center; font-size: 12px; font-weight: 800; align-self: end; margin-bottom: 5px; }
.weight-box { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.weight-box input[type="text"] { width: 66px; text-align: right; padding: 9px 9px; }
.wpct { font-weight: 700; color: var(--brand-800); min-width: 48px; text-align: right; }
.item .row-actions { align-self: end; margin-bottom: 3px; }

.method-list { display: grid; gap: 8px; }
.method { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .15s, background-color .15s; }
.method:hover { border-color: var(--brand-200); }
.method.on { border-color: var(--brand-500); background: var(--brand-50); box-shadow: inset 3px 0 0 var(--brand-600); }
.method input { margin-top: 3px; accent-color: var(--brand-600); width: 16px; height: 16px; flex: none; }
.method b { display: block; font-size: 14px; font-weight: 600; }
.method small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.5; margin-top: 2px; }
.method.on b { color: var(--brand-900); }
#method-msg .note:first-child { margin-top: 14px; }

.ahp-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; margin-top: 14px; }
.ahp-side { display: flex; flex-direction: column; gap: 14px; }
.ahp-wrap .table-wrap { border: 0; }
table.matrix { border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
table.matrix th, table.matrix td { padding: 5px; text-align: center; border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line-2); min-width: 84px; }
table.matrix thead th { font-size: 12px; font-weight: 600; color: #334155; background: #f1f3ff; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 8px 6px; }
table.matrix tbody th { text-align: left; font-size: 13px; font-weight: 600; background: var(--surface-2); max-width: 190px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 6px 12px; }
table.matrix td.diag { color: #94a3b8; background: var(--soft); font-weight: 600; }
table.matrix td.recip { color: var(--brand-700); background: var(--brand-50); font-weight: 600; font-size: 13px; }
table.matrix td input { width: 74px; min-height: 34px; text-align: center; padding: 4px; font-weight: 600; }

/* ---------------- Langkah 2: Matriks keputusan ---------------- */

.matrix-wrap { position: relative; overflow: auto; margin-top: 14px; border: 1px solid var(--line); border-radius: var(--r); max-height: 72vh; }
table.dm { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13.5px; }
table.dm th, table.dm td { border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line-2); padding: 6px; vertical-align: middle; }
table.dm tr:last-child th, table.dm tr:last-child td { border-bottom: 0; }
table.dm thead th { position: sticky; top: 0; z-index: 2; background: #f1f3ff; text-align: left; font-weight: 600; color: #334155; padding: 8px 10px; min-width: 120px; }
table.dm .sticky { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 210px; box-shadow: 1px 0 0 var(--line); }
table.dm thead th.sticky { z-index: 3; background: #f1f3ff; }
.ch-name { display: block; font-size: 12.5px; line-height: 1.3; }
.ch-meta { display: flex; gap: 6px; align-items: center; margin-top: 4px; font-size: 11.5px; color: var(--muted); font-weight: 500; flex-wrap: wrap; }
.tag.benefit { background: var(--good-soft); color: var(--good); font-weight: 600; }
.tag.cost { background: #fff7ed; color: #b45309; font-weight: 600; }
table.dm td input { width: 100%; min-width: 92px; text-align: right; min-height: 36px; padding: 6px 9px; }
table.dm td input.empty-cell { background: #fffbeb; border-color: #fcd34d; }
.alt-cell { display: flex; align-items: center; gap: 8px; }
.alt-cell input { min-height: 36px; padding: 6px 9px; font-weight: 600; }
table.dm .act-col { width: 1%; white-space: nowrap; background: var(--surface-2); min-width: 0; }
table.dm thead th.act-col { background: #f1f3ff; }
#matrix-status { margin-top: 4px; }

/* ---------------- Langkah 3: Hasil ---------------- */

.summary.verdict { border-color: var(--good-line); }
.rank-table td.rank { font-weight: 700; text-align: center; width: 84px; }
.sm-only { display: none; }
table.data tr.best { background: var(--good-soft); }
table.data tr.best th, table.data tr.best td { font-weight: 700; }
table.data tbody tr.best:hover { background: #d1fae5; }
.bar-cell { width: 30%; min-width: 110px; vertical-align: middle !important; }
.bar { height: 9px; background: #e2e8f0; border-radius: 99px; overflow: hidden; min-width: 75px; }
.bar span { height: 100%; display: block; background: linear-gradient(90deg, #6366f1, #8b5cf6); border-radius: 99px; }
.chart-grid.one { grid-template-columns: minmax(0, 1fr); }
.chart-card.plain { border: 0; padding: 0; box-shadow: none; }
.chart-card.plain:hover { box-shadow: none; }

.calc-step { padding: 18px 0; border-top: 1px solid var(--line-2); }
.calc-step:first-of-type { border-top: 0; padding-top: 4px; }
.cs-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.cs-head h3 { font-size: 15px; color: var(--brand-900); }
.calc-step .cs-head:not(:first-child) { margin-top: 16px; }
.formula { display: inline-block; padding: 9px 14px; border-radius: 10px; background: var(--brand-50); border: 1px solid #dbe3ff; color: var(--brand-950); font-size: 14px; font-style: italic; line-height: 1.7; margin-bottom: 8px; max-width: 100%; overflow-x: auto; }
.formula sub { font-size: 70%; }
.example { color: var(--ink-2); font-size: 13px; margin: 0 0 10px; font-variant-numeric: tabular-nums; }
table.data.calc th, table.data.calc td { padding: 7px 10px; white-space: nowrap; }
table.data .sum-row th, table.data .sum-row td { background: var(--surface-2); font-weight: 600; border-top: 1px solid var(--line); }
table.data.compact th, table.data.compact td { padding: 6px 9px; font-size: 12.5px; }
table.data.compact small { color: var(--muted); font-weight: 500; }

/* ---------------- Langkah 4: Sensitivitas ---------------- */

.sub-h { margin: 22px 0 10px; }
.range-bar { position: relative; height: 10px; border-radius: 5px; background: var(--soft); min-width: 120px; margin-top: 5px; }
.range-bar span { position: absolute; top: 0; bottom: 0; background: var(--brand-200); border-radius: 5px; }
.range-bar i { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
.pb-rank { color: var(--muted); font-weight: 600; }
.move { font-size: 11px; font-weight: 700; margin-left: 2px; }
.move.upm { color: var(--good); }
.move.downm { color: var(--bad-ink); }
.banner.ok { background: var(--good-soft); border-color: var(--good-line); color: #065f46; }
.sens-body .table-wrap + .row-buttons { margin-top: 10px; }
.sens-body { padding-top: 18px; }

/* ---------------- Tempel, bantuan ---------------- */

.paste-preview { margin-top: 12px; font-size: 13.5px; color: var(--ink-2); display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow: auto; }
textarea#paste-text { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; white-space: pre; overflow-wrap: normal; overflow-x: auto; tab-size: 14; }
.guide-example { padding: 13px 15px; border: 1px solid var(--brand-200); border-radius: 11px; background: var(--brand-50); color: var(--brand-900); font-size: 14px; }
.dl-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* ---------------- Responsif ---------------- */

@media (max-width: 1180px) {
  .crit-grid, .ahp-wrap { grid-template-columns: minmax(0, 1fr); }
  .side-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
}

@media (max-width: 920px) {
  :root { --gutter: 18px; }
  .chart-grid, .dyn { grid-template-columns: minmax(0, 1fr); }
  .side-col { display: flex; }
}

@media (max-width: 720px) {
  :root { --gutter: 14px; }
  body { font-size: 14.5px; }
  h1 { font-size: 22px; }
  .hero-row { padding-top: 20px; }
  .hero-title { font-size: 27px; }
  .hero-sub { font-size: 14px; }
  .hero-actions { gap: 6px; }
  .btn.glass { padding: 7px 11px; min-height: 36px; font-size: 13px; }
  .save-state { display: none; }
  .title-field { flex-basis: 100%; }
  main { padding-top: 18px; gap: 18px; }
  .panel { padding: 16px; }
  .panel > .panel-head:first-child { margin: -16px -16px 16px; padding: 13px 16px; }
  .step { padding: 6px 12px 6px 6px; font-size: 13.5px; }
  .item { grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1fr); align-items: end; }
  .item .grow { grid-column: 2 / 4; }
  .item .type { grid-column: 2; }
  .item .unit { grid-column: 3; }
  .item .weight { grid-column: 2 / 4; }
  .item .row-actions { grid-column: 1 / 4; justify-content: flex-end; margin: -4px 0 0; }
  .idx { grid-row: 1; }
  .settings, .settings.two { grid-template-columns: minmax(0, 1fr); }
  .toolbar .btn { flex: 1 1 auto; }
  table.dm .sticky { min-width: 150px; }
  table.dm td input { min-width: 78px; }
  .dl-grid { grid-template-columns: minmax(0, 1fr); }
  .chart-card { padding: 14px 12px 10px; }
  .chart-tools .btn { padding: 4px 8px; }
  .head-ctrls { width: 100%; }
  .step-foot { flex-wrap: wrap; }
  .step-foot .btn.lg { flex: 1 1 auto; }
  .toasts { top: auto; bottom: 16px; right: 12px; }
  .formula { font-size: 13px; }
  .bar-cell, .bar-head { display: none; }
  .rank-table th, .rank-table td { padding: 8px 9px; white-space: nowrap; }
  .rank-table td.rank { width: 40px; }
  .rank-table .dcol, .lg-only { display: none; }
  .sm-only { display: inline; }
  .rank-table th:nth-child(2) { white-space: normal; }
}

/* ================================================================== *
 * Khusus SAW: sub-kriteria, penilai, sel konversi
 * ================================================================== */

.item-foot { grid-column: 1 / -1; margin-top: -2px; }
.tag.sub-tag { display: inline-flex; align-items: center; gap: 5px; border: 1px solid #dbe3ff; background: var(--brand-50); color: var(--brand-800); font-weight: 600; cursor: pointer; }
.tag.sub-tag:hover { border-color: var(--brand-200); }
.tag.sub-tag .ic { width: 13px; height: 13px; }
.tag.sub { background: #eef2ff; color: var(--brand-700); font-weight: 600; }
.formula.small-f { display: block; font-size: 13px; margin: 12px 0 6px; }

.sub-card .panel-head { flex-wrap: wrap; gap: 10px; }
.sub-card .panel-head h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sub-card .panel-head .idx { font-size: 12px; }
.sub-card .field.inline { min-width: 200px; }
.sub-card.plain-mode { background: var(--surface-2); }
table.sub-table { min-width: 520px; }
table.sub-table td { padding: 5px 6px; vertical-align: middle; }
table.sub-table td.no { width: 1%; color: var(--muted); }
table.sub-table input { width: 100%; min-height: 34px; padding: 5px 9px; }
table.sub-table input.num { text-align: right; min-width: 90px; }
table.sub-table input.empty-cell { background: #fffbeb; border-color: #fcd34d; }
.sub-status { margin-top: 8px; }

.expert-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 18px; flex-wrap: wrap; margin: 4px 0 12px; }
.expert-bar.single { align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line); }
.expert-bar.single .muted { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.expert-bar .tabs { flex: 1 1 340px; min-width: 0; align-items: center; }
.exp-tabs button.agg { display: inline-flex; align-items: center; gap: 6px; }
.exp-tabs .btn { margin-left: 6px; }
.expert-ctrl { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.expert-ctrl .field.inline { min-width: 200px; }

table.dm td.has-out { position: relative; }
table.dm td.has-out input { padding-right: 46px; }
.crip-out { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 11.5px; font-weight: 700; color: var(--brand-700); pointer-events: none; font-variant-numeric: tabular-nums; }
.crip-out.bad { color: var(--bad-ink); }
table.dm select.cell-sel { width: 100%; min-width: 150px; min-height: 36px; padding: 6px 28px 6px 9px; font-size: 13.5px; }
table.dm select.cell-sel.empty-cell { background-color: #fffbeb; border-color: #fcd34d; }
select.invalid { border-color: var(--bad) !important; box-shadow: 0 0 0 3px rgba(225, 29, 72, .18) !important; }

.crips-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px 18px; margin: 10px 0 14px; }
.crips-box .cs-head { margin-bottom: 6px; }
.crips-box h4 { font-size: 13.5px; color: var(--ink-2); }
.calc-step details { margin: 8px 0; border: 1px solid var(--line-2); border-radius: 10px; padding: 6px 12px; }
.calc-step details > summary { cursor: pointer; font-weight: 600; color: var(--brand-800); padding: 4px 0; }
.calc-step details[open] > summary { margin-bottom: 8px; }
.calc-step .lead { margin-bottom: 8px; }

@media (max-width: 720px) {
  .expert-bar .tabs { flex-basis: 100%; }
  .expert-ctrl .field.inline, .sub-card .field.inline { min-width: 0; flex: 1 1 160px; }
  table.dm select.cell-sel { min-width: 116px; }
  .crips-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@media print {
  @page { size: A4 portrait; margin: 14mm; }
  body { background: #fff; }
  .hero, .foot, .chart-tools, .step-foot, .toasts, .tip, .modal, .toolbar, .row-buttons, .cs-head .btn, .head-ctrls { display: none !important; }
  .panel, .chart-card { break-inside: avoid; border-color: #ccc; box-shadow: none; }
}
