/* ===========================================================================
   IDW Task Board
   Token di :root adalah satu-satunya tempat warna dan jarak didefinisikan.
   Untuk mengganti ke warna brand IDW, ubah --accent dan --ink saja.
   ======================================================================== */

:root {
  --accent: #e8502a;
  --accent-soft: #fdeee9;
  --accent-ink: #ffffff;

  --ink: #1c1917;
  --ink-2: #44403c;
  --ink-3: #78716c;
  --ink-4: #a8a29e;

  --bg: #f7f6f4;
  --surface: #ffffff;
  --surface-2: #faf9f7;
  --line: #e7e5e4;
  --line-strong: #d6d3d1;

  --urgent: #dc2626;
  --high: #ea580c;
  --medium: #ca8a04;
  --low: #65a30d;
  --neutral: #a8a29e;

  --overdue-bg: #fef2f2;
  --overdue-line: #fecaca;

  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgb(28 25 23 / 0.06);
  --shadow-md: 0 4px 16px rgb(28 25 23 / 0.08);
  --shadow-lg: 0 16px 48px rgb(28 25 23 / 0.16);

  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --col-w: 312px;
}

[data-theme='dark'] {
  --accent: #ff6b43;
  --accent-soft: #2a1a14;
  --accent-ink: #1c1917;

  --ink: #f5f5f4;
  --ink-2: #d6d3d1;
  --ink-3: #a8a29e;
  --ink-4: #78716c;

  --bg: #16130f;
  --surface: #211d19;
  --surface-2: #1a1713;
  --line: #342f2a;
  --line-strong: #44403c;

  --overdue-bg: #2b1512;
  --overdue-line: #5c241d;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 16px rgb(0 0 0 / 0.45);
  --shadow-lg: 0 16px 48px rgb(0 0 0 / 0.6);
}

/* --- dasar ------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

/* Beberapa blok di bawah memakai display grid/flex, yang specificity-nya
   mengalahkan [hidden] bawaan browser. Tanpa baris ini, elemen ber-atribut
   hidden tetap tampil. */
[hidden] {
  display: none !important;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- tombol ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.btn--ghost {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink-2);
}
.btn--ghost:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.btn--primary:hover {
  filter: brightness(1.06);
}

.btn--quiet {
  color: var(--accent);
  padding: 7px 4px;
  font-weight: 600;
}
.btn--quiet:hover {
  text-decoration: underline;
}

.btn__icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn.is-spinning .btn__icon {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- gerbang passcode -------------------------------------------------- */

.gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  z-index: 60;
}

.gate__card {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.gate__mark {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.gate__title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.gate__text {
  color: var(--ink-3);
  font-size: 13px;
  margin-bottom: 4px;
}

.gate__input {
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.gate__error {
  color: var(--urgent);
  font-size: 13px;
}

.gate__submit {
  justify-content: center;
  padding: 11px;
}

/* --- kerangka ---------------------------------------------------------- */

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.topbar__identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.topbar__titles {
  min-width: 0;
}

.topbar__title {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar__sub::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--low);
  flex-shrink: 0;
}

.topbar__sub[data-state='syncing']::before {
  background: var(--medium);
  animation: pulse 1.2s ease-in-out infinite;
}
.topbar__sub[data-state='error']::before {
  background: var(--urgent);
}
.topbar__sub[data-state='stale']::before {
  background: var(--ink-4);
}

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

.topbar__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* --- ringkasan --------------------------------------------------------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.metric {
  padding: 13px 20px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric__value {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.metric__label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
}

.metric--alert .metric__value {
  color: var(--urgent);
}
.metric--warn .metric__value {
  color: var(--high);
}

.metric--people {
  grid-column: span 2;
  gap: 6px;
}

/* Dibatasi dua baris supaya tim besar tidak membuat seluruh baris ringkasan
   ikut tinggi. Sisanya bisa digulir. */
.metric__people {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 56px;
  overflow-y: auto;
  scrollbar-width: thin;
  padding-right: 4px;
}

.chip-person {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 11px;
  background: var(--surface-2);
  cursor: pointer;
}
.chip-person:hover {
  border-color: var(--line-strong);
}
.chip-person b {
  font-family: var(--mono);
  font-weight: 600;
}
.chip-person[data-overdue='true'] {
  border-color: var(--overdue-line);
  background: var(--overdue-bg);
  color: var(--urgent);
}

/* --- filter ------------------------------------------------------------ */

.controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 11px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.controls__search {
  position: relative;
  flex: 1 1 220px;
  max-width: 340px;
}

.controls__searchicon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--ink-4);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  pointer-events: none;
}

/* Tombol "Filter" hanya muncul di layar kecil. */
.controls__more {
  display: none;
}

.controls__badge {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
}

.controls__search input {
  width: 100%;
  padding: 8px 12px 8px 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.controls__search input::placeholder {
  color: var(--ink-4);
}

.controls__selects {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.select {
  display: flex;
  align-items: center;
  gap: 6px;
}

.select__label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

.select select {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  max-width: 170px;
}

.controls__toggles {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}

.toggle input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* --- papan ------------------------------------------------------------- */

.board {
  flex: 1;
  display: flex;
  gap: 14px;
  padding: 16px 20px 20px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
}

.column {
  display: flex;
  flex-direction: column;
  width: var(--col-w);
  min-width: var(--col-w);
  scroll-snap-align: start;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.column--done {
  opacity: 0.78;
}

.column__head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex-shrink: 0;
}

.column__swatch {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--neutral);
  flex-shrink: 0;
}

.column__name {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.column__count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 1px 7px;
  flex-shrink: 0;
}

.column__list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  scrollbar-width: thin;
}

.column__empty {
  padding: 22px 10px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-4);
}

/* --- kartu ------------------------------------------------------------- */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px 12px 11px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.card:active {
  transform: scale(0.995);
}

/* Garis prioritas di tepi kiri. */
.card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--neutral);
}

.card[data-tone='urgent']::before { background: var(--urgent); }
.card[data-tone='high']::before   { background: var(--high); }
.card[data-tone='medium']::before { background: var(--medium); }
.card[data-tone='low']::before    { background: var(--low); }
.card[data-tone='none']::before   { background: var(--line-strong); }

.card[data-due='overdue'] {
  background: var(--overdue-bg);
  border-color: var(--overdue-line);
}

.card--done .card__title {
  color: var(--ink-3);
  text-decoration: line-through;
  text-decoration-color: var(--ink-4);
}

.card__top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.card__client {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.card__client::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--clientcolor, var(--ink-4));
}

.card__title {
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1.38;
  letter-spacing: -0.005em;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  font-size: 10.5px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  white-space: nowrap;
}

.card__foot {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.due {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
}

.due[data-state='overdue'] { color: var(--urgent); }
.due[data-state='today']   { color: var(--high); }
.due[data-state='soon']    { color: var(--medium); }

.avatars {
  display: flex;
  margin-left: auto;
}

.avatar {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1.5px solid var(--surface);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.avatar + .avatar {
  margin-left: -6px;
}

.avatar--more {
  background: var(--surface-2);
  color: var(--ink-3);
  border-color: var(--surface);
}

.card__meta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-4);
}

/* --- panel geser ------------------------------------------------------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.sheet__scrim {
  position: absolute;
  inset: 0;
  background: rgb(28 25 23 / 0.38);
  backdrop-filter: blur(2px);
  animation: fade 0.18s ease;
}

@keyframes fade {
  from { opacity: 0; }
}

.sheet__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  animation: slide 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes slide {
  from { transform: translateX(14px); opacity: 0; }
}

.sheet__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.sheet__title {
  font-size: 16px;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.sheet__body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 28px;
}

.detail-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
}

.detail-row:last-child {
  border-bottom: 0;
}

.detail-row__label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  padding-top: 2px;
}

.detail-row__value {
  font-size: 13.5px;
  color: var(--ink);
  word-break: break-word;
}

.detail-row__value a {
  color: var(--accent);
}

.detail-note {
  white-space: pre-wrap;
  line-height: 1.6;
  color: var(--ink-2);
}

.diag-group {
  margin-bottom: 22px;
}

.diag-group h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-bottom: 9px;
}

.diag-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.diag-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 12.5px;
}

.diag-item code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-left: auto;
}

.diag-item[data-ok='false'] {
  border-color: var(--overdue-line);
  background: var(--overdue-bg);
}

.diag-hint {
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.6;
  margin-top: 10px;
}

.diag-hint code {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}

/* --- status halaman ---------------------------------------------------- */

.state {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 40px 24px;
  text-align: center;
  color: var(--ink-3);
  max-width: 420px;
}

.state h2 {
  font-size: 16px;
  font-weight: 650;
  color: var(--ink);
}

.state p {
  font-size: 13.5px;
  line-height: 1.6;
}

.state code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
}

.state ol {
  text-align: left;
  font-size: 13px;
  line-height: 1.8;
  color: var(--ink-2);
  padding-left: 20px;
  margin: 0;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 2.5px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* --- footer & toast ---------------------------------------------------- */

.footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  font-size: 11.5px;
  color: var(--ink-4);
  flex-shrink: 0;
}

.footer__dot {
  color: var(--line-strong);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 70;
  padding: 10px 16px;
  border-radius: 99px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toast 0.2s ease;
}

@keyframes toast {
  from { opacity: 0; transform: translate(-50%, 8px); }
}

/* --- tombol tambahan --------------------------------------------------- */

.btn--sm {
  padding: 6px 10px;
  font-size: 12.5px;
}

.btn--icon {
  padding: 6px;
}

.btn.is-copied {
  color: var(--low);
  border-color: var(--low);
}

/* --- department -------------------------------------------------------- */

/* Department adalah navigasi utama, jadi diberi ruang dan ukuran yang lebih
   besar dari filter biasa. */
/* Baris navigasi utama: view di kiri, department di tengah, rentang tanggal
   di kanan. */
.navrow {
  display: flex;
  align-items: stretch;
  gap: 16px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  min-width: 0;
}

.views {
  display: flex;
  gap: 18px;
  padding-right: 18px;
  border-right: 1px solid var(--line);
  flex-shrink: 0;
}

.view {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2.5px solid transparent;
  background: transparent;
  color: var(--ink-3);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.view:hover {
  color: var(--ink);
}

.view[aria-selected='true'] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.view__icon {
  font-size: 15px;
  line-height: 1;
}

.view__count {
  min-width: 26px;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
}

.view__count--strong {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.view[aria-selected='false'] .view__count--strong {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

.navrow__range {
  align-self: center;
  margin-left: auto;
  padding-left: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
  flex-shrink: 0;
}

.navrow__range:empty {
  display: none;
}

.depts {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.depts::-webkit-scrollbar {
  display: none;
}

.dept {
  --dept: var(--ink-3);
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px 9px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}

.dept:hover {
  border-color: var(--line-strong);
}

.dept__dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--dept);
  flex-shrink: 0;
}

.dept__name {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.dept__count {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
}

.dept__alert {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--urgent);
  background: var(--overdue-bg);
  border: 1px solid var(--overdue-line);
  border-radius: 99px;
  padding: 0 6px;
}

.dept[aria-pressed='true'] {
  border-color: var(--dept);
  background: color-mix(in srgb, var(--dept) 9%, var(--surface));
}

.dept[aria-pressed='true'] .dept__count {
  color: var(--ink);
}

.dept--empty .dept__name::after {
  content: ' · belum ada anggota';
  font-weight: 500;
  font-size: 12px;
  color: var(--ink-4);
}

/* --- tombol copy di kolom dan kartu ------------------------------------ */

.column__copy {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  flex-shrink: 0;
}
.column__copy:hover {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--ink);
}
.column__copy .btn__icon {
  width: 14px;
  height: 14px;
}
.column__count {
  margin-left: auto;
}

.card {
  padding-right: 34px;
}

.card__copy {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink-4);
  background: transparent;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.card:hover .card__copy,
.card:focus-within .card__copy,
.card__copy:focus-visible {
  opacity: 1;
}

.card__copy:hover {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--ink);
}

.card__copy .btn__icon {
  width: 13px;
  height: 13px;
}

/* Layar sentuh tidak punya hover, jadi tombol copy selalu terlihat. */
@media (hover: none) {
  .card__copy {
    opacity: 1;
  }
}

.card__group {
  font-size: 10.5px;
  color: var(--ink-3);
  font-weight: 500;
}

.card__top .card__group::before {
  content: '·';
  margin-right: 6px;
  color: var(--ink-4);
}

.tag--staff {
  background: transparent;
  border-style: dashed;
  color: var(--ink-3);
}

/* --- panel: varian & bagian tambahan ----------------------------------- */

.sheet__panel--narrow {
  width: min(400px, 100%);
}

.sheet__panel--wide {
  width: min(600px, 100%);
}

.sheet__sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 3px;
}

.sheet__headactions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.sheet__foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  flex-shrink: 0;
}

.sheet__footmsg {
  flex: 1;
  font-size: 12.5px;
  color: var(--ink-3);
  text-align: right;
}

.sheet__footmsg[data-tone='error'] {
  color: var(--urgent);
}

.sheet__footmsg[data-tone='ok'] {
  color: var(--low);
}

.muted {
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.6;
}

.admin-login {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* --- admin ------------------------------------------------------------- */

.admin-tabs {
  display: flex;
  gap: 2px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.admin-tab {
  padding: 11px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-size: 13px;
  font-weight: 550;
  color: var(--ink-3);
  cursor: pointer;
  white-space: nowrap;
}

.admin-tab[aria-selected='true'] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.admin-section + .admin-section {
  margin-top: 26px;
}

.admin-section h3 {
  font-size: 14px;
  font-weight: 650;
  margin-bottom: 4px;
}

.admin-section > .muted {
  margin-bottom: 14px;
}

.notice {
  padding: 11px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-2);
  margin-bottom: 18px;
}

.notice--warn {
  border-color: color-mix(in srgb, var(--medium) 45%, var(--line));
  background: color-mix(in srgb, var(--medium) 9%, var(--surface));
}

.notice code,
.admin-section code {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}

.dept-editor {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  overflow: hidden;
}

.dept-editor + .dept-editor {
  margin-top: 12px;
}

.dept-editor__head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.dept-editor__color {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: none;
  cursor: pointer;
  flex-shrink: 0;
}

.dept-editor__name {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-weight: 600;
}

.dept-editor__count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
}

.dept-editor__body {
  padding: 10px 12px 12px;
}

.dept-editor__search {
  width: 100%;
  padding: 7px 10px;
  margin-bottom: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 12.5px;
}

.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.member {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 7px;
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
}

.member:hover {
  background: var(--surface);
}

.member input {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.member span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member small {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-4);
}

.member__other {
  color: var(--ink-4);
}

.option-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--surface);
  cursor: pointer;
  font-size: 13.5px;
}

.option + .option {
  border-top: 1px solid var(--line);
}

.option input[type='checkbox'],
.option input[type='radio'] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.option small {
  margin-left: auto;
  color: var(--ink-4);
  font-size: 11.5px;
}

.field-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.field-row:last-child {
  border-bottom: 0;
}

.field-row select,
.text-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
}

.field-row__hint {
  grid-column: 2;
  font-size: 11.5px;
  color: var(--ink-4);
  margin-top: -6px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row > .text-input {
  flex: 1;
}

.preview-line {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 9px 11px;
  word-break: break-all;
  white-space: pre-wrap;
}

/* --- layar kecil ------------------------------------------------------- */

@media (max-width: 1040px) {
  .metrics {
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  }
  .metric--people {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1180px) {
  .navrow__range {
    display: none;
  }
}

@media (max-width: 860px) {
  .metric--people {
    display: none;
  }
  .controls__toggles {
    margin-left: 0;
    width: 100%;
  }
  .controls__search {
    max-width: none;
  }
}

/* Di layar sempit, ruang vertikal adalah barang mahal: papan harus terlihat
   tanpa menggulir dulu. Ringkasan jadi satu baris yang digeser ke samping,
   dan filter lanjutan disembunyikan di balik tombol. */
@media (max-width: 680px) {
  .topbar {
    padding: 11px 14px;
  }
  .btn__label {
    display: none;
  }

  .metrics {
    display: flex;
    overflow-x: auto;
    gap: 1px;
    scrollbar-width: none;
  }
  .metrics::-webkit-scrollbar {
    display: none;
  }
  .metric {
    min-width: 118px;
    padding: 10px 14px;
  }
  .metric__value {
    font-size: 19px;
  }
  .metric__label {
    font-size: 10px;
    white-space: nowrap;
  }

  .controls {
    padding: 10px 14px;
    gap: 9px;
    flex-wrap: wrap;
  }
  .controls__more {
    display: inline-flex;
    flex-shrink: 0;
  }
  .controls__selects,
  .controls__toggles {
    display: none;
    width: 100%;
  }
  .controls.is-open .controls__selects {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }
  .controls.is-open .controls__toggles {
    display: flex;
    flex-wrap: wrap;
  }
  .select {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }
  .select select {
    max-width: none;
    width: 100%;
  }

  .board {
    padding: 12px 14px 16px;
    gap: 12px;
    scroll-snap-type: x mandatory;
  }
  .column {
    width: min(84vw, 316px);
    min-width: min(84vw, 316px);
  }

  .footer {
    padding: 8px 14px;
  }
  .footer span:not(#footer-count):not(.footer__dot) {
    display: none;
  }

  .navrow {
    flex-wrap: wrap;
    gap: 0;
    padding: 0;
  }
  .views {
    width: 100%;
    gap: 0;
    padding: 0 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .view {
    flex: 1;
    justify-content: center;
    padding: 12px 0;
    font-size: 14px;
  }
  .navrow__range {
    display: none;
  }
  .depts {
    padding: 10px 14px;
    gap: 6px;
  }
  .dept {
    padding: 8px 12px;
  }
  .dept__name {
    font-size: 13px;
  }
  .dept--empty .dept__name::after {
    content: '';
  }
  .controls__toggles .btn--sm span {
    display: none;
  }
  .field-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .field-row__hint {
    grid-column: 1;
    margin-top: 0;
  }

  .sheet__panel,
  .sheet__panel--wide,
  .sheet__panel--narrow {
    top: auto;
    left: 0;
    width: 100%;
    max-height: 86dvh;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    animation: slideup 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  }
}

@keyframes slideup {
  from {
    transform: translateY(18px);
    opacity: 0;
  }
}

/* Aman untuk notch saat dipasang sebagai PWA. */
@supports (padding: max(0px)) {
  .topbar {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }
  .footer {
    padding-bottom: max(9px, env(safe-area-inset-bottom));
  }
}
