/* Layout: satu daftar baris; di HP tiap baris jadi kartu, di layar lebar jadi tabel 8 kolom seperti Excel. */
:root {
  --bg: #f3f5f1;
  --surface: #ffffff;
  --ink: #1d2420;
  --muted: #5d6a62;
  --line: #dde3dc;
  --accent: #0f5f4c;
  --accent-ink: #ffffff;
  /* warna Remarks = warna template Excel */
  --r-a1: #dbf0d4;
  --r-a1-ink: #24561a;
  --r-ws: #f7c7aa;
  --r-ws-ink: #7a3510;
  --r-gray: #d1d1d1;
  --r-gray-ink: #3f3f3f;
  --r-plain: #eef1ed;
  --r-plain-ink: #3b463f;
  --danger: #b3261e;
  --ok: #2e7d32;
  --shadow: 0 10px 40px rgba(20, 35, 28, .18);
  --f-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --f-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111613; --surface: #1a211d; --ink: #e6ece7; --muted: #9aa8a0; --line: #2c3631;
    --accent: #5cc6a6; --accent-ink: #062018;
    --r-a1: #23432a; --r-a1-ink: #bfe8b3; --r-ws: #4f3020; --r-ws-ink: #f6c8ab;
    --r-gray: #34393a; --r-gray-ink: #d7dbdc; --r-plain: #222a26; --r-plain-ink: #c5cfc9;
    --danger: #ff8a80; --ok: #81c784; --shadow: 0 10px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111613; --surface: #1a211d; --ink: #e6ece7; --muted: #9aa8a0; --line: #2c3631;
  --accent: #5cc6a6; --accent-ink: #062018;
  --r-a1: #23432a; --r-a1-ink: #bfe8b3; --r-ws: #4f3020; --r-ws-ink: #f6c8ab;
  --r-gray: #34393a; --r-gray-ink: #d7dbdc; --r-plain: #222a26; --r-plain-ink: #c5cfc9;
  --danger: #ff8a80; --ok: #81c784; --shadow: 0 10px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 400 15px/1.45 var(--f-body);
  padding: env(safe-area-inset-top, 0px) 16px calc(env(safe-area-inset-bottom, 0px) + 40px);
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 8px; padding: 8px 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.icon { padding: 6px 10px; font-size: 18px; line-height: 1; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: progress; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; display: grid; gap: 10px; }
.login-card h1 { font: 800 24px/1.1 var(--f-display); margin: 0; letter-spacing: -.01em; }
.login-card p { margin: 0; color: var(--muted); }
.login-card input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.err { color: var(--danger) !important; }

/* Header */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); padding-block: 14px 8px; display: grid; gap: 10px; }
.top-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.brand { min-width: 0; }
.brand h1 { margin: 0; font: 800 22px/1.05 var(--f-display); letter-spacing: -.015em; text-wrap: balance; }
.brand h1 span { color: var(--accent); }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.live i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.live.on i { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.live.off i { background: var(--danger); }
.tools { display: flex; gap: 8px; }
.tools input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip b { font: 500 12px var(--f-mono); margin-left: 4px; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip[aria-pressed="true"] b { color: inherit; }

/* Saringan dept / PIC / tenggat / urutan */
.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.fl { display: grid; gap: 2px; min-width: 0; }
.fl span { font: 700 12px var(--f-display); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.fl select { width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 14px; }
.fl.on select { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 600; }
.result-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; }
.result-info { margin: 0; font-size: 13px; color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
#resetBtn { min-height: 36px; flex: none; }
mark { background: color-mix(in srgb, #ffd54f 70%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.tools input, .tools .btn { min-height: 44px; }
@media (max-width: 720px) { .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.menu { position: fixed; right: 16px; top: calc(env(safe-area-inset-top, 0px) + 60px); z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); display: grid; min-width: 240px; overflow: hidden; }
.menu button { text-align: left; background: none; border: 0; padding: 12px 16px; cursor: pointer; }
.menu button:hover { background: var(--bg); }

/* Rows */
.list { display: grid; gap: 8px; }
.thead { display: none; }
.item {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; display: grid; gap: 4px; cursor: pointer; min-width: 0;
  grid-template-columns: auto 1fr; grid-template-areas: "no rem" "title title" "meta meta" "notes notes";
}
.item:hover { border-color: var(--accent); }
.item.flash { animation: flash 1.4s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 3px var(--accent); } to { box-shadow: 0 0 0 0 transparent; } }
.c-no { grid-area: no; font: 500 12px/1.9 var(--f-mono); color: var(--muted); font-variant-numeric: tabular-nums; min-width: 2.2em; }
.c-rem { grid-area: rem; justify-self: start; }
.c-title { grid-area: title; font-weight: 700; font-size: 15.5px; }
.c-meta { grid-area: meta; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); }
.c-meta .due { color: var(--ink); font-weight: 600; }
.c-notes { grid-area: notes; font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.c-notes:empty, .c-detail:empty { display: none; }
.c-notes, .c-detail, .c-due, .c-pic, .c-dept { display: none; }
.c-notes { display: -webkit-box; }
.pill { display: inline-block; border-radius: 6px; padding: 1px 8px; font-size: 12px; font-weight: 700; letter-spacing: .02em; background: var(--r-plain); color: var(--r-plain-ink); }
.pill.a1 { background: var(--r-a1); color: var(--r-a1-ink); }
.pill.ws { background: var(--r-ws); color: var(--r-ws-ink); }
.pill.gray { background: var(--r-gray); color: var(--r-gray-ink); }
.item.is-done { opacity: .72; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

@media (min-width: 1000px) {
  body { padding-inline: 24px; }
  .thead, .item {
    display: grid; grid-template-areas: none;
    grid-template-columns: 4.2rem 8.5rem minmax(14rem, 2.2fr) minmax(10rem, 1.6fr) minmax(12rem, 2fr) 8.5rem 9rem 5.5rem;
    gap: 12px;
  }
  .thead { position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--toph, 146px)); z-index: 4; background: var(--bg); padding: 6px 12px; font: 700 12px var(--f-display); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); border-bottom: 1px solid var(--line); }
  .list { gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
  .item { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 9px 12px; align-items: start; }
  .item > * { grid-area: auto !important; min-width: 0; }
  .c-meta { display: none; }
  .c-notes, .c-detail, .c-due, .c-pic, .c-dept { display: block; font-size: 13.5px; color: var(--ink); white-space: pre-line; overflow-wrap: anywhere; }
  .c-notes, .c-detail { -webkit-line-clamp: 4; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); }
  .c-title { font-size: 14.5px; }
  .c-notes:empty, .c-detail:empty { display: block; }
  .c-due { font-weight: 600; }
}

/* Sheet / panel */
.sheet { position: fixed; inset: 0; z-index: 30; background: rgba(10, 18, 14, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet-card {
  background: var(--surface); width: min(980px, 100%); max-height: 94vh; overflow-y: auto;
  border-radius: 16px 16px 0 0; padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 18px); box-shadow: var(--shadow); display: grid; gap: 12px;
}
@media (min-width: 760px) { .sheet { align-items: center; } .sheet-card { border-radius: 16px; } }
.sheet-head { display: flex; align-items: center; gap: 10px; }
.sheet-head h2 { margin: 0; font: 800 18px var(--f-display); flex: 1; }
.save-state { font-size: 12px; color: var(--muted); }
.save-state.ok { color: var(--ok); }
.save-state.bad { color: var(--danger); }
.remote-note { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--r-ws); color: var(--r-ws-ink); font-size: 13px; }
.edit-form { display: grid; gap: 4px; }
.edit-form label { font: 700 12px var(--f-display); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-top: 6px; }
.edit-form input, .edit-form textarea, .edit-form select { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); resize: vertical; }
.edit-form textarea { min-height: 2.6em; line-height: 1.5; overflow: hidden; }
.edit-form #f_notes, .edit-form #f_detail { font-size: 16px; min-height: 7.5em; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two > div { display: grid; gap: 4px; min-width: 0; }
.move { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.move > span { margin-right: 4px; }
.move b { font-family: var(--f-mono); color: var(--ink); }
.move input { width: 5.5em; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.to-no { margin-left: 4px; }
.sheet-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.del-confirm { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.panel-body { display: grid; gap: 8px; font-size: 14px; }
.panel-body .entry { display: grid; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.panel-body .entry small { color: var(--muted); font-family: var(--f-mono); font-size: 12px; }
.panel-body .entry .row-actions { display: flex; gap: 6px; margin-top: 4px; }
.panel-body input { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); z-index: 40; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100% - 32px); box-shadow: var(--shadow); }

@media (max-width: 520px) {
  .top-row { align-items: flex-start; }
  .brand h1 { font-size: 20px; }
  #exportBtn { padding: 8px 10px; }
  .live b { display: none; }
}
@media (prefers-reduced-motion: reduce) { .item.flash { animation: none; } }
/* di HP header tinggi karena saringan; jangan menempel supaya daftar tetap lega */
@media (max-width: 999px) { .top { position: static; } }

/* Drag urutan */
.c-no { display: inline-flex; align-items: flex-start; gap: 4px; }
.grip { border: 0; background: none; color: var(--muted); font-size: 16px; line-height: 1; padding: 4px 6px; margin: -3px 0 0 -6px; border-radius: 6px; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.grip:hover { background: var(--bg); color: var(--ink); }
.grip:active { cursor: grabbing; }
.list.no-drag .grip { opacity: .3; cursor: not-allowed; }
.item.dragging { position: relative; z-index: 10; opacity: .92; box-shadow: var(--shadow); background: var(--surface); transition: none; }
.drop-line { height: 3px; background: var(--accent); border-radius: 2px; margin: -1px 0; }
@media (max-width: 999px) { .grip { font-size: 20px; padding: 6px 10px; margin: -8px 0 -6px -10px; } }

/* Mode pilih (hapus massal) */
.sel { width: 22px; height: 22px; margin: 0 6px 0 0; accent-color: var(--danger); vertical-align: middle; cursor: pointer; }
.list.selecting .grip { display: none; }
.item.selected { outline: 2px solid var(--danger); outline-offset: -2px; background: color-mix(in srgb, var(--danger) 7%, transparent); }
.selbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; max-width: calc(100vw - 24px);
  background: var(--bg, #fff); border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.selbar .btn { min-height: 44px; }
.selbar b { font-size: 14px; padding: 0 4px; }
#selBtn[aria-pressed="true"] { background: var(--danger); color: #fff; border-color: var(--danger); }
.list.selecting { padding-bottom: 110px; }
/* Cegah geser samping di HP sempit (320–390px) */
.top, .top > *, .tools, .chips, .filters { min-width: 0; max-width: 100%; }
.tools .btn { flex: none; padding-left: 12px; padding-right: 12px; }
@media (max-width: 400px) { .top-actions { flex-wrap: wrap; } }
.selbar { left: 12px; right: 12px; transform: none; max-width: 720px; margin: 0 auto; }
.selbar b { flex: 1 0 100%; text-align: center; }

.fabs { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 29; display: flex; gap: 8px; }
.fabs[hidden] { display: none; }
.selfab { min-height: 48px; padding: 0 18px; white-space: nowrap;
  border-radius: 24px; border: 1px solid var(--line); background: var(--surface, #fff); color: var(--ink, #111); font-weight: 700; font-size: 15px;
  box-shadow: 0 6px 18px rgba(0,0,0,.18); cursor: pointer; }
.selfab[hidden] { display: none; }

.chat-card { display: flex; flex-direction: column; max-height: 92vh; }
.chat-info { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.chat-log { flex: 1; min-height: 200px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px 8px; }
.msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink, #fff); border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--surface, #f3f4f6); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg small { display: block; font-size: 12px; opacity: .7; margin-top: 4px; }
.msg.typing { font-style: italic; color: var(--muted); }
.chat-form { display: flex; gap: 8px; align-items: flex-end; border-top: 1px solid var(--line); padding-top: 8px; }
.chat-form textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 160px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 15px; resize: vertical; background: var(--surface); }
.chat-form .btn { min-height: 44px; }
#chatBtn { min-height: 40px; }

.pill.oo { background: #ede4ff; color: #4c2a92; }

/* Section Smallbytes GH (Hazel, 7 Okt 2026) */
.sb { margin-top: 22px; border-top: 3px solid var(--accent); padding-top: 10px; }
.sb-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sb-head h2 { margin: 0; font: 800 18px/1.2 var(--f-display); letter-spacing: -.01em; }
.sb-head h2 b { font: 500 13px var(--f-mono); color: var(--muted); margin-left: 6px; }
.sb-head .btn { min-height: 44px; }
.sb-note { margin: 6px 0 10px; font-size: 13px; color: var(--muted); }
.sb-list .no { color: var(--accent); font-weight: 700; }
.sb.collapsed { padding-bottom: 4px; }
.sb-empty { padding: 16px 0; }
.list.selecting.sb-list { padding-bottom: 0; }
.sb.selecting-pad { padding-bottom: 120px; }

/* Tab tampilan: List Meeting | Smallbytes GH */
.views { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); min-width: 0; }
.views button { min-height: 44px; border: 0; background: transparent; font: 700 14px var(--f-display); cursor: pointer; padding: 6px 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.views button + button { border-left: 1px solid var(--line); }
.views button b { font: 500 12px var(--f-mono); margin-left: 4px; }
.views button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.sb.sb-only { margin-top: 0; border-top: 0; padding-top: 0; }
.sb.sb-only .sb-head { display: none; }
.sb.sb-only .sb-note { margin-top: 0; }

/* Kolom cari menempel di atas saat digulir (Hazel, 7 Okt 2026) */
.pinbar { position: fixed; top: 0; left: 0; right: 0; z-index: 15; display: flex; gap: 8px; align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 16px 8px; background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.pinbar input { flex: 1; min-width: 0; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.pinbar .btn { min-height: 44px; min-width: 44px; flex: none; }
@media (min-width: 1000px) { .pinbar { padding-inline: 24px; } }
