/* Selected Prepago dashboard: an open study canvas and a daily rail. */
body #sidebar .nav-item.active { background: var(--brand-solid); color: #fff; box-shadow: none; }
body #sidebar .nav-item.active:hover { background: var(--brand-solid-hover); color: #fff; }
body #sidebar .nav-item.active .icon-svg { filter: brightness(0) invert(1); opacity: 1; }

.dashboard-help, .dashboard-account-icon, .dashboard-account-label { display: none; }
.dashboard-panel-title { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; }
.dashboard-panel-title:hover { color: var(--brand); }
.dashboard-resume-kicker { display: none; }
.dashboard-progress-ring { display: none; }
.dashboard-date-pager { position: relative; display: flex; align-items: center; flex-shrink: 0; }
.dashboard-date-pager button { border: 0; background: transparent; color: var(--secondary); }
.dashboard-date-pager button:first-child { min-height: 40px; padding: 8px 0; text-transform: capitalize; }
.dashboard-date-pager [data-dashboard-day] { display: grid; place-items: center; width: 28px; height: 32px; padding: 0; }
.dashboard-date-pager .icon-svg { width: 16px; height: 16px; }
.dashboard-date-pager [data-dashboard-day="1"] .icon-svg { transform: rotate(180deg); }

@media (min-width: 768px) {
  html:not([data-theme="dark"]) body[data-page="overview"]:not([data-theme="dark"]) {
    --ink: #0B102E;
    --secondary: #64749A;
    --hairline: #E3EAF4;
    --surface-hover: #F5F8FF;
  }
  html:has(body[data-page]) { scrollbar-gutter: stable; }
  body[data-page="overview"] .main { background: var(--surface); }
  body[data-page="overview"]:not(.landing-view):not(.auth-pending) #page {
    max-width: 1320px;
    padding: 24px 32px 48px;
    margin: 0 auto;
  }
  body .dashboard-reference {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    grid-template-areas: "heading heading" "metrics metrics" "analysis rail";
    gap: 20px 32px;
    align-items: start;
    font-family: var(--font-sans);
  }
  body .dashboard-reference > .desk-main { display: contents; }
  body .dashboard-reference .dashboard-heading {
    grid-area: heading;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 42px;
    margin: 0;
    padding: 0;
    border: 0;
  }
  body .dashboard-reference .dashboard-welcome { min-width: 0; }
  body .dashboard-reference .dashboard-heading .dashboard-panel-kicker { display: none; }
  body .dashboard-reference .dashboard-heading h1 {
    margin: 0;
    font-size: var(--text-greeting);
    line-height: 1.2;
    font-weight: var(--font-bold);
    letter-spacing: -.045em;
    overflow-wrap: anywhere;
  }
  body .dashboard-reference .dashboard-date-pager { margin: 0 0 0 20px; padding: 0 28px; }
  body .dashboard-reference .dashboard-date-pager button:first-child { font-size: var(--text-label); font-weight: var(--font-regular); }
  body .dashboard-reference .dashboard-date-pager [data-dashboard-day] { position: absolute; top: 4px; opacity: 0; }
  body .dashboard-reference .dashboard-date-pager [data-dashboard-day="-1"] { left: 0; }
  body .dashboard-reference .dashboard-date-pager [data-dashboard-day="1"] { right: 0; }
  body .dashboard-reference .dashboard-date-pager:hover [data-dashboard-day],
  body .dashboard-reference .dashboard-date-pager:focus-within [data-dashboard-day] { opacity: 1; }
  body .dashboard-reference .dashboard-date-pager [data-dashboard-day]:hover { color: var(--brand); background: var(--surface-hover); border-radius: 5px; }

  body .dashboard-reference .dashboard-metrics {
    grid-area: metrics;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    padding: 0 0 20px;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--hairline);
    border-radius: 0;
    overflow: visible;
  }
  body .dashboard-reference .dashboard-metric {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    min-height: 66px;
    min-width: 0;
    margin: 0;
    padding: 4px 24px;
    border: 0;
    border-right: 1px solid var(--hairline);
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    box-shadow: none;
    text-align: left;
    transform: none;
  }
  body .dashboard-reference .dashboard-metric:first-child { padding-left: 0; }
  body .dashboard-reference .dashboard-metric:last-child { border-right: 0; padding-right: 0; }
  body .dashboard-reference .dashboard-metric:hover { background: var(--surface-hover); transform: none; box-shadow: none; }
  body .dashboard-reference .dashboard-metric > .dashboard-metric-icon,
  body .dashboard-reference .dashboard-metric em { display: none !important; }
  body .dashboard-reference .dashboard-metric-copy { display: flex; flex-direction: column; min-width: 0; }
  body .dashboard-reference .dashboard-metric strong {
    order: 0;
    margin: 0;
    font-size: var(--text-stat);
    line-height: 1.15;
    font-weight: var(--font-bold);
    letter-spacing: -.045em;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
  body .dashboard-reference .dashboard-metric small {
    order: 1;
    display: block;
    margin: 8px 0 0;
    min-height: 0;
    font-size: var(--text-sm);
    line-height: 1.4;
    font-weight: var(--font-regular);
    color: var(--secondary);
  }

  body .dashboard-reference .dashboard-analysis { grid-area: analysis; display: block; min-width: 0; }
  body .dashboard-reference .next-action {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 88px;
    margin: 0;
    padding: 0 0 16px;
    border: 0;
    border-bottom: 1px solid var(--hairline);
    border-radius: 0;
    background: none;
    box-shadow: none;
  }
  body .dashboard-reference .next-action > div { min-width: 0; }
  body .dashboard-reference .dashboard-resume-kicker {
    display: block;
    margin: 0 0 6px;
    color: var(--secondary);
    font-size: 10px;
    line-height: 14px;
    font-weight: var(--font-semibold);
    letter-spacing: .12em;
  }
  body .dashboard-reference .next-action .dashboard-resume-context {
    display: block;
    margin: 0 0 4px;
    font-size: var(--text-label) !important;
    line-height: 1.4;
    letter-spacing: 0 !important;
    color: var(--ink);
    text-transform: none !important;
  }
  body .dashboard-reference .next-action h2 { margin: 0; font-size: 22px; line-height: 1.35; font-weight: var(--font-bold); letter-spacing: -.025em; }
  body .dashboard-reference .next-action p { display: none; }
  body .dashboard-reference .next-action > .primary-btn { flex: 0 0 auto; min-width: 132px; min-height: 40px; padding: 10px 16px; margin-top: 14px; font-size: var(--text-sm); border-radius: 8px; }
  body .dashboard-reference .next-action > .primary-btn .icon-svg { width: 17px; height: 17px; }

  body .dashboard-reference .dashboard-study-chart {
    --study-plot-height: clamp(200px, calc(100dvh - 510px), 320px);
    margin: 20px 0 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
  }
  body .dashboard-reference .study-chart-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  body .dashboard-reference .study-chart-head h2 { margin: 0; font-size: var(--text-lg); line-height: 1.3; font-weight: var(--font-semibold); letter-spacing: -.025em; }
  body .dashboard-reference .study-chart-period,
  body .dashboard-reference .study-chart-insights,
  body .dashboard-reference .study-chart-total .study-chart-legend { display: none; }
  body .dashboard-reference .dashboard-study-chart .chart-range { position: static; display: flex; padding: 3px; border: 1px solid var(--hairline); background: var(--surface); border-radius: 8px; box-shadow: none; }
  body .dashboard-reference .dashboard-study-chart .chart-range button { min-width: 64px; min-height: 30px; padding: 6px 10px; font-size: var(--text-xs); border-radius: 6px; background: transparent; }
  body .dashboard-reference .dashboard-study-chart .chart-range button.active { background: var(--brand-tint); color: var(--brand-solid); box-shadow: none; }
  body .dashboard-reference .study-chart-total { display: flex; flex-direction: column; align-items: flex-start; gap: 0; margin: 12px 0 0; }
  body .dashboard-reference .study-chart-total > strong { font-size: var(--text-greeting); line-height: 1.18; font-weight: var(--font-semibold); letter-spacing: -.04em; }
  body .dashboard-reference .study-chart-total > span { font-size: var(--text-label); line-height: 1.5; }
  body .dashboard-reference .study-chart-plot { grid-template-columns: 32px minmax(0, 1fr); gap: 8px; margin-top: 10px; }
  body .dashboard-reference .study-chart-axis { height: calc(var(--study-plot-height) - 52px); margin-top: 20px; font-size: var(--text-xs); }
  body .dashboard-reference .study-chart-guides { inset: 20px 0 32px 40px; }
  body .dashboard-reference .study-chart-guides i { border-top: 1px dashed var(--hairline); }
  body .dashboard-reference .study-chart-guides i:last-child { border-top-style: solid; }
  body .dashboard-reference .study-chart-grid { height: var(--study-plot-height); gap: 14px; }
  body .dashboard-reference .study-chart-day { grid-template-rows: 20px minmax(0, 1fr) 32px; }
  body .dashboard-reference .study-chart-track { grid-row: 2; max-width: 36px; position: relative; }
  body .dashboard-reference .study-chart-track i { background: var(--brand-solid); border-radius: 4px 4px 0 0; }
  body .dashboard-reference .study-chart-value { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); visibility: visible; padding-bottom: 5px; font-style: normal; font-size: 11px; line-height: 18px; color: var(--ink); }
  body .dashboard-reference .study-chart-day > small { grid-row: 3; padding: 0; font-size: var(--text-xs); line-height: 24px; color: var(--secondary); }
  body .dashboard-reference .study-chart-day.is-today > small { background: transparent; color: var(--secondary); font-weight: var(--font-regular); }
  body .dashboard-reference .study-chart-day:hover .study-chart-track i { background: var(--brand-solid-hover); }
  body .dashboard-reference .study-chart-grid.is-month { gap: 4px; }
  body .dashboard-reference .is-month .study-chart-track { max-width: 15px; }
  body .dashboard-reference .is-month .study-chart-value { visibility: hidden; }
  body .dashboard-reference .is-month .study-chart-day > small { font-size: var(--text-label); }
  body .dashboard-reference .study-chart-empty-note { margin: 16px 0 0; font-size: var(--text-sm); line-height: 1.5; }
  body .dashboard-reference .study-chart-details { margin: 18px 0 0; font-size: var(--text-label); }

  body .dashboard-reference > .day-rail {
    grid-area: rail;
    display: block;
    padding: 0 0 0 24px;
    margin: 0;
    border: 0;
    border-left: 1px solid var(--hairline);
    min-width: 0;
    align-self: stretch;
  }
  body .dashboard-reference .dashboard-panel { min-height: 0; min-width: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  body .dashboard-reference .dashboard-panel-list { border: 0; }
  body .dashboard-reference .dashboard-panel-head { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
  body .dashboard-reference .dashboard-panel-head h2 { margin: 0; font-size: var(--text-panel); line-height: 1.4; font-weight: var(--font-semibold); letter-spacing: -.025em; }
  body .dashboard-reference .dashboard-panel-head h2 small,
  body .dashboard-reference .dashboard-panel-head .dashboard-panel-kicker { display: none; }
  body .dashboard-reference .dashboard-panel-head > .link-btn { display: flex; align-items: center; gap: 6px; min-height: 28px; margin-left: auto; padding: 0; color: var(--secondary); font-size: var(--text-xs); white-space: nowrap; }
  body .dashboard-reference .dashboard-panel-head > .dashboard-task-count { font-size: var(--text-label); }
  body .dashboard-reference .dashboard-task { display: flex; align-items: center; min-height: 44px; padding: 10px 0; gap: 12px; border: 0; }
  body .dashboard-reference .dashboard-task input { width: 19px; height: 19px; flex: 0 0 19px; margin: 0; accent-color: var(--brand-solid); }
  body .dashboard-reference .dashboard-task-copy strong { font-size: var(--text-sm); line-height: 1.5; font-weight: var(--font-regular); color: var(--ink); overflow-wrap: anywhere; }
  body .dashboard-reference .dashboard-task.is-done strong { color: #909DB6; text-decoration: line-through; }
  body .dashboard-reference .dashboard-task-copy small,
  body .dashboard-reference .dashboard-add { display: none; }
  body .dashboard-reference .dashboard-task-more { margin-top: 14px; font-size: var(--text-sm); }
  body .dashboard-reference .dashboard-events { padding-top: 24px; margin-top: 24px; border-top: 1px solid var(--hairline); }
  body .dashboard-reference .dashboard-events .dashboard-panel-head { margin: 0 0 18px; }
  body .dashboard-reference .dashboard-events .dashboard-panel-head h2 { font-size: var(--text-panel); }
  body .dashboard-reference .dashboard-event { display: block; min-height: 90px; width: 100%; padding: 4px 0 4px 16px; border: 0; border-left: 3px solid var(--brand-solid); border-radius: 0; background: transparent; text-align: left; }
  body .dashboard-reference .dashboard-event:hover { background: var(--surface-hover); }
  body .dashboard-reference .dashboard-event-date,
  body .dashboard-reference .dashboard-event-icon { display: none; }
  body .dashboard-reference .dashboard-event-copy { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
  body .dashboard-reference .dashboard-event-copy strong { order: 0; font-size: var(--text-base); font-weight: var(--font-semibold); line-height: 1.4; letter-spacing: -.02em; }
  body .dashboard-reference .dashboard-event-copy small { margin: 0; font-size: var(--text-label); color: var(--secondary); line-height: 1.5; }
  body .dashboard-reference .dashboard-event-time { order: 1; }
  body .dashboard-reference .dashboard-event-location { order: 2; display: flex; align-items: center; gap: 9px; }
  body .dashboard-reference .dashboard-event-location .icon-svg { width: 15px; height: 15px; opacity: .65; flex-shrink: 0; }
  body .dashboard-reference .dashboard-panel-empty { padding: 10px 0; }
  body .dashboard-reference .dashboard-panel-empty p { margin: 0 0 12px; font-size: 15px; }
  body .dashboard-reference .studio-onboarding,
  body .dashboard-reference .weekly-xp-card { grid-column: 1 / -1; margin: 28px 0 0 !important; }
  body .dashboard-reference :is(button,input,summary):focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; }
}

/* One shared desktop shell prevents navigation and content from jumping between pages. */
@media (min-width: 1101px) {
  body[data-page] { --sidebar-width: 232px; --topbar-height: 64px; }
  body[data-page] .topbar { height: var(--topbar-height); }
  body[data-page] .topbar-brand { width: var(--sidebar-width); flex-basis: var(--sidebar-width); padding: 0 24px; }
  body[data-page] .topbar-content { padding: 0 32px; gap: 24px; }
  body[data-page] .topbar-search { flex: 1; max-width: 720px; margin: 0; }
  body[data-page] .topbar-search input { height: 38px; min-height: 38px; font-size: var(--text-sm); background: var(--surface-hover); padding-left: 40px; padding-right: 70px; }
  body[data-page] .topbar-search > img { left: 14px; width: 18px; height: 18px; }
  body[data-page] .topbar-shortcut { font-size: 11px; padding: 3px 6px; }
  body[data-page] .topbar-actions { gap: 14px; margin-left: auto; }
  body[data-page] .topbar-create { min-height: 38px; height: 38px; padding: 8px 14px; font-size: var(--text-sm); gap: 8px; }
  body[data-page] .topbar-create > img,
  body[data-page] .topbar-divider,
  body[data-page] #topbarProfileName,
  body[data-page] .topbar-profile > img,
  body[data-page] .topbar-actions > .support-nav-button { display: none; }
  body[data-page] .topbar-create-plus { display: flex; align-items: center; margin: 0; }
  body[data-page] .topbar-create-plus .icon-svg { width: 18px; height: 18px; filter: brightness(0) invert(1); }
  body[data-page] .topbar-icon-btn { width: 36px; height: 36px; }
  body[data-page] .topbar-icon-btn > img { width: 20px; height: 20px; }
  body[data-page] .topbar-profile { width: 34px; height: 34px; padding: 0; }
  body[data-page] .topbar-avatar { width: 34px; height: 34px; flex-basis: 34px; border-radius: 50%; background: var(--brand-solid); color: #fff; font-size: var(--text-sm); }
  body[data-page] #sidebar { width: var(--sidebar-width); top: var(--topbar-height); padding: 20px 12px 16px; background: var(--surface); }
  body[data-page] #sidebar > .brand,
  body[data-page] #sidebar > .nav-label,
  body[data-page] .sidebar .nav-item[data-page="ai"] { display: none; }
  body[data-page] #mainNav { margin: 0; padding: 0; }
  body[data-page] #sidebar .nav-item { min-height: 44px; height: 44px; margin: 0 0 4px; padding: 0 14px; gap: 12px; border-radius: 8px; font-size: var(--text-sm); line-height: 20px; font-weight: var(--font-medium); color: var(--secondary); }
  body[data-page] #sidebar .nav-item.active { color: #fff; }
  body[data-page] #sidebar .nav-item .icon { display: flex; align-items: center; width: 19px; height: 19px; flex: 0 0 19px; }
  body[data-page] #sidebar .nav-item .icon-svg { width: 19px; height: 19px; opacity: .85; }
  body[data-page] .sidebar-footer { display: flex; flex-direction: column; padding: 12px 0 0; border-top: 1px solid var(--hairline); }
  body[data-page] .sidebar-progress { order: 0; padding: 6px 14px 14px; }
  body[data-page] .dashboard-help { order: 1; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 8px 14px; border: 0; border-radius: 6px; background: transparent; color: var(--secondary); text-align: left; font-size: var(--text-sm); }
  body[data-page] .dashboard-help .icon-svg { width: 19px; height: 19px; }
  body[data-page] .studio-profile-wrap { order: 2; }
  body[data-page] .sidebar .sidebar-profile { min-height: 40px; width: 100%; padding: 8px 14px; gap: 12px; border-radius: 6px; }
  body[data-page] .sidebar-profile-copy,
  body[data-page] .sidebar-profile-arrow,
  body[data-page] .sidebar .sidebar-avatar { display: none; }
  body[data-page] .dashboard-account-icon { display: flex; align-items: center; }
  body[data-page] .dashboard-account-icon .icon-svg { width: 19px; height: 19px; }
  body[data-page] .dashboard-account-label { display: block; font-size: var(--text-sm); font-weight: var(--font-regular); color: var(--secondary); }
  body[data-page] :is(.dashboard-help,.sidebar-profile):hover { background: var(--surface-hover); }
}
/* Brand assets already have important declarations in the legacy layer. */
@layer prepago-legacy {
  @media (min-width: 1101px) {
    body[data-page] .topbar-brand .prepago-mark { width: 32px !important; height: 32px !important; }
    body[data-page] .topbar-brand .prepago-wordmark { font-size: 24px !important; letter-spacing: -1px !important; color: var(--ink) !important; }
  }
}
@media (min-width: 960px) and (max-width: 1199px) {
  body[data-page="overview"]:not(.landing-view):not(.auth-pending) #page { padding-left: 24px; padding-right: 24px; }
  body .dashboard-reference { column-gap: 24px; grid-template-columns: minmax(0, 1fr) 280px; }
  body .dashboard-reference .dashboard-metric { padding-left: 18px; padding-right: 18px; }
  body .dashboard-reference .dashboard-metric:first-child { padding-left: 0; }
  body .dashboard-reference > .day-rail { padding-left: 20px; }
}
@media (min-width: 768px) and (max-width: 959px) {
  body .dashboard-reference { grid-template-columns: 1fr; grid-template-areas: "heading" "metrics" "analysis" "rail"; }
  body .dashboard-reference > .day-rail { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; padding: 28px 0 0; border: 0; border-top: 1px solid var(--hairline); }
  body .dashboard-reference .dashboard-events { padding: 0; margin: 0; border: 0; }
  body .dashboard-reference .dashboard-date-pager button:first-child { font-size: var(--text-sm); }
  body .dashboard-reference .dashboard-metric strong { font-size: var(--text-title); }
  body .dashboard-reference .dashboard-metric small { font-size: var(--text-label); }
}
@media (max-width: 767px) {
  .dashboard-analysis { display: contents; }
  body .dashboard-reference { align-items: stretch; }
  body .dashboard-reference :is(.dashboard-heading,.dashboard-metrics,.mobile-focus-card,.mobile-revisions,.dashboard-panel,.dashboard-study-chart) { width: 100%; box-sizing: border-box; }
  body .dashboard-reference .dashboard-metrics { order: 1; gap: 0; margin: 0 0 24px; }
  body .dashboard-reference .dashboard-metric { min-height: 80px; padding: 9px 0 10px; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
  body .dashboard-reference .dashboard-metric:nth-child(odd) { border-right: 1px solid var(--hairline); }
  body .dashboard-reference .dashboard-metric:nth-child(even) { padding-left: 16px; }
  body .dashboard-reference .dashboard-metric strong { margin: 6px 0 0; font-size: 30px; }
  body .dashboard-reference .mobile-focus-card { order: 2; }
  body .dashboard-reference .mobile-revisions { order: 3; }
  body .dashboard-reference .dashboard-tasks { order: 4; }
  body .dashboard-reference .dashboard-study-chart { order: 5; }
  .dashboard-date-pager, .dashboard-progress-ring, .dashboard-event-icon { display: none; }
  .dashboard-event-location { display: flex; align-items: center; gap: 6px; }
  .dashboard-event-location .icon-svg { width: 14px; height: 14px; }
  body .dashboard-layout .mobile-focus-card { padding: 20px; border-radius: 16px; border-color: #C8D8F4; }
  body .dashboard-layout .dashboard-study-chart { border-radius: 16px; padding: 20px 18px; }
  body .dashboard-layout .mobile-focus-start { min-height: 48px; font-weight: var(--font-semibold); }
  body .dashboard-layout .study-chart-day { grid-template-rows: 24px minmax(0, 1fr) 28px; }
  body .dashboard-layout .study-chart-track { grid-row: 2; }
  body .dashboard-layout .study-chart-day > small { grid-row: 3; font-size: 11px; }
  body .dashboard-layout .study-chart-value { display: none; }
  .dashboard-task-count { font-variant-numeric: tabular-nums; }
}
