:root {
  --ink: #10232f; /* biru-hitam untuk teks */
  --sub: #5b6b76;
  --line: #dfe6ea;
  --line-soft: #eef2f4;
  --paper: #ffffff;
  --wash: #f4f7f9;
  --wika: #019fe3; /* biru logo WIKA */
  --wika-soft: #e3f4fc;
  --accent: #0a6fa6; /* biru WIKA tua: tombol, link, fokus */
  --accent-hover: #085b88;
  --button-bg: #0a6fa6;
  --button-hover: #085b88;
  --other: #eef1f3;
  --other-edge: #a7b3bb;
  --err: #c0392b;
  --ok: #1e7a4c;
  --past-a: rgba(91, 107, 118, 0.1);
  --past-b: rgba(246, 247, 248, 0.78);
  --selection-bg: rgba(1, 159, 227, 0.08);
  --danger-bg: rgba(179, 38, 30, 0.07);
  --danger-hover: rgba(192, 57, 43, 0.06);
  --danger-border: rgba(192, 57, 43, 0.4);
  --scrim: rgba(16, 35, 47, 0.35);
  --shadow: rgba(16, 35, 47, 0.16);
  --dialog-shadow: rgba(16, 35, 47, 0.2);
  --radius: 6px;
  --row: 28px;
  --time-col: 52px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ink: #e6edf2;
  --sub: #a6b5c0;
  --line: #35434d;
  --line-soft: #2a3740;
  --paper: #17232c;
  --wash: #202e38;
  --wika-soft: #173b50;
  --accent: #51b7e6;
  --accent-hover: #2b9fd5;
  --button-bg: #076b94;
  --button-hover: #075879;
  --other: #2b3943;
  --other-edge: #647580;
  --err: #ff8175;
  --ok: #63c991;
  --past-a: rgba(181, 196, 207, 0.08);
  --past-b: rgba(28, 41, 51, 0.7);
  --selection-bg: rgba(81, 183, 230, 0.14);
  --danger-bg: rgba(255, 129, 117, 0.12);
  --danger-hover: rgba(255, 129, 117, 0.1);
  --danger-border: rgba(255, 129, 117, 0.42);
  --scrim: rgba(0, 0, 0, 0.58);
  --shadow: rgba(0, 0, 0, 0.36);
  --dialog-shadow: rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    "Plus Jakarta Sans",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  font-size: 15px;
  line-height: 1.45;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Bar atas ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  border-top: 3px solid var(--wika);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand img {
  height: 30px;
  width: auto;
  display: block;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}
.brand-text b {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand-text small {
  font-size: 12px;
  color: var(--sub);
}
.user {
  font-size: 14px;
  color: var(--sub);
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--sub);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}
.theme-toggle span:first-child {
  color: var(--accent);
  font-size: 16px;
  line-height: 1;
}
.theme-toggle:hover {
  background: var(--wash);
}
.user strong {
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40vw;
  display: inline-block;
  vertical-align: bottom;
}
.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- Tata letak (desktop) ---------- */
.app {
  display: grid;
  gap: 0 32px;
  padding: 20px 24px 40px;
  max-width: 1240px;
  margin: 0 auto;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-areas: "board side" "board mine";
  grid-template-rows: auto 1fr;
}
.board-area {
  grid-area: board;
  min-width: 0;
}
.side {
  grid-area: side;
}
.mine-list {
  grid-area: mine;
}

/* ---------- Navigasi tanggal ---------- */
.daybar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.daybar h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 8px 0 0;
  font-variant-numeric: tabular-nums;
}
.navbtns {
  display: flex;
  gap: 8px;
}
.step,
.today {
  height: 36px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--radius);
  cursor: pointer;
}
.step {
  width: 36px;
  font-size: 18px;
  line-height: 1;
}
.today {
  padding: 0 12px;
  font-size: 14px;
}
.new-btn {
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--button-bg);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  margin-left: auto;
}
.jump {
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  font-size: 14px;
  cursor: pointer;
}
@media (hover: hover) {
  .step:hover,
  .today:hover,
  .jump:hover {
    background: var(--wash);
  }
}

/* Deretan tanggal */
.strip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.strip .step {
  flex: none;
  height: 52px;
}
.days {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(14, minmax(44px, 1fr));
  gap: 4px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.days::-webkit-scrollbar {
  display: none;
}
.d {
  position: relative;
  height: 52px;
  padding: 4px 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  cursor: pointer;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
}
.d .dw {
  font-size: 11px;
  color: var(--sub);
}
.d .dn {
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.d.wk .dw,
.d.wk .dn {
  color: var(--other-edge);
}
.d.gone {
  opacity: 0.55;
}
.d.today {
  border-color: var(--wika);
}
.d.today .dn {
  color: var(--accent);
}
.d.has::after {
  content: "";
  position: absolute;
  bottom: 5px;
  left: 50%;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: var(--other-edge);
}
.d.on {
  background: var(--button-bg);
  border-color: var(--accent);
  opacity: 1;
}
.d.on .dw,
.d.on .dn {
  color: #fff;
}
.d.on.has::after {
  background: #fff;
}
@media (hover: hover) {
  .d:not(.on):hover {
    background: var(--wash);
  }
}

/* ---------- Papan jadwal ---------- */
.board-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}
.board {
  min-width: 520px;
  max-width: 100%;
  transition: opacity 0.15s;
}
.board.loading {
  opacity: 0.45;
  pointer-events: none;
}
.bhead,
.bbody {
  display: grid;
  grid-template-columns: var(--time-col) repeat(
      var(--rooms),
      minmax(0, 1fr)
    );
}
.bhead {
  border-bottom: 1px solid var(--line);
  background: var(--wash);
  position: sticky;
  top: 0;
  z-index: 4;
}
.bhead div {
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  border-left: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bhead div:first-child {
  border-left: 0;
}
.bhead .short {
  display: none;
}
.bbody {
  position: relative;
}

.times {
  position: relative;
}
.times span {
  position: absolute;
  left: 0;
  right: 8px;
  text-align: right;
  font-size: 12px;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
  transform: translateY(3px);
}
.col {
  position: relative;
  height: calc(var(--slots) * var(--row));
  border-left: 1px solid var(--line);
  cursor: pointer;
  touch-action: manipulation;
  background-image:
    repeating-linear-gradient(
      to bottom,
      transparent 0 calc(var(--row) * 2 - 1px),
      var(--line) calc(var(--row) * 2 - 1px) calc(var(--row) * 2)
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0 calc(var(--row) - 1px),
      var(--line-soft) calc(var(--row) - 1px) var(--row)
    );
}
.past {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  background: repeating-linear-gradient(
    135deg,
    var(--past-a) 0 4px,
    var(--past-b) 4px 8px
  );
  pointer-events: none;
}
.now {
  position: absolute;
  left: var(--time-col);
  right: 0;
  height: 0;
  border-top: 2px solid var(--err);
  pointer-events: none;
  z-index: 3;
}
.now-label {
  position: absolute;
  top: -10px;
  left: 4px;
  padding: 0 4px;
  border-radius: 3px;
  background: var(--err);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  white-space: nowrap;
}

.bk {
  position: absolute;
  left: 3px;
  right: 3px;
  z-index: 1;
  background: var(--other);
  border-left: 3px solid var(--other-edge);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
  line-height: 1.3;
  overflow: hidden;
  cursor: default;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bk .l1 {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.bk .t {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.bk .nm {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bk .p {
  color: var(--sub);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.bk.mine {
  background: var(--wika-soft);
  border-left-color: var(--wika);
  color: var(--ink);
}
.bk.mine .t {
  color: var(--accent);
}
.bk.editable {
  cursor: pointer;
}
.bk.selected {
  box-shadow:
    0 0 0 2px var(--paper),
    0 0 0 4px var(--accent);
}

.sel {
  position: absolute;
  left: 3px;
  right: 3px;
  z-index: 2;
  pointer-events: none;
  border: 2px dashed var(--accent);
  border-radius: 3px;
  background: var(--selection-bg);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  padding: 2px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sel.bad {
  border-color: var(--err);
  background: var(--danger-bg);
  color: var(--err);
}

.note {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--sub);
}
.selection-help {
  margin: 10px 0 0;
  padding: 9px 11px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--wash);
  color: var(--sub);
  font-size: 12px;
}

/* ---------- Form ---------- */
.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.side h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}
.close {
  display: none;
}
.field {
  margin-top: 14px;
}
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--sub);
  margin-bottom: 5px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}
.password-control {
  position: relative;
}
.field .password-control input {
  padding-right: 46px;
}
.password-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--sub);
  cursor: pointer;
  transform: translateY(-50%);
}
.password-toggle:hover {
  background: var(--wash);
  color: var(--accent);
}
.password-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}
.password-toggle .eye-off-icon,
.password-toggle[aria-pressed="true"] .eye-icon {
  display: none;
}
.password-toggle[aria-pressed="true"] .eye-off-icon {
  display: block;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: transparent;
}
.field textarea {
  resize: vertical;
  min-height: 60px;
}
.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.owner {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--sub);
}
.owner strong {
  color: var(--ink);
  font-weight: 500;
}

.primary {
  margin-top: 16px;
  width: 100%;
  padding: 11px;
  border: 0;
  border-radius: var(--radius);
  background: var(--button-bg);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.primary:disabled {
  opacity: 0.55;
  cursor: wait;
}
@media (hover: hover) {
  .primary:hover,
  .new-btn:hover {
    background: var(--button-hover);
  }
}
.row-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  font-size: 14px;
}
.secondary-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition:
    background-color 0.15s,
    border-color 0.15s,
    color 0.15s;
}
.row-actions > button {
  flex: 1;
}
.secondary-btn {
  color: var(--accent);
}
.danger-btn {
  border-color: var(--danger-border);
  color: var(--err);
}
.user-action {
  min-height: 34px;
  padding: 5px 10px;
  white-space: nowrap;
}
@media (hover: hover) {
  .secondary-btn:hover {
    border-color: var(--accent);
    background: var(--wika-soft);
  }
  .danger-btn:hover {
    border-color: var(--err);
    background: var(--danger-hover);
  }
}

.msg {
  margin-top: 12px;
  font-size: 14px;
  padding-left: 10px;
  border-left: 3px solid;
}
.msg:empty {
  display: none;
}
.msg.err {
  color: var(--err);
}
.msg.ok {
  color: var(--ok);
}

.mine-list {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.mine-list h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 6px;
}
.mine-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mine-list button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}
.mine-list .w {
  font-variant-numeric: tabular-nums;
}
.mine-list .r {
  display: block;
  font-size: 13px;
  color: var(--sub);
}
@media (hover: hover) {
  .mine-list button:hover .w {
    text-decoration: underline;
  }
}
.empty {
  font-size: 13px;
  color: var(--sub);
  margin: 0;
}

.backdrop {
  display: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  max-width: calc(100% - 32px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
  z-index: 40;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Tab (admin) ---------- */
.tabs {
  display: flex;
  gap: 4px;
  margin-right: auto;
  margin-left: 24px;
}
.tabs button {
  background: none;
  border: 0;
  padding: 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  color: var(--sub);
  font-weight: 500;
}
.tabs button.on {
  color: var(--accent);
  background: var(--wika-soft);
}

/* ---------- Status ruangan di header papan (hari ini) ---------- */
.bhead .hs {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hs::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: 1px;
}
.hs.free {
  color: var(--ok);
}
.hs.free::before {
  background: var(--ok);
}
.hs.busy {
  color: var(--err);
}
.hs.busy::before {
  background: var(--err);
}

/* ---------- Masuk (di panel samping) ---------- */
.login-box p {
  margin: 6px 0 0;
  color: var(--sub);
  font-size: 14px;
}
.pending {
  margin-top: 12px;
  font-size: 14px;
  padding: 8px 10px;
  background: var(--wash);
  border-radius: var(--radius);
}
.pending:empty {
  display: none;
}
.guest-only {
  display: none;
}
body.guest .guest-only {
  display: initial;
}
body.guest .user-only {
  display: none !important;
}

/* ---------- Admin ---------- */
.admin {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}
.admin-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.admin-bar h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
}
.admin-bar .new-btn {
  display: inline-block;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0 12px;
  margin-bottom: 16px;
}
.filters .field {
  margin-top: 0;
  min-width: 150px;
  flex: 1 1 150px;
  max-width: 220px;
}
.tbl-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
}
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.tbl th {
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  background: var(--wash);
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
.tbl tr:last-child td {
  border-bottom: 0;
}
.tbl .nw {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tbl .em {
  display: block;
  font-size: 12px;
  color: var(--sub);
}
.tbl .acts {
  white-space: nowrap;
  text-align: right;
}
.tbl .acts .link + .link {
  margin-left: 14px;
}
.tbl tr.batal td:not(.acts) {
  color: var(--sub);
  text-decoration: line-through;
}
.badge {
  font-size: 12px;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--wash);
  border: 1px solid var(--line);
  text-decoration: none;
  display: inline-block;
}
.count {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--sub);
}
.user-form {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 16px 16px;
  margin-bottom: 16px;
  max-width: 760px;
}
.user-form .grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 140px;
  gap: 0 12px;
}
.user-form .btns {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 14px;
}
.user-form .primary {
  width: auto;
  margin: 0;
  padding: 9px 18px;
}
.user-form input[readonly] {
  background: var(--wash);
  color: var(--sub);
}
.you {
  font-size: 12px;
  color: var(--sub);
  margin-left: 6px;
}
@media (max-width: 600px) {
  .user-form .grid {
    grid-template-columns: 1fr;
  }
}
.code {
  font-size: 22px;
  letter-spacing: 0.35em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ================= Tablet (≤ 960px) ================= */
@media (max-width: 960px) {
  .tabs {
    margin-left: 8px;
  }
  .admin {
    padding: 16px 20px 40px;
  }
  .app {
    grid-template-columns: 1fr;
    grid-template-areas: "board" "mine";
    grid-template-rows: auto;
    padding: 16px 20px 40px;
  }
  .board {
    min-width: 420px;
  }
  .note {
    display: none;
  }
  .selection-help {
    font-size: 11.5px;
    line-height: 1.45;
  }

  /* Form jadi panel yang muncul dari bawah */
  .side {
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0 auto;
    width: min(560px, 100%);
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--paper);
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -8px 32px var(--shadow);
    padding: 18px 20px calc(20px + env(safe-area-inset-bottom));
    transform: translateY(105%);
    visibility: hidden;
    transition:
      transform 0.22s ease,
      visibility 0s 0.22s;
  }
  .side.open {
    transform: none;
    visibility: visible;
    transition: transform 0.22s ease;
  }
  .close {
    display: inline-block;
    background: none;
    border: 0;
    font-size: 14px;
    color: var(--sub);
    cursor: pointer;
    padding: 6px 0 6px 12px;
  }
  .backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 29;
    background: var(--scrim);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }
  .backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }
  .mine-list {
    margin-top: 24px;
  }
}
@media (min-width: 961px) {
  .new-btn {
    display: none;
  }
}

/* ================= Tablet landscape ================= */
@media (min-width: 601px) and (max-width: 1180px) and (orientation: landscape) {
  :root {
    --row: 30px;
    --time-col: 48px;
  }
  body {
    font-size: 14px;
  }
  .top {
    gap: 10px;
    padding-right: 18px;
    padding-left: 18px;
  }
  .brand {
    gap: 9px;
  }
  .brand-text {
    padding-left: 9px;
  }
  .tabs {
    gap: 2px;
    margin-left: 12px;
  }
  .tabs button {
    padding: 6px 8px;
    font-size: 13px;
  }
  .theme-toggle {
    padding-right: 8px;
    padding-left: 8px;
  }
  .app {
    gap: 0 20px;
    padding: 16px 18px 32px;
  }
  .daybar {
    gap: 7px;
    margin-bottom: 10px;
  }
  .daybar h1 {
    font-size: 19px;
  }
  .strip {
    gap: 6px;
    margin-bottom: 10px;
  }
  .strip .step,
  .d {
    height: 46px;
  }
  .days {
    grid-template-columns: repeat(14, minmax(38px, 1fr));
    gap: 3px;
  }
  .bhead div {
    padding: 7px 6px;
    font-size: 12px;
  }
  .bhead .hs {
    font-size: 11px;
  }
  .bk {
    padding-right: 4px;
    padding-left: 4px;
    font-size: 11px;
  }
  .selection-help {
    font-size: 11px;
  }
  .side {
    max-height: 84vh;
    max-height: 84dvh;
  }
}

/* ================= HP (≤ 600px) ================= */
@media (max-width: 600px) {
  :root {
    --row: 32px;
    --time-col: 40px;
  }
  .top {
    padding: 10px 16px;
    padding-top: max(10px, env(safe-area-inset-top));
  }
  .brand img {
    height: 26px;
  }
  .brand-text b {
    font-size: 14px;
  }
  .app {
    padding: 14px 12px 32px;
  }

  .daybar {
    gap: 8px;
  }
  .daybar h1 {
    font-size: 18px;
    width: 100%;
    margin: 0;
  }

  .board {
    min-width: 380px;
  }
  .bhead div {
    flex-direction: column;
    padding: 6px 3px;
    font-size: 10.5px;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
  }
  .bhead .full {
    display: none;
  }
  .bhead .short {
    display: inline;
  }
  .times span {
    right: 5px;
    font-size: 11px;
  }
  .bk {
    left: 2px;
    right: 2px;
    padding: 2px 4px;
    font-size: 10.5px;
    gap: 1px;
  }
  .bk .l1 {
    gap: 3px;
  }
  .bk .te,
  .bk .p {
    display: none;
  }
  .bk .nm {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .sel {
    left: 2px;
    right: 2px;
    padding: 2px 4px;
    font-size: 10.5px;
  }

  .bhead .hs {
    font-size: 0;
    margin-top: 2px;
  }
  .bhead .hs::before {
    margin: 0;
    width: 8px;
    height: 8px;
  }
  .selection-help {
    font-size: 11px;
    line-height: 1.4;
  }
  .top.has-tabs .brand-text {
    display: none;
  }
  .tabs {
    margin-left: 0;
  }
  .admin {
    padding: 14px 12px 32px;
  }
  .filters .field {
    max-width: none;
    flex: 1 1 140px;
  }
  /* Tabel admin jadi daftar bertumpuk */
  .tbl-wrap {
    border: 0;
  }
  .tbl thead {
    display: none;
  }
  .tbl,
  .tbl tbody,
  .tbl tr,
  .tbl td {
    display: block;
    width: 100%;
  }
  .tbl tr {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }
  .tbl td {
    padding: 1px 0;
    border: 0;
  }
  .tbl td.nw,
  .tbl td.rm {
    display: inline;
    font-weight: 600;
    margin-right: 8px;
  }
  .tbl td.pp {
    color: var(--sub);
  }
  .tbl td.st {
    display: inline-block;
    width: auto;
    margin-top: 6px;
  }
  .tbl .acts {
    display: inline-block;
    width: auto;
    margin: 6px 0 0 14px;
  }
  .tbl .em {
    display: inline;
    margin-left: 6px;
  }

  /* 16px mencegah iPhone auto-zoom saat mengetik */
  .field input,
  .field select,
  .field textarea {
    font-size: 16px;
    padding: 10px;
  }
  .side {
    padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .board,
  .side,
  .backdrop,
  .toast {
    transition: none !important;
  }
}

/* ---------- Tambahan versi Supabase ---------- */
.hint-sm {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--sub);
}
.user .link {
  font-size: 14px;
}
.user-form #uPassField {
  max-width: 420px;
}
.tbl .acts .link {
  margin-left: 14px;
}
.tbl .acts .link:first-child {
  margin-left: 0;
}
.dialog-wrap {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.dialog {
  width: min(400px, 100%);
  background: var(--paper);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 12px 40px var(--dialog-shadow);
}
.dialog h2 {
  margin: 0 0 6px;
  font-size: 18px;
}
.dialog p {
  margin: 0;
  color: var(--sub);
  font-size: 14px;
}
.dialog .btns {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 16px;
}
.dialog .primary {
  width: auto;
  margin: 0;
  padding: 10px 18px;
}
@media (max-width: 600px) {
  .user #pwBtn {
    display: none;
  }
}
