:root {
  --navy: #0f1e36; --navy-2: #172a47; --line: #e3e7ee; --ink: #142033; --muted: #66738a;
  --bg: #f4f6fa; --card: #fff; --crimson: #c62828; --crimson-2: #a91f1f; --gold: #c9a227;
  --green: #16a34a; --amber: #b45309; --blue: #1d4ed8; --radius: 12px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); min-height: 100vh; }
a { color: var(--blue); }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }

/* ---------- Kerangka ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #cfd8e6; padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 18px; padding: 4px 8px 18px; }
.brand .mark { width: 30px; height: 30px; border-radius: 8px; background: var(--crimson); display: grid; place-items: center; font-size: 16px; }
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--gold); letter-spacing: .06em; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 10px; color: #cfd8e6; text-decoration: none; padding: 9px 12px; border-radius: 8px; margin-bottom: 2px; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.on { background: var(--navy-2); color: #fff; box-shadow: inset 3px 0 0 var(--crimson); }
.nav .badge { margin-left: auto; }
.side .foot { margin-top: auto; padding: 10px 8px 0; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; }
.side .foot button { margin-top: 8px; width: 100%; }
main { padding: 24px 28px 60px; max-width: 1280px; width: 100%; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar h1 { margin: 0; margin-right: auto; }
.menu-btn { display: none; }

/* ---------- Komponen ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-bottom: 16px; }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 26px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.alert .value { color: var(--crimson); }

button, .btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; }
button:hover { border-color: #c5ccd8; }
button.primary { background: var(--crimson); border-color: var(--crimson); color: #fff; }
button.primary:hover { background: var(--crimson-2); }
button.danger { color: var(--crimson); border-color: #f1c7c7; }
button.ghost { background: transparent; border-color: transparent; }
button.sm { padding: 5px 10px; font-size: 12px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.side button { background: transparent; color: #cfd8e6; border-color: rgba(255,255,255,.15); }

input, select, textarea { font: inherit; width: 100%; padding: 9px 11px; border: 1px solid #cfd6e1; border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(198,40,40,.2); border-color: var(--crimson); }
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-weight: 600; font-size: 12px; margin: 0 0 5px; color: #3a475c; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row > .field { flex: 1 1 200px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; color: var(--ink); }
.check input { width: auto; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input, .toolbar select { width: auto; min-width: 180px; }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfd; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f8f9fc; }
td.wrap { white-space: normal; min-width: 200px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: #eef1f6; color: #45526a; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.red { background: #fde2e2; color: #9b1c1c; }
.badge.amber { background: #fef3c7; color: #92400e; }
.badge.blue { background: #dbeafe; color: #1e40af; }
.badge.gold { background: #fbf3d5; color: #7a5d00; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #9aa6b8; margin-right: 6px; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #e6eaf1; display: inline-grid; place-items: center; font-weight: 700; color: #4a5870; vertical-align: middle; }
.who { display: flex; align-items: center; gap: 10px; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15,30,54,.45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 14px; width: min(720px, 100%); max-height: 92vh; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal header { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal header h2 { margin: 0; margin-right: auto; }
.modal .body { padding: 18px 20px; }
.modal footer { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: #fff; }
dl.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; margin: 0 0 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-weight: 500; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 20% -10%, #24406b 0%, var(--navy) 55%); padding: 16px; }
.login .card { width: min(380px, 100%); padding: 28px; }
.login .brand { color: var(--ink); padding: 0 0 18px; }
.login .brand small { color: var(--crimson); }
.err { color: var(--crimson); font-size: 13px; min-height: 18px; margin: 4px 0 10px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 99; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 90vw; }
.toast.bad { background: var(--crimson); }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.bars .bar { flex: 1; background: linear-gradient(180deg, var(--crimson), #e57373); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bars .bar span { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); }
.bars-wrap { padding-bottom: 20px; }

/* ---------- Chat (portal advokat) ---------- */
.chat { display: flex; flex-direction: column; height: calc(100vh - 140px); min-height: 420px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.chat .head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.chat .timer { font-weight: 800; background: var(--crimson); color: #fff; padding: 4px 10px; border-radius: 8px; font-variant-numeric: tabular-nums; }
.chat .msgs { flex: 1; overflow-y: auto; padding: 16px; background: #f7f8fb; }
.chat .summary { background: #fff8e1; border: 1px solid #f3e1a6; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; white-space: pre-wrap; }
.bubble { max-width: 75%; padding: 9px 12px; border-radius: 14px; margin: 4px 0; white-space: pre-wrap; word-wrap: break-word; }
.bubble.me { margin-left: auto; background: var(--crimson); color: #fff; border-bottom-right-radius: 4px; }
.bubble.them { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble time { display: block; font-size: 10px; opacity: .7; margin-top: 3px; }
.chat form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.chat form textarea { min-height: 44px; height: 44px; }
.banner { padding: 8px 12px; text-align: center; font-size: 13px; }
.banner.warn { background: #fef3c7; color: #92400e; }
.banner.info { background: #e8edf5; color: #334155; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 700; }
.switch input { display: none; }
.switch .track { width: 46px; height: 26px; border-radius: 999px; background: #c7ced9; position: relative; transition: .2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { left: 23px; }

.req { border-left: 4px solid var(--crimson); }
.req.urgent { border-left-color: var(--gold); }
.req + .req { margin-top: 12px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 240px; z-index: 40; transform: translateX(-100%); transition: .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .menu-btn { display: inline-block; }
  main { padding: 16px; }
  dl.kv { grid-template-columns: 1fr; }
  dl.kv dd { margin-bottom: 6px; }
  .bubble { max-width: 88%; }
}

/* ---------- Banner promosi (pratinjau seperti di aplikasi) ---------- */
.promo { position: relative; aspect-ratio: 2 / 1; border-radius: 16px; overflow: hidden; color: #fff;
  background-size: cover; background-position: center; display: flex; align-items: flex-end; padding: 16px;
  box-shadow: 0 6px 18px rgba(15,30,54,.18); }
.promo::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.55), rgba(0,0,0,.05)); }
.promo.noimg::before { background: radial-gradient(120% 140% at 100% 0%, rgba(255,255,255,.18), transparent 60%); }
.promo > div { position: relative; max-width: 85%; }
.promo .lbl { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .1em; background: rgba(255,255,255,.2); padding: 2px 8px; border-radius: 999px; margin-bottom: 6px; }
.promo .ttl { font-size: 18px; font-weight: 800; line-height: 1.2; text-shadow: 0 1px 3px rgba(0,0,0,.3); }
.promo .sub { font-size: 12px; opacity: .92; margin-top: 4px; }
/* Gambar penuh (desain jadi) + animasi */
.promo.full { padding: 0; }
.promo.full::before { display: none; }
.promo .pimg { position: absolute; inset: 0; background-size: cover; background-position: center; transform-origin: 60% 50%; }
.promo .shine { position: absolute; inset: 0; pointer-events: none; z-index: 1; background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.28) 48%, rgba(255,255,255,.05) 55%, transparent 65%); background-size: 250% 100%; background-position: 160% 0; opacity: 0; }
.promo.anim-zoom .pimg, .promo.anim-zoom_shine .pimg { animation: promoZoom 9s ease-in-out infinite alternate; }
.promo.anim-shine .shine, .promo.anim-zoom_shine .shine { opacity: 1; animation: promoShine 4.5s ease-in-out infinite; }
.promo.anim-zoom:not(.full), .promo.anim-zoom_shine:not(.full) { animation: promoBg 9s ease-in-out infinite alternate; background-size: 108%; }
@keyframes promoZoom { from { transform: scale(1); } to { transform: scale(1.06) translateX(-1%); } }
@keyframes promoBg { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
@keyframes promoShine { 0%, 55% { background-position: 160% 0; } 100% { background-position: -60% 0; } }
@media (prefers-reduced-motion: reduce) { .promo .pimg, .promo .shine, .promo { animation: none !important; } }

/* Banner bergeser di portal advokat */
.promo-rot { position: relative; max-width: 640px; margin: 0 0 16px; }
.promo-rot .slides { position: relative; aspect-ratio: 2 / 1; border-radius: 16px; overflow: hidden; }
.promo-rot .slide { position: absolute; inset: 0; opacity: 0; transform: translateX(6%) scale(.98); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1); }
.promo-rot .slide.on { opacity: 1; transform: none; z-index: 1; }
.promo-rot .slide.out { opacity: 0; transform: translateX(-6%) scale(.98); }
.promo-rot .slide .promo { box-shadow: none; border-radius: 0; height: 100%; }
.promo-rot a.slide, .promo-rot .slide[data-link] { cursor: pointer; }
.promo-rot .dots { display: flex; justify-content: center; gap: 6px; margin-top: 8px; }
.promo-rot .dots button { width: 7px; height: 7px; padding: 0; border-radius: 4px; border: 0; background: #c9cfdb; transition: width .3s; min-height: 0; }
.promo-rot .dots button.on { width: 22px; background: var(--crimson, #c62828); }
.promo-rot .hide { position: absolute; top: 8px; right: 8px; z-index: 3; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.45); color: #fff; font-size: 16px; line-height: 28px; padding: 0; min-height: 0; cursor: pointer; }
@media (max-width: 720px) { .promo-rot { max-width: none; } }

.banner-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.banner-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.banner-card .meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 10px 0 8px; font-size: 12px; }
.banner-card .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.phone-preview { max-width: 360px; margin: 0 auto 16px; background: var(--navy); padding: 14px; border-radius: 22px; }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type=color] { width: 46px; height: 38px; padding: 2px; }

/* ---------- Pratinjau tampilan aplikasi ---------- */
.phone { width: 300px; border-radius: 30px; padding: 12px; background: #000; box-shadow: 0 12px 30px rgba(0,0,0,.25); }
.phone .screen { border-radius: 22px; overflow: hidden; min-height: 520px; padding: 14px 12px; color: #fff; }
.phone .bar { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; margin-bottom: 12px; }
.phone .bar img { height: 28px; max-width: 120px; object-fit: contain; }
.phone .hero { border-radius: 14px; padding: 14px; aspect-ratio: 16/7; display: flex; flex-direction: column; justify-content: flex-end; margin-bottom: 12px; }
.phone .hero b { font-size: 15px; }
.phone .chip { display: inline-block; padding: 5px 10px; border-radius: 8px; font-size: 11px; margin: 0 4px 6px 0; border: 1px solid rgba(255,255,255,.4); }
.phone .card2 { border-radius: 12px; padding: 10px; display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 12px; }
.phone .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; }
.phone .btn2 { margin-left: auto; padding: 6px 10px; border-radius: 16px; font-weight: 700; font-size: 11px; color: #fff; }
.phone .fab { margin-top: 18px; padding: 10px; border-radius: 14px; text-align: center; font-weight: 800; font-size: 12px; color: #fff; }
.logo-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.logo-box .lg { height: 48px; min-width: 48px; max-width: 180px; border: 1px dashed #c5ccd8; border-radius: 8px; display: grid; place-items: center; padding: 4px; background: #0f1e36; }
.logo-box .lg img { max-height: 40px; max-width: 170px; }
.sumgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- Dokumen & AI ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 10px 14px; color: var(--muted); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--crimson); }
.issue { border-left: 4px solid #cbd5e1; background: #f8fafc; padding: 8px 10px; border-radius: 6px; margin-bottom: 8px; font-size: 13px; }
.issue.tinggi { border-left-color: var(--crimson); background: #fff5f5; }
.issue.sedang { border-left-color: #d97706; background: #fffbeb; }
.issue .meta { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cite { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; font-size: 13px; }
.cite blockquote { margin: 6px 0 0; padding-left: 10px; border-left: 3px solid var(--line); color: #475569; }
.editor { display: grid; grid-template-columns: minmax(300px, 0.9fr) 1.4fr; gap: 16px; align-items: start; }
.editor textarea.doc { min-height: 70vh; font-family: "Times New Roman", serif; font-size: 15px; line-height: 1.6; }
.scroll { max-height: 72vh; overflow: auto; }
.kv2 { display: grid; grid-template-columns: 150px 1fr; gap: 4px 10px; font-size: 13px; margin-bottom: 12px; }
.kv2 dt { color: var(--muted); } .kv2 dd { margin: 0; white-space: pre-wrap; }
.key-row { display: flex; gap: 8px; align-items: center; }
.ok-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: #9aa6b8; margin-right: 6px; }
.ok-dot.on { background: var(--green); }
@media (max-width: 1000px) { .editor { grid-template-columns: 1fr; } }

/* Utas pengaduan */
.thread { height: auto !important; min-height: 0; padding: 12px; background: #f7f8fb; max-height: 60vh; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.bubble.me .muted { color: rgba(255, 255, 255, .82); }
