/* ============================================================
   Doittools Attendance Dashboard — Design System
   ============================================================ */

:root {
  /* Brand palette */
  --primary: #4F46E5;        /* indigo-600 */
  --primary-dark: #4338CA;
  --primary-light: #818CF8;
  --primary-50: #EEF2FF;
  --accent: #06B6D4;          /* cyan-500 */
  --accent-dark: #0E7490;

  /* Neutrals */
  --bg: #F7F8FA;
  --bg-muted: #F1F2F6;
  --card: #FFFFFF;
  --border: #E5E7EB;
  --border-strong: #D1D5DB;
  --text: #111827;
  --text-secondary: #4B5563;
  --text-muted: #6B7280;
  --text-faint: #9CA3AF;

  /* Status */
  --success: #059669;
  --success-bg: #ECFDF5;
  --warning: #D97706;
  --warning-bg: #FFFBEB;
  --error: #DC2626;
  --error-bg: #FEF2F2;
  --info: #0284C7;
  --info-bg: #F0F9FF;

  /* Layout */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 10px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-focus: 0 0 0 4px rgba(79, 70, 229, 0.15);

  --sidebar-w: 256px;
}

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

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app { min-height: 100vh; }

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

code {
  font-family: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, 'Courier New', monospace;
  font-size: 0.85em;
  background: var(--bg-muted);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  color: var(--text-secondary);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ============================================================
   Shell layout
   ============================================================ */
.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #FFFFFF 0%, #FAFAFC 100%);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  font-size: 1.35rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}
.sidebar-brand span {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 0.25rem;
  -webkit-text-fill-color: var(--text-muted);
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.sidebar nav a {
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.93rem;
  font-weight: 500;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.sidebar nav a:hover {
  background: var(--bg);
  color: var(--text);
}
.sidebar nav a.active {
  background: var(--primary-50);
  color: var(--primary-dark);
  font-weight: 600;
}

.sidebar-user {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.sidebar-user b {
  color: var(--text);
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
}
.sidebar-user .role-badge {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0.15rem 0.55rem;
  border-radius: 8px;
  background: var(--bg-muted);
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.sidebar-user button {
  margin-top: 0.75rem;
  background: none;
  border: 1px solid var(--border);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s ease;
  width: 100%;
}
.sidebar-user button:hover {
  background: var(--error-bg);
  color: var(--error);
  border-color: var(--error);
}

.main {
  flex: 1;
  padding: 2rem 2.5rem;
  overflow-y: auto;
  max-width: 100%;
  min-width: 0;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.main-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.main-header .actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.back-link {
  font-size: 0.95rem;
  color: var(--text-muted) !important;
  font-weight: 500;
}
.back-link:hover { color: var(--primary) !important; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

/* Stats */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat {
  background: var(--card);
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: linear-gradient(180deg, var(--primary) 0%, var(--accent) 100%);
}
.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}
.stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.stat-sub {
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-top: 0.25rem;
}

/* ============================================================
   Forms
   ============================================================ */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-secondary);
}
.form-group input,
.form-group select,
.form-group textarea,
input[type="text"],
input[type="tel"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="month"] {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  transition: all 0.15s ease;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}
.form-group input:disabled,
.form-group select:disabled {
  background: var(--bg-muted);
  color: var(--text-muted);
  cursor: not-allowed;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.help {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Search input */
.search-wrap {
  position: relative;
}
.search-wrap .search-icon {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}
.search-wrap input {
  padding-left: 2.5rem !important;
  font-size: 1rem !important;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  background: var(--primary);
  color: white;
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.1);
}
.btn:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}
.btn:active { transform: translateY(0); }
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
}
.btn-secondary {
  background: var(--card);
  color: var(--text-secondary);
  border-color: var(--border-strong);
  box-shadow: none;
}
.btn-secondary:hover {
  background: var(--primary-50);
  color: var(--primary-dark);
  border-color: var(--primary);
}
.btn-secondary.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn-danger {
  background: var(--error);
  border-color: var(--error);
  box-shadow: 0 1px 2px rgba(220, 38, 38, 0.1);
}
.btn-danger:hover {
  background: #B91C1C;
  border-color: #B91C1C;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}
.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

/* ============================================================
   Tables
   ============================================================ */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}
th {
  text-align: left;
  padding: 0.65rem 0.85rem;
  background: var(--bg-muted);
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
th:first-child { border-top-left-radius: var(--radius-sm); }
th:last-child { border-top-right-radius: var(--radius-sm); }
td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s ease; }
tbody tr:hover td { background: var(--bg); }
tbody tr[onclick] { cursor: pointer; }
tbody tr[onclick]:hover td { background: var(--primary-50); }

td.right, th.right { text-align: right; }
td.center, th.center { text-align: center; }
td.nowrap, th.nowrap { white-space: nowrap; }
td.code-cell {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.right-actions {
  text-align: right;
  white-space: nowrap;
}
.row-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-error   { background: var(--error-bg);   color: var(--error); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-muted   { background: var(--bg-muted);   color: var(--text-muted); }

/* ============================================================
   Login
   ============================================================ */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}
.login-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,0.1) 0%, transparent 50%);
}
.login-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 2.75rem;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  position: relative;
  z-index: 1;
}
.login-card h1 {
  font-size: 1.85rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}
.login-card .tagline {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}
.login-card .btn {
  width: 100%;
  padding: 0.85rem;
  font-size: 1rem;
}
.login-card .step-back {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.88rem;
  margin-top: 1rem;
  padding: 0.5rem;
  width: 100%;
  font-weight: 500;
}
.login-card .step-back:hover { color: var(--primary-dark); }

/* ============================================================
   Alerts
   ============================================================ */
.alert {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.92rem;
  border: 1px solid;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: #A7F3D0;
}
.alert-error {
  background: var(--error-bg);
  color: var(--error);
  border-color: #FECACA;
}
.alert-info {
  background: var(--info-bg);
  color: var(--info);
  border-color: #BAE6FD;
}
.alert-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: #FDE68A;
}

/* ============================================================
   Loading + empty states
   ============================================================ */
.loading {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
}
.empty-state h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--text);
  font-weight: 600;
}
.empty-state p { color: var(--text-muted); font-size: 0.9rem; }
.empty-state-mini {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ============================================================
   Tabs
   ============================================================ */
.tab-bar {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab-btn {
  padding: 0.5rem 1rem !important;
  font-size: 0.9rem !important;
}

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.15s ease;
}
.modal-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  max-width: 500px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ============================================================
   Utilities
   ============================================================ */
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* Sticky-first-col table (used in attendance grid) */
.sticky-col table { min-width: 100%; }
.sticky-col th:first-child,
.sticky-col td:first-child {
  position: sticky;
  left: 0;
  background: var(--card);
  z-index: 1;
}
.sticky-col tbody tr:hover td:first-child { background: var(--bg); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding: 1rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 1rem;
    padding-top: 1rem;
    overflow-x: auto;
  }
  .sidebar nav a { white-space: nowrap; font-size: 0.85rem; padding: 0.5rem 0.7rem; }
  .sidebar-user {
    margin-top: 1rem;
    padding-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }
  .sidebar-user button { width: auto; margin-top: 0; }
  .main { padding: 1rem; }
  .form-row { grid-template-columns: 1fr; }
  .main-header h1 { font-size: 1.3rem; }
}

@media (max-width: 600px) {
  .card { padding: 1rem; }
  table { font-size: 0.85rem; }
  th, td { padding: 0.5rem 0.6rem; }
}


/* Sidebar nav sections */
.nav-section { margin-bottom: 1.25rem; }
.nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 0 0.9rem;
  margin-bottom: 0.4rem;
  margin-top: 0.5rem;
}
.nav-section:first-child .nav-section-title { margin-top: 0; }

/* ============================================================
   Landing page (logged-out)
   ============================================================ */
.landing {
  background: #ffffff;
  color: var(--text);
  min-height: 100vh;
}

/* Nav bar */
.landing-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.landing-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}
.landing-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--text) !important;
  letter-spacing: -0.01em;
}
.landing-brand:hover { text-decoration: none; }
.landing-brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: white;
}
.landing-brand-text {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.landing-nav-links {
  display: flex;
  gap: 2rem;
  flex: 1;
  margin-left: 2rem;
}
.landing-nav-links a {
  color: var(--text-secondary) !important;
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s;
}
.landing-nav-links a:hover { color: var(--primary) !important; text-decoration: none; }
.landing-nav-actions { display: flex; gap: 0.5rem; }

/* Hero */
.hero {
  padding: 5rem 1.5rem 4rem;
  background:
    radial-gradient(ellipse at top, rgba(99, 102, 241, 0.08), transparent 60%),
    linear-gradient(180deg, #fafbfc 0%, #ffffff 100%);
  border-bottom: 1px solid var(--border);
}
.hero-inner {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}
.hero-pill {
  display: inline-block;
  padding: 0.4rem 1rem;
  background: var(--primary-50);
  color: var(--primary-dark);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(79, 70, 229, 0.15);
}
.hero-h1 {
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  color: var(--text);
}
.hero-h1-line { display: block; }
.hero-h1-accent {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}
.hero-ctas {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.btn-lg {
  padding: 0.9rem 1.8rem !important;
  font-size: 1rem !important;
  font-weight: 600;
}
.hero-subnote {
  font-size: 0.88rem;
  color: var(--text-faint);
  margin-top: 0.5rem;
}

/* Features section */
.section-h2 {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 0.75rem;
}
.section-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 600px;
  margin: 0 auto 3rem;
}

.features {
  padding: 5rem 1.5rem;
  background: #fafbfc;
}
.features-inner {
  max-width: 1100px;
  margin: 0 auto;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.25rem;
}
.feature {
  background: white;
  padding: 1.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}
.feature:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}
.feature-icon {
  font-size: 1.75rem;
  margin-bottom: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  background: var(--primary-50);
  border-radius: var(--radius-sm);
}
.feature h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.feature p {
  font-size: 0.93rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* How it works */
.how {
  padding: 5rem 1.5rem;
}
.how-inner {
  max-width: 800px;
  margin: 0 auto;
}
.how-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.how-steps li {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}
.how-num {
  flex-shrink: 0;
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}
.how-steps h3 {
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
  font-weight: 700;
  color: var(--text);
}
.how-steps p {
  color: var(--text-secondary);
  line-height: 1.55;
  font-size: 0.95rem;
}

/* Final CTA */
.cta-section {
  padding: 5rem 1.5rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  text-align: center;
}
.cta-inner {
  max-width: 600px;
  margin: 0 auto;
}
.cta-section h2 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}
.cta-section p {
  font-size: 1.1rem;
  opacity: 0.92;
  margin-bottom: 2rem;
}
.cta-section .btn {
  background: white;
  color: var(--primary-dark);
  border-color: white;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
.cta-section .btn:hover {
  background: white;
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}

/* Footer */
.landing-footer {
  background: #f8f9fb;
  border-top: 1px solid var(--border);
  padding: 3rem 1.5rem 2rem;
}
.landing-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 3rem;
  margin-bottom: 2rem;
}
.footer-note {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 0.75rem;
  max-width: 280px;
}
.footer-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 2rem;
}
.footer-cols h4 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}
.footer-cols a {
  display: block;
  color: var(--text-secondary) !important;
  font-size: 0.92rem;
  text-decoration: none;
  padding: 0.25rem 0;
}
.footer-cols a:hover { color: var(--primary) !important; }
.landing-footer-bottom {
  max-width: 1100px;
  margin: 0 auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.85rem;
}

/* Sign-in modal tweaks */
.login-modal { max-width: 420px; padding: 2rem; }
.login-modal h2 {
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.modal-close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-faint);
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: var(--bg-muted); color: var(--text); }
.login-modal { position: relative; }

/* Responsive */
@media (max-width: 768px) {
  .landing-nav-inner { padding: 0.7rem 1rem; gap: 1rem; }
  .landing-nav-links { display: none; }
  .hero { padding: 3rem 1.25rem 2rem; }
  .hero-ctas .btn { width: 100%; }
  .features, .how, .cta-section { padding: 3rem 1.25rem; }
  .landing-footer-inner { grid-template-columns: 1fr; gap: 2rem; }
  .how-steps li { flex-direction: column; }
}

/* ============================================================
   Two-portal styling: admin (Doittools) vs app (tenant)
   ============================================================ */

/* Admin sidebar — slightly different tint to signal "platform mode" */
.sidebar-admin {
  background: linear-gradient(180deg, #FAFBFF 0%, #F2F3FA 100%);
  border-right: 1px solid var(--border);
}
.sidebar-admin .sidebar-brand {
  /* Platform admin uses a more "system" tone */
  background: linear-gradient(135deg, #1E40AF 0%, #4F46E5 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.sidebar-admin .sidebar-brand span {
  font-weight: 700;
  color: #1E40AF;
  -webkit-text-fill-color: #1E40AF;
  font-size: 0.7rem;
}

.sidebar-app .sidebar-brand span {
  /* Tenant name shown bigger and lowercase, friendlier */
  font-size: 0.8rem;
  text-transform: none;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  -webkit-text-fill-color: var(--text-muted);
  margin-top: 0.2rem;
  font-weight: 500;
}

/* Portal switcher */
.portal-switcher {
  margin: 1.5rem 0;
  padding: 1rem 0.9rem;
  background: rgba(99, 102, 241, 0.05);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}
.portal-switcher-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.portal-switcher .btn {
  width: 100%;
  padding: 0.55rem 0.75rem !important;
  justify-content: flex-start;
  font-size: 0.88rem !important;
}

/* ============================================================
   Team Owners page
   ============================================================ */
.to-card { padding: 1.5rem; }
.to-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.to-name { font-size: 1.15rem; font-weight: 700; }
.to-section { margin-top: 1.25rem; }
.to-section-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* Permission toggles */
.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.5rem;
}
.perm-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--card);
}
.perm-toggle:hover { background: var(--bg); }
.perm-toggle input[type=checkbox] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin-top: 0.15rem;
  accent-color: var(--primary);
}
.perm-toggle input[type=checkbox]:checked + .perm-info .perm-label {
  color: var(--primary-dark);
}
.perm-toggle.sensitive {
  border-left: 3px solid var(--warning);
}
.sensitive-tag {
  display: inline-block;
  color: var(--warning);
  font-size: 0.85em;
  margin-left: 0.25rem;
}
.perm-info { flex: 1; }
.perm-label {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
}
.perm-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  line-height: 1.4;
}

/* Staff assignment */
.staff-assignment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0.85rem;
}
.staff-pool {
  background: var(--bg);
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  min-height: 100px;
}
.pool-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}
.staff-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  margin: 0.15rem;
  transition: all 0.15s ease;
}
.staff-chip:hover { background: var(--primary-50); border-color: var(--primary); }
.staff-chip input[type=checkbox] {
  width: 14px; height: 14px;
  accent-color: var(--primary);
  cursor: pointer;
}
.staff-chip-assigned {
  background: var(--primary-50);
  border-color: var(--primary);
  color: var(--primary-dark);
}

@media (max-width: 600px) {
  .staff-assignment { grid-template-columns: 1fr; }
  .perm-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Staff CRUD page — master/detail
   ============================================================ */
.staff-crud {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1rem;
  height: calc(100vh - 180px);
}
.staff-list {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.staff-list-header {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-muted);
}
.staff-list-header input {
  padding: 0.5rem 0.75rem !important;
  font-size: 0.88rem !important;
}
.staff-list-body { overflow-y: auto; flex: 1; }
.staff-list-row {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s ease;
}
.staff-list-row:hover { background: var(--bg); }
.staff-list-row.selected {
  background: var(--primary-50);
  border-left: 3px solid var(--primary);
  padding-left: calc(1rem - 3px);
}
.staff-list-row-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}
.staff-list-row-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.staff-list-row-salary {
  font-size: 0.85rem;
  color: var(--text);
  margin-top: 0.15rem;
  font-weight: 600;
}

.staff-detail {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
  overflow-y: auto;
}
.staff-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.staff-detail-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.15rem;
}

table.kv td { padding: 0.6rem 0.85rem; }
table.kv td:first-child { color: var(--text-muted); width: 40%; }

@media (max-width: 900px) {
  .staff-crud { grid-template-columns: 1fr; height: auto; }
  .staff-list { max-height: 300px; }
}

/* ============================================================
   Holidays — month calendar
   ============================================================ */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}
.cal-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-dow {
  padding: 0.5rem 0;
  text-align: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cal-cell {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 80px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.1s ease;
}
.cal-cell.cal-blank {
  background: transparent;
  border: none;
}
.cal-cell.cal-clickable {
  cursor: pointer;
}
.cal-cell.cal-clickable:hover {
  background: var(--primary-50);
  border-color: var(--primary);
  transform: scale(1.02);
}
.cal-day-num {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.cal-day-name {
  font-size: 0.78rem;
  margin-top: 0.25rem;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.2;
  word-break: break-word;
}
.cal-sunday {
  background: #FEF3F2;
  border-color: #FECACA;
}
.cal-sunday .cal-day-num { color: var(--error); }
.cal-today {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-50);
}
.cal-today .cal-day-num {
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cal-holiday-mandatory {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border-color: var(--warning);
}
.cal-holiday-mandatory .cal-day-num { color: var(--warning); }
.cal-holiday-mandatory .cal-day-name {
  color: var(--warning);
  font-weight: 600;
}
.cal-holiday-optional {
  background: var(--info-bg);
  border-color: #BAE6FD;
}
.cal-holiday-optional .cal-day-name { color: var(--info); }

.cal-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  vertical-align: middle;
  border: 1px solid;
}
.cal-swatch.cal-holiday-mandatory { background: #FEF3C7; border-color: var(--warning); }
.cal-swatch.cal-holiday-optional { background: var(--info-bg); border-color: #BAE6FD; }
.cal-swatch.cal-sunday { background: #FEF3F2; border-color: #FECACA; }
.cal-swatch.cal-today { background: var(--primary); border-color: var(--primary); }

@media (max-width: 700px) {
  .cal-cell { min-height: 55px; padding: 0.35rem; }
  .cal-day-num { font-size: 0.8rem; }
  .cal-day-name { font-size: 0.65rem; }
  .cal-title { font-size: 1.1rem; }
}
