:root {
  --bg: #f4f6f5; --card: #fff; --ink: #1d2626; --muted: #6b7777; --line: #e2e7e6;
  --pri: #0f3d3e; --pri2: #1d6b6c; --acc: #e0a526; --ok: #1e8a4c; --bad: #c7392f; --warn: #b7791f;
  --r: 12px; --sh: 0 1px 3px rgba(0,0,0,.07);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--bad); min-height: 1.2em; }
h3 { margin: 0 0 10px; font-size: 16px; }
button, input, select, textarea { font: inherit; }
input, select, textarea { width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--pri2); outline-offset: -1px; }
label { display: block; margin: 0 0 10px; font-size: 13px; color: var(--muted); }
label > input, label > select, label > textarea { margin-top: 4px; font-size: 15px; }
label.inline { display: flex; align-items: center; gap: 6px; margin: 0; }
label.inline input { width: auto; margin: 0; }
fieldset { border: 0; padding: 0; margin: 0 0 10px; } legend { font-size: 13px; color: var(--muted); padding: 0 0 4px; }
.btn { border: 1px solid transparent; border-radius: 10px; padding: 10px 14px; cursor: pointer; background: #e9eeed; color: var(--ink); min-height: 42px; }
.btn.sm { padding: 6px 10px; min-height: 34px; font-size: 14px; }
.btn.primary { background: var(--pri); color: #fff; }
.btn.ok { background: var(--ok); color: #fff; } .btn.bad { background: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--sh); padding: 14px; margin-bottom: 12px; }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: #e9eeed; color: var(--ink); white-space: nowrap; }
.notice { background: #fff6dd; border: 1px solid #f1d58a; border-radius: var(--r); padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; }
.brand { font-weight: 800; letter-spacing: .04em; color: var(--pri); }
.brand span { font-weight: 500; color: var(--acc); letter-spacing: 0; }
.brand.big { font-size: 26px; }

/* Layout */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--pri); color: #fff; }
.topbar .brand { color: #fff; }
.topbar .who { margin-left: auto; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.topbar .who .btn { color: #fff; border-color: rgba(255,255,255,.3); }
main { padding: 12px 12px 90px; max-width: 1180px; margin: 0 auto; }
.tabs { display: flex; gap: 4px; }
.tabs button { background: none; border: 0; color: inherit; padding: 8px 12px; border-radius: 9px; cursor: pointer; opacity: .8; }
.tabs button.on { background: rgba(255,255,255,.15); opacity: 1; font-weight: 600; }
#tabsTop { display: none; }
.tabs.bottom { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; background: #fff; border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); justify-content: space-around; }
.tabs.bottom button { flex: 1; display: flex; flex-direction: column; align-items: center; font-size: 12px; color: var(--muted); padding: 6px 2px; opacity: 1; }
.tabs.bottom button .ic { font-size: 20px; line-height: 1.2; }
.tabs.bottom button.on { color: var(--pri); background: #e6efee; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.bar h3 { margin: 0; }
.nav-date { display: flex; align-items: center; gap: 6px; flex: 1 1 100%; min-width: 0; order: -1; }
.nav-date strong { flex: 1; text-align: center; font-size: 16px; }
#viewSeg { flex: 1; } #viewSeg button { flex: 1; }
.ch dd span { font-size: 11px; font-weight: 500; }
.nav-date strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg { display: inline-flex; background: #e3e9e8; border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--ink); }
.seg button.on { background: #fff; box-shadow: var(--sh); font-weight: 600; }
.filters { background: #fff; border-radius: var(--r); padding: 8px 12px; margin-bottom: 10px; box-shadow: var(--sh); }
.filters summary { cursor: pointer; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 6px 11px; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--pri); color: #fff; border-color: var(--pri); }

/* Kalender bulan */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; background: var(--line); border-radius: var(--r); overflow: hidden; }
.month .dow { background: #f9fbfa; text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0; }
.month .day { background: #fff; min-height: 58px; padding: 3px; cursor: pointer; position: relative; }
.month .day.other { background: #fafbfb; color: #b5bdbd; }
.month .day.today .num { background: var(--acc); color: #fff; border-radius: 99px; }
.month .day.sel { outline: 2px solid var(--pri2); outline-offset: -2px; }
.month .num { font-size: 12px; display: inline-block; min-width: 20px; text-align: center; }
.month .dots { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 2px; }
.dot { width: 7px; height: 7px; border-radius: 99px; background: var(--muted); }
.month .ev { display: none; }
.st-ide { --c: #8a9696; } .st-script { --c: #5b7fbf; } .st-editing { --c: #8a63c2; } .st-nunggu_acc { --c: #d08a14; } .st-acc { --c: #1e8a4c; } .st-tayang { --c: #0f3d3e; }
.dot[class*="st-"] { background: var(--c); }
.dayhead { margin: 14px 0 6px; font-weight: 600; }
.ev-card { display: flex; gap: 10px; background: #fff; border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; box-shadow: var(--sh); border-left: 4px solid var(--c, #ccc); cursor: pointer; }
.ev-card .t { font-weight: 600; }
.ev-card .meta { font-size: 12px; color: var(--muted); }
.ev-card .time { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); min-width: 40px; }
.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; color: #fff; background: var(--c, #888); }
.week { display: grid; grid-template-columns: 1fr; gap: 8px; }
.week .wday { background: #f9fbfa; border-radius: 10px; padding: 6px; }
.week .wday h4 { margin: 2px 4px 6px; font-size: 13px; }
.week .wday.today h4 { color: var(--acc); }
.empty { color: var(--muted); font-size: 13px; padding: 4px 6px; }

/* Sheet */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; }
.sheet-body { background: var(--bg); width: 100%; max-width: 640px; max-height: 94vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 14px 14px calc(18px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; position: sticky; top: -14px; background: var(--bg); padding: 4px 0 8px; z-index: 1; }
.sheet-head h3 { margin: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions { display: flex; gap: 8px; justify-content: space-between; }

/* File */
.grid-files { display: grid; grid-template-columns: 1fr; gap: 10px; }
.file { background: #fff; border-radius: var(--r); box-shadow: var(--sh); overflow: hidden; }
.file .media { background: #111; display: grid; place-items: center; aspect-ratio: 9 / 12; max-height: 420px; width: 100%; }
.file .media video, .file .media img { max-width: 100%; max-height: 420px; display: block; }
.file .info { padding: 10px 12px; }
.file .name { font-weight: 600; word-break: break-all; }
.rv-menunggu { --c: #d08a14; } .rv-acc { --c: #1e8a4c; } .rv-tolak { --c: #c7392f; }
.review-box { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.review-box .btns { display: flex; gap: 6px; } .review-box .btns .btn { flex: 1; }
.comments { margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; }
.comments li { padding: 4px 0; border-top: 1px dashed var(--line); }
.progress { height: 8px; background: #e3e9e8; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress > div { height: 100%; background: var(--pri2); width: 0; transition: width .2s; }
.row-form { display: flex; gap: 6px; flex-wrap: wrap; } .row-form input, .row-form select { flex: 1; min-width: 120px; width: auto; }

/* Rekap */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.kpi { background: #fff; border-radius: var(--r); padding: 12px; box-shadow: var(--sh); }
.kpi .l { font-size: 12px; color: var(--muted); }
.kpi .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--muted); }
.up { color: var(--ok); } .down { color: var(--bad); }
.bar-target { height: 6px; background: #e3e9e8; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar-target > div { height: 100%; background: var(--acc); }
.chan { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 12px; }
.ch { background: #fff; border-radius: var(--r); padding: 12px; box-shadow: var(--sh); }
.ch.child { margin-left: 14px; background: #fbfcfc; }
.ch .hd { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ch .hd b { font-size: 15px; }
.ch dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 10px; margin: 8px 0 0; }
.ch dt { font-size: 11px; color: var(--muted); } .ch dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.ch.off { opacity: .75; border: 1px dashed var(--line); box-shadow: none; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th { color: var(--muted); font-weight: 500; font-size: 12px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.chart .legend i { display: inline-block; width: 10px; height: 3px; vertical-align: middle; margin-right: 4px; }
.src { font-size: 12px; color: var(--muted); }
.src code { font-size: 11px; background: #eef2f1; padding: 1px 4px; border-radius: 4px; word-break: break-all; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: #1d2626; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 30; max-width: 90vw; }

/* Chat */
body.on-chat main { padding-bottom: 0; }
#tab-chat { display: flex; flex-direction: column; height: calc(100dvh - 58px - 12px - 80px - env(safe-area-inset-bottom)); }
.chat-head { font-size: 14px; padding: 0 2px 8px; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px 10px; overscroll-behavior: contain; }
.chat-log .center { text-align: center; margin-top: 30px; }
.chat-more { align-self: center; }
.bubble { max-width: 86%; padding: 8px 12px 6px; border-radius: 14px; box-shadow: var(--sh); overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: var(--pri); color: #fff; border-bottom-right-radius: 4px; }
.bubble.ai { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px; }
.bubble.err-b { align-self: flex-start; background: #fdecea; color: var(--bad); font-size: 14px; }
.bubble .meta { font-size: 11px; opacity: .65; text-align: right; margin-top: 2px; }
.bubble .txt p { margin: 0 0 4px; } .bubble .txt p:last-child { margin-bottom: 0; } .bubble .txt p.h { font-weight: 700; }
.bubble .txt ul, .bubble .txt ol { margin: 2px 0 6px; padding-left: 20px; }
.bubble .txt pre { background: #f1f4f3; padding: 8px; border-radius: 8px; overflow-x: auto; font-size: 13px; margin: 4px 0; }
.bubble .txt code { font-size: 13px; background: #f1f4f3; padding: 0 4px; border-radius: 4px; }
.bubble.me .txt a { color: #fff; }
.bubble.live .txt:empty { display: none; }
.typing { text-align: left !important; font-style: italic; }
.dots { display: inline-flex; gap: 3px; margin-left: 5px; } .dots i { width: 5px; height: 5px; border-radius: 9px; background: currentColor; animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.chat-form { display: flex; gap: 8px; align-items: flex-end; padding: 8px 0 10px; background: var(--bg); }
.chat-form textarea { resize: none; min-height: 42px; max-height: 160px; font: inherit; }
.chat-form .btn { flex: none; }

@media (min-width: 760px) {
  #tab-chat { height: calc(100dvh - 58px - 36px); max-width: 820px; margin: 0 auto; }
  .nav-date { flex: 1; order: 0; } .nav-date strong { flex: none; } #viewSeg { flex: none; }
  #tabsTop { display: flex; } .tabs.bottom { display: none; }
  main { padding: 18px 20px 30px; }
  .month .day { min-height: 96px; }
  .month .dots { display: none; }
  .month .ev { display: block; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--c); padding: 1px 4px; margin-top: 2px; background: #f4f7f6; border-radius: 3px; }
  .week { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .week .wday { min-height: 300px; }
  .week .ev-card { flex-direction: column; gap: 2px; padding: 8px; }
  .grid-files { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .chan { grid-template-columns: repeat(2, 1fr); }
  .ch.child { margin-left: 0; }
  .rekap-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .sheet { align-items: center; } .sheet-body { border-radius: 16px; }
  .toast { bottom: 24px; }
}
