:root {
  --bg-color: #f8fafc;
  --text-color: #0f172a;
  --muted-text: #64748b;

  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --accent-color: #06b6d4;

  --card-bg: #ffffff;
  --border-color: #e2e8f0;

  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;

  --timer-bg: #0f172a;
  --timer-track: #1e293b;
  --timer-progress: #22c55e;

  --banner-start: #4f46e5;
  --banner-end: #06b6d4;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
  --bg-color: #0b1220;
  --text-color: #e5e7eb;
  --muted-text: #94a3b8;

  --primary-color: #818cf8;
  --primary-hover: #6366f1;
  --accent-color: #22d3ee;

  --card-bg: #111827;
  --border-color: #1f2937;

  --success: #22c55e;
  --warning: #fbbf24;
  --danger: #fb7185;

  --timer-bg: #020617;
  --timer-track: #1e293b;
  --timer-progress: #34d399;

  --banner-start: #6366f1;
  --banner-end: #22d3ee;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 10px 30px rgba(0,0,0,0.4);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  display: flex;
  min-height: 100vh;
  font-family: Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: background-color 0.3s, color 0.3s;
}

.hidden {
  display: none !important;
}

body.logged-out #sidebar,
body.logged-out main {
  display: none;
}

#sidebar {
  width: 250px;
  background-color: var(--primary-color);
  height: 100vh;
  padding-top: 60px;
  position: fixed;
  overflow-y: auto;
  transition: width 0.3s;
}

#sidebar ul {
  list-style: none;
}

#sidebar li {
  margin: 0;
}

#sidebar a {
  display: block;
  color: white;
  text-decoration: none;
  padding: 15px 20px;
  transition: background-color 0.3s;
}

#sidebar a:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

main {
  margin-left: 250px;
  padding: 20px;
  flex-grow: 1;
}

.card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 15px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.card h2 {
  margin-bottom: 10px;
}

.btn {
  background-color: var(--accent-color);
  color: #000;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
  margin-right: 8px;
  margin-top: 6px;
}

.btn:hover {
  background-color: #02877a;
  transform: translateY(-1px);
}

.btn.danger {
  background: #ef4444;
  color: white;
}

.btn.danger:hover {
  background: #dc2626;
}

@media (max-width: 768px) {
  #sidebar {
    left: -250px;
  }

  #sidebar.active {
    left: 0;
  }

  main {
    margin-left: 0;
  }
}

#sidebar::-webkit-scrollbar {
  width: 6px;
}

#sidebar::-webkit-scrollbar-track {
  background: var(--primary-color);
}

#sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
}

progress {
  width: 100%;
  height: 20px;
}

progress[value]::-webkit-progress-bar {
  background-color: var(--card-bg);
  border-radius: 10px;
}

progress[value]::-webkit-progress-value {
  background-color: var(--accent-color);
  border-radius: 10px;
}

input,
select,
textarea {
  width: 100%;
  padding: 8px;
  margin-bottom: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: inherit;
  color: inherit;
}

input[type="date"] {
  padding: 4px;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.overdue-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 8px;
  font-size: 0.9rem;
  font-weight: bold;
  color: #fff;
  background: #ef4444;
  border-radius: 999px;
  vertical-align: middle;
}

/* Dashboard */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.welcome-banner {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--banner-start), var(--banner-end));
  color: white;
  border-radius: 18px;
  padding: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.welcome-banner h1 {
  font-size: 1.8rem;
  margin-top: 4px;
}

.welcome-banner p {
  opacity: 0.95;
}

.banner-eyebrow {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.9;
}

.banner-chip {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

.stat-card {
  text-align: center;
}

.stat-card .big {
  font-size: 2rem;
  font-weight: bold;
  margin: 8px 0;
}

.stat-card span {
  opacity: 0.8;
}

.wide-card {
  grid-column: span 2;
}

.styled-list {
  list-style: none;
  margin-top: 10px;
}

.styled-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .styled-list li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.attendance-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
}

.timer-page {
  min-height: calc(100vh - 40px);
  display: flex;
  justify-content: center;
  align-items: center;
}

.timer-shell {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 22px;
  align-items: center;
}

.timer-copy {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(6, 182, 212, 0.10));
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

.timer-copy h2 {
  font-size: 2rem;
  margin-bottom: 10px;
}

.timer-copy p {
  line-height: 1.6;
  opacity: 0.9;
  margin-bottom: 10px;
}

.timer-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.timer-pill {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  font-size: 0.9rem;
}

.timer-container {
  text-align: center;
  background: var(--timer-bg);
  color: white;
  padding: 24px;
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}

.timer-header {
  margin-bottom: 14px;
}

.timer-title {
  font-size: 1.8rem;
  margin-bottom: 6px;
}

.timer-mode {
  font-size: 0.95rem;
  opacity: 0.75;
}

.timer-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}

.timer-input-group {
  text-align: left;
}

.timer-input-group input {
  margin-bottom: 0;
}

.timer-container .btn {
  margin: 0;
  height: 42px;
  align-self: end;
}

.timer-wrapper {
  position: relative;
  width: 260px;
  height: 260px;
  margin: auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

.circle {
  transform: rotate(-90deg);
}

.bg {
  fill: none;
  stroke: var(--timer-track);
  stroke-width: 12;
}

.progress {
  fill: none;
  stroke: var(--timer-progress);
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}

#time {
  position: absolute;
  font-size: 48px;
  font-weight: bold;
  letter-spacing: 1px;
}

.timer-buttons {
  margin-top: 18px;
}

.timer-buttons button {
  margin: 10px 5px 0;
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  transition: transform 0.2s;
}

.timer-buttons button:hover {
  transform: scale(1.05);
}

.timer-buttons .start { background: #22c55e; color: white; }
.timer-buttons .pause { background: #f59e0b; color: white; }
.timer-buttons .reset { background: #ef4444; color: white; }

.timer-stats {
  margin-top: 14px;
  font-size: 0.9rem;
  opacity: 0.8;
}

@media (max-width: 900px) {
  .timer-shell {
    grid-template-columns: 1fr;
  }

  .wide-card {
    grid-column: span 1;
  }

  .welcome-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .timer-inputs {
    grid-template-columns: 1fr;
  }
}

.onboarding-screen {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.onboarding-card {
  width: min(620px, 100%);
  background: rgba(255, 255, 255, 0.06);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
}

.app-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.12);
  padding: 8px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
  font-size: 1.25rem;
  font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif
}

.onboarding-card h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.onboarding-text {
  opacity: 0.9;
  margin-bottom: 16px;
}

.warning-box {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fff;
  padding: 14px;
  border-radius: 14px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-weight: bold;
}

.policy-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 8px 0 16px;
  line-height: 1.5;
  cursor: pointer;
}

.policy-row input {
  width: auto;
  margin-top: 4px;
}

.create-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.settings-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.settings-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
}

.setting-row strong {
  font-size: 1rem;
}

.subtle {
  opacity: 0.75;
  line-height: 1.5;
}

.theme-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 74px;
  height: 38px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  background: linear-gradient(135deg, #1e293b, #334155);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.theme-switch input {
  display: none;
}

.theme-switch .track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  overflow: hidden;
}

.theme-switch .sun,
.theme-switch .moon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  transition: opacity 0.25s ease;
}

.theme-switch .sun {
  left: 12px;
  opacity: 1;
}

.theme-switch .moon {
  right: 12px;
  opacity: 0.55;
}

.theme-switch .thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: white;
  transition: transform 0.25s ease, background 0.25s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.theme-switch input:checked ~ .thumb {
  transform: translateX(36px);
  background: #111827;
}

.theme-switch input:checked ~ .sun {
  opacity: 0.55;
}

.theme-switch input:checked ~ .moon {
  opacity: 1;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.task-card {
  position: relative;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  overflow: hidden;
}

[data-theme="dark"] .task-card {
  background: rgba(255, 255, 255, 0.06);
}

.task-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.18);
}

.task-card.completed {
  opacity: 0.75;
}

.task-card.completed .task-title-text {
  text-decoration: line-through;
}

.task-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.task-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.task-badge.low {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.task-badge.normal {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.task-badge.high {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.task-check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-check input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.task-title-text {
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.task-deadline {
  font-size: 0.92rem;
  opacity: 0.8;
  margin-bottom: 16px;
}

.task-actions {
  display: flex;
  justify-content: flex-end;
}

.empty-state {
  opacity: 0.75;
  padding: 10px 0;
}

.input-label {
  font-size: 0.85rem;
  opacity: 0.7;
  display: block;
  margin-bottom: 4px;
}

.focus-active {
  background: var(--bg);
}

.focus-active .timer-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.focus-active .timer-copy,
.focus-active .timer-inputs,
.focus-active .timer-meta,
.focus-active .timer-stats,
.focus-active .timer-buttons,
.focus-active .timer-header {
  display: none;
}

.focus-active .timer-container {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.focus-active .timer-wrapper {
  transform: scale(1.5);
}

.focus-active #time {
  font-size: 3.2rem;
  font-weight: 600;
  margin-top: 10px;
}

.focus-active .timer-container,
.focus-active .timer-wrapper,
.focus-active svg {
  box-shadow: none;
  filter: none;
}

.focus-active .timer-wrapper,
.focus-active #time {
  transition: all 0.2s ease;
}

.secondary-btn {
  margin-top: 10px;
  background: transparent;
  border: 1px solid var(--border);
}

td:last-child {
  white-space: nowrap;
  text-align: center;
}

.delete-subject {
  display: inline-block;
}

.btn {
  width: auto;
}

table {
  border-collapse: separate;
  border-spacing: 10px 10px;
}

.logo-container {
  text-align: center;
  padding: 20px 10px;
}

.logo {
  width: 70px;
  height: auto;
  margin-bottom: 10px;
}

.logo-text {
  font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
  color: white;
  font-size: 1.2rem;
  font-weight: bold;
}