/* ============================================================
   BountyTitle Lab — tema "kapal bajak laut malam hari"
   ============================================================ */
:root {
  --bg: #070b14;
  --bg-2: #0a1120;
  --panel: #0e1626;
  --card: #121d30;
  --card-2: #16233a;
  --line: #1f2f4a;
  --line-2: #2a3d5c;
  --text: #e9effb;
  --muted: #8fa3c4;
  --gold: #f5c34b;
  --gold-2: #ffd97a;
  --red: #e0475c;
  --green: #35d08a;
  --blue: #4aa8ff;
  --purple: #a97bff;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 20% -10%, #14213a 0%, transparent 60%),
              radial-gradient(900px 500px at 110% 0%, #2a1a2e 0%, transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}

h1, h2, h3, h4 { margin: 0 0 .35em; line-height: 1.25; }
h2 { font-size: 1.5rem; letter-spacing: -.02em; }
h3 { font-size: 1.02rem; letter-spacing: -.01em; }
p { margin: .2em 0 .8em; }
a { color: var(--blue); }
code { font-family: var(--mono); font-size: .85em; background: #0b1424; padding: .1em .35em; border-radius: 5px; border: 1px solid var(--line); }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------------------- topbar ---------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: .7rem 1.2rem;
  background: rgba(7, 11, 20, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .65rem; min-width: max-content; }
.brand .logo { font-size: 1.6rem; filter: drop-shadow(0 2px 6px rgba(245, 195, 75, .35)); }
.brand strong { display: block; font-size: 1.02rem; letter-spacing: -.01em; }
.brand small { display: block; color: var(--muted); font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; }

.tabs { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: .45rem .8rem;
  border-radius: 9px;
  font-size: .87rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: .15s;
}
.tab:hover { color: var(--text); background: #101a2c; }
.tab.active { color: #12100a; background: linear-gradient(180deg, var(--gold-2), var(--gold)); box-shadow: 0 4px 16px rgba(245, 195, 75, .25); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.quota-badge {
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .28rem .7rem;
  background: #0b1424;
  white-space: nowrap;
}

/* ---------------------------- layout ---------------------------- */
main { max-width: 1280px; margin: 0 auto; padding: 1.4rem 1.2rem 4rem; }
.panel { display: none; animation: fade .18s ease; }
.panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.panel-head p { margin: 0; max-width: 70ch; }

.card {
  background: linear-gradient(180deg, var(--card), #0f1a2b);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.05rem 1.1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-bottom: .6rem; }
.card-head h3 { margin: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 900px) { .two-col, .three-col { grid-template-columns: 1fr; } }

.badge {
  font-size: .76rem;
  color: var(--gold);
  border: 1px solid rgba(245, 195, 75, .35);
  background: rgba(245, 195, 75, .08);
  padding: .25rem .65rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------------------------- form ---------------------------- */
label { display: block; font-size: .8rem; color: var(--muted); margin: .5rem 0 .25rem; font-weight: 600; letter-spacing: .01em; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  background: #0a1322;
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: .55rem .7rem;
  font-size: .94rem;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.5; font-size: .92rem; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 195, 75, .14);
}
.form-row { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; }
.form-row > .grow { flex: 1 1 220px; }
.form-row > .w-sm { width: 150px; }
.form-row > .w-xs { width: 105px; }
.form-actions { display: flex; align-items: center; gap: .8rem; margin-left: auto; }
.check { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .82rem; margin: 0; }
.check input { width: auto; }

/* ---------------------------- tombol ---------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border: 1px solid var(--line-2);
  background: #16233a;
  color: var(--text);
  padding: .55rem .95rem;
  border-radius: 10px;
  font-size: .89rem;
  font-weight: 700;
  cursor: pointer;
  transition: .15s;
  font-family: inherit;
}
.btn:hover { background: #1d2d49; border-color: var(--line-2); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn.primary {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #17120a;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(245, 195, 75, .2);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.small { padding: .3rem .6rem; font-size: .78rem; border-radius: 8px; }
.btn.block { width: 100%; margin-top: 1rem; }
.btn.danger { color: #ffd7dd; border-color: rgba(224, 71, 92, .4); background: rgba(224, 71, 92, .12); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-row { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ---------------------------- kartu statistik ---------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stat {
  background: linear-gradient(180deg, var(--card-2), #101b2e);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .85rem .95rem;
  position: relative;
  overflow: hidden;
}
.stat::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, var(--gold), transparent); opacity: .6; }
.stat .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.stat .value { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; margin-top: .1rem; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: .74rem; color: var(--muted); }
.stat.good .value { color: var(--green); }
.stat.warn .value { color: var(--gold); }
.stat.bad .value { color: var(--red); }

/* ---------------------------- chips ---------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.chip {
  border: 1px solid var(--line-2);
  background: #0c1626;
  color: var(--text);
  border-radius: 999px;
  padding: .28rem .7rem;
  font-size: .8rem;
  cursor: pointer;
  transition: .12s;
  font-family: inherit;
}
.chip:hover { border-color: var(--gold); color: var(--gold-2); }
.chip.action { border-color: rgba(245, 195, 75, .3); }
.chip.gap { border-color: rgba(53, 208, 138, .3); background: rgba(53, 208, 138, .07); }
.chip .rank { color: var(--muted); font-family: var(--mono); font-size: .7rem; margin-right: .3rem; }

/* ---------------------------- tabel ---------------------------- */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--line); }
.table { width: 100%; border-collapse: collapse; font-size: .87rem; min-width: 640px; }
.table th {
  text-align: left;
  padding: .55rem .7rem;
  background: #0c1526;
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  white-space: nowrap;
}
.table td { padding: .55rem .7rem; border-bottom: 1px solid rgba(31, 47, 74, .6); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(74, 168, 255, .05); }
.table.compact { font-size: .8rem; min-width: 420px; }
.table.compact td, .table.compact th { padding: .4rem .5rem; }
.title-cell { max-width: 520px; }
.title-cell .t { font-weight: 600; line-height: 1.35; display: block; }
.title-cell .meta { font-size: .74rem; color: var(--muted); }
.rank-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; padding: 0 .3rem;
  border-radius: 8px; font-weight: 800; font-size: .8rem;
  background: #182741; border: 1px solid var(--line-2); font-family: var(--mono);
}
.rank-badge.r1 { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #17120a; border: none; }
.rank-badge.r2 { background: #cfd8e6; color: #10151f; border: none; }
.rank-badge.r3 { background: #c98b5a; color: #1b120a; border: none; }
.score-pill {
  font-family: var(--mono); font-weight: 700; font-size: .82rem;
  padding: .12rem .5rem; border-radius: 999px;
  background: rgba(245, 195, 75, .1); color: var(--gold-2); border: 1px solid rgba(245, 195, 75, .28);
}
.status-select { width: auto; padding: .2rem .45rem; font-size: .78rem; }

/* ---------------------------- bar kriteria ---------------------------- */
.bars { display: flex; gap: 3px; align-items: flex-end; height: 30px; min-width: 190px; }
.bars .bar { width: 16px; height: 100%; background: #24344f; border-radius: 3px 3px 0 0; position: relative; }
.bars .bar > i { position: absolute; inset: auto 0 0 0; border-radius: 3px 3px 0 0; background: linear-gradient(180deg, var(--gold-2), #c9971f); }
.bars .bar.cost > i { background: linear-gradient(180deg, #ff8f9f, #b32a41); }
.bars .bar span { position: absolute; bottom: -15px; left: 50%; transform: translateX(-50%); font-size: .6rem; color: var(--muted); }

/* ---------------------------- bobot ---------------------------- */
.weights { display: grid; gap: .55rem; }
.weight-row { display: grid; grid-template-columns: 170px 1fr 58px; align-items: center; gap: .6rem; }
.weight-row .name { font-size: .82rem; display: flex; align-items: center; gap: .35rem; }
.weight-row .name .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.weight-row .name .dot.cost { background: var(--red); }
.weight-row input[type="range"] { width: 100%; accent-color: var(--gold); height: 18px; }
.weight-row .val { font-family: var(--mono); font-size: .78rem; text-align: right; color: var(--gold-2); }
.weight-note { display: flex; justify-content: space-between; gap: .6rem; margin-top: .7rem; font-size: .82rem; flex-wrap: wrap; }
.preset-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .7rem; padding-top: .7rem; border-top: 1px solid var(--line); }
.preset-row .chips { margin-top: 0; }
.hint { font-size: .8rem; color: var(--muted); background: #0b1424; border: 1px dashed var(--line-2); border-radius: 10px; padding: .6rem .75rem; margin-top: .8rem; }

/* ---------------------------- meter ---------------------------- */
.meter-block { margin-top: .6rem; }
.meter-label { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); margin: .5rem 0 .2rem; font-family: var(--mono); }
.meter { height: 8px; background: #0b1424; border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.meter-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), #ff9d4b); transition: width .4s; }
.meter-fill.alt { background: linear-gradient(90deg, var(--blue), var(--purple)); }

/* ---------------------------- winner ---------------------------- */
.winner {
  background:
    radial-gradient(600px 220px at 10% 0%, rgba(245, 195, 75, .16), transparent 65%),
    linear-gradient(180deg, #17233a, #0f1a2b);
  border: 1px solid rgba(245, 195, 75, .32);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
}
.winner::before {
  content: "🏆";
  position: absolute; right: -10px; top: -18px; font-size: 6rem; opacity: .08; transform: rotate(12deg);
}
.winner .kicker { font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.winner .title { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; margin: .25rem 0 .4rem; line-height: 1.3; }
.winner .meta { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.winner .meta strong { color: var(--text); }

/* ---------------------------- empty & toast ---------------------------- */
.empty-state { text-align: center; padding: 3rem 1rem; border: 1px dashed var(--line-2); border-radius: var(--radius); background: rgba(14, 22, 38, .5); }
.empty-state .big { font-size: 2.6rem; display: block; margin-bottom: .5rem; }
.empty-state .chips { justify-content: center; }

.toast-stack { position: fixed; bottom: 1.2rem; right: 1.2rem; display: flex; flex-direction: column; gap: .5rem; z-index: 90; max-width: 380px; }
.toast {
  background: #16233a; border: 1px solid var(--line-2); border-left: 4px solid var(--gold);
  padding: .7rem .9rem; border-radius: 10px; box-shadow: var(--shadow); font-size: .86rem;
  animation: slideIn .2s ease;
}
.toast.err { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ---------------------------- modal ---------------------------- */
.overlay {
  position: fixed; inset: 0; background: rgba(4, 7, 13, .72); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 80; padding: 1rem;
}
.modal-card {
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px;
  width: min(900px, 100%); max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; }
#modalBody { padding: 1rem 1.1rem; overflow: auto; }
.modal-foot { padding: .8rem 1.1rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: .5rem; }

.login-card {
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px;
  padding: 1.6rem; width: min(380px, 100%); text-align: center; box-shadow: var(--shadow);
}
.login-card h1 { font-size: 1.25rem; }
.login-card p { color: var(--muted); font-size: .88rem; }
.login-card input { margin: .8rem 0; }
.login-card .btn { width: 100%; }
.error { color: #ff9aa7 !important; min-height: 1.2em; font-size: .82rem; }

/* ---------------------------- AHP grid ---------------------------- */
.ahp-grid { border-collapse: collapse; font-size: .78rem; width: 100%; }
.ahp-grid th, .ahp-grid td { border: 1px solid var(--line); padding: .25rem; text-align: center; }
.ahp-grid th { color: var(--muted); font-weight: 600; font-size: .7rem; background: #0c1526; }
.ahp-grid select { padding: .15rem; font-size: .75rem; border-radius: 5px; }
.cr-box { margin-top: .8rem; padding: .7rem .9rem; border-radius: 10px; border: 1px solid var(--line-2); font-size: .85rem; }
.cr-box.ok { border-color: rgba(53, 208, 138, .4); background: rgba(53, 208, 138, .07); }
.cr-box.bad { border-color: rgba(224, 71, 92, .4); background: rgba(224, 71, 92, .08); }

/* ---------------------------- misc ---------------------------- */
.loader { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(0,0,0,.25); border-top-color: #1a1408; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
details.reasons { margin-top: .35rem; }
details.reasons summary { cursor: pointer; color: var(--muted); font-size: .78rem; }
details.reasons ul { margin: .35rem 0 0; padding-left: 1.1rem; font-size: .8rem; color: #c3d2ea; }
details.reasons li { margin-bottom: .15rem; }
.chip-list { display: flex; flex-wrap: wrap; gap: .3rem; }
.mini-tag { font-size: .7rem; padding: .1rem .4rem; border-radius: 5px; background: #16243a; border: 1px solid var(--line-2); color: var(--muted); }
.copy-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: .9rem; padding: .1rem .3rem; }
.copy-btn:hover { color: var(--gold); }
hr { border: none; border-top: 1px solid var(--line); margin: 1rem 0; }
.doc h4 { color: var(--gold-2); margin-top: 1.1rem; font-size: .95rem; }
.doc ul { padding-left: 1.2rem; font-size: .86rem; color: #c3d2ea; }
.doc li { margin-bottom: .3rem; }
.doc table { font-size: .8rem; }
.kpi-inline { display: flex; gap: .8rem; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.kpi-inline b { color: var(--text); }

/* ---------------------------- impor CSV ---------------------------- */
.import-card summary { cursor: pointer; font-weight: 700; font-size: .95rem; }
.import-card summary::marker { color: var(--gold); }
.import-card[open] summary { margin-bottom: .6rem; }
.import-card textarea { font-family: var(--mono); font-size: .8rem; }
