/* RST Taskboard — MOBILE-FIRST (kebalikan style.css Control Tower yang desktop-first).
   Aturan dasar = HP; satu breakpoint di 760px menambah layar lebar.
   Token warna disalin apa adanya dari control_tower/static/style.css supaya
   kedua app terasa satu keluarga. */
:root {
  --bg: #0f141a;
  --bg2: #131a22;
  --card: #1a222c;
  --card2: #202a36;
  --ink: #dfe6ee;
  --muted: #8a98a8;
  --line: #2b3643;
  --brand: #4d9fff;
  --brand-dark: #3b87e6;
  --ok: #3fb950;
  --warn: #e3a317;
  --over: #f8584f;
  --shadow: 0 1px 3px rgba(0,0,0,.45);
  --radius: 12px;
  --tabh: 58px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;  /* 16px: cegah zoom iOS */
  -webkit-text-size-adjust: 100%;
  padding-bottom: calc(var(--tabh) + env(safe-area-inset-bottom) + 12px);
}
body.bare { padding-bottom: 0; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.note { font-size: .9rem; }
.inline { display: inline; }
.empty { color: var(--muted); padding: 24px 4px; text-align: center; }

/* --- Rangka ------------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px calc(10px + env(safe-area-inset-top));
  background: var(--bg2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 700; }
.desknav { display: none; margin-left: auto; gap: 6px; flex-wrap: wrap; }
.container { max-width: 860px; margin: 0 auto; padding: 12px; }
/* Halaman padat data (papan & daftar) memakai lebar layar, bukan kolom sempit
   860px yang bikin semuanya menumpuk ke tengah. */
.container-wide { max-width: 1600px; }
.datum { color: var(--muted); margin: 0 0 14px; }

/* --- Tab bar bawah (hanya HP) ------------------------------------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--bg2); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: var(--tabh); font-size: .72rem; color: var(--muted);
  text-decoration: none;
}
.tab span { font-size: 1.15rem; position: relative; }
.tab.on { color: var(--brand); }
.tab:hover { text-decoration: none; }
.tab-add {
  font-size: 1.9rem; color: #fff; background: var(--brand);
  border-radius: 50%; width: 52px; height: 52px; margin: 3px auto 0;
  min-height: 52px; line-height: 1;
}
.dot {
  position: absolute; top: -4px; right: -12px; font-style: normal;
  background: var(--warn); color: #111; border-radius: 9px;
  font-size: .62rem; padding: 0 5px; font-weight: 700;
}

/* --- Primitif ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 14px;              /* 44px: target sentuh */
  background: var(--card2); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit; cursor: pointer; text-decoration: none;
}
.btn:hover { background: #26313f; text-decoration: none; }
.btn-sm { min-height: 36px; padding: 5px 10px; font-size: .85rem; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #06121f; font-weight: 600; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-done { color: var(--ok); border-color: #2b4a33; }
.btn-done:hover { background: #17301f; }
.btn-done-big {
  min-height: 56px; width: 100%; background: #17301f;
  border-color: #2b4a33; color: var(--ok); font-size: 1.05rem; font-weight: 600;
}
.btn-done-big:hover { background: #1d3d28; }
.btn.on { border-color: var(--brand); color: var(--brand); }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.ok-card { border-color: #2b4a33; }

input, select, textarea {
  width: 100%; padding: 10px; min-height: 44px;
  background: var(--bg2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  font: inherit;
}
textarea { min-height: 120px; resize: vertical; }
label { display: block; margin-bottom: 10px; font-size: .88rem; color: var(--muted); }
label input, label select, label textarea { margin-top: 4px; color: var(--ink); }

.flashes { padding: 8px 12px 0; max-width: 860px; margin: 0 auto; }
.flash { padding: 10px 12px; border-radius: 10px; margin-bottom: 8px; border: 1px solid var(--line); }
.flash-ok { background: #16301f; border-color: #2b4a33; }
.flash-error { background: #3a1c1a; border-color: #6b2b26; }
.flash-info { background: var(--card2); }

/* --- Chip --------------------------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.chip {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: var(--card2); border: 1px solid var(--line);
  font-size: .74rem; color: var(--muted); white-space: nowrap;
}
.chip-over { background: #3a1c1a; border-color: #6b2b26; color: #ffb3ad; }
.chip-warn { background: #3a2f12; border-color: #6b5620; color: #f0cd77; }
.chip-roll { background: #2a2340; border-color: #443a66; color: #c3b3f0; }

/* Status: satu warna per status, teksnya yang menjelaskan. Ikon dibuang -- "🔥
   vs 🚨" tak memberi tahu mana yang lebih mendesak. */
.st-trouble  { color: #ffb3ad; border-color: #6b2b26; background: #33191700; }
.st-high     { color: #f0cd77; border-color: #6b5620; }
.st-followup { color: #9ec9ff; border-color: #2f5183; }
.st-backlog  { color: var(--muted); border-color: var(--line); }
.st-someday  { color: #8d8fa8; border-color: var(--line); }

/* --- Fokus Hari Ini ----------------------------------------------------- */
.rollbanner { margin-bottom: 14px; }
.focusgrid { display: grid; gap: 12px; }
.focuscard {
  background: var(--card); border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.fc-head { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.fc-head:empty { display: none; }
.fc-title { display: block; font-size: 1.25rem; font-weight: 650; color: var(--ink); line-height: 1.3; }
.fc-notes { color: var(--muted); font-size: .92rem; margin: 8px 0 0; white-space: pre-wrap; }
.fc-roll { color: #c3b3f0; font-size: .82rem; margin: 8px 0 0; }
.fc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.fc-actions form:first-child { flex: 1 1 100%; }
.donetoday { color: var(--ok); margin-top: 20px; text-align: center; }

.picker { margin-top: 18px; }
.picker summary { cursor: pointer; padding: 10px 0; color: var(--brand); }
.picklist { list-style: none; padding: 0; margin: 0; }
.picklist li {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 10px;
  align-items: start; padding: 10px 0; border-top: 1px solid var(--line);
}
.picklist .chips { grid-column: 2; }

/* --- Papan kanban -------------------------------------------------------- */
/* Kolom digeser sebagai satu grup di layar sempit dan berjajar di layar lebar.
   Kartu bisa diseret di desktop; dropdown status di tiap kartu melakukan hal
   yang sama dan itulah satu-satunya yang andal di HP. */
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(272px, 1fr);
  gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: start;
  scroll-snap-type: x proximity;
}
.bcol {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); display: flex; flex-direction: column;
  max-height: calc(100vh - 230px); scroll-snap-align: start;
}
.bcol-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; font-size: .82rem; font-weight: 650;
  letter-spacing: .02em; text-transform: uppercase;
  border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: var(--bg2); border-radius: var(--radius) var(--radius) 0 0;
}
.bcol-head b { color: var(--muted); font-size: .8rem; }
.bcol-body { padding: 8px; overflow-y: auto; display: grid; gap: 8px; }
.bcol-body.drag-over { background: #16283d; outline: 1px dashed var(--brand); }
.bcol-empty { color: var(--muted); font-size: .82rem; text-align: center; padding: 10px 0; margin: 0; }

.task-card { margin: 0; padding: 10px; }
.task-card.dragging { opacity: .4; }
.task-card.is-over { border-left: 3px solid var(--over); }
.task-card.is-focus { border-left: 3px solid var(--brand); }
.tc-top { display: flex; align-items: start; gap: 6px; justify-content: space-between; }
.tc-title { color: var(--ink); font-weight: 550; line-height: 1.35; }
.tc-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }

/* --- Editor inline (status / tenggat / catatan langsung dari daftar) ------ */
.q-form { display: inline-flex; gap: 4px; align-items: center; margin: 0; }
.q-note-form { display: flex; margin-top: 6px; }
.q-status, .q-due {
  width: auto; min-height: 32px; padding: 3px 6px; font-size: .8rem;
  background: var(--card2); border-radius: 8px;
}
.q-status { min-width: 108px; }
.q-due.is-over { border-color: #6b2b26; color: #ffb3ad; }
.q-note {
  width: 100%; min-height: 32px; padding: 5px 7px; font-size: .82rem;
  background: var(--bg2); border-radius: 8px; resize: vertical;
  color: var(--muted);
}
.q-note:focus { color: var(--ink); min-height: 62px; }
/* Tombol Save hanya muncul saat catatannya benar-benar diubah (dipasang app.js);
   tanpa JS ia selalu tampil supaya tetap bisa disimpan. */
.q-note-save { display: none; align-self: flex-start; margin-left: 6px; }
.q-note-form.is-dirty .q-note-save { display: inline-flex; }
html.no-js .q-note-save { display: inline-flex; }

/* --- Filter ------------------------------------------------------------- */
.filters { margin-bottom: 12px; }
.filterrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.filterrow .search { flex: 1 1 100%; margin: 0; }
/* Di HP dua dropdown berbagi satu baris; kalau masing-masing sebaris penuh,
   filter saja sudah memakan setengah layar sebelum task pertama kelihatan. */
.filterrow select { width: auto; flex: 1 1 45%; min-height: 40px; }
.layouttoggle { display: flex; gap: 6px; margin-left: auto; }
.search { margin-bottom: 8px; }
.chiprow { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chiprow select { width: auto; flex: 1 1 140px; min-height: 40px; }
.fchip {
  padding: 6px 12px; border-radius: 999px; background: var(--card2);
  border: 1px solid var(--line); font-size: .82rem; color: var(--muted);
  text-decoration: none; min-height: 36px; display: inline-flex; align-items: center;
}
.fchip.on { border-color: var(--brand); color: var(--brand); background: #16283d; }
.fchip:hover { text-decoration: none; }

.quickadd { margin-bottom: 12px; }
.quickadd summary { cursor: pointer; padding: 8px 0; color: var(--brand); }
.addrow { display: grid; gap: 8px; margin-top: 8px; }

/* --- Daftar task -------------------------------------------------------- */
.listhead {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line);
  font-size: .85rem; color: var(--muted);
}
.selall { margin: 0; display: flex; align-items: center; gap: 8px; }
.selall input { width: 20px; height: 20px; min-height: 20px; }

.tasklist { list-style: none; padding: 0; margin: 0; }
.trow {
  display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px;
  align-items: start; padding: 12px 2px; border-bottom: 1px solid var(--line);
}
.tasklist.tight .trow { grid-template-columns: 1fr auto; padding: 10px 2px; }
.trow.is-done .ttitle { text-decoration: line-through; color: var(--muted); }
.trow.sel { background: #16283d; }
.tsel { width: 20px; height: 20px; min-height: 20px; margin-top: 3px; }
.ttitle { color: var(--ink); font-weight: 550; }
.tnotes {
  color: var(--muted); font-size: .85rem; margin: 5px 0 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tact { display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
        justify-content: flex-end; }
.tact-btns { display: flex; gap: 4px; }
.tact.stack { flex-direction: column; align-items: stretch; }
.is-pinned { color: var(--warn); border-color: var(--warn); }

/* --- Bar aksi massal ---------------------------------------------------- */
.bulkbar {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--tabh) + env(safe-area-inset-bottom));
  z-index: 25; display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 10px 12px; background: var(--card2);
  border-top: 1px solid var(--brand); box-shadow: 0 -4px 14px rgba(0,0,0,.5);
}
/* `display: flex` di atas mengalahkan atribut [hidden] (yang cuma display:none
   dari UA stylesheet) -- tanpa baris ini barnya tetap tampil walau 0 dipilih. */
.bulkbar[hidden] { display: none; }
.bulkbar select { width: auto; flex: 1 1 130px; min-height: 36px; padding: 5px 8px; }
.bcount { font-size: .85rem; color: var(--muted); margin-right: 4px; }
.bulkbar.static { position: static; box-shadow: none; margin-top: 12px; border-radius: var(--radius); }

.pager { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; }

/* --- Nunggu orang ------------------------------------------------------- */
.wgroup { margin-bottom: 20px; }
.wgroup h2 { font-size: 1.05rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wdays { font-size: .8rem; color: var(--muted); font-weight: 400; }
.wdays.over { color: var(--over); font-weight: 600; }
.wgroup.is-due h2 { color: #ffb3ad; }

/* --- Capture ------------------------------------------------------------ */
.capture textarea { min-height: 38vh; font-family: ui-monospace, Consolas, monospace; font-size: .95rem; }
.synhelp { font-size: .8rem; margin: 6px 0 12px; }
.caprow { display: grid; gap: 8px; margin-bottom: 12px; }

/* --- Detail & triase ---------------------------------------------------- */
.grid2 { display: grid; gap: 0 12px; }
.detailacts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px;
              padding-top: 14px; border-top: 1px solid var(--line); }
.detailacts form:first-child { flex: 1 1 100%; }
.events { list-style: none; padding: 0; margin: 0; font-size: .85rem; }
.events li { padding: 5px 0; border-bottom: 1px solid var(--line); }
.triase h2 { font-size: 1.3rem; }
.triase-actions { display: grid; gap: 8px; margin: 16px 0; }
.triase-actions .btn { width: 100%; }

/* --- Login -------------------------------------------------------------- */
.login { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.login h1 { font-size: 1.6rem; }

/* --- Layar lebar -------------------------------------------------------- */
@media (min-width: 760px) {
  body { padding-bottom: 24px; }
  .tabbar { display: none; }
  .desknav { display: flex; }
  .bulkbar { bottom: 0; }
  .focusgrid { grid-template-columns: repeat(3, 1fr); align-items: start; }
  .addrow { grid-template-columns: 2fr 1fr 1fr 1fr auto; align-items: end; }
  .caprow { grid-template-columns: repeat(3, 1fr); }
  .grid2 { grid-template-columns: 1fr 1fr; }
  .triase-actions { grid-template-columns: repeat(3, 1fr); }
  .tact.stack { flex-direction: row; }
  /* Daftar: judul melebar, kontrol edit rapat di kanan. */
  .trow { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
  .filterrow .search { flex: 1 1 220px; }
  .filterrow select { flex: 0 1 190px; }
}

/* Lima kolom muat sekaligus -- tak perlu geser samping lagi. */
@media (min-width: 1180px) {
  .board { grid-auto-columns: minmax(0, 1fr); overflow-x: visible; }
}

/* Umpan balik simpan-inline: kedip hijau singkat, tanpa toast yang menutupi apa pun. */
.just-saved, .just-saved .q-note { border-color: var(--ok) !important; transition: border-color .25s; }
.undo { margin: 4px 0; }
