:root {
  --bg: #f6f7f6;
  --surface: #ffffff;
  --text: #17201d;
  --muted: #5f6b67;
  --border: #dde3e0;
  --primary: #0f5c4d;
  --primary-text: #ffffff;
  --accent-bg: #e3f1ec;
  --now-border: #0f5c4d;
  --past: #8a948f;
  --error: #b42318;
  --warn-bg: #fff4d6;
  --warn-text: #7a5300;
  --radius: 12px;
  --gutter: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1412;
    --surface: #171e1b;
    --text: #e6ece9;
    --muted: #9aa7a2;
    --border: #2a3430;
    --primary: #3fb59a;
    --primary-text: #06120f;
    --accent-bg: #173a31;
    --now-border: #3fb59a;
    --past: #6b7672;
    --error: #ff8a80;
    --warn-bg: #3a2f12;
    --warn-text: #ffd27a;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1412;
  --surface: #171e1b;
  --text: #e6ece9;
  --muted: #9aa7a2;
  --border: #2a3430;
  --primary: #3fb59a;
  --primary-text: #06120f;
  --accent-bg: #173a31;
  --now-border: #3fb59a;
  --past: #6b7672;
  --error: #ff8a80;
  --warn-bg: #3a2f12;
  --warn-text: #ffd27a;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

h1 { font-size: 1.25rem; margin: 0; }
h2 { font-size: 1rem; margin: 0 0 8px; }

.muted { color: var(--muted); font-weight: 400; }
.error { color: var(--error); }

.btn {
  font: inherit;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 16px;
  min-height: 44px;
  cursor: pointer;
}
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); font-weight: 600; }
.btn.icon { width: 44px; padding: 0; font-size: 1.5rem; line-height: 1; }

.link {
  font: inherit;
  background: none;
  border: 0;
  padding: 4px;
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
}

.center-card {
  max-width: 420px;
  margin: 12vh auto 0;
  padding: 24px var(--gutter);
  text-align: center;
}

#login-form { display: grid; gap: 12px; margin-top: 24px; text-align: start; }
#login-form input {
  font: inherit;
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

.env-badge {
  display: inline-block;
  background: var(--warn-bg);
  color: var(--warn-text);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: .8rem;
  font-weight: 600;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px var(--gutter);
}
.week-title { display: flex; flex-direction: column; align-items: center; text-align: center; }
.tag { font-size: .8rem; color: var(--primary); font-weight: 600; }

.week {
  display: grid;
  gap: 12px;
  padding: 0 var(--gutter) var(--gutter);
}
@media (min-width: 720px) { .week { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .week { grid-template-columns: repeat(7, minmax(0, 1fr)); } }

.day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-width: 0;
}

.slots { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.slot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .9rem;
}
.slot-time { font-weight: 600; white-space: nowrap; }
.slot.past { color: var(--past); }
.slot.now { border: 2px solid var(--now-border); background: var(--accent-bg); }

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px var(--gutter) 24px;
  color: var(--muted);
  font-size: .85rem;
}

.update-banner {
  position: fixed;
  inset-inline: var(--gutter);
  bottom: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
}
