/* Ruzmah design system — editorial premium direction */
:root {
  --purple: #594775;
  --purple-light: #eee9f2;
  --navy: #302747;
  --bg: #f5f2ec;
  --surface: #fffefa;
  --cream: #efe9df;
  --text: #29243a;
  --muted: #827c8b;
  --border: #e9e3dc;
  --soft: #f0ece5;
  --shadow: 0 18px 48px #30274710;
  --radius: 20px;
  --font: Ruzmah, Tahoma, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #191722;
  --surface: #242130;
  --cream: #2d2938;
  --text: #f2edf7;
  --muted: #b8afc1;
  --border: #3d374b;
  --soft: #2d2939;
  --purple: #b7a2d0;
  --purple-light: #3b324b;
  --navy: #eee6f7;
  --shadow: 0 18px 48px #0003;
  color-scheme: dark;
}
html { scroll-padding-top: 100px; }
body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.85;
  letter-spacing: 0;
}
h1, h2, h3, h4 { line-height: 1.5; letter-spacing: -.35px; }
h1 { font-size: clamp(30px, 3vw, 42px); }
h2 { font-size: clamp(22px, 2vw, 29px); }
h3 { font-size: 18px; }
p { line-height: 1.9; }
.container { width: min(1240px, calc(100% - 56px)); }
.site-header {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom-color: var(--border);
  box-shadow: 0 5px 22px #30274706;
}
.header-inner { height: 78px; }
.site-header nav { gap: clamp(14px, 2.2vw, 30px); }
.site-header nav a, .site-header nav summary { font-size: 13px; }
.logo > span:not(.logo-mark) { font-size: 33px; }
.logo-mark { color: var(--purple); }
.logo-mark .icon { width: 29px; height: 29px; }
.btn {
  min-height: 46px;
  border-radius: 12px;
  padding: 11px 20px;
  font-size: 13px;
  font-weight: 700;
  gap: 10px;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--purple);
  box-shadow: 0 7px 20px color-mix(in srgb, var(--purple) 18%, transparent);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-outline { border-color: var(--border); background: var(--surface); }
.btn-sm { min-height: 38px; padding: 8px 14px; }
.panel, .stat, .dash-card, .dash-stat, .teacher-card, .catalog-course,
.route-card, .course-choice, .question-card, .user-detail, .auth-form,
.auth-art, .order-review, .feed-empty, .feed-entry {
  border-radius: var(--radius);
}
.panel, .dash-card, .question-card, .user-detail, .auth-form, .order-review {
  border-color: var(--border);
  box-shadow: var(--shadow);
}
.badge { border-radius: 20px; padding: 4px 10px; font-size: 10px; }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.eyebrow { color: var(--purple); font-size: 11px; letter-spacing: .2px; }
.section-space { padding-block: clamp(48px, 6vw, 78px); }
.section-heading { margin-bottom: 26px; }
.section-heading p { font-size: 13px; }
.page-content { padding-top: 34px; padding-bottom: 70px; }
.page-heading { margin-bottom: 26px; }
.page-heading h1 { font-size: clamp(27px, 3vw, 39px); }
.page-heading p { font-size: 13px; max-width: 760px; }
.card, .panel {
  background: var(--surface);
  border: 1px solid var(--border);
}
.text-link { gap: 8px; }
.icon-btn { border-radius: 12px; background: var(--surface); }
input, select, textarea {
  border-radius: 12px;
  border-color: var(--border);
  background: var(--surface);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--purple) 60%, transparent);
  outline-offset: 2px;
}
:focus-visible { scroll-margin: 100px; }
.hero {
  border-radius: 28px;
  background:
    radial-gradient(circle at 12% 8%, #a58fbd3b, transparent 36%),
    linear-gradient(120deg, #302747, #493a61 68%, #665474);
  box-shadow: 0 22px 55px #30274720;
}
.hero h1 { font-size: clamp(32px, 4vw, 48px); line-height: 1.42; }
.hero-copy > p { font-size: 14px; line-height: 2; }
.hero-actions { gap: 12px; }
.hero-proof { gap: 18px; }
.opening-section { padding-top: 58px; }
.opening-copy h1 { line-height: 1.48; letter-spacing: -1px; }
.opening-copy > p { font-size: 14px; line-height: 2; }
.opening-actions .btn { min-height: 48px; }
.route-card, .store-path-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 12px 30px #30274708;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.route-card:hover, .store-path-card:hover, .catalog-course:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--purple) 35%, var(--border));
}
.catalog-course { border: 1px solid var(--border); box-shadow: 0 10px 28px #30274708; }
.catalog-course-art { border-radius: 17px 17px 0 0; }
.store-benefits article, .store-start-steps article {
  border-radius: var(--radius);
  border-color: var(--border);
}
.storefront .btn-primary { background: var(--purple); }
.subscription-layout .panel { padding: clamp(20px, 3vw, 30px); }
.price-card, .pricing-card, .plan-card {
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 12px 35px #30274709;
}
.price-card.featured, .pricing-card.featured, .plan-card.featured {
  border-color: var(--accent, #b58b5a);
  box-shadow: 0 18px 42px #30274712;
}
.auth-layout { gap: 20px; }
.auth-art {
  border-radius: 24px;
  background: linear-gradient(145deg, #302747, #5b4a70);
}
.auth-form { padding: clamp(22px, 3vw, 38px); }
.form-error { border-radius: 10px; }
.question-card { padding: 22px; }
.question-card .options { gap: 9px; }
.question-card .option { border-radius: 12px; min-height: 50px; }
.explanation { border-radius: 12px; padding: 14px; }
.feed-entry { border-radius: 15px; }
.feed-empty { padding: 25px; background: var(--surface); border: 1px solid var(--border); }
.app-bar {
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-bottom-color: var(--border);
}
.app-bar-inner { height: 68px; }
.app-shell { grid-template-columns: 258px minmax(0, 1fr); }
.app-side {
  background: var(--surface);
  border-inline-end-color: var(--border);
  padding: 25px 16px;
}
.app-nav-title { padding: 12px 13px 7px; font-size: 10px; letter-spacing: .4px; }
.app-side a, .app-side button {
  border-radius: 12px;
  padding: 11px 13px;
  min-height: 44px;
}
.app-side a.active {
  background: var(--purple-light);
  color: var(--purple);
}
.app-side a.active .icon { color: var(--purple); }
.app-main { padding: 32px clamp(18px, 3vw, 46px) 60px; }
.app-page { max-width: 1160px; }
.app-page .page-heading h1 { font-size: 32px; }
.app-user { border-radius: 999px; }
.app-avatar { background: linear-gradient(135deg, var(--purple), #8e7aa4); }
.app-tabs {
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 28px #30274708;
}
.app-tabs a { font-size: 10px; min-width: 58px; }
.app-tabs a.active { color: var(--purple); }
.dash-hero {
  border-radius: 26px;
  background:
    radial-gradient(circle at 10% 0%, #b6a2cf55, transparent 42%),
    linear-gradient(120deg, #302747, #55436b 70%, #705b7d);
  box-shadow: 0 20px 46px #3027471c;
}
.dash-hero h1 { font-size: clamp(27px, 3vw, 37px); }
.dash-card, .dash-stat { background: var(--surface); border: 1px solid var(--border); }
.dash-card { padding: 21px; }
.dash-stat { border-radius: 17px; }
.task-item { border-radius: 13px; }
.task-item:hover { background: var(--soft); }
.welcome-layout > aside { border-radius: 22px; }
.welcome-layout .panel { padding: clamp(20px, 3vw, 30px); }
.welcome-choice { border-radius: 13px; }
.course-choice { border-radius: 15px; }
.teacher-card { border: 1px solid var(--border); box-shadow: 0 10px 30px #30274708; }
.teacher-card:hover { box-shadow: var(--shadow); }
.admin-shell { gap: 20px; }
.admin-nav {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 15px;
  box-shadow: var(--shadow);
}
.admin-nav button { border-radius: 11px; padding: 11px 12px; }
.admin-nav button.active { background: var(--purple-light); color: var(--purple); }
#admin-content, #live-admin-root { min-width: 0; }
.admin-overview-title { border-radius: 22px; }
.admin-metrics .stat { border-radius: 16px; border: 1px solid var(--border); }
.admin-table-wrap { border-radius: 16px; border: 1px solid var(--border); }
.admin-table-wrap table { border-collapse: separate; border-spacing: 0; }
.admin-table-wrap th { background: var(--soft); }
.admin-table-wrap th:first-child { border-radius: 0 12px 0 0; }
.admin-table-wrap th:last-child { border-radius: 12px 0 0 0; }
.user-detail { border: 1px solid var(--border); margin-bottom: 12px; }
.modal, dialog { border-radius: 20px; border-color: var(--border); }
.toast { border-radius: 12px; box-shadow: var(--shadow); }
.empty-state, .empty { border-radius: 18px; }
@media (max-width: 900px) {
  .container { width: min(100% - 36px, 760px); }
  .site-header nav { gap: 14px; }
  .app-shell { grid-template-columns: 225px minmax(0, 1fr); }
  .app-side { padding-inline: 12px; }
}
@media (max-width: 720px) {
  .container { width: calc(100% - 28px); }
  .header-inner { height: 66px; }
  .site-header nav { gap: 10px; }
  .site-header nav a { font-size: 11px; }
  .logo > span:not(.logo-mark) { font-size: 29px; }
  .section-space { padding-block: 44px; }
  .page-content { padding-top: 23px; }
  .hero { border-radius: 20px; }
  .hero h1 { font-size: 29px; }
  .opening-section { padding-top: 34px; }
  .opening-copy h1 { font-size: 31px; }
  .app-bar-inner { height: 60px; }
  .app-shell { display: block; min-height: calc(100vh - 60px); }
  .app-side {
    position: fixed;
    z-index: 45;
    top: 60px;
    right: 0;
    bottom: 0;
    width: min(82vw, 300px);
    height: auto;
    border-radius: 0 0 0 18px;
    transform: translateX(110%);
    transition: transform .22s ease;
  }
  body.app-menu-open .app-side { transform: translateX(0); }
  .app-scrim { display: none; position: fixed; inset: 60px 0 0; z-index: 44; background: #17132166; border: 0; }
  body.app-menu-open .app-scrim { display: block; }
  .app-menu-btn { display: inline-flex; }
  .app-main { padding: 21px 14px calc(88px + env(safe-area-inset-bottom)); }
  .app-page .page-heading h1 { font-size: 26px; }
  .app-tabs {
    display: flex;
    position: fixed;
    z-index: 42;
    bottom: 0;
    right: 0;
    left: 0;
    padding: 7px 5px calc(7px + env(safe-area-inset-bottom));
    justify-content: space-around;
    gap: 2px;
  }
  .app-tabs a { min-width: 0; flex: 1; padding: 6px 3px; gap: 3px; }
  .dash-hero { padding: 21px; border-radius: 20px; }
  .dash-hero h1 { font-size: 27px; }
  .admin-shell { display: block; }
  .admin-nav { display: flex; overflow-x: auto; gap: 6px; margin-bottom: 15px; padding: 9px; }
  .admin-nav button { flex: 0 0 auto; width: auto; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Student reports: clear provenance and safe review states */
.leaks-page { max-width: 1120px; margin-inline: auto; }
.leaks-toolbar { display:flex; align-items:end; justify-content:space-between; gap:16px; margin:22px 0; }
.leaks-filters { display:flex; gap:10px; flex-wrap:wrap; }
.leaks-filters label { display:grid; gap:5px; color:var(--muted); font-size:11px; }
.leaks-filters select { min-width:150px; }
.leaks-form { padding:clamp(18px,3vw,28px); }
.leaks-form .panel-head { display:flex; align-items:center; justify-content:space-between; gap:15px; margin-bottom:12px; }
.leaks-form .panel-head h2 { margin:4px 0 0; }
.leaks-form .form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin-top:18px; }
.leaks-form .field { min-width:0; }
.leaks-form .field.full { grid-column:1/-1; }
.leaks-form .field label { font-size:12px; }
.leaks-form textarea { min-height:120px; }
.leaks-rights { display:flex; align-items:flex-start; gap:10px; margin:16px 0; color:var(--muted); font-size:11px; }
.leaks-rights input { width:auto; margin-top:5px; accent-color:var(--purple); }
.leaks-list { margin-top:28px; }
.leak-card { padding:22px; margin-bottom:14px; }
.leak-card-top, .leak-card-foot, .leak-meta { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.leak-card-top time { color:var(--muted); font-size:10px; }
.leak-card h3 { margin:13px 0 6px; font-size:18px; }
.leak-card p { font-size:13px; margin-bottom:14px; }
.leak-meta { justify-content:flex-start; color:var(--muted); font-size:10px; }
.leak-meta span { background:var(--soft); border-radius:20px; padding:4px 9px; }
.leak-card-foot { border-top:1px solid var(--border); padding-top:12px; margin-top:14px; }
.leak-card-foot .btn { min-height:32px; }
@media(max-width:720px) {
  .leaks-toolbar { align-items:stretch; flex-direction:column; }
  .leaks-toolbar > .btn { width:100%; }
  .leaks-filters { display:grid; grid-template-columns:1fr 1fr; }
  .leaks-filters select { min-width:0; width:100%; }
  .leaks-form .form-grid { grid-template-columns:1fr; }
  .leaks-form .field.full { grid-column:auto; }
  .leak-card { padding:16px; }
}

.leak-report { position:relative; font-size:11px; }
.leak-report summary { cursor:pointer; color:var(--muted); list-style:none; }
.leak-report summary::-webkit-details-marker { display:none; }
.leak-report[open] { display:flex; align-items:center; gap:7px; }
.leak-report-form { display:flex; align-items:center; gap:6px; }
.leak-report-form select { width:auto; max-width:150px; padding:5px 8px; font-size:10px; }

/* AI tutor attachment control */
.tutor-attachment { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-top:10px; }
.tutor-attachment label { cursor:pointer; }
.tutor-attachment small { font-size:11px; }
#tutor-image:focus-visible + small { outline:2px solid var(--purple); }

/* Admin subscriber broadcast */
#broadcast-form { padding:clamp(18px,3vw,28px); }
#broadcast-form .form-grid { display:grid; grid-template-columns:1fr; gap:14px; }
#broadcast-form textarea { min-height:150px; }
.broadcast-preview { margin-top:16px; padding:13px 15px; border:1px solid var(--border); border-radius:13px; background:var(--soft); color:var(--text); font-size:12px; }
#broadcast-form .checkbox { display:flex; align-items:flex-start; gap:9px; font-size:11px; }
#broadcast-form .checkbox input { width:auto; margin-top:5px; accent-color:var(--purple); }
@media(max-width:720px) {
  #broadcast-form .modal-actions { display:grid; grid-template-columns:1fr; }
  #broadcast-form .modal-actions .btn { width:100%; }
}


/* Floating lesson tools — compact, touch-friendly and theme-aware */
.lesson-content { position: relative; }
.lesson-floating-canvas {
  position: absolute; inset: 0; z-index: 18; pointer-events: none;
  touch-action: none; max-width: 100%; overflow: hidden;
}
.lesson-tools-fab {
  position: fixed; inset-inline-end: max(18px, env(safe-area-inset-right));
  bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 120;
  width: 48px; height: 48px; display: grid; place-items: center;
  border: 1px solid color-mix(in srgb, var(--purple) 25%, var(--border));
  border-radius: 50%; background: var(--surface); color: var(--purple);
  box-shadow: 0 8px 28px #21172c26; font-size: 24px; cursor: pointer;
}
.lesson-tools-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 32px #21172c30; }
.lesson-tools-fab[aria-expanded="true"] { background: var(--purple); color: white; }
.lesson-tools-panel {
  position: fixed; inset-inline-end: 16px;
  bottom: calc(146px + env(safe-area-inset-bottom)); z-index: 121;
  width: min(360px, calc(100vw - 32px)); max-height: min(70vh, 560px);
  overflow: auto; padding: 12px; border: 1px solid var(--border);
  border-radius: 18px; background: var(--surface); color: var(--text);
  box-shadow: 0 18px 55px #21172c2b;
}
.lesson-tools-panel[hidden] { display: none !important; }
.lt-main-tools, .lt-more-actions, .lt-destination {
  display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
}
.lt-tool, .lt-close, .lt-destination button, .lt-more-actions button,
.lesson-notebook-item, [data-ltool="clear"] {
  min-height: 40px; padding: 8px 11px; border: 1px solid var(--border);
  border-radius: 11px; background: var(--soft); color: var(--text);
}
.lt-tool { display: grid; justify-items: center; min-width: 48px; font-size: 17px; }
.lt-tool small { font-size: 10px; }
.lt-tool.active { border-color: var(--purple); background: var(--purple-light); color: var(--purple); }
.lt-close { margin-inline-start: auto; font-size: 20px; }
.lt-context { margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--soft); font-size: 12px; }
.lt-context[hidden] { display: none !important; }
.lt-colors { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 9px; }
.lt-colors button { width: 28px; height: 28px; border-radius: 50%; background: var(--swatch); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.lt-colors button.chosen { box-shadow: 0 0 0 2px var(--purple); }
.lt-custom-color { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 1px dashed var(--border); border-radius: 50%; }
.lt-custom-color input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.lt-size { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.lt-size input { flex: 1; }
.lt-destination { margin-top: 12px; }
.lt-destination button { flex: 1; background: var(--purple); color: white; border-color: var(--purple); }
.lesson-notebook-list { display: grid; gap: 8px; margin-top: 12px; }
.lesson-notebook-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; }
.lesson-notebook-item img { width: 54px; height: 42px; object-fit: contain; border-radius: 7px; background: white; }
@media(max-width:720px) {
  .lesson-tools-fab { inset-inline-end: 12px; bottom: calc(82px + env(safe-area-inset-bottom)); }
  .lesson-tools-panel { inset-inline: 10px; bottom: calc(138px + env(safe-area-inset-bottom)); width: auto; }
  .lt-tool { flex: 1; min-width: 42px; }
}
