:root {
  color-scheme: light;
  --sp-1: 8px;
  --sp-2: 16px;
  --sp-3: 24px;
  --sp-4: 32px;
  --sp-5: 40px;
  --sp-6: 48px;

  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-subtle: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  --primary: #0f766e;
  --primary-hover: #115e59;
  --primary-soft: #f0fdfa;
  --primary-border: #99f6e4;

  --admin: #2563eb;
  --admin-hover: #1d4ed8;
  --admin-soft: #eff6ff;
  --admin-border: #bfdbfe;

  --present-bg: #ecfdf5;
  --present-text: #065f46;
  --present-border: #a7f3d0;

  --absent-bg: #fef2f2;
  --absent-text: #991b1b;
  --absent-border: #fecaca;

  --warn-bg: #fffbeb;
  --warn-text: #92400e;
  --warn-border: #fde68a;

  --radius-sm: 8px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --shadow-subtle: 0 1px 2px rgba(15, 23, 42, 0.03);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden],
.hidden {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

h1, h2, h3, h4, p, dl, dt, dd, ul {
  margin: 0;
}

button, input, select, textarea {
  font: inherit;
}

a {
  color: var(--admin);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Top Navigation Bar (8px grid) */
.ds-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.ds-topbar-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: var(--sp-2) var(--sp-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.ds-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  text-decoration: none;
}

.ds-brand:hover {
  text-decoration: none;
}

.ds-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--text-primary);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

/* Cards: 1px solid border, subtle elevation */
.ds-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-subtle);
}

/* Badges */
.ds-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 4px var(--sp-1);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.ds-badge-admin {
  background: var(--admin-soft);
  color: var(--admin);
  border-color: var(--admin-border);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text-secondary);
}

.status-pill-present {
  background: var(--present-bg);
  color: var(--present-text);
  border-color: var(--present-border);
}

.status-pill-absent {
  background: var(--absent-bg);
  color: var(--absent-text);
  border-color: var(--absent-border);
}

.status-pill-warn {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-color: var(--warn-border);
}

/* Buttons (strict 8px grid heights: 40px default, 48px large CTA, 32px compact) */
.ds-btn,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  min-height: 40px;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
  text-decoration: none;
  white-space: nowrap;
}

.ds-btn:hover:not(:disabled),
.button:hover:not(:disabled) {
  background: var(--surface-subtle);
  text-decoration: none;
}

.ds-btn:disabled,
.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ds-btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.ds-btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.ds-btn-admin,
.button-primary {
  background: var(--admin);
  border-color: var(--admin);
  color: #ffffff;
}

.ds-btn-admin:hover:not(:disabled),
.button-primary:hover:not(:disabled) {
  background: var(--admin-hover);
  border-color: var(--admin-hover);
}

.ds-btn-secondary,
.button-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

.ds-btn-sm,
.button-small {
  min-height: 32px;
  padding: 4px 12px;
  font-size: 0.8125rem;
}

/* Obvious Present / Absent Action Buttons in Attendance Tables */
.btn-approve {
  background: var(--present-bg);
  border-color: var(--present-border);
  color: var(--present-text);
  font-weight: 700;
}

.btn-approve:hover:not(:disabled) {
  background: #d1fae5;
}

.btn-reject {
  background: var(--absent-bg);
  border-color: var(--absent-border);
  color: var(--absent-text);
  font-weight: 700;
}

.btn-reject:hover:not(:disabled) {
  background: #fee2e2;
}

.btn-delete {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-delete:hover:not(:disabled) {
  background: var(--absent-bg);
  border-color: var(--absent-border);
  color: var(--absent-text);
}

/* Form Inputs (40px height, 8px grid padding) */
.ds-input,
.input-field {
  width: 100%;
  min-height: 40px;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.ds-input:focus,
.input-field:focus {
  outline: none;
  border-color: var(--admin);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
