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

/* ─── CSS Variables — Light mode ─────────────────────────────────────────── */
:root {
  /* Brand palette */
  --graphite: #333333;
  --blue: #005AF6;
  --red: #FC0100;
  --yellow: #FFD100;
  --stone: #F7F7F7;
  --cement: #999999;
  --white: #ffffff;
  --border: #e2e2e2;

  /* Layout */
  --sidebar-width: 230px;

  /* Semantic aliases — light */
  --bg: #F7F7F7;
  --surface: #ffffff;
  --surface-2: #f0f0f0;
  --text: #333333;
  --text-muted: #999999;
  --border-color: #e2e2e2;
  --input-bg: #ffffff;
  --sidebar-bg: #222222;
  --sidebar-text: rgba(255,255,255,0.5);
  --sidebar-text-active: #ffffff;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.16);
}

/* ─── Dark mode — media query ─────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-2: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --input-bg: #1e293b;
    --sidebar-bg: #0a0f1e;
    --sidebar-text: rgba(255,255,255,0.45);
    --sidebar-text-active: #ffffff;
    --white: #1e293b;
    --stone: #0f172a;
    --shadow: 0 2px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 48px rgba(0,0,0,0.6);
    --border: #334155;
  }
}

/* ─── Dark mode — explicit attribute (overrides media query) ──────────────── */
[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --input-bg: #1e293b;
  --sidebar-bg: #0a0f1e;
  --sidebar-text: rgba(255,255,255,0.45);
  --sidebar-text-active: #ffffff;
  --white: #1e293b;
  --stone: #0f172a;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.6);
  --border: #334155;
}

/* ─── Light mode — explicit attribute overrides media query back to light ──── */
[data-theme="light"] {
  --bg: #F7F7F7;
  --surface: #ffffff;
  --surface-2: #f0f0f0;
  --text: #333333;
  --text-muted: #999999;
  --border-color: #e2e2e2;
  --input-bg: #ffffff;
  --sidebar-bg: #222222;
  --sidebar-text: rgba(255,255,255,0.5);
  --sidebar-text-active: #ffffff;
  --white: #ffffff;
  --stone: #F7F7F7;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.16);
  --border: #e2e2e2;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Body ───────────────────────────────────────────────────────────────── */
body {
  font-family: 'Kumbh Sans', 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Prevent body scroll when mobile sidebar is open */
body.sidebar-open {
  overflow: hidden;
}

/* ─── Auth pages ─────────────────────────────────────────────────────────── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--graphite);
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.07) 1px, transparent 1px);
  background-size: 24px 24px;
}

.auth-card {
  background: var(--surface);
  border-radius: 10px;
  padding: 44px 40px;
  width: 420px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.32);
}

/* Brand mark — three shapes */
.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.brand-mark .shape-circle {
  width: 18px; height: 18px;
  background: var(--blue);
  border-radius: 50%;
}

.brand-mark .shape-triangle {
  width: 0; height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 18px solid var(--yellow);
}

.brand-mark .shape-square {
  width: 18px; height: 18px;
  background: var(--red);
}

.auth-card .logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-card .logo h1 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.auth-card .logo p {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 4px;
}

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--input-bg);
  transition: border-color 0.15s;
  outline: none;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--blue);
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
  letter-spacing: 0.2px;
}

.btn:hover { opacity: 0.88; }
.btn:active { opacity: 0.75; transform: scale(0.98); }

.btn-primary { background: var(--blue); color: #ffffff; width: 100%; padding: 12px; font-size: 14px; letter-spacing: 0.5px; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1.5px solid var(--border-color); }
.btn-danger { background: var(--red); color: #ffffff; }
.btn-sm { padding: 6px 14px; font-size: 12px; }

.error-msg {
  color: var(--red);
  font-size: 12px;
  margin-top: 10px;
  text-align: center;
  min-height: 20px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--blue);
  cursor: pointer;
  font-size: 13px;
  text-decoration: underline;
  padding: 0;
  font-family: inherit;
}

/* ─── App layout ─────────────────────────────────────────────────────────── */
.app-layout { display: flex; height: 100vh; overflow: hidden; }

/* ─── Mobile menu button ─────────────────────────────────────────────────── */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 44px;
  height: 44px;
  z-index: 201;
  background: var(--sidebar-bg);
  color: #ffffff;
  border: none;
  border-radius: 0 0 8px 0;
  font-size: 18px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

/* ─── Sidebar overlay (mobile) ───────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
}

body.sidebar-open .sidebar-overlay {
  display: block;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-logo {
  padding: 22px 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-logo .sidebar-shapes {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.sidebar-logo .s-circle {
  width: 10px; height: 10px;
  background: var(--blue);
  border-radius: 50%;
}

.sidebar-logo .s-triangle {
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 10px solid var(--yellow);
}

.sidebar-logo .s-square {
  width: 10px; height: 10px;
  background: var(--red);
}

.sidebar-logo h1 {
  font-size: 11px;
  font-weight: 700;
  color: var(--sidebar-text-active);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  line-height: 1.4;
}

.sidebar-logo h1 span { color: var(--blue); }

.sidebar-logo p {
  font-size: 9px;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 3px;
}

.sidebar-nav { flex: 1; padding: 10px 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  user-select: none;
}

.nav-item:hover { color: var(--sidebar-text-active); background: rgba(255,255,255,0.04); }
.nav-item.active { color: var(--sidebar-text-active); border-left-color: var(--blue); background: rgba(0,90,246,0.10); }
.nav-item .icon { width: 16px; text-align: center; font-size: 14px; }

/* ─── Theme toggle button ────────────────────────────────────────────────── */
.theme-toggle-btn {
  display: block;
  width: 100%;
  padding: 10px 18px;
  background: none;
  border: none;
  color: var(--sidebar-text);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}

.theme-toggle-btn:hover {
  color: var(--sidebar-text-active);
}

.sidebar-user {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.sidebar-user .name { font-size: 13px; font-weight: 700; color: var(--sidebar-text-active); }
.sidebar-user .role { font-size: 10px; color: rgba(255,255,255,0.35); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.8px; }
.sidebar-user .logout-btn {
  background: none; border: none; color: rgba(255,255,255,0.3);
  font-size: 11px; cursor: pointer; margin-top: 8px; padding: 0;
  font-family: inherit; text-decoration: underline;
}
.sidebar-user .logout-btn:hover { color: var(--sidebar-text-active); }

/* ─── Main content ───────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 30px 36px;
}

.page-title {
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.page-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 28px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border-color);
  padding: 24px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

/* ─── Stat grid ──────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

/* ─── Week nav ───────────────────────────────────────────────────────────── */
.week-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.week-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  min-width: 180px;
  text-align: center;
  letter-spacing: 0.2px;
}

/* ─── Graph ──────────────────────────────────────────────────────────────── */
.graph-wrap { position: relative; height: 380px; }

/* ─── Entry table ────────────────────────────────────────────────────────── */
.entry-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 13px;
}

.entry-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
}

.entry-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
}

.entry-table td input {
  width: 80px;
  padding: 5px 8px;
  border: 1.5px solid var(--border-color);
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  color: var(--text);
  background: var(--input-bg);
}

.entry-table td input:focus { border-color: var(--blue); }
.entry-table td input:disabled { background: var(--surface-2); color: var(--text-muted); }

.today-row td { background: rgba(0,90,246,0.04); font-weight: 700; }

/* ─── Data table ─────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
  background: var(--surface-2);
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.data-table tr:hover td { background: var(--surface-2); }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.badge-pending  { background: #fff3cd; color: #856404; }
.badge-approved { background: #d1e7dd; color: #0a3622; }
.badge-employee { background: #e8f0fe; color: #1a3c8f; }
.badge-manager  { background: #fde8f0; color: #8f1a4a; }
.badge-executive{ background: #e8f5e9; color: #1b5e20; }
.badge-admin    { background: #f3e8fd; color: #4a1a8f; }

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: 12px;
  padding: 36px;
  width: 440px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.22);
}

.modal h2 { font-size: 18px; font-weight: 900; margin-bottom: 20px; letter-spacing: -0.3px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ─── Pending banner ─────────────────────────────────────────────────────── */
.pending-banner {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 8px;
  padding: 20px 24px;
  text-align: center;
}
.pending-banner h2 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.pending-banner p { font-size: 13px; color: var(--cement); }

/* ─── Divider ────────────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border-color); margin: 20px 0; }

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
.main-content::-webkit-scrollbar { width: 5px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

/* ─── Touch targets ──────────────────────────────────────────────────────── */
@media (pointer: coarse) {
  button, .nav-item, .btn { min-height: 44px; }
}

/* ─── Responsive: Mobile (max 767px) ─────────────────────────────────────── */
@media (max-width: 767px) {
  .mobile-menu-btn {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 260px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .main-content {
    padding: 20px 16px;
  }

  .modal {
    width: calc(100% - 32px);
    max-width: 440px;
    margin: 16px;
    padding: 24px 20px;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .page-title {
    font-size: 20px;
  }
}

/* ─── Responsive: Tablet (768px – 1023px) ────────────────────────────────── */
@media (min-width: 768px) and (max-width: 1023px) {
  :root {
    --sidebar-width: 200px;
  }

  .sidebar {
    width: 200px;
  }

  .main-content {
    padding: 24px 24px;
  }

  .stat-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .modal {
    width: 90%;
    max-width: 440px;
  }
}

/* ─── Responsive: Desktop (1024px+) ──────────────────────────────────────── */
@media (min-width: 1024px) {
  .mobile-menu-btn {
    display: none;
  }
}
