:root {
  --bg: #f6f3eb;
  --panel: #fffdf8;
  --ink: #1f2b24;
  --muted: #637267;
  --accent: #0f8a73;
  --accent-2: #ff8f3f;
  --line: #d9ded3;
  --danger: #cf4040;
  --surface: #fff;
  --surface-soft: #fffcf7;
  --surface-item: #fffdf9;
  --card-inner: #fffefb;
  --toast-bg: #172e27;
  --shadow: 0 16px 35px rgba(21, 53, 45, 0.08);
  --shape-a: #ffd199;
  --shape-b: #9ef2da;
}

body[data-theme="dark"] {
  --bg: #111723;
  --panel: #161f2c;
  --ink: #e6edf5;
  --muted: #9ab0c8;
  --accent: #2ec2a5;
  --accent-2: #ff9e57;
  --line: #2a3a4d;
  --danger: #f06c6c;
  --surface: #1b2737;
  --surface-soft: #202f43;
  --surface-item: #1f2b3a;
  --card-inner: #1a2635;
  --toast-bg: #0b121a;
  --shadow: 0 16px 35px rgba(2, 8, 16, 0.45);
  --shape-a: #2e6b6f;
  --shape-b: #5a3e7b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 10%, color-mix(in srgb, var(--shape-a) 26%, var(--bg)), var(--bg) 35%),
    radial-gradient(circle at 85% 85%, color-mix(in srgb, var(--shape-b) 26%, var(--bg)), var(--bg) 30%);
  min-height: 100vh;
}

.bg-shape {
  position: fixed;
  z-index: -1;
  filter: blur(70px);
  opacity: 0.55;
}

.bg-shape-a {
  width: 280px;
  height: 280px;
  background: var(--shape-a);
  top: -80px;
  right: 10%;
}

.bg-shape-b {
  width: 260px;
  height: 260px;
  background: var(--shape-b);
  bottom: -90px;
  left: 8%;
}

.app-shell {
  max-width: 1160px;
  margin: 0 auto;
  padding: 28px 18px 44px;
  animation: rise 0.35s ease-out;
}

.panel {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, var(--surface));
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.login-panel {
  max-width: 560px;
  margin: 11vh auto 0;
}

h1,
h2,
h3 {
  margin: 0 0 8px;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(30px, 5vw, 52px);
}

h2 {
  font-size: clamp(22px, 3.2vw, 34px);
}

h3 {
  font-size: 20px;
}

.muted {
  color: var(--muted);
}

.hint-muted {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.hint-error {
  color: var(--danger);
}

.hidden {
  display: none !important;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tab {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--surface);
  font-weight: 700;
  cursor: pointer;
}

.tab.active {
  background: linear-gradient(120deg, var(--accent), #27aa90);
  color: #fff;
  border-color: transparent;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.grid {
  display: grid;
  gap: 14px;
}

.two-cols {
  grid-template-columns: 1fr 1fr;
}

.card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  padding: 14px;
}

.card-inner {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 10px;
  background: var(--card-inner);
}

.form-grid {
  display: grid;
  gap: 10px;
}

.row-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

input,
select,
button {
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
}

input,
select {
  background: var(--surface-soft);
  color: var(--ink);
}

button {
  background: linear-gradient(110deg, var(--accent-2), #ff7a24);
  border: none;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.01em;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ghost-btn {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

.tabs .tab {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

.tabs .tab.active {
  background: linear-gradient(120deg, var(--accent), #27aa90);
  color: #fff;
  border-color: transparent;
}

.list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-item);
  padding: 10px;
  font-size: 14px;
}

.absence-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

#excusedList .absence-row {
  grid-template-columns: 1fr 1fr auto;
}

.mono {
  font-family: "Space Mono", monospace;
}

.attendance-table,
.stats-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 13px;
}

.attendance-table th,
.attendance-table td,
.stats-table th,
.stats-table td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: left;
}

.attendance-status-select {
  min-width: 130px;
}

.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.fill-flag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e7f8ef;
  color: #166848;
  font-size: 12px;
  font-weight: 700;
}

.fill-flag.warn {
  background: #ffebe6;
  color: #a83a23;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  max-width: 400px;
  background: var(--toast-bg);
  color: #fff;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2);
}

.toast.error {
  background: var(--danger);
}

.theme-toggle {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 20;
  font-weight: 700;
}

@media (max-width: 900px) {
  .two-cols {
    grid-template-columns: 1fr;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
