@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg:           #f0f4ff;
  --surface:      #ffffff;
  --surface2:     #f8faff;
  --line:         #e2e8f0;
  --text:         #111827;
  --muted:        #6b7280;
  --primary:      #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --success:      #16a34a;
  --success-soft: #ecfdf5;
  --danger:       #dc2626;
  --danger-soft:  #fef2f2;
  --warning:      #d97706;
  --warning-soft: #fffbeb;
  --holiday:      #7c3aed;
  --holiday-soft: #f5f3ff;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow: 0 2px 12px rgba(15,23,42,0.06);
  --shadow-lg: 0 8px 40px rgba(15,23,42,0.12);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tap-min: 48px;
  --nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
html, body {
  width: 100%; overflow-x: hidden;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif !important;
  background: var(--bg) !important;
  color: var(--text) !important;
  font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body { min-height: 100dvh; background: var(--bg) !important; }
.hidden { display: none !important; }
.loading { opacity: 0.6; pointer-events: none; }
.muted { color: var(--muted); font-size: 14px; font-weight: 500; }
.mt-12 { margin-top: 12px; }
.small-note { font-size: 13px; font-weight: 500; color: var(--muted); margin-top: 8px; line-height: 1.4; }

.session-restore {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, rgba(219,234,254,0.98) 0%, rgba(237,233,254,0.98) 50%, rgba(240,244,255,0.98) 100%);
}
.session-restore-card {
  width: min(100%, 320px);
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(226,232,240,0.9);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 28px 22px;
  text-align: center;
  backdrop-filter: blur(8px);
}
.session-restore-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 4px solid rgba(37,99,235,0.16);
  border-top-color: var(--primary);
  animation: session-spin 0.85s linear infinite;
}
.session-restore-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.session-restore-sub {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}
@keyframes session-spin {
  to { transform: rotate(360deg); }
}

/* LOGIN */
.login-wrap {
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: stretch; justify-content: center;
  padding: calc(20px + var(--safe-top)) 16px calc(20px + var(--safe-bottom));
  background: linear-gradient(160deg, #dbeafe 0%, #ede9fe 50%, #f0f4ff 100%) !important;
  position: relative; overflow: hidden;
}
.login-lang { position: absolute; top: calc(14px + var(--safe-top)); right: 14px; z-index: 2; }
.lang-select {
  background: white; border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 10px 14px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  outline: none; -webkit-appearance: none; appearance: none;
  min-height: var(--tap-min); font-family: inherit;
  box-shadow: var(--shadow);
}
.login-card {
  width: 100%; background: white;
  border: 1px solid var(--line); border-radius: 24px;
  padding: 28px 20px 22px; box-shadow: var(--shadow-lg);
  position: relative; z-index: 1;
}
.login-logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 26px; font-weight: 700;
  margin: 0 auto 18px;
  box-shadow: 0 12px 28px rgba(37,99,235,0.3);
}
.login-title {
  font-size: 22px; font-weight: 700; text-align: center;
  margin-bottom: 6px; letter-spacing: -0.02em; color: var(--text);
}
.login-sub {
  font-size: 14px; font-weight: 500; color: var(--muted);
  text-align: center; margin-bottom: 24px; line-height: 1.5;
}

/* APP SHELL */
.app {
  min-height: 100dvh; width: 100%; max-width: 480px; margin: 0 auto;
  display: flex; flex-direction: column; background: var(--bg);
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom));
}

/* HEADER */
.app-header {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  padding: calc(12px + var(--safe-top)) 14px 16px;
  color: white; position: sticky; top: 0; z-index: 40;
  overflow: visible;
}
.app-header::after { display: none; }
.header-top {
  display: flex; justify-content: space-between;
  align-items: center; gap: 8px; margin-bottom: 4px;
}
.header-logo {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.25);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 15px; font-weight: 700;
}
.header-actions { display: flex; gap: 6px; align-items: center; }
.lang-select-dark {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: white; border-radius: 8px; padding: 0 10px;
  font-size: 12px; font-weight: 700; cursor: pointer;
  outline: none; -webkit-appearance: none; appearance: none;
  min-height: 34px; font-family: inherit;
}
.lang-select-dark option { color: #111; background: white; }
.btn-logout {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: white; border-radius: 8px;
  padding: 0 12px; font-size: 13px; font-weight: 600;
  cursor: pointer; min-height: 34px; font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.header-welcome {
  font-size: 16px; font-weight: 700; color: white;
  letter-spacing: -0.01em; line-height: 1.2;
}
.header-meta { font-size: 11px; color: rgba(255,255,255,0.75); margin-top: 1px; }
.header-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.header-chip {
  appearance: none;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 999px; padding: 3px 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px; font-weight: 600; color: white;
}
.header-chip.active {
  background: rgba(255,255,255,0.98);
  border-color: rgba(255,255,255,0.98);
  color: #4f46e5;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.16);
}
.header-task-flag {
  position: absolute;
  right: 14px;
  bottom: 12px;
  border: 1px solid rgba(127, 29, 29, 0.28);
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff7f7;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 8px 18px rgba(127,29,29,0.28);
}

/* ENV BANNER */
.env-banner {
  margin: 8px 12px; padding: 9px 12px; border-radius: var(--radius-xs);
  background: var(--primary-soft); color: var(--primary);
  font-size: 12px; font-weight: 500;
  border: 1px solid rgba(37,99,235,0.2); display: none;
}
.env-banner.show { display: block; }

/* CONTENT */
.content { padding: 10px 12px 0; }

/* CARDS */
.card {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 10px;
  overflow: hidden; border: 1px solid var(--line);
}
.card-header { padding: 14px 14px 0; }
.card-title { font-size: 16px; font-weight: 700; color: var(--text); }
.card-sub { font-size: 13px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.card-body { padding: 12px 14px 14px; }
.section-head { display: flex; flex-direction: column; gap: 10px; padding: 14px 14px 0; }

/* CLOCK HERO */
.clock-hero {
  text-align: center; padding: 18px 16px 20px;
  background: white !important; border-radius: var(--radius);
  margin: 10px 12px 0; border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.clock-time {
  font-size: 64px; font-weight: 700;
  letter-spacing: -0.04em; color: #111827 !important;
  line-height: 1; font-variant-numeric: tabular-nums;
  opacity: 1 !important;
}
.clock-date { font-size: 13px; color: #6b7280 !important; margin-top: 4px; font-weight: 500; opacity: 1 !important; }

/* FORMS */
.form-group { margin-bottom: 14px; }
.form-group.is-hidden { display: none; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
input[type="text"], input[type="date"], input[type="time"], select, #correctionNotes {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface2); font-size: 16px; outline: none; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none; appearance: none;
  min-height: var(--tap-min); font-family: inherit;
}
#correctionNotes { min-height: 120px; line-height: 1.45; resize: vertical; }
input:focus, select:focus, #correctionNotes:focus {
  border-color: var(--primary); background: white;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* BUTTONS */
.btn {
  border: none; border-radius: var(--radius-sm);
  padding: 0 16px; font-size: 15px; font-weight: 700; cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
  display: flex; align-items: center; justify-content: center;
  gap: 6px; width: 100%; min-height: var(--tap-min);
  -webkit-tap-highlight-color: transparent;
  letter-spacing: -0.01em; font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1.5px solid var(--line); }
.btn-success { background: var(--success-soft); color: var(--success); border: 1.5px solid rgba(22,163,74,0.2); }
.btn-success:hover:not(:disabled) { background: #dcfce7; }
.btn-full { width: 100%; }

/* MESSAGES */
.message {
  padding: 11px 14px; border-radius: var(--radius-xs);
  font-size: 13px; font-weight: 500; line-height: 1.4;
  margin-top: 10px; display: none;
}
.message.show { display: block; }
.message.error { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(220,38,38,0.15); }
.message.success { background: var(--success-soft); color: var(--success); border: 1px solid rgba(22,163,74,0.15); }

/* ATTENDANCE */
.attendance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.punch-card {
  background: var(--surface2); border-radius: var(--radius-sm);
  padding: 14px 12px; border: 1px solid var(--line);
}
.punch-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 10px; }
.punch-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; gap: 4px; }
.punch-type { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.punch-time { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.punch-date { font-size: 10px; color: var(--muted); margin-top: 6px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.task-reminder {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid #fdba74;
  background: linear-gradient(135deg, #fff7ed 0%, #fffbeb 100%);
  color: #9a3412;
}
.task-reminder-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.task-reminder-text {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
.task-reminder-list {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.task-reminder-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(154,52,18,0.16);
  font-size: 12px;
  font-weight: 700;
  color: #9a3412;
}

/* STATS */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 4px; }
.stat-item { background: var(--surface2); border-radius: var(--radius-sm); padding: 12px; border: 1px solid var(--line); }
.stat-label { font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; line-height: 1; }
.stat-sub { font-size: 10px; color: var(--muted); margin-top: 3px; line-height: 1.3; }

/* MONTH NAV */
.month-nav { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 6px; width: 100%; }
.month-nav-btn {
  width: 40px; height: 40px; border: 1px solid var(--line);
  background: white; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px; color: var(--text);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s; font-family: inherit; box-shadow: var(--shadow);
}
.month-nav-btn:active { transform: scale(0.93); }
.month-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.month-nav-label {
  text-align: center; font-size: 14px; font-weight: 600; color: var(--text);
  background: white; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 0 12px; height: 40px; display: flex; align-items: center;
  justify-content: center; box-shadow: var(--shadow);
}

/* CALENDAR */
.calendar-shell {
  background: white; border-radius: var(--radius-sm);
  overflow-x: auto; overflow-y: hidden;
  border: 1px solid var(--line); margin-top: 12px; width: 100%;
  overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow);
}
.calendar-track { width: max(100%, 560px); }
.calendar-weekdays {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  width: 100%; background: var(--surface2); border-bottom: 1px solid var(--line);
}
.calendar-weekdays div {
  text-align: center; padding: 8px 2px;
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted);
}
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); width: 100%; }
.calendar-day {
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 24px 0 0; min-height: 90px; background: white;
  position: relative; overflow: hidden;
}
.calendar-day:nth-child(7n) { border-right: none; }
.calendar-day.empty { background: var(--surface2); }
.calendar-day.today .calendar-day-number { background: var(--primary); color: white; border-radius: 999px; }
.calendar-day-number {
  position: absolute; top: 5px; left: 5px;
  font-size: 9px; font-weight: 600; width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  z-index: 2; color: var(--muted);
}
.calendar-task-dot {
  position: absolute; top: 10px; right: 8px;
  width: 8px; height: 8px; border-radius: 999px;
  box-shadow: 0 0 0 2px white; z-index: 3;
}
.calendar-task-dot.pending { background: var(--danger); }
.calendar-task-dot.done    { background: var(--success); }
.shift-card {
  display: flex; flex-direction: column;
  width: auto; max-width: calc(100% - 6px);
  margin: 3px 3px 0; border-radius: 7px; padding: 4px 5px;
  font-size: 8px; position: relative; z-index: 1;
  font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.03em; line-height: 1.2;
  border: 1px solid; min-height: 52px; overflow: hidden;
}
.shift-work         { background: #fefce8; color: #92400e; border-color: #fde68a; }
.shift-work-ontime  { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.shift-work-late    { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.shift-off          { background: var(--surface2); color: var(--muted); border-color: var(--line); }
.shift-holiday      { background: #f5f3ff; color: #5b21b6; border-color: #ddd6fe; }
.shift-sick         { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.shift-attended-check {
  position: absolute;
  top: 4px;
  right: 5px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: currentColor;
  opacity: 0.92;
}
.shift-status { font-size: 8px; overflow-wrap: anywhere; }
.shift-probation-name { margin-top: 2px; font-size: 8px; font-weight: 800; text-transform: none; letter-spacing: 0; overflow-wrap: anywhere; }
.shift-time-small { font-size: 9px; font-weight: 700; margin-top: 3px; overflow-wrap: anywhere; }
.shift-time-actual { font-size: 8px; font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; opacity: 0.88; }
.shift-location { margin-top: 2px; font-size: 8px; font-weight: 500; text-transform: none; overflow-wrap: anywhere; opacity: 0.8; line-height: 1.2; }
.calendar-legend {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface2);
}
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); font-weight: 600; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; border: 1px solid transparent; flex-shrink: 0; }
.dot-work    { background: #fde68a; border-color: #f59e0b; }
.dot-off     { background: var(--surface2); border-color: var(--line); }
.dot-holiday { background: #ddd6fe; border-color: #a78bfa; }
.dot-sick    { background: #fecaca; border-color: #f87171; }

/* REQUESTS */
.request-list { display: grid; gap: 8px; }
.request-item { background: white; border-radius: var(--radius-sm); padding: 14px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.request-item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.request-dates { font-size: 14px; font-weight: 600; color: var(--text); }
.request-loc { font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 2px; }

.team-day-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.team-member-card {
  background: rgba(248, 250, 255, 0.9);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 14px;
  padding: 10px 11px;
  min-width: 0;
}
.team-member-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.team-member-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  margin-top: 6px;
}
.team-member-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  word-break: break-word;
}
.team-member-check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  border: 1px solid rgba(22, 163, 74, 0.18);
  box-shadow: none;
  margin-top: 1px;
}
.team-member-check.clocked-out {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.16);
}
.team-member-role {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  line-height: 1.2;
}
.team-member-time {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  line-height: 1.2;
}

@media (max-width: 360px) {
  .team-day-grid { grid-template-columns: 1fr; }
}

/* PILLS */
.pill {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.03em;
  white-space: nowrap; border: 1px solid transparent; flex-shrink: 0;
}
.pill-pending  { background: var(--warning-soft);  color: #92400e; border-color: #fde68a; }
.pill-approved { background: var(--success-soft);  color: #166534; border-color: #bbf7d0; }
.pill-rejected { background: var(--danger-soft);   color: #991b1b; border-color: #fecaca; }
.pill-type     { background: var(--surface2); color: var(--muted); border-color: var(--line); }
.pill-open     { background: var(--warning-soft);  color: #92400e; border-color: #fde68a; }
.pill-done     { background: var(--success-soft);  color: #166534; border-color: #bbf7d0; }
.pill-cancelled{ background: var(--surface2); color: var(--muted); border-color: var(--line); }

/* EMPTY STATES */
.empty-state { text-align: center; padding: 28px 20px; color: var(--muted); }
.empty-icon  { font-size: 32px; margin-bottom: 10px; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.empty-sub   { font-size: 14px; font-weight: 500; color: var(--muted); }

/* ATTENDANCE BUTTONS */
.attendance-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.btn-attendance-correction {
  background: var(--primary-soft); border: 1px solid rgba(37,99,235,0.2);
  color: var(--primary); border-radius: 999px; padding: 8px 14px;
  min-height: 36px; font-size: 12px; font-weight: 700;
  white-space: nowrap; cursor: pointer; font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.requests-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.btn-new-request {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--primary); color: white; border: none;
  border-radius: 9px; padding: 7px 13px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  white-space: nowrap; flex-shrink: 0; min-height: 36px;
  -webkit-tap-highlight-color: transparent; font-family: inherit;
}
.btn-new-request:hover { background: var(--primary-dark); }
.task-complete-btn { min-height: 38px; font-size: 13px; border-radius: 9px; }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; pointer-events: none;
  padding: 16px;
  transition: opacity 0.25s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-sheet {
  background: white; border: 1px solid var(--line);
  border-radius: 22px;
  width: 100%; max-width: 460px;
  max-height: 92dvh; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 0 24px;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.25s ease;
  box-shadow: var(--shadow-lg);
}
.modal-overlay.open .modal-sheet { transform: translateY(0) scale(1); }
.modal-handle { display: none; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 0; margin-bottom: 14px; }
.modal-title { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.modal-close-btn {
  width: 32px; height: 32px; border: none;
  background: var(--surface2); border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; color: var(--muted);
  border: 1px solid var(--line); -webkit-tap-highlight-color: transparent;
}
.modal-body { padding: 0 20px; }

@media (max-width: 520px) {
  .modal-overlay { padding: 12px; }
  .modal-sheet {
    max-width: 100%;
    max-height: 94dvh;
  }
  .header-task-flag {
    right: 12px;
    bottom: 10px;
  }
}

/* BOTTOM NAV */
.mobile-bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  background: white; border-top: 1px solid var(--line);
  display: flex; padding-bottom: var(--safe-bottom);
  z-index: 9999; box-shadow: 0 -4px 20px rgba(15,23,42,0.08);
}
.mobile-nav-tab {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; background: none; border: none;
  cursor: pointer; padding: 8px 4px; color: #9ca3af;
  position: relative; transition: color 0.15s; font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-tab.active { color: var(--primary); }
.mobile-nav-tab.active::before {
  content: ''; position: absolute; top: 0; left: 50%;
  transform: translateX(-50%); width: 28px; height: 2px;
  background: var(--primary); border-radius: 0 0 3px 3px;
}
.mobile-nav-tab svg { display: block; }
.mobile-nav-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.section-hidden { display: none !important; }

@media (max-width: 480px) {
  .app { max-width: 100%; }
  .content { padding: 8px 10px 0; }
  .card { border-radius: 14px; }
  .card-header { padding: 12px 12px 0; }
  .card-body { padding: 10px 12px 12px; }
  .section-head { padding: 12px 12px 0; }
  .punch-time { font-size: 18px; }
  .clock-time { font-size: 56px; }
  .clock-hero { margin: 8px 10px 0; }
}
@media (min-width: 600px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .calendar-track { width: max(100%, 640px); }
  .calendar-day { min-height: 100px; }
}
:focus-visible { outline: 3px solid rgba(37,99,235,0.3); outline-offset: 2px; }

/* ── TARGETED FIXES ── */
#mClock, #mLiveClock, .clock-time {
  color: #111827 !important;
  -webkit-text-fill-color: #111827 !important;
  opacity: 1 !important;
  font-weight: 700 !important;
}
#mDate, #mLiveDate, .clock-date {
  color: #6b7280 !important;
  -webkit-text-fill-color: #6b7280 !important;
  opacity: 1 !important;
}
/* Clock In green, Clock Out grey */
#clockInBtn {
  background: #ecfdf5 !important;
  color: #16a34a !important;
  border: 1.5px solid rgba(22,163,74,0.2) !important;
}
#clockOutBtn {
  background: #f8faff !important;
  color: #374151 !important;
  border: 1.5px solid #e2e8f0 !important;
}

/* ── Hide nav on login, show only when dashboard visible ── */
#mobileNav { display: none !important; }
#dashboardView:not(.hidden) ~ #mobileNav,
body:has(#dashboardView:not(.hidden)) #mobileNav { display: flex !important; }

/* ── Clock In = solid green, Clock Out = solid grey ── */
#clockInBtn {
  background: #16a34a !important;
  color: white !important;
  border: none !important;
  opacity: 1 !important;
}
#clockInBtn:disabled { opacity: 0.45 !important; }

#clockOutBtn {
  background: #6b7280 !important;
  color: white !important;
  border: none !important;
  opacity: 1 !important;
}
#clockOutBtn:disabled { opacity: 0.45 !important; }

/* ── FINAL BUTTON FIX ── */
button#clockInBtn,
#clockInBtn,
.btn#clockInBtn {
  background: #16a34a !important;
  color: #ffffff !important;
  border: none !important;
  opacity: 1 !important;
  -webkit-text-fill-color: #ffffff !important;
}
button#clockOutBtn,
#clockOutBtn,
.btn#clockOutBtn {
  background: #4b5563 !important;
  color: #ffffff !important;
  border: none !important;
  opacity: 1 !important;
  -webkit-text-fill-color: #ffffff !important;
}
button#clockInBtn:disabled,
button#clockOutBtn:disabled {
  opacity: 0.4 !important;
}

/* ── Rounded header ── */
.app-header {
  border-radius: 0 0 24px 24px !important;
  overflow: hidden !important;
}

/* ── Match the colorful icon nav style ── */
#mobileNav {
  background: white !important;
  border-top: 1px solid #e2e8f0 !important;
  height: calc(72px + env(safe-area-inset-bottom,0px)) !important;
}
.mobile-nav-tab, #mobileNav button {
  color: #9ca3af !important;
  gap: 4px !important;
}
.mobile-nav-tab.active, #mobileNav button.active {
  color: #2563eb !important;
}
/* Make nav icons bigger and colorful when active */
.mobile-nav-tab.active svg, #mobileNav button.active svg {
  color: #2563eb !important;
  stroke: #2563eb !important;
}
.mobile-nav-tab svg, #mobileNav button svg {
  width: 26px !important;
  height: 26px !important;
}
.mobile-nav-label, #mobileNav button span {
  font-size: 10px !important;
  font-weight: 600 !important;
  text-transform: capitalize !important;
  letter-spacing: 0 !important;
}
