
:root {
  --forest: #244B37;
  --forest-dark: #183728;
  --sage: #78977B;
  --mint: #C9DDC5;
  --ivory: #F5F5EC;
  --white: #FFFFFF;
  --text: #26352C;
  --muted: #788579;
  --border: #E1E8DE;
  --surface: #FFFFFF;
  --background: #F5F5EC;
  --danger: #B84F4F;
  --success: #3F805A;
  --shadow: 0 8px 25px rgba(36, 75, 55, 0.08);
  --radius: 16px;
}

[data-theme="dark"] {
  --forest: #A5C9A8;
  --forest-dark: #C8E0C9;
  --sage: #91B396;
  --mint: #304B38;
  --ivory: #17231B;
  --white: #223128;
  --text: #EDF3EC;
  --muted: #A7B5A8;
  --border: #394A3D;
  --surface: #223128;
  --background: #17231B;
  --danger: #EF8989;
  --success: #8BC69B;
  --shadow: 0 8px 25px rgba(0, 0, 0, 0.18);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.2s, color 0.2s;
}

button, input, textarea, select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 255px;
  min-width: 255px;
  background: var(--forest);
  color: white;
  padding: 25px 16px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 10px 25px;
  border-bottom: 1px solid rgba(255,255,255,0.16);
}

.brand-icon {
  width: 43px;
  height: 43px;
  border-radius: 14px;
  background: rgba(255,255,255,0.16);
  display: grid;
  place-items: center;
  font-size: 24px;
}

.brand h2 {
  font-size: 20px;
  font-weight: 700;
}

.brand small {
  opacity: 0.75;
  font-size: 12px;
}

.navigation {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 24px;
}

.nav-btn {
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 12px 13px;
  border-radius: 10px;
  font-size: 14px;
  transition: 0.2s;
}

.nav-btn:hover {
  background: rgba(255,255,255,0.12);
}

.sidebar .nav-btn.active {
  background: var(--mint);
  color: #244B37;
  font-weight: 700;
}

.sidebar-footer {
  margin-top: auto;
  padding: 20px 10px 5px;
  border-top: 1px solid rgba(255,255,255,0.16);
  font-size: 13px;
}

.sidebar-footer span {
  opacity: 0.7;
  font-size: 11px;
}

.main-area {
  flex: 1;
  min-width: 0;
  padding: 28px 35px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 28px;
}

.welcome-label {
  color: var(--sage);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.topbar h1 {
  font-size: 27px;
  margin-top: 3px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.top-date {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
}

.page-content {
  max-width: 1200px;
  margin: auto;
  min-height: 70vh;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.card h2 {
  font-size: 19px;
  margin-bottom: 12px;
  color: var(--forest-dark);
}

.card h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.card p {
  margin-bottom: 9px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.btn {
  display: inline-block;
  border: 0;
  border-radius: 9px;
  padding: 10px 16px;
  margin: 5px 5px 5px 0;
  background: var(--forest);
  color: white;
  font-size: 13px;
  font-weight: 600;
  transition: 0.2s;
}

.btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn.secondary {
  background: var(--mint);
  color: #244B37;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 13px 0;
}

.field label {
  font-size: 13px;
  font-weight: 600;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 12px;
  background: var(--background);
  color: var(--text);
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(120,151,123,0.13);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

input[type="checkbox"] {
  width: auto;
  accent-color: var(--forest);
  margin-right: 8px;
}

input[type="date"], input[type="time"] {
  max-width: 100%;
}

form {
  margin-top: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.muted, .loading {
  color: var(--muted);
}

.success {
  color: var(--success);
}

.error {
  color: var(--danger);
}

.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 30px;
  background: var(--mint);
  color: #244B37;
  font-size: 12px;
}

.progress-track {
  width: 100%;
  height: 9px;
  background: var(--border);
  border-radius: 20px;
  overflow: hidden;
  margin: 10px 0;
}

.progress-track > div {
  height: 100%;
  background: var(--sage);
  border-radius: 20px;
}

details.card summary {
  cursor: pointer;
  font-size: 15px;
  color: var(--forest-dark);
}

.topic-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 3px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.topic-check:last-child {
  border-bottom: 0;
}

#timer-display {
  font-size: clamp(38px, 7vw, 62px);
  text-align: center;
  color: var(--forest);
  font-variant-numeric: tabular-nums;
  padding: 20px 0;
}

#ai-output {
  margin-top: 12px;
}

.app-footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 25px 0 10px;
}

.mobile-nav {
  display: none;
}

.loading {
  padding: 30px;
  text-align: center;
}

@media (max-width: 850px) {
  .sidebar {
    width: 220px;
    min-width: 220px;
  }

  .main-area {
    padding: 24px 20px;
  }
}

@media (max-width: 650px) {
  .app {
    display: block;
    padding-bottom: 75px;
  }

  .sidebar {
    display: none;
  }

  .main-area {
    padding: 20px 14px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar h1 {
    font-size: 22px;
  }

  .top-date {
    font-size: 11px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 17px;
  }

  .mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-around;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 8px 3px calc(8px + env(safe-area-inset-bottom));
  }

  .mobile-nav .nav-btn {
    color: var(--text);
    text-align: center;
    padding: 5px 8px;
    font-size: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
  }

  .mobile-nav .nav-btn span {
    font-size: 10px;
  }

  .mobile-nav .nav-btn.active {
    background: var(--mint);
    color: #244B37;
  }
}
/* ===== LOGIN AND SIGNUP SCREEN ===== */

#auth-screen {
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--background);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 30px;
  box-shadow: var(--shadow);
}

.auth-brand {
  text-align: center;
  margin-bottom: 25px;
}

.auth-brand-icon {
  font-size: 38px;
}

.auth-brand h1 {
  color: var(--forest-dark);
  font-size: 27px;
}

.auth-brand p {
  color: var(--muted);
  font-size: 13px;
}

.auth-card h2 {
  margin-bottom: 15px;
  color: var(--forest-dark);
}

.auth-switch {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.auth-switch button {
  border: 0;
  background: none;
  color: var(--forest);
  font-weight: 700;
  cursor: pointer;
}

.auth-message {
  font-size: 13px;
  margin-top: 12px;
}