@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --ink: #12141c;
  --ink-soft: #1c1f2b;
  --paper: #f5f6fa;
  --card: #ffffff;
  --primary: #3355ff;
  --primary-dim: #e7ebff;
  --accent: #16c79a;
  --accent-dim: #e2f9f2;
  --warn: #ffb020;
  --warn-dim: #fff3dd;
  --danger: #ef4444;
  --danger-dim: #fde8e8;
  --text: #1b1d28;
  --muted: #6b7280;
  --border: #e4e7ee;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(18, 20, 28, 0.04), 0 8px 24px -12px rgba(18, 20, 28, 0.12);
  --font-display: 'Sora', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  margin: 0;
}

a { color: var(--primary); }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

button, input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- Pulse mark (brand signature) ---------- */
.pulse-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.pulse-mark svg { display: block; }
.pulse-mark .wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  color: inherit;
}
.pulse-mark .wordmark .thin { font-weight: 400; opacity: 0.6; }

@keyframes pulse-draw {
  from { stroke-dashoffset: 240; }
  to { stroke-dashoffset: 0; }
}
.pulse-line {
  stroke-dasharray: 240;
  animation: pulse-draw 1.6s ease-out forwards;
}

/* ---------- Auth screen ---------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}
@media (max-width: 880px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
}
.auth-hero {
  background: var(--ink);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px;
  position: relative;
  overflow: hidden;
}
.auth-hero::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(51, 85, 255, 0.35), transparent 70%);
}
.auth-hero h1 {
  font-size: 40px;
  line-height: 1.15;
  max-width: 480px;
  font-weight: 700;
}
.auth-hero .tag {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}
.auth-hero .foot {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  position: relative;
}
.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
}
.auth-card h2 { font-size: 24px; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.auth-tabs button {
  flex: 1;
  background: none;
  border: none;
  padding: 10px 0;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.auth-tabs button.active { color: var(--text); border-color: var(--primary); }

/* ---------- Form elements ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s, box-shadow 0.15s;
  font-size: 14px;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; width: 100%; }
.btn-primary:hover { box-shadow: 0 6px 16px -6px rgba(51, 85, 255, 0.55); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--paper); }
.btn-danger-outline { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.error-banner {
  background: var(--danger-dim);
  color: #a52424;
  border: 1px solid #f4b8b8;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 16px;
}
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* ---------- App shell ---------- */
.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .app-shell.nav-open .sidebar { display: flex; position: fixed; inset: 0; z-index: 40; width: 100%; }
}
.sidebar {
  background: var(--ink);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
}
.sidebar .pulse-mark { color: #fff; padding: 0 8px; margin-bottom: 28px; }
.nav-group { margin-bottom: 4px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.68);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 2px;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-link.active { background: var(--primary); color: #fff; }
.sidebar-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.who { font-size: 13px; color: rgba(255, 255, 255, 0.55); padding: 0 12px 10px; }
.who strong { color: #fff; display: block; font-size: 14px; }

.main { padding: 28px 32px; max-width: 1180px; width: 100%; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.topbar h1 { font-size: 22px; }
.topbar .sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card h3 { font-size: 15px; margin-bottom: 14px; }

.stat-card .label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}
.stat-card .value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  margin-top: 6px;
}
.stat-card .value.accent { color: var(--accent); }
.stat-card .value.warn { color: var(--warn); }
.stat-card .value.danger { color: var(--danger); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-present { background: var(--accent-dim); color: #0b8d68; }
.badge-late { background: var(--warn-dim); color: #a66200; }
.badge-absent { background: var(--danger-dim); color: #b13030; }
.badge-leave { background: var(--primary-dim); color: #2540bf; }
.badge-pending { background: #eef0f4; color: var(--muted); }
.badge-approved { background: var(--accent-dim); color: #0b8d68; }
.badge-rejected { background: var(--danger-dim); color: #b13030; }

.clock-card {
  background: var(--ink);
  color: #fff;
  border-radius: 18px;
  padding: 28px;
  position: relative;
  overflow: hidden;
}
.clock-card .time {
  font-family: var(--font-mono);
  font-size: 42px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.clock-card .date { color: rgba(255, 255, 255, 0.6); font-size: 13.5px; margin-top: 4px; }
.clock-card .status-line { display: flex; align-items: center; gap: 8px; margin: 18px 0 22px; font-size: 13.5px; color: rgba(255,255,255,0.75); }
.clock-actions { display: flex; gap: 12px; }
.clock-actions .btn { flex: 1; }
.btn-clockin { background: var(--accent); color: #04231b; }
.btn-clockout { background: rgba(255, 255, 255, 0.1); color: #fff; border-color: rgba(255,255,255,0.2); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state .glyph { font-size: 28px; margin-bottom: 8px; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(18, 20, 28, 0.5);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal {
  background: var(--card); border-radius: 16px; padding: 24px; width: 100%; max-width: 440px;
  max-height: 90vh; overflow-y: auto;
}
.modal h3 { font-size: 17px; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .field { margin-bottom: 0; min-width: 150px; }
.toolbar-spacer { flex: 1; }

.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 10px; font-size: 13.5px; box-shadow: var(--shadow);
  z-index: 60; max-width: 320px;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--accent); color: #04231b; }

.menu-btn { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text); }
@media (max-width: 820px) { .menu-btn { display: block; } }

.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title h2 { font-size: 17px; }

.tabs-row { display: flex; gap: 6px; border: 1px solid var(--border); border-radius: 10px; padding: 4px; width: fit-content; margin-bottom: 18px; background: var(--card); }
.tabs-row button { border: none; background: none; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.tabs-row button.active { background: var(--primary); color: #fff; }
