/* A weekly planner with the visual rhythm of a printed timetable. */
:root[data-theme="light"] {
  --bg: #f3f5f2;
  --bg-elev: #ffffff;
  --bg-elev-2: #eaf0ed;
  --border: #cad8d1;
  --text: #172b2c;
  --text-dim: #526764;
  --accent: #ae452d;
  --accent-hover: #8b3521;
  --danger: #a62936;
  --warn: #916008;
  --success: #136b56;
  --busy: #c1534e;
  --free: #348d73;
  --sleep: #8175b0;
  --session: #aa6a36;
  --shadow: 0 16px 36px rgba(21, 54, 57, 0.12);
  --accent-soft: #f8e9e3;
  --accent-ink: #ffffff;
  --sidebar-bg: #17383e;
  --sidebar-text: #f5f8f5;
  --sidebar-muted: #b8d0cd;
  --sidebar-line: #416168;
  --header-bg: #214b50;
  --header-text: #f6f7ef;
  --header-muted: #d2e4df;
  --header-rule: rgba(255, 255, 255, 0.12);
}

:root[data-theme="dark"] {
  --bg: #111b1e;
  --bg-elev: #1e2b2e;
  --bg-elev-2: #2a3b3d;
  --border: #3e5658;
  --text: #eff4ef;
  --text-dim: #bbceca;
  --accent: #f0a77e;
  --accent-hover: #ffc39f;
  --danger: #ff8b91;
  --warn: #ebbf72;
  --success: #73cbaa;
  --busy: #cf6867;
  --free: #428f79;
  --sleep: #877fba;
  --session: #c58e62;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.26);
  --accent-soft: #48362e;
  --accent-ink: #172b2c;
  --sidebar-bg: #0c171a;
  --sidebar-text: #eff4ef;
  --sidebar-muted: #adc4c3;
  --sidebar-line: #31474c;
  --header-bg: #28464a;
  --header-text: #f3f6ef;
  --header-muted: #c7dad5;
  --header-rule: rgba(255, 255, 255, 0.10);
}

html, body {
  font-family: "Segoe UI", "Noto Sans", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}

button, .btn, input, select, textarea { border-radius: 7px; }
button, .btn { color: var(--accent-ink); font-weight: 650; }
button:focus-visible, .btn:focus-visible, a:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-secondary, .btn-ghost, .theme-toggle { color: var(--text); }
.theme-toggle:hover { background: var(--bg-elev-2); color: var(--text); border-color: var(--accent); }
.btn-danger, .badge-danger { color: #ffffff; }
input, select, textarea { min-height: 42px; }
label { color: var(--text); font-weight: 600; }

.auth-screen {
  background-color: var(--bg);
  background-image: linear-gradient(90deg, transparent calc(100% - 1px), var(--border) 100%);
  background-size: calc(100% / 7) 100%;
}
.auth-card {
  position: relative;
  border-radius: 12px;
  border-top: 6px solid var(--accent);
  box-shadow: var(--shadow);
  max-width: 460px;
  padding: 38px;
}
.auth-card::before {
  content: "";
  display: block;
  width: 94px;
  height: 5px;
  margin-bottom: 24px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 10px, transparent 10px 15px);
}
.auth-card h1 { font-size: 36px; line-height: 1.1; letter-spacing: -0.05em; }
.auth-card .subtitle { font-size: 14px; line-height: 1.5; margin-bottom: 28px; }
.auth-tabs { border-radius: 6px; border: 1px solid var(--border); }
.auth-tabs button.active { border-radius: 4px; }

.sidebar {
  width: 268px;
  padding: 30px 18px 20px;
  gap: 24px;
  background: var(--sidebar-bg);
  border-color: var(--sidebar-line);
  color: var(--sidebar-text);
}
.brand {
  padding: 0 10px 18px;
  border-bottom: 1px solid var(--sidebar-line);
  color: var(--sidebar-text);
  font-size: 27px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.055em;
}
.brand::after {
  content: "";
  display: block;
  width: 118px;
  height: 5px;
  margin-top: 15px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 11px, transparent 11px 17px);
}
.nav-title {
  padding: 8px 10px 7px;
  font-size: 10px;
  letter-spacing: 0.14em;
  font-weight: 750;
  color: var(--sidebar-muted);
}
.sidebar .nav-item {
  min-height: 41px;
  padding: 9px 12px;
  border-radius: 7px;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 550;
  line-height: 1.35;
}
.sidebar .nav-item:hover { background: var(--sidebar-line); }
.sidebar .nav-item.active {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: none;
  font-weight: 700;
}
.sidebar .nav-item.active:hover { background: var(--accent-hover); }
.sidebar .nav-item[style] { color: var(--sidebar-muted) !important; }
.sidebar .theme-toggle {
  background: transparent;
  border: 1px solid var(--sidebar-line);
  color: var(--sidebar-text);
  border-radius: 7px;
}
.sidebar .theme-toggle:hover { background: var(--sidebar-line); color: var(--sidebar-text); }

.main { padding: 32px clamp(24px, 4vw, 68px) 54px; }
.main > * { max-width: 1380px; }
.topbar {
  position: relative;
  overflow: hidden;
  min-height: 122px;
  padding: 26px 30px;
  margin-bottom: 24px;
  border-radius: 12px;
  background: var(--header-bg);
  color: var(--header-text);
  border-left: 6px solid var(--accent);
}
.topbar::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 42%;
  pointer-events: none;
  background-image: linear-gradient(90deg, var(--header-rule) 1px, transparent 1px);
  background-size: calc(100% / 7) 100%;
}
.topbar > * { position: relative; z-index: 1; }
.page-title {
  font-size: clamp(27px, 2.2vw, 35px);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.045em;
}
.page-sub { font-size: 13px; line-height: 1.5; }
.topbar .page-sub { margin-top: 8px; color: var(--header-muted); font-size: 14px; }
.card {
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 5px 0 rgba(21, 54, 57, 0.045);
}
.card h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.01em;
}
.card h3::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--accent);
}
.grid-2 { gap: 20px; }
.list-item, .session-card, .session-detail, .notif-item, .proposal {
  border-radius: 8px;
  border: 1px solid var(--border);
}
.list-item { padding: 14px 16px; }
.list-item .name, .session-title { font-weight: 650; }
.badge { border-radius: 4px; font-weight: 700; }
.badge-accent { color: var(--accent-ink); }
.badge-warn { color: #172321; }
.badge-success { color: #172321; }
.badge-danger { color: #ffffff; }
:root[data-theme="light"] .badge-warn,
:root[data-theme="light"] .badge-success { color: #ffffff; }
:root[data-theme="dark"] .badge-danger,
:root[data-theme="dark"] .btn-danger { color: #172321; }
.code-pill { border-style: solid; border-radius: 5px; letter-spacing: 0.08em; }

.mode-toggle { border: 1px solid var(--border); border-radius: 7px; }
.schedule-grid, .session-calendar { border-radius: 8px; }
.sg-head, .sc-head { font-weight: 700; }
.sg-head, .sc-header-row { background: var(--header-bg); color: var(--header-text); }
.sc-head { color: var(--header-text); }
.sc-head .sc-date { color: var(--header-muted); }
.sg-cell:hover { outline-width: 2px; }
.sc-head.today {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: none;
}
.sc-head.today .sc-date { color: var(--accent-ink); opacity: 0.85; }
.sc-event { border-radius: 5px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.16); }
.session-detail { border-left-width: 4px; padding: 17px 18px; }
.session-detail-title { font-weight: 700; }
.session-detail-group { border-radius: 4px; border: 1px solid var(--border); }
.notif-item.notif-unread { border-left: 3px solid var(--accent); }
.toast, .modal { border-radius: 10px; }
.modal { border: 1px solid var(--border); }
.support-pill {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-weight: 650;
}
.support-pill:hover {
  background: var(--bg-elev-2);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* The Mini App uses the same type, controls and calendar without a sidebar. */
.tg-app { max-width: 760px; }
.tg-app > div:first-child {
  padding: 18px 20px;
  border-left: 5px solid var(--accent);
  border-radius: 10px;
  background: var(--header-bg);
  color: var(--header-text);
}
.tg-app > div:first-child .page-sub { color: var(--header-muted); }
.tg-app .card { box-shadow: 0 5px 0 rgba(21, 54, 57, 0.045); }
.tg-hello { font-size: 22px; font-weight: 750; letter-spacing: -0.04em; }
.tg-center .page-sub { max-width: 460px; }

/* Feedback stays on controls and surfaces that already respond to input. */
button, .btn, .sidebar .nav-item, .card, .list-item, .sc-event {
  transition: background-color 0.18s ease, border-color 0.18s ease,
    box-shadow 0.18s ease, transform 0.18s ease;
}
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px var(--accent-soft); }
.card:focus-within { border-color: var(--accent); }
button:active, .btn:active { transform: translateY(1px) scale(0.985); }
@media (hover: hover) and (pointer: fine) {
  .sidebar .nav-item:not(.active):hover { transform: translateX(3px); }
  .card:hover { box-shadow: 0 10px 24px rgba(21, 54, 57, 0.11); }
  .list-item:hover { border-color: var(--accent); }
  .sc-event:hover { transform: translateY(-2px); }
  button:not(.nav-item):not(.toast-close):hover, .btn:hover {
    box-shadow: 0 4px 12px rgba(21, 54, 57, 0.14);
  }
}
@media (prefers-reduced-motion: reduce) {
  button, .btn, .sidebar .nav-item, .card, .list-item, .sc-event {
    transition: none;
  }
}

@media (max-width: 900px) {
  .sidebar { width: 100%; padding: 16px 14px; gap: 9px; }
  .sidebar .brand { padding: 2px 8px 12px; border-bottom: 0; font-size: 23px; }
  .sidebar .brand::after { margin-top: 10px; }
  .sidebar .nav-item { background: var(--sidebar-line); }
  .sidebar .nav-item.active { box-shadow: none; }
  .main { padding: 22px 18px; }
}

@media (max-width: 600px) {
  html, body { font-size: 14px; }
  .main { padding: 16px 12px; }
  .card { padding: 17px; border-radius: 10px; }
  .auth-card { padding: 26px 22px; }
  .auth-card h1 { font-size: 31px; }
  .topbar { min-height: 0; padding: 22px 20px; border-radius: 10px; }
  .topbar::after { width: 35%; }
  .page-title { font-size: 26px; }
  .sidebar .nav-item { min-height: 36px; }
  .support-pill { bottom: 10px; right: 10px; }
  .tg-app { padding: 12px; }
}
