:root {
  --bg: #f5f6fa; --panel: #ffffff; --panel2: #f0f2f8; --line: #e2e5ee; --text: #161a2b; --muted: #636a82;
  --brand: #2447d6; --brand2: #1a36a8; --brandSoft: #e6ebff; --ok: #138a4c; --okSoft: #e3f6ec; --warn: #a15c00; --warnSoft: #fff3dd; --bad: #c62f2f; --badSoft: #fde8e8;
  --star: #e8a300; --shadow: 0 1px 2px rgba(20,25,50,.06), 0 4px 16px rgba(20,25,50,.05); --r: 14px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1220; --panel: #171b2d; --panel2: #1e2338; --line: #2a3050; --text: #e9ecf7; --muted: #9aa2bf;
  --brand: #6f8cff; --brand2: #8ea5ff; --brandSoft: #232c55; --ok: #4fd18b; --okSoft: #183a2a; --warn: #ffb547; --warnSoft: #3a2c12; --bad: #ff7a7a; --badSoft: #3d1d22;
  --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
small, .muted { color: var(--muted); }
[hidden] { display: none !important; }

.boot { min-height: 100vh; display: grid; place-content: center; text-align: center; gap: 12px; color: var(--muted); }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; flex: none; }
.logo-mark.big { width: 56px; height: 56px; font-size: 28px; margin: 0 auto; }
img.logo-mark { display: block; background: none; object-fit: contain; }

.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; }
.brand b { display: block; font-size: 17px; } .brand small { font-size: 12px; }
.nav-h { font-size: 11px; letter-spacing: .08em; font-weight: 700; color: var(--muted); margin: 14px 10px 6px; }
.nav-a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text); font-size: 14px; }
.nav-a:hover { background: var(--panel2); }
.nav-a.on { background: var(--brandSoft); color: var(--brand); font-weight: 600; }
.nav-a .n { margin-left: auto; font-size: 12px; color: var(--muted); }
.nav-a .tag { margin-left: auto; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--warnSoft); color: var(--warn); }
.side-foot { margin-top: auto; padding: 12px 10px 0; font-size: 12px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 5; display: flex; gap: 10px; align-items: center; padding: 12px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.search { position: relative; flex: 1; max-width: 560px; }
.search input { width: 100%; padding: 10px 40px 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); outline: none; }
.search input:focus { border-color: var(--brand); }
.search kbd { position: absolute; right: 10px; top: 9px; font-size: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; color: var(--muted); }
.qres { position: absolute; left: 0; right: 0; top: 46px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-height: 60vh; overflow: auto; padding: 6px; }
.qres a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.qres a:hover, .qres a.sel { background: var(--panel2); }
.icon-btn { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; width: 40px; height: 40px; cursor: pointer; flex: none; }
.view { padding: 24px; max-width: 1180px; width: 100%; }
.foot { margin-top: auto; padding: 18px 24px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gauto { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt { margin-top: 18px; } .mt2 { margin-top: 28px; } .mb { margin-bottom: 14px; }

.hero { background: linear-gradient(135deg, var(--brand), #6a3df0); color: #fff; border: 0; }
.hero p { opacity: .92; margin: 4px 0 14px; }
.hero .btn { background: #fff; color: var(--brand2); }
.stat b { display: block; font-size: 1.7rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }
.stat i { font-style: normal; font-size: 20px; float: right; }

.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 11px; font-weight: 600; cursor: pointer; text-align: center; justify-content: center; }
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: var(--panel); color: var(--text); border-color: var(--line); }
.btn.soft { background: var(--brandSoft); color: var(--brand); }
.btn.ok { background: var(--ok); }
.btn.danger { background: var(--panel); color: var(--bad); border-color: var(--line); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.btn.big { padding: 14px 20px; font-size: 16px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-size: 13px; color: var(--text); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--panel2); color: var(--muted); }
.tag.Easy { background: var(--okSoft); color: var(--ok); } .tag.Medium { background: var(--warnSoft); color: var(--warn); } .tag.Hard { background: var(--badSoft); color: var(--bad); }
.code { font: 600 12px ui-monospace, Menlo, monospace; color: var(--brand); }
.star { background: none; border: 0; cursor: pointer; font-size: 18px; color: var(--muted); padding: 2px 4px; line-height: 1; }
.star.on { color: var(--star); }

.item { display: flex; flex-direction: column; gap: 6px; cursor: pointer; transition: transform .08s, border-color .08s; }
.item:hover { border-color: var(--brand); transform: translateY(-1px); }
.item h3 { margin: 0; }
.cat { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.cat .ic { font-size: 24px; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--panel2); }
.cat:hover { border-color: var(--brand); }

.list-row { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .t { flex: 1; min-width: 0; cursor: pointer; }
.list-row .t b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

label.f { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.in, select.in, textarea.in { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); outline: none; }
.in:focus { border-color: var(--brand); }
textarea.in { min-height: 90px; resize: vertical; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.fgrid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fgrid .full { grid-column: 1 / -1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; background: var(--panel); padding: 9px 14px; cursor: pointer; }
.seg button.on { background: var(--brand); color: #fff; }
.check { display: inline-flex; gap: 8px; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--panel); }
.check input { accent-color: var(--brand); }

.steps { display: flex; gap: 6px; margin-bottom: 18px; }
.steps div { flex: 1; height: 6px; border-radius: 6px; background: var(--line); }
.steps div.on { background: var(--brand); }
.stepname { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.note { padding: 12px 14px; border-radius: 12px; background: var(--warnSoft); color: var(--warn); font-size: 14px; }
.note.info { background: var(--brandSoft); color: var(--brand); }
.note.ok { background: var(--okSoft); color: var(--ok); }
.note.bad { background: var(--badSoft); color: var(--bad); }
.opt { border: 2px solid var(--line); border-radius: var(--r); padding: 16px; }
.opt.on { border-color: var(--brand); }
.ai-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.empty { text-align: center; padding: 34px 18px; color: var(--muted); }
.empty .e { font-size: 36px; }
.spin { width: 18px; height: 18px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp .8s linear infinite; display: inline-block; }
@keyframes sp { to { transform: rotate(360deg); } }
.loading { text-align: center; padding: 40px 10px; }
.loading .spin { width: 34px; height: 34px; color: var(--brand); }
.bar { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; margin: 14px auto 0; max-width: 360px; }
.bar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .6s; }

/* preview dokumen */
.paper { background: #fff; color: #111; border-radius: 6px; padding: 34px 40px; font-family: "Times New Roman", Georgia, serif; font-size: 15px; line-height: 1.5; box-shadow: var(--shadow); border: 1px solid var(--line); }
.paper h2 { text-align: center; font-size: 18px; margin: 0 0 4px; }
.paper h3 { font-size: 15px; margin: 18px 0 6px; }
.paper h4 { font-size: 15px; margin: 12px 0 4px; }
.paper table { border-collapse: collapse; width: 100%; margin: 6px 0; font-size: 14px; }
.paper td, .paper th { border: 1px solid #999; padding: 5px 7px; vertical-align: top; text-align: left; }
.paper th { background: #d9e2f3; }
.paper ol, .paper ul { margin: 4px 0; padding-left: 24px; }
.paper .kop { text-align: center; border-bottom: 3px double #000; padding-bottom: 8px; margin-bottom: 14px; display: flex; align-items: center; gap: 14px; justify-content: center; }
.paper .kop img { width: 64px; height: 64px; object-fit: contain; }
.paper .kop b { font-size: 19px; display: block; }
.paper .pb { border-top: 2px dashed #bbb; margin: 28px 0 18px; text-align: center; font: 12px ui-sans-serif, system-ui; color: #888; }
.paper .stim { font-style: italic; margin-left: 22px; }
.paper .ops { list-style: upper-alpha; }
.paper .key { color: #138a4c; font-weight: 700; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.sticky-act { position: sticky; top: 66px; z-index: 3; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 12px; z-index: 50; font-size: 14px; max-width: calc(100vw - 32px); }
.only-m { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 19; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; z-index: 20; width: 270px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .only-m { display: inline-grid; place-items: center; } .only-d { display: none; }
  .top { padding: 10px 16px; }
  .view { padding: 16px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3, .g2 { grid-template-columns: 1fr; }
  .fgrid { grid-template-columns: 1fr; }
  .paper { padding: 18px 16px; font-size: 14px; }
  .ai-btns { grid-template-columns: 1fr; }
  .sticky-act { top: 60px; }
  h1 { font-size: 1.35rem; }
}
