@font-face {
  font-family: "Noto Study";
  src: url("/public/assets/fonts/NotoSansArabic-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Noto Study";
  src: url("/public/assets/fonts/NotoSansArabic-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Big Shoulders";
  src: url("/public/assets/fonts/BigShoulders-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --font-body: "Noto Study", system-ui, sans-serif;
  --font-display: "Big Shoulders", "Noto Study", sans-serif;
  --bg: oklch(0.145 0.018 305);
  --bg-raised: oklch(0.18 0.022 305);
  --surface: oklch(0.205 0.025 305);
  --surface-strong: oklch(0.245 0.03 305);
  --surface-soft: oklch(0.175 0.018 305);
  --text: oklch(0.965 0.008 305);
  --text-soft: oklch(0.76 0.02 305);
  --text-faint: oklch(0.61 0.025 305);
  --border: oklch(0.94 0.01 305 / 0.1);
  --border-strong: oklch(0.94 0.01 305 / 0.18);
  --accent: oklch(0.705 0.145 290);
  --accent-strong: oklch(0.63 0.18 290);
  --accent-soft: oklch(0.705 0.145 290 / 0.14);
  --accent-ink: oklch(0.17 0.03 305);
  --warning: oklch(0.78 0.13 74);
  --warning-soft: oklch(0.78 0.13 74 / 0.14);
  --danger: oklch(0.68 0.18 28);
  --danger-soft: oklch(0.68 0.18 28 / 0.14);
  --success: oklch(0.73 0.12 159);
  --success-soft: oklch(0.73 0.12 159 / 0.13);
  --info: oklch(0.72 0.12 230);
  --shadow-sm: 0 1px 2px oklch(0.05 0.01 305 / 0.2), 0 8px 24px oklch(0.05 0.01 305 / 0.08);
  --shadow-lg: 0 18px 60px oklch(0.05 0.01 305 / 0.36), 0 3px 12px oklch(0.05 0.01 305 / 0.18);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --sidebar-width: 252px;
  --topbar-height: 76px;
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --content-width: 1440px;
}

html[data-theme="paper"] {
  color-scheme: light;
  --bg: oklch(0.955 0.018 80);
  --bg-raised: oklch(0.98 0.012 80);
  --surface: oklch(0.99 0.008 80);
  --surface-strong: oklch(0.925 0.025 80);
  --surface-soft: oklch(0.965 0.014 80);
  --text: oklch(0.22 0.025 55);
  --text-soft: oklch(0.42 0.03 55);
  --text-faint: oklch(0.53 0.03 55);
  --border: oklch(0.22 0.025 55 / 0.1);
  --border-strong: oklch(0.22 0.025 55 / 0.18);
  --accent: oklch(0.5 0.17 294);
  --accent-strong: oklch(0.43 0.16 294);
  --accent-soft: oklch(0.5 0.17 294 / 0.11);
  --accent-ink: oklch(0.98 0.008 80);
  --warning: oklch(0.63 0.14 64);
  --warning-soft: oklch(0.63 0.14 64 / 0.12);
  --danger: oklch(0.49 0.18 28);
  --danger-soft: oklch(0.49 0.18 28 / 0.1);
  --success: oklch(0.52 0.13 154);
  --success-soft: oklch(0.52 0.13 154 / 0.1);
  --info: oklch(0.53 0.13 238);
  --shadow-sm: 0 1px 2px oklch(0.25 0.03 55 / 0.06), 0 10px 24px oklch(0.25 0.03 55 / 0.05);
  --shadow-lg: 0 22px 70px oklch(0.25 0.03 55 / 0.16), 0 4px 14px oklch(0.25 0.03 55 / 0.08);
}

html[data-theme="midnight"] {
  --bg: oklch(0.105 0.015 255);
  --bg-raised: oklch(0.145 0.02 255);
  --surface: oklch(0.175 0.025 255);
  --surface-strong: oklch(0.22 0.035 255);
  --surface-soft: oklch(0.135 0.02 255);
  --text: oklch(0.97 0.008 250);
  --text-soft: oklch(0.75 0.025 250);
  --text-faint: oklch(0.59 0.03 250);
  --border: oklch(0.95 0.01 250 / 0.09);
  --border-strong: oklch(0.95 0.01 250 / 0.16);
  --accent: oklch(0.72 0.13 225);
  --accent-strong: oklch(0.62 0.17 225);
  --accent-soft: oklch(0.72 0.13 225 / 0.13);
  --accent-ink: oklch(0.12 0.025 255);
}

html[data-theme="sage"] {
  color-scheme: light;
  --bg: oklch(0.94 0.018 142);
  --bg-raised: oklch(0.975 0.012 142);
  --surface: oklch(0.99 0.008 142);
  --surface-strong: oklch(0.9 0.035 142);
  --surface-soft: oklch(0.955 0.018 142);
  --text: oklch(0.215 0.035 142);
  --text-soft: oklch(0.35 0.04 142);
  --text-faint: oklch(0.41 0.04 142);
  --border: oklch(0.215 0.035 142 / 0.1);
  --border-strong: oklch(0.215 0.035 142 / 0.17);
  --accent: oklch(0.37 0.12 147);
  --accent-strong: oklch(0.31 0.11 147);
  --accent-soft: oklch(0.37 0.12 147 / 0.11);
  --accent-ink: oklch(0.98 0.008 142);
  --danger: oklch(0.39 0.17 28);
  --danger-soft: oklch(0.39 0.17 28 / 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-synthesis: none;
  overflow-x: hidden;
}

.skip-link {
  position: fixed;
  inset-block-start: -100px;
  inset-inline-start: 10px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  transition: inset-block-start 150ms var(--ease-out);
}

.skip-link:focus-visible { inset-block-start: 10px; }

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
}

button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  touch-action: manipulation;
}

button {
  border: 0;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border: 3px solid var(--bg);
  border-radius: 999px;
  background: var(--surface-strong);
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-width);
  grid-template-rows: var(--topbar-height) minmax(0, 1fr);
  grid-template-areas:
    "topbar sidebar"
    "main sidebar";
}

.sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-end: 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar-width);
  padding: 26px 18px 18px;
  border-inline-start: 1px solid var(--border);
  background: var(--bg-raised);
  flex-direction: column;
  overflow: hidden;
}

.brand {
  display: flex;
  width: fit-content;
  margin: 0 10px 30px;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex: 0 0 auto;
}

.brand-logo-frame {
  display: grid;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  place-content: center;
  flex: 0 0 auto;
}

.brand-logo {
  display: block;
  width: 78px;
  height: 78px;
  max-width: none;
  object-fit: contain;
}

.brand > span:last-child {
  direction: ltr;
  line-height: 0.78;
}

.brand strong,
.brand small {
  display: block;
  font-family: var(--font-display);
  letter-spacing: 0.055em;
}

.brand strong { font-size: 1.15rem; }
.brand small { margin-top: 7px; color: var(--accent); font-size: 0.9rem; }

.main-nav,
.custom-section-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.main-nav { flex: 0 0 auto; }

.nav-item {
  position: relative;
  display: grid;
  min-height: 46px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  text-align: start;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out), transform 140ms var(--ease-out);
}

.nav-item svg { width: 20px; height: 20px; }
.nav-item b {
  display: grid;
  min-width: 22px;
  height: 22px;
  padding-inline: 6px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  place-items: center;
}

@media (hover: hover) and (pointer: fine) {
  .nav-item:hover,
  .icon-button:hover,
  .search-trigger:hover,
  .platform-link:hover,
  .text-button:hover {
    background-color: var(--surface-strong);
    color: var(--text);
  }
}

.nav-item:active,
.icon-button:active,
.button:active,
.platform-link:active,
.task-check:active,
.theme-card:active {
  transform: scale(0.96);
}

.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-item.is-active::after {
  position: absolute;
  inset-block: 13px;
  inset-inline-end: -18px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  content: "";
}

.nav-section {
  flex: 0 0 auto;
  min-height: 0;
  margin-top: 24px;
  overflow: visible;
}

.nav-section-label {
  display: flex;
  min-height: 40px;
  padding: 0 12px;
  color: var(--text-faint);
  font-size: 0.77rem;
  align-items: center;
  justify-content: space-between;
}

.custom-section-icon {
  display: grid;
  width: 24px;
  height: 24px;
  font-size: 1rem;
  place-items: center;
}

.sidebar-footer {
  display: flex;
  flex: 0 0 auto;
  margin-top: auto;
  padding-top: 16px;
  flex-direction: column;
  gap: 10px;
}

.mini-profile {
  display: grid;
  min-height: 64px;
  padding: 9px 8px;
  border-top: 1px solid var(--border);
  grid-template-columns: 40px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 10px;
}

.mini-profile strong,
.mini-profile span { display: block; }
.mini-profile strong { overflow: hidden; font-size: 0.88rem; text-overflow: ellipsis; white-space: nowrap; }
.mini-profile span { margin-top: 2px; color: var(--text-faint); font-size: 0.68rem; }
.online-dot { display: inline-block; width: 6px; height: 6px; margin-inline-end: 3px; border-radius: 50%; background: var(--success); }

.avatar {
  display: grid;
  flex: none;
  overflow: hidden;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-weight: 700;
  place-items: center;
  outline: 1px solid oklch(1 0 0 / 0.1);
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 40px; height: 40px; font-size: 1.1rem; }

.topbar {
  position: sticky;
  inset-block-start: 0;
  z-index: 15;
  grid-area: topbar;
  display: flex;
  height: var(--topbar-height);
  padding: 0 clamp(22px, 3.2vw, 48px);
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
  align-items: center;
  justify-content: space-between;
}

.search-trigger {
  display: flex;
  width: min(430px, 42vw);
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--text-faint);
  cursor: pointer;
  align-items: center;
  gap: 10px;
  text-align: start;
  transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out), color 160ms var(--ease-out), transform 140ms var(--ease-out);
}

.search-trigger span { flex: 1; }
kbd {
  padding: 3px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-faint);
  direction: ltr;
  font-family: inherit;
  font-size: 0.68rem;
  box-shadow: inset 0 -1px 0 var(--border-strong);
}

.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  place-items: center;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out), transform 140ms var(--ease-out);
}
.icon-button.compact { width: 36px; height: 36px; border-radius: 10px; }
.notification-button { position: relative; }
.notification-button i {
  position: absolute;
  inset-block-start: 8px;
  inset-inline-start: 8px;
  width: 7px;
  height: 7px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--danger);
}
.notification-button i.is-hidden { display: none; }

.platform-link {
  display: flex;
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out), transform 140ms var(--ease-out);
}

.main-content {
  grid-area: main;
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding: 36px clamp(22px, 3.2vw, 48px) 64px;
}

.page-enter {
  animation: page-enter 280ms var(--ease-out) both;
}

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

.page-header {
  display: flex;
  margin-bottom: 30px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.page-header h1,
.page-header h2,
.section-heading h2,
.dialog-header h2 {
  margin: 0;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.page-header h1,
.page-header h2 { font-size: clamp(1.75rem, 2.6vw, 2.5rem); }
.page-header p,
.section-heading p,
.dialog-header p {
  margin: 6px 0 0;
  color: var(--text-soft);
  line-height: 1.7;
  text-wrap: pretty;
}

.page-actions { display: flex; align-items: center; gap: 10px; }
.button {
  display: inline-flex;
  min-height: 44px;
  padding: 0 17px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out), box-shadow 160ms var(--ease-out), transform 140ms var(--ease-out);
}

.button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 1px 1px oklch(0.05 0.01 305 / 0.24), 0 7px 18px color-mix(in oklch, var(--accent) 22%, transparent);
}
.button.secondary { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); }
.button.ghost { background: transparent; color: var(--text-soft); }
.button.danger { background: var(--danger); color: oklch(0.99 0 0); }
.button.small { min-height: 38px; padding-inline: 13px; font-size: 0.82rem; }
.button:disabled { cursor: not-allowed; opacity: 0.5; transform: none; }
.text-button {
  min-height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out);
}

.profile-stage {
  position: relative;
  min-height: 268px;
  margin-bottom: 26px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  box-shadow: var(--shadow-sm);
}

.profile-banner {
  position: absolute;
  inset: 0;
  background-color: oklch(0.155 0.026 305);
  background-image:
    linear-gradient(180deg, oklch(0.12 0.02 305 / 0.18), oklch(0.09 0.02 305 / 0.9)),
    linear-gradient(90deg, transparent 0 12%, color-mix(in oklch, var(--accent) 70%, transparent) 12% 23%, transparent 23% 30%, oklch(0.97 0.008 305 / 0.82) 30% 44%, transparent 44% 51%, color-mix(in oklch, var(--danger) 72%, transparent) 51% 62%, transparent 62% 70%, color-mix(in oklch, var(--warning) 78%, transparent) 70% 82%, transparent 82%);
  background-position: center;
  background-size: cover;
}

.profile-stage.has-banner .profile-banner { background-image: linear-gradient(180deg, transparent 15%, oklch(0.09 0.02 305 / 0.86)), var(--profile-banner); }

.profile-stage-content {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 268px;
  padding: clamp(24px, 4vw, 46px);
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}

.profile-copy { display: flex; min-width: 0; align-items: center; gap: 20px; }
.profile-copy > div:last-child { min-width: 0; }
.profile-copy .avatar {
  width: 80px;
  height: 80px;
  border: 5px solid oklch(0.15 0.02 305);
  font-size: 2rem;
  box-shadow: 0 12px 32px oklch(0.05 0.01 305 / 0.28);
}
.profile-copy h1 { margin: 0; font-size: clamp(1.65rem, 3vw, 2.7rem); letter-spacing: -0.03em; text-wrap: balance; }
.profile-copy p { margin: 7px 0 0; color: oklch(0.84 0.02 305); }
.profile-streak {
  display: flex;
  min-width: 155px;
  padding: 14px 17px;
  border: 1px solid oklch(1 0 0 / 0.12);
  border-radius: var(--radius-md);
  background: oklch(0.12 0.02 305 / 0.72);
  align-items: center;
  gap: 12px;
  backdrop-filter: blur(8px);
}
.profile-streak svg { color: var(--warning); }
.profile-streak strong,
.profile-streak span { display: block; }
.profile-streak strong { font-size: 0.9rem; }
.profile-streak span { margin-top: 2px; color: oklch(0.78 0.02 305); font-size: 0.72rem; }

.day-progress {
  display: grid;
  margin-bottom: 26px;
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  grid-template-columns: minmax(160px, 0.72fr) minmax(240px, 2fr) auto;
  align-items: center;
  gap: 24px;
}
.progress-copy span,
.progress-copy strong { display: block; }
.progress-copy span { color: var(--text-soft); font-size: 0.78rem; }
.progress-copy strong { margin-top: 2px; font-size: 1.15rem; }
.progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: var(--surface-strong); }
.progress-track i { display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--accent); transform: scaleX(var(--progress-scale, 0)); transform-origin: right center; transition: transform 260ms var(--ease-out); }
.progress-number { min-width: 72px; color: var(--accent); font-family: var(--font-display); font-size: 2.25rem; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; text-align: end; }

.widget-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
}

.widget {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.widget[data-widget="today"] { grid-column: span 7; }
.widget[data-widget="exam"] { grid-column: span 5; }
.widget[data-widget="platform"] { grid-column: span 5; }
.widget[data-widget="schedule"] { grid-column: span 7; }
.widget[data-widget="week"] { grid-column: span 7; }
.widget[data-widget="files"] { grid-column: span 5; }

.section-heading {
  display: flex;
  margin-bottom: 20px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.section-heading h2 { font-size: 1.08rem; }
.section-heading p { font-size: 0.78rem; }
.section-heading .meta { color: var(--text-faint); font-size: 0.75rem; }

.task-list { display: flex; flex-direction: column; }
.task-row {
  display: grid;
  min-height: 78px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.task-row:first-child { border-top: 0; }
.task-check {
  display: grid;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: transparent;
  color: transparent;
  cursor: pointer;
  place-items: center;
  transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out), color 160ms var(--ease-out), transform 140ms var(--ease-out);
}
.task-check svg { width: 18px; height: 18px; }
.task-check.is-done { border-color: var(--success); background: var(--success); color: oklch(0.15 0.03 155); }
.task-row-main { min-width: 0; }
.task-row-main h3 { margin: 0; overflow: hidden; font-size: 0.92rem; text-overflow: ellipsis; white-space: nowrap; }
.task-row-main p { margin: 5px 0 0; overflow: hidden; color: var(--text-soft); font-size: 0.73rem; text-overflow: ellipsis; white-space: nowrap; }
.task-row-meta { display: flex; color: var(--text-faint); font-size: 0.72rem; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.priority-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.priority-dot.important { background: var(--warning); }
.priority-dot.urgent { background: var(--danger); }
.task-row.is-complete .task-row-main h3 { color: var(--text-faint); text-decoration: line-through; }

.empty-state {
  display: grid;
  min-height: 180px;
  color: var(--text-soft);
  text-align: center;
  place-items: center;
}
.empty-state svg { width: 32px; height: 32px; margin-bottom: 10px; color: var(--accent); }
.empty-state strong,
.empty-state span { display: block; }
.empty-state strong { color: var(--text); }
.empty-state span { margin-top: 5px; font-size: 0.8rem; }

.exam-countdown {
  display: flex;
  min-height: 252px;
  flex-direction: column;
}
.exam-subject { display: flex; align-items: center; gap: 10px; }
.exam-subject i { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.exam-subject strong { font-size: 0.92rem; }
.countdown-value {
  margin: auto 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(3.4rem, 7vw, 6.2rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  line-height: 0.8;
}
.countdown-value small { margin-inline-start: 7px; color: var(--text-faint); font-family: var(--font-body); font-size: 0.82rem; }
.countdown-details { display: flex; padding-top: 18px; border-top: 1px solid var(--border); color: var(--text-soft); font-size: 0.76rem; justify-content: space-between; gap: 12px; }

.platform-checkin {
  display: grid;
  min-height: 196px;
  grid-template-columns: minmax(0, 1fr) 72px;
  align-items: center;
  gap: 22px;
}
.platform-checkin .platform-glyph {
  display: grid;
  width: 72px;
  height: 72px;
  border-radius: 24px;
  background: var(--accent-soft);
  color: var(--accent);
  place-items: center;
}
.platform-glyph svg { width: 30px; height: 30px; }
.platform-checkin h2 { margin: 0; font-size: 1.25rem; }
.platform-checkin p { margin: 8px 0 18px; color: var(--text-soft); font-size: 0.82rem; line-height: 1.7; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.schedule-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.day-chip { padding: 12px 10px; border-radius: var(--radius-sm); background: var(--surface-soft); text-align: center; }
.day-chip span,
.day-chip strong { display: block; }
.day-chip span { color: var(--text-faint); font-size: 0.68rem; }
.day-chip strong { margin-top: 5px; font-size: 0.8rem; }
.day-chip.is-today { background: var(--accent); color: var(--accent-ink); }
.day-chip.is-today span { color: color-mix(in oklch, var(--accent-ink) 75%, transparent); }

.week-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; }
.week-stat { min-height: 100px; padding: 12px 15px; border-inline-start: 1px solid var(--border); }
.week-stat:last-child { border-inline-start: 0; }
.week-stat strong,
.week-stat span { display: block; }
.week-stat strong { font-family: var(--font-display); font-size: 2rem; font-variant-numeric: tabular-nums; }
.week-stat span { margin-top: 8px; color: var(--text-soft); font-size: 0.74rem; }

.file-preview-list { display: flex; flex-direction: column; gap: 8px; }
.file-preview {
  display: grid;
  min-height: 54px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}
.file-type { display: grid; width: 38px; height: 38px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 0.62rem; font-weight: 700; place-items: center; }
.file-preview strong,
.file-preview span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview .file-type { color: var(--danger); }
.file-preview strong { font-size: 0.78rem; }
.file-preview span { margin-top: 2px; color: var(--text-faint); font-size: 0.66rem; }

.filter-bar {
  display: flex;
  margin-bottom: 18px;
  padding-bottom: 2px;
  overflow-x: auto;
  align-items: center;
  gap: 8px;
}
.filter-chip {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  flex: none;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}
.filter-chip.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.item-board {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.item-row {
  display: grid;
  min-height: 88px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  grid-template-columns: 42px minmax(160px, 1.3fr) minmax(120px, .8fr) minmax(110px, .65fr) 42px;
  align-items: center;
  gap: 16px;
}
.item-row:first-child { border-top: 0; }
.item-title strong,
.item-title span { display: block; }
.item-title strong { font-size: 0.9rem; }
.item-title span { margin-top: 4px; color: var(--text-faint); font-size: 0.7rem; }
.item-detail { color: var(--text-soft); font-size: 0.76rem; }
.badge {
  display: inline-flex;
  width: fit-content;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-soft);
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  white-space: nowrap;
}
.badge.urgent { background: var(--danger-soft); color: var(--danger); }
.badge.important { background: var(--warning-soft); color: var(--warning); }
.badge.done { background: var(--success-soft); color: var(--success); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

.exam-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.exam-card {
  position: relative;
  min-height: 265px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.exam-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.exam-card h2 { margin: 0; font-size: 1.05rem; }
.exam-card header p { margin: 5px 0 0; color: var(--text-faint); font-size: 0.72rem; }
.exam-card .exam-days { margin: 34px 0 28px; font-family: var(--font-display); font-size: 3.4rem; font-variant-numeric: tabular-nums; line-height: 0.9; }
.exam-card .exam-days small { margin-inline-start: 5px; color: var(--text-faint); font-family: var(--font-body); font-size: .75rem; }
.exam-card dl { display: grid; margin: 0; grid-template-columns: 1fr 1fr; gap: 12px; }
.exam-card dt { color: var(--text-faint); font-size: 0.65rem; }
.exam-card dd { margin: 3px 0 0; font-size: 0.76rem; }
.study-bar { height: 5px; margin-top: 22px; overflow: hidden; border-radius: 99px; background: var(--surface-strong); }
.study-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

.schedule-board {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.schedule-table { width: 100%; min-width: 820px; border-collapse: collapse; table-layout: fixed; }
.schedule-table th,
.schedule-table td { height: 76px; padding: 10px; border-inline-start: 1px solid var(--border); border-top: 1px solid var(--border); text-align: center; }
.schedule-table th:first-child,
.schedule-table td:first-child { border-inline-start: 0; }
.schedule-table thead th { height: 60px; border-top: 0; color: var(--text-soft); font-size: 0.76rem; }
.schedule-table tbody th { width: 86px; color: var(--text-faint); font-size: 0.7rem; font-variant-numeric: tabular-nums; }
.lesson-cell {
  width: 100%;
  min-height: 52px;
  padding: 7px;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  transition: background-color 160ms var(--ease-out), transform 140ms var(--ease-out);
}
.lesson-cell span,
.lesson-cell small { display: block; }
.lesson-cell span { font-size: 0.76rem; font-weight: 700; }
.lesson-cell small { margin-top: 4px; color: var(--text-faint); font-size: 0.62rem; }
.lesson-cell.is-empty { color: var(--text-faint); font-weight: 400; }

.library-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; }
.folder-list,
.file-library { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); }
.folder-list { padding: 10px; }
.folder-button { display: flex; width: 100%; min-height: 44px; padding: 0 12px; border-radius: 10px; background: transparent; color: var(--text-soft); cursor: pointer; align-items: center; justify-content: space-between; }
.folder-button.is-active { background: var(--accent-soft); color: var(--accent); }
.folder-button small { font-variant-numeric: tabular-nums; }
.file-library { overflow: hidden; }
.file-row { display: grid; min-height: 72px; padding: 10px 16px; border-top: 1px solid var(--border); grid-template-columns: 42px minmax(0, 1fr) 120px 90px 42px; align-items: center; gap: 12px; }
.file-row:first-child { border-top: 0; }

.notes-grid { columns: 3 260px; column-gap: 16px; }
.note-card { margin: 0 0 16px; padding: 20px; break-inside: avoid; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); }
.note-card h2 { margin: 0; font-size: .98rem; }
.note-card p { margin: 12px 0 0; color: var(--text-soft); font-size: .79rem; line-height: 1.9; white-space: pre-wrap; }
.note-card footer { display: flex; margin-top: 18px; color: var(--text-faint); font-size: .66rem; justify-content: space-between; }

.focus-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); min-height: 570px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-lg); }
.focus-clock { display: flex; padding: clamp(30px, 6vw, 72px); background: var(--surface-soft); flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.focus-clock-label { color: var(--text-faint); font-size: .75rem; }
.timer-digits { margin: 26px 0 34px; font-family: var(--font-display); font-size: clamp(5.6rem, 12vw, 9.6rem); font-variant-numeric: tabular-nums; letter-spacing: .02em; line-height: .72; }
.timer-actions { display: flex; align-items: center; justify-content: center; gap: 10px; }
.timer-presets { display: flex; margin-top: 32px; gap: 8px; }
.focus-context { display: flex; padding: 34px; border-inline-start: 1px solid var(--border); flex-direction: column; }
.focus-context h2 { margin: 0; font-size: 1.15rem; }
.focus-context > p { margin: 8px 0 26px; color: var(--text-soft); font-size: .8rem; line-height: 1.8; }
.focus-steps { display: flex; flex-direction: column; gap: 10px; }
.focus-step { display: flex; min-height: 48px; padding: 8px 10px; border-radius: 10px; background: var(--surface-soft); align-items: center; gap: 10px; }
.focus-step input { width: 18px; height: 18px; accent-color: var(--accent); }
.focus-stats { display: grid; margin-top: auto; padding-top: 26px; border-top: 1px solid var(--border); grid-template-columns: 1fr 1fr; gap: 16px; }
.focus-stat strong,
.focus-stat span { display: block; }
.focus-stat strong { font-family: var(--font-display); font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.focus-stat span { color: var(--text-faint); font-size: .68rem; }

.settings-layout { display: grid; grid-template-columns: 210px minmax(0, 760px); align-items: start; gap: 32px; }
.settings-nav { position: sticky; top: calc(var(--topbar-height) + 28px); display: flex; flex-direction: column; gap: 4px; }
.settings-nav button { min-height: 42px; padding: 0 12px; border-radius: 10px; background: transparent; color: var(--text-soft); cursor: pointer; text-align: start; }
.settings-nav button.is-active { background: var(--accent-soft); color: var(--accent); }
.settings-content { display: flex; flex-direction: column; gap: 34px; }
.settings-section { padding-bottom: 34px; border-bottom: 1px solid var(--border); scroll-margin-top: calc(var(--topbar-height) + 24px); }
.settings-section:last-child { border-bottom: 0; }
.settings-section h2 { margin: 0; font-size: 1.05rem; }
.settings-section > p { margin: 7px 0 22px; color: var(--text-soft); font-size: .79rem; line-height: 1.8; }
.setting-row { display: grid; min-height: 68px; padding: 12px 0; border-top: 1px solid var(--border); grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 24px; }
.setting-row:first-of-type { border-top: 0; }
.setting-copy strong,
.setting-copy span { display: block; }
.setting-copy strong { font-size: .86rem; }
.setting-copy span { margin-top: 4px; color: var(--text-faint); font-size: .7rem; }
.switch { position: relative; display: inline-flex; padding: 8px; margin: -8px; flex: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { display: block; width: 48px; height: 28px; border-radius: 999px; background: var(--surface-strong); cursor: pointer; transition: background-color 180ms var(--ease-out); }
.switch span::after { display: block; width: 22px; height: 22px; margin: 3px; border-radius: 50%; background: var(--text); content: ""; box-shadow: 0 2px 7px oklch(0.05 0.01 305 / .26); transition: transform 180ms var(--ease-out); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(-20px); background: var(--accent-ink); }
.switch input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 3px; }

.theme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.theme-card { padding: 8px; border: 2px solid transparent; border-radius: var(--radius-md); background: transparent; color: var(--text); cursor: pointer; text-align: start; transition: border-color 160ms var(--ease-out), transform 140ms var(--ease-out); }
.theme-card.is-active { border-color: var(--accent); }
.theme-swatch { display: flex; height: 90px; padding: 12px; border-radius: 11px; align-items: flex-end; gap: 5px; }
.theme-swatch i { width: 20%; border-radius: 4px; }
.theme-swatch i:nth-child(1) { height: 40%; }
.theme-swatch i:nth-child(2) { height: 74%; }
.theme-swatch i:nth-child(3) { height: 55%; }
.theme-card strong { display: block; margin-top: 8px; font-size: .76rem; }
.swatch-night { background: oklch(0.16 0.02 305); }
.swatch-night i { background: oklch(0.7 0.145 290); }
.swatch-paper { background: oklch(0.955 0.018 80); }
.swatch-paper i { background: oklch(0.57 0.16 294); }
.swatch-midnight { background: oklch(0.105 0.015 255); }
.swatch-midnight i { background: oklch(0.72 0.13 225); }
.swatch-sage { background: oklch(0.94 0.018 142); }
.swatch-sage i { background: oklch(0.55 0.13 147); }

.channel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.channel-card { padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-soft); }
.channel-card header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.channel-card svg { color: var(--accent); }
.channel-card h3 { margin: 16px 0 5px; font-size: .88rem; }
.channel-card p { margin: 0 0 16px; color: var(--text-faint); font-size: .7rem; line-height: 1.7; }
.channel-card .status-line { display: flex; color: var(--text-soft); font-size: .68rem; align-items: center; gap: 6px; }
.channel-card .status-line i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); }
.channel-card .status-line i.connected { background: var(--success); }

.reminder-table { width: 100%; border-collapse: collapse; }
.reminder-table th,
.reminder-table td { min-height: 52px; padding: 13px 8px; border-top: 1px solid var(--border); text-align: start; font-size: .74rem; }
.reminder-table thead th { border-top: 0; color: var(--text-faint); font-size: .66rem; }
.time-input { width: 112px; min-height: 38px; padding: 0 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-soft); }
.quiet-time-controls { display: flex; margin-top: 11px; align-items: center; gap: 8px; }
.quiet-time-controls b { color: var(--text-faint); font-size: .68rem; font-weight: 400; }
.quiet-time-controls .time-input { width: 102px; }
input[type="range"] { width: min(210px, 44vw); accent-color: var(--accent); }

.app-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(86vh, 860px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overscroll-behavior: contain;
}
.app-dialog[open] { animation: dialog-enter 220ms var(--ease-out) both; }
.app-dialog::backdrop { background: oklch(0.08 0.018 305 / .66); backdrop-filter: blur(3px); }
@keyframes dialog-enter { from { opacity: 0; transform: scale(.97) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.app-dialog form { margin: 0; }
.dialog-header { display: flex; min-height: 86px; padding: 20px 22px; border-bottom: 1px solid var(--border); align-items: flex-start; justify-content: space-between; gap: 20px; }
.dialog-header h2 { font-size: 1.13rem; }
.dialog-header p { font-size: .73rem; }
.dialog-body { max-height: calc(86vh - 164px); padding: 22px; overflow-y: auto; }
.dialog-footer,
.panel-footer { display: flex; min-height: 76px; padding: 15px 22px; border-top: 1px solid var(--border); align-items: center; justify-content: flex-end; gap: 9px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: flex; min-width: 0; flex-direction: column; gap: 8px; }
.field-wide { grid-column: 1 / -1; }
.field > span { color: var(--text-soft); font-size: .75rem; }
.field em { color: var(--text-faint); font-style: normal; }
.field input,
.field textarea,
.field select,
.command-input input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--text);
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: border-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out), background-color 150ms var(--ease-out);
}
.field textarea { min-height: 84px; resize: vertical; line-height: 1.7; }
.field input::placeholder,
.field textarea::placeholder,
.command-input input::placeholder { color: var(--text-faint); opacity: .8; }
.field input:focus-visible,
.field textarea:focus-visible,
.field select:focus-visible,
.command-input input:focus-visible { border-color: var(--accent); outline-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.file-field { display: flex; min-height: 92px; padding: 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-soft); cursor: pointer; align-items: center; gap: 14px; }
.file-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.file-field input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-field svg { color: var(--accent); }
.file-field strong,
.file-field small { display: block; }
.file-field strong { font-size: .78rem; }
.file-field small { margin-top: 4px; color: var(--text-faint); font-size: .68rem; }
.small-dialog { width: min(500px, calc(100vw - 32px)); }

.search-dialog { width: min(650px, calc(100vw - 24px)); border-radius: 18px; transform-origin: top center; }
.search-dialog form { padding: 0; }
.command-input { display: grid; min-height: 64px; padding: 10px 14px; border-bottom: 1px solid var(--border); grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.command-input input { border: 0; background: transparent; box-shadow: none; }
.command-input input:focus-visible { border-color: transparent; outline-color: transparent; box-shadow: none; }
.search-results { max-height: min(65vh, 500px); padding: 9px; overflow-y: auto; }
.search-group-label { padding: 10px 12px 6px; color: var(--text-faint); font-size: .65rem; }
.search-result { display: grid; width: 100%; min-height: 58px; padding: 9px 11px; border-radius: 10px; background: transparent; color: var(--text); cursor: pointer; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 10px; text-align: start; }
.search-result:hover { background: var(--surface-strong); }
.search-result:focus-visible { background: var(--surface-strong); outline: 2px solid var(--accent); outline-offset: -2px; }
.search-result > svg { width: 18px; height: 18px; color: var(--accent); }
.search-result strong,
.search-result span { display: block; }
.search-result strong { font-size: .78rem; }
.search-result span { margin-top: 3px; color: var(--text-faint); font-size: .66rem; }
.search-result kbd { color: var(--text-faint); }

.side-dialog { width: min(430px, 100vw); height: 100vh; max-height: 100vh; margin: 0 0 0 auto; border-radius: 0; border-block: 0; border-inline-start: 1px solid var(--border-strong); }
.side-dialog[open] { animation: side-enter 260ms var(--ease-drawer) both; }
@keyframes side-enter { from { opacity: .6; transform: translateX(-100%); } to { opacity: 1; transform: translateX(0); } }
.panel-content { display: flex; height: 100%; flex-direction: column; }
.notification-list,
.widget-controls { padding: 8px 16px; overflow-y: auto; flex: 1; }
.notification-item { display: grid; min-height: 88px; padding: 14px 8px; border-top: 1px solid var(--border); grid-template-columns: 38px minmax(0, 1fr); gap: 12px; }
.notification-item:first-child { border-top: 0; }
.notification-icon { display: grid; width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); place-items: center; }
.notification-icon svg { width: 18px; height: 18px; }
.notification-item strong,
.notification-item span { display: block; }
.notification-item strong { font-size: .78rem; }
.notification-item p { margin: 4px 0; color: var(--text-soft); font-size: .72rem; line-height: 1.7; }
.notification-item span { color: var(--text-faint); font-size: .63rem; }
.notification-item.is-read { opacity: .58; }
.panel-footer { justify-content: space-between; }
.widget-control { display: grid; min-height: 66px; padding: 10px 4px; border-top: 1px solid var(--border); grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.widget-control:first-child { border-top: 0; }
.widget-control > svg { color: var(--text-faint); }
.widget-control strong,
.widget-control small { display: block; }
.widget-control strong { font-size: .8rem; }
.widget-control small { margin-top: 3px; color: var(--text-faint); font-size: .65rem; }
.reorder-actions { display: flex; gap: 2px; }
.reorder-actions button { width: 36px; height: 36px; border-radius: 9px; background: transparent; color: var(--text-soft); cursor: pointer; }

.toast-region { position: fixed; inset-block-start: 18px; inset-inline-start: 18px; z-index: 80; display: flex; width: min(360px, calc(100vw - 36px)); flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: grid; min-height: 62px; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); grid-template-columns: 26px minmax(0, 1fr); align-items: center; gap: 10px; pointer-events: auto; transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out); }
@starting-style {
  .toast { opacity: 0; transform: translateY(-8px); }
}
.toast svg { color: var(--success); }
.toast strong,
.toast span { display: block; }
.toast strong { font-size: .78rem; }
.toast span { margin-top: 3px; color: var(--text-soft); font-size: .68rem; }
.toast.is-leaving { opacity: 0; transform: translateY(-6px); }

.mobile-nav { display: none; }

.login-page { display: grid; min-height: 100vh; background: var(--bg); grid-template-columns: minmax(0, .95fr) minmax(420px, 1.05fr); }
.login-art { position: relative; min-height: 100vh; overflow: hidden; background: url("/design/brand-canvas.png") center / cover no-repeat; }
.login-art::after { position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--bg)); content: ""; }
.login-panel { display: flex; max-width: 560px; padding: clamp(38px, 8vw, 110px); flex-direction: column; justify-content: center; }
.login-panel .brand { margin: 0 0 72px; }
.login-panel h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.6rem); letter-spacing: -.04em; line-height: 1.25; text-wrap: balance; }
.login-panel > p { margin: 18px 0 34px; color: var(--text-soft); line-height: 1.9; text-wrap: pretty; }
.login-error { max-width: 520px; margin: -12px 0 20px; padding: 12px 14px; border: 1px solid var(--danger); border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--text); font-size: .76rem; line-height: 1.7; }
.discord-button { width: 100%; min-height: 54px; background: oklch(0.52 0.17 277); color: oklch(0.99 0 0); }
.login-note { margin-top: 16px; color: var(--text-faint); font-size: .7rem; text-align: center; }

.focus-popup { display: grid; min-height: 100vh; padding: 20px; background: var(--bg); place-items: center; text-align: center; }
.focus-popup .timer-digits { font-size: clamp(4rem, 25vw, 7rem); }
.focus-popup h1 { margin: 0 0 10px; color: var(--text-soft); font-size: .85rem; font-weight: 400; }

@media (max-width: 1160px) {
  :root { --sidebar-width: 224px; }
  .widget[data-widget] { grid-column: span 6; }
  .widget[data-widget="today"],
  .widget[data-widget="schedule"] { grid-column: span 7; }
  .widget[data-widget="exam"],
  .widget[data-widget="platform"] { grid-column: span 5; }
  .exam-grid { grid-template-columns: repeat(2, 1fr); }
  .theme-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  :root { --topbar-height: 64px; }
  .app-shell { display: block; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .sidebar { display: none; }
  .topbar { height: var(--topbar-height); padding-inline: 16px; }
  .search-trigger { width: min(54vw, 360px); }
  .search-trigger kbd { display: none; }
  .platform-link span { display: none; }
  .main-content { padding: 24px 16px 40px; }
  .mobile-nav {
    position: fixed;
    inset-inline: 10px;
    inset-block-end: max(10px, env(safe-area-inset-bottom));
    z-index: 35;
    display: grid;
    height: 64px;
    padding: 6px;
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    background: color-mix(in oklch, var(--bg-raised) 92%, transparent);
    box-shadow: var(--shadow-lg);
    grid-template-columns: repeat(5, 1fr);
    backdrop-filter: blur(18px);
  }
  .mobile-nav button { display: flex; min-width: 0; border-radius: 14px; background: transparent; color: var(--text-faint); cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
  .mobile-nav button svg { width: 20px; height: 20px; }
  .mobile-nav button span { font-size: .62rem; }
  .mobile-nav button.is-active { background: var(--accent-soft); color: var(--accent); }
  .mobile-nav .mobile-add { width: 52px; height: 52px; margin: 0 auto; border-radius: 18px; background: var(--accent); color: var(--accent-ink); transform: translateY(-11px); box-shadow: 0 12px 24px color-mix(in oklch, var(--accent) 24%, transparent); }
  .mobile-nav .mobile-add:active { transform: translateY(-11px) scale(.96); }
  .widget[data-widget] { grid-column: 1 / -1; }
  .profile-stage-content { align-items: flex-end; }
  .profile-streak { min-width: 0; }
  .day-progress { grid-template-columns: minmax(0, 1fr) auto; gap: 16px; }
  .progress-track { grid-column: 1 / -1; grid-row: 2; }
  .exam-grid { grid-template-columns: 1fr 1fr; }
  .settings-layout { grid-template-columns: 1fr; gap: 20px; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
  .settings-nav button { flex: none; }
  .focus-layout { grid-template-columns: 1fr; }
  .focus-context { border-inline-start: 0; border-top: 1px solid var(--border); }
  .library-layout { grid-template-columns: 1fr; }
  .folder-list { display: flex; overflow-x: auto; }
  .folder-button { width: auto; flex: none; gap: 18px; }
  .notes-grid { columns: 2 240px; }
}

@media (max-width: 620px) {
  .top-actions { gap: 2px; }
  .platform-link { min-width: 42px; padding: 0; justify-content: center; }
  .search-trigger { width: calc(100vw - 166px); }
  .search-trigger span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page-header { align-items: flex-start; flex-direction: column; gap: 16px; }
  .page-actions { width: 100%; }
  .page-actions .button { flex: 1; }
  .profile-stage { min-height: 310px; }
  .profile-stage-content { min-height: 310px; padding: 24px; align-items: flex-start; justify-content: flex-end; flex-direction: column; }
  .profile-copy { width: 100%; align-items: flex-end; gap: 14px; }
  .profile-copy .avatar { width: 66px; height: 66px; }
  .profile-copy h1 { font-size: 1.55rem; }
  .profile-copy p { font-size: .76rem; }
  .profile-streak { width: 100%; }
  .day-progress { padding: 18px; }
  .progress-number { font-size: 1.8rem; }
  .widget { padding: 20px; }
  .widget-grid { gap: 12px; }
  .task-row { grid-template-columns: 42px minmax(0, 1fr); }
  .task-row-meta { grid-column: 2; margin-top: -8px; }
  .countdown-value { font-size: 4.8rem; }
  .schedule-strip { grid-template-columns: repeat(5, minmax(72px, 1fr)); overflow-x: auto; }
  .week-stats { grid-template-columns: 1fr 1fr; gap: 0; }
  .week-stat { border-top: 1px solid var(--border); }
  .week-stat:first-child,
  .week-stat:nth-child(2) { border-top: 0; }
  .item-row { grid-template-columns: 40px minmax(0, 1fr) 40px; gap: 10px; }
  .item-row .item-detail,
  .item-row .item-state { grid-column: 2; }
  .item-row > .icon-button { grid-column: 3; grid-row: 1; }
  .exam-grid { grid-template-columns: 1fr; }
  .notes-grid { columns: 1; }
  .file-row { grid-template-columns: 40px minmax(0, 1fr) 40px; }
  .file-row > :nth-child(3),
  .file-row > :nth-child(4) { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .app-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 20px; }
  .dialog-body { max-height: calc(100dvh - 180px); padding: 18px; }
  .side-dialog { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .channel-grid { grid-template-columns: 1fr; }
  .theme-grid { grid-template-columns: 1fr 1fr; }
  .settings-section { scroll-margin-top: calc(var(--topbar-height) + 12px); }
  .reminder-table,
  .reminder-table tbody,
  .reminder-table tr,
  .reminder-table td { display: block; width: 100%; }
  .reminder-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .reminder-table tbody { display: grid; gap: 0; }
  .reminder-table tr {
    display: grid;
    min-height: 76px;
    padding: 14px 0;
    border-top: 1px solid var(--border);
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 5px 16px;
  }
  .reminder-table tr:first-child { border-top: 0; }
  .reminder-table td { min-height: 0; padding: 0; border: 0; }
  .reminder-table td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .reminder-table td:nth-child(2) { display: block; grid-column: 1; grid-row: 2; color: var(--text-soft); line-height: 1.65; }
  .reminder-table td:nth-child(3) { width: auto; grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .time-input { min-height: 44px; }
  .reminder-table .time-input { width: 118px; }
  .focus-clock { padding: 46px 20px; }
  .timer-digits { font-size: 6.2rem; }
  .login-page { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-panel { min-height: 100vh; padding: 32px 24px; }
  .login-panel .brand { margin-bottom: 70px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

@media print {
  .sidebar,
  .topbar,
  .mobile-nav,
  .page-actions { display: none !important; }
  .app-shell { display: block; }
  .main-content { max-width: none; padding: 0; }
  body { background: white; color: black; }
}
