/* ============================================================
   919 Technology — App CSS
   Mobile-first design system
   ============================================================ */

/* ── 1. Theme tokens ─────────────────────────────────────── */
:root {
  /* Blue (default) */
  --primary:        #0ea5e9;
  --primary-dark:   #0284c7;
  --primary-light:  #e0f2fe;
  --primary-text:   #ffffff;

  --accent:         #f59e0b;

  --bg:             #f1f5f9;
  --bg-card:        #ffffff;
  --bg-input:       #f8fafc;
  --bg-muted:       #f1f5f9;

  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-on-primary:#ffffff;

  --border:         #e2e8f0;
  --border-focus:   #0ea5e9;

  --success:        #22c55e;
  --success-bg:     #dcfce7;
  --success-text:   #15803d;
  --warning:        #f59e0b;
  --warning-bg:     #fef3c7;
  --warning-text:   #b45309;
  --danger:         #ef4444;
  --danger-bg:      #fee2e2;
  --danger-text:    #dc2626;
  --info:           #3b82f6;
  --info-bg:        #dbeafe;
  --info-text:      #1d4ed8;

  --shadow-sm:      0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.06);
  --shadow-lg:      0 10px 32px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.08);

  --radius-sm:      8px;
  --radius-md:      14px;
  --radius-lg:      20px;
  --radius-xl:      28px;
  --radius-full:    9999px;

  --font:           -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:      'SF Mono', 'Fira Code', monospace;

  --topbar-h:       56px;
  --bottomnav-h:    64px;

  --transition:     0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Dark mode (semua tema) ──────────────────────────────── */
[data-mode="dark"] {
  --bg:             #0f172a;
  --bg-card:        #1e293b;
  --bg-input:       #0f172a;
  --bg-muted:       #1e293b;
  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;
  --text-on-primary:#0f172a;
  --border:         #334155;
  --success-bg:     #052e16;
  --success-text:   #4ade80;
  --warning-bg:     #1c1400;
  --warning-text:   #fbbf24;
  --danger-bg:      #1c0505;
  --danger-text:    #f87171;
  --info-bg:        #0c1a3a;
  --info-text:      #60a5fa;
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:      0 10px 32px rgba(0,0,0,0.5);
}

/* ── Tema: Biru (default) ────────────────────────────────── */
[data-theme="blue"] {
  --primary:        #0ea5e9;
  --primary-dark:   #0284c7;
  --primary-light:  #e0f2fe;
  --border-focus:   #0ea5e9;
}
[data-mode="dark"][data-theme="blue"] {
  --primary-light:  #0c2a3a;
  --border-focus:   #38bdf8;
}

/* ── Tema: Hijau ─────────────────────────────────────────── */
[data-theme="green"] {
  --primary:        #10b981;
  --primary-dark:   #059669;
  --primary-light:  #d1fae5;
  --border-focus:   #10b981;
}
[data-mode="dark"][data-theme="green"] {
  --primary-light:  #052e16;
  --border-focus:   #34d399;
}

/* ── Tema: Ungu ──────────────────────────────────────────── */
[data-theme="purple"] {
  --primary:        #8b5cf6;
  --primary-dark:   #7c3aed;
  --primary-light:  #ede9fe;
  --border-focus:   #8b5cf6;
}
[data-mode="dark"][data-theme="purple"] {
  --primary-light:  #1e1040;
  --border-focus:   #a78bfa;
}

/* ── Tema: Merah ─────────────────────────────────────────── */
[data-theme="red"] {
  --primary:        #841d1d;
  --primary-dark:   #5e0505;
  --primary-light:  #fde8e8;
  --border-focus:   #a61717;
}
[data-mode="dark"][data-theme="red"] {
  --primary-light:  #391616;
  --border-focus:   #c81e1e;
}

/* ── Tema: Kuning ────────────────────────────────────────── */
[data-theme="yellow"] {
  --primary:        #e18e00;
  --primary-dark:   #c66900;
  --primary-light:  #fef3c7;
  --border-focus:   #f59e0b;
  --text-on-primary:#1c1400;
}
[data-mode="dark"][data-theme="yellow"] {
  --primary-light:  #3f2d00;
  --border-focus:   #fbbf24;
  --text-on-primary:#1c1400;
}

/* ── 2. Reset & Base ─────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg);
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

input, button, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ── 3. Layout ───────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* Page with topbar + bottom nav */
.app-shell.has-nav .page-content {
  padding-top: calc(var(--topbar-h) + 8px);
  padding-bottom: calc(var(--bottomnav-h) + 16px);
}

.page-content {
  flex: 1;
  padding: 16px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

/* Auth pages (login/register) — centered */
.auth-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100dvh;
  padding: 32px 16px 24px;
  background: var(--bg);
}

/* ── 4. Top Navigation Bar ───────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--primary);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.topbar-back {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 18px;
  flex-shrink: 0;
  transition: background var(--transition);
}
.topbar-back:hover { background: rgba(255,255,255,0.25); }

.topbar-title {
  flex: 1;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.topbar-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.18);
  border: none;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  transition: background var(--transition);
  white-space: nowrap;
}
.topbar-btn:hover { background: rgba(255,255,255,0.28); }
.topbar-btn.danger { background: rgba(239,68,68,0.25); }
.topbar-btn.danger:hover { background: rgba(239,68,68,0.4); }

/* ── 5. Bottom Navigation ────────────────────────────────── */
.bottomnav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottomnav-h);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 0;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  font-size: 0.6875rem;
  font-weight: 600;
  text-decoration: none;
  transition: color var(--transition);
  position: relative;
}
.nav-item .nav-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform var(--transition);
}
.nav-item.active { color: var(--primary); }
.nav-item.active .nav-icon { transform: scale(1.15); }
.nav-item:hover { color: var(--primary); }

/* ── 6. Cards ────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
}
.card-body { padding: 16px; }
.card-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-muted);
}

/* Board card (dashboard) */
.board-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.06);
  overflow: hidden;
  margin-bottom: 20px;
}

.board-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.board-header-info .board-id {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
}
.board-header-info .board-sub {
  color: rgba(255,255,255,0.9);
  font-size: 0.75rem;
  margin-top: 2px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(4px);
  border-radius: var(--radius-full);
  padding: 5px 11px;
  font-size: 0.75rem;
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4ade80;
}
.status-dot.online { animation: pulse-dot 1.5s infinite; }
.status-dot.offline { background: #f87171; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.board-meta {
  padding: 8px 16px;
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.board-meta-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}
.board-meta-actions { display: flex; gap: 6px; }

.key-bar {
  margin: 10px 16px 4px;
  background: var(--warning-bg);
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--warning-text);
}
.key-bar .key-val {
  font-weight: 700;
  font-family: var(--font-mono);
  word-break: break-all;
}

/* ── 7. Output Item ──────────────────────────────────────── */
.output-list {
  padding: 8px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.output-item {
  background: var(--bg-muted);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--transition), background var(--transition);
}
.output-item.is-on {
  border-color: var(--primary);
  background: var(--primary-light);
}

.output-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.output-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
}
.output-sub {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Toggle switch */
.toggle-group {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.toggle-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 26px;
  text-align: right;
}
.toggle-label.is-on { color: var(--primary); }

.toggle {
  appearance: none; -webkit-appearance: none;
  width: 50px; height: 27px;
  border-radius: var(--radius-full);
  background: var(--border);
  border: none;
  position: relative;
  cursor: pointer;
  transition: background 0.25s;
  outline: none;
  flex-shrink: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  width: 21px; height: 21px;
  border-radius: 50%;
  background: #fff;
  top: 3px; left: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1.2);
}
.toggle:checked { background: var(--primary); }
.toggle:checked::after { transform: translateX(23px); }
.toggle:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.toggle:disabled { opacity: 0.5; cursor: not-allowed; }

/* Schedule row */
/* Schedule: baris 1 = ON/OFF time + warning, baris 2 = tombol simpan/hapus */
.schedule-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.schedule-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sch-label {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  min-width: 20px;
}
.sch-time {
  border: none;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  outline: none;
  min-width: 0;
  max-width: 90px;
}
.sch-divider {
  width: 1px; height: 18px;
  background: var(--border);
  flex-shrink: 0;
}
.sch-warn {
  margin-left: auto;
  flex-shrink: 0;
}
.sch-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.output-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}
.exec-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 0.6875rem;
  color: var(--text-muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.output-actions { display: flex; gap: 5px; }

/* ── 8. Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition), background var(--transition);
  text-decoration: none;
  white-space: nowrap;
  outline: none;
  -webkit-user-select: none;
  user-select: none;
}
.btn:active { transform: scale(0.96); }
.btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* Sizes */
.btn-xs  { height: 32px; padding: 0 10px; font-size: 0.75rem; border-radius: var(--radius-sm); }
.btn-sm  { height: 34px; padding: 0 13px; font-size: 0.8125rem; }
.btn-md  { height: 42px; padding: 0 18px; font-size: 0.9375rem; }
.btn-lg  { height: 50px; padding: 0 24px; font-size: 1rem; border-radius: var(--radius-md); }
.btn-full { width: 100%; }

/* Variants */
.btn-primary   { background: var(--primary); color: var(--text-on-primary); }
.btn-primary:hover { background: var(--primary-dark); }

.btn-ghost     { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-ghost:hover { background: var(--primary-light); }

.btn-danger    { background: var(--danger-bg); color: var(--danger-text); }
.btn-danger:hover { background: #fecaca; }

.btn-success   { background: var(--success-bg); color: var(--success-text); }
.btn-success:hover { background: #bbf7d0; }

.btn-warning   { background: var(--warning-bg); color: var(--warning-text); }
.btn-warning:hover { background: #fde68a; }

.btn-info      { background: var(--info-bg); color: var(--info-text); }
.btn-info:hover { background: #bfdbfe; }

.btn-muted     { background: var(--bg-muted); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-muted:hover { background: var(--border); }

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

/* ── 9. Forms ────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.form-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9375rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.form-input.is-error { border-color: var(--danger); }
.form-input.is-success { border-color: var(--success); }

.form-input-wrap {
  position: relative;
}
.form-input-wrap .form-input { padding-right: 44px; }
.form-input-wrap .input-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  padding: 0;
}
.form-input-icon-left .form-input { padding-left: 44px; }
.form-input-icon-left .input-icon-left {
  position: absolute;
  left: 14px;
  top: 50%; transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
}

.form-hint  { font-size: 0.75rem; color: var(--text-muted); }
.form-error { font-size: 0.75rem; color: var(--danger-text); }

.form-select {
  width: 100%;
  height: 46px;
  padding: 0 36px 0 14px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9375rem;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  transition: border-color var(--transition);
}
.form-select:focus { border-color: var(--border-focus); }

/* ── 10. Auth Card ───────────────────────────────────────── */
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 32px 28px;
  margin-top: 12px;
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
}
.auth-logo-mark {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
  font-weight: 900;
  margin-bottom: 10px;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--primary) 35%, transparent);
  letter-spacing: -1px;
}
.auth-logo-name {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.auth-logo-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.auth-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}
.auth-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ── 11. Alert / Toast ───────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 16px;
}
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger-text); }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); }
.alert-info    { background: var(--info-bg);    color: var(--info-text); }
.alert-icon    { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

/* Toast */
.toast-container {
  position: fixed;
  bottom: calc(var(--bottomnav-h) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 360px;
}
.toast {
  background: var(--text-primary);
  color: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 11px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  animation: toast-in 0.3s cubic-bezier(0.2, 0, 0, 1.2);
}
.toast.toast-success { background: var(--success); color: #fff; }
.toast.toast-danger  { background: var(--danger);  color: #fff; }
.toast.toast-warning { background: var(--warning); color: #fff; }
.toast.toast-out     { animation: toast-out 0.25s ease forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px) scale(0.94); }
}

/* ── 12. Modal / Bottom Sheet ────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  background: var(--bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 640px;
  padding: 0 0 calc(env(safe-area-inset-bottom, 0px) + 16px);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
  max-height: 85dvh;
  overflow-y: auto;
}
.modal-overlay.is-open .bottom-sheet {
  transform: translateY(0);
}

.sheet-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  margin: 12px auto 0;
}
.sheet-header {
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sheet-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.sheet-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-muted);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.sheet-close:hover { background: var(--border); }
.sheet-body { padding: 16px 20px; }

/* Center modal (for desktop / confirm dialog) */
.modal-overlay.center { align-items: center; }
.modal-center {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  width: calc(100% - 32px);
  max-width: 380px;
  padding: 24px;
  transform: scale(0.9);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1.2), opacity 0.25s;
}
.modal-overlay.center.is-open .modal-center {
  transform: scale(1);
  opacity: 1;
}

/* ── 13. Badge & Chips ───────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 700;
}
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger-text); }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-info    { background: var(--info-bg);    color: var(--info-text); }
.badge-muted   { background: var(--bg-muted);   color: var(--text-muted); border: 1px solid var(--border); }

/* ── 14. List Items (admin) ──────────────────────────────── */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  transition: background var(--transition);
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--bg-muted); }

.list-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}
.list-body { flex: 1; min-width: 0; }
.list-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-action { flex-shrink: 0; display: flex; gap: 6px; }

/* ── 15. Stats Card ──────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.stat-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
  line-height: 1;
}
.stat-sub {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.stat-icon {
  font-size: 22px;
  margin-bottom: 8px;
}

/* ── 16. Theme Picker ────────────────────────────────────── */
.theme-picker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.theme-swatch {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
  position: relative;
}
.theme-swatch:hover { transform: scale(1.1); }
.theme-swatch.active { border-color: var(--primary); }
.theme-swatch.active::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.swatch-blue   { background: #0ea5e9; }
.swatch-green  { background: #10b981; }
.swatch-purple { background: #8b5cf6; }
.swatch-red    { background: #ef4444; }
.swatch-yellow { background: #f59e0b; }

/* Active state untuk color swatch */
.theme-color-swatch.active {
  border-color: var(--text-primary) !important;
  transform: scale(1.15);
}
.theme-color-swatch:hover { transform: scale(1.1); transition: transform 0.2s; }

/* Active state untuk mode button */
.theme-mode-btn.active {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

/* ── 17. Divider & Section Label ─────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}
.section-label {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
  padding: 0 4px;
}

/* ── 18. Loading / Spinner ───────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }

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

.page-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  flex-direction: column;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ── 19. Empty state ─────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state .empty-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.empty-state .empty-sub { font-size: 0.875rem; }

/* ── 20. Utilities ───────────────────────────────────────── */
.flex   { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-sm   { font-size: 0.875rem; }
.text-xs   { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── 21. Desktop overrides (≥ 769px) ────────────────────── */
@media (min-width: 769px) {
  .page-content { padding: 24px 24px; }
  .auth-shell   { padding: 48px 24px; }
  .auth-card    { padding: 40px 36px; }

  .stats-grid { grid-template-columns: repeat(4, 1fr); }

  /* Bottom nav → left sidebar on desktop */
  .bottomnav {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 220px;
    height: 100dvh;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 80px 0 24px;
    border-top: none;
    border-right: 1px solid var(--border);
    box-shadow: 2px 0 8px rgba(0,0,0,0.04);
  }
  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    padding: 12px 20px;
    border-radius: 0;
    font-size: 0.9rem;
    gap: 12px;
  }
  .nav-item .nav-icon { font-size: 20px; }
  .nav-item.active {
    background: var(--primary-light);
    border-right: 3px solid var(--primary);
  }
  .nav-item.active .nav-icon { transform: none; }

  .app-shell.has-nav .page-content {
    padding-top: 80px;
    padding-left: calc(220px + 24px);
    padding-bottom: 32px;
  }

  .toast-container {
    bottom: 24px;
    left: auto;
    right: 24px;
    transform: none;
  }

  .board-card { margin-bottom: 20px; }
}

/* ── 22. Scrollbar styling ───────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── 23. Print ───────────────────────────────────────────── */
@media print {
  .topbar, .bottomnav, .toast-container { display: none; }
  .app-shell.has-nav .page-content { padding: 16px; }
}
