:root {
  --accent: #0519B0;
  --accent-hover: #04138a;
  --accent-soft: #EEF0FF;
  --ink: #1c1b1a;
  --ink-2: #3d3b38;
  --muted: #6b6966;
  --line: #e7e3dd;
  --bg: #f6f5f3;
  --surface: #ffffff;
  --danger: #c62828;
  --radius: 10px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-head: "Plus Jakarta Sans", var(--font);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
button { font: inherit; }
kbd { font: 11px var(--font); padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: #fff; }

.btn { height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger:hover { color: var(--danger); border-color: #f0c9c9; background: #fff6f6; }

/* login */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 340px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; display: grid; gap: 12px; }
.login-card h1 { font: 700 20px var(--font-head); margin: 4px 0 0; }
.login-card p { margin: 0; color: var(--muted); }
.pin { position: relative; }
.pin input { width: 100%; height: 42px; padding: 0 44px 0 12px; border: 1px solid var(--line); border-radius: 8px; font: 16px var(--font); letter-spacing: .1em; outline: none; }
.pin input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pin button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 18px; }
.login-card .btn { height: 42px; justify-content: center; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; }

/* app shell */
.app { height: 100%; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font: 700 15px var(--font-head); flex-shrink: 0; }
.brand img { border-radius: 7px; }
.search { flex: 1; max-width: 560px; position: relative; display: flex; align-items: center; color: var(--muted); }
.search svg { position: absolute; left: 10px; }
.search input { width: 100%; height: 34px; padding: 0 10px 0 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font: inherit; color: var(--ink); outline: none; }
.search input:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.link { background: none; border: none; color: var(--muted); text-decoration: none; cursor: pointer; font-size: 13px; padding: 6px 4px; }
.link:hover { color: var(--accent); }
.top .link:first-of-type { margin-left: auto; }

.panes { flex: 1; min-height: 0; display: grid; grid-template-columns: 380px 1fr; }
.pane-list { border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.pane-detail { min-height: 0; overflow: auto; }

.filters { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.chip { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; font-size: 13px; font-weight: 500; }
.chip span { color: var(--muted); font-weight: 400; margin-left: 2px; }
.chip:hover { background: var(--bg); }
.chip.active { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip.active span { color: var(--accent); }

.list { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
.list li { display: block; }
.item { display: block; padding: 9px 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; cursor: pointer; }
.item:hover { background: var(--bg); }
.item.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.item .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; margin-top: 2px; }
.badge { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.badge.auto { background: #F1EFEC; color: var(--muted); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.day { padding: 10px 14px 4px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface); position: sticky; top: 0; }

/* detail */
.detail { max-width: 920px; padding: 16px 20px 40px; }
.placeholder { text-align: center; color: var(--muted); padding: 80px 16px; }
.placeholder img { opacity: .5; }
.hint { font-size: 13px; }
.back { display: none; }
.d-head { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
.d-title { flex: 1; min-width: 240px; }
.d-title h2 { font: 700 20px/1.25 var(--font-head); margin: 0 0 4px; word-break: break-word; }
.d-title .meta { color: var(--muted); font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

.win { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.win-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--ink-2); background: #fcfbfa; }
.win-head button { font-size: 12px; }
.win-tools { display: flex; gap: 12px; }
.grp .link + .link { margin-left: 8px; }
.exthint { font-size: 12px; color: var(--muted); margin: -4px 0 10px; }
.exthint.ok { color: #0F7B3F; }
.blk { border-top: 1px solid var(--line); }
.win-head + .blk { border-top: none; }
.blk.in { box-shadow: inset 3px 0 0 var(--gc); scroll-margin-top: 70px; }
.grp { display: flex; align-items: center; gap: 8px; padding: 8px 12px 4px; font-size: 13px; font-weight: 600; color: var(--ink); }
.grp i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.grp em, .gchip em { font-style: normal; font-weight: 500; font-size: 12px; color: var(--muted); }
.grp .link { font-size: 12px; font-weight: 400; padding: 0; }
.grp em { margin-right: auto; }
.grp.nogrp { color: var(--muted); font-weight: 500; }
.gsum { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 14px; }
.gchip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500; text-decoration: none; }
.gchip:hover { background: var(--bg); }
.gchip i { width: 9px; height: 9px; border-radius: 3px; }
.gchip.muted { color: var(--muted); }
.tab { display: flex; align-items: center; gap: 10px; padding: 6px 12px; text-decoration: none; color: inherit; border-top: 1px solid transparent; }
.tab:hover { background: var(--bg); }
.tab img, .tab .fav { width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0; }
.tab .fav { background: var(--line); }
.tab .t { flex: 1; min-width: 0; }
.tab .tt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab .tu { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab .pin-ic { font-size: 11px; color: var(--muted); }
.res-session { font-size: 12px; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 9px 14px; border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s; z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* mobile: satu pane, list ↔ detail */
@media (max-width: 760px) {
  .panes { grid-template-columns: 1fr; }
  .app.show-detail .pane-list { display: none; }
  .app:not(.show-detail) .pane-detail { display: none; }
  .pane-list { border-right: none; }
  .top { gap: 8px; padding-left: 12px; padding-right: 12px; flex-wrap: wrap; }
  .brand span { display: none; }
  .top a.link { display: none; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .detail { padding: 12px 12px 40px; }
  .back { display: inline-flex; margin-bottom: 10px; }
  .exthint { display: none; }
  .tab { padding: 9px 12px; }
  .item { padding: 11px 14px; }
}
