/* The app's look, layered on top of the base styles in styles.css (index.html loads both and puts
   the ui-fresh class on <html>).
   Direction: an evergreen "chalkboard" rail with today's date, a cool paper background, tighter
   spacing and type, quieter cards. Everything else in styles.css still applies. */

html.ui-fresh {
  --paper: #F3F6F4; --sheet: #FFFFFF;
  --ink: #102A26; --ink-2: #4A615C; --ink-3: #6B807B;
  --rule: #DFE7E3; --rule-strong: #C5D3CD;
  --pencil: #F2B400; --pencil-soft: #FFF4CC;
  --margin: #C93B3B; --margin-soft: #FBE7E6;
  --leaf: #1F7F5A; --leaf-soft: #DFF1E8;
  --sky: #2459C2; --sky-soft: #E6EDFA;
  --slate-soft: #EAF0ED;
  --go: #17594A; --go-hover: #11473B; --on-go: #FFFFFF;
  --rail: #0F2E28; --rail-ink: #C4D8D1; --rail-dim: #86A79D; --rail-line: rgba(255, 255, 255, .09);
  --radius-sm: 10px; --radius-lg: 16px;
  --tracking: -0.015em; --tracking-hero: -0.03em;
}
@media (prefers-color-scheme: dark) {
  html.ui-fresh:not([data-theme="light"]) {
    --paper: #0D1614; --sheet: #14201D;
    --ink: #E5EEEB; --ink-2: #ADC0BA; --ink-3: #7F958F;
    --rule: #22332F; --rule-strong: #30463F;
    --pencil: #F5C232; --pencil-soft: #3A3216;
    --margin: #EE7470; --margin-soft: #3A1F20;
    --leaf: #5CC796; --leaf-soft: #15332A;
    --sky: #86ABF5; --sky-soft: #172A4A;
    --slate-soft: #1B2926;
    --go: #46B08F; --go-hover: #5CC39F; --on-go: #04140F;
    --rail: #091311; --rail-line: rgba(255, 255, 255, .07);
  }
}
html.ui-fresh:lang(ar) { --tracking: 0; --tracking-hero: 0; }

/* ---------- type ---------- */
html.ui-fresh body { line-height: 1.5; }
html.ui-fresh h1 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); letter-spacing: -0.025em; margin-bottom: .3rem; }
html.ui-fresh:lang(ar) h1 { letter-spacing: 0; }
html.ui-fresh h2 { font-size: 1.15rem; margin-bottom: .6rem; }
html.ui-fresh h3 { font-size: 1rem; }
html.ui-fresh a { color: var(--sky); text-underline-offset: 2px; }
html.ui-fresh :focus-visible { outline: 2px solid var(--go); outline-offset: 2px; }

/* ---------- header: narrow screens and signed-out pages ---------- */
html.ui-fresh .top { background: var(--rail); }
html.ui-fresh .top-row { min-height: 3.4rem; }
html.ui-fresh .brand { font-size: 1.08rem; letter-spacing: -0.01em; }
html.ui-fresh .who { color: var(--rail-ink); }
html.ui-fresh .who button, html.ui-fresh .lang-pick select { border-color: var(--rail-line); background: rgba(255, 255, 255, .05); border-radius: 8px; }
html.ui-fresh .nav { gap: .35rem; padding-bottom: .6rem; }
html.ui-fresh .nav a { color: var(--rail-ink); border: 0; border-radius: 999px; padding: .38rem .8rem; font-size: .92rem; }
html.ui-fresh .nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
html.ui-fresh .nav a[aria-current="page"] { background: var(--pencil); color: #102A26; }
html.ui-fresh .rail-date { display: none; }

/* The demo bar stays yellow with black text, a little slimmer. */
html.ui-fresh .demo-bar { padding: .3rem 1rem; font-size: .85rem; gap: .6rem; }
html.ui-fresh .demo-bar button, html.ui-fresh .demo-switch select { border-radius: 8px; }

/* ---------- wide screens, signed in: the side rail ---------- */
@media (min-width: 1000px) {
  html.ui-fresh body.has-rail { display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); grid-template-rows: auto 1fr auto; min-height: 100vh; }
  html.ui-fresh body.has-rail > .demo-bar { grid-column: 2; grid-row: 1; }
  html.ui-fresh body.has-rail > .top {
    grid-column: 1; grid-row: 1 / 4; position: sticky; top: 0; height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column; padding: 1.1rem .75rem 1rem;
  }
  html.ui-fresh body.has-rail > main { grid-column: 2; grid-row: 2; width: 100%; max-width: 1100px; margin: 0; padding: 1.75rem clamp(16px, 3vw, 2.75rem) 4rem; }
  html.ui-fresh body.has-rail > #foot, html.ui-fresh body.has-rail > .site-foot { grid-column: 2; }
  html.ui-fresh body.has-rail .top-row { display: contents; }
  html.ui-fresh body.has-rail .brand { order: 1; padding: .2rem .55rem; font-size: 1rem; }
  html.ui-fresh body.has-rail .brand span { white-space: normal; line-height: 1.25; }
  /* The one big moment: today's date in the rail, like the date written on the board. */
  html.ui-fresh body.has-rail .rail-date { order: 2; display: block; margin: 1.6rem .55rem 1.25rem; padding-bottom: 1.1rem; border-bottom: 1px solid var(--rail-line); }
  html.ui-fresh body.has-rail .rail-date span { display: block; color: var(--rail-dim); font-size: .9rem; }
  html.ui-fresh body.has-rail .rail-date strong { display: block; color: #fff; font: 800 1.85rem/1.1 var(--display); letter-spacing: -0.03em; }
  html.ui-fresh:lang(ar) body.has-rail .rail-date strong { letter-spacing: 0; font-weight: 700; }
  html.ui-fresh body.has-rail .nav { order: 3; flex-direction: column; gap: .15rem; overflow: visible; margin: 0; padding: 0; }
  html.ui-fresh body.has-rail .nav a { border-radius: 10px; padding: .5rem .7rem; font-size: .95rem; display: flex; align-items: center; justify-content: space-between; }
  html.ui-fresh body.has-rail .nav a[aria-current="page"] { background: rgba(242, 180, 0, .14); color: #fff; box-shadow: inset 3px 0 0 var(--pencil); }
  html.ui-fresh[dir="rtl"] body.has-rail .nav a[aria-current="page"] { box-shadow: inset -3px 0 0 var(--pencil); }
  html.ui-fresh body.has-rail .who { order: 4; margin: auto 0 0; padding-top: 1rem; border-top: 1px solid var(--rail-line); flex-direction: column; align-items: stretch; gap: .5rem; font-size: .85rem; }
  html.ui-fresh body.has-rail .who > * { width: 100%; }
  html.ui-fresh body.has-rail .who .lang-pick select { width: 100%; }
  html.ui-fresh body.has-rail .who-link { display: flex; flex-direction: column; gap: .1rem; padding: .45rem .55rem; border-radius: 10px; color: var(--rail-ink); text-decoration: none; }
  html.ui-fresh body.has-rail .who-link:hover, html.ui-fresh body.has-rail .who-link[aria-current="page"] { background: rgba(255, 255, 255, .07); }
  html.ui-fresh body.has-rail .who-link > span:first-child { display: block; color: #fff; font-weight: 700; }
  html.ui-fresh body.has-rail .who-acct { color: var(--rail-dim); }
  html.ui-fresh body.has-rail .who-name { padding: .3rem .55rem; }
  html.ui-fresh body.has-rail #signout { justify-content: center; }
}

/* ---------- page ---------- */
html.ui-fresh main { padding-top: 1.5rem; }
html.ui-fresh .page-head { margin-bottom: 1.25rem; gap: .5rem 1.25rem; }
html.ui-fresh .page-head p { font-size: .97rem; }
html.ui-fresh .panel { border-radius: var(--radius-lg); padding: 1.05rem 1.15rem; }
html.ui-fresh .panel + .panel { margin-top: 1rem; }
html.ui-fresh .grid-2 { gap: 1.25rem; }
html.ui-fresh .list > li { padding: .6rem 0; }

/* ---------- controls ---------- */
html.ui-fresh button, html.ui-fresh .btn { border-radius: var(--radius-sm); font-size: .92rem; padding: .5rem .9rem; }
html.ui-fresh button.small, html.ui-fresh a.btn.small, html.ui-fresh label.btn.small { border-radius: 8px; padding: .28rem .6rem; font-size: .84rem; }
html.ui-fresh button.primary, html.ui-fresh .btn.primary { background: var(--go); border-color: var(--go); color: var(--on-go); }
html.ui-fresh button.primary:hover, html.ui-fresh .btn.primary:hover { background: var(--go-hover); border-color: var(--go-hover); filter: none; }
html.ui-fresh input, html.ui-fresh select, html.ui-fresh textarea { border-radius: var(--radius-sm); padding: .55rem .7rem; }
html.ui-fresh input:focus, html.ui-fresh select:focus, html.ui-fresh textarea:focus { outline: none; border-color: var(--go); box-shadow: 0 0 0 3px color-mix(in srgb, var(--go) 22%, transparent); }
html.ui-fresh input[type="checkbox"], html.ui-fresh input[type="radio"] { accent-color: var(--go); }
html.ui-fresh .seg { border-radius: var(--radius-sm); }
html.ui-fresh .seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
html.ui-fresh .chip { font-size: .76rem; padding: .12rem .55rem; }

/* ---------- home dashboards ---------- */
html.ui-fresh .cta-row { gap: .6rem; margin-block-end: 1rem; grid-template-columns: repeat(auto-fit, minmax(14.5rem, 1fr)); }
html.ui-fresh .cta { border-radius: 14px; padding: .8rem .9rem; border-inline-start-width: 3px; gap: .3rem .7rem; }
html.ui-fresh .cta-icon { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 10px; background: var(--sky-soft); font-size: 1.15rem; }
html.ui-fresh .cta.urgent .cta-icon { background: var(--margin-soft); }
html.ui-fresh .cta.done .cta-icon { background: var(--leaf-soft); }
html.ui-fresh .cta-text strong { font-size: .96rem; }
html.ui-fresh .stat-row { gap: .5rem; margin-block-end: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); }
html.ui-fresh .stat { border-radius: 14px; padding: .6rem .8rem; border-color: transparent; }
html.ui-fresh .stat:hover { border-color: var(--rule-strong); }
html.ui-fresh .stat-n { font-size: 1.5rem; letter-spacing: -0.02em; }
html.ui-fresh .try-panel { border: 1px dashed var(--rule-strong); background: transparent; }
html.ui-fresh .kid-card { border-radius: 14px; }

/* ---------- homework notebook and calendar ---------- */
html.ui-fresh .notebook {
  --mg: 5.75rem;
  background: linear-gradient(var(--mg-dir), transparent calc(var(--mg) - 2px), var(--pencil) calc(var(--mg) - 2px), var(--pencil) var(--mg), transparent var(--mg)), var(--sheet);
}
html.ui-fresh .nb-margin .d { font-size: 1.4rem; }
html.ui-fresh .nb-margin .rel { color: var(--margin); }
html.ui-fresh .nb-item > button { padding-block: .45rem; }
html.ui-fresh .cal { border-radius: var(--radius-lg); }
html.ui-fresh .cal .day.today .n { background: var(--go); color: var(--on-go); }
html.ui-fresh .cal .ev { border-radius: 6px; }

/* ---------- dialogs and toasts ---------- */
html.ui-fresh #modal { border-radius: 18px; }
html.ui-fresh #modal::backdrop { background: rgba(10, 30, 26, .45); }
html.ui-fresh #toast { border-radius: 12px; }

/* ---------- sign-in page ---------- */
html.ui-fresh .auth-hero h1 { font-size: clamp(2rem, 4.6vw, 3.2rem); line-height: 1.04; }
html.ui-fresh:lang(ar) .auth-hero h1 { line-height: 1.3; }
html.ui-fresh .auth .panel { border-radius: 20px; }
html.ui-fresh .role-tabs { border-radius: 12px; }

@media (prefers-reduced-motion: reduce) { html.ui-fresh * { scroll-behavior: auto; } }

/* Links inside the rail and tiles keep their own colours. */
html.ui-fresh .brand, html.ui-fresh .brand span { color: #fff; }
html.ui-fresh .stat, html.ui-fresh .stat .stat-n { color: var(--ink); }
html.ui-fresh .stat.warn .stat-n { color: var(--margin); }
@media (min-width: 1000px) {
  html.ui-fresh body.has-rail .who-link { align-items: flex-start; text-align: start; }
  html.ui-fresh body.has-rail .who-acct { border: 0; padding: 0; background: none; font-size: .8rem; }
}
@media (max-width: 640px) {
  html.ui-fresh .demo-bar { font-size: .8rem; padding: .3rem .75rem; }
  html.ui-fresh .demo-bar > span { flex-basis: 100%; line-height: 1.3; }
}
html.ui-fresh main:focus, html.ui-fresh main:focus-visible { outline: none; }
/* Phones: the demo bar is one slim row (the "View as" menu already says it's a demo). */
@media (max-width: 640px) {
  html.ui-fresh .demo-bar > span:first-child { display: none; }
  html.ui-fresh .demo-bar { flex-wrap: nowrap; justify-content: space-between; }
  html.ui-fresh .demo-switch { flex: 1; min-width: 0; display: flex; align-items: center; gap: .4rem; }
  html.ui-fresh .demo-switch select { flex: 1; min-width: 0; font-size: .82rem; }
}

/* ---------- setup checklist ---------- */
html.ui-fresh .setup { border-inline-start: 4px solid var(--go); }
html.ui-fresh .setup-bar span { background: var(--go); }
html.ui-fresh .setup-steps li.next .setup-tick { border-color: var(--go); color: var(--go); }
html.ui-fresh .notice-stats .linklike { padding: .2rem 0; min-height: 0; min-width: 0; }
html.ui-fresh .msg-tabs a[aria-current="page"] { background: var(--go); border-color: var(--go); color: var(--on-go); }
/* top bar (tablets in portrait, phones): the name link stays light on the dark bar */
html.ui-fresh .who-link { color: var(--rail-ink); }
html.ui-fresh .who-link > span:first-child { color: #fff; }

/* Language switch in the top-right corner on wide screens (in addition to the side rail). */
html.ui-fresh .corner-lang { display: none; }
@media (min-width: 1000px) {
  html.ui-fresh body.has-rail > .corner-lang { display: block; grid-column: 2; grid-row: 2; justify-self: end; align-self: start; position: relative; z-index: 5;
    margin: .9rem clamp(16px, 3vw, 2.75rem) 0; }
  html.ui-fresh body.has-rail > .corner-lang select { width: auto; min-height: 0; padding: .3rem 2rem .3rem .8rem; font-size: .9rem; font-weight: 700; border-radius: 999px;
    background-color: var(--sheet) !important; color: var(--ink) !important; border: 1px solid var(--rule-strong) !important; box-shadow: 0 1px 2px rgba(9, 30, 26, .06); }
  html.ui-fresh body.has-rail:has(> .corner-lang) > main { padding-top: 3.9rem; }
}
