/* =====================================================================
   SKILLZY YOUNG SCHOLARS LMS · BASE THEME
   Warm neutral palette. Every colour on the site comes from the
   variables below, so the whole LMS can be re-tinted from this block.
   ===================================================================== */
:root {
  /* Surfaces */
  --bg:           #F7F2EC;   /* page background (warm ivory) */
  --surface:      #FFFFFF;   /* cards */
  --surface-2:    #FBF8F4;   /* quiet panels inside cards */
  --sand:         #F1E9DF;   /* table heads, hovers, soft fills */
  --line:         #E9DFD3;   /* hairlines */
  --line-strong:  #D8CBBC;

  /* Text */
  --ink:          #2A2421;
  --muted:        #7A6E65;

  /* Brand: deep navy from the logo + a warm caramel accent */
  --brand:        #22304F;
  --brand-deep:   #172238;
  --brand-soft:   #F1E9DF;
  --accent:       #C98F62;
  --accent-deep:  #A86F45;
  --accent-soft:  #F8EBDF;
  --gold:         #D9A84E;

  /* Supporting tints (kept under their old names so every page still works) */
  --lav:          #F1E9DF;
  --lav-soft:     #FBF8F4;
  --ok:           #4C7A5B;
  --ok-soft:      #E7F0E8;
  --pink:         #8A6789;
  --pink-soft:    #F2E8F1;
  --sky:          #54779E;
  --sky-soft:     #E7EEF5;
  --danger:       #B4483A;
  --danger-soft:  #F8E5E0;
  --warn-ink:     #8A5A2B;

  /* Shape, depth, motion */
  --radius:       18px;
  --radius-sm:    12px;
  --shadow-sm:    0 1px 2px rgba(42,36,33,.05);
  --shadow:       0 1px 2px rgba(42,36,33,.04), 0 8px 24px rgba(42,36,33,.06);
  --shadow-lg:    0 2px 4px rgba(42,36,33,.05), 0 18px 44px rgba(42,36,33,.12);
  --ring:         0 0 0 4px rgba(201,143,98,.22);
  --ease:         cubic-bezier(.2,.7,.2,1);

  --font:         "Plus Jakarta Sans", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fraunces", "Plus Jakarta Sans", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 15.5px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { color: var(--brand-deep); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.015em; }
h1 { font-family: var(--font-display); font-size: clamp(1.7rem, 2.6vw, 2.2rem); font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: 1.18rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0 0 1em; }
a { color: var(--brand); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
::selection { background: var(--accent); color: #fff; }
hr { border: 0; height: 1px; background: var(--line); margin: 20px 0; }

/* ---------- Page frame for signed-out pages ---------- */
.main { padding: clamp(18px, 2.4vw, 34px); width: 100%; }
.plain { min-height: 100vh; }

/* ---------- Page header ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { position: relative; margin-bottom: 6px; padding-bottom: 12px; }
.page-head h1::after { content: ""; position: absolute; left: 0; bottom: 0; width: 44px; height: 3px; border-radius: 3px; background: var(--accent); transition: width .5s var(--ease); }
.page-head:hover h1::after { width: 84px; }
.page-head p { margin: 0; color: var(--muted); max-width: 78ch; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  transition: box-shadow .25s ease, border-color .25s ease;
}
.card:hover { box-shadow: var(--shadow-lg); border-color: var(--line-strong); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card > h2 { padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.stat {
  position: relative; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: transform .2s var(--ease), box-shadow .2s ease;
}
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat b { display: block; font-size: 1.9rem; font-weight: 700; color: var(--brand-deep); letter-spacing: -0.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .9rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; text-decoration: none; color: var(--ink); display: block; box-shadow: var(--shadow);
  transition: transform .2s var(--ease), box-shadow .2s ease, border-color .2s ease;
}
.tile::after { content: ""; position: absolute; right: -28px; top: -28px; width: 84px; height: 84px; border-radius: 50%; background: var(--accent-soft); transition: transform .35s var(--ease); }
.tile > * { position: relative; z-index: 1; }
.tile b { display: block; font-size: 1.9rem; font-weight: 700; color: var(--brand-deep); letter-spacing: -0.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: .9rem; }
.tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--accent); text-decoration: none; color: var(--ink); }
.tile:hover::after { transform: scale(1.5); }

/* ---------- Hero banner ---------- */
.hero {
  background: linear-gradient(135deg, var(--brand-deep) 0%, var(--brand) 60%, #34456B 100%);
  color: #fff; border-radius: 22px; padding: clamp(22px, 4vw, 38px); margin-bottom: 24px;
  display: grid; gap: 14px; position: relative; overflow: hidden;
}
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(217,168,78,.55) 0%, rgba(217,168,78,0) 70%); }
.hero h1 { color: #fff; margin: 0; }
.hero .when { font-size: 1.05rem; color: rgba(255,255,255,.78); margin: 0; }
.hero .count { font-size: clamp(2.2rem, 6vw, 3.4rem); font-weight: 700; letter-spacing: -0.04em; color: var(--gold); line-height: 1; background: none; padding: 0; margin: 0; }
.hero.live { background: linear-gradient(135deg, #35604A 0%, var(--ok) 100%); }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; position: relative; z-index: 1; }

/* ---------- Rows ---------- */
.row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 10px; margin: 0 -10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; border-radius: 12px; transition: background .15s ease; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row .info { min-width: 0; flex: 1 1 260px; }
.row .info strong { display: block; font-size: 1rem; color: var(--brand-deep); }
.row .info span { color: var(--muted); font-size: .9rem; }
.row .acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Status pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--sand); color: var(--brand); white-space: nowrap; }
.pill.live { background: var(--accent-soft); color: var(--warn-ink); }
.pill.live::before { content: ""; width: 7px; height: 7px; background: var(--accent); border-radius: 50%; animation: pulse-ring 1.5s infinite ease-in-out; }
@keyframes pulse-ring { 0%,100% { transform: scale(.9); box-shadow: 0 0 0 0 rgba(201,143,98,.5); } 50% { transform: scale(1.15); box-shadow: 0 0 0 5px rgba(201,143,98,0); } }
.pill.completed, .pill.present { background: var(--ok-soft); color: var(--ok); }
.pill.cancelled { background: #EFEAE4; color: var(--muted); }
.pill.absent { background: var(--danger-soft); color: var(--danger); }
.pill.pending { background: var(--sky-soft); color: var(--sky); }
.pill.scheduled { background: var(--sand); color: var(--brand); }

.badge, .count { display: inline-block; min-width: 22px; text-align: center; padding: 1px 8px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .74rem; font-weight: 700; line-height: 1.6; }
.count { margin-left: 6px; }

/* ---------- Buttons ---------- */
.btn {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-block; vertical-align: middle; border: 0; cursor: pointer; font: inherit; font-weight: 700;
  padding: 11px 22px; border-radius: 12px; background: var(--brand); color: #fff;
  text-decoration: none; line-height: 1.2; letter-spacing: .005em;
  transition: transform .18s var(--ease), box-shadow .18s ease, background-color .18s ease, color .18s ease;
}
.btn:hover { background-color: var(--brand-deep); text-decoration: none; color: #fff; transform: translateY(-2px); box-shadow: 0 10px 22px rgba(23,34,56,.24); }
.btn:active { transform: translateY(0) scale(.98); box-shadow: none; }
.btn.accent { background: var(--accent); color: #fff; }
.btn.accent:hover { background: var(--accent-deep); color: #fff; box-shadow: 0 10px 22px rgba(168,111,69,.32); }
.btn.ghost { background: transparent; color: var(--brand); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.btn.ghost:hover { background: var(--sand); color: var(--brand-deep); box-shadow: inset 0 0 0 1.5px var(--brand); }
.btn.on-dark { background: transparent; color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.45); }
.btn.on-dark:hover { background: #fff; color: var(--brand); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: #963A2E; box-shadow: 0 10px 22px rgba(180,72,58,.28); }
.btn.small { padding: 7px 14px; font-size: .86rem; border-radius: 10px; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn .ripple { position: absolute; z-index: -1; border-radius: 50%; background: currentColor; opacity: .18; transform: scale(0); pointer-events: none; animation: ripple .6s ease-out forwards; }
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }
form.inline { display: inline; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; color: var(--ink); }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=tel],
input[type=datetime-local], input[type=date], input[type=time], input[type=month], input[type=week], input[type=search], input[type=file], select, textarea {
  width: 100%; font: inherit; padding: 10px 13px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { border-color: var(--accent) !important; outline: none; box-shadow: var(--ring) !important; }
input::placeholder, textarea::placeholder { color: #A99D93; }
input[type=file] { padding: 8px; background: var(--surface-2); border-style: dashed; cursor: pointer; }
input[type=file]::file-selector-button { font: inherit; font-weight: 700; margin-right: 12px; padding: 7px 14px; border: 0; border-radius: 9px; background: var(--brand); color: #fff; cursor: pointer; transition: background .15s ease; }
input[type=file]::file-selector-button:hover { background: var(--accent-deep); }
select { cursor: pointer; }
textarea { resize: vertical; }
input.search { margin-bottom: 14px; max-width: 360px; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); width: 16px; height: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; max-height: 240px; overflow: auto; padding: 4px; }
.check-list label { display: flex; gap: 8px; align-items: center; font-weight: 600; margin: 0; padding: 9px 11px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.check-list label:hover { border-color: var(--accent); background: var(--accent-soft); }
.check-list label:has(input:checked) { border-color: var(--brand); background: var(--sand); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .74rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; background: var(--sand); white-space: nowrap; }
th:first-child { border-radius: 10px 0 0 10px; }
th:last-child { border-radius: 0 10px 10px 0; }
tbody tr { transition: background .12s ease; }
tbody tr:hover td { background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td .btn.small { padding: 6px 11px; font-size: .82rem; }
td form.inline { display: inline-block; vertical-align: middle; }

/* ---------- Segmented control ---------- */
.seg { display: inline-flex; padding: 4px; gap: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.seg label { margin: 0; padding: 7px 14px; cursor: pointer; font-weight: 600; border-radius: 9px; transition: background .15s ease, color .15s ease; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:hover { background: var(--sand); }
.seg label:has(input:checked) { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.seg input:checked + span { color: #fff; }

/* ---------- Messages & banners ---------- */
.flash { position: relative; padding: 13px 16px 13px 18px; border-radius: var(--radius-sm); margin-bottom: 18px; font-weight: 600; border-left: 4px solid currentColor; animation: flashIn .35s var(--ease); transition: opacity .5s ease, transform .5s ease; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.err { background: var(--danger-soft); color: var(--danger); }
.flash.gone { opacity: 0; transform: translateY(-6px); }
@keyframes flashIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.empty { text-align: center; padding: 34px 14px; color: var(--muted); background: var(--surface-2); border: 1.5px dashed var(--line-strong); border-radius: 14px; }
.notice-box { background: var(--accent-soft); border-left: 4px solid var(--accent); border-radius: var(--radius-sm); padding: 12px 14px; font-size: .92rem; color: var(--warn-ink); }

/* Admin "view as" bar */
.viewbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px clamp(12px, 3vw, 28px); background: var(--brand-deep); color: #F4E7D8; font-weight: 600; position: relative; z-index: 80; }
.viewbar strong { color: #fff; }
.viewbar em { font-weight: 500; opacity: .8; }

/* ---------- Due labels ---------- */
.late { color: var(--danger); font-weight: 700; }
b.late { background: var(--danger-soft); padding: 1px 8px; border-radius: 999px; font-size: .78rem; }
.soon { color: var(--warn-ink); font-weight: 700; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: nowrap; margin: 0 0 20px; padding: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); width: fit-content; max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
.tab { border: 0; background: transparent; font: inherit; font-weight: 700; color: var(--muted); padding: 9px 16px; border-radius: 10px; cursor: pointer; white-space: nowrap; transition: background .18s ease, color .18s ease, box-shadow .18s ease; }
.tab:hover { background: var(--sand); color: var(--brand-deep); text-decoration: none; }
.tab.on { background: var(--brand); color: #fff; box-shadow: 0 6px 14px rgba(23,34,56,.2); }
.tab.on .count { background: var(--accent); color: #fff; }
.tabpanel { display: none; }
.tabpanel.on { display: block; animation: fadeUp .3s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Filter chips ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.chip { border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; padding: 7px 15px; border-radius: 99px; cursor: pointer; transition: all .18s ease; }
.chip:hover { border-color: var(--accent); background: var(--accent-soft); text-decoration: none; color: var(--ink); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Expandable forms ---------- */
details > summary { cursor: pointer; }
.acc { margin-top: 14px; border: 1.5px dashed var(--line-strong); border-radius: 14px; background: var(--surface-2); overflow: hidden; transition: border-color .2s ease, background .2s ease; }
.acc > summary { padding: 12px 16px; font-weight: 700; color: var(--brand); list-style: none; display: flex; align-items: center; gap: 8px; transition: background .15s ease; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s ease; opacity: .6; }
.acc[open] > summary::after { transform: rotate(-135deg); }
.acc > summary:hover { background: var(--sand); }
.acc[open] { border-style: solid; border-color: var(--accent); background: var(--surface); }
.acc[open] > summary { background: var(--accent-soft); border-bottom: 1px solid var(--line); }
.acc > form, .acc > div { padding: 16px; animation: fadeUp .25s var(--ease); }

/* ---------- Homework ---------- */
.hw { border-left: 4px solid var(--accent); }
.work { padding: 14px 0; border-bottom: 1px solid var(--line); }
.work:last-child { border-bottom: 0; }
.answer { margin: 10px 0; padding: 12px 14px; background: var(--surface-2); border-left: 4px solid var(--brand); border-radius: 10px; font-size: .95rem; }
.feedback-box { margin: 12px 0; padding: 14px 16px; background: var(--ok-soft); border-left: 4px solid var(--ok); border-radius: 12px; color: #33553F; }
.feedback-box strong { color: #33553F; }
.grade-form { margin-top: 12px; padding: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
.annotation-wrapper { background: var(--surface) !important; border-color: var(--line-strong) !important; }

/* ---------- Star ratings ---------- */
.stars { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.stars input { position: absolute; opacity: 0; pointer-events: none; }
.stars label { margin: 0; cursor: pointer; font-size: 2.1rem; line-height: 1; color: #DDD3C7; transition: color .15s ease, transform .15s var(--ease); }
.stars label:hover, .stars label:hover ~ label, .stars input:checked ~ label { color: var(--gold); }
.stars label:hover { transform: scale(1.2) rotate(-6deg); }
.stars input:focus-visible + label { outline: 3px solid var(--accent); border-radius: 6px; }
.stars-static { color: var(--gold); letter-spacing: 2px; white-space: nowrap; }
.stars-static .off { color: #DDD3C7; }

/* ---------- Quiz ---------- */
.quiz fieldset.q, .card.q { border: 1px solid var(--line); border-radius: var(--radius); }
.quiz fieldset { min-width: 0; margin: 0 0 16px; padding: 16px 18px; background: var(--surface); }
.quiz legend, .card.q h3 { font-weight: 700; color: var(--brand-deep); padding: 0 6px; }
.opt { display: flex; align-items: center; gap: 10px; margin: 8px 0; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); font-weight: 600; cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s var(--ease); }
label.opt:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateX(3px); }
label.opt:has(input:checked) { border-color: var(--brand); background: var(--sand); box-shadow: inset 4px 0 0 var(--accent); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); color: #33553F; cursor: default; }
.opt.wrong { border-color: var(--danger); background: var(--danger-soft); color: #8C3327; cursor: default; }
.sticky { position: sticky; top: 84px; z-index: 5; }
.bar { position: relative; height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 10px 0; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--gold)); transition: width .5s var(--ease); }
.bar.sticky { height: auto; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: visible; border-radius: 14px; }
.bar.sticky > i { position: absolute; left: 0; bottom: 0; height: 4px; border-radius: 0 99px 99px 0; }
.result { text-align: center; background: linear-gradient(135deg, var(--surface) 0%, var(--accent-soft) 100%); }
.score { display: inline-grid; place-items: center; align-content: center; gap: 2px; width: 130px; height: 130px; border-radius: 50%; margin: 6px auto 12px; background: var(--surface); border: 8px solid var(--line-strong); box-shadow: var(--shadow); animation: pop .5s var(--ease); }
@keyframes pop { from { transform: scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }
.score b { font-size: 2.5rem; line-height: 1; color: var(--brand-deep); }
.score span { font-size: .78rem; color: var(--muted); font-weight: 600; }
.score.good { border-color: var(--ok); }

/* ---------- Progress ring ---------- */
.ring { position: relative; width: 120px; height: 120px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .trk { stroke: var(--line); }
.ring .val { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: var(--off, 326.7); animation: ringIn 1.1s var(--ease) both; }
@keyframes ringIn { from { stroke-dashoffset: 326.7; } to { stroke-dashoffset: var(--off, 326.7); } }
.ring-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring-c b { font-size: 1.9rem; line-height: 1; color: var(--brand-deep); font-weight: 700; }
.ring-c span { font-size: .74rem; color: var(--muted); font-weight: 600; }

/* ---------- Profile facts ---------- */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0; margin: 0; }
.facts dt, .facts dd { padding: 11px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); font-weight: 600; font-size: .9rem; padding-right: 24px; }
.facts dd { margin: 0; font-weight: 600; color: var(--brand-deep); word-break: break-word; }
.facts dt:last-of-type, .facts dd:last-of-type { border-bottom: 0; }
.plan-box { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; padding: 20px; border-radius: 16px; background: linear-gradient(135deg, var(--surface-2) 0%, var(--accent-soft) 100%); border: 1px solid var(--line); }
.plan-box > div:last-child { flex: 1 1 260px; }

/* ---------- Messages / chat ---------- */
.chat-shell { display: grid; grid-template-columns: 320px 1fr; height: min(74vh, 720px); min-height: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); }
.chat-list { border-right: 1px solid var(--line); padding: 14px; overflow-y: auto; background: var(--surface-2); }
.chat-list input.search { max-width: none; border-radius: 99px; }
.conv { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 4px; border-radius: 14px; text-decoration: none; color: var(--ink); border: 1px solid transparent; transition: background .15s ease, border-color .15s ease, transform .15s var(--ease); }
.conv:hover { background: var(--surface); text-decoration: none; border-color: var(--line); transform: translateX(2px); color: var(--ink); }
.conv.on { background: var(--surface); border-color: var(--line-strong); box-shadow: inset 3px 0 0 var(--accent), var(--shadow-sm); }
.conv .avatar, .chat-head .avatar { flex: none; }
.conv-t { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.conv-t strong { color: var(--brand-deep); font-size: .96rem; }
.conv-t small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-pane { display: flex; flex-direction: column; min-width: 0; background: var(--surface); }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); background: var(--surface); }
.chat-head .back { display: none; width: 34px; height: 34px; border-radius: 50%; background: var(--sand); color: var(--brand); place-items: center; font-weight: 700; text-decoration: none; }
.chat-log { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.bubble { max-width: min(78%, 520px); padding: 10px 14px 6px; border-radius: 18px; line-height: 1.45; word-wrap: break-word; box-shadow: var(--shadow-sm); animation: bubbleIn .25s var(--ease); }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.bubble time { display: block; margin-top: 4px; font-size: .7rem; opacity: .65; text-align: right; }
.bubble.me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 6px; }
.bubble.them { align-self: flex-start; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.composer { display: flex; gap: 10px; align-items: flex-end; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--surface); }
.composer textarea { flex: 1; resize: none; max-height: 120px; border-radius: 20px; padding: 11px 16px; background: var(--surface-2); }
.composer .btn { flex: none; }
@media (max-width: 760px) {
  .chat-shell { grid-template-columns: 1fr; height: 76vh; }
  .chat-shell .chat-pane { display: none; }
  .chat-shell.open .chat-list { display: none; }
  .chat-shell.open .chat-pane { display: flex; }
  .chat-head .back { display: grid; }
}

/* ---------- Sign-in pages ---------- */
.login { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; background: var(--bg); }
.login-art {
  position: relative; overflow: hidden; isolation: isolate;
  margin: 18px 0 18px 18px; border-radius: 28px;
  padding: clamp(28px, 4.5vw, 64px);
  display: flex; flex-direction: column; justify-content: space-between; gap: 28px;
  color: #fff;
  background:
    radial-gradient(60% 50% at 88% 8%, rgba(217,168,78,.34) 0%, rgba(217,168,78,0) 70%),
    radial-gradient(70% 60% at 0% 100%, rgba(201,143,98,.42) 0%, rgba(201,143,98,0) 70%),
    linear-gradient(150deg, var(--brand-deep) 0%, var(--brand) 55%, #3A3550 100%);
}
.login-art::before, .login-art::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; border: 1px solid rgba(255,255,255,.12); animation: drift 16s ease-in-out infinite alternate; }
.login-art::before { width: 460px; height: 460px; right: -160px; top: -140px; }
.login-art::after { width: 300px; height: 300px; left: -90px; bottom: -110px; animation-duration: 20s; animation-direction: alternate-reverse; }
@keyframes drift { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(18px,22px,0) scale(1.08); } }
.login-art h1 { color: #fff; font-size: clamp(2.1rem, 4vw, 3.3rem); line-height: 1.08; max-width: 13ch; margin-bottom: .45em; animation: fadeUp .7s var(--ease) both; }
.login-art p { color: rgba(255,255,255,.82); max-width: 40ch; font-size: 1.05rem; animation: fadeUp .7s .08s var(--ease) both; }
.login-art .brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--gold), var(--accent)); color: #fff; font-weight: 800; font-size: 1.3rem; display: grid; place-items: center; }
.brand-text { font-weight: 700; font-size: 1.1rem; line-height: 1.1; display: flex; flex-direction: column; }
.login-form { display: grid; place-items: center; padding: clamp(22px, 4vw, 56px); }
.login-form form { width: 100%; max-width: 420px; display: grid; gap: 18px; background: var(--surface); padding: clamp(26px, 3vw, 38px); border-radius: 24px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: fadeUp .6s .1s var(--ease) both; }
.login-form form h2 { font-family: var(--font-display); font-weight: 600; color: var(--brand-deep); margin: 0; letter-spacing: -0.02em; }
.login-form form input { padding: 13px 14px; }
.login-form form .btn { width: 100%; padding: 14px 24px; font-size: 1rem; }
@media (max-width: 860px) {
  .grid.cols-2, .grid.cols-3, .form-grid { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-art { margin: 12px 12px 0; min-height: 0; border-radius: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
@media print { .btn, .support-float { display: none !important; } body { background: #fff; } }