/* Portal styles — internal-app feel.
   Inherits the brand colors from the marketing site but uses a flatter,
   more utilitarian visual language (no display serif, more whitespace,
   surface-y cards). Self-contained — no imports from the parent site. */

:root {
  /* color */
  --color-accent:        #f26618;
  --color-accent-hover:  #d54e09;
  --color-accent-soft:   rgba(242, 102, 24, 0.15);
  --color-ink:           #0f2560;
  --color-ink-soft:      #3b5998;
  --color-text:          #1f2937;
  --color-muted:         #6b7280;
  --color-bg:            #f7f8fb;        /* page background — soft, not pure white */
  --color-surface:       #ffffff;        /* cards / panels */
  --color-surface-alt:   #eef1f7;        /* nav rails, inputs */
  --color-border:        #e2e6ee;
  --color-border-strong: #c8cee0;
  --color-error:         #b91c1c;
  --color-success:       #15803d;

  /* type */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --fs-xs:   0.75rem;
  --fs-sm:   0.875rem;
  --fs-base: 1rem;
  --fs-md:   1.125rem;
  --fs-lg:   1.25rem;
  --fs-xl:   1.5rem;
  --fs-2xl:  2rem;
  --lh-tight: 1.25;
  --lh-body:  1.55;

  /* spacing */
  --space-2xs: 0.25rem;
  --space-xs:  0.5rem;
  --space-sm:  0.75rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;
  --space-2xl: 3rem;

  /* shape & motion */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 37, 96, 0.06);
  --shadow-md: 0 6px 18px rgba(15, 37, 96, 0.08);
  --shadow-focus: 0 0 0 3px rgba(242, 102, 24, 0.35);
  --dur:      180ms;
  --ease:     cubic-bezier(0.2, 0.8, 0.2, 1);

  /* layout */
  --sidebar-w: 240px;
  --topbar-h:  64px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
}

/* ---------- typography ---------- */
h1, h2, h3, h4 {
  margin: 0 0 var(--space-sm);
  color: var(--color-ink);
  line-height: var(--lh-tight);
  font-weight: 600;
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
p  { margin: 0 0 var(--space-md); }

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}
a:hover { color: var(--color-accent-hover); }
a:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-sm);
}

/* ---------- focus ring (universal) ---------- */
:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 0.7rem 1.25rem;
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    background var(--dur) var(--ease),
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
  background: var(--color-accent);
  color: #fff;
}
.btn:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn:active { transform: translateY(0); box-shadow: inset 0 2px 4px rgba(0,0,0,0.15); }
.btn[disabled], .btn.is-loading {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn--ghost {
  background: transparent;
  color: var(--color-ink);
  border-color: var(--color-border-strong);
}
.btn--ghost:hover {
  background: var(--color-surface-alt);
  color: var(--color-ink);
}

.btn--block { width: 100%; }

/* ---------- form fields ---------- */
.field { display: block; margin-bottom: var(--space-md); }
.field__label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-ink);
  margin-bottom: var(--space-2xs);
}
.field__hint {
  display: block;
  margin-top: var(--space-2xs);
  font-size: var(--fs-xs);
  color: var(--color-muted);
}
.field__error {
  display: block;
  margin-top: var(--space-2xs);
  font-size: var(--fs-xs);
  color: var(--color-error);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  font: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--shadow-focus);
}
textarea { resize: vertical; min-height: 6rem; }

.field--error input,
.field--error select,
.field--error textarea {
  border-color: var(--color-error);
}

/* ---------- cards ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
}

/* ---------- alerts ---------- */
.alert {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  margin-bottom: var(--space-md);
}
.alert--error   { background: rgba(185, 28, 28, 0.08); color: var(--color-error); }
.alert--success { background: rgba(21, 128, 61, 0.08); color: var(--color-success); }

/* ===========================================================
   LOGIN SCREEN (centered card on plain background)
   =========================================================== */

body.is-login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: var(--space-md);
  background: linear-gradient(160deg, #f7f8fb 0%, #eef1f7 100%);
}
.login-shell { width: 100%; max-width: 26rem; }
.login-brand {
  text-align: center;
  margin-bottom: var(--space-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}
.login-brand__pill {
  display: inline-flex;
  align-items: center;
  background: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(30, 58, 138, 0.18);
}
.login-brand__logo {
  height: 48px;
  width: auto;
  display: block;
}
.login-brand__sub {
  font-size: var(--fs-sm);
  color: var(--color-muted);
}
.login-card { padding: var(--space-xl); }

/* ===========================================================
   APP LAYOUT (sidebar + topbar + main)
   =========================================================== */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
  min-height: 100vh;
}

/* topbar */
.topbar {
  grid-area: topbar;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
}
.topbar__title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--color-ink);
}
.topbar__user {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.topbar__user-name {
  font-size: var(--fs-sm);
  color: var(--color-text);
}
.topbar__user-name strong { color: var(--color-ink); }

/* sidebar */
.sidebar {
  grid-area: sidebar;
  background: var(--color-ink);
  color: #fff;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
}
/* Brand logo — exact match to the marketing site's navbar pill.
   White rounded pill, subtle navy shadow, inline SVG so the brand fonts
   (Cormorant Garamond italic + EB Garamond) render correctly. */
.sidebar__brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  align-self: flex-start;
  background: #fff;
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow:
    0 2px 8px rgba(30, 58, 138, 0.18),
    inset 0 0 0 1px rgba(30, 58, 138, 0.06);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  margin-bottom: var(--space-xs);
}
.sidebar__brand:hover {
  transform: translateY(-1px);
  box-shadow:
    0 4px 14px rgba(30, 58, 138, 0.28),
    inset 0 0 0 1px rgba(30, 58, 138, 0.06);
}
.sidebar__logo {
  height: 36px;
  width: auto;
  display: block;
}
.sidebar__logo-r2 {
  font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-weight: 700;
}
.sidebar__logo-wm {
  font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
  font-weight: 800;
}
.sidebar__brand-tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--color-accent);
  padding: 0 0 var(--space-md) var(--space-2xs);
  margin-bottom: var(--space-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  align-self: stretch;
}
.sidebar__nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.78);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.sidebar__link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.sidebar__link.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.sidebar__nav-divider {
  margin-top: var(--space-md);
  padding: var(--space-2xs) var(--space-sm);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}
.sidebar__link-icon {
  width: 1rem;
  height: 1rem;
  opacity: 0.85;
}

/* main */
.main {
  grid-area: main;
  padding: var(--space-xl);
  overflow-y: auto;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
  gap: var(--space-md);
}
.page-header h1 { margin: 0; }

/* responsive */
@media (max-width: 800px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-h) auto 1fr;
    grid-template-areas:
      "topbar"
      "sidebar"
      "main";
  }
  .sidebar { padding: var(--space-sm) var(--space-md); }
  .sidebar__brand { display: none; }
  .sidebar__nav {
    flex-direction: row;
    overflow-x: auto;
    gap: var(--space-2xs);
  }
  .sidebar__link { white-space: nowrap; padding: 0.5rem 0.8rem; }
  .main { padding: var(--space-md); }
}

/* ===========================================================
   PROFILE PAGE
   =========================================================== */

.profile-form { display: flex; flex-direction: column; gap: var(--space-md); }

.profile-section {
  margin: 0;
  padding: var(--space-xl);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
}
.profile-section legend, .profile-section h2 {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--color-ink);
  padding: 0 var(--space-xs);
  margin: 0 0 var(--space-md);
}

/* responsive 2-column grid for compact fields */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--space-md);
}
.field-grid .field { margin-bottom: 0; }

/* chip / pill checkboxes for modes, subjects, grades */
.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  border-radius: var(--radius-pill, 999px);
  font-size: var(--fs-sm);
  cursor: pointer;
  user-select: none;
  transition:
    background var(--dur) var(--ease),
    color var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}
.chip input {
  /* visually hidden but keyboard-accessible */
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.chip:hover { background: var(--color-surface-alt); }
.chip:has(input:checked) {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}
.chip:has(input:focus-visible) {
  box-shadow: var(--shadow-focus);
  outline: none;
}

.subjects-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: var(--space-xs);
}
.subject-row {
  background: var(--color-surface-alt);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.chip--subject {
  align-self: flex-start;
  font-weight: 600;
}
.chip--grade {
  font-size: var(--fs-xs);
  padding: 0.3rem 0.65rem;
}
.grades-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.profile-actions {
  display: flex;
  justify-content: flex-end;
  padding: var(--space-md) 0;
}

.password-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-width: 28rem;
}

/* ---------- file upload sections ---------- */
.upload-section h2 {
  margin-top: 0;
}
.upload-row {
  display: flex;
  gap: var(--space-xl);
  align-items: flex-start;
  flex-wrap: wrap;
}
.upload-preview {
  flex: 0 0 12rem;
  width: 12rem;
  height: 12rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  display: grid;
  place-items: center;
}
.upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.upload-preview__placeholder {
  color: var(--color-muted);
  font-size: var(--fs-sm);
  text-align: center;
  padding: var(--space-md);
}
.upload-form {
  flex: 1 1 18rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  min-width: 0;
}
.upload-form input[type="file"] {
  font: inherit;
  padding: 0.4rem;
  background: var(--color-surface);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  width: 100%;
  cursor: pointer;
}
.upload-form input[type="file"]:hover {
  border-color: var(--color-accent);
  background: var(--color-surface-alt);
}
.record-check-status .alert a {
  margin-left: var(--space-sm);
  font-weight: 600;
}

/* ===========================================================
   CALENDAR / SCHEDULE PAGE
   =========================================================== */

.cal-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}
.cal-toolbar h2.cal-month {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: 600;
  min-width: 10ch;
  text-align: center;
}
.cal-toolbar__total {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: var(--fs-sm);
  color: var(--color-ink);
  font-weight: 600;
}
.cal-toolbar__count {
  color: var(--color-muted);
  font-size: var(--fs-xs);
  font-weight: 400;
}

.cal-grid {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.cal-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border);
}
.cal-headers > div {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
}
.cal-cells {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-cell {
  min-height: 8rem;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-2xs);
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--color-surface);
}
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell--muted {
  background: var(--color-bg);
  color: var(--color-muted);
}
.cal-cell--today {
  background: rgba(242, 102, 24, 0.05);
}
.cal-cell--today .cal-cell__num {
  color: var(--color-accent);
  font-weight: 700;
}
.cal-cell__num {
  align-self: flex-start;
  background: transparent;
  border: 0;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--color-text);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.cal-cell__num:hover {
  background: var(--color-surface-alt);
}
.cal-cell__num:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* session chip inside a calendar cell */
.cal-chip {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 4px 6px;
  background: var(--color-accent-soft);
  border: 1px solid transparent;
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  text-align: left;
  cursor: pointer;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
  width: 100%;
  font-family: inherit;
  color: var(--color-text);
  overflow: hidden;
}
.cal-chip:hover {
  background: rgba(242, 102, 24, 0.25);
  transform: translateX(2px);
}
.cal-chip:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}
.cal-chip__time {
  font-weight: 600;
  color: var(--color-accent-ink, var(--color-accent-hover));
  font-size: 0.7rem;
}
.cal-chip__name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.cal-chip--completed {
  background: rgba(21, 128, 61, 0.1);
  border-left-color: var(--color-success);
}
.cal-chip--completed .cal-chip__time { color: var(--color-success); }
.cal-chip--completed:hover { background: rgba(21, 128, 61, 0.2); }

.cal-chip--cancelled {
  background: rgba(107, 114, 128, 0.1);
  border-left-color: var(--color-muted);
  text-decoration: line-through;
  opacity: 0.7;
}
.cal-chip--cancelled .cal-chip__time { color: var(--color-muted); }

/* mobile layout — switch to vertical day list-ish view */
@media (max-width: 720px) {
  .cal-cells, .cal-headers {
    grid-template-columns: 1fr;
  }
  .cal-headers { display: none; }
  .cal-cell {
    min-height: auto;
    border-right: 0;
  }
  .cal-cell--muted { display: none; }
  .cal-cell__num::before {
    /* show day-of-week label on mobile, since the header row is hidden */
    content: attr(aria-label) " — ";
    font-weight: 400;
    color: var(--color-muted);
    margin-right: 4px;
  }
  /* Simpler: don't include verbose ARIA — show date number + cell content. */
  .cal-cell__num::before { content: ""; margin: 0; }
}

/* ===========================================================
   MODAL
   =========================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: var(--space-md);
}
.modal[hidden] { display: none !important; }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 37, 96, 0.45);
  backdrop-filter: blur(2px);
  cursor: pointer;
  animation: modal-fade var(--dur) var(--ease);
}
.modal__panel {
  position: relative;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(15, 37, 96, 0.25);
  max-width: 32rem;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--space-xl);
  animation: modal-pop 220ms var(--ease);
}
.modal__panel h2 {
  margin: 0 0 var(--space-md);
  font-size: var(--fs-xl);
}
.modal__close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: 2rem; height: 2rem;
  border: 0;
  background: transparent;
  color: var(--color-muted);
  font-size: 1.5rem;
  line-height: 1;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.modal__close:hover { background: var(--color-surface-alt); color: var(--color-ink); }
.modal__close:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

.modal__actions {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

@keyframes modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modal-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .modal__backdrop, .modal__panel { animation: none; }
  .cal-chip:hover { transform: none; }
}

.modal__actions-left { display: flex; gap: var(--space-xs); }

/* recurring-session indicator on calendar chips */
.cal-chip--recurring .cal-chip__time {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* recurrence fieldset inside the session modal */
.recurrence-block {
  margin: 0 0 var(--space-md);
  padding: var(--space-md);
  border: 1px dashed var(--color-border-strong);
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
}
.recurrence-block legend {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-ink);
  padding: 0 var(--space-2xs);
}
.recurrence-preview {
  margin-top: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  background: var(--color-accent-soft);
  color: var(--color-accent-ink, var(--color-accent-hover));
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
}

/* ===========================================================
   INVOICE PAGE
   =========================================================== */

.invoice-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.invoice-toolbar__month {
  font-size: var(--fs-md);
  color: var(--color-ink);
  min-width: 9ch;
  text-align: center;
}

.invoice-doc {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-sm);
  max-width: 56rem;
}
.invoice-doc__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-lg);
  padding-bottom: var(--space-lg);
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}
.invoice-doc__title {
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--color-ink);
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin-bottom: var(--space-2xs);
}
.invoice-doc__period {
  color: var(--color-muted);
  font-size: var(--fs-sm);
}
.invoice-doc__number {
  margin-top: var(--space-xs);
  font-family: 'SF Mono', Consolas, monospace;
  font-size: var(--fs-sm);
  color: var(--color-text);
}
.invoice-doc__issued {
  font-size: var(--fs-xs);
  color: var(--color-muted);
}
.invoice-doc__logo { display: block; }

.invoice-doc__parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}
@media (max-width: 600px) {
  .invoice-doc__parties { grid-template-columns: 1fr; }
}
.invoice-doc__party-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: var(--space-2xs);
}
.invoice-doc__party-name {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--color-ink);
  margin-bottom: var(--space-2xs);
}
.invoice-doc__party div { font-size: var(--fs-sm); color: var(--color-text); }

.invoice-doc__lines {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  margin-bottom: var(--space-lg);
}
.invoice-doc__lines th,
.invoice-doc__lines td {
  padding: var(--space-sm) var(--space-xs);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.invoice-doc__lines th {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  font-weight: 600;
  background: var(--color-surface-alt);
}
.invoice-doc__lines th.num,
.invoice-doc__lines td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.invoice-doc__lines tr.line-cancelled { opacity: 0.4; text-decoration: line-through; }
.invoice-doc__total-row td {
  border-top: 2px solid var(--color-ink);
  border-bottom: 0;
  font-weight: 700;
  color: var(--color-ink);
  padding-top: var(--space-md);
}

.status-pill {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill, 999px);
  letter-spacing: 0.04em;
}
.status-pill--scheduled { background: var(--color-accent-soft); color: var(--color-accent-hover); }
.status-pill--completed { background: rgba(21,128,61,0.12); color: var(--color-success); }
.status-pill--cancelled { background: var(--color-surface-alt); color: var(--color-muted); }

.invoice-doc__summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}
.invoice-doc__summary-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  margin-bottom: var(--space-2xs);
}
.invoice-doc__summary-value {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--color-ink);
  font-variant-numeric: tabular-nums;
}
.invoice-doc__summary-value--accent { color: var(--color-accent); }

.invoice-doc__footer {
  font-size: var(--fs-xs);
  color: var(--color-muted);
  text-align: center;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
}

/* ===========================================================
   VIEW-AS BANNER (when admin is impersonating a tutor)
   =========================================================== */

.view-as-banner {
  background: linear-gradient(90deg, #fb923c 0%, #f26618 100%);
  color: #fff;
  padding: 0.6rem var(--space-md);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.view-as-banner__inner {
  max-width: var(--container-max, 1400px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  font-size: var(--fs-sm);
}
.view-as-banner__badge {
  background: rgba(0, 0, 0, 0.18);
  padding: 2px 10px;
  border-radius: var(--radius-pill, 999px);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.view-as-banner__sep { opacity: 0.5; }
.view-as-banner__exit {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--fs-xs);
  text-decoration: none;
  transition: background var(--dur) var(--ease);
}
.view-as-banner__exit:hover {
  background: rgba(255, 255, 255, 0.32);
  color: #fff;
}
@media print {
  .view-as-banner { display: none !important; }
}

/* ===========================================================
   ADMIN — TUTOR MANAGEMENT
   =========================================================== */

.field-readonly {
  padding: 0.7rem 0.9rem;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-ink);
  font-weight: 500;
}

.admin-tutors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
}
.admin-tutor-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  text-align: left;
  padding: var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.admin-tutor-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.admin-tutor-card:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.admin-tutor-card--inactive { opacity: 0.55; }
.admin-tutor-card__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-xs);
}
.admin-tutor-card__name { font-weight: 600; font-size: var(--fs-md); color: var(--color-ink); }
.admin-tutor-card__role {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  padding: 2px 10px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-pill, 999px);
  color: var(--color-muted);
}
.admin-tutor-card__role--admin {
  background: var(--color-accent-soft);
  color: var(--color-accent-hover);
}
.admin-tutor-card__email { color: var(--color-muted); font-size: var(--fs-sm); }
.admin-tutor-card__title { color: var(--color-ink-soft); font-size: var(--fs-sm); }
.admin-tutor-card__row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xs);
  margin-top: var(--space-xs);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border);
}
.admin-tutor-card__label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
}
.admin-tutor-card__value {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-ink);
}
.admin-tutor-card__actions {
  display: flex;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border);
}
.btn--sm {
  padding: 0.45rem 0.9rem;
  font-size: var(--fs-sm);
}

.invoice-bottom-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-md);
  max-width: 56rem;
}
.invoice-submit-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}
.invoice-submit-summary__label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  margin-bottom: var(--space-2xs);
}
.invoice-submit-summary__value {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--color-ink);
  font-variant-numeric: tabular-nums;
}
.invoice-submit-summary__value--accent { color: var(--color-accent); }

.invoice-submission-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
  border-left: 4px solid;
}
.invoice-submission-banner > div { display: flex; align-items: center; gap: var(--space-sm); }
.invoice-submission-banner--submitted {
  background: var(--color-accent-soft);
  border-left-color: var(--color-accent);
  color: var(--color-accent-ink, var(--color-accent-hover));
}
.invoice-submission-banner--approved {
  background: rgba(21, 128, 61, 0.08);
  border-left-color: var(--color-success);
  color: var(--color-success);
}
.invoice-submission-banner--paid {
  background: rgba(21, 128, 61, 0.18);
  border-left-color: var(--color-success);
  color: #0d4a25;
  font-weight: 600;
}
.invoice-submit-section h2 {
  font-size: var(--fs-lg);
  margin-bottom: var(--space-xs);
}

/* Print styles — strip the app shell, just show the invoice */
@media print {
  .sidebar, .topbar, .invoice-toolbar, .alert,
  .invoice-submission-banner, .invoice-submit-section { display: none !important; }
  .app { grid-template-columns: 1fr !important; grid-template-areas: "main" !important; }
  .main { padding: 0 !important; overflow: visible !important; }
  .page-header h1 { display: none; }
  .invoice-doc {
    border: 0;
    box-shadow: none;
    padding: 1rem;
    max-width: 100%;
  }
  body { background: #fff !important; }
}

/* ===========================================================
   STUDENT STRIP (on the schedule page)
   =========================================================== */

.students-strip {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
}
.students-strip__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

/* Compact student "pills" — clickable to edit */
.student-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.5rem 0.85rem;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill, 999px);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--fs-sm);
  color: var(--color-text);
  transition:
    background var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}
.student-pill:hover {
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
  transform: translateY(-1px);
}
.student-pill:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}
.student-pill--inactive {
  opacity: 0.55;
}
.student-pill__name {
  font-weight: 600;
  color: var(--color-ink);
}
.student-pill__grade {
  font-size: var(--fs-xs);
  color: var(--color-muted);
  font-weight: 500;
}
.student-pill__badge {
  font-size: 0.7rem;
  padding: 1px 8px;
  background: var(--color-border-strong);
  color: var(--color-muted);
  border-radius: var(--radius-pill, 999px);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===========================================================
   (legacy) full students page grid — still used if accessed
   directly via URL while the page exists
   =========================================================== */

.students-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: var(--space-md);
}
.student-card {
  text-align: left;
  padding: var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  transition:
    border-color var(--dur) var(--ease),
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.student-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.student-card:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}
.student-card--inactive {
  opacity: 0.6;
}
.student-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  margin-bottom: var(--space-2xs);
}
.student-card__name {
  font-weight: 600;
  font-size: var(--fs-md);
  color: var(--color-ink);
}
.student-card__badge {
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 2px 8px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-pill, 999px);
  color: var(--color-muted);
}
.student-card__meta {
  font-size: var(--fs-sm);
  color: var(--color-muted);
}

/* dashboard cards grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--space-md);
}
.kpi {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}
.kpi__label {
  display: block;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin-bottom: var(--space-2xs);
}
.kpi__value {
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--color-ink);
}
