/* Jamals Online System — design system.
   Brand: Jamals International Academy (D:\Claude\.claude\skills\jamals-brand). Light product
   surface for content, near-black green field for the sidebar (the brand's own ground).
   Two brand colours (#48AE4F, #2F463F) + mono ink #2B2A29; everything else is derived.
   Rules kept here: never white text on #48AE4F; green text on white is #237D2C;
   every status carries an icon and a label, never colour alone. */

@font-face {
  font-family: "Montserrat";
  src: url("../fonts/Montserrat-Variable.cc17c07d2cee.woff2") format("woff2");
  font-weight: 100 900; /* variable font: without the range everything renders Thin */
  font-style: normal;
  font-display: swap;
}

:root {
  --green: #48AE4F;
  --forest: #2F463F;
  --ink: #2B2A29;
  --green-50: #E9F8E9;
  --green-100: #D3EFD2;
  --green-600: #32983B;
  --green-700: #237D2C;
  --green-800: #176320;
  --green-900: #0F4A16;

  --bg: #F5F6F5;
  --surface: #FFFFFF;
  --surface-2: #EEF0F0;
  --surface-brand: #EDF7ED;
  --text: #2F463F;
  --text-2: #4E625C;
  --muted: #5D6F69;
  --disabled: #A1ACA9;
  --accent-text: #237D2C;
  --border: #E6E9E8;
  --border-subtle: #EEF0F0;
  --border-strong: #85938F;   /* functional borders (inputs): 3.2:1 on white */
  --focus: #32983B;

  --dark-0: #0F1918;
  --dark-1: #131D1C;
  --dark-2: #1B2725;
  --dark-3: #222E2C;
  --on-dark: #FEFEFE;
  --on-dark-2: #C1C3C3;
  --on-dark-muted: #939897;
  --dark-border: #1D3D25;

  --success-fg: #237D2C; --success-bg: #E9F5EA; --success-bd: #C1E3C3; --success-solid: #48AE4F; --success-on: #2B2A29;
  --warning-fg: #7F4F00; --warning-bg: #FAF1E0; --warning-bd: #F2D8A8; --warning-solid: #D98B00; --warning-on: #2B2A29; --warning-text: #A16500;
  --danger-fg: #AA0D24;  --danger-bg: #F9E6E7;  --danger-bd: #EEB9BC;  --danger-solid: #CD303A;  --danger-on: #FFFFFF; --danger-text: #CD303A;
  --info-fg: #0D53BC;    --info-bg: #E5EEFB;    --info-bd: #B6CEF4;    --info-solid: #276EE0;
  --pending-fg: #4D5F5C; --pending-bg: #EDEFEF; --pending-bd: #CBD1D0;

  --star-fill: #F2A232;
  --star-line: #A16500;

  --font: "Montserrat", "Segoe UI", Roboto, Arial, sans-serif;
  --fs-xs: .75rem;   /* 12 */
  --fs-sm: .8125rem; /* 13 */
  --fs-base: .9375rem; /* 15 */
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;

  --r-sm: 8px;
  --r: 10px;
  --r-lg: 14px;
  --r-pill: 999px;
  --sh-1: 0 1px 2px rgb(4 10 11 / .05), 0 1px 1px rgb(4 10 11 / .03);
  --sh-2: 0 6px 20px rgb(4 10 11 / .08), 0 1px 3px rgb(4 10 11 / .05);
  --sh-3: 0 18px 50px rgb(4 10 11 / .28);
  --sidebar-w: 252px;
  --tap: 44px;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
img, svg { display: block; max-width: 100%; }
svg.icon { display: inline-block; flex: none; vertical-align: -0.2em; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { color: var(--green-800); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; color: var(--text); }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
h4 { font-size: var(--fs-base); }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
small, .small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.strong { font-weight: 600; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.label {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.hidden { display: none !important; }

/* ---------- app shell ---------- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--dark-1) 0%, var(--dark-0) 60%);
  color: var(--on-dark-2);
  border-right: 1px solid #0A1110;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 18px; color: var(--on-dark); }
.brand:hover { color: var(--on-dark); text-decoration: none; }
.brand .emblem { width: 42px; height: auto; color: var(--on-dark); }
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: .02em; line-height: 1.1; }
.brand-sub { display: block; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--on-dark-muted); margin-top: 3px; }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
.nav-section { margin-top: 18px; }
.nav-section:first-child { margin-top: 4px; }
.nav-label { padding: 0 10px 6px; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--on-dark-muted); }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 40px; padding: 8px 10px; margin: 1px 0;
  border-radius: var(--r-sm); color: var(--on-dark-2); font-size: 14px; font-weight: 500;
}
.nav a .icon { color: var(--on-dark-muted); }
.nav a:hover { background: var(--dark-2); color: var(--on-dark); text-decoration: none; }
.nav a:hover .icon { color: var(--on-dark-2); }
.nav a.is-active { background: var(--dark-2); color: var(--on-dark); }
.nav a.is-active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--green); }
.nav a.is-active .icon { color: var(--green); }
.nav-badge {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px; border-radius: var(--r-pill);
  background: var(--green); color: var(--ink); font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
}
.sidebar-foot { border-top: 1px solid var(--dark-border); padding: 14px 16px 16px; }
.me { display: flex; align-items: center; gap: 10px; color: var(--on-dark); }
.me-name { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { display: block; font-size: 12px; line-height: 1.3; color: var(--on-dark-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--dark-3); color: var(--green); border: 1px solid var(--dark-border);
}
.foot-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.foot-actions form { margin: 0; }
.foot-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px;
  border-radius: var(--r-sm); border: 1px solid var(--dark-border); background: transparent;
  color: var(--on-dark-2); font: 600 12px/1 var(--font); cursor: pointer;
}
.foot-btn:hover { background: var(--dark-2); color: var(--on-dark); text-decoration: none; }
.foot-btn.is-on { border-color: var(--green); color: var(--on-dark); }
/* Laptops (1440x900, 1366x768): tighten the sidebar so the owner's full menu, Staff and Activity
   included, fits without scrolling. app.js also scrolls the current item into view. */
@media (min-width: 1024px) and (max-height: 940px) {
  .sidebar .brand { padding: 14px 20px 10px; }
  .nav-section { margin-top: 10px; }
  .nav-label { padding-bottom: 4px; }
  .nav a { min-height: 34px; padding: 5px 10px; }
  .nav a.is-active::before { top: 6px; bottom: 6px; }
  .sidebar-foot { padding: 10px 16px 12px; }
  .foot-actions { margin-top: 8px; }
}
@media (min-width: 1024px) and (max-height: 800px) {
  .sidebar .brand .emblem { width: 34px; }
  .nav a { min-height: 30px; padding: 3px 10px; margin: 0; }
  .nav-section { margin-top: 8px; }
  .nav-label { padding-bottom: 2px; }
  .me .avatar { width: 28px; height: 28px; font-size: 12px; }
  .foot-btn { height: 28px; }
}

.topbar { display: none; }
.main { margin-left: var(--sidebar-w); min-height: 100vh; }
.page { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }
.page-narrow { max-width: 760px; }
.page-mid { max-width: 1040px; }

.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.scrim { display: none; }

@media (max-width: 1023px) {
  .topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
    height: 56px; padding: 0 12px 0 16px; background: var(--dark-0); color: var(--on-dark);
  }
  .topbar .brand { padding: 0; gap: 10px; }
  .topbar .brand .emblem { width: 34px; }
  .topbar .brand-sub { display: none; }
  .menu-btn {
    margin-left: auto; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px;
    border-radius: var(--r-sm); border: 1px solid var(--dark-border); color: var(--on-dark); cursor: pointer;
    font: 600 13px/1 var(--font);
  }
  .sidebar {
    transform: translateX(-102%); visibility: hidden; width: min(300px, 86vw); box-shadow: none;
    transition: transform .2s ease, visibility 0s linear .2s;
  }
  .nav-toggle:checked ~ .sidebar { transform: none; visibility: visible; box-shadow: var(--sh-3); transition: transform .2s ease; }
  .nav-toggle:checked ~ .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgb(4 10 11 / .45); }
  .nav-toggle:focus-visible ~ .topbar .menu-btn { outline: 2px solid var(--green); outline-offset: 2px; }
  .main { margin-left: 0; }
  .page { padding: 18px 16px 72px; }
  .sidebar-close { display: inline-flex !important; }
}
.sidebar-close {
  display: none; margin-left: auto; width: 36px; height: 36px; align-items: center; justify-content: center;
  border-radius: var(--r-sm); color: var(--on-dark-2); cursor: pointer;
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* ---------- page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px; margin-bottom: 22px; }
.page-head-text { flex: 1 1 320px; min-width: 0; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; font-size: var(--fs-sm); color: var(--muted); }
.crumbs a { color: var(--muted); font-weight: 500; }
.crumbs a:hover { color: var(--accent-text); }
.crumbs .icon { width: 14px; height: 14px; }
.page-sub { margin-top: 4px; color: var(--muted); font-size: var(--fs-sm); }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- layout helpers ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.ml-auto { margin-left: auto; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.card-body { padding: 20px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 16px 20px; border-bottom: 1px solid var(--border-subtle); }
.card-head h2, .card-head h3 { font-size: var(--fs-md); }
.card-head .card-sub { color: var(--muted); font-size: var(--fs-sm); }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border-subtle); }
.card-link { display: block; color: inherit; transition: box-shadow .15s, border-color .15s; }
.card-link:hover { color: inherit; text-decoration: none; border-color: var(--green-600); box-shadow: var(--sh-2); }
.card-brand { background: var(--surface-brand); border-color: #DAEFDC; }
@media (max-width: 640px) { .card-body { padding: 16px; } .card-head { padding: 14px 16px; } }

/* stat tile */
.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; } /* a two-line label keeps the values in line */
.stat-label { font-size: var(--fs-sm); font-weight: 500; line-height: 1.35; color: var(--muted); }
.stat-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-brand); color: var(--green-700); }
.stat-value { font-size: var(--fs-2xl); font-weight: 600; line-height: 1.15; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-sub { font-size: var(--fs-sm); color: var(--muted); }
.stat-danger .stat-icon { background: var(--danger-bg); color: var(--danger-fg); }
.stat-warning .stat-icon { background: var(--warning-bg); color: var(--warning-fg); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: var(--r);
  border: 1px solid transparent; background: var(--surface-2); color: var(--text);
  font: 600 14px/1.2 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--green-700); color: #FFFFFF; }
.btn-primary:hover { background: var(--green-800); color: #FFFFFF; }
.btn-primary:active { background: var(--green-900); }
.btn-secondary { background: var(--surface); color: var(--green-700); border-color: var(--green-600); }
.btn-secondary:hover { background: var(--surface-brand); color: var(--green-800); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger-solid); color: #FFFFFF; }
.btn-danger:hover { background: #A81F2A; color: #FFFFFF; }
.btn-danger-ghost { background: transparent; color: var(--danger-text); border-color: var(--danger-bd); }
.btn-danger-ghost:hover { background: var(--danger-bg); color: var(--danger-fg); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: var(--r-sm); gap: 6px; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { padding: 0; width: 40px; }
.btn-sm.btn-icon { width: 32px; }
@media (max-width: 640px) { .btn { min-height: var(--tap); } .btn-sm { min-height: 36px; } }

/* ---------- badges, chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px 0 7px;
  border-radius: var(--r-pill); border: 1px solid var(--pending-bd); background: var(--pending-bg); color: var(--pending-fg);
  font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap;
}
.badge .icon { width: 14px; height: 14px; }
.badge-compact { height: 22px; padding: 0 7px 0 5px; font-size: 12px; }
.badge-success { background: var(--success-bg); border-color: var(--success-bd); color: var(--success-fg); }
.badge-warning { background: var(--warning-bg); border-color: var(--warning-bd); color: var(--warning-fg); }
.badge-danger  { background: var(--danger-bg);  border-color: var(--danger-bd);  color: var(--danger-fg); }
.badge-info    { background: var(--info-bg);    border-color: var(--info-bd);    color: var(--info-fg); }
.badge-pending { background: var(--pending-bg); border-color: var(--pending-bd); color: var(--pending-fg); }
.badge-solid-forest { background: var(--forest); border-color: var(--forest); color: #FFFFFF; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer;
}
.chip:hover { border-color: var(--green-600); color: var(--text); text-decoration: none; }
.chip.is-on, .chip[aria-current="true"] { background: var(--forest); border-color: var(--forest); color: #FFFFFF; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; }

/* points (stars total): green when up, red when down */
.points { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.points-pos { color: var(--green-700); }
.points-neg { color: var(--danger-text); }
.points-zero { color: var(--muted); }

/* ---------- tables ---------- */
.table-wrap { position: relative; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  position: sticky; top: 0; z-index: 1;
  padding: 10px 14px; text-align: left; white-space: nowrap;
  background: #F8F9F8; border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FAFBFA; }
.table .num, .table th.num { text-align: right; }
.table .center, .table th.center { text-align: center; }
.table .actions { text-align: right; white-space: nowrap; }
.table .cell-main { font-weight: 600; color: var(--text); }
.table .cell-sub { display: block; font-size: 12.5px; color: var(--muted); font-weight: 400; }
.table-compact td { padding: 8px 12px; }
.table a.row-link { color: var(--text); font-weight: 600; }
.table a.row-link:hover { color: var(--accent-text); }
tr.is-muted td { color: var(--muted); }
@media (max-width: 720px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table-stack tbody tr:hover td { background: transparent; }
  .table-stack td { padding: 3px 0; border: 0; text-align: left !important; }
  /* Label | value columns. As a table, the cell's own content (text, links, badges, .cell-sub lines)
     is wrapped in ONE anonymous cell beside the label, so wrapped text and sub-lines stay in the
     value column instead of falling back under the label. */
  .table-stack td[data-label] { display: table; table-layout: fixed; }
  .table-stack td[data-label]::before {
    content: attr(data-label); display: table-cell; width: 42%; padding-right: 8px; vertical-align: baseline;
    font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
    overflow-wrap: anywhere;
  }
  .table-stack td[data-label] .badge { height: auto; min-height: 24px; max-width: 100%; padding-top: 3px; padding-bottom: 3px; line-height: 1.25; white-space: normal; }
  .table-stack td.cell-title { display: block; font-size: 15px; padding-bottom: 6px; }
  .table-stack td.cell-title::before { display: none; }
}

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.field-label .req { color: var(--danger-text); margin-left: 2px; }
.field-help { font-size: 12.5px; color: var(--muted); }
.field-error { display: flex; gap: 6px; align-items: flex-start; font-size: 13px; font-weight: 500; color: var(--danger-fg); }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--danger-solid); }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 9px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface);
  color: var(--text); font: 500 15px/1.4 var(--font);
  transition: border-color .12s, box-shadow .12s;
}
.textarea { min-height: 80px; resize: vertical; }
.select {
  appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234E625C' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
select[multiple].select { background-image: none; padding-right: 12px; min-height: 120px; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-2); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--green-600); box-shadow: 0 0 0 3px rgb(50 152 59 / .22); }
.input::placeholder, .textarea::placeholder { color: var(--disabled); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.input-sm, .select.input-sm { min-height: 36px; padding: 6px 10px; font-size: 14px; }
.select.input-sm { padding-right: 32px; background-position: right 10px center; }
.checkbox { width: 18px; height: 18px; accent-color: var(--green-700); }
.choice-list { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-list label, .choice-list > div > label { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: var(--r-pill); font-weight: 600; font-size: 14px; cursor: pointer; background: var(--surface); }
.choice-list input { accent-color: var(--green-700); width: 16px; height: 16px; }
.choice-list > div { display: contents; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 4px; }
.form-errors { padding: 12px 14px; border-radius: var(--r); background: var(--danger-bg); border: 1px solid var(--danger-bd); color: var(--danger-fg); font-size: 14px; font-weight: 500; }
.form-errors ul { margin: 0; padding-left: 18px; }

/* filter bar */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 16px; }
.filters .field { flex: 1 1 160px; max-width: 260px; gap: 4px; }
.filters .field-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.filters .field-search { flex: 2 1 240px; max-width: 360px; }
.filters-actions { display: flex; gap: 8px; align-items: center; }
@media (max-width: 640px) { .filters .field { max-width: none; flex: 1 1 140px; } .filters .field-search { flex-basis: 100%; } }
.search-input { position: relative; }
.search-input .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-input .input { padding-left: 38px; }

/* switch (Telegram-style rights) */
.switch { display: flex; align-items: flex-start; gap: 14px; padding: 12px 0; cursor: pointer; }
.switch + .switch { border-top: 1px solid var(--border-subtle); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative; flex: none; width: 44px; height: 26px; margin-top: 1px; border-radius: 13px;
  background: #C7CFCC; transition: background .15s;
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #FFFFFF; box-shadow: 0 1px 3px rgb(4 10 11 / .3); transition: transform .15s;
}
.switch input:checked + .switch-track { background: var(--green-700); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .45; }
.switch-text { display: flex; flex-direction: column; gap: 2px; font-weight: 600; font-size: 14.5px; }
.switch-text small { font-weight: 400; color: var(--muted); font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .switch-track, .switch-track::after { transition: none; } }

/* ---------- attendance controls ---------- */
/* Segmented status picker: <div class="seg"> <input class="seg-input" type="radio"> <label class="seg-opt seg-attended"> ... */
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.seg-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.seg-opt {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); min-width: 44px; padding: 0 12px;
  font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; user-select: none;
  border-left: 1px solid var(--border);
}
.seg-opt:first-of-type { border-left: 0; }
.seg-opt:hover { background: var(--surface-2); color: var(--text); }
.seg-input:checked + .seg-attended { background: var(--success-solid); color: var(--success-on); }
.seg-input:checked + .seg-absent { background: var(--danger-solid); color: var(--danger-on); }
.seg-input:checked + .seg-excused { background: var(--warning-solid); color: var(--warning-on); }
.seg-input:focus-visible + .seg-opt { outline: 2px solid var(--forest); outline-offset: -3px; }
.seg-full { display: flex; width: 100%; }
.seg-full .seg-opt { flex: 1; }

/* Star picker: inputs in DOM order 5..1, shown 1..5 left to right */
.star-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.star-input label { display: grid; place-items: center; width: 36px; height: var(--tap); cursor: pointer; color: var(--border-strong); }
.star-input label .icon { width: 24px; height: 24px; }
.star-input label .icon path { fill: transparent; }
.star-input input:checked ~ label, .star-input label:hover, .star-input label:hover ~ label { color: var(--star-line); }
.star-input input:checked ~ label .icon path, .star-input label:hover .icon path, .star-input label:hover ~ label .icon path { fill: var(--star-fill); }
.star-input input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: 6px; }
.star-input.is-disabled { opacity: .3; pointer-events: none; }
.star-clear { font-size: 12px; color: var(--muted); background: none; border: 0; cursor: pointer; padding: 4px 6px; font-family: var(--font); }
/* Star display */
.stars { display: inline-flex; gap: 1px; vertical-align: middle; }
.star { color: #C7CFCC; display: inline-flex; }
.star .icon path { fill: transparent; }
.star.is-on { color: var(--star-line); }
.star.is-on .icon path { fill: var(--star-fill); }

/* ---------- progress (group fill) ---------- */
.progress, .progress-bar { display: block; }
.progress { height: 8px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.progress-bar { height: 100%; border-radius: inherit; background: var(--green); min-width: 2px; }
.progress.is-full .progress-bar { background: var(--forest); }
.progress.is-over .progress-bar { background: var(--danger-solid); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: -1px; white-space: nowrap;
  border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; font-size: 14px;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active, .tab[aria-current="page"] { color: var(--text); border-bottom-color: var(--green); }
.tab .count { font-size: 12px; color: var(--muted); font-weight: 600; }
/* Phones: wrap the tabs instead of hiding the last ones off-screen behind a hidden scrollbar. */
@media (max-width: 640px) {
  .tabs { flex-wrap: wrap; overflow: visible; row-gap: 0; }
  .tab { padding: 10px 12px; }
}

/* ---------- alerts / messages ---------- */
.messages { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--pending-bd); background: var(--pending-bg); color: var(--pending-fg); font-size: 14px; font-weight: 500; }
.alert .icon { margin-top: 1px; }
.alert-success { background: var(--success-bg); border-color: var(--success-bd); color: var(--success-fg); }
.alert-error, .alert-danger { background: var(--danger-bg); border-color: var(--danger-bd); color: var(--danger-fg); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-bd); color: var(--warning-fg); }
.alert-info { background: var(--info-bg); border-color: var(--info-bd); color: var(--info-fg); }

/* ---------- empty state ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 40px 20px; color: var(--muted); }
.empty-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.empty-title { font-weight: 600; color: var(--text); font-size: var(--fs-md); }

/* ---------- pagination ---------- */
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border-subtle); font-size: 13.5px; color: var(--muted); }
.pagination .row { gap: 6px; }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border-subtle); }
.list > li:last-child { border-bottom: 0; }
.list-link { display: flex; align-items: center; gap: 12px; width: 100%; color: inherit; }
.list-link:hover { color: inherit; text-decoration: none; }
.list-link:hover .list-title { color: var(--accent-text); }
.list-title { font-weight: 600; }
.list-meta { font-size: 13px; color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; } .kv dd { margin-bottom: 8px; } }

/* phone links */
.tel-list { display: inline-flex; flex-direction: column; gap: 2px; }
.tel { color: var(--text); font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
a.tel:hover { color: var(--accent-text); }

/* sticky save bar (long sheets) */
.savebar {
  position: sticky; bottom: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  margin-top: 16px; padding: 12px 16px; border-radius: var(--r-lg);
  background: rgb(255 255 255 / .96); border: 1px solid var(--border); box-shadow: var(--sh-2);
  backdrop-filter: blur(6px);
}
@media (max-width: 640px) { .savebar { margin-left: -16px; margin-right: -16px; border-radius: 0; border-left: 0; border-right: 0; } }

/* login */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-brand {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  padding: 48px; background: var(--dark-0); color: var(--on-dark);
}
.auth-brand::after { /* the brand's single 45° light streak, white core with green bloom */
  content: ""; position: absolute; left: -20%; right: -20%; top: 58%; height: 2px; transform: rotate(-45deg);
  background: linear-gradient(90deg, transparent, rgb(254 254 254 / .9) 50%, transparent);
  box-shadow: 0 0 22px 4px rgb(72 174 79 / .35);
}
.auth-brand .emblem { width: 96px; height: auto; color: var(--on-dark); }
.auth-word { display: flex; align-items: center; gap: 16px; position: relative; z-index: 1; }
.auth-word-name { font-size: 22px; font-weight: 600; letter-spacing: .04em; line-height: 1.1; }
.auth-word-sub { display: block; font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--on-dark-muted); margin-top: 4px; }
.auth-title { font-size: 34px; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; max-width: 12ch; position: relative; z-index: 1; }
.auth-title span { color: var(--green); }
.auth-panel { display: grid; place-items: center; padding: 32px 20px; background: var(--surface); }
.auth-card { width: 100%; max-width: 380px; }
@media (max-width: 860px) {
  /* Brand strip sized to its content; the form takes the rest, starting near the top (phone keyboard). */
  .auth { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .auth-panel { place-items: start center; padding-top: 28px; }
  .auth-brand { padding: 22px 20px; min-height: 0; }
  .auth-brand .emblem { width: 52px; }
  .auth-word-name { font-size: 17px; }
  .auth-brand::after, .auth-title { display: none; }
}

/* journal matrix (students x sessions) */
.matrix { border-collapse: separate; border-spacing: 0; font-size: 13px; }
.matrix th, .matrix td { padding: 6px 8px; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
.matrix th { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; background: #F8F9F8; }
.matrix .sticky-col { position: sticky; left: 0; z-index: 2; background: var(--surface); border-right: 1px solid var(--border); text-align: left; }
.matrix th.sticky-col { background: #F8F9F8; z-index: 3; }
.cell { display: inline-grid; place-items: center; width: 30px; height: 28px; border-radius: 7px; font-size: 12px; font-weight: 700; }
.cell-attended { background: var(--success-bg); color: var(--success-fg); border: 1px solid var(--success-bd); }
.cell-absent { background: var(--danger-bg); color: var(--danger-fg); border: 1px solid var(--danger-bd); }
.cell-excused { background: var(--warning-bg); color: var(--warning-fg); border: 1px solid var(--warning-bd); }
.cell-none { color: var(--disabled); }

/* print */
@media print {
  .sidebar, .topbar, .page-actions, .savebar, .filters, .pagination { display: none !important; }
  .main { margin: 0; }
  body { background: #FFFFFF; }
  .card { box-shadow: none; }
}
