/* ============ Al Itqan — royal Islamic theme (light default + dark) ============ */
:root {
  --cream: #faf6ee;
  --cream-2: #f4ecdd;
  --paper: #fffdf8;
  --surface: #ffffff;
  --ink: #3b2a1a;
  --ink-soft: #7a6a55;
  --heading: #8c2f24;
  --gold: #c39435;
  --gold-soft: #e6cf9c;
  --gold-pale: #f6ecd8;
  --flame: #e05426;
  --flame-deep: #b23a1c;
  --maroon: #8c2f24;
  --green: #2e7d4f;
  --green-pale: #e4f2e9;
  --green-line: #bcdcc8;
  --red: #c0392b;
  --red-pale: #fbe9e6;
  --red-line: #efc4bd;
  --amber: #b07818;
  --amber-pale: #fdf3dd;
  --amber-line: #ecd9ac;
  --gray-pale: #efece5;
  --gray-line: #ddd8cc;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(90, 60, 20, 0.08), 0 1px 3px rgba(90, 60, 20, 0.06);
  --shadow-lift: 0 6px 18px rgba(90, 60, 20, 0.13), 0 2px 6px rgba(90, 60, 20, 0.08);
  --topbar-1: #fffdf8;
  --topbar-2: #fdf6e7;
  --font: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  --font-display: 'Amiri', 'Cairo', serif;
}

/* Burnished espresso & antique gold - warm, distinctive, and Quran-binding inspired */
[data-theme="dark"] {
  --cream: #17120f;
  --cream-2: #352820;
  --paper: #211915;
  --surface: #2a201b;
  --ink: #eee2d0;
  --ink-soft: #b7a38b;
  --heading: #e4bd70;
  --gold: #cda452;
  --gold-soft: #58442c;
  --gold-pale: #32261d;
  --flame: #d97a50;
  --flame-deep: #a94d36;
  --maroon: #74332f;
  --green: #9ac8a2;
  --green-pale: #1e3025;
  --green-line: #3d5b45;
  --red: #e4a096;
  --red-pale: #3a201e;
  --red-line: #68403a;
  --amber: #e1ba6d;
  --amber-pale: #332919;
  --amber-line: #5e4a29;
  --gray-pale: #302722;
  --gray-line: #514139;
  --shadow: 0 3px 14px rgba(8, 4, 2, 0.38), 0 1px 3px rgba(8, 4, 2, 0.3);
  --shadow-lift: 0 10px 28px rgba(8, 4, 2, 0.48), 0 2px 7px rgba(8, 4, 2, 0.35);
  --topbar-1: #251a16;
  --topbar-2: #17100e;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scrollbar-color: var(--gold-soft) var(--cream); overflow-x: hidden; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--cream);
  background-image:
    radial-gradient(circle at 15% 10%, rgba(195, 148, 53, 0.06), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(224, 84, 38, 0.05), transparent 40%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23c39435' stroke-opacity='0.10' stroke-width='1'%3E%3Cpath d='M36 6 L45 27 L66 36 L45 45 L36 66 L27 45 L6 36 L27 27 Z'/%3E%3Ccircle cx='36' cy='36' r='7'/%3E%3C/g%3E%3C/svg%3E");
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  transition: background-color 0.35s ease, color 0.35s ease;
  overflow-x: hidden;
}
[data-theme="dark"] body {
  background-image:
    radial-gradient(circle at 15% 10%, rgba(205, 164, 82, 0.075), transparent 42%),
    radial-gradient(circle at 85% 90%, rgba(116, 51, 47, 0.16), transparent 44%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23cda452' stroke-opacity='0.065' stroke-width='1'%3E%3Cpath d='M36 6 L45 27 L66 36 L45 45 L36 66 L27 45 L6 36 L27 27 Z'/%3E%3Ccircle cx='36' cy='36' r='7'/%3E%3C/g%3E%3C/svg%3E");
}

::selection { background: var(--gold-soft); color: var(--ink); }

/* subtle entrance for page content */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
main.container > * { animation: rise 0.35s ease both; }
main.container > *:nth-child(2) { animation-delay: 0.04s; }
main.container > *:nth-child(3) { animation-delay: 0.08s; }
main.container > *:nth-child(4) { animation-delay: 0.12s; }
@media (prefers-reduced-motion: reduce) { main.container > * { animation: none; } }

/* ---------------- top bar ---------------- */
.topbar {
  background: linear-gradient(135deg, var(--topbar-1) 0%, var(--topbar-2) 100%);
  border-block-end: 1px solid var(--gold-soft);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background 0.35s ease;
}
.topbar-inner {
  max-width: 1500px;
  margin-inline: auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-logo {
  width: 52px; height: 52px; border-radius: 50%;
  object-fit: cover; object-position: center 40%;
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 3px var(--gold-pale);
  background: #fff;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-family: var(--font-display); font-size: 1.25rem; color: var(--heading); }
.brand-text small { color: var(--ink-soft); font-size: 0.72rem; }

.mainnav { display: flex; gap: 3px; flex-wrap: wrap; margin-inline-start: 4px; }
.mainnav a {
  text-decoration: none; color: var(--ink-soft); font-weight: 600; font-size: 0.89rem;
  padding: 6px 11px; border-radius: 999px; transition: all 0.15s; white-space: nowrap;
}
.mainnav a:hover { background: var(--gold-pale); color: var(--heading); }
.mainnav a.on { background: linear-gradient(135deg, var(--maroon), var(--flame-deep)); color: #fff; box-shadow: 0 2px 6px rgba(140, 47, 36, 0.35); }
[data-theme="dark"] .mainnav a.on { color: #fff; }
.nav-separator { width: 1px; height: 22px; align-self: center; margin-inline: 5px; background: var(--gold-soft); }

.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.lang-btn {
  text-decoration: none; font-weight: 700; font-size: 0.85rem; color: var(--gold);
  border: 1.5px solid var(--gold-soft); padding: 5px 14px; border-radius: 999px; background: var(--surface);
  transition: all 0.15s;
}
.lang-btn:hover { background: var(--gold); color: #fff; }
.theme-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  color: var(--gold); background: var(--surface); border: 1.5px solid var(--gold-soft);
  border-radius: 50%; transition: all 0.2s;
}
.theme-btn .ic { width: 1.05rem; height: 1.05rem; vertical-align: 0; }
.theme-btn:hover { background: var(--gold); color: #fff; transform: rotate(15deg); }

.user-chip {
  display: flex; align-items: center; gap: 7px; text-decoration: none; color: var(--ink);
  padding: 3px 8px; border-radius: 999px; transition: background 0.15s; white-space: nowrap;
}
.user-chip:hover { background: var(--gold-pale); }
.user-chip.on { background: var(--gold-pale); box-shadow: inset 0 0 0 1px var(--gold-soft); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--flame), var(--gold)); color: #fff; font-weight: 800;
  font-size: 0.88rem;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta strong { font-size: 0.88rem; }
.user-meta small { color: var(--ink-soft); font-size: 0.7rem; }

/* ---------------- ornament ---------------- */
.ornament-divider {
  height: 6px;
  background:
    linear-gradient(90deg, var(--maroon), var(--flame) 30%, var(--gold) 50%, var(--flame) 70%, var(--maroon));
}
.ornament-divider.small { height: 3px; border-radius: 2px; margin-block: 14px; }
.ornament-divider.flip { margin-block-end: 0; }

/* ---------------- layout ---------------- */
.container { max-width: 1250px; width: 100%; margin-inline: auto; padding: 26px 20px 40px; flex: 1; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-block-end: 20px; }
.page-head h1 { font-family: var(--font-display); font-size: 1.7rem; color: var(--heading); }
.profile-head { align-items: flex-start; }
.page-intro { max-width: 680px; margin-block-start: 2px; font-size: 0.88rem; }
.anchor-section { scroll-margin-top: 100px; }
.eyebrow {
  display: inline-block; margin-block-end: 2px; color: var(--gold); font-size: 0.75rem;
  font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
}

.muted { color: var(--ink-soft); }
.small-note { font-size: 0.8rem; margin-block-start: 10px; }
.huge { font-size: 4rem; font-family: var(--font-display); color: var(--gold); }

/* ---------------- cards ---------------- */
.card {
  background: var(--paper);
  border: 1px solid var(--gold-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-block-end: 20px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.25s ease, background-color 0.35s ease, border-color 0.35s ease;
}
.card:hover { box-shadow: var(--shadow-lift); }
.card::before {
  content: '';
  position: absolute; inset-block-start: 0; inset-inline: 0; height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--flame), var(--gold));
  opacity: 0.6;
}
.card-title { font-family: var(--font-display); font-size: 1.2rem; color: var(--heading); margin-block-end: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-block-end: 8px; }
.card-head .card-title { margin-block-end: 0; }
.card-subtitle { font-size: 0.82rem; margin-block-start: 1px; }
.center-card { max-width: 430px; margin-inline: auto; text-align: center; padding: 44px; }
.narrow-card { max-width: 470px; }
.self-start { align-self: flex-start; }

.grid-2 { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 20px; align-items: start; }
/* flipped variant: first card is the main (wide) one, second is the narrow side card */
.grid-2-flip { grid-template-columns: 1fr minmax(280px, 340px); }
.grid-2 > .card { margin-block-end: 0; min-width: 0; }
@media (max-width: 900px) { .grid-2, .grid-2-flip { grid-template-columns: 1fr; } }

/* ---------------- stats ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-block-end: 20px; }
.stat-card {
  background: linear-gradient(150deg, var(--paper), var(--gold-pale));
  border: 1px solid var(--gold-soft); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; display: flex; align-items: center; gap: 14px;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.stat-grid a.stat-card { color: var(--ink); text-decoration: none; }
.stat-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.stat-icon {
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 12px;
  display: grid; place-items: center; color: var(--gold);
  background: var(--gold-pale); border: 1px solid var(--gold-soft);
}
.stat-icon .ic { width: 1.45rem; height: 1.45rem; vertical-align: 0; }
.stat-body { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.stat-num {
  font-size: 2rem; font-weight: 800; line-height: 1.15;
  background: linear-gradient(135deg, var(--flame-deep), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-label { color: var(--ink-soft); font-weight: 600; font-size: 0.88rem; }
.stat-note { color: var(--ink-soft); font-size: 0.72rem; }
.stat-text { font-size: 1.25rem; line-height: 1.35; }

/* High-value destinations on role dashboards */
.quick-actions-card { background: linear-gradient(150deg, var(--paper), var(--gold-pale)); }
.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-block-start: 14px; }
.quick-link {
  min-width: 0; display: flex; align-items: center; gap: 12px; padding: 15px;
  color: var(--ink); text-decoration: none; background: var(--surface);
  border: 1px solid var(--gold-soft); border-radius: 12px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.quick-link:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--gold); }
.quick-link > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.quick-link strong { color: var(--heading); font-size: 0.9rem; }
.quick-link small { color: var(--ink-soft); font-size: 0.72rem; line-height: 1.5; }
.quick-icon {
  width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center;
  color: var(--gold); background: var(--gold-pale); border: 1px solid var(--gold-soft); border-radius: 12px;
}
.quick-icon .ic { width: 1.3rem; height: 1.3rem; }

/* ---------------- tables ---------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th {
  text-align: start; padding: 10px 12px; color: var(--heading); font-size: 0.8rem;
  border-block-end: 2px solid var(--gold-soft); white-space: nowrap;
  background: var(--gold-pale);
}
th:first-child { border-start-start-radius: 8px; }
th:last-child { border-start-end-radius: 8px; }
td { padding: 10px 12px; border-block-end: 1px solid var(--cream-2); vertical-align: middle; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: rgba(195, 148, 53, 0.07); }
.row-highlight { background: var(--gold-pale); }
.row-highlight:hover { background: var(--gold-pale); }
.actions-cell { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.table-metric-link { color: var(--ink-soft); text-decoration: none; white-space: nowrap; }
.table-metric-link strong { color: var(--heading); }
.table-metric-link:hover { color: var(--gold); }

/* ---------------- badges & chips ---------------- */
.badge {
  display: inline-block; padding: 2px 11px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 700; white-space: nowrap;
}
.badge-green { background: var(--green-pale); color: var(--green); border: 1px solid var(--green-line); }
.badge-red { background: var(--red-pale); color: var(--red); border: 1px solid var(--red-line); }
.badge-amber { background: var(--amber-pale); color: var(--amber); border: 1px solid var(--amber-line); }
.badge-gray { background: var(--gray-pale); color: var(--ink-soft); border: 1px solid var(--gray-line); }
.badge-gold { background: linear-gradient(135deg, var(--gold), #ad8125); color: #fff; }
.conflict-badge {
  width: fit-content; font-size: 0.68rem; padding: 2px 8px;
  box-shadow: 0 1px 4px rgba(192, 57, 43, 0.12);
}
.session-pill .conflict-badge { margin-block-start: 3px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.page-filters { margin-block: -4px 16px; }
.chip {
  text-decoration: none; color: var(--ink-soft); background: var(--surface); border: 1.5px solid var(--gold-soft);
  padding: 4px 15px; border-radius: 999px; font-weight: 600; font-size: 0.87rem; transition: all 0.15s;
}
.chip:hover { border-color: var(--gold); color: var(--heading); }
.chip.on { background: linear-gradient(135deg, var(--maroon), var(--flame-deep)); border-color: var(--maroon); color: #fff; }

/* ---------------- forms ---------------- */
.stack { display: flex; flex-direction: column; gap: 13px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { grid-column: 1 / -1; }
.form-button-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .form-grid, .row-2 { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: span 1; } }

label { display: flex; flex-direction: column; gap: 4px; font-size: 0.86rem; font-weight: 600; color: var(--ink-soft); min-width: 0; }
label input, label select, label textarea { width: 100%; min-width: 0; }
input, select, textarea {
  font-family: inherit; font-size: 0.95rem; color: var(--ink);
  padding: 9px 12px; border: 1.5px solid var(--gold-soft); border-radius: 9px; background: var(--surface);
  transition: border 0.15s, box-shadow 0.15s, background-color 0.35s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(195, 148, 53, 0.18);
}
input[type="date"], input[type="time"] { color-scheme: light; }
[data-theme="dark"] input[type="date"], [data-theme="dark"] input[type="time"] { color-scheme: dark; }
.search-input { min-width: 220px; }
input[type="file"]::file-selector-button {
  font-family: inherit; font-weight: 700; font-size: 0.85rem; cursor: pointer;
  border: 1px solid var(--gold-soft); border-radius: 7px; padding: 5px 13px;
  margin-inline-end: 10px; background: var(--gold-pale); color: var(--heading);
  transition: all 0.15s;
}
input[type="file"]::file-selector-button:hover { background: var(--gold); color: #fff; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit; font-weight: 700; font-size: 0.9rem; cursor: pointer;
  border-radius: 9px; border: 1.5px solid transparent; padding: 9px 18px;
  text-decoration: none; transition: all 0.15s; white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn-primary {
  background: linear-gradient(135deg, var(--maroon), var(--flame-deep)); color: #fff;
  box-shadow: 0 2px 6px rgba(140, 47, 36, 0.3);
}
.btn-primary:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); color: var(--heading); border-color: var(--gold-soft); }
.btn-ghost:hover { background: var(--gold-pale); border-color: var(--gold); }
.btn-danger { background: var(--surface); color: var(--red); border-color: var(--red-line); }
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
[data-theme="dark"] .btn-danger:hover { color: #2a120c; }
.btn-sm { padding: 4px 12px; font-size: 0.8rem; border-radius: 7px; }
.btn-lg { padding: 12px 22px; font-size: 1.05rem; }
.inline-form { display: inline-flex; }
.inline-details { display: inline-block; position: relative; }
.inline-details summary { list-style: none; }
.inline-details summary::-webkit-details-marker { display: none; }
.inline-details[open] .row-form {
  position: absolute; z-index: 20; inset-inline-start: 0; margin-block-start: 6px;
  background: var(--paper); border: 1px solid var(--gold-soft); border-radius: 10px;
  box-shadow: var(--shadow-lift); padding: 10px; display: flex; gap: 6px;
}
.reassign-details[open] .reassign-form {
  position: absolute; z-index: 30; inset-inline-end: 0; min-width: 245px; margin-block-start: 6px;
  padding: 12px; display: flex; flex-direction: column; gap: 10px;
  background: var(--paper); border: 1px solid var(--gold-soft); border-radius: 11px; box-shadow: var(--shadow-lift);
}
.reassign-form select { width: 100%; }

/* ---------------- flash & callout ---------------- */
.flash {
  padding: 11px 18px; border-radius: 10px; font-weight: 600; margin-block-end: 16px;
  border: 1px solid;
}
.flash-success { background: var(--green-pale); color: var(--green); border-color: var(--green-line); }
.flash-error { background: var(--red-pale); color: var(--red); border-color: var(--red-line); }

.callout {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px; border-radius: var(--radius); margin-block-end: 20px;
  border: 1px solid; font-size: 1rem;
}
.callout-green { background: var(--green-pale); border-color: var(--green-line); }
.callout-red { background: var(--red-pale); border-color: var(--red-line); }

/* ---------------- tabs ---------------- */
.tabs {
  display: flex; gap: 6px; flex-wrap: wrap; margin-block-end: 20px;
  border-block-end: 2px solid var(--gold-soft); padding-block-end: 0;
}
.tab {
  text-decoration: none; color: var(--ink-soft); font-weight: 700; font-size: 0.95rem;
  padding: 9px 18px; border-radius: 10px 10px 0 0; border: 2px solid transparent; border-block-end: none;
  margin-block-end: -2px; transition: all 0.15s;
}
.tab:hover { color: var(--heading); background: var(--gold-pale); }
.tab.on {
  background: var(--paper); color: var(--heading);
  border-color: var(--gold-soft); border-block-end: 2px solid var(--paper);
}

/* ---------------- schedule ---------------- */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
@media (max-width: 1000px) { .week-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 640px) { .week-grid { grid-template-columns: repeat(2, 1fr); } }
.day-col {
  background: var(--cream); border: 1px solid var(--cream-2); border-radius: 10px;
  padding: 8px; display: flex; flex-direction: column; gap: 6px; min-height: 90px;
}
.day-col.today { border-color: var(--gold); background: var(--gold-pale); }
.day-name { font-weight: 800; font-size: 0.83rem; color: var(--heading); text-align: center; padding-block-end: 4px; border-block-end: 1px dashed var(--gold-soft); }
.day-empty { color: var(--ink-soft); text-align: center; font-size: 0.85rem; padding-block: 8px; }
.session-pill {
  display: flex; flex-direction: column; text-decoration: none;
  background: var(--surface); border: 1px solid var(--gold-soft); border-inline-start: 3px solid var(--flame);
  border-radius: 8px; padding: 5px 9px; transition: all 0.15s; color: var(--ink);
}
a.session-pill:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-inline-start-color: var(--gold); }
.session-time { font-weight: 800; font-size: 0.8rem; color: var(--flame-deep); }
[data-theme="dark"] .session-time { color: var(--flame); }
.session-student { font-size: 0.84rem; font-weight: 600; }
.session-pill.big { flex-direction: row; align-items: center; gap: 14px; padding: 10px 16px; }
.session-pill.big .session-time { font-size: 0.95rem; min-width: 80px; }
.session-pill.big .session-student { font-size: 1rem; }
.today-list { display: flex; flex-direction: column; gap: 8px; }
.today-list-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.session-duration {
  display: inline-flex; align-items: center; gap: 5px; margin-inline-start: auto;
  color: var(--ink-soft); font-size: 0.8rem; white-space: nowrap;
}
.sessions-card { background: linear-gradient(145deg, var(--paper), var(--gold-pale)); }
.sessions-card .empty { padding-block: 18px; }

/* Teacher workload bars */
.teacher-load-card { background: linear-gradient(150deg, var(--paper), var(--gold-pale)); }
.teacher-bars { display: flex; flex-direction: column; gap: 8px; margin-block-start: 14px; }
.teacher-bar-row {
  display: grid; grid-template-columns: minmax(145px, 190px) minmax(160px, 1fr) 62px;
  align-items: center; gap: 14px; padding: 9px 11px; border-radius: 11px;
  color: var(--ink); text-decoration: none; border: 1px solid transparent;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}
.teacher-bar-row:hover { background: var(--surface); border-color: var(--gold-soft); transform: translateX(calc(var(--dir-factor, 1) * -2px)); }
[dir="ltr"] .teacher-bar-row:hover { transform: translateX(2px); }
.teacher-bar-person { display: flex; align-items: center; gap: 9px; min-width: 0; }
.teacher-bar-person strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.teacher-bar-avatar {
  width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border-radius: 10px;
  color: #fff; font-weight: 800; background: linear-gradient(145deg, var(--maroon), var(--flame));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
}
.teacher-bar-track { height: 12px; overflow: hidden; border-radius: 999px; background: var(--cream-2); border: 1px solid var(--gold-soft); }
.teacher-bar-fill {
  display: block; width: var(--bar-size); height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--flame), var(--gold));
  box-shadow: 0 0 10px rgba(195, 148, 53, 0.2); transition: width 0.35s ease;
}
.teacher-bar-count { display: flex; align-items: baseline; justify-content: flex-end; gap: 4px; color: var(--ink-soft); white-space: nowrap; }
.teacher-bar-count strong { color: var(--heading); font-size: 1.12rem; }
.teacher-bar-count small { font-size: 0.7rem; }
.schedule-filters { margin-block-end: 16px; }
.teacher-create-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Compact teacher appointments */
.teacher-today-card {
  background:
    radial-gradient(circle at 8% 12%, rgba(195, 148, 53, 0.11), transparent 28%),
    linear-gradient(145deg, var(--paper), var(--gold-pale));
}
.teacher-today-head { margin-block-end: 15px; }
.today-list-compact {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
}
.appointment-card {
  min-width: 0; min-height: 126px; padding: 15px 16px 13px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 8px; color: var(--ink); text-decoration: none;
  background: var(--surface); border: 1px solid var(--gold-soft); border-radius: 12px;
  box-shadow: 0 1px 4px rgba(90, 60, 20, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.appointment-card::before {
  content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 3px;
  background: linear-gradient(var(--gold), var(--flame));
}
.appointment-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--gold); }
.appointment-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.appointment-time { color: var(--flame-deep); font-size: 1rem; letter-spacing: 0.01em; }
[data-theme="dark"] .appointment-time { color: var(--flame); }
.appointment-duration { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-soft); font-size: 0.75rem; white-space: nowrap; }
.appointment-duration .ic { width: 0.9rem; height: 0.9rem; }
.appointment-student { font-size: 1.02rem; line-height: 1.45; overflow-wrap: anywhere; }
.appointment-link {
  margin-block-start: auto; display: inline-flex; align-items: center; gap: 5px;
  color: var(--gold); font-size: 0.75rem; font-weight: 700;
}

/* Student portal hierarchy */
.section-nav {
  display: flex; gap: 8px; flex-wrap: wrap; margin-block-end: 18px; padding: 7px;
  width: fit-content; max-width: 100%; background: var(--paper); border: 1px solid var(--gold-soft);
  border-radius: 999px; box-shadow: var(--shadow);
}
.section-nav a {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px;
  color: var(--ink-soft); text-decoration: none; font-size: 0.82rem; font-weight: 700; transition: all 0.15s;
}
.section-nav a:hover { color: var(--heading); background: var(--gold-pale); }
.section-nav .ic { color: var(--gold); }
.portal-stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.portal-status-stat.is-paid { border-color: var(--green-line); }
.portal-status-stat.is-due { border-color: var(--red-line); }
.portal-stat-value { min-height: 2rem; display: flex; align-items: center; }
.portal-stat-value .badge { font-size: 0.88rem; padding: 4px 13px; }
.portal-priority-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 20px; align-items: stretch; }
.portal-priority-grid > .card { min-width: 0; }
.portal-session-row .session-student { min-width: 92px; }
.material-list { display: flex; flex-direction: column; gap: 8px; }
.material-row {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; color: var(--ink);
  text-decoration: none; background: var(--surface); border: 1px solid var(--gold-soft); border-radius: 10px;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.material-row:hover { border-color: var(--gold); transform: translateY(-1px); box-shadow: var(--shadow); }
.material-icon { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; color: var(--gold); background: var(--gold-pale); border-radius: 9px; }
.material-copy { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.material-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.material-copy small { color: var(--ink-soft); font-size: 0.72rem; }
.material-download { display: inline-flex; align-items: center; gap: 5px; color: var(--heading); font-size: 0.75rem; font-weight: 700; white-space: nowrap; }
.info-list-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }

/* ---------------- icons ---------------- */
.ic { width: 1.1em; height: 1.1em; vertical-align: -0.18em; flex-shrink: 0; display: inline-block; }
.ic-gold { color: var(--gold); }
.ic-lg { width: 1.35em; height: 1.35em; vertical-align: -0.28em; }
.card-title .ic { color: var(--gold); margin-inline-end: 4px; }
.tab .ic { color: var(--gold); margin-inline-end: 3px; }
.tab.on .ic { color: var(--flame-deep); }
[data-theme="dark"] .tab.on .ic { color: var(--flame); }
.btn .ic { width: 1em; height: 1em; vertical-align: -0.14em; }
h1 .ic { color: var(--gold); }

/* ---------------- empty states ---------------- */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--ink-soft); text-align: center; padding: 26px 10px;
}
.empty .ic { width: 2.1rem; height: 2.1rem; color: var(--gold-soft); }
[data-theme="dark"] .empty .ic { color: var(--gold); opacity: 0.5; }

/* ---------------- misc ---------------- */
.info-list { display: flex; flex-direction: column; }
.info-list > div {
  display: flex; justify-content: space-between; gap: 14px;
  padding-block: 8px; border-block-end: 1px dashed var(--cream-2);
}
.info-list dt { color: var(--ink-soft); font-weight: 600; font-size: 0.88rem; }
.info-list dd { font-weight: 700; text-align: end; }

.cred-box {
  background: var(--gold-pale); border: 1px dashed var(--gold); border-radius: 10px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; margin-block-end: 12px;
}
.credential-form { margin-block-start: 12px; }
.credential-reset-form { margin-block-start: 10px; }
.readonly-field {
  display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 9px 12px;
  color: var(--ink-soft); background: var(--gold-pale); border: 1px solid var(--gold-soft); border-radius: 9px;
}
.readonly-field > span { font-size: 0.78rem; font-weight: 700; }
.readonly-field > strong { color: var(--ink); font-size: 0.95rem; }
.readonly-field > small { font-size: 0.7rem; line-height: 1.4; }

/* Payment entry is optimized for the common task: confirming this month's fee. */
.payment-entry-card { background: linear-gradient(150deg, var(--paper), var(--gold-pale)); }
.payment-plan-summary {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-block: 14px;
}
.payment-plan-summary > div {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--gold-soft); border-radius: 10px;
}
.payment-plan-summary span { color: var(--ink-soft); font-size: 0.73rem; }
.payment-plan-summary strong { color: var(--heading); font-size: 1rem; }
.current-payment-form { padding-block-end: 16px; }
.payment-advanced { border-block-start: 1px dashed var(--gold-soft); padding-block-start: 13px; }
.payment-advanced summary { color: var(--heading); font-weight: 700; font-size: 0.84rem; cursor: pointer; }
.payment-advanced[open] summary { margin-block-end: 8px; }
code {
  background: var(--surface); border: 1px solid var(--gold-soft); border-radius: 6px;
  padding: 1px 8px; font-size: 0.88rem; color: var(--flame-deep); font-weight: 700;
  unicode-bidi: embed;
}
[data-theme="dark"] code { color: var(--flame); }

/* ---------------- login ---------------- */
.login-wrap { flex: 1; display: grid; place-items: center; padding: 30px 16px; }
.login-card {
  background: var(--paper); border: 1px solid var(--gold-soft); border-radius: 20px;
  box-shadow: 0 10px 40px rgba(90, 60, 20, 0.14);
  padding: 38px 42px; max-width: 470px; width: 100%; text-align: center;
  animation: rise 0.4s ease both;
}
[data-theme="dark"] .login-card { box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.login-brand img {
  width: 110px; height: 110px; border-radius: 50%; object-fit: cover; object-position: center 40%;
  border: 3px solid var(--gold); box-shadow: 0 0 0 6px var(--gold-pale);
  background: #fff;
}
.login-brand h1 { font-family: var(--font-display); color: var(--heading); font-size: 1.75rem; margin-block-start: 10px; }
.login-brand .tagline { color: var(--ink-soft); font-size: 0.92rem; }
.login-card h2 { font-size: 1.08rem; margin-block-end: 2px; }
.login-card form { text-align: start; margin-block-start: 18px; }
.login-lang { margin-block-start: 18px; display: flex; justify-content: center; align-items: center; gap: 10px; }

/* ---------------- profile ---------------- */
.profile-page-head { padding: 4px 2px 2px; }
.profile-page-head h1 { margin-block-end: 2px; }
.profile-monogram {
  width: 66px; height: 66px; border-radius: 20px; display: grid; place-items: center;
  color: #fff; font-family: var(--font-display); font-size: 2rem; font-weight: 700;
  background: linear-gradient(145deg, var(--maroon), var(--flame), var(--gold));
  border: 2px solid var(--gold-soft); box-shadow: var(--shadow-lift); transform: rotate(3deg);
}
.profile-security-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.profile-security-card .card-title { margin: 0; }
.profile-security-icon {
  width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center;
  color: var(--gold); background: var(--gold-pale); border: 1px solid var(--gold-soft);
}
.profile-security-icon .ic { width: 1.5rem; height: 1.5rem; }
.profile-note {
  display: flex; align-items: flex-start; gap: 8px; width: 100%; margin-block-start: 6px;
  padding: 11px 12px; border-radius: 10px; text-align: start; color: var(--ink-soft);
  background: var(--gold-pale); border: 1px dashed var(--gold-soft); font-size: 0.8rem;
}
.profile-note .ic { color: var(--gold); margin-block-start: 2px; }
.security-form-card { margin-inline: auto; }
.security-form-card > .profile-security-icon { margin: 0 auto 16px; }

/* ---------------- footer ---------------- */
.footer { color: var(--ink-soft); font-size: 0.82rem; }
.footer-inner {
  background: linear-gradient(135deg, var(--topbar-1), var(--topbar-2)); padding: 20px max(20px, calc((100% - 1250px) / 2));
  display: grid; grid-template-columns: minmax(210px, 0.7fr) auto minmax(450px, 1.3fr); align-items: center; gap: 20px;
}
.footer-brand { display: flex; flex-direction: column; }
.footer-brand strong { color: var(--heading); font-family: var(--font-display); font-size: 1.05rem; }
.footer-brand span { font-size: 0.74rem; }
.footer-contact { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: nowrap; white-space: nowrap; }
.footer-contact strong { color: var(--heading); }
.footer-contact a { color: var(--ink-soft); text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.footer-contact a:hover { color: var(--gold); }
.footer-inner > p { text-align: end; white-space: nowrap; font-size: 0.78rem; }

/* ---------------- scrollbars (webkit) ---------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--cream); }
::-webkit-scrollbar-thumb { background: var(--gold-soft); border-radius: 6px; border: 2px solid var(--cream); }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* ---------------- print ---------------- */
@media print {
  .topbar, .footer, .btn, .ornament-divider, .filters { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
}

@media (max-width: 1050px) {
  .today-list-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-priority-grid { grid-template-columns: 1fr; }
  .teacher-create-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-inner > p { grid-column: 1 / -1; text-align: center; }
}

@media (min-width: 761px) and (max-width: 1100px) {
  .topbar-inner { padding: 9px 16px; gap: 9px; }
  .brand { order: 1; }
  .topbar-actions { order: 2; margin-inline-start: auto; }
  .mainnav {
    order: 3;
    width: 100%;
    margin-inline-start: 0;
    flex-wrap: nowrap;
    justify-content: center;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }
  .mainnav::-webkit-scrollbar { display: none; }
  .mainnav a { flex: 0 0 auto; }
}

@media (max-width: 760px) {
  .topbar-inner {
    padding: 8px 12px;
    gap: 7px;
    flex-wrap: wrap;
  }
  .brand { order: 1; gap: 0; flex: 0 0 auto; }
  .brand-logo { width: 40px; height: 40px; box-shadow: 0 0 0 2px var(--gold-pale); }
  .brand-text { display: none; }
  .topbar-actions {
    order: 2;
    margin-inline-start: auto;
    gap: 5px;
  }
  .topbar-actions .user-meta { display: none; }
  .topbar-actions .user-chip { padding: 2px; }
  .topbar-actions .lang-btn { padding: 4px 10px; font-size: 0.76rem; }
  .topbar-actions .theme-btn { width: 32px; height: 32px; }
  .topbar-actions .btn-sm { min-height: 32px; padding: 4px 10px; font-size: 0.75rem; }
  .mainnav {
    order: 3;
    width: 100%;
    margin-inline-start: 0;
    flex-wrap: nowrap;
    gap: 4px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    scroll-snap-type: inline proximity;
  }
  .mainnav::-webkit-scrollbar { display: none; }
  .mainnav a {
    flex: 0 0 auto;
    padding: 5px 10px;
    font-size: 0.78rem;
    scroll-snap-align: start;
  }
  .container { padding: 18px 12px 30px; }
  .page-head { gap: 10px; margin-block-end: 14px; }
  .page-head h1 { font-size: 1.48rem; line-height: 1.35; }
  .page-intro { font-size: 0.8rem; line-height: 1.6; }
  .card { padding: 15px; margin-block-end: 14px; border-radius: 12px; }
  .card-title { font-size: 1.08rem; margin-block-end: 10px; }
  .card-head { align-items: flex-start; gap: 8px; }
  .stat-grid,
  .portal-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-block-end: 14px;
  }
  .stat-card { min-width: 0; padding: 12px; gap: 9px; border-radius: 12px; }
  .stat-icon { width: 38px; height: 38px; border-radius: 10px; }
  .stat-icon .ic { width: 1.15rem; height: 1.15rem; }
  .stat-num { font-size: 1.5rem; }
  .stat-text { font-size: 1rem; }
  .stat-label { font-size: 0.75rem; line-height: 1.45; }
  .stat-note { font-size: 0.66rem; }
  .teacher-stat-grid .stat-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .page-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    padding-block-end: 5px;
  }
  .page-filters::-webkit-scrollbar { display: none; }
  .page-filters .chip { flex: 0 0 auto; }
  .search-input { width: 100%; min-width: 0; }
  .card > .table-wrap {
    width: calc(100% + 30px);
    margin-inline: -15px;
    padding-inline: 15px;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }
  th, td { padding: 9px 10px; }
  .tabs {
    flex-wrap: nowrap;
    gap: 3px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    margin-block-end: 14px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; padding: 8px 12px; font-size: 0.84rem; }
  .week-grid { gap: 7px; }
  .day-col { padding: 6px; gap: 5px; }
  .session-pill { padding: 5px 7px; }
  .session-pill.big { padding: 9px 11px; gap: 9px; }
  .session-pill.big .session-time { min-width: 66px; font-size: 0.84rem; }
  .session-pill.big .session-student { font-size: 0.9rem; }
  input, select, textarea { min-height: 42px; }
  textarea { min-height: 76px; }
  .btn { min-height: 42px; padding: 8px 15px; }
  .btn-sm { min-height: 38px; padding: 5px 11px; }
  .inline-details[open] .row-form,
  .reassign-details[open] .reassign-form {
    position: fixed;
    z-index: 90;
    inset-inline: 12px;
    inset-block-end: 12px;
    inset-block-start: auto;
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 14px;
    background: var(--paper);
    border: 1px solid var(--gold-soft);
    border-radius: 12px;
    box-shadow: var(--shadow-lift);
  }
  .inline-details[open] .row-form { flex-wrap: wrap; }
  .inline-details[open] .row-form input { flex: 1 1 180px; }
  .today-list-grid { grid-template-columns: 1fr; }
  .today-list-compact { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; text-align: center; gap: 10px; }
  .footer-inner > p { grid-column: auto; white-space: normal; text-align: center; }
  .footer-brand { align-items: center; }
  .footer-contact { flex-wrap: wrap; }
  .teacher-bar-row { grid-template-columns: minmax(125px, 1fr) 54px; gap: 9px; }
  .teacher-bar-track { grid-column: 1 / -1; grid-row: 2; }
  .nav-separator { display: none; }
  .section-nav { width: 100%; border-radius: 14px; }
  .section-nav a { flex: 1 1 calc(50% - 8px); justify-content: center; }
  .info-list-grid { grid-template-columns: 1fr; }
  .material-download { font-size: 0; }
  .material-download .ic { width: 1rem; height: 1rem; }
  .payment-plan-summary { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .quick-grid, .teacher-create-form { grid-template-columns: 1fr; }
  .quick-link { padding: 12px; }
  .section-nav { gap: 5px; padding: 5px; }
  .section-nav a { padding: 6px 8px; font-size: 0.76rem; }
  .login-wrap { padding: 18px 12px; }
  .login-card { padding: 26px 20px; border-radius: 16px; }
  .login-brand img { width: 88px; height: 88px; }
}
