/* ==========================================================================
   THE LEARNING PLANET — portal stylesheet
   Loaded after assets/css/style.css, which owns the brand tokens. Nothing is
   redefined here except in dark mode: the sidebar, cards, tables and charts
   all derive from the same --violet / --ink / --radius / --shadow variables
   the public site uses, so the two halves read as one product.
   ========================================================================== */

:root {
  --sidebar-w: 268px;
  --topbar-h: 68px;
  --panel: #ffffff;
  --panel-2: var(--surface);
  --grid-line: var(--line);
  --text: var(--ink);
  --text-muted: var(--muted);
  --text-subtle: var(--subtle);
  --good: #10a37f;
  --good-bg: #e7f7f2;
  --warn: #b57500;
  --warn-bg: #fff5e2;
  --bad: #c2402f;
  --bad-bg: #fdeeeb;
  --info-bg: #ecf0ff;
}

/* Dark mode: only the tokens change. Every component follows automatically. */
[data-theme="dark"] {
  --white: #10141b;
  --paper: #0c1017;
  --surface: #151b25;
  --surface-2: #1b2230;
  --line: #232c3a;
  --line-strong: #2d3847;
  --ink: #e9edf4;
  --muted: #97a2b4;
  --subtle: #74809333;
  --panel: #131922;
  --panel-2: #171e29;
  --text: #e9edf4;
  --text-muted: #98a3b5;
  --text-subtle: #6f7b8d;
  --good-bg: #10281f;
  --warn-bg: #2a2110;
  --bad-bg: #2a1614;
  --info-bg: #171d33;
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, .3);
  --shadow-md: 0 20px 60px rgba(0, 0, 0, .42);
  --shadow-lg: 0 35px 100px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
[data-theme="dark"] body {
  background:
    radial-gradient(circle at 12% 8%, rgba(101, 85, 255, .10), transparent 26rem),
    radial-gradient(circle at 88% 12%, rgba(56, 189, 248, .07), transparent 28rem),
    var(--paper);
  color: var(--text);
}
[data-theme="dark"] .progress-ring::before { background: var(--panel); }

/* ------------------------------------------------------------------ shell */

body.portal-body { overflow-x: hidden; }

.portal {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* ------------------------------------------------------------------ sidebar */

.side {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  border-right: 1px solid var(--grid-line);
  background: var(--panel);
  z-index: 60;
}

.side-head {
  display: flex;
  align-items: center;
  gap: 11px;
  height: var(--topbar-h);
  padding: 0 20px;
  border-bottom: 1px solid var(--grid-line);
  flex-shrink: 0;
}
.side-head .brand-mark { width: 34px; height: 34px; flex-shrink: 0; }
[data-theme="dark"] .side-head .brand-mark circle[stroke],
[data-theme="dark"] .side-head .brand-mark ellipse[stroke],
[data-theme="dark"] .brand-mark circle[stroke],
[data-theme="dark"] .brand-mark ellipse[stroke] { stroke: #dfe5ee; }
.side-head b {
  display: block;
  font-family: "Space Grotesk", Inter, sans-serif;
  font-size: .98rem;
  letter-spacing: -.03em;
  line-height: 1.15;
}
.side-head small {
  display: block;
  color: var(--text-subtle);
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.side-scroll { flex: 1; overflow-y: auto; padding: 16px 12px 24px; scrollbar-width: thin; }
.side-scroll::-webkit-scrollbar { width: 6px; }
.side-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }

.side-group { margin-bottom: 18px; }
.side-group > span {
  display: block;
  padding: 0 12px 8px;
  color: var(--text-subtle);
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.side-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  margin-bottom: 2px;
  color: var(--text-muted);
  font-size: .855rem;
  font-weight: 600;
  border-radius: 12px;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.side-link:hover { background: var(--surface); color: var(--text); }
.side-link:active { transform: translateX(1px); }
.side-link .ico {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex-shrink: 0;
  color: var(--text-subtle);
  font-size: .82rem;
  border: 1px solid var(--grid-line);
  border-radius: 9px;
  background: var(--panel-2);
  transition: inherit;
}
.side-link span.label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.side-link.is-active { color: var(--violet); background: color-mix(in srgb, var(--violet) 9%, transparent); }
.side-link.is-active .ico {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--violet), var(--violet-2));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--violet) 34%, transparent);
}
.side-link.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  width: 3px;
  height: 20px;
  transform: translateY(-50%);
  border-radius: 0 3px 3px 0;
  background: var(--violet);
}

.side-badge {
  min-width: 20px;
  padding: 2px 6px;
  color: #fff;
  font-size: .66rem;
  font-weight: 800;
  text-align: center;
  border-radius: 99px;
  background: var(--rose);
}

.side-foot { padding: 12px; border-top: 1px solid var(--grid-line); flex-shrink: 0; }
.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 13px;
  background: var(--panel-2);
}
.side-user b { display: block; font-size: .8rem; line-height: 1.3; }
.side-user small { display: block; color: var(--text-subtle); font-size: .68rem; }
.side-user .avatar-chip { flex-shrink: 0; }

/* ------------------------------------------------------------------ topbar */

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--topbar-h);
  padding: 0 22px;
  border-bottom: 1px solid var(--grid-line);
  /* Glassmorphism, kept subtle so text stays crisp */
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}
.topbar h1 {
  margin: 0;
  font-family: "Space Grotesk", Inter, sans-serif;
  font-size: 1.16rem;
  font-weight: 600;
  letter-spacing: -.035em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar .crumb { display: block; color: var(--text-subtle); font-size: .68rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.topbar-spacer { flex: 1; }

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--text-muted);
  font-size: .95rem;
  border: 1px solid var(--grid-line);
  border-radius: 12px;
  background: var(--panel);
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease, transform .18s ease, background .18s ease;
}
.icon-btn:hover { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 40%, var(--line)); transform: translateY(-1px); }
.icon-btn .dot {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  color: #fff;
  font-size: .6rem;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  border-radius: 99px;
  background: var(--rose);
  box-shadow: 0 0 0 2px var(--panel);
}

.menu-btn { display: none; }

/* dropdown panels (notifications, user menu) */
.pop {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(360px, calc(100vw - 32px));
  padding: 8px;
  border: 1px solid var(--grid-line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
  z-index: 80;
}
.pop.open { opacity: 1; visibility: visible; transform: translateY(0); }
.pop-wrap { position: relative; }
.pop-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 10px; border-bottom: 1px solid var(--grid-line); }
.pop-head b { font-size: .84rem; }
.pop-head a { color: var(--violet); font-size: .72rem; font-weight: 700; }
.pop-list { max-height: 340px; overflow-y: auto; padding: 6px 0; }
.pop-item { display: flex; gap: 11px; padding: 10px; border-radius: 12px; transition: background .16s ease; }
.pop-item:hover { background: var(--surface); }
.pop-item.unread { background: color-mix(in srgb, var(--violet) 6%, transparent); }
.pop-item .ico { display: grid; place-items: center; width: 30px; height: 30px; flex-shrink: 0; border-radius: 9px; background: var(--panel-2); font-size: .8rem; }
.pop-item b { display: block; font-size: .8rem; line-height: 1.35; }
.pop-item p { margin: 2px 0 0; color: var(--text-muted); font-size: .74rem; line-height: 1.5; }
.pop-item time { display: block; margin-top: 3px; color: var(--text-subtle); font-size: .68rem; }
.pop-foot { padding: 8px 10px 4px; border-top: 1px solid var(--grid-line); text-align: center; }
.pop-foot a { color: var(--violet); font-size: .76rem; font-weight: 700; }

.menu-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: var(--text-muted); font-size: .82rem; font-weight: 600; border-radius: 11px; }
.menu-item:hover { background: var(--surface); color: var(--text); }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--grid-line); }

/* ------------------------------------------------------------------ content */

.content { padding: 26px 22px 60px; }
.wrap { width: min(1320px, 100%); margin-inline: auto; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head .eyebrow { margin-bottom: 8px; }
.page-head h2 {
  margin: 0;
  font-family: "Space Grotesk", Inter, sans-serif;
  font-size: clamp(1.55rem, 2.4vw, 2.15rem);
  font-weight: 600;
  letter-spacing: -.045em;
  line-height: 1.06;
}
.page-head p { margin: 8px 0 0; max-width: 62ch; color: var(--text-muted); font-size: .9rem; line-height: 1.65; }
.page-actions { display: flex; flex-wrap: wrap; gap: 9px; }

/* ------------------------------------------------------------------ cards */

.card-p {
  padding: 20px;
  border: 1px solid var(--grid-line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.card-p.glass {
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { margin: 0; font-family: "Space Grotesk", Inter, sans-serif; font-size: 1rem; font-weight: 600; letter-spacing: -.025em; }
.card-head p { margin: 3px 0 0; color: var(--text-subtle); font-size: .76rem; }
.card-head a.more { color: var(--violet); font-size: .76rem; font-weight: 700; white-space: nowrap; }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr); align-items: start; }
.g-side { grid-template-columns: minmax(0, 1fr) minmax(0, 1.62fr); align-items: start; }

/* ------------------------------------------------------------------ stat tiles */

.stat-tile {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--grid-line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  transition: transform .24s ease, box-shadow .24s ease;
}
.stat-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
/* the orbit echo from the public site's planet motif */
.stat-tile::after {
  content: "";
  position: absolute;
  right: -46px;
  top: -46px;
  width: 118px;
  height: 118px;
  border: 1px solid color-mix(in srgb, var(--accent, var(--violet)) 22%, transparent);
  border-radius: 50%;
  pointer-events: none;
}
.stat-tile .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.stat-tile .ico {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #fff;
  font-size: .92rem;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent, var(--violet)), color-mix(in srgb, var(--accent, var(--violet)) 62%, #fff));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent, var(--violet)) 30%, transparent);
}
.stat-tile .k {
  display: block;
  font-family: "Space Grotesk", Inter, sans-serif;
  font-size: 1.92rem;
  font-weight: 600;
  letter-spacing: -.05em;
  line-height: 1;
}
.stat-tile .l { display: block; margin-top: 7px; color: var(--text-muted); font-size: .78rem; font-weight: 600; }
.stat-tile .sub { display: block; margin-top: 4px; color: var(--text-subtle); font-size: .71rem; }

.trend { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 700; }
.trend.up { color: var(--good); }
.trend.down { color: var(--bad); }
.trend.flat { color: var(--text-subtle); }

/* ------------------------------------------------------------------ pills, chips, avatars */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
  border-radius: 99px;
}
.pill-good { color: var(--good); background: var(--good-bg); }
.pill-warn { color: var(--warn); background: var(--warn-bg); }
.pill-bad { color: var(--bad); background: var(--bad-bg); }
.pill-info { color: var(--violet); background: var(--info-bg); }
.pill-muted { color: var(--text-muted); background: var(--surface-2); }
.pill-live { color: #fff; background: var(--rose); }
.pill-live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  animation: livePulse 1.4s ease-in-out infinite;
}
@keyframes livePulse { 50% { opacity: .25; } }

.avatar-chip {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #fff;
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .02em;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent, var(--violet)), color-mix(in srgb, var(--accent, var(--violet)) 58%, #fff));
}
.avatar-chip.lg { width: 50px; height: 50px; font-size: 1rem; border-radius: 15px; }
.avatar-chip.sm { width: 28px; height: 28px; font-size: .66rem; border-radius: 9px; }

.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who b { display: block; font-size: .84rem; font-weight: 600; line-height: 1.3; }
.who small { display: block; color: var(--text-subtle); font-size: .72rem; }

.dot-sep { color: var(--text-subtle); }

/* ------------------------------------------------------------------ tables */

.table-wrap { overflow-x: auto; border: 1px solid var(--grid-line); border-radius: var(--radius-md); background: var(--panel); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .855rem; }
table.tbl th {
  padding: 13px 16px;
  color: var(--text-subtle);
  font-size: .69rem;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
  background: var(--panel-2);
  border-bottom: 1px solid var(--grid-line);
}
table.tbl th a { display: inline-flex; align-items: center; gap: 5px; }
table.tbl th a:hover { color: var(--violet); }
table.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--grid-line); vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr { transition: background .14s ease; }
table.tbl tbody tr:hover { background: var(--surface); }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td.tight { white-space: nowrap; }
table.tbl .muted { color: var(--text-muted); }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions a, .row-actions button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--text-muted);
  font-size: .8rem;
  border: 1px solid var(--grid-line);
  border-radius: 9px;
  background: var(--panel);
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease;
}
.row-actions a:hover, .row-actions button:hover { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 40%, var(--line)); }

/* toolbar above a table */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 14px; }
.toolbar .search { position: relative; flex: 1; min-width: 200px; max-width: 380px; }
.toolbar .search input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  color: var(--text);
  font-size: .85rem;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--panel);
}
.toolbar .search::before {
  content: "⌕";
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  font-size: 1rem;
}
.toolbar select, .toolbar input[type="date"] {
  padding: 10px 12px;
  color: var(--text);
  font-size: .82rem;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--panel);
}
.toolbar-spacer { flex: 1; }

.btn-mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 14px;
  color: var(--text);
  font-size: .8rem;
  font-weight: 700;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--panel);
  cursor: pointer;
  transition: border-color .18s ease, color .18s ease, transform .18s ease;
}
.btn-mini:hover { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 44%, var(--line)); transform: translateY(-1px); }
.btn-mini.solid { color: #fff; border-color: transparent; background: linear-gradient(120deg, var(--violet), #7a64ff); }
.btn-mini.solid:hover { color: #fff; }
.btn-mini.ghost { background: transparent; }

/* pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.pager .info { color: var(--text-subtle); font-size: .76rem; }
.pager .pages { display: flex; gap: 5px; }
.pager .pages a, .pager .pages span {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 600;
  border: 1px solid var(--grid-line);
  border-radius: 10px;
}
.pager .pages a:hover { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 40%, var(--line)); }
.pager .pages .cur { color: #fff; border-color: transparent; background: var(--violet); }
.pager .pages .gap { border: 0; }

/* ------------------------------------------------------------------ lists */

.list { display: flex; flex-direction: column; gap: 2px; }
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  transition: background .16s ease;
}
.list-item:hover { background: var(--surface); }
.list-item .ico {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  color: var(--accent, var(--violet));
  font-size: .92rem;
  border: 1px solid color-mix(in srgb, var(--accent, var(--violet)) 24%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent, var(--violet)) 8%, transparent);
}
.list-item .body { flex: 1; min-width: 0; }
.list-item b { display: block; font-size: .855rem; font-weight: 600; line-height: 1.35; }
.list-item p { margin: 3px 0 0; color: var(--text-muted); font-size: .76rem; line-height: 1.5; }
.list-item .end { flex-shrink: 0; text-align: right; }
.list-item .end small { display: block; color: var(--text-subtle); font-size: .71rem; }

.divide > * + * { border-top: 1px solid var(--grid-line); }

/* ------------------------------------------------------------------ progress */

.bar { height: 7px; overflow: hidden; border-radius: 99px; background: var(--surface-2); }
.bar > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent, var(--violet)), color-mix(in srgb, var(--accent, var(--violet)) 55%, #fff));
  transition: width .8s cubic-bezier(.22, .8, .28, 1);
}
.bar.thin { height: 5px; }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-row .bar { flex: 1; }
.bar-row b { font-size: .78rem; font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }

.ring {
  --p: 0;
  --size: 108px;
  position: relative;
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: conic-gradient(var(--accent, var(--violet)) calc(var(--p) * 1%), var(--surface-2) 0);
}
.ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--panel); box-shadow: inset 0 0 0 1px var(--grid-line); }
.ring .in { position: relative; z-index: 1; text-align: center; }
.ring .in b { display: block; font-family: "Space Grotesk", Inter, sans-serif; font-size: 1.5rem; font-weight: 600; letter-spacing: -.04em; line-height: 1; }
.ring .in small { display: block; margin-top: 2px; color: var(--text-subtle); font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }

/* ------------------------------------------------------------------ charts (inline SVG) */

.chart { width: 100%; overflow: visible; }
.chart .grid-l { stroke: var(--grid-line); stroke-width: 1; }
.chart .axis { fill: var(--text-subtle); font-size: 10px; font-weight: 600; }
.chart .line { fill: none; stroke: var(--violet); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chart .area { fill: url(#tlpArea); }
.chart .dot { fill: var(--panel); stroke: var(--violet); stroke-width: 2.2; }
.chart .dot:hover { r: 5.5; }
.chart .bar-r { fill: var(--violet); rx: 4; transition: opacity .2s ease; }
.chart .bar-r:hover { opacity: .78; }
.chart .bar-bg { fill: var(--surface-2); rx: 4; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: .74rem; font-weight: 600; }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; background: var(--violet); }

.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ calendar */

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal .dow { padding: 6px 0; color: var(--text-subtle); font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; text-align: center; }
.cal .day {
  position: relative;
  min-height: 62px;
  padding: 6px 7px;
  border: 1px solid var(--grid-line);
  border-radius: 12px;
  background: var(--panel);
}
.cal .day.out { opacity: .38; }
.cal .day.today { border-color: var(--violet); box-shadow: inset 0 0 0 1px var(--violet); }
.cal .day > span { color: var(--text-muted); font-size: .72rem; font-weight: 700; }
.cal .ev {
  display: block;
  margin-top: 4px;
  padding: 2px 5px;
  color: #fff;
  font-size: .63rem;
  font-weight: 700;
  border-radius: 5px;
  background: var(--accent, var(--violet));
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------------------ forms in portals */

.form-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.field label, .fld label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .01em;
}
.fld { margin-bottom: 14px; }
.fld .input, .fld .select, .fld .textarea, .fld input[type="text"], .fld input[type="email"],
.fld input[type="password"], .fld input[type="date"], .fld input[type="number"], .fld input[type="tel"],
.fld select, .fld textarea {
  width: 100%;
  padding: 12px 14px;
  color: var(--text);
  font-size: .875rem;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--paper);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.fld input:focus, .fld select:focus, .fld textarea:focus,
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--violet) 12%, transparent);
}
.fld .hint { display: block; margin-top: 5px; color: var(--text-subtle); font-size: .72rem; }
.fld .err { display: block; margin-top: 5px; color: var(--bad); font-size: .74rem; font-weight: 600; }
.fld.bad input, .fld.bad select, .fld.bad textarea { border-color: var(--bad); background: var(--bad-bg); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { position: relative; width: 42px; height: 24px; border-radius: 99px; background: var(--line-strong); transition: background .2s ease; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.2); transition: transform .2s ease; }
.switch input:checked + .track { background: var(--violet); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px color-mix(in srgb, var(--violet) 18%, transparent); }

/* attendance quick-marking control */
.att-set { display: inline-flex; padding: 3px; border: 1px solid var(--grid-line); border-radius: 11px; background: var(--panel-2); }
.att-set label { position: relative; cursor: pointer; }
.att-set input { position: absolute; opacity: 0; }
.att-set span {
  display: block;
  padding: 6px 12px;
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 700;
  border-radius: 8px;
  transition: background .16s ease, color .16s ease;
}
.att-set input:checked + span { color: #fff; }
.att-set label.p input:checked + span { background: var(--good); }
.att-set label.a input:checked + span { background: var(--bad); }
.att-set label.l input:checked + span { background: var(--warn); }
.att-set label.e input:checked + span { background: var(--muted); }
.att-set input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--violet) 22%, transparent); }

/* ------------------------------------------------------------------ empty & skeleton */

.empty { padding: 46px 20px; text-align: center; }
.empty .mark {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin: 0 auto 16px;
  color: var(--violet);
  font-size: 1.5rem;
  border: 1px dashed color-mix(in srgb, var(--violet) 34%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--violet) 6%, transparent);
}
.empty b { display: block; font-family: "Space Grotesk", Inter, sans-serif; font-size: 1.02rem; font-weight: 600; letter-spacing: -.02em; }
.empty p { margin: 7px auto 16px; max-width: 44ch; color: var(--text-muted); font-size: .84rem; line-height: 1.6; }

/* ------------------------------------------------------------------ auth pages */

.auth {
  display: grid;
  grid-template-columns: 1.02fr .98fr;
  min-height: 100vh;
}
.auth-aside {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px;
  color: #eef1f7;
  background: linear-gradient(150deg, #131820, #1b2333 52%, #16283f);
}
.auth-aside .brand-name, .auth-aside .brand-name small { color: #fff; }
.auth-aside h2 {
  margin: 0 0 14px;
  max-width: 15ch;
  font-family: "Space Grotesk", Inter, sans-serif;
  font-size: clamp(2rem, 3.4vw, 3.1rem);
  font-weight: 600;
  letter-spacing: -.05em;
  line-height: 1.02;
}
.auth-aside p { max-width: 44ch; color: #b9c2d2; font-size: .92rem; line-height: 1.75; }
.auth-aside .orbit {
  position: absolute;
  right: -140px;
  top: 50%;
  width: 520px;
  height: 520px;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 50%;
  pointer-events: none;
}
.auth-aside .orbit::before {
  content: "";
  position: absolute;
  inset: 74px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 50%;
}
.auth-aside .planet {
  position: absolute;
  right: 60px;
  top: 50%;
  width: 190px;
  height: 190px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at 33% 28%, #8b7bff, #5040d6 62%, #2f2699);
  box-shadow: 0 40px 90px rgba(80, 64, 214, .42);
}
.auth-aside .moon {
  position: absolute;
  right: 22px;
  top: 32%;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ffc07a, #ff7d2f);
  box-shadow: 0 14px 30px rgba(255, 125, 47, .4);
}
.auth-stats { display: flex; gap: 26px; flex-wrap: wrap; position: relative; z-index: 2; }
.auth-stats div b { display: block; font-family: "Space Grotesk", Inter, sans-serif; font-size: 1.5rem; font-weight: 600; letter-spacing: -.04em; }
.auth-stats div small { color: #9aa5b8; font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }

.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: min(452px, 100%); }
.auth-card h1 {
  margin: 0 0 8px;
  font-family: "Space Grotesk", Inter, sans-serif;
  font-size: 1.92rem;
  font-weight: 600;
  letter-spacing: -.045em;
}
.auth-card > p { margin: 0 0 26px; color: var(--text-muted); font-size: .89rem; line-height: 1.65; }

.role-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-bottom: 22px; }
.role-tabs label { position: relative; cursor: pointer; }
.role-tabs input { position: absolute; opacity: 0; }
.role-tabs .tab {
  display: block;
  padding: 11px 6px;
  color: var(--text-muted);
  font-size: .76rem;
  font-weight: 700;
  text-align: center;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--panel);
  transition: all .18s ease;
}
.role-tabs .tab i { display: block; margin-bottom: 4px; font-size: .95rem; font-style: normal; }
.role-tabs input:checked + .tab {
  color: var(--violet);
  border-color: var(--violet);
  background: color-mix(in srgb, var(--violet) 8%, transparent);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--violet) 16%, transparent);
}
.role-tabs input:focus-visible + .tab { box-shadow: 0 0 0 4px color-mix(in srgb, var(--violet) 18%, transparent); }

.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 20px; }
.auth-row label { display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: .8rem; font-weight: 600; cursor: pointer; }
.auth-row a { color: var(--violet); font-size: .8rem; font-weight: 700; }
.auth-foot { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--grid-line); color: var(--text-muted); font-size: .84rem; text-align: center; }
.auth-foot a { color: var(--violet); font-weight: 700; }

.demo-creds { margin-top: 18px; padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: 15px; background: var(--panel-2); }
.demo-creds b { display: block; margin-bottom: 8px; font-size: .74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-subtle); }
.demo-creds button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 7px 9px;
  margin-bottom: 4px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .74rem;
  text-align: left;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  transition: background .16s ease;
}
.demo-creds button:hover { background: var(--surface); }
.demo-creds button em { color: var(--text-subtle); font-style: normal; }

/* steps (registration wizard) */
.steps { display: flex; align-items: center; gap: 8px; margin-bottom: 26px; }
.steps .step { display: flex; align-items: center; gap: 8px; color: var(--text-subtle); font-size: .76rem; font-weight: 700; }
.steps .step i {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  font-size: .74rem;
  font-style: normal;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}
.steps .step.on { color: var(--violet); }
.steps .step.on i { color: #fff; border-color: transparent; background: var(--violet); }
.steps .step.done i { color: #fff; border-color: transparent; background: var(--good); }
.steps .line { flex: 1; height: 1px; background: var(--line-strong); }

/* ------------------------------------------------------------------ checkout (Stripe-style) */

.pay-shell { min-height: 100vh; background: var(--surface); }
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.pay-left { display: flex; justify-content: flex-end; padding: 48px 44px; background: var(--panel); border-right: 1px solid var(--grid-line); }
.pay-right { display: flex; justify-content: flex-start; padding: 48px 44px; }
.pay-inner { width: min(400px, 100%); }
.pay-back { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 26px; color: var(--text-muted); font-size: .84rem; font-weight: 600; }
.pay-back:hover { color: var(--text); }
.pay-amount { margin: 20px 0 6px; font-family: "Space Grotesk", Inter, sans-serif; font-size: 2.5rem; font-weight: 600; letter-spacing: -.05em; line-height: 1; }
.pay-for { color: var(--text-muted); font-size: .88rem; }
.pay-line { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--grid-line); font-size: .855rem; }
.pay-line:last-child { border-bottom: 0; }
.pay-line span { color: var(--text-muted); }
.pay-line b { font-variant-numeric: tabular-nums; }
.pay-total { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line-strong); font-size: .95rem; font-weight: 700; }

.card-input { position: relative; }
.card-input input { padding-right: 66px !important; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.card-brand {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  padding: 3px 7px;
  color: var(--text-muted);
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .04em;
  border: 1px solid var(--grid-line);
  border-radius: 6px;
  background: var(--panel-2);
}
.pay-secure { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 18px; color: var(--text-subtle); font-size: .74rem; }
.test-cards { margin-top: 20px; padding: 14px; border: 1px dashed var(--line-strong); border-radius: 14px; background: var(--panel-2); }
.test-cards b { display: block; margin-bottom: 9px; color: var(--text-subtle); font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.test-cards button {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 7px 8px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .73rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}
.test-cards button:hover { background: var(--surface); }
.test-cards button em { color: var(--text-subtle); font-style: normal; }

.result-shell { display: grid; place-items: center; min-height: 100vh; padding: 40px 20px; }
.result-card { width: min(520px, 100%); padding: 40px; text-align: center; border: 1px solid var(--grid-line); border-radius: var(--radius-lg); background: var(--panel); box-shadow: var(--shadow-md); }
.result-mark { display: grid; place-items: center; width: 74px; height: 74px; margin: 0 auto 20px; color: #fff; font-size: 1.9rem; border-radius: 50%; }
.result-mark.ok { background: linear-gradient(135deg, #25ceb1, #10a37f); box-shadow: 0 18px 40px rgba(16, 163, 127, .3); }
.result-mark.no { background: linear-gradient(135deg, #f0755d, #c2402f); box-shadow: 0 18px 40px rgba(194, 64, 47, .28); }
.result-card h1 { margin: 0 0 10px; font-family: "Space Grotesk", Inter, sans-serif; font-size: 1.68rem; font-weight: 600; letter-spacing: -.04em; }
.result-card > p { margin: 0 auto 24px; max-width: 40ch; color: var(--text-muted); font-size: .9rem; line-height: 1.7; }
.receipt { margin: 0 0 24px; text-align: left; border: 1px solid var(--grid-line); border-radius: var(--radius-sm); overflow: hidden; }
.receipt div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 15px; font-size: .82rem; }
.receipt div + div { border-top: 1px solid var(--grid-line); }
.receipt span { color: var(--text-muted); }
.receipt b { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ print (receipts, reports) */

@media print {
  .side, .topbar, .page-actions, .toolbar, .pager, .no-print { display: none !important; }
  .portal { grid-template-columns: 1fr; }
  .content { padding: 0; }
  .card-p, .table-wrap { border: 0; box-shadow: none; }
  body { background: #fff; }
}

/* ------------------------------------------------------------------ responsive */

@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main, .g-side { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 980px) {
  .portal { grid-template-columns: 1fr; }
  .side {
    position: fixed;
    inset: 0 auto 0 0;
    width: 282px;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.22, .8, .28, 1);
    box-shadow: var(--shadow-lg);
  }
  .side.open { transform: translateX(0); }
  .menu-btn { display: grid; }
  .scrim {
    position: fixed;
    inset: 0;
    background: rgba(11, 15, 22, .46);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .26s ease, visibility .26s;
    z-index: 55;
  }
  .scrim.open { opacity: 1; visibility: visible; }
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .pay-grid { grid-template-columns: 1fr; }
  .pay-left, .pay-right { justify-content: center; padding: 32px 22px; border-right: 0; }
  .pay-left { border-bottom: 1px solid var(--grid-line); }
}

@media (max-width: 720px) {
  .g-2, .g-3, .g-4, .form-grid-2, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .content { padding: 18px 14px 48px; }
  .topbar { padding: 0 14px; gap: 9px; }
  .topbar h1 { font-size: 1rem; }
  .role-tabs { grid-template-columns: repeat(2, 1fr); }
  .cal .day { min-height: 48px; padding: 4px; }
  .cal .ev { font-size: .56rem; }
  table.tbl { font-size: .8rem; }
  table.tbl th, table.tbl td { padding: 10px 12px; }
}

/* ------------------------------------------------------------------ motion */

.rise { opacity: 0; transform: translateY(14px); }
.rise.in { opacity: 1; transform: none; transition: opacity .6s ease, transform .6s cubic-bezier(.22, .8, .28, 1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .rise { opacity: 1; transform: none; }
}

/* visible keyboard focus everywhere */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}
