/* Shared visual language for all four academic workspaces. */
:root {
  --rota-violet: #4d3cd5;
  --rota-teal: #087b6a;
  --rota-amber: #ad502b;
  --rota-page: #f5f5ff;
  --rota-surface: #fff;
  --rota-ink: #201f48;
  --rota-muted: #555e7c;
  --rota-edge: #e0e1f4;
  --rota-lilac: #eeebff;
  --rota-mint: #e7f8f1;
  --rota-peach: #fff2e3;
  --rota-shadow: 0 12px 34px #332b8410, 0 1px 3px #24175b0b;
  --rota-line: #5744d8;
  --rota-horizon: linear-gradient(105deg,#2c2481 5%,#5136ba 60%,#744ddd);
}
html[data-theme=dark] {
  --rota-page: #14142a;
  --rota-surface: #1d1d36;
  --rota-ink: #f1efff;
  --rota-muted: #b7bbd8;
  --rota-edge: #373657;
  --rota-violet: #beafff;
  --rota-teal: #78dfc3;
  --rota-amber: #ffbb91;
  --rota-lilac: #2c2854;
  --rota-mint: #153632;
  --rota-peach: #392b2f;
  --rota-line: #b6a6ff;
  --rota-shadow: 0 12px 34px #08081e40;
}

html[data-accent] body.rota-dashboard,
html body.rota-dashboard {
  background: radial-gradient(ellipse at 91% 0%,color-mix(in srgb,var(--rota-violet) 11%,transparent),transparent 33rem),var(--rota-page) !important;
}
body.rota-dashboard .main {
  min-width: 0;
  --flow-line: var(--rota-edge);
}
body.rota-dashboard :is(.main,.main.workspace-clear) > :is(.intro,.today-heading) {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  align-items: center;
  min-height: 144px;
  padding: clamp(18px,3vw,35px) !important;
  border-radius: 23px;
  background: var(--rota-horizon);
  color: white;
  box-shadow: 0 14px 30px #4230ad29;
}
body.rota-dashboard :is(.main,.main.workspace-clear) > :is(.intro,.today-heading)::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(90deg,#2c2481 6%,transparent 76%),url('/rota-horizon.webp') right bottom / auto 108% no-repeat;
}
body.rota-dashboard :is(.main,.main.workspace-clear) > :is(.intro,.today-heading) :is(h1,p,.tiny) {
  color: white !important;
  text-shadow: 0 1px 12px #1c145c85;
}
body.rota-dashboard :is(.main,.main.workspace-clear) > :is(.intro,.today-heading) h1 {
  font-weight: 800;
  letter-spacing: -.04em;
}
body.rota-dashboard :is(.main,.main.workspace-clear) > :is(.intro,.today-heading) h1 + p { max-width: 53ch; }
body.rota-dashboard :is(.main,.main.workspace-clear) > :is(.intro,.today-heading) :is(a,button) {
  background: var(--rota-surface) !important;
  color: var(--rota-violet) !important;
  border-color: var(--rota-edge);
}
body.rota-dashboard :is(.card,.study-card,.daily-stat,.daily-progress-card,.rota-summary-grid article) {
  box-shadow: var(--rota-shadow);
  border-radius: 19px;
}
body.rota-dashboard :is(.card,.study-card) { min-width: 0; }
body.rota-dashboard :is(.cardhead,.study-card) h2 {
  letter-spacing: -.025em;
  text-wrap: balance;
}
body.rota-dashboard .sidebar {
  background: var(--rota-surface);
  border-color: var(--rota-edge);
}
body.rota-dashboard :is(.sidebar .brand i,.role-brand-mark) {
  background: linear-gradient(145deg,#6854eb,#4030ad);
  color: white;
}
body.rota-dashboard .sidebar .nav :is(a.active,a[aria-current=page],.has-active>summary),
body.rota-dashboard .mobile-bottom :is(a.active,a[aria-current=page],.has-active>summary) {
  background: var(--rota-lilac) !important;
  color: var(--rota-violet) !important;
}
body.rota-dashboard :is(.study-tabs,.workspace-bar,.chartfilters) { overflow-wrap: anywhere; }
body.rota-dashboard :is(.study-tabs,.chartfilters) :is(button,select),
body.rota-dashboard .mobile-bottom :is(a,summary),
body.rota-dashboard .main :is(.primary,.secondary) { min-height: 44px; }
body.rota-dashboard :is(.rota-table-wrap,.school-table-wrap,.charttable) {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}
body.rota-dashboard :focus-visible { outline: 3px solid var(--rota-violet); outline-offset: 3px; }

body.rota-dashboard #weeklyGoalCard {
  background-image: linear-gradient(145deg,var(--rota-mint),color-mix(in srgb,var(--rota-mint) 60%,var(--rota-surface)));
  color: var(--rota-ink);
  border-color: color-mix(in srgb,var(--rota-teal) 23%,var(--rota-edge));
}
#weeklyGoalCard progress { accent-color: var(--rota-teal); }
#weeklyGoalCard progress::-webkit-progress-bar { background: color-mix(in srgb,var(--rota-teal) 13%,var(--rota-surface)); }
#weeklyGoalCard progress::-webkit-progress-value { background: var(--rota-teal); }
#weeklyGoalCard progress::-moz-progress-bar { background: var(--rota-teal); }
#weeklyGoalCard .week-range { color: var(--rota-teal); }
#weeklyGoalCard .mini-goal b { font-variant-numeric: tabular-nums; }
body.rota-dashboard #homeFocusTopics {
  background-image: linear-gradient(145deg,var(--rota-peach),color-mix(in srgb,var(--rota-peach) 52%,var(--rota-surface)));
  border-color: color-mix(in srgb,var(--rota-amber) 27%,var(--rota-edge));
  color: var(--rota-ink);
}
.visual-topic { display:grid; gap:5px; margin-block:14px; }
.visual-topic > a { color: var(--rota-ink); font-weight: 720; overflow-wrap:anywhere; }
.visual-topic > span { color: var(--rota-muted); font-size:.8125rem; }
.visual-topic-track { border-radius:999px; height:6px; background:color-mix(in srgb,var(--rota-amber) 15%,var(--rota-surface)); overflow:hidden; }
.visual-topic-track i { display:block; background:var(--rota-amber); width:var(--topic-value); height:100%; border-radius:inherit; }
#homeNetChart select { width:auto; min-width:84px; min-height:44px; }
.visual-empty { color:var(--rota-muted); margin:1.25rem 0; }
.visual-chart-metrics {
  display:flex; flex-wrap:wrap; gap:8px 14px; align-items: baseline; margin-block:8px;
  color:var(--rota-ink); font-variant-numeric:tabular-nums;
}
.visual-chart-metrics > strong { font-size: clamp(1.5rem,3vw,2.25rem); letter-spacing:-.04em; }
.visual-chart-metrics small { font-size: .9rem; letter-spacing:0; }
.visual-chart-metrics > span { color:var(--rota-teal); font-size:.85rem; font-weight:750; }
.visual-chart-metrics span[data-direction=down] { color:var(--rota-amber); }
body.rota-dashboard .visual-line-chart { display:block; width:100%; max-height:310px; min-height:135px; }
.visual-line-chart text { fill:var(--rota-muted); font:13px system-ui,sans-serif; }
.visual-mountains { fill:var(--rota-lilac); }
.visual-grid { stroke:var(--rota-edge); vector-effect:non-scaling-stroke; }
.visual-stop { stop-color:var(--rota-line); stop-opacity:.26; }
.visual-stop-end { stop-opacity:.01; }
.visual-line { fill:none; stroke:var(--rota-line); stroke-width:3; stroke-linecap:round; stroke-linejoin:round; vector-effect:non-scaling-stroke; }
.visual-point { fill:var(--rota-surface); stroke:var(--rota-line); stroke-width:2; vector-effect:non-scaling-stroke; }
.visual-series > summary { cursor:pointer; color:var(--rota-violet); padding:10px 0; font-weight:700; }
.visual-series ul { padding:0; margin:0; list-style:none; }
.visual-series li { display:flex; align-items:baseline; flex-wrap:wrap; gap:8px 13px; padding:9px 0; border-top:1px solid var(--rota-edge); }
.visual-series li strong { margin-inline-start:auto; }
body.rota-dashboard :is(.week-bars,.hub-bars,.reasonbar,.time-chart) { accent-color:var(--rota-violet); }
body.rota-dashboard :is(.week-bars,.hub-bars,.time-chart) :is(svg,canvas) { max-width:100%; }
body.rota-dashboard :is(.task,.coach-task):has(input:checked) { background:var(--rota-mint); }
@media (prefers-reduced-motion:no-preference) {
  body.rota-dashboard :is(.task,.coach-task):has(input:focus-visible:checked) { animation:rota-complete .34s ease-out; }
  @keyframes rota-complete { from { box-shadow:inset 0 0 0 2px var(--rota-teal); } to { box-shadow:inset 0 0 0 0 transparent; } }
}

@media(max-width:699px) {
  .role-entry-home .entry-login-heading { min-height:250px; }
  .role-entry-home .entry-login-heading::before { opacity:.47; background-size:auto 64%,auto 64%; }
  body.rota-dashboard :is(.main,.main.workspace-clear) > :is(.intro,.today-heading) { min-height:128px; }
  body.rota-dashboard :is(.main,.main.workspace-clear) > :is(.intro,.today-heading)::before { opacity:.57; background-size:auto 78%; }
  body.rota-dashboard .main > .today-heading > button.primary { font-size:.83rem; width:auto; min-width:44px; padding-inline:10px; }
}
@media(min-width:690px) and (max-width:1024px) {
  body.rota-dashboard:has(.mobile-bottom) .main { margin-left:0; max-width:100%; padding-inline:clamp(18px,3.6vw,38px); padding-bottom:calc(105px + env(safe-area-inset-bottom)); }
  body.rota-dashboard:has(.mobile-bottom) .sidebar { display:none; }
  body.rota-dashboard:has(.mobile-bottom) .mobile-bottom {
    position:fixed; z-index:10010; inset:auto 18px max(12px,env(safe-area-inset-bottom));
    margin-inline:auto; max-width:760px; display:flex !important; align-items:stretch; gap:6px;
    min-height:60px; padding:6px; border:1px solid var(--rota-edge); border-radius:17px;
    background:var(--rota-surface); box-shadow:0 12px 36px #2824562b;
  }
  body.rota-dashboard .mobile-bottom > :is(a,details,button) { flex:1; min-width:0; }
  body.rota-dashboard .mobile-bottom > :is(a,details>summary) { min-height:46px; font-size:.8rem; }
  body.rota-dashboard .mobile-bottom .mobile-more > div { bottom:84px; }
}
@media (min-width:821px) and (max-width:1180px) and (orientation:landscape) {
  body.rota-dashboard:has(.mobile-bottom) .sidebar {
    display:flex; position:relative; inset:auto; top:auto !important; width:auto; min-height:0; height:auto !important; overflow:visible; flex-direction:row; align-items:center;
    gap:20px; padding:10px clamp(16px,3vw,38px); border:0; border-bottom:1px solid var(--rota-edge);
  }
  body.rota-dashboard:has(.mobile-bottom) .sidebar .brand { padding:0; flex:none; }
  body.rota-dashboard:has(.mobile-bottom) .sidebar .nav { display:flex; flex-direction:row; align-items:flex-start; flex-wrap:wrap; gap:4px; margin:0; }
  body.rota-dashboard:has(.mobile-bottom) .sidebar :is(.rota-role-label,.sidebottom) { display:none; }
  body.rota-dashboard:has(.mobile-bottom) .sidebar .workspace-nav-section { position:relative; }
  body.rota-dashboard:has(.mobile-bottom) .sidebar .workspace-nav-section[open] { z-index:12; }
  body.rota-dashboard:has(.mobile-bottom) .main { margin-left:0; max-width:100%; padding:22px clamp(18px,3.6vw,40px) 36px; }
  body.rota-dashboard:has(.mobile-bottom) .mobile-bottom { display:none !important; }
}
@media print {
  html body.rota-dashboard { background:white !important; }
  body.rota-dashboard .main :is(.card,.study-card) { box-shadow:none; }
  body.rota-dashboard :is(.main,.main.workspace-clear) > :is(.intro,.today-heading) { background:none; box-shadow:none; }
  body.rota-dashboard :is(.main,.main.workspace-clear) > :is(.intro,.today-heading) :is(h1,p,.tiny) { color:#000 !important; text-shadow:none; }
  body.rota-dashboard :is(.main,.main.workspace-clear) > :is(.intro,.today-heading)::before { display:none; }
}

.visual-home-charts {
  display:grid;
  grid-template-columns:minmax(0,1.55fr) minmax(0,1fr);
  align-items:start;
  gap:clamp(12px,2vw,22px);
  margin-block:12px 22px;
}
.visual-home-charts .card { margin:0; }
.visual-net-label { color:var(--rota-muted); font-size:.85rem; margin:0; }
@media(max-width:680px) {
  .visual-home-charts { grid-template-columns:minmax(0,1fr); }
}

body.rota-dashboard .sidebar .brand i {
  position:relative; font-size:0;
}
body.rota-dashboard .sidebar .brand i::after {
  content:""; position:absolute; inset:23%; background:currentColor;
  clip-path:polygon(17% 83%,10% 76%,67% 19%,35% 19%,35% 8%,88% 8%,88% 61%,77% 61%,77% 29%,23% 87%);
}
.visual-line-chart { cursor:crosshair; }
.visual-point.is-selected { fill:var(--rota-line); stroke:var(--rota-surface); stroke-width:2.5; }
.visual-chart-selected {
  min-height:2rem; padding:7px 10px; margin:0 0 6px;
  border-radius:9px; background:var(--rota-lilac); color:var(--rota-ink); font-size:.85rem;
}
@media(max-width:689px) {
  body.rota-dashboard:has(.main.workspace-clear) nav.mobile-bottom {
    display:flex !important; align-items:stretch; gap:2px;
  }
  body.rota-dashboard:has(.main.workspace-clear) nav.mobile-bottom > * { flex:1; min-width:0; }
  body.rota-dashboard:has(.main.workspace-clear) nav.mobile-bottom > :is(a,details>summary) {
    font-size:.68rem; overflow-wrap:anywhere;
  }
}

body.rota-dashboard svg.rota-line-chart:not(.visual-line-chart) {
  display:block; width:100%; max-height:280px; border-radius:14px;
  background:
    linear-gradient(0deg,color-mix(in srgb,var(--rota-lilac) 55%,transparent),transparent 77%),
    url('/rota-horizon.webp') right bottom / auto 68% no-repeat;
  background-blend-mode:normal,soft-light;
}
body.rota-dashboard .rota-line-chart:not(.visual-line-chart) :is(polyline,circle) { stroke:var(--rota-line); }
body.rota-dashboard .rota-line-chart:not(.visual-line-chart) circle { fill:var(--rota-surface); stroke-width:2; }
body.rota-dashboard .rota-line-chart:not(.visual-line-chart) text { fill:var(--rota-muted); }

#weeklyGoalCard .visual-goal-meter { display:flex; align-items:center; gap:12px; margin:4px 0 12px; color:var(--rota-teal); font-weight:700; }
.visual-goal-ring {
  display:grid; place-items:center; width:63px; height:63px; flex:none; border-radius:50%;
  background:conic-gradient(var(--rota-teal) var(--goal-percent),color-mix(in srgb,var(--rota-teal) 16%,var(--rota-mint)) 0);
}
.visual-goal-ring strong { display:grid; place-items:center; width:51px; height:51px; border-radius:50%; background:var(--rota-mint); color:var(--rota-teal); font-variant-numeric:tabular-nums; }

body.rota-dashboard :is(.rota-summary-grid,.role-panel-summary) > article {
  --tile-tint:var(--rota-lilac);
  background:linear-gradient(145deg,var(--tile-tint),var(--rota-surface) 78%) !important;
}
body.rota-dashboard :is(.rota-summary-grid,.role-panel-summary) > article:nth-of-type(3n+2) { --tile-tint:var(--rota-mint); }
body.rota-dashboard :is(.rota-summary-grid,.role-panel-summary) > article:nth-of-type(3n+3) { --tile-tint:var(--rota-peach); }

/* The same layered surfaces frame entry, role workspaces and detail screens. */
@media screen {
  :root {
    --rota-page:#f1f5fb; --rota-edge:#d7e0ee; --rota-lilac:#e7efff;
    --rota-ink:#142842; --rota-muted:#4e647d; --rota-violet:#205cb5;
    --rota-shadow:inset 0 1px 0 #ffffff99,0 2px 5px #12305a09,0 14px 36px -17px #26457455;
    --rota-horizon:radial-gradient(ellipse at 95% 105%,#16777b,transparent 48%),linear-gradient(115deg,#101d48,#243b75 66%,#134b70);
    --depth-edge:inset 0 1px 1px #ffffff85;
  }
  html[data-theme=dark] {
    --rota-page:#0d1525; --rota-surface:#172338; --rota-ink:#edf5ff; --rota-muted:#b9cade;
    --rota-edge:#354760; --rota-lilac:#213759; --rota-violet:#a8caff;
    --rota-shadow:inset 0 1px 0 #c8e6ff1c,0 12px 30px -12px #02081199;
    --depth-edge:inset 0 1px 1px #ceeaff22;
  }
  body.rota-dashboard :is(.main,.main.workspace-clear) > :is(.intro,.today-heading)::before {
    background:linear-gradient(100deg,#15244a,transparent 80%),url('/rota-horizon.webp') right bottom / auto 100% no-repeat;
    opacity:.52;
  }
  body.rota-dashboard .main :is(.card,.study-card,.daily-stat,.daily-progress-card) {
    background-image:linear-gradient(155deg,color-mix(in srgb,var(--rota-violet) 6%,transparent),transparent 52%);
    box-shadow:var(--rota-shadow); border-color:var(--rota-edge);
  }
  .rota-dashboard .brand i { box-shadow:var(--depth-edge),0 3px 8px #173e5c24; }
  .visual-chart {
    --plot-text:#d9e9ff; --plot-grid:#b0d5f22e;
    background:radial-gradient(ellipse at 84% 105%,#164a63,transparent 66%),linear-gradient(155deg,#171c4a,#101c3a 62%,#102d44);
    border:1px solid #52688d; box-shadow:inset 0 1px 0 #c3e9ff40,0 8px 20px -12px #09172dcc;
    border-radius:19px; padding:clamp(8px,2vw,19px); min-width:0;
  }
  .visual-chart-metrics { color:var(--plot-text); }
  .visual-chart-metrics > span { color:#8ff5d7; }
  .visual-chart-metrics span[data-direction=down] { color:#ffc397; }
  .visual-line-chart { touch-action:pan-y pinch-zoom; }
  .visual-line-chart text { fill:var(--plot-text); }
  .visual-grid,.visual-guide { stroke:var(--plot-grid); stroke-dasharray:2 5; }
  .visual-guide { stroke:#a9fce0; }
  .visual-mountains { fill:#5579be; opacity:.18; }
  .visual-stop { stop-color:#1ecef3; stop-opacity:.42; }
  .visual-stop-end { stop-color:#4677ed; stop-opacity:.04; }
  .visual-line { stroke:#4de6e6; filter:drop-shadow(0 1px 3px #22cddb63); }
  .visual-point { fill:#d8fff8; stroke:#3de3d7; }
  .visual-point.is-selected { fill:white; stroke:#72ffcf; stroke-width:3; filter:drop-shadow(0 0 5px #65ffc9); }
  .visual-chart-selected { background:#263e59; color:white; border:1px solid #627b93; box-shadow:inset 0 1px 0 #d9faff30; }
  .visual-goal-ring { box-shadow:inset 0 2px 3px #ffffff80,0 4px 8px #084b6129; }
  .visual-goal-ring strong { box-shadow:0 1px 3px #123f4c55; }
  body.rota-dashboard :is(.reasonbar>i,.week-bars i,.hub-bars span,.visual-topic-track i) {
    background-image:linear-gradient(120deg,#ffffff42,transparent 65%);
    box-shadow:var(--depth-edge),inset 0 -1px 2px #14213f32;
  }
  body.rota-dashboard .main :is(table,fieldset) { border-color:var(--rota-edge); }
  @supports (backdrop-filter:blur(12px)) {
    body.rota-dashboard nav.mobile-bottom {
      background:color-mix(in srgb,var(--rota-surface) 92%,transparent);
      backdrop-filter:blur(12px);box-shadow:var(--rota-shadow);
    }
  }
}

/* Keep today's records and analysis in independent desktop columns. */
.today-main .daily-plan-main > .visual-home-charts {
  margin:0;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,18rem),1fr));
}
.today-main #storageStatus:empty { display:none; }
.today-main #dailyQuestions { max-height:none; overflow:visible; }
.today-main .visual-home-charts .visual-empty { margin:.5rem 0 .75rem; }
.today-main #homeNetChart:has(.visual-empty) .visual-net-label { display:none; }
@media(max-width:900px) {
  .today-main .daily-plan-layout { display:flex; flex-direction:column; align-items:stretch; gap:14px; }
  .today-main .daily-plan-main { display:contents; }
  .today-main .daily-plan-layout > .daily-plan-side { order:1; }
  .today-main .daily-plan-main > .visual-home-charts { order:2; }
  .today-main .daily-plan-main > .card { margin-block:0; }
}
