/* ============================================================
   APLIKASI ABSENSI — Design System "Cual Heritage"
   Theme: Dark-first with light mode support
   Inspired by: Tenun Cual Bangka Belitung, Batu Granit, Timah, Laut Tropis
   Colors: Granite (bg), Cual Gold (accent), Ocean (depth), Tin (secondary)
   Mobile-first responsive design
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&display=swap');

/* ----- CSS Custom Properties ----- */
:root {
  /* Theme tokens — dark (default) — "Cual Heritage" palette */
  --bg-body: #1E2128;
  --bg-surface: #262A32;
  --bg-card: #262A32;
  --bg-elevated: #2E333C;
  --bg-hover: rgba(200, 150, 62, 0.08);
  --border-default: rgba(200, 150, 62, 0.12);
  --border-subtle: rgba(200, 150, 62, 0.04);
  --border-hover: rgba(200, 150, 62, 0.25);
  --text-primary: #F5E6D3;
  --text-secondary: #B8C4D1;     /* contrast ≈ 8.2:1 with #1E2128 */
  --text-muted: #95A4B5;          /* contrast ≈ 5.5:1 with #1E2128 */
  --accent: #C8963E;
  --accent-hover: #D4A94F;
  --accent-subtle: rgba(200, 150, 62, 0.12);
  --success: #3D9970;
  --success-subtle: rgba(61, 153, 112, 0.15);
  --danger: #A63D4C;
  --danger-subtle: rgba(166, 61, 76, 0.15);
  --warning: #D4A94F;
  --info: #2D5A8A;
  --cual-ocean: #1B3A5C;
  --cual-red: #8B2E3B;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
  --gradient-cual: linear-gradient(135deg, #1B3A5C 0%, #1E2128 50%, #1E2128 100%);
  --gradient-gold: linear-gradient(135deg, #C8963E 0%, #9B7B2F 100%);
  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
  --sidebar-width: 180px;
  --sidebar-collapsed: 56px;
  --bottom-nav-height: 60px;
  --header-height: 52px;
}

/* ----- Light Mode — WCAG AA contrast verified ----- */
body.light-mode {
  --bg-body: #FAF7F2;
  --bg-surface: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-elevated: #F5F0E8;
  --bg-hover: rgba(155, 123, 47, 0.05);
  --border-default: rgba(30, 33, 40, 0.10);
  --border-subtle: rgba(30, 33, 40, 0.05);
  --border-hover: rgba(155, 123, 47, 0.20);
  --text-primary: #1E2128;
  --text-secondary: #3A4754;     /* contrast ≈ 9.8:1 with #FAF7F2 */
  --text-muted: #5A6573;          /* contrast ≈ 6.0:1 with #FAF7F2 */
  --accent: #9B7B2F;
  --accent-hover: #7D6325;
  --accent-subtle: rgba(155, 123, 47, 0.10);
  --success: #2D7A50;
  --success-subtle: rgba(45, 122, 80, 0.10);
  --danger: #8B2E3B;
  --danger-subtle: rgba(139, 46, 59, 0.10);
  --warning: #9B7B2F;
  --info: #1B3A5C;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
}

/* ----- Reset & Base ----- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: clamp(0.8125rem, 1.6vw, 0.9375rem);
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-body);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent);
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
}

button {
  cursor: pointer;
}

/* ----- Accessibility ----- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.75rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 1rem;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ----- Typography ----- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

h1, h2, .app-title, .greeting-text {
  font-family: 'Playfair Display', serif;
}

h1 { font-size: clamp(1.25rem, 3vw, 1.625rem); }
h2 { font-size: clamp(1.125rem, 2.5vw, 1.375rem); }
h3 { font-size: clamp(1rem, 2.2vw, 1.125rem); }
h4 { font-size: clamp(0.9375rem, 2vw, 1rem); }

.text-eyebrow {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.time-display {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
}

/* ----- Layout ----- */
.content-area {
  width: 100%;
  padding: 1rem;
  padding-bottom: calc(var(--bottom-nav-height) + 1.5rem);
  overflow-y: auto;
  transition: padding var(--transition-slow);
}

.desktop-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

/* ----- Cards ----- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: clamp(1rem, 3vw, 1.5rem);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(200, 150, 62, 0.25);
}

/* Card variant: clickable — explicit indication card adalah interactive */
.card.clickable,
.card[onclick],
a.card,
button.card {
  cursor: pointer;
}
.card.clickable:hover,
.card[onclick]:hover,
a.card:hover,
button.card:hover {
  border-color: rgba(200, 150, 62, 0.35);
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast), border-color var(--transition-fast),
    color var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, #C8963E, #9B7B2F);
  color: #1E2128;
  font-weight: 700;
  border: none;
  box-shadow: 0 2px 8px rgba(200, 150, 62, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #D4A94F, #C8963E);
  box-shadow: 0 4px 16px rgba(200, 150, 62, 0.4);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(200, 150, 62, 0.25);
}

body.light-mode .btn-primary {
  background: linear-gradient(135deg, #9B7B2F, #7D6325);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(125, 99, 37, 0.3);
}

body.light-mode .btn-primary:hover {
  background: linear-gradient(135deg, #7D6325, #5E4A1C);
  box-shadow: 0 4px 16px rgba(125, 99, 37, 0.4);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-primary);
}

.btn-ghost:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
  color: var(--text-primary);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: var(--success);
  filter: brightness(1.12);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: var(--danger);
  filter: brightness(1.12);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ----- Input Fields ----- */
.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="tel"],
input[type="url"],
select,
textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* Improved input border visibility */
.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="tel"],
input[type="url"],
select,
textarea {
  border: 1px solid rgba(200, 150, 62, 0.15);
}
.input:hover,
input:hover,
select:hover,
textarea:hover {
  border-color: rgba(200, 150, 62, 0.3);
}

.input::placeholder,
input::placeholder,
textarea::placeholder {
  color: #A8B5C5;  /* contrast 4.6:1 dengan dark bg */
  opacity: 1;
}

select::placeholder {
  color: #A8B5C5;
  opacity: 1;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ----- Navigation: Bottom Nav (Mobile) ----- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: var(--bottom-nav-height);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-default);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-width: 44px;
  min-height: 44px;
  padding: 0.375rem 0.75rem;
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  transition: color var(--transition-fast);
  text-decoration: none;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  color: var(--accent);
}

.nav-item svg,
.nav-item i {
  width: 22px;
  height: 22px;
}

/* ----- Navigation: Sidebar (Desktop) ----- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1100;
  display: none;
  flex-direction: column;
  width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  background: linear-gradient(180deg, #1B3A5C 0%, #1E2128 100%);
  border-right: 1px solid var(--border-default);
  padding: 1rem 0.75rem;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--transition-slow);
}

.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    repeating-linear-gradient(45deg, transparent, transparent 12px, rgba(200, 150, 62, 0.04) 12px, rgba(200, 150, 62, 0.04) 24px);
  pointer-events: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.625rem;
  margin-bottom: 1.5rem;
  white-space: nowrap;
  overflow: hidden;
  color: #E8EDF2;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #A8BCCE !important;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
}

.sidebar-item:hover {
  background: var(--bg-elevated);
  color: #C8D5E3 !important;
}

.sidebar-item.active {
  background: rgba(200, 150, 62, 0.2) !important;
  color: #F5E6D3 !important;
}

.sidebar-item svg,
.sidebar-item i {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.sidebar-item span {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar collapsed state */
.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-header span,
.sidebar.collapsed .sidebar-item span {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-header {
  justify-content: center;
}

.sidebar.collapsed .sidebar-item {
  justify-content: center;
  padding: 0.625rem;
}

/* ----- Status Badges ----- */
.status-badge,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 4px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-masuk {
  background: rgba(45, 122, 80, 0.15);
  color: #2D7A50;
  border: 1px solid rgba(45, 122, 80, 0.3);
}

.status-pulang {
  background: rgba(94, 122, 148, 0.18);
  color: #B8C4D1;
  border: 1px solid rgba(94, 122, 148, 0.35);
}

.status-terlambat {
  background: rgba(163, 61, 76, 0.15);
  color: #A63D4C;
  border: 1px solid rgba(163, 61, 76, 0.3);
}

.status-izin {
  background: rgba(200, 150, 62, 0.15);
  color: #9B7B2F;
  border: 1px solid rgba(200, 150, 62, 0.25);
}

.status-neutral {
  background: rgba(94, 122, 148, 0.12);
  color: #A8BCCE;
  border: 1px solid rgba(94, 122, 148, 0.25);
}

/* Light mode status-tag overrides — kontras setiap tag ≥ 4.5:1 */
body.light-mode .status-tag.pending {
  background: rgba(180, 83, 9, 0.10);
  color: #92400e;        /* contrast 7.5:1 di #FFFFFF */
}
body.light-mode .status-tag.approved {
  background: rgba(21, 128, 61, 0.10);
  color: #14532d;        /* contrast 9.5:1 */
}
body.light-mode .status-tag.rejected {
  background: rgba(185, 28, 28, 0.10);
  color: #7f1d1d;        /* contrast 9.0:1 */
}

/* Light mode badge adjustments */
body.light-mode .status-masuk {
  background: rgba(27, 58, 92, 0.08);
  color: #1B3A5C;
  border-color: rgba(27, 58, 92, 0.15);
}

body.light-mode .status-pulang {
  background: rgba(139, 157, 175, 0.10);
  color: #4A5568;
  border-color: rgba(139, 157, 175, 0.20);
}

body.light-mode .status-terlambat {
  background: rgba(139, 46, 59, 0.08);
  color: #8B2E3B;
  border-color: rgba(139, 46, 59, 0.15);
}

body.light-mode .status-neutral {
  background: rgba(74, 85, 104, 0.06);
  color: #4A5568;
  border-color: rgba(74, 85, 104, 0.12);
}

/* ----- Visual Hierarchy ----- */
.section-header,
.card-header,
h3 {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.stat-value,
.metric-value {
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--accent);
}

.help-text,
.hint-text {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Focus indicators for accessibility */
a:focus-visible,
button:focus-visible,
.nav-item:focus-visible,
.sidebar-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ----- Camera Container ----- */
.camera-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 4 / 3;
  background: #18181b;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-default);
}

.camera-container video,
.camera-container canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ----- Map Container ----- */
.map-container {
  width: 100%;
  height: 180px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
}

/* ----- Modal / Bottom Sheet ----- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  width: 100%;
  max-width: 100%;
  max-height: 85vh;
  max-height: 85dvh;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 1.5rem;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform var(--transition-slow);
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border-hover);
  border-radius: 9999px;
  margin: 0 auto 1rem;
}

/* ----- Toast Notifications ----- */
.toast-container {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: clamp(280px, 90vw, 400px);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  color: var(--text-primary);
  pointer-events: auto;
  animation: toast-in var(--transition-slow) ease forwards;
}

.toast.toast-success {
  background: #2D7A50;
  border: 1px solid #3D9970;
  color: #FFFFFF;
  border-left: 3px solid #3D9970;
}

.toast.toast-error {
  background: #8B2E3B;
  border: 1px solid #A63D4C;
  color: #FFFFFF;
  border-left: 3px solid #A63D4C;
}

.toast.toast-info {
  background: #1B3A5C;
  border: 1px solid #2D5A8A;
  color: #FFFFFF;
  border-left: 3px solid #2D5A8A;
}

.toast.toast-warning {
  background: #D4A94F;
  border: 1px solid #C8963E;
  color: #1E2128;
  border-left: 3px solid #C8963E;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-0.75rem) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-0.75rem) scale(0.95);
  }
}

.toast.removing {
  animation: toast-out var(--transition-base) ease forwards;
}

/* ----- Spinner ----- */
.spinner {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border: 2.5px solid var(--border-default);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-lg {
  width: 2.5rem;
  height: 2.5rem;
  border-width: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ----- Splash Screen ----- */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  background: var(--bg-body);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.splash-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-logo {
  width: clamp(48px, 12vw, 72px);
  height: clamp(48px, 12vw, 72px);
  animation: pulse-scale 1.5s ease-in-out infinite;
}

@keyframes pulse-scale {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

/* ----- Success Animation ----- */
.success-animation {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  margin: 0 auto;
}

.success-checkmark {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: block;
  stroke-width: 3;
  stroke: var(--success);
  stroke-miterlimit: 10;
  animation: checkmark-fill 0.4s ease-in-out 0.4s forwards,
    checkmark-scale 0.3s ease-in-out 0.9s both;
}

.success-checkmark circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-width: 3;
  stroke-miterlimit: 10;
  stroke: var(--success);
  fill: none;
  animation: checkmark-stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.success-checkmark path {
  transform-origin: 50% 50%;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: checkmark-stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes checkmark-stroke {
  100% { stroke-dashoffset: 0; }
}

@keyframes checkmark-fill {
  100% { box-shadow: inset 0 0 0 80px rgba(34, 197, 94, 0.08); }
}

@keyframes checkmark-scale {
  0%, 100% { transform: none; }
  50% { transform: scale3d(1.1, 1.1, 1); }
}

/* ----- Page Visibility ----- */
.page {
  display: none !important;
}

.page.active {
  display: block !important;
}

/* Hide app internals when page-app is not the active page.
   Note: sidebar is now part of CSS grid on desktop, so parent's display:none
   already hides it. Kept as defensive layer. */
#page-app:not(.active) .sidebar,
#page-app:not(.active) .bottom-nav {
  display: none !important;
}

/* Login/Register: sit above any fixed elements when active */
#page-login.active,
#page-register.active {
  position: relative;
  z-index: 1200;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-body);
}

/* Sibling safety: if login is active, hide app's fixed children */
#page-login.active ~ #page-app .sidebar,
#page-login.active ~ #page-app .bottom-nav,
#page-register.active ~ #page-app .sidebar,
#page-register.active ~ #page-app .bottom-nav {
  display: none !important;
}

/* ----- Utility Classes ----- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: 0.25rem; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.gap-lg { gap: 1.5rem; }

.w-full { width: 100%; }
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }
.mt-lg { margin-top: 1.5rem; }
.mb-sm { margin-bottom: 0.5rem; }
.mb-md { margin-bottom: 1rem; }
.mb-lg { margin-bottom: 1.5rem; }
.p-sm { padding: 0.5rem; }
.p-md { padding: 1rem; }
.p-lg { padding: 1.5rem; }
.hidden { display: none; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}



/* ----- Reduced Motion ----- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
    transition-duration: 0.01ms;
    scroll-behavior: auto;
  }

  .splash-logo {
    animation: none;
  }
}

/* ----- Print Styles ----- */
@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
  }

  .sidebar,
  .bottom-nav,
  .toast-container,
  .modal-overlay,
  .splash-screen,
  .btn,
  .camera-container {
    display: none;
  }

  .content-area {
    margin-left: 0;
    padding: 0;
  }

  .card {
    border: 1px solid #ccc;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .status-badge {
    border: 1px solid currentColor;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #555;
  }
}

/* ============================================================
   TAILWIND OVERRIDE SECTION
   Forces dark theme colors on Tailwind utility classes
   used in the HTML to maintain visual consistency.
   !important is permitted ONLY in this section.
   ============================================================ */

/* Background overrides */
.bg-gray-900,
.bg-slate-900,
.bg-zinc-900 {
  background-color: var(--bg-body) !important;
}

.bg-gray-800,
.bg-slate-800,
.bg-zinc-800 {
  background-color: var(--bg-surface) !important;
}

.bg-gray-700,
.bg-slate-700,
.bg-zinc-700 {
  background-color: var(--bg-card) !important;
}

.bg-indigo-600,
.bg-indigo-500 {
  background-color: var(--accent) !important;
}

.bg-green-600,
.bg-green-500 {
  background-color: var(--success) !important;
}

.bg-red-600,
.bg-red-500 {
  background-color: var(--danger) !important;
}

/* Text color overrides */
.text-white {
  color: var(--text-primary) !important;
}

.text-gray-100,
.text-slate-100,
.text-zinc-100 {
  color: var(--text-primary) !important;
}

.text-gray-300,
.text-slate-300,
.text-zinc-300 {
  color: var(--text-secondary) !important;
}

.text-gray-400,
.text-slate-400,
.text-zinc-400 {
  color: var(--text-secondary) !important;
}

.text-gray-500,
.text-slate-500,
.text-zinc-500 {
  color: var(--text-muted) !important;
}

.text-indigo-400,
.text-indigo-500 {
  color: var(--accent-hover) !important;
}

.text-green-400,
.text-green-500 {
  color: var(--success) !important;
}

.text-red-400,
.text-red-500 {
  color: var(--danger) !important;
}

/* Border overrides */
.border-gray-700,
.border-slate-700,
.border-zinc-700 {
  border-color: var(--border-default) !important;
}

.border-gray-600,
.border-slate-600,
.border-zinc-600 {
  border-color: var(--border-default) !important;
}

/* Rounded overrides */
.rounded-lg {
  border-radius: var(--radius-lg) !important;
}

.rounded-xl {
  border-radius: var(--radius-xl) !important;
}

/* Spacing consistency */
.p-4 {
  padding: clamp(1rem, 3vw, 1.5rem) !important;
}

.p-6 {
  padding: clamp(1.25rem, 3.5vw, 1.75rem) !important;
}

/* Shadow overrides */
.shadow-lg {
  box-shadow: var(--shadow-lg) !important;
}

.shadow-md {
  box-shadow: var(--shadow-md) !important;
}

/* Ring / focus overrides */
.ring-indigo-500,
.focus\:ring-indigo-500:focus {
  --tw-ring-color: var(--accent) !important;
}

/* Light mode Tailwind overrides */
body.light-mode .bg-gray-900,
body.light-mode .bg-slate-900,
body.light-mode .bg-zinc-900 {
  background-color: var(--bg-body) !important;
}

body.light-mode .bg-gray-800,
body.light-mode .bg-slate-800,
body.light-mode .bg-zinc-800 {
  background-color: var(--bg-surface) !important;
}

body.light-mode .bg-gray-700,
body.light-mode .bg-slate-700,
body.light-mode .bg-zinc-700 {
  background-color: var(--bg-card) !important;
}

body.light-mode .text-white,
body.light-mode .text-gray-100,
body.light-mode .text-slate-100,
body.light-mode .text-zinc-100 {
  color: var(--text-primary) !important;
}

body.light-mode .text-gray-300,
body.light-mode .text-slate-300,
body.light-mode .text-zinc-300,
body.light-mode .text-gray-400,
body.light-mode .text-slate-400,
body.light-mode .text-zinc-400 {
  color: var(--text-secondary) !important;
}

body.light-mode .border-gray-700,
body.light-mode .border-slate-700,
body.light-mode .border-zinc-700,
body.light-mode .border-gray-600,
body.light-mode .border-slate-600,
body.light-mode .border-zinc-600 {
  border-color: var(--border-default) !important;
}

/* ============================================================
   COMPONENT STYLES
   ============================================================ */

/* Rekap table container - horizontal scroll */
#rekap-table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* Personil list fix - avatar and text alignment */
.personil-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-default, rgba(255,255,255,0.06));
}
.personil-item:last-child { border-bottom: none; }
.personil-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated, #27272a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-secondary, #a1a1aa);
  flex-shrink: 0;
}
.personil-info {
  flex: 1;
  min-width: 0;
}
.personil-info .name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary, #fafafa);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.personil-info .meta {
  font-size: 0.6875rem;
  color: var(--text-muted, #71717a);
  margin-top: 1px;
}
.personil-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* Summary cards in rekap */
#rekap-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}


/* ============================================================
   SPRINT A — Polish components
   ============================================================ */

/* Badge pill (notification count) */
.badge-pill {
  position: absolute;
  top: 4px;
  right: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger, #ef4444);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Action required widget */
.action-required-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-md, 8px);
  background: var(--bg-elevated, rgba(255, 255, 255, 0.03));
  cursor: pointer;
  transition: background var(--transition-fast, 150ms);
}
.action-required-item:hover {
  background: var(--bg-hover, rgba(99, 102, 241, 0.08));
}
.action-required-item .icon-wrap {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--accent-subtle, rgba(99, 102, 241, 0.15));
  color: var(--accent, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.action-required-item .label {
  flex: 1;
  font-size: 0.8125rem;
  color: var(--text-primary);
  font-weight: 500;
}
.action-required-item .count {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent, #6366f1);
  font-variant-numeric: tabular-nums;
}

/* Approval item card with checkbox */
.approval-card {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--border-default, rgba(255, 255, 255, 0.08));
  background: var(--bg-surface, rgba(255, 255, 255, 0.02));
  transition: border-color var(--transition-fast, 150ms);
}
.approval-card.checked {
  border-color: var(--accent, #6366f1);
  background: var(--accent-subtle, rgba(99, 102, 241, 0.06));
}
.approval-card .check-col {
  display: flex;
  align-items: flex-start;
  padding-top: 2px;
}
.approval-card input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent, #6366f1);
}
.approval-card .info {
  flex: 1;
  min-width: 0;
}
.approval-card .info .who {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}
.approval-card .info .when {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.approval-card .info .reason {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.4;
}
.approval-card .actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.approval-card .status-tag {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-tag.pending {
  background: rgba(245, 158, 11, 0.20);
  color: #FCD34D;       /* contrast 9.7:1 di dark bg */
}
.status-tag.approved {
  background: rgba(34, 197, 94, 0.20);
  color: #6EE7A7;        /* contrast 9.5:1 */
}
.status-tag.rejected {
  background: rgba(239, 68, 68, 0.20);
  color: #FCA5A5;        /* contrast 8.0:1 */
}

/* Sticky toast for critical errors */
.toast.sticky {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--danger, #ef4444);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  font-size: 0.875rem;
  max-width: 92%;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  animation: slideDown 200ms ease-out;
}
.toast.sticky .close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
@keyframes slideDown {
  from { transform: translate(-50%, -20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* Onboarding wizard modal */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 200ms ease-out;
}
.onboarding-card {
  background: var(--bg-surface, #18181b);
  border-radius: var(--radius-lg, 12px);
  padding: 1.5rem;
  max-width: 440px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-default, rgba(255, 255, 255, 0.08));
}
.onboarding-card h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
}
.onboarding-card p.lead {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.5;
}
.onboarding-step-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 1rem 0;
}
.onboarding-step-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-default, rgba(255, 255, 255, 0.15));
  transition: background var(--transition-fast, 150ms);
}
.onboarding-step-dots span.active {
  background: var(--accent, #6366f1);
}
.onboarding-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
}
.onboarding-actions .btn {
  flex: 1;
}

/* Empty state consistent block */
.empty-state-v2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}
.empty-state-v2 svg {
  width: 40px;
  height: 40px;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}
.empty-state-v2 .title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}
.empty-state-v2 .desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.875rem;
  max-width: 280px;
  line-height: 1.4;
}
.empty-state-v2 .cta {
  margin-top: 0.25rem;
}

/* Pulse for badge */
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.badge-pill.urgent {
  animation: pulse-ring 1.6s infinite;
}

/* Light mode adjustments */
body.light-mode .approval-card {
  background: #fff;
  border-color: #e5e7eb;
}
body.light-mode .approval-card.checked {
  background: rgba(155, 123, 47, 0.04);
}
body.light-mode .action-required-item {
  background: #FAF7F2;
}
body.light-mode .action-required-item:hover {
  background: rgba(155, 123, 47, 0.06);
}
body.light-mode .onboarding-card {
  background: #fff;
  border-color: #e5e7eb;
}


/* ============================================================
   REKAP TABLE — Polished visual (replaces broken plain layout)
   ============================================================ */
.rekap-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  background: var(--bg-surface, #18181b);
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
}
.rekap-table thead th {
  background: var(--bg-elevated, #27272a);
  color: var(--text-secondary, #a1a1aa);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 4px;
  font-size: 0.625rem;
  border-bottom: 1px solid var(--border-default, rgba(255, 255, 255, 0.08));
  white-space: nowrap;
  text-align: center;
}
.rekap-table thead th:first-child {
  text-align: left;
  padding-left: 12px;
  position: sticky;
  left: 0;
  background: var(--bg-elevated, #27272a);
  z-index: 2;
}
.rekap-table tbody td {
  padding: 6px 4px;
  border-bottom: 1px solid var(--border-default, rgba(255, 255, 255, 0.05));
  text-align: center;
  color: var(--text-secondary, #a1a1aa);
  white-space: nowrap;
}
.rekap-table tbody tr:last-child td {
  border-bottom: none;
}
.rekap-table tbody tr:hover td {
  background: var(--bg-hover, rgba(99, 102, 241, 0.04));
}
.rekap-table tbody td:first-child {
  text-align: left;
  padding-left: 12px;
  font-weight: 600;
  color: var(--text-primary, #fafafa);
  position: sticky;
  left: 0;
  background: var(--bg-surface, #18181b);
  border-right: 1px solid var(--border-default, rgba(255, 255, 255, 0.08));
  min-width: 110px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rekap-table tbody tr:hover td:first-child {
  background: var(--bg-hover, rgba(99, 102, 241, 0.04));
}

/* Day cells — semantic color coding */
.rekap-table td.cell-h { color: #22c55e; font-weight: 700; background: rgba(34, 197, 94, 0.08); }
.rekap-table td.cell-t { color: #f59e0b; font-weight: 700; background: rgba(245, 158, 11, 0.10); }
.rekap-table td.cell-i { color: #6366f1; font-weight: 700; background: rgba(99, 102, 241, 0.10); }
.rekap-table td.cell-s { color: #ec4899; font-weight: 700; background: rgba(236, 72, 153, 0.10); }
.rekap-table td.cell-c { color: #06b6d4; font-weight: 700; background: rgba(6, 182, 212, 0.10); }
.rekap-table td.cell-l { color: #a855f7; font-weight: 700; background: rgba(168, 85, 247, 0.10); }
.rekap-table td.cell-a { color: #ef4444; font-weight: 700; background: rgba(239, 68, 68, 0.10); }
.rekap-table td.cell-w { color: var(--text-muted, #71717a); background: rgba(255, 255, 255, 0.02); }

/* Summary columns (H/T/I/S/C/L/A totals at end) */
.rekap-table tbody td.summary-col {
  background: var(--bg-elevated, #27272a);
  font-weight: 700;
  color: var(--text-primary, #fafafa);
  font-variant-numeric: tabular-nums;
  border-left: 1px solid var(--border-default, rgba(255, 255, 255, 0.05));
}
.rekap-table thead th.summary-col-head {
  background: var(--accent-subtle, rgba(99, 102, 241, 0.15));
  color: var(--accent, #6366f1);
}

/* Light mode adjustments */
body.light-mode .rekap-table {
  background: #fff;
  border: 1px solid #e5e7eb;
}
body.light-mode .rekap-table thead th {
  background: #f9fafb;
  color: #475569;
  border-bottom-color: #e5e7eb;
}
body.light-mode .rekap-table thead th:first-child {
  background: #f9fafb;
}
body.light-mode .rekap-table tbody td {
  border-bottom-color: #f3f4f6;
  color: #475569;
}
body.light-mode .rekap-table tbody td:first-child {
  background: #fff;
  color: #0f172a;
  border-right-color: #e5e7eb;
}
body.light-mode .rekap-table td.cell-h { background: rgba(34, 197, 94, 0.12); color: #15803d; }
body.light-mode .rekap-table td.cell-t { background: rgba(245, 158, 11, 0.15); color: #b45309; }
body.light-mode .rekap-table td.cell-i { background: rgba(99, 102, 241, 0.10); color: #4338ca; }
body.light-mode .rekap-table td.cell-s { background: rgba(236, 72, 153, 0.10); color: #be185d; }
body.light-mode .rekap-table td.cell-c { background: rgba(6, 182, 212, 0.10); color: #0e7490; }
body.light-mode .rekap-table td.cell-l { background: rgba(168, 85, 247, 0.10); color: #7e22ce; }
body.light-mode .rekap-table td.cell-a { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
body.light-mode .rekap-table td.cell-w { background: #f9fafb; color: #94a3b8; }
body.light-mode .rekap-table tbody td.summary-col { background: #f9fafb; color: #0f172a; }
body.light-mode .rekap-table thead th.summary-col-head {
  background: rgba(155, 123, 47, 0.08);
  color: #7D6325;
}

/* Legend below table */
.rekap-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-top: 0.75rem;
  padding: 0.625rem 0.75rem;
  background: var(--bg-elevated, rgba(255, 255, 255, 0.02));
  border-radius: var(--radius-md, 8px);
  font-size: 0.6875rem;
  color: var(--text-secondary, #a1a1aa);
}
.rekap-legend .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.rekap-legend .legend-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  text-align: center;
  font-size: 0.5625rem;
  font-weight: 700;
  line-height: 14px;
}
.rekap-legend .legend-dot.h { color: #22c55e; background: rgba(34, 197, 94, 0.15); }
.rekap-legend .legend-dot.t { color: #f59e0b; background: rgba(245, 158, 11, 0.15); }
.rekap-legend .legend-dot.i { color: #6366f1; background: rgba(99, 102, 241, 0.15); }
.rekap-legend .legend-dot.s { color: #ec4899; background: rgba(236, 72, 153, 0.15); }
.rekap-legend .legend-dot.c { color: #06b6d4; background: rgba(6, 182, 212, 0.15); }
.rekap-legend .legend-dot.l { color: #a855f7; background: rgba(168, 85, 247, 0.15); }
.rekap-legend .legend-dot.a { color: #ef4444; background: rgba(239, 68, 68, 0.15); }

body.light-mode .rekap-legend {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  color: #475569;
}



/* ============================================================
   CMS / SETTINGS PANEL
   ============================================================ */
.settings-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg, 12px);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.settings-section h4 {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.25rem 0;
}
.settings-section .desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.settings-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.625rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-default);
}
.settings-row:last-child { border-bottom: none; padding-bottom: 0; }
.settings-row:first-of-type { padding-top: 0; }
.settings-row .label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}
.settings-row .label .hint {
  display: block;
  font-size: 0.6875rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}
.settings-row .control input[type="text"],
.settings-row .control input[type="email"],
.settings-row .control input[type="number"],
.settings-row .control input[type="time"],
.settings-row .control input[type="url"],
.settings-row .control textarea,
.settings-row .control select {
  width: 100%;
}
.settings-row .control textarea { min-height: 70px; resize: vertical; }
.settings-row .control .help {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

/* Toggle switch for boolean settings */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border-default, #3f3f46);
  border-radius: 24px;
  transition: background var(--transition-fast, 200ms);
}
.toggle-switch .slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition-fast, 200ms);
}
.toggle-switch input:checked + .slider { background: var(--accent, #C8963E); }
.toggle-switch input:checked + .slider::before { transform: translateX(18px); }
.toggle-switch input:focus-visible + .slider {
  box-shadow: 0 0 0 3px rgba(200, 150, 62, 0.3);
}

/* Settings sub-tabs */
.settings-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md, 8px);
  margin-bottom: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-wrap: nowrap;
  scrollbar-width: none;
}
.settings-tabs::-webkit-scrollbar { display: none; }
.settings-tab {
  padding: 0.5rem 0.875rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--transition-fast, 150ms), color var(--transition-fast, 150ms);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.settings-tab:hover { background: var(--bg-elevated); color: var(--text-primary); }
.settings-tab.active {
  background: var(--accent-subtle, rgba(200, 150, 62, 0.12));
  color: var(--accent-hover, #D4A94F);
}
body.light-mode .settings-tab.active {
  background: rgba(155, 123, 47, 0.10);
  color: var(--accent, #9B7B2F);
}

/* Save toolbar (sticky bottom) */
.settings-save-bar {
  position: sticky;
  bottom: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-default);
  margin: 1rem -1rem -1rem;
  padding: 0.875rem 1rem;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  align-items: center;
  z-index: 5;
  border-radius: 0 0 var(--radius-lg, 12px) var(--radius-lg, 12px);
}
.settings-save-bar .dirty-indicator {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-right: auto;
}
.settings-save-bar .dirty-indicator.dirty {
  color: var(--accent);
  font-weight: 600;
}

/* Holiday list item */
.holiday-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm, 6px);
  margin-bottom: 0.375rem;
}
.holiday-item .date {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  min-width: 90px;
}
.holiday-item .name {
  flex: 1;
  font-size: 0.8125rem;
  color: var(--text-primary);
  font-weight: 500;
}
.holiday-item .type-badge {
  font-size: 0.625rem;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--bg-surface);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.holiday-item .remove-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
}

/* CMS card */
.cms-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--border-default);
  margin-bottom: 0.5rem;
}
.cms-card .icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm, 6px);
  background: var(--accent-subtle, rgba(99, 102, 241, 0.15));
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cms-card .info { flex: 1; min-width: 0; }
.cms-card .info .title { font-size: 0.875rem; font-weight: 700; color: var(--text-primary); }
.cms-card .info .subtitle { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.cms-card .arrow { color: var(--text-muted); align-self: center; flex-shrink: 0; }
.cms-card { cursor: pointer; transition: border-color var(--transition-fast, 150ms), background var(--transition-fast, 150ms); }
.cms-card:hover { border-color: var(--accent); background: var(--bg-hover, rgba(99, 102, 241, 0.04)); }


/* ============================================================
   CUAL HERITAGE — Decorative Elements
   Subtle cultural touches inspired by Tenun Cual Bangka Belitung
   ============================================================ */

/* --- Cual Pattern Border (geometric weave strip) --- */
.cual-border-top {
  position: relative;
}
.cual-border-top::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    #C8963E 0px, #C8963E 8px,
    #8B2E3B 8px, #8B2E3B 12px,
    #1B3A5C 12px, #1B3A5C 20px,
    #C8963E 20px, #C8963E 24px,
    transparent 24px, transparent 28px
  );
  opacity: 0.8;
  border-radius: inherit;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* --- Sidebar & Header: Ocean-to-Granite gradient --- */
#app-sidebar, .app-header {
  background: linear-gradient(180deg, #1B3A5C 0%, #1E2128 100%);
}

/* Catatan: aturan `.card:hover` didefinisikan sekali di bagian Components
   (lihat ~baris 221). Definisi duplikat di sini sudah dihapus agar tidak
   saling menimpa. */

/* --- Login Page: Premium Treatment --- */
#page-login {
  background:
    radial-gradient(circle at 20% 30%, rgba(200, 150, 62, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(27, 58, 92, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 2px 2px, rgba(200, 150, 62, 0.03) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 24px 24px;
  background-color: var(--bg-body);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#page-login .card {
  position: relative;
  border: 1px solid rgba(200, 150, 62, 0.12);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(200, 150, 62, 0.06);
}

/* Cual border on login card */
#page-login .card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    #C8963E 0px, #C8963E 8px,
    #8B2E3B 8px, #8B2E3B 12px,
    #1B3A5C 12px, #1B3A5C 20px,
    #C8963E 20px, #C8963E 24px,
    transparent 24px, transparent 28px
  );
  border-radius: inherit;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

#page-login .app-title,
#page-login h1,
#page-login h2 {
  font-family: 'Playfair Display', serif;
  color: var(--text-primary);
}

#page-login .btn-primary {
  background: linear-gradient(135deg, #C8963E, #9B7B2F);
  color: #1E2128;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(200, 150, 62, 0.25);
}

#page-login .btn-primary:hover {
  background: linear-gradient(135deg, #D4A94F, #C8963E);
  box-shadow: 0 4px 16px rgba(200, 150, 62, 0.35);
}

/* Register page same treatment */
#page-register {
  background:
    radial-gradient(circle at 20% 30%, rgba(200, 150, 62, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(27, 58, 92, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 2px 2px, rgba(200, 150, 62, 0.03) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 24px 24px;
  background-color: var(--bg-body);
}

#page-register .card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    #C8963E 0px, #C8963E 8px,
    #8B2E3B 8px, #8B2E3B 12px,
    #1B3A5C 12px, #1B3A5C 20px,
    #C8963E 20px, #C8963E 24px,
    transparent 24px, transparent 28px
  );
  border-radius: inherit;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

#page-register .card {
  position: relative;
}

/* --- Print: Cual border on report headers --- */
@media print {
  .report-header,
  .print-header {
    position: relative;
    padding-top: 8px;
  }
  .report-header::before,
  .print-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: repeating-linear-gradient(
      90deg,
      #C8963E 0px, #C8963E 8px,
      #8B2E3B 8px, #8B2E3B 12px,
      #1B3A5C 12px, #1B3A5C 20px,
      #C8963E 20px, #C8963E 24px,
      transparent 24px, transparent 28px
    );
  }
}


/* --- Light mode: Login page adjustments --- */
body.light-mode #page-login,
body.light-mode #page-register {
  background:
    radial-gradient(circle at 20% 30%, rgba(155, 123, 47, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(27, 58, 92, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 2px 2px, rgba(155, 123, 47, 0.03) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 24px 24px;
  background-color: var(--bg-body);
}

body.light-mode #page-login .card,
body.light-mode #page-register .card {
  border-color: rgba(30, 33, 40, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(155, 123, 47, 0.06);
}

body.light-mode #page-login .btn-primary,
body.light-mode #page-register .btn-primary {
  background: linear-gradient(135deg, #9B7B2F, #C8963E);
  color: #FFFFFF;
}

/* ============================================================
   ACCESSIBILITY & CONTRAST FIXES
   ============================================================ */

/* Muted text — gunakan token agar konsisten dark & light (WCAG AA).
   Hardcode warna sebelumnya (#8B9DAF) membuat kontras light mode gagal. */
.text-muted {
  color: var(--text-muted);
}

/* Visual hierarchy: section headers */
.section-header,
.card-header {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

/* Emphasized metrics */
.stat-value,
.metric-value {
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--accent);
}

/* Help/hint text */
.help-text,
.hint-text {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Improved focus indicators for accessibility */
a:focus-visible,
button:focus-visible,
.nav-item:focus-visible,
.sidebar-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Cual border visibility improvement */
.cual-border-top::before {
  opacity: 0.85;
}

/* Status badges: improved contrast */
.status-badge {
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* Tab content visibility (base rule, not responsive) */
.tab-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.tab-content.hidden {
  display: none !important;
}




/* ============================================================
   RESPONSIVE BREAKPOINTS — CONSOLIDATED
   Order: Mobile → Tablet → Desktop → Large Desktop
   ============================================================ */

/* ===== MOBILE ONLY (≤767px) ===== */
@media (max-width: 767px) {
  /* Sidebar: always hidden on mobile */
  .sidebar {
    display: none !important;
  }

  /* Bottom nav: visible on mobile — touch target ≥48px */
  .bottom-nav {
    display: flex !important;
    height: 60px;
  }
  .nav-item {
    padding: 8px 0;
    gap: 2px;
    min-height: 48px;
    min-width: 48px;
  }
  .nav-item svg {
    width: 20px;
    height: 20px;
  }
  .nav-item span {
    font-size: 10px;
  }

  /* Content area */
  .content-area {
    padding: 0.75rem;
    padding-bottom: calc(60px + 1.5rem);
  }

  /* Grid: single column */
  .desktop-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  /* Cards */
  .card {
    padding: 0.75rem;
    border-radius: 0.75rem;
  }

  /* Camera */
  .camera-container {
    aspect-ratio: 16 / 10;
    max-height: 200px;
    border-radius: 0.625rem;
  }

  /* Map */
  .map-container, #map {
    height: 140px;
    border-radius: 0.625rem;
  }

  /* Inputs — minimum 44px untuk WCAG 2.5.5 (touch target AAA recommended) */
  input, select, textarea {
    padding: 0.75rem 0.875rem;
    min-height: 44px;
    font-size: 16px; /* prevent iOS auto-zoom on focus */
    border-radius: 0.5rem;
  }
  textarea {
    min-height: 80px;
  }
  label {
    font-size: 0.8125rem;
    margin-bottom: 0.375rem;
  }

  /* Buttons — minimum 44px touch target (WCAG 2.5.5) */
  .btn {
    min-height: 44px;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    border-radius: 0.5rem;
  }

  /* Header */
  .content-area > header {
    margin-bottom: 0.75rem;
  }
  .content-area > header h1 {
    font-size: 0.875rem;
  }
  .content-area > header #header-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.75rem;
  }

  /* Time display */
  .time-display,
  #tab-dashboard .time-display {
    font-size: 1.75rem;
  }

  /* Eyebrow text */
  .text-eyebrow {
    font-size: 0.625rem;
  }

  /* Form field gaps */
  form .mb-md, .mb-md {
    margin-bottom: 0.625rem;
  }

  /* Quick actions: 2x2 grid */
  #tab-dashboard [style*="repeat(4"] {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.375rem;
  }
  #tab-dashboard [style*="repeat(4"] .btn {
    padding: 0.5rem 0.25rem;
    min-height: 60px;
    font-size: 0.625rem;
  }
  #tab-dashboard [style*="repeat(4"] svg {
    width: 18px;
    height: 18px;
  }

  /* Stats: 2x2 grid */
  #tab-dashboard .desktop-grid[style*="repeat(2"] {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  #tab-dashboard .desktop-grid .card {
    padding: 0.625rem;
  }
  #tab-dashboard .desktop-grid .card p:last-child {
    font-size: 1.25rem;
  }

  /* Status items in hero */
  #tab-dashboard .flex[style*="flex:1"] span:last-child {
    font-size: 1rem;
  }

  /* Chart smaller */
  #tab-dashboard [style*="height:220px"] {
    height: 160px;
  }

  /* Admin sub-tabs (5-col) */
  .admin-subtab {
    font-size: 0.75rem;
    padding: 0.5rem;
  }
  [role="tablist"][style*="repeat(5"] .admin-subtab {
    font-size: 0.625rem;
    padding: 0.375rem 0.125rem;
    min-height: 36px;
  }

  /* Admin stat grid stays 3-col */
  #admin-sub-harian .desktop-grid[style*="repeat(3"] {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Absen buttons 2-col */
  #tab-absen .desktop-grid[style*="repeat(2"] {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  /* Keterangan khusus 2x2 on mobile */
  #tab-absen [style*="repeat(4"],
  #tab-absen [style*="grid-template-columns:repeat(4"] {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.375rem;
  }

  /* Riwayat filters */
  #tab-riwayat .flex.gap-sm {
    flex-wrap: wrap;
  }
  #tab-riwayat select {
    flex: 1;
    min-width: 0;
  }

  /* Profile avatar */
  #profile-avatar,
  #tab-profil #profile-avatar {
    width: 60px;
    height: 60px;
    font-size: 1.25rem;
  }

  /* Login card tighter */
  #page-login .card,
  #page-register .card {
    padding: 1.25rem;
  }

  /* Modal: full-width bottom sheet */
  .modal-content {
    border-radius: 1rem 1rem 0 0;
    padding: 1rem;
    max-height: 80vh;
    max-height: 80dvh;
  }

  /* Rekap table */
  .rekap-table {
    font-size: 0.625rem;
  }
  .rekap-table thead th {
    padding: 6px 3px;
    font-size: 0.5625rem;
  }
  .rekap-table tbody td {
    padding: 5px 3px;
  }
  .rekap-table tbody td:first-child {
    min-width: 90px;
    max-width: 110px;
    font-size: 0.6875rem;
  }
  #rekap-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Settings tabs: horizontal scroll */
  .settings-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }
  .settings-tab {
    min-width: fit-content;
    font-size: 0.6875rem;
  }

  /* Very small screens (≤400px) — admin 5-tab overflow */
  [role="tablist"][style*="repeat(5"] {
    gap: 0.125rem;
  }

  /* Login page: full viewport, no app chrome */
  #page-login main {
    padding: 1rem;
    min-height: 100vh;
    min-height: 100dvh;
  }
  #page-login .card {
    width: 100%;
    max-width: 100%;
    padding: 1.5rem;
  }

  /* Dashboard hero: compact on mobile */
  #tab-dashboard .greeting-text {
    font-size: 0.875rem;
  }
  #tab-dashboard .date-display {
    font-size: 0.75rem;
  }

  /* Camera section: constrain height */
  #tab-absen .camera-container {
    max-height: 45vh;
    max-height: 45dvh;
  }

  /* Modal: bottom sheet behavior */
  .modal-overlay {
    align-items: flex-end;
  }
  .modal-content {
    max-height: 85vh;
    max-height: 85dvh;
    border-radius: 1rem 1rem 0 0;
    padding: 1rem;
  }
  .modal-handle {
    display: block;
  }

  /* Toast: top position (not behind bottom nav) */
  .toast-container {
    top: 1rem;
  }

  /* Admin tabs: no overflow, compressed text */
  [role="tablist"][style*="repeat(5"] .admin-subtab {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ===== TABLET (768px–1023px) ===== */
@media (min-width: 768px) and (max-width: 1023px) {
  /* Sidebar: hidden on tablet */
  .sidebar {
    display: none !important;
  }

  /* Bottom nav: visible on tablet */
  .bottom-nav {
    display: flex !important;
    height: 60px;
  }
  .nav-item {
    padding: 6px 0;
    min-height: 52px;
  }
  .nav-item svg {
    width: 20px;
    height: 20px;
  }
  .nav-item span {
    font-size: 0.5625rem;
  }

  /* Content area */
  .content-area {
    padding: 1.25rem;
    padding-bottom: calc(60px + 1.5rem);
    max-width: 720px;
    margin-inline: auto;
  }

  /* Grid: 2 columns where appropriate */
  .desktop-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  /* Cards */
  .card {
    padding: 1rem;
    border-radius: 0.75rem;
  }

  /* Camera */
  .camera-container {
    max-height: 260px;
    border-radius: 0.625rem;
  }

  /* Map */
  .map-container, #map {
    height: 180px;
  }

  /* Modal: centered bottom sheet */
  .modal-content {
    max-width: 480px;
    margin-inline: auto;
    border-radius: 1rem 1rem 0 0;
    padding: 1.25rem;
    max-height: 80vh;
    max-height: 80dvh;
  }

  /* Admin tabs */
  .admin-subtab {
    font-size: 0.75rem;
    padding: 0.5rem;
  }

  /* Stats: 2x2 grid */
  #tab-dashboard .desktop-grid[style*="repeat(2"] {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  /* Quick actions: 4-col grid */
  #tab-dashboard [style*="repeat(4"] {
    gap: 0.375rem;
  }
  #tab-dashboard [style*="repeat(4"] .btn {
    padding: 0.5rem 0.25rem;
    min-height: 60px;
    font-size: 0.6875rem;
  }

  /* Admin stats: 3 col */
  #tab-admin .desktop-grid[style*="repeat(3"],
  #admin-sub-harian .desktop-grid[style*="repeat(3"] {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }

  /* Absen buttons 2-col */
  #tab-absen .desktop-grid[style*="repeat(2"] {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  /* Keterangan khusus 2x2 */
  #tab-absen [style*="repeat(4"] {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.375rem;
  }

  /* Rekap table */
  .rekap-table {
    font-size: 9px;
  }
  .rekap-table th, .rekap-table td {
    padding: 3px 2px;
    min-width: 18px;
  }
  .rekap-table td:first-child {
    min-width: 60px;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #rekap-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Rekap summary: 4-col */
  #rekap-summary {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Settings row: 2-col layout */
  .settings-row {
    grid-template-columns: 1fr 1.5fr;
    align-items: start;
    gap: 1rem;
  }

  /* Inputs */
  input, select, textarea {
    padding: 0.625rem 0.75rem;
    min-height: 42px;
    font-size: 0.875rem;
  }

  /* Buttons */
  .btn {
    min-height: 42px;
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
  }

  /* Time display */
  #tab-dashboard .time-display {
    font-size: 2rem;
  }

  /* Profile avatar */
  #tab-profil #profile-avatar {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
  }
}

/* ===== DESKTOP (≥1024px) — FLEXBOX LAYOUT ===== */
@media (min-width: 1024px) {
  /* App shell: Flexbox — sidebar kiri fixed, content kanan scrollable */
  #page-app.active {
    display: block !important;  /* override .page.active display:block — sama, tapi eksplisit */
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
  }

  /* Body: kill scroll-x */
  body {
    overflow-x: hidden;
  }

  /* Bottom nav: hidden on desktop */
  .bottom-nav {
    display: none !important;
  }

  /* Sidebar: fixed ke kiri viewport, full height */
  .sidebar,
  #app-sidebar {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    z-index: 1100;
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* Content area: margin-left = sidebar width, mulai dari top */
  .content-area,
  #main-content {
    display: block;
    margin-left: var(--sidebar-width);
    margin-top: 0;
    padding: 1.5rem 2.5rem;
    padding-bottom: 2rem;
    min-width: 0;
    width: calc(100% - var(--sidebar-width));
    max-width: none;
    min-height: 100vh;
    min-height: 100dvh;
    box-sizing: border-box;
  }

  /* Sidebar collapsed: shrink sidebar + adjust content margin */
  body.sidebar-collapsed .sidebar,
  body.sidebar-collapsed #app-sidebar {
    width: var(--sidebar-collapsed);
  }
  body.sidebar-collapsed .content-area,
  body.sidebar-collapsed #main-content {
    margin-left: var(--sidebar-collapsed);
    width: calc(100% - var(--sidebar-collapsed));
  }

  /* Hide page-app when not active */
  #page-app:not(.active) {
    display: none !important;
  }

  /* Grid: 2 columns default for cards inside content */
  .desktop-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  /* Dashboard stats: 4-col (override inline grid-template-columns) */
  #tab-dashboard .desktop-grid[style*="grid-template-columns"],
  #tab-dashboard > .desktop-grid:first-of-type {
    grid-template-columns: repeat(4, 1fr) !important;
  }

  /* Quick actions grid (4 buttons row) */
  #tab-dashboard [style*="repeat(4"] {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 1rem !important;
  }

  /* Admin stats grid (3 cards) */
  #admin-sub-harian .desktop-grid[style*="repeat(3"] {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  /* Cards */
  .card {
    padding: 1.5rem !important;
    border: 1px solid var(--border-default);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow var(--transition-fast);
  }
  .card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }

  /* Camera */
  .camera-container {
    max-height: 240px;
    aspect-ratio: auto;
  }

  /* Map */
  .map-container {
    height: 220px;
  }

  /* Modal: centered vertically */
  .modal-overlay {
    align-items: center;
  }
  .modal-content {
    max-width: 520px;
    max-height: 80vh;
    max-height: 80dvh;
    border-radius: var(--radius-xl);
    transform: translateY(1rem) scale(0.97);
  }
  .modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
  }
  .modal-handle {
    display: none;
  }

  /* Toast */
  .toast-container {
    top: 1.5rem;
  }

  /* Time display */
  #tab-dashboard .time-display {
    font-size: 2.5rem !important;
  }
  .greeting-text {
    font-size: 1rem;
  }

  /* Activity section */
  #tab-dashboard .text-eyebrow {
    margin-bottom: 0.5rem;
  }

  /* Stats cards compact */
  #tab-dashboard .desktop-grid .card {
    padding: 1.25rem !important;
  }
  
  /* Stats card text sizing */
  #tab-dashboard .desktop-grid .card p[style*="font-size:1.5rem"] {
    font-size: 2rem !important;
  }

  /* Form 2-col for report/profile */
  #tab-laporan form,
  #tab-profil form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }
  #tab-laporan form > .mb-md:first-child,
  #tab-laporan form > .mb-md:last-of-type,
  #tab-laporan form > button,
  #tab-profil form > .mb-md:first-child,
  #tab-profil form > .mb-md:last-of-type,
  #tab-profil form > button {
    grid-column: 1 / -1;
  }

  /* Rekap summary: 4-col */
  #rekap-summary {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Settings row: 2-col layout */
  .settings-row {
    grid-template-columns: 1fr 1.5fr;
    align-items: start;
    gap: 1rem;
  }

  /* --- Desktop layout fixes --- */

  /* Tab content base layout */
  .tab-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
  }
  .tab-content.hidden {
    display: none !important;
  }

  /* Desktop: ensure 2-col grid works for all tab content */
  .tab-content > .desktop-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }

  /* Dashboard stats: 4-col on desktop (override inline styles) */
  #tab-dashboard .desktop-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 1.25rem !important;
  }

  /* Admin panel — rekap table full width */
  #admin-sub-rekap {
    max-width: none;
  }
  #admin-sub-rekap .card {
    max-width: none;
  }
  #rekap-table {
    max-width: 100%;
  }
  .rekap-table {
    font-size: 0.75rem;
  }
  .rekap-table thead th {
    padding: 10px 6px;
    font-size: 0.6875rem;
  }
  .rekap-table tbody td {
    padding: 8px 6px;
  }

  /* Admin stats: 3-col grid */
  #admin-sub-harian .desktop-grid[style*="repeat(3"] {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }

  /* Quick actions: 4-col (override inline styles) */
  #tab-dashboard [style*="repeat(4"] {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 1rem !important;
  }
  
  /* Quick action buttons: better sizing */
  #tab-dashboard [style*="repeat(4"] .btn {
    min-height: 80px !important;
    font-size: 0.75rem !important;
    padding: 0.875rem 0.625rem !important;
  }
  #tab-dashboard [style*="repeat(4"] svg {
    width: 22px !important;
    height: 22px !important;
  }

  /* Sidebar item compact sizing */
  .sidebar {
    width: var(--sidebar-width);
  }
  .sidebar-item {
    font-size: 0.875rem;
    padding: 0.625rem 0.875rem;
    min-height: 44px;
  }
  .sidebar-item svg {
    width: 20px;
    height: 20px;
  }

  /* Desktop typography improvements */
  body {
    font-size: 0.9375rem;
  }
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }

  /* Login/Register page centering */
  #page-login main,
  #page-register main {
    padding: 2rem;
  }
  #page-login .card,
  #page-register .card {
    max-width: 420px;
    margin: 0 auto;
  }
}

/* ===== LARGE DESKTOP (≥1280px) ===== */
@media (min-width: 1280px) {
  .content-area,
  #main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 2rem 3rem;
    padding-bottom: 2rem;
  }
  body.sidebar-collapsed .content-area,
  body.sidebar-collapsed #main-content {
    margin-left: var(--sidebar-collapsed);
    width: calc(100% - var(--sidebar-collapsed));
  }
}

/* ===== EXTRA LARGE DESKTOP (≥1440px) ===== */
@media (min-width: 1440px) {
  .content-area,
  #main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 2rem 4rem;
    padding-bottom: 2rem;
  }
  body.sidebar-collapsed .content-area,
  body.sidebar-collapsed #main-content {
    margin-left: var(--sidebar-collapsed);
    width: calc(100% - var(--sidebar-collapsed));
  }

  .desktop-grid {
    gap: 1.75rem;
  }

  #tab-dashboard .desktop-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 1.5rem !important;
  }
}

/* ===== Dashboard UX refinements: proportional cards, no horizontal scroll ===== */
#main-content,
.content-area,
.tab-content,
.desktop-grid,
.card,
.admin-subcontent,
.settings-section,
.settings-row,
.personil-item,
.approval-card {
  min-width: 0;
}

.tab-content {
  max-width: 1440px;
  margin-inline: auto;
  width: 100%;
}

.tab-content > .card,
.tab-content > .desktop-grid,
.admin-subcontent > .card,
.admin-subcontent > .desktop-grid,
.admin-subcontent > .settings-tabs,
.admin-subcontent > #settings-content {
  width: 100%;
}

.card {
  overflow-wrap: anywhere;
}

.flex,
.grid {
  min-width: 0;
}

.admin-tablist,
.settings-tabs {
  min-width: 0;
}

.admin-tablist .admin-subtab,
.settings-tab {
  min-width: 0;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.admin-stat-card {
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.admin-data-card,
.admin-approval-card,
.admin-rekap-card,
.admin-personil-card,
.profile-main-card,
.profile-recap-card {
  overflow: hidden;
}

.profile-grid {
  align-items: start;
}

.profile-main-card {
  max-width: 760px;
}

.profile-recap-card {
  align-self: start;
}

.profile-main-card input:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.profile-main-card .profile-admin-only-disabled {
  opacity: 0.72;
}

.profile-main-card .profile-admin-only-disabled input {
  cursor: not-allowed;
}

.profile-field-note {
  display: block;
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.6875rem;
  line-height: 1.35;
}

.personil-info .meta,
.approval-card .info .reason,
.settings-row .label .hint,
.settings-row .control .help {
  overflow-wrap: anywhere;
}

@media (max-width: 767px) {
  .admin-tablist {
    display: flex !important;
    flex-wrap: wrap;
    gap: 0.25rem !important;
  }

  .admin-tablist .admin-subtab {
    flex: 1 1 calc(50% - 0.25rem);
    white-space: normal !important;
    text-overflow: clip !important;
    line-height: 1.2;
  }

  .admin-tablist .admin-subtab:last-child {
    flex-basis: 100%;
  }

  .admin-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.5rem !important;
  }

  .admin-stat-card {
    min-height: 82px;
    padding: 0.75rem 0.5rem !important;
  }

  .settings-save-bar {
    flex-wrap: wrap;
  }

  .settings-save-bar .dirty-indicator {
    flex: 1 1 100%;
  }

  .settings-tabs {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .settings-tab {
    flex: 1 1 calc(50% - 0.25rem);
    justify-content: center;
    white-space: normal;
    line-height: 1.2;
  }

  .settings-tab:last-child {
    flex-basis: 100%;
  }
}

@media (min-width: 1024px) {
  #tab-admin,
  #tab-profil,
  #tab-absen,
  #tab-laporan,
  #tab-proyek,
  #tab-riwayat {
    max-width: 1440px;
    margin-inline: auto;
  }

  .admin-tab-card {
    padding: 0.375rem !important;
  }

  .admin-tablist {
    display: flex !important;
    flex-wrap: wrap;
  }

  .admin-tablist .admin-subtab {
    flex: 1 1 9rem;
    white-space: normal;
  }

  .admin-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 1rem !important;
  }

  .admin-stat-card {
    padding: 1rem !important;
  }

  #admin-sub-harian,
  #admin-sub-approval,
  #admin-sub-rekap,
  #admin-sub-personil,
  #admin-sub-settings {
    display: grid;
    gap: 1rem;
  }

  .admin-subcontent.hidden {
    display: none !important;
  }

  .settings-tabs {
    display: flex;
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .settings-tab {
    flex: 1 1 8.5rem;
    justify-content: center;
  }

  .profile-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr) !important;
    gap: 1rem !important;
  }

  .profile-main-card,
  .profile-recap-card {
    padding: 1.25rem !important;
  }
}

#tab-dashboard {
  max-width: 1440px;
  margin-inline: auto;
  width: 100%;
}

#tab-dashboard .dashboard-hero-card {
  overflow: hidden;
}

#tab-dashboard .dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 0.75rem !important;
}

#tab-dashboard .dashboard-stat-card {
  min-height: 92px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#tab-dashboard .dashboard-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 0.875rem !important;
}

#tab-dashboard .dashboard-main-grid > .card {
  min-width: 0;
  overflow: hidden;
}

#tab-dashboard .dashboard-quick-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

#tab-dashboard .dashboard-quick-actions .btn {
  min-width: 0;
  white-space: normal;
  text-align: center;
}

#belum-absen-list {
  min-width: 0;
}

#belum-absen-list > div {
  min-width: 0;
}

#belum-absen-list span {
  min-width: 0;
}

#belum-absen-list span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#attendance-calendar {
  min-width: 0;
}

#attendance-calendar > div:first-child {
  min-width: 0;
}

.dashboard-ops-card {
  min-width: 0;
}

.ops-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.625rem;
}

.ops-metric {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  min-height: 52px;
  padding: 0.75rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), transform var(--transition-fast), background var(--transition-fast);
}

.ops-metric[role="button"] {
  cursor: pointer;
}

.ops-metric[role="button"]:hover,
.ops-metric[role="button"]:focus-visible {
  border-color: var(--accent);
  background: var(--bg-hover);
  transform: translateY(-1px);
  outline: none;
}

.ops-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(200, 150, 62, 0.12);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
}

.ops-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
}

.ops-count {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
}

.ops-success .ops-count,
.ops-success .ops-icon {
  color: var(--success);
}

.ops-warning .ops-count,
.ops-warning .ops-icon {
  color: var(--warning);
}

.ops-danger .ops-count,
.ops-danger .ops-icon {
  color: var(--danger);
}

.admin-quality-card {
  min-width: 0;
}

.quality-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.875rem;
}

.quality-subtitle {
  margin: 0.25rem 0 0;
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.45;
}

.quality-score {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 58px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
}

.quality-score strong {
  color: var(--text-primary);
  font-size: 1.2rem;
  line-height: 1;
}

.quality-score span {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.quality-score.is-clean {
  border-color: rgba(34, 197, 94, 0.28);
}

.quality-score.has-issues {
  border-color: rgba(245, 158, 11, 0.35);
}

.quality-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.625rem;
}

.quality-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  min-height: 68px;
  padding: 0.75rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: inherit;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--transition-fast), transform var(--transition-fast), background var(--transition-fast);
}

.quality-item:hover,
.quality-item:focus-visible {
  border-color: var(--accent);
  background: var(--bg-hover);
  transform: translateY(-1px);
  outline: none;
}

.quality-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(200, 150, 62, 0.12);
  color: var(--accent);
  font-weight: 800;
}

.quality-copy {
  min-width: 0;
}

.quality-copy strong,
.quality-copy small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.quality-copy strong {
  color: var(--text-primary);
  font-size: 0.82rem;
  line-height: 1.25;
}

.quality-copy small {
  margin-top: 0.2rem;
  color: var(--text-secondary);
  font-size: 0.72rem;
  line-height: 1.35;
}

.quality-success .quality-count {
  color: var(--success);
}

.quality-warning .quality-count {
  color: var(--warning);
}

.quality-danger .quality-count {
  color: var(--danger);
}

@media (min-width: 768px) {
  #tab-dashboard .dashboard-stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  #tab-dashboard .dashboard-quick-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1024px) {
  .content-area,
  #main-content {
    overflow-x: clip;
  }

  #tab-dashboard {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
  }

  #tab-dashboard .dashboard-hero-card,
  #tab-dashboard .dashboard-stats-grid,
  #tab-dashboard .dashboard-main-grid {
    margin-bottom: 0 !important;
  }

  #tab-dashboard .dashboard-hero-card {
    grid-column: span 5;
    min-height: 100%;
    padding: 1.125rem !important;
  }

  #tab-dashboard .dashboard-hero-card .time-display {
    font-size: 2.25rem !important;
    margin-bottom: 0.875rem !important;
  }

  #tab-dashboard .dashboard-hero-card .btn {
    min-height: 42px;
    margin-top: 1rem !important;
  }

  #tab-dashboard .dashboard-stats-grid {
    grid-column: span 7;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 1rem !important;
    align-self: stretch;
  }

  #tab-dashboard .desktop-grid.dashboard-stats-grid[style*="grid-template-columns"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #tab-dashboard .dashboard-main-grid {
    grid-column: 1 / -1;
    grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
    gap: 1rem !important;
    align-items: stretch;
  }

  #tab-dashboard .dashboard-activity-card {
    grid-column: span 7;
  }

  #tab-dashboard .dashboard-chart-card {
    grid-column: span 5;
  }

  #tab-dashboard .dashboard-calendar-card {
    grid-column: span 7;
  }

  #tab-dashboard .dashboard-attendance-card {
    grid-column: span 5;
  }

  #tab-dashboard .dashboard-ops-card {
    grid-column: 1 / -1;
  }

  #tab-dashboard .dashboard-main-grid > .card {
    padding: 1.125rem !important;
  }

  #tab-dashboard .dashboard-chart-card [style*="height:220px"] {
    height: 190px !important;
  }

  #tab-dashboard .dashboard-stat-card {
    min-height: 100%;
    padding: 1rem !important;
  }

  #tab-dashboard .dashboard-stat-card .text-eyebrow,
  #tab-dashboard .dashboard-attendance-card .text-eyebrow,
  #tab-dashboard .dashboard-calendar-card .text-eyebrow,
  #tab-dashboard .dashboard-chart-card .text-eyebrow,
  #tab-dashboard .dashboard-activity-card .text-eyebrow,
  #tab-dashboard .dashboard-ops-card .text-eyebrow {
    line-height: 1.25;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 767px) {
  .ops-grid,
  .quality-grid {
    grid-template-columns: 1fr;
  }

  .quality-header {
    align-items: stretch;
  }
}

@media (min-width: 1280px) {
  #tab-dashboard .dashboard-main-grid {
    gap: 1.25rem !important;
  }

  #tab-dashboard .dashboard-main-grid > .card {
    padding: 1.25rem !important;
  }

  #tab-dashboard .dashboard-hero-card {
    grid-column: span 4;
  }

  #tab-dashboard .dashboard-stats-grid {
    grid-column: span 8;
  }

  #tab-dashboard .dashboard-chart-card [style*="height:220px"] {
    height: 210px !important;
  }
}

@media (min-width: 1600px) {
  #tab-dashboard .dashboard-activity-card,
  #tab-dashboard .dashboard-calendar-card {
    grid-column: span 8;
  }

  #tab-dashboard .dashboard-chart-card,
  #tab-dashboard .dashboard-attendance-card {
    grid-column: span 4;
  }
}

/* ============================================================
   END OF STYLESHEET
   ============================================================ */


/* ===== CONFIRM MODAL / DIALOG ===== */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 1.25rem;
  animation: fadeIn 200ms ease;
}

.confirm-box {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  animation: slideUp 250ms ease;
}

.confirm-box h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.confirm-box p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.confirm-box .flex {
  display: flex;
  gap: 0.75rem;
}

.confirm-box button {
  flex: 1;
  min-height: 44px;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.confirm-box button[data-action="cancel"] {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
}

.confirm-box button[data-action="cancel"]:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.confirm-box button[data-action="ok"] {
  background: var(--accent);
  color: #fff;
}

.confirm-box button[data-action="ok"]:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(200, 150, 62, 0.3);
}

.confirm-box button[data-action="ok"]:active {
  transform: translateY(0);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Light mode adjustments */
body.light-mode .confirm-overlay {
  background: rgba(0, 0, 0, 0.5);
}

body.light-mode .confirm-box {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}


/* ===== INDIKATOR KESIAPAN ABSEN (foto + GPS) ===== */
.absen-readiness {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.875rem;
}

.readiness-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.readiness-item .readiness-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}

.readiness-item.ready {
  background: var(--success-subtle);
  border-color: var(--success);
  color: var(--success);
}

.readiness-item.ready .readiness-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-subtle);
}

/* Tombol absen yang ter-disable: jelas tidak bisa diklik */
#btn-absen-masuk:disabled,
#btn-absen-pulang:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.3);
}
