/* ============================================================================
   Chitkara University · Attendance · design system v3
   Dark (default) + Light mode via [data-theme="light"]
   ============================================================================ */

/* ── Dark theme (default) ─────────────────────────────────────── */
:root, [data-theme="dark"] {
  --bg:        #0b1220;
  --bg-elev:   #11192b;
  --bg-card:   #161f37;
  --bg-card-hi:#1c2748;
  --line:      #233055;
  --line-soft: #1a2444;
  --ink:       #e5ecff;
  --ink-soft:  #94a3c8;
  --ink-mute:  #6f7da4;
  --brand:     #d32f2f;
  --brand-hi:  #ef4444;
  --brand-soft:rgba(211,47,47,0.16);
  --accent:    #38bdf8;
  --good:      #16a34a;
  --good-soft: rgba(22,163,74,0.14);
  --warn:      #f59e0b;
  --warn-soft: rgba(245,158,11,0.14);
  --bad:       #ef4444;
  --bad-soft:  rgba(239,68,68,0.14);
  --scrollbar: #233055;
}

/* ── Light theme ──────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:        #f4f6fb;
  --bg-elev:   #eef1f8;
  --bg-card:   #ffffff;
  --bg-card-hi:#f0f4ff;
  --line:      #d1d9ef;
  --line-soft: #e2e8f7;
  --ink:       #0f172a;
  --ink-soft:  #475569;
  --ink-mute:  #94a3b8;
  --brand:     #c62828;
  --brand-hi:  #ef4444;
  --brand-soft:rgba(198,40,40,0.10);
  --accent:    #0284c7;
  --good:      #15803d;
  --good-soft: rgba(21,128,61,0.12);
  --warn:      #b45309;
  --warn-soft: rgba(180,83,9,0.12);
  --bad:       #dc2626;
  --bad-soft:  rgba(220,38,38,0.12);
  --scrollbar: #d1d9ef;
}

:root {
  --r-sm: 6px; --r: 10px; --r-lg: 16px;
  --shadow:    0 4px 18px rgba(0,0,0,0.15);
  --shadow-lg: 0 10px 36px rgba(0,0,0,0.20);
  --transition: 200ms cubic-bezier(0.4,0,0.2,1);
  --font:      'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--ink);
  min-height: 100dvh; line-height: 1.55;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}
a { color: inherit; text-decoration: none; transition: color var(--transition); }
img { max-width: 100%; display: block; }
input, select, button, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
::selection { background: var(--brand); color: white; }
:focus-visible { outline: 2px solid var(--brand-hi); outline-offset: 2px; border-radius: var(--r-sm); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 99px; }

.wrap { width: min(1280px, 100% - 2rem); margin: 0 auto; }
.row  { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.col  { display: flex; flex-direction: column; gap: 0.85rem; }
.muted { color: var(--ink-soft); }
.dim   { color: var(--ink-mute); }
.mono  { font-family: var(--font-mono); font-size: 0.82em; letter-spacing: 0.02em; }

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11,18,32,0.88);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
  padding: 0.7rem 0;
}
[data-theme="light"] .topbar {
  background: rgba(255,255,255,0.9);
}
.topbar .wrap { display: flex; align-items: center; gap: 0.75rem; }
.brand { display: flex; align-items: center; gap: 0.65rem; font-weight: 700; flex-shrink: 0; }
.brand img { height: 30px; width: auto; }
.brand span { letter-spacing: -0.01em; font-size: 1rem; }
.topnav { display: flex; gap: 0.2rem; margin-left: auto; align-items: center; }
.topnav a {
  padding: 0.4rem 0.8rem; border-radius: var(--r-sm);
  color: var(--ink-soft); font-size: 0.9rem; font-weight: 500;
  transition: var(--transition);
}
.topnav a:hover  { background: var(--bg-card); color: var(--ink); }
.topnav a.active { background: var(--brand-soft); color: var(--brand-hi); }
.user-chip {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0.65rem 0.35rem 0.45rem;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--r); font-size: 0.82rem; flex-shrink: 0;
}
.user-chip .avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-hi));
  display: grid; place-items: center; font-weight: 700; font-size: 0.65rem; color: white;
}
.theme-toggle {
  padding: 0.35rem 0.55rem; font-size: 1rem; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--bg-card); flex-shrink: 0;
}
.menu-btn {
  display: none; width: 34px; height: 34px;
  border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--bg-card); align-items: center; justify-content: center; flex-shrink: 0;
}
.menu-btn span, .menu-btn span::before, .menu-btn span::after {
  content: ''; display: block; width: 15px; height: 2px;
  background: var(--ink); border-radius: 2px;
}
.menu-btn span { position: relative; }
.menu-btn span::before { position: absolute; top: -4px; left: 0; }
.menu-btn span::after  { position: absolute; top:  4px; left: 0; }
@media (max-width: 860px) {
  .menu-btn { display: inline-flex; }
  .topnav {
    position: fixed; inset: 54px 0 auto 0;
    flex-direction: column; gap: 0;
    background: var(--bg-elev); border-bottom: 1px solid var(--line);
    padding: 0.75rem; transform: translateY(-110%);
    transition: transform var(--transition); box-shadow: var(--shadow-lg);
  }
  .topnav.open { transform: translateY(0); }
  .topnav a { padding: 0.8rem 1rem; width: 100%; }
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.4rem; padding: 0.55rem 1rem; border-radius: var(--r-sm);
  font-weight: 600; font-size: 0.9rem;
  background: var(--bg-card); color: var(--ink);
  border: 1px solid var(--line); transition: var(--transition);
  white-space: nowrap;
}
.btn:hover:not(:disabled)    { background: var(--bg-card-hi); border-color: var(--brand); }
.btn:active:not(:disabled)   { transform: scale(0.97); }
.btn:disabled                { opacity: 0.45; cursor: not-allowed; }
.btn.primary  { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--brand-hi); border-color: var(--brand-hi); }
.btn.good     { background: var(--good); border-color: var(--good); color: #fff; }
.btn.bad      { background: var(--bad);  border-color: var(--bad);  color: #fff; }
.btn.ghost    { background: transparent; border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { background: var(--bg-card); }
.btn.sm       { padding: 0.35rem 0.65rem; font-size: 0.8rem; }
.btn.lg       { padding: 0.8rem 1.4rem; font-size: 1rem; }
.btn.block    { width: 100%; }

/* ── Forms ─────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field label { font-size: 0.75rem; font-weight: 600; color: var(--ink-soft); letter-spacing: 0.03em; text-transform: uppercase; }
.field input, .field select, .field textarea,
input[type="range"] {
  background: var(--bg-elev); border: 1px solid var(--line);
<<<<<<< Updated upstream
  border-radius: var(--r-sm); padding: 0.6rem 0.8rem;
  font-size: 0.92rem; color: var(--ink); transition: border-color var(--transition); width: 100%;
=======
  border-radius: var(--r-sm); padding: 0.65rem 0.85rem;
  aria-label for select

  font-size: 0.95rem; color: var(--ink);
  transition: border-color var(--transition);
  width: 100%;
>>>>>>> Stashed changes
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
input[type="range"] { padding: 0.3rem 0; cursor: pointer; accent-color: var(--brand); }
.field textarea { resize: vertical; min-height: 80px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }

/* Filter inputs (inline, not in .field wrapper) */
.filter-input {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 0.38rem 0.65rem; color: var(--ink); font-size: 0.85rem;
  transition: border-color var(--transition);
}
.filter-input:focus { outline: none; border-color: var(--brand); }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 1.2rem 1.35rem;
  box-shadow: var(--shadow); margin-bottom: 1.5rem;
}
.card.tight { padding: 0.9rem 1.1rem; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.card-header h2 { font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; }

/* ── Stats grid ────────────────────────────────────────────── */
.stats-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 1.5rem;
}
.stat {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 1rem 1.15rem;
  position: relative; overflow: hidden;
}
.stat::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--brand); }
.stat.good::before { background: var(--good); }
.stat.warn::before { background: var(--warn); }
.stat.bad::before  { background: var(--bad);  }
.stat .k {
  font-size: 0.68rem; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 0.35rem;
}
.stat .v { font-size: 1.75rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--r-sm); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead { background: var(--bg-elev); }
th {
  text-align: left; padding: 0.65rem 0.85rem;
  font-size: 0.68rem; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--ink-soft); font-weight: 600;
  white-space: nowrap; border-bottom: 1px solid var(--line);
}
td { padding: 0.55rem 0.85rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-card-hi); }
.table-empty { text-align: center; padding: 2rem 1rem; color: var(--ink-mute); font-style: italic; }

/* ── Pills ─────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.18rem 0.5rem; border-radius: 999px;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.02em;
  border: 1px solid currentColor; white-space: nowrap;
}
.pill .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.pill.good  { color: var(--good);     background: var(--good-soft); }
.pill.warn  { color: var(--warn);     background: var(--warn-soft); }
.pill.bad   { color: var(--bad);      background: var(--bad-soft); }
.pill.brand { color: var(--brand-hi); background: var(--brand-soft); }
.pill.mute  { color: var(--ink-mute); background: var(--bg-elev); border-color: var(--line); }

/* ── Role badges ───────────────────────────────────────────── */
.role-badge { background: var(--bg-elev); padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.72rem; font-weight: 600; }
.role-teacher { color: var(--brand-hi); }
.role-mentor  { color: var(--accent); }
.role-dean    { color: var(--warn); }
.role-super   { color: #a855f7; }

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
  padding: 0.7rem 0.95rem; border-radius: var(--r-sm);
  font-size: 0.86rem; border: 1px solid currentColor; margin: 0 0 1rem;
}
.alert.error   { color: var(--bad);      background: var(--bad-soft); }
.alert.success { color: var(--good);     background: var(--good-soft); }
.alert.warn    { color: var(--warn);     background: var(--warn-soft); }
.alert.info    { color: var(--brand-hi); background: var(--brand-soft); }

/* ── Tabs ──────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 0.15rem; border-bottom: 1px solid var(--line);
  margin-bottom: 1.25rem; flex-wrap: wrap; overflow-x: auto;
}
.tab {
  padding: 0.55rem 0.9rem; background: none; color: var(--ink-soft); font-size: 0.88rem;
  border-bottom: 2px solid transparent; transition: var(--transition); white-space: nowrap; flex-shrink: 0;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand-hi); border-bottom-color: var(--brand); }
.tab-panel  { display: none; }
.tab-panel.active { display: block; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(11,18,32,0.72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 1rem; z-index: 100;
}
.modal {
  width: 100%; max-width: 540px;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1.5rem 1.6rem;
  max-height: 90dvh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 1rem; }

/* ── Auth ──────────────────────────────────────────────────── */
.auth-shell {
  min-height: 100dvh; display: grid; place-items: center; padding: 2rem 1rem;
  background:
    radial-gradient(circle at 30% 20%, rgba(211,47,47,0.12) 0%, transparent 60%),
    radial-gradient(circle at 70% 80%, rgba(56,189,248,0.08) 0%, transparent 50%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 2rem 1.85rem; box-shadow: var(--shadow-lg);
}
.auth-card h1 { font-size: 1.45rem; font-weight: 700; margin-bottom: 0.4rem; }
.auth-card .lede { color: var(--ink-soft); margin-bottom: 1.5rem; font-size: 0.9rem; }
.auth-card .field + .field { margin-top: 0.85rem; }
.auth-card .btn { margin-top: 1.25rem; }

/* ── Landing hero ──────────────────────────────────────────── */
.hero {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 4rem 1.5rem;
  background:
    radial-gradient(circle at 30% 20%, rgba(211,47,47,0.18) 0%, transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(56,189,248,0.12) 0%, transparent 50%),
    var(--bg);
  text-align: center;
}
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 800; letter-spacing: -0.025em; line-height: 1.05; margin-bottom: 1rem; }
.hero h1 .accent { color: var(--brand-hi); }
.hero p.lede { font-size: 1.05rem; color: var(--ink-soft); max-width: 56ch; margin: 0 auto 2rem; }
.hero .cta { display: flex; gap: 0.85rem; justify-content: center; flex-wrap: wrap; }

/* ── Punch panel ───────────────────────────────────────────── */
.punch-panel {
  background: linear-gradient(135deg, rgba(211,47,47,0.07), rgba(56,189,248,0.04));
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.6rem;
  margin-bottom: 1.25rem;
}
.punch-panel.live    { border-color: var(--good); background: linear-gradient(135deg, rgba(22,163,74,0.09), rgba(56,189,248,0.03)); }
.punch-panel.outside { border-color: var(--bad);  background: linear-gradient(135deg, rgba(239,68,68,0.09), rgba(245,158,11,0.03)); }
.punch-panel h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.3rem; }
.punch-panel .meta { color: var(--ink-soft); font-size: 0.85rem; margin-bottom: 0.9rem; }
.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--good); animation: livePulse 1.6s infinite; margin-right: 0.4rem;
  box-shadow: 0 0 0 0 rgba(22,163,74,0.65);
}
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0   rgba(22,163,74,0.65); }
  70%  { box-shadow: 0 0 0 10px rgba(22,163,74,0); }
  100% { box-shadow: 0 0 0 0   rgba(22,163,74,0); }
}

/* Today row */
.today-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.55rem 0; border-bottom: 1px solid var(--line-soft);
}
.today-row:last-child { border-bottom: none; }

/* Percentage row */
.pct-row {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.55rem 0; border-bottom: 1px solid var(--line-soft);
}
.pct-row:last-child { border-bottom: none; }

/* ── Duration progress bar ─────────────────────────────────── */
.duration-progress { background: var(--line-soft); height: 5px; border-radius: 99px; overflow: hidden; margin-top: 0.5rem; }
.duration-bar { height: 100%; background: var(--good); transition: width 0.4s ease, background 0.4s; border-radius: 99px; }

/* ── Buildings grid ────────────────────────────────────────── */
.buildings-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem;
}
.building-card {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r); padding: 1rem 1.15rem;
  transition: border-color var(--transition);
}
.building-card:hover { border-color: var(--brand); }
.building-card.inactive { opacity: 0.6; }

/* ── Page header ───────────────────────────────────────────── */
.page-header {
  padding: 1.4rem 0 1rem; border-bottom: 1px solid var(--line-soft);
  margin-bottom: 1.5rem; display: flex; align-items: flex-end;
  justify-content: space-between; flex-wrap: wrap; gap: 0.75rem;
}
.page-header h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; }
.page-header .sub { color: var(--ink-soft); font-size: 0.88rem; margin-top: 0.15rem; }

/* ── Install banner ────────────────────────────────────────── */
.install-banner {
  position: fixed; bottom: 1rem; left: 1rem; right: 1rem; z-index: 60;
  background: var(--bg-card); border: 1px solid var(--brand);
  border-radius: var(--r); padding: 0.8rem 1rem;
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  box-shadow: var(--shadow-lg); max-width: 480px; margin: 0 auto;
}
.install-banner .ic { width: 30px; height: 30px; background: var(--brand-soft); color: var(--brand-hi); border-radius: 50%; display: grid; place-items: center; font-size: 0.9rem; }
.install-banner .text { flex: 1; font-size: 0.85rem; }
.install-banner .text strong { display: block; }

/* ── Spinner ───────────────────────────────────────────────── */
.spinner {
  display: inline-block; width: 13px; height: 13px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: spin 0.65s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }
.violation-badge { animation: pulse 2s infinite; color: var(--bad); background: var(--bad-soft); }

/* ── Site footer ───────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--line-soft); padding: 1.75rem 0; margin-top: 3rem;
  font-size: 0.8rem; color: var(--ink-mute);
}
.site-footer .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ── Responsive tablet/mobile ──────────────────────────────── */
@media (max-width: 760px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .buildings-grid { grid-template-columns: 1fr; }
  .wrap { width: calc(100% - 1.5rem); }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat .v { font-size: 1.45rem; }
  .page-header h1 { font-size: 1.2rem; }
}
