/*
 * SAEUM Night Workspace
 * A full visual rebuild based on the supplied three-column education dashboard.
 * Product copy, behavior and data remain SAEUM's own.
 */

:root {
  --brand: #2789ff;
  --brand-hover: #1679ec;
  --brand-soft: rgba(39, 137, 255, .14);
  --brand-line: rgba(39, 137, 255, .35);
  --info: #2789ff;
  --info-soft: rgba(39, 137, 255, .12);
  --ink: #f5f7fb;
  --text: #d8dce5;
  --muted: #8d93a1;
  --subtle: #626875;
  --line: #242831;
  --line-strong: #323743;
  --divider: #20242c;
  --canvas: #111318;
  --surface: #090b0f;
  --surface-alt: #15181e;
  --surface-raised: #191d24;
  --success: #1dde68;
  --warning: #ffb33b;
  --danger: #ff6374;
  --sidebar-width: 238px;
  --rail-width: 354px;
  --topbar-height: 94px;
  --content-width: 1440px;
  --radius-xs: 8px;
  --radius-sm: 14px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 30px;
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, .18);
  --shadow-md: 0 18px 44px rgba(0, 0, 0, .28);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, .38);
}

html,
body {
  background: #080a0e;
}

body {
  color: var(--text);
  background: var(--canvas);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: -.012em;
}

body.entry-app {
  overflow: hidden;
}

body.entry-app,
body.entry-app #appMain,
body.entry-app .app-shell {
  color-scheme: dark;
}

::selection {
  color: #fff;
  background: rgba(39, 137, 255, .42);
}

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

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

::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: #343a46;
  background-clip: padding-box;
}

.app-shell {
  width: 100%;
  height: var(--app-viewport-height);
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  overflow: hidden;
  background: var(--canvas);
}

body[data-view="dashboard"] .app-shell {
  grid-template-columns: var(--sidebar-width) minmax(620px, 1fr) var(--rail-width);
}

/* Sidebar */

.sidebar {
  position: relative;
  z-index: 120;
  min-width: 0;
  height: var(--app-viewport-height);
  padding: 30px 0 20px;
  overflow: hidden;
  border: 0;
  background: #080a0e;
}

.brand {
  width: calc(100% - 36px);
  min-height: 70px;
  margin: 0 18px 34px;
  padding: 0 18px;
  gap: 13px;
  border-radius: 18px;
  color: #76a9ff;
}

.brand:hover {
  color: #fff;
  background: #11151c;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, #5fa7ff, #176ee8);
  box-shadow: 0 10px 26px rgba(39, 137, 255, .28);
}

.brand-mark .ui-icon {
  width: 23px;
  height: 23px;
}

.brand strong {
  color: #78a8ff;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.03em;
}

.brand small {
  margin-top: 2px;
  color: #626a79;
  font-size: 11px;
}

#mainNav {
  width: 100%;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
}

.nav-item {
  position: relative;
  width: 100%;
  min-height: 64px;
  padding: 0 28px;
  gap: 15px;
  border-radius: 0;
  color: #a8adb8;
  background: transparent;
  font-size: 15px;
  font-weight: 700;
  text-align: left;
}

.nav-item::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  border-radius: 0 6px 6px 0;
  background: transparent;
}

.nav-item:hover {
  color: #fff;
  background: #101319;
}

.nav-item.active {
  color: var(--brand);
  background: #13161c;
}

.nav-item.active::before {
  background: var(--brand);
  box-shadow: 0 0 20px rgba(39, 137, 255, .55);
}

.nav-item .ui-icon {
  width: 25px;
  height: 25px;
  stroke-width: 1.8;
}

.nav-label {
  line-height: 1;
}

.sidebar-foot {
  right: 18px;
  bottom: 20px;
  left: 18px;
  gap: 7px;
}

.sidebar-save-state,
.sidebar-utility {
  min-height: 54px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: #949aa7;
  background: transparent;
}

.sidebar-save-state:hover,
.sidebar-utility:hover {
  border-color: var(--line);
  color: #fff;
  background: #101319;
}

.sidebar-save-state > span {
  background: var(--success);
  box-shadow: 0 0 14px rgba(29, 222, 104, .35);
}

.sidebar-save-state strong,
.sidebar-utility strong {
  color: #d8dce5;
  font-size: 12px;
}

.sidebar-save-state small,
.sidebar-utility small {
  color: #626a78;
  font-size: 10px;
}

.sidebar-utility > span:first-child,
.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--brand);
  background: #171b22;
}

/* Main workspace and top bar */

#appMain {
  min-width: 0;
  height: var(--app-viewport-height);
  overflow-x: hidden;
  overflow-y: auto;
  background: #111318;
}

.topbar {
  position: sticky;
  z-index: 90;
  top: 0;
  min-height: var(--topbar-height);
  height: var(--topbar-height);
  padding: 18px 28px 12px;
  gap: 16px;
  border: 0;
  background: rgba(17, 19, 24, .94);
  box-shadow: none;
  backdrop-filter: blur(22px) saturate(140%);
}

.global-search {
  width: min(520px, 48vw);
  min-height: 52px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #181c23;
  border-radius: 19px;
  background: #090b0f;
}

.global-search-submit {
  width: 32px;
  height: 32px;
  padding: 4px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: #b6bbc5;
  background: transparent;
}

.global-search-submit:hover,
.global-search-submit:focus-visible {
  color: #fff;
  background: rgba(39, 137, 255, .14);
}

.global-search-submit .ui-icon {
  width: 23px;
  height: 23px;
}

.global-search input {
  width: 100%;
  min-height: 48px;
  padding: 0;
  border: 0;
  outline: 0;
  color: #f4f6fb;
  background: transparent;
  box-shadow: none;
  font-size: 14px;
}

.global-search input::placeholder {
  color: #747b88;
}

.page-heading {
  display: none;
}

.top-actions {
  margin-left: auto;
  gap: 8px;
}

.save-state,
.topbar .settings-button {
  display: none;
}

.topbar .notification-button,
.topbar #quickAddBtn,
.topbar .account-button {
  min-height: 48px;
  height: 48px;
  border: 1px solid #20242c;
  color: #b8bdc7;
  background: #0b0d12;
  box-shadow: none;
}

.topbar .notification-button:hover,
.topbar #quickAddBtn:hover,
.topbar .account-button:hover {
  color: #fff;
  border-color: #303641;
  background: #171a21;
}

.topbar .notification-button {
  width: 48px;
  color: var(--brand);
}

.topbar #quickAddBtn {
  color: #fff;
  border-color: rgba(39, 137, 255, .48);
  background: var(--brand);
}

.topbar #quickAddBtn:hover {
  background: var(--brand-hover);
}

.topbar .account-button {
  max-width: 180px;
  padding: 0 14px 0 8px;
}

.account-dot {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #1a1e26;
}

.account-button #accountLabel {
  overflow: hidden;
  color: #daddE5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-nav {
  position: sticky;
  z-index: 82;
  top: var(--topbar-height);
  min-height: 48px;
  padding: 4px 28px 8px;
  gap: 7px;
  border: 0;
  background: rgba(17, 19, 24, .96);
}

.section-nav button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: #7f8693;
  background: #0d0f14;
  font-size: 12px;
}

.section-nav button.active {
  color: #fff;
  border-color: var(--brand-line);
  background: var(--brand-soft);
}

.view {
  width: min(100%, var(--content-width));
  margin: 0 auto;
  padding: 12px 28px 72px;
}

.view-intro,
.ai-hero {
  min-height: 68px;
  margin: 0 0 16px;
  padding: 0 2px;
}

.view-intro h2,
.ai-hero h2 {
  color: #f4f6fb;
  font-size: 27px;
  line-height: 34px;
}

.view-intro > div:first-child > span,
.view-intro > div:first-child > p:not(.eyebrow),
.ai-hero p {
  color: var(--muted);
  font-size: 13px;
}

.eyebrow,
.view-intro .eyebrow,
.panel-head .eyebrow {
  color: var(--brand);
  font-size: 10px;
  line-height: 14px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* Shared cards and controls */

.panel,
.stat-card,
.task-card,
.grade-term-card,
.exam-plan-card,
.mistake-card,
.pro-panel,
.weekly-planner-panel,
.study-pack-panel,
.flashcard-library,
.timer-hero-card,
.subject-timer-panel,
.subject-timers {
  border: 1px solid #1c2028;
  border-radius: 21px;
  color: var(--text);
  background: #090b0f;
  box-shadow: var(--shadow-sm);
}

.panel {
  padding: 20px 22px;
}

.panel-head {
  min-height: 42px;
  margin-bottom: 14px;
}

.panel-head h3 {
  color: #f0f2f7;
  font-size: 17px;
  line-height: 23px;
}

.panel-head small,
.helper {
  color: var(--muted);
}

.primary-button,
.soft-button,
.text-button,
.link-button,
.danger-button,
.icon-button,
.close-button,
.round-timer-button {
  min-height: 42px;
  border-radius: 12px;
  box-shadow: none;
}

.primary-button {
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
}

.primary-button:hover {
  border-color: var(--brand-hover);
  background: var(--brand-hover);
}

.soft-button,
.icon-button,
.close-button {
  border-color: var(--line);
  color: #bac0cb;
  background: #15181f;
}

.soft-button:hover,
.icon-button:hover,
.close-button:hover {
  color: #fff;
  border-color: #3b414e;
  background: #1b1f27;
}

.text-button,
.link-button {
  color: var(--brand);
}

.text-button:hover,
.link-button:hover {
  color: #70b0ff;
  background: var(--brand-soft);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select,
textarea {
  border-color: #2b303b;
  color: #f1f3f7;
  background: #11141a;
  box-shadow: none;
}

input::placeholder,
textarea::placeholder {
  color: #656c79;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(39, 137, 255, .15);
}

.content-tabs,
.pack-tabs,
.filter-tabs {
  border: 1px solid #20242c;
  background: #090b0f;
}

.content-tabs button,
.pack-tabs button,
.filter-tabs button {
  color: #7f8693;
}

.content-tabs button.active,
.pack-tabs button.active,
.filter-tabs button.active {
  color: #fff;
  background: #20252e;
  box-shadow: none;
}

.empty,
.empty-state,
.compact-empty,
.task-first-empty,
.dashboard-empty,
.records-empty-state {
  border: 1px dashed #303541;
  color: #818895;
  background: #101319;
}

.empty strong,
.empty-state strong,
.compact-empty strong,
.task-first-empty strong,
.dashboard-empty strong,
.records-empty-state strong {
  color: #dfe2e9;
}

/* Dashboard */

#dashboardView {
  padding-top: 8px;
}

.home-primary-grid {
  margin-bottom: 18px;
}

.today-priority-card {
  position: relative;
  min-height: 226px;
  padding: 34px 42% 30px 40px;
  overflow: hidden;
  border: 0;
  border-radius: 25px;
  color: #fff;
  background:
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, .16), transparent 15rem),
    linear-gradient(115deg, #2186ff 0%, #287ff0 62%, #1c69ed 100%);
  box-shadow: 0 20px 44px rgba(16, 93, 214, .25);
}

.today-priority-card::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: -110px;
  right: -60px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: rgba(7, 60, 178, .24);
}

.today-next-task,
.today-primary-actions,
.today-progress-copy,
.home-focus-subjects,
.today-card-stats,
.secondary-dday-list {
  position: relative;
  z-index: 2;
}

.today-next-task {
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 16px;
}

#ddayCount {
  width: 68px;
  height: 68px;
  border: 1px solid rgba(255, 255, 255, .36);
  border-radius: 18px;
  color: #fff;
  background: rgba(7, 28, 73, .3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16);
  font-size: 13px;
}

.today-next-task small {
  color: rgba(255, 255, 255, .72);
  font-size: 11px;
}

.today-next-task h3 {
  max-width: 500px;
  color: #fff;
  font-size: clamp(24px, 2.4vw, 36px);
  line-height: 1.18;
}

#ddayDate {
  color: rgba(255, 255, 255, .72);
}

.today-primary-actions {
  margin-top: 20px;
}

.today-primary-actions .primary-button {
  color: #1870de;
  border-color: #fff;
  background: #fff;
}

.today-primary-actions .primary-button:hover {
  color: #0d5dbf;
  background: #e9f3ff;
}

.today-primary-actions .text-button {
  color: #fff;
  background: rgba(5, 38, 96, .22);
}

.today-progress-copy {
  min-width: 150px;
  margin-top: 18px;
  padding: 10px 14px;
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 1px 8px;
  border-radius: 12px;
  background: rgba(5, 38, 96, .2);
}

.today-progress-copy .eyebrow,
.today-progress-copy span {
  color: rgba(255, 255, 255, .72);
}

.today-progress-copy strong {
  color: #fff;
}

.today-progress-copy span {
  grid-column: 1 / -1;
}

.today-card-stats {
  display: none;
}

.dashboard-hero-visual {
  position: absolute;
  z-index: 1;
  top: 18px;
  right: 26px;
  width: 34%;
  min-width: 210px;
  height: calc(100% - 30px);
  pointer-events: none;
}

.dashboard-hero-visual::before {
  content: "";
  position: absolute;
  right: 13%;
  bottom: 8%;
  width: 62%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(173, 207, 255, .7), rgba(92, 131, 231, .88));
  box-shadow: -54px 28px 0 -31px #ff9fc7, 66px 50px 0 -43px #ffe6a1;
}

.dashboard-hero-visual > span {
  position: absolute;
  z-index: 2;
  right: 31%;
  bottom: 10%;
  width: 28%;
  height: 58%;
  border-radius: 48% 48% 20% 20%;
  background: linear-gradient(160deg, #fff 0 55%, #c8d6f0 56% 100%);
  transform: rotate(-8deg);
  box-shadow: 28px -30px 0 -20px #2a1830;
}

.dashboard-hero-visual > i {
  position: absolute;
  z-index: 3;
  right: 23%;
  top: 25%;
  width: 30%;
  height: 9%;
  border-radius: 99px;
  background: #25172a;
  transform: rotate(22deg);
}

.dashboard-hero-visual > b {
  position: absolute;
  z-index: 3;
  right: 11%;
  bottom: 31%;
  width: 34%;
  height: 10%;
  border-radius: 99px;
  background: #eef3fa;
  transform: rotate(14deg);
}

.dashboard-insight-grid {
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, .8fr);
  gap: 18px;
}

.dashboard-performance-panel,
.dashboard-completion-panel {
  min-height: 310px;
}

.dashboard-focus-chart {
  height: 224px;
  padding: 18px 6px 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: 9px;
  border-bottom: 1px solid #303540;
  background:
    linear-gradient(#20242c 1px, transparent 1px) 0 25% / 100% 25%,
    linear-gradient(#20242c 1px, transparent 1px) 0 50% / 100% 25%,
    linear-gradient(#20242c 1px, transparent 1px) 0 75% / 100% 25%;
}

.dashboard-chart-day {
  height: 100%;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 26px;
  align-items: end;
  justify-items: center;
  gap: 7px;
}

.dashboard-chart-bar {
  width: min(28px, 62%);
  min-height: 5px;
  align-self: end;
  border-radius: 8px 8px 2px 2px;
  background: linear-gradient(180deg, #3ca0ff, #1769d8);
  box-shadow: 0 0 18px rgba(39, 137, 255, .26);
}

.dashboard-chart-day.today .dashboard-chart-bar {
  background: linear-gradient(180deg, #71b9ff, #2789ff);
}

.dashboard-chart-day small {
  color: #747b87;
  font-size: 10px;
}

.dashboard-completion-list {
  display: grid;
  gap: 8px;
}

.dashboard-completion-row {
  min-height: 55px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--divider);
}

.dashboard-completion-row:last-child {
  border-bottom: 0;
}

.dashboard-completion-row strong,
.dashboard-completion-row small {
  display: block;
}

.dashboard-completion-row strong {
  overflow: hidden;
  color: #e3e6ec;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-completion-row small {
  margin-top: 2px;
  color: #6d7480;
  font-size: 10px;
}

.dashboard-progress-ring {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color, var(--brand)) calc(var(--progress, 0) * 1%), #20242b 0);
}

.dashboard-progress-ring::before {
  content: "";
  grid-area: 1 / 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #090b0f;
}

.dashboard-progress-ring span {
  z-index: 1;
  grid-area: 1 / 1;
  color: #dce0e7;
  font-size: 9px;
  font-weight: 800;
}

.dashboard-agenda-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.dashboard-agenda-panel,
.dashboard-timetable-panel {
  min-height: 268px;
}

.task-row,
.schedule-row {
  min-height: 58px;
  border-bottom-color: var(--divider);
}

.task-row:hover,
.schedule-row:hover {
  background: #12151b;
}

.task-row-copy strong,
.schedule-row strong {
  color: #e6e8ed;
}

.task-row-copy small,
.schedule-row span {
  color: #747b87;
}

.task-complete-button {
  color: #737a87;
  border-color: #2b3039;
  background: #11141a;
}

.due-chip {
  color: #7fb7ff;
  background: rgba(39, 137, 255, .12);
}

.due-chip.urgent {
  color: #ff8190;
  background: rgba(255, 99, 116, .12);
}

.home-more-summary {
  margin-top: 18px;
  border: 1px solid #1c2028;
  border-radius: 20px;
  background: #090b0f;
}

.home-more-summary > summary {
  color: #dfe2e8;
}

.stats-grid {
  gap: 10px;
}

.stat-card {
  min-height: 92px;
  background: #12151b;
}

.stat-card strong {
  color: #f2f4f8;
}

/* Right information rail */

.dashboard-rail {
  display: none;
  height: var(--app-viewport-height);
  padding: 30px 22px 34px;
  overflow-x: hidden;
  overflow-y: auto;
  border-left: 1px solid #171a21;
  background: #080a0e;
}

body[data-view="dashboard"] .dashboard-rail {
  display: block;
}

.rail-profile {
  width: 100%;
  min-height: 62px;
  padding: 8px 11px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 11px;
  border: 1px solid #1c2028;
  border-radius: 15px;
  color: #e7e9ee;
  background: #11141a;
  text-align: left;
}

.rail-profile:hover {
  border-color: #303641;
  background: #171a21;
}

.rail-avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, #4ba4ff, #176fe8);
  font-size: 16px;
  font-weight: 850;
}

.rail-profile strong,
.rail-profile small {
  display: block;
}

.rail-profile strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-profile small {
  margin-top: 3px;
  color: #717885;
  font-size: 10px;
}

.rail-profile > .ui-icon {
  color: #767d89;
}

.rail-calendar,
.rail-upcoming {
  margin-top: 36px;
}

.rail-section-head {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rail-section-head h2 {
  color: #eceef3;
  font-size: 20px;
  line-height: 26px;
}

.rail-section-head button {
  min-height: 34px;
  padding: 0 6px;
  color: var(--brand);
  background: transparent;
  font-size: 11px;
  font-weight: 750;
}

.rail-calendar-weekdays,
.rail-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.rail-calendar-weekdays {
  margin-top: 14px;
}

.rail-calendar-weekdays span {
  padding: 7px 0;
  color: #7c8390;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.rail-calendar-grid {
  gap: 4px 2px;
}

.rail-calendar-day {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  min-width: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #6f7581;
  background: transparent;
  font-size: 11px;
}

.rail-calendar-day:hover {
  color: #fff;
  background: #1a1e25;
}

.rail-calendar-day.other {
  opacity: .26;
}

.rail-calendar-day.today {
  color: #fff;
  background: var(--brand);
}

.rail-calendar-day.has-event {
  color: #05070a;
  font-weight: 900;
}

.rail-calendar-day.event-task {
  background: #ff3b91;
}

.rail-calendar-day.event-school {
  background: #ff8b4c;
}

.rail-calendar-day.event-google {
  background: #1dde68;
}

.rail-calendar-day.event-multi {
  color: #fff;
  background: #2789ff;
}

.rail-calendar-day.selected {
  z-index: 1;
  box-shadow: 0 0 0 3px #080a0e, 0 0 0 5px rgba(126, 177, 255, .9);
  transform: scale(.9);
}

.rail-calendar-day.other.has-event {
  opacity: .5;
}

.rail-upcoming-list {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.rail-upcoming-item {
  width: 100%;
  min-height: 92px;
  padding: 14px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  border: 1px solid #1a1e25;
  border-radius: 17px;
  color: var(--text);
  background: #11141a;
  text-align: left;
}

.rail-upcoming-item:hover {
  border-color: #303641;
  background: #171a21;
  transform: translateY(-1px);
}

.rail-date-badge {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #05070a;
  background: var(--event-color, var(--brand));
  font-size: 18px;
  font-weight: 900;
}

.rail-upcoming-copy {
  min-width: 0;
}

.rail-upcoming-copy strong,
.rail-upcoming-copy small {
  display: block;
}

.rail-upcoming-copy strong {
  overflow: hidden;
  color: #e6e9ee;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-upcoming-copy small {
  margin-top: 5px;
  overflow: hidden;
  color: #777e8a;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-upcoming-item > .ui-icon {
  color: #707783;
}

/* Schedule, timetable and records */

.schedule-workspace {
  gap: 18px;
}

.schedule-calendar-panel,
.schedule-agenda-panel {
  min-height: 540px;
}

.calendar-head h2 {
  color: #f0f2f6;
}

.calendar-grid {
  border-color: #292e38;
}

.calendar-day {
  border-color: #20242c;
  color: #d1d5dd;
  background: #0d1015;
}

.calendar-day:hover {
  background: #171b22;
}

.calendar-day.other,
.calendar-day.other-month {
  color: #4e5560;
  background: #0a0c10;
}

.calendar-day.today > span:first-child {
  color: #fff;
  background: var(--brand);
}

.calendar-day.selected {
  color: #fff;
  background: rgba(39, 137, 255, .12);
  box-shadow: inset 0 0 0 2px var(--brand);
}

.calendar-agenda-item {
  border-color: var(--divider);
  color: var(--text);
  background: #101319;
}

.calendar-agenda-item:hover {
  background: #171b22;
}

.calendar-agenda-item strong {
  color: #e2e5eb;
}

.task-card {
  background: #0c0f14;
}

.task-card:hover {
  border-color: #303641;
  background: #11151b;
}

.task-card h3,
.task-card-main h3 {
  color: #e8eaf0;
}

.task-meta,
.task-meta span {
  color: #767d89;
}

.task-status-toggle,
.task-overflow {
  color: #8e95a1;
  background: #171a21;
}

.table-wrap {
  border-color: #20242c;
  background: #090b0f;
}

.timetable-grid {
  border-color: #282d36;
}

.time-cell,
.time-head,
.period-cell {
  border-color: #22262e;
}

.time-head,
.period-cell {
  color: #8b929e;
  background: #11141a;
}

.time-cell:is(button) {
  color: #d9dde5;
  background: #0b0e13;
}

.time-cell:is(button):hover {
  background: #151a22;
}

.class-block {
  border-radius: 10px;
}

.record-primary-grid > button {
  border-color: #20242c;
  color: var(--text);
  background: #0b0e13;
}

.record-primary-grid > button:hover {
  border-color: #343a45;
  background: #12161d;
}

.record-primary-grid strong,
.grade-term-card strong,
.grade-row strong {
  color: #eff1f5;
}

.grade-term-card,
.grade-row,
.grade-whatif-panel {
  border-color: #20242c;
  background: #101319;
}

.bar-chart {
  border-color: #252a33;
  background: #0d1015;
}

/* Focus and AI */

.stopwatch-layout {
  gap: 18px;
}

.timer-hero-card {
  color: #fff;
  background:
    radial-gradient(circle at 50% 10%, rgba(39, 137, 255, .16), transparent 15rem),
    #090b0f;
}

.running-badge {
  color: #7de3bd;
  background: rgba(29, 222, 104, .1);
}

.current-subject,
.stopwatch-display,
.timer-subject-row strong {
  color: #f2f4f8;
}

.stopwatch-display {
  height: 96px;
  min-height: 96px;
  line-height: 96px;
  overflow: hidden;
}

.stopwatch-kind,
.timer-hero-card > p,
.timer-subject-row small {
  color: #777e8a;
}

.round-timer-button,
.timer-round-button {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 12px 28px rgba(39, 137, 255, .25);
}

.timer-subject-row {
  border-bottom-color: #20242c;
}

.timer-subject-row:hover,
.timer-subject-row.active {
  background: #141820;
}

.subject-play {
  box-shadow: none;
}

.focus-progress-details,
.study-summary,
.achievement-strip {
  border-color: #20242c;
  color: var(--text);
  background: #090b0f;
}

.ai-hero,
.ai-study-hero {
  border: 1px solid #1c2028;
  color: var(--text);
  background:
    radial-gradient(circle at 92% 10%, rgba(39, 137, 255, .22), transparent 16rem),
    #090b0f;
}

.ai-source-card,
.ai-control-card,
.ai-planner-panel,
.ai-maker,
.study-pack-panel,
.flashcard-library {
  border-color: #20242c;
  color: var(--text);
  background: #0b0e13;
}

.upload-zone,
.study-upload-zone,
.ai-plan-file {
  border-color: #333946;
  color: #b8bec8;
  background: #11151b;
}

.upload-zone:hover,
.study-upload-zone:hover,
.ai-plan-file:hover {
  border-color: var(--brand);
  background: rgba(39, 137, 255, .07);
}

.ai-output-summary,
.ai-create-actions {
  border-color: #232831;
  background: #11141a;
}

.flashcard-face,
.mini-flashcard {
  color: var(--text);
  background: #101319;
}

.more-ai-usage,
.more-menu,
.more-menu-list,
.cloud-sync-card,
.auth-profile {
  border-color: #20242c;
  color: var(--text);
  background: #090b0f;
}

.more-menu button,
.more-menu-list button {
  border-color: #20242c;
  color: var(--text);
  background: #101319;
}

.more-menu button:hover,
.more-menu-list button:hover {
  background: #171b22;
}

/* Dialogs and feedback */

dialog {
  border: 1px solid #2b303a;
  color: var(--text);
  background: #0b0e13;
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(7px);
}

.modal-form,
.detail-sheet,
.focus-room {
  color: var(--text);
  background: #0b0e13;
}

.modal-head h2,
.detail-sheet h2,
.detail-sheet h3 {
  color: #f2f4f8;
}

.modal-actions {
  border-color: #242933;
  background: #0b0e13;
}

.advanced-form-details,
.recognition-source,
.calendar-sync-details {
  border-color: #252a33;
  color: var(--text);
  background: #11141a;
}

.toast[popover],
.toast,
.xp-reward-toast,
.network-banner,
.app-update-banner {
  border-color: #303641;
  color: #f1f3f7;
  background: #151920;
  box-shadow: var(--shadow-md);
}

/* Landing page shares the same dark product language */

.landing-page {
  color: var(--text);
  background:
    radial-gradient(circle at 75% 12%, rgba(39, 137, 255, .15), transparent 28rem),
    #090b0f;
}

.landing-header {
  border-color: #1a1e25;
  background: rgba(8, 10, 14, .9);
}

.landing-header nav a,
.landing-login {
  color: #9aa1ad;
}

.landing-header nav a:hover,
.landing-login:hover {
  color: #fff;
}

.landing-open,
.landing-primary,
.landing-service-panel button,
.landing-final-cta button {
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
}

.landing-hero {
  background: transparent;
}

.landing-badge {
  border-color: var(--brand-line);
  color: #8fc0ff;
  background: var(--brand-soft);
}

.landing-kicker {
  color: #8cbcff;
}

.landing-hero h1,
.landing-section-head h2,
.landing-final-cta h2,
.landing-service-panel h3 {
  color: #f3f5f9;
}

.landing-hero h1 span {
  color: var(--brand);
}

.landing-lead,
.landing-section-head > span,
.landing-note,
.landing-service-panel li {
  color: #8f96a3;
}

.landing-app-preview,
.landing-preview-window,
.landing-service-panel {
  border-color: #242933;
  background: #11141a;
  box-shadow: var(--shadow-lg);
}

.landing-preview-rail,
.landing-preview-main,
.landing-preview-main > header {
  border-color: #242933;
  background: #0b0e13;
}

.landing-preview-priority {
  color: #fff;
  background: linear-gradient(115deg, #2186ff, #176ee8);
}

.landing-preview-columns > section {
  border-color: #242933;
  background: #11141a;
}

.landing-service-tabs {
  border-color: #242933;
  background: #101319;
}

.landing-service-tabs button {
  color: #858c98;
}

.landing-service-tabs button.active {
  color: #fff;
  background: #20252e;
}

.landing-final-cta {
  border-color: #242933;
  background: #101319;
}

.landing-footer {
  border-color: #1a1e25;
  background: #080a0e;
}

@media (min-width: 961px) {
  .landing-hero {
    padding-inline: 0;
  }
}

/* Tablet */

@media (max-width: 1399px) {
  :root {
    --sidebar-width: 214px;
  }

  body[data-view="dashboard"] .app-shell,
  .app-shell {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .dashboard-rail {
    display: none !important;
  }

  .global-search {
    width: min(430px, 48vw);
  }
}

@media (max-width: 980px) and (min-width: 768px) {
  :root {
    --sidebar-width: 82px;
  }

  .brand {
    width: 56px;
    margin-inline: 13px;
    padding: 0;
    justify-content: center;
  }

  .brand > span:last-child,
  .nav-label,
  .sidebar-foot {
    display: none;
  }

  .nav-item {
    min-height: 62px;
    padding: 0;
    justify-content: center;
  }

  .global-search {
    width: min(410px, 56vw);
  }

  .dashboard-insight-grid,
  .dashboard-agenda-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Mobile */

@media (max-width: 767px) {
  :root {
    --topbar-height: 56px;
    --mobile-tabbar-height: 72px;
  }

  body.entry-app {
    height: var(--app-viewport-height);
    padding: 0;
    overflow: hidden;
    background: #0c0f14;
  }

  body[data-view="dashboard"] .app-shell,
  .app-shell {
    width: 100%;
    height: var(--app-viewport-height);
    display: block;
    overflow: hidden;
  }

  #appMain {
    width: 100%;
    height: calc(var(--app-viewport-height) - var(--mobile-tabbar-height) - env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    overflow-y: auto;
    background: #0f1217;
  }

  .sidebar {
    position: fixed;
    z-index: 1000;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(var(--mobile-tabbar-height) + env(safe-area-inset-bottom, 0px));
    min-height: var(--mobile-tabbar-height);
    padding: 4px max(8px, env(safe-area-inset-right, 0px)) max(6px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    overflow: visible;
    border-top: 1px solid #242933;
    background: rgba(8, 10, 14, .96);
    box-shadow: 0 -12px 32px rgba(0, 0, 0, .25);
    backdrop-filter: blur(18px);
  }

  .brand,
  .sidebar-foot {
    display: none;
  }

  #mainNav {
    width: 100%;
    height: 62px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
  }

  #mainNav .nav-item {
    width: 100%;
    height: 62px;
    min-height: 62px;
    padding: 5px 2px 4px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    overflow: hidden;
    border-radius: 10px;
    color: #6e7582;
    background: transparent;
    font-size: 10px;
    text-align: center;
  }

  #mainNav .nav-item::before {
    display: none;
  }

  #mainNav .nav-item.active {
    color: var(--brand);
    background: rgba(39, 137, 255, .09);
  }

  #mainNav .nav-item .ui-icon {
    width: 24px;
    height: 24px;
  }

  .nav-label {
    display: block;
  }

  .topbar {
    min-height: var(--topbar-height);
    height: var(--topbar-height);
    padding: 6px 12px;
    gap: 8px;
    border-bottom: 1px solid #20242c;
    background: rgba(9, 11, 15, .96);
  }

  .global-search {
    display: none;
  }

  .page-heading {
    position: absolute;
    right: 56px;
    left: 56px;
    display: block;
    text-align: center;
    pointer-events: none;
  }

  .page-heading .eyebrow {
    display: none;
  }

  .page-heading h1 {
    overflow: hidden;
    color: #f0f2f6;
    font-size: 16px;
    line-height: 22px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-home-button,
  .account-button {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    border-radius: 11px;
  }

  .mobile-home-button {
    color: #fff;
    background: var(--brand);
  }

  .topbar .account-button {
    width: 40px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .account-button > span:last-child,
  .topbar #quickAddBtn,
  .notification-button {
    display: none;
  }

  .section-nav {
    top: var(--topbar-height);
    min-height: 46px;
    height: 46px;
    padding: 5px 12px;
    overflow-x: auto;
    border-bottom: 1px solid #20242c;
    background: rgba(9, 11, 15, .96);
  }

  .section-nav button {
    min-height: 36px;
    height: 36px;
    flex: 0 0 auto;
  }

  .view,
  .section-nav:not([hidden]) ~ .view {
    width: 100%;
    height: auto;
    min-height: calc(100% - var(--topbar-height));
    padding: 14px 12px 28px;
  }

  .section-nav:not([hidden]) ~ .view {
    min-height: calc(100% - var(--topbar-height) - 46px);
  }

  .view-intro,
  .ai-hero {
    min-height: 52px;
    margin-bottom: 10px;
  }

  .view-intro h2,
  .ai-hero h2 {
    font-size: 20px;
    line-height: 26px;
  }

  .view-intro > div:first-child > span,
  .view-intro > div:first-child > p:not(.eyebrow),
  .ai-hero p {
    display: none;
  }

  .panel,
  .grade-summary-panel,
  .panel[data-content-panel="grade-records"],
  .study-pack-panel,
  .flashcard-library,
  .weekly-planner-panel,
  .pro-panel {
    padding: 14px;
    border-radius: 16px;
  }

  #dashboardView {
    padding: 12px;
  }

  .today-priority-card {
    min-height: 250px;
    padding: 22px 20px 138px;
    border-radius: 21px;
  }

  .today-priority-card::after {
    top: auto;
    right: -70px;
    bottom: -160px;
    width: 360px;
    height: 360px;
  }

  .today-next-task {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 12px;
  }

  #ddayCount {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    font-size: 11px;
  }

  .today-next-task h3 {
    font-size: 20px;
    line-height: 25px;
  }

  .today-primary-actions {
    margin-top: 14px;
  }

  .today-progress-copy {
    margin-top: 12px;
  }

  .dashboard-hero-visual {
    top: auto;
    right: 4px;
    bottom: 2px;
    width: 58%;
    min-width: 180px;
    height: 130px;
  }

  .dashboard-insight-grid,
  .dashboard-agenda-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .dashboard-insight-grid {
    margin-bottom: 12px;
  }

  .dashboard-performance-panel,
  .dashboard-completion-panel {
    min-height: 0;
  }

  .dashboard-focus-chart {
    height: 180px;
  }

  .dashboard-completion-panel {
    display: none;
  }

  .dashboard-agenda-panel,
  .dashboard-timetable-panel {
    min-height: 0;
  }

  .dashboard-rail {
    display: none !important;
  }

  .schedule-workspace {
    display: none;
  }

  .mobile-schedule-overview,
  .mobile-timetable {
    color: var(--text);
    border-color: #20242c;
    background: #090b0f;
  }

  .mobile-week-day button,
  .mobile-schedule-week > div > button,
  .mobile-timetable-days button,
  .mobile-period-row {
    border-color: #242933;
    color: #9da4b0;
    background: #11141a;
  }

  .mobile-week-day button.active,
  .mobile-schedule-week > div > button.selected,
  .mobile-timetable-days button.active {
    color: #fff;
    border-color: var(--brand);
    background: var(--brand);
    box-shadow: none;
  }

  .mobile-period-row {
    border-bottom-color: #242933;
  }

  .mobile-period-copy strong {
    color: #e6e8ed;
  }

  .mobile-period-number {
    color: #80b8ff;
    background: rgba(39, 137, 255, .12);
  }

  .record-primary-grid > button,
  .grade-term-card,
  .grade-row {
    border-color: #20242c;
    background: #0b0e13;
  }

  .timer-hero-card,
  .subject-timers {
    background: #090b0f;
  }

  .timer-hero-card {
    min-height: 330px;
  }

  .stopwatch-display {
    height: 66px !important;
    min-height: 66px !important;
    line-height: 60px !important;
    overflow: hidden;
    color: #fff;
  }

  .ai-hero {
    border-radius: 16px;
  }

  dialog {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - 12px);
    margin: auto 0 0;
    border-radius: 22px 22px 0 0;
  }

  .modal-actions {
    background: #0b0e13;
  }

  .toast[popover] {
    inset: auto 12px calc(var(--mobile-tabbar-height) + env(safe-area-inset-bottom, 0px) + 8px) 12px;
  }

  .landing-header {
    background: rgba(8, 10, 14, .95);
  }

  .landing-hero {
    padding-top: 72px;
  }

  .landing-app-preview {
    border-radius: 18px;
  }

  /* Override the previous mobile-first layer with the new night workspace. */
  #dashboardView .today-priority-card {
    min-height: 250px;
    margin: 0;
    padding: 22px 20px 138px;
    border: 0;
    border-radius: 21px;
    color: #fff;
    background:
      radial-gradient(circle at 80% 20%, rgba(255, 255, 255, .16), transparent 15rem),
      linear-gradient(115deg, #2186ff 0%, #287ff0 62%, #1c69ed 100%);
    box-shadow: 0 18px 36px rgba(16, 93, 214, .22);
  }

  #dashboardView .today-next-task {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 12px;
  }

  #dashboardView #ddayCount {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    border-radius: 14px;
    color: #fff;
    background: rgba(7, 28, 73, .3);
  }

  #dashboardView .today-next-task h3 {
    color: #fff;
    font-size: 20px;
    line-height: 25px;
  }

  #dashboardView .today-next-task small,
  #dashboardView #ddayDate {
    color: rgba(255, 255, 255, .72);
  }

  #dashboardView .today-primary-actions {
    margin-top: 14px;
    display: flex;
    grid-template-columns: none;
    gap: 6px;
  }

  #dashboardView .today-primary-actions button {
    min-height: 40px;
    height: 40px;
    border-radius: 11px;
  }

  #dashboardView .today-progress-copy {
    margin: 12px 0 0;
    padding: 9px 12px;
    display: inline-grid;
    border: 0;
    border-radius: 11px;
    background: rgba(5, 38, 96, .2);
  }

  #dashboardView .dashboard-agenda-grid {
    gap: 12px;
  }

  #dashboardView .dashboard-agenda-panel,
  #dashboardView .dashboard-timetable-panel {
    min-height: 0;
    padding: 14px;
    border: 1px solid #1c2028;
    border-radius: 16px;
    color: var(--text);
    background: #090b0f;
    box-shadow: var(--shadow-sm);
  }

  #dashboardView .dashboard-agenda-panel .empty,
  #dashboardView .dashboard-timetable-panel .empty,
  #dashboardView .dashboard-empty {
    margin-inline: 0;
    border-radius: 12px;
    color: #818895;
    background: #101319;
  }

  #dashboardView .home-more-summary {
    margin: 12px 0 0;
    border: 1px solid #1c2028;
    border-radius: 16px;
    color: var(--text);
    background: #090b0f;
  }

  #tasksView .schedule-task-collection,
  #gradesView .grade-summary-panel,
  #gradesView .grade-whatif-panel,
  #gradesView .panel[data-content-panel="grade-records"],
  #timerView .timer-hero-card,
  #timerView .subject-timers,
  #aiView .ai-maker,
  #aiView .study-pack-panel,
  #aiView .flashcard-library,
  #moreView .more-menu,
  #proView .weekly-planner-panel,
  #proView .pro-panel {
    border-color: #1c2028;
    color: var(--text);
    background: #090b0f;
    box-shadow: var(--shadow-sm);
  }

  #tasksView .task-card,
  #gradesView .grade-term-card,
  #gradesView .grade-row,
  #timerView .timer-subject-row,
  #moreView .more-menu button {
    border-color: #20242c;
    color: var(--text);
    background: #101319;
  }
}

@media (max-width: 380px) {
  .view,
  #dashboardView {
    padding-inline: 9px;
  }

  .today-priority-card {
    padding-inline: 16px;
  }

  .today-next-task h3 {
    font-size: 18px;
  }

  #mainNav .nav-item {
    font-size: 9px;
  }
}

/* Finishing layer: soft geometry shared by every product surface. */

.panel,
.today-priority-card,
.timer-hero-card,
.ai-hero,
.ai-study-hero,
.more-profile-card,
.more-ai-usage,
.sync-card,
.task-card,
.grade-term-card,
.study-pack-panel,
.flashcard-library,
.schedule-calendar-panel,
.schedule-agenda-panel,
.timetable-editor,
.planner-panel,
.mistake-panel {
  border-radius: var(--radius-lg);
}

.global-search,
.rail-profile,
.sidebar-utility,
.account-button,
.notification-button,
.quick-add-button,
.primary-button,
.soft-button,
.landing-login,
.landing-open,
.landing-primary,
.landing-secondary,
.landing-service-panel button,
.content-tabs,
.filter-tabs {
  border-radius: var(--radius-sm);
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea,
.upload-zone,
.calendar-sync-details,
.mobile-google-details {
  border-radius: var(--radius-sm);
}

dialog,
dialog .modal-form,
dialog .detail-sheet {
  border-radius: var(--radius-xl);
}

.rail-upcoming-item,
.compact-empty,
.dashboard-completion-row {
  border-radius: 20px;
}

.rail-upcoming-item {
  min-height: 96px;
  padding: 15px;
  border-color: #222731;
  background: #101319;
}

.rail-upcoming-item:hover {
  border-color: rgba(39, 137, 255, .48);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .22);
}

.rail-day-item {
  cursor: default;
}

button.rail-day-item {
  cursor: pointer;
}

.rail-date-badge {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}

button,
a,
input,
select,
textarea {
  transition:
    color .16s ease,
    background-color .16s ease,
    border-color .16s ease,
    box-shadow .16s ease,
    transform .16s ease;
}

button:active:not(:disabled) {
  transform: scale(.975);
}

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