/**
 * Ostadi interface refinement layer.
 * Loaded after the theme and companion plugins so visual changes stay isolated
 * from calculation, import, export and authentication behaviour.
 */

:root {
  --os-ink: #17233b;
  --os-muted: #667085;
  --os-green: #2457d6;
  --os-green-dark: #1946b8;
  --os-green-soft: #eef4ff;
  --os-purple: #7153c6;
  --os-purple-dark: #5c3eb0;
  --os-purple-soft: #f3f0fb;
  --os-cream: #f7f9fc;
  --os-line: #dce3ed;
  --os-card: #fff;
  --os-orange: #a6532e;
  --os-shadow: 0 8px 24px rgba(20, 40, 80, .07);
  --os-radius-sm: 8px;
  --os-radius: 12px;
  --os-radius-lg: 16px;
  --os-focus: 0 0 0 3px rgba(36, 87, 214, .2);
}

html { overflow-x: clip; }
body {
  overflow-wrap: break-word;
  color: var(--os-ink);
  background: #fff;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
body, button, input, select, textarea { letter-spacing: 0; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--os-green) !important;
  outline-offset: 3px;
}
.ostadi-container { width: min(1180px, calc(100% - 40px)); }

/* Header and navigation. */
.ostadi-site-header {
  background: rgba(255, 255, 255, .96);
  border-color: var(--os-line);
  backdrop-filter: blur(10px);
}
.ostadi-site-header.is-scrolled { box-shadow: 0 5px 18px rgba(20, 40, 80, .06); }
.ostadi-header-inner { min-height: 72px; gap: 22px; }
.ostadi-brand .custom-logo-link,
.ostadi-bundled-logo { padding: 2px 4px; border-radius: 8px; }
.ostadi-bundled-logo img,
.custom-logo { height: 52px; }
.ostadi-nav-list { gap: 2px; }
.ostadi-nav-list a,
.ostadi-tools-menu summary { min-height: 40px; padding: 8px 11px; border-radius: 7px; }
.ostadi-nav-list a:hover,
.ostadi-nav-list .current-menu-item > a,
.ostadi-tools-menu summary:hover { color: var(--os-green-dark); background: #f2f6fc; }
.ostadi-tools-list {
  min-width: 230px;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(20, 40, 80, .1);
}
.ostadi-tools-list .ostadi-tools-new span { background: var(--os-purple); }
.ostadi-header-cta,
.ostadi-header-login,
.ostadi-theme-toggle,
.ostadi-menu-toggle { border-radius: 8px; box-shadow: none; }
.ostadi-header-register { background: var(--os-green); box-shadow: none; }
.ostadi-header-register:hover { background: var(--os-green-dark); }

/* Home hero: compact, useful and deliberately free of decorative effects. */
.ostadi-hero {
  min-height: 0;
  background: #f8faff;
  border-bottom-color: var(--os-line);
}
.ostadi-hero::before,
.ostadi-hero-shape { display: none; }
.ostadi-hero-grid {
  grid-template-columns: minmax(0, .92fr) minmax(420px, 1.08fr);
  min-height: 0;
  gap: clamp(42px, 6vw, 78px);
  padding-block: 64px;
}
.ostadi-kicker,
.ostadi-overline { color: var(--os-green-dark); }
.ostadi-hero-copy h1 {
  margin: 14px 0 17px;
  max-width: 620px;
  font-size: clamp(38px, 4.3vw, 54px);
  line-height: 1.28;
  letter-spacing: -.025em;
}
.ostadi-hero-copy h1 em {
  color: var(--os-green);
  background: none;
  -webkit-text-fill-color: currentColor;
}
.ostadi-hero-copy > p { max-width: 585px; font-size: 17px; line-height: 1.85; }
.ostadi-hero-actions { margin-top: 25px; }
.ostadi-button {
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 8px;
  transition: background-color .15s, border-color .15s, color .15s;
}
.ostadi-button:hover { transform: none; }
.ostadi-button-primary { background: var(--os-green); box-shadow: none; }
.ostadi-button-ghost { background: #fff; }
.ostadi-trust-list { margin-top: 20px; color: var(--os-muted); }
.ostadi-trust-list span { border-radius: 6px; }
.ostadi-hero-visual { padding: 0; }
.ostadi-preview-card {
  padding: 20px;
  background: #fff;
  border-color: var(--os-line);
  border-radius: var(--os-radius-lg);
  box-shadow: var(--os-shadow);
  transform: none;
}
.ostadi-preview-card::before,
.ostadi-floating-note { display: none; }
.ostadi-preview-stats > div,
.ostadi-preview-table,
.ostadi-preview-row i,
.ostadi-preview-row mark { border-radius: var(--os-radius-sm); }

/* Quick access is an ordinary navigation block, not a floating dashboard. */
.ostadi-home-tools { margin-top: 0; padding: 28px 0; background: #fff; border-bottom: 1px solid var(--os-line); }
.ostadi-home-tools > .ostadi-container { padding: 0; border: 0; border-radius: 0; box-shadow: none; }
.ostadi-home-tools-head { margin-bottom: 14px; }
.ostadi-home-tools-head .ostadi-all-tools-link { display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:6px 12px;color:var(--os-green-dark);border:1px solid var(--os-line);border-radius:6px;font-size:13px;font-weight:700;text-decoration:none;white-space:nowrap; }
.ostadi-home-tools-head .ostadi-all-tools-link span { color:inherit;font-size:16px; }
.ostadi-tools-catalog-link { border-bottom:1px solid var(--os-line);margin-bottom:5px;padding-bottom:5px; }
.ostadi-home-tools-head h2 { font-size: 22px; }
.ostadi-home-tools-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ostadi-home-tools-grid > a,
.ostadi-home-tools-grid > a.is-new {
  min-height: 74px;
  padding: 12px 14px;
  color: var(--os-ink);
  background: #fff;
  border: 1px solid var(--os-line);
  border-radius: 10px;
  box-shadow: none;
}
.ostadi-home-tools-grid > a:hover {
  transform: none;
  background: #f8faff;
  border-color: #9db5eb;
  box-shadow: none;
}
.ostadi-home-tools-grid > a.is-new { border-inline-start: 3px solid var(--os-purple); }
.ostadi-home-tools-grid > a.is-new small { color: var(--os-muted); }
.ostadi-home-tools-grid > a.is-new i { color: var(--os-purple-dark); background: var(--os-purple-soft); }
.ostadi-home-tool-icon {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  color: var(--os-green-dark);
  background: var(--os-green-soft);
  border-radius: 9px;
  font-size: 20px;
}
.ostadi-home-tools-grid > a.is-new .ostadi-home-tool-icon { color: var(--os-purple-dark); background: var(--os-purple-soft); }

/* Page sections use hierarchy and separators instead of repeated oversized cards. */
.ostadi-section { padding: 76px 0; }
.ostadi-section-heading { max-width: 680px; margin-bottom: 34px; }
.ostadi-section-heading h2,
.ostadi-how-copy h2,
.ostadi-privacy-panel h2,
.ostadi-final-panel h2 { font-size: clamp(28px, 3vw, 38px); letter-spacing: -.02em; }
.ostadi-platform-hubs { padding-top: 70px; background: #f7f9fc; }
.ostadi-hub-grid { gap: 16px; }
.ostadi-hub-card,
.ostadi-hub-lesson,
.ostadi-hub-docs,
.ostadi-hub-ai {
  grid-template-columns: 58px 1fr;
  min-height: 0;
  padding: 28px;
  color: var(--os-ink);
  background: #fff;
  border: 1px solid var(--os-line);
  border-radius: 14px;
  box-shadow: none;
}
.ostadi-hub-lesson { border-top: 3px solid var(--os-green); }
.ostadi-hub-ai { border-top: 3px solid var(--os-purple); }
.ostadi-hub-docs { border-top: 3px solid #7b8ca6; }
.ostadi-hub-notes { border-top: 3px solid #2563eb; }
.ostadi-hub-card::after { display: none; }
.ostadi-hub-icon,
.ostadi-hub-ai .ostadi-hub-icon {
  width: 54px;
  height: 54px;
  color: var(--os-green-dark);
  background: var(--os-green-soft);
  border: 0;
  border-radius: 10px;
  box-shadow: none;
  font-size: 27px;
}
.ostadi-hub-ai .ostadi-hub-icon { color: var(--os-purple-dark); background: var(--os-purple-soft); }
.ostadi-hub-badge,
.ostadi-hub-ai .ostadi-hub-badge { color: var(--os-purple-dark); background: var(--os-purple-soft); border-radius: 6px; }
.ostadi-hub-card h3 { margin: 8px 0 5px; font-size: clamp(23px, 2.3vw, 31px); }
.ostadi-hub-card p,
.ostadi-hub-ai p { color: var(--os-muted); }
.ostadi-hub-card ul { margin: 14px 0 18px; }
.ostadi-hub-card li,
.ostadi-hub-ai li { color: #42526c; background: #f1f4f8; border-radius: 6px; }
.ostadi-hub-ai .ostadi-button-light { color: #fff; background: var(--os-purple); }
.ostadi-hub-ai .ostadi-button-light:hover { background: var(--os-purple-dark); }
.ostadi-feature-grid { gap: 0; border-block: 1px solid var(--os-line); }
.ostadi-feature-grid article {
  padding: 28px;
  border: 0;
  border-inline-start: 1px solid var(--os-line);
  border-radius: 0;
}
.ostadi-feature-grid article:first-child { border-inline-start: 0; }
.ostadi-feature-grid article:hover { transform: none; box-shadow: none; background: #fafbfd; }
.ostadi-feature-icon { width: 42px; height: 42px; margin-bottom: 17px; border-radius: 8px; font-size: 20px; }
.ostadi-how { background: #f7f9fc; }
.ostadi-how-grid { gap: 70px; }
.ostadi-steps li { padding-block: 19px; border-color: var(--os-line); }
.ostadi-steps b { border-color: var(--os-line); border-radius: 8px; }
.ostadi-privacy { padding-block: 64px; }
.ostadi-privacy-panel {
  grid-template-columns: 58px 1fr auto;
  gap: 24px;
  padding: 30px;
  color: var(--os-ink);
  background: #eef4ff;
  border: 1px solid #cddbf5;
  border-radius: 14px;
  box-shadow: none;
}
.ostadi-privacy-icon { width: 52px; height: 52px; color: var(--os-green-dark); background: #fff; border-color: #cddbf5; border-radius: 9px; font-size: 27px; }
.ostadi-privacy-panel span { color: var(--os-green-dark); }
.ostadi-privacy-panel h2 { font-size: 27px; }
.ostadi-privacy-panel p,
.ostadi-privacy-panel ul { color: #50617a; }
.ostadi-privacy-panel li::before { color: var(--os-green); }
.ostadi-final-cta { padding: 16px 0 76px; }
.ostadi-final-panel {
  padding: 38px;
  background: #173b82;
  border-radius: 14px;
}
.ostadi-final-panel::after { display: none; }
.ostadi-final-panel h2 { font-size: clamp(27px, 3.2vw, 38px); }

/* Footer. */
.ostadi-site-footer { background: #101a2d; }
.ostadi-footer-grid { padding-block: 42px 32px; }
.ostadi-footer-grid > div > p { color: #aab6c8; }
.ostadi-footer-bottom { color: #92a0b5; }
.ostadi-footer-brand .ostadi-brand-mark { border-radius: 8px; box-shadow: none; }

/* WordPress pages and articles. */
.ostadi-page-main { padding: 34px 0 64px; background: #f7f9fc; }
.ostadi-page-container { width: min(1280px, calc(100% - 32px)); }
.ostadi-page-card {
  padding: clamp(18px, 2.5vw, 32px);
  border-radius: 14px;
  box-shadow: none;
}
.ostadi-results-page-card { min-width: 0; }
.ostadi-page-header { margin-bottom: 22px; }
.ostadi-page-header h1 { font-size: clamp(27px, 3vw, 38px); }
.ostadi-content-card,
.ostadi-not-found { border-radius: 12px; box-shadow: none; }
.ostadi-entry-content,
.ostadi-entry-content > * { min-width: 0; }

/* Shared treatment for tools supplied by the companion plugins. */
:where(.orc-app, .orc-doc-library, .orc-ai-app, .orc-lesson-app, .orc-wallet, .orc-account-page, .esn-app) {
  --orc-green: #2457d6;
  --orc-green-dark: #1946b8;
  --orc-purple: #7153c6;
  --orc-purple-dark: #5c3eb0;
  --orc-ink: #17233b;
  --orc-muted: #667085;
  --orc-line: #dce3ed;
  --orc-soft: #f7f9fc;
  min-width: 0;
}
:where(.orc-panel, .orc-ai-panel, .orc-lesson-step, .orc-wallet-card, .orc-account-form, .orc-account-summary, .orc-account-login) {
  border-color: var(--os-line) !important;
  border-radius: 12px !important;
  box-shadow: none !important;
}
:where(.orc-btn, .orc-file-button, .orc-ai-app button, .orc-lesson-app button, .esn-app button) {
  border-radius: 8px !important;
  box-shadow: none !important;
}
:where(.orc-btn-primary, .orc-btn-register, .orc-lesson-generate) {
  color: #fff !important;
  background: var(--os-green) !important;
  border-color: var(--os-green) !important;
}
:where(.orc-btn-primary, .orc-btn-register, .orc-lesson-generate):hover {
  background: var(--os-green-dark) !important;
  border-color: var(--os-green-dark) !important;
  transform: none !important;
}
:where(.orc-app, .orc-ai-app, .orc-lesson-app, .orc-account-page, .esn-app) :where(input, select, textarea) {
  min-height: 44px;
  border-color: #cbd5e1;
  border-radius: 8px !important;
  box-shadow: none;
}
:where(.orc-app, .orc-ai-app, .orc-lesson-app, .orc-account-page, .esn-app) :where(input, select, textarea):focus {
  border-color: var(--os-green) !important;
  box-shadow: var(--os-focus) !important;
}

/* Results calculator. */
.orc-app { max-width: 1260px; margin-inline: auto; }
.orc-header { margin-bottom: 18px; padding: 4px 0 18px; border-bottom: 1px solid var(--os-line); }
.orc-header h1 { font-size: clamp(27px, 3.2vw, 39px); }
.orc-platform-links {
  display: flex;
  gap: 8px;
  max-width: 100%;
  margin: 0 0 18px;
  padding: 0 0 4px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  background: transparent;
  border: 0;
}
.orc-platform-link,
.orc-app .orc-platform-link {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  flex: 1 0 185px;
  column-gap: 8px;
  min-width: 0;
  min-height: 58px;
  padding: 8px 10px;
  color: var(--os-ink);
  background: #fff;
  border: 1px solid var(--os-line);
  border-radius: 9px;
  box-shadow: none;
  text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
.orc-platform-link > span,
.orc-app .orc-platform-link > span {
  display: grid;
  grid-row: 1 / 3;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--os-green-dark);
  background: var(--os-green-soft);
  border-radius: 7px;
  font-size: 17px;
  font-weight: 900;
}
.orc-platform-link strong { overflow: hidden; font-size: 13px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.orc-platform-link small { color: var(--os-muted); font-size: 8px; font-weight: 800; line-height: 1.25; }
.orc-platform-link:hover,
.orc-app .orc-platform-link:hover { color: var(--os-ink); transform: none; background: #f8faff; border-color: #9db5eb; box-shadow: none; }
.orc-platform-link.is-current,
.orc-app .orc-platform-link.is-current { color: #fff; background: var(--os-green); border-color: var(--os-green); }
.orc-platform-link.is-current:hover,
.orc-app .orc-platform-link.is-current:hover { color: #fff; background: var(--os-green-dark); border-color: var(--os-green-dark); }
.orc-platform-link.is-current > span,
.orc-app .orc-platform-link.is-current > span { color: #fff; background: rgba(255, 255, 255, .14); }
.orc-platform-link.is-current small,
.orc-app .orc-platform-link.is-current small { color: rgba(255, 255, 255, .78); }
.orc-top-import-actions {
  padding: 16px;
  background: #f8faff;
  border: 1px solid #9db5eb;
  border-inline-start: 4px solid var(--os-green);
  border-radius: 10px;
  box-shadow: none;
}
.orc-top-import-actions.is-guided { outline: 0; animation: none; }
.orc-import-arrow { animation: none !important; }
.orc-panel { background: #fff; }
.orc-fields-grid { gap: 12px; }
.orc-stats { gap: 9px; }
.orc-stat { padding: 15px; border-radius: 10px; }
.orc-stat::after { display: none; }
.orc-stat-mastery { background: #f7f5fd; }
.orc-table-wrap { max-width: 100%; overscroll-behavior-inline: contain; }
.orc-settings details > summary { padding: 17px 19px; }
.orc-toast { border-radius: 8px; box-shadow: 0 8px 22px rgba(0, 0, 0, .16); }

/* Resource library: compact scan-friendly cards. */
.orc-document-container { max-width: 1180px; padding: 0; }
.orc-portal-hero,
.orc-library-v2 .orc-portal-hero,
.orc-lesson-hero,
.orc-account-hero {
  margin-bottom: 22px;
  padding: 26px 28px;
  color: var(--os-ink);
  background: #fff;
  border: 1px solid var(--os-line);
  border-inline-start: 4px solid var(--os-green);
  border-radius: 12px;
  box-shadow: none;
}
.orc-portal-hero span,
.orc-portal-hero p,
.orc-account-hero span,
.orc-account-hero p { color: var(--os-muted); }
.orc-portal-hero h1,
.orc-account-hero h1 { color: var(--os-ink); font-size: clamp(27px, 3.2vw, 38px); }
.orc-portal-icon,
.orc-lesson-hero-icon {
  width: 58px;
  height: 58px;
  flex-basis: 58px;
  color: var(--os-green-dark);
  background: var(--os-green-soft);
  border: 0;
  border-radius: 10px;
  box-shadow: none;
  font-size: 29px;
}
.orc-doc-search { margin: 16px 0 12px; padding: 8px; border-radius: 10px; }
.orc-doc-tabs,
.orc-library-chips { gap: 6px; padding: 0; background: transparent; border-radius: 0; }
.orc-doc-tabs button,
.orc-library-chips a { min-height: 38px; border: 1px solid var(--os-line); border-radius: 7px; background: #fff; }
.orc-doc-tabs button.is-active,
.orc-library-chips a[aria-current] { color: #fff; background: var(--os-green); border-color: var(--os-green); box-shadow: none; }
.orc-doc-grid,
.orc-library-v2 .orc-doc-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.orc-doc-card,
.orc-library-v2 .orc-doc-card {
  border-radius: 11px;
  box-shadow: none;
  transition: background-color .15s, border-color .15s;
}
.orc-doc-card:hover,
.orc-library-v2 .orc-doc-card:hover { transform: none; background: #fbfcfe; border-color: #aebed4; box-shadow: none; }
.orc-doc-cover,
.orc-library-v2 .orc-doc-cover { height: 145px; background: #f0f4fa; }
.orc-doc-placeholder { background: #eef3fb; }
.orc-doc-placeholder span {
  width: 58px;
  height: 64px;
  color: var(--os-green-dark);
  background: #fff;
  border: 1px solid #cbd8ec;
  border-radius: 7px;
  box-shadow: none;
}
.orc-doc-card-body,
.orc-library-v2 .orc-doc-card-body { padding: 15px; }
.orc-doc-category { color: var(--os-purple-dark); background: var(--os-purple-soft); border-radius: 5px; }
.orc-doc-card .orc-doc-download,
.orc-library-v2 .orc-doc-card .orc-doc-download {
  color: #fff !important;
  background: var(--os-green) !important;
  border-color: var(--os-green) !important;
  border-radius: 7px;
  box-shadow: none;
}
.orc-portal-empty { padding: 46px 20px; border-radius: 11px; }

/* Premium analysis and onboarding. */
.orc-ai-onboarding,
.orc-ai-gate {
  padding: 22px;
  background: #fff;
  border: 1px solid var(--os-line);
  border-inline-start: 4px solid var(--os-purple);
  border-radius: 12px;
  box-shadow: none;
}
.orc-ai-onboarding-steps li,
.orc-ai-options label { background: #f8fafc; border-radius: 8px; }
.orc-ai-onboarding-steps li > span,
.orc-ai-onboarding-icon {
  color: var(--os-purple-dark);
  background: var(--os-purple-soft);
  border-radius: 8px;
  box-shadow: none;
  animation: none;
}
.orc-ai-onboarding-actions .orc-btn-register { background: var(--os-purple) !important; border-color: var(--os-purple) !important; text-shadow: none; }
.orc-ai-layout { gap: 14px; }
.orc-ai-panel { padding: 20px; }
.orc-ai-source { background: #f1f6ff; border-radius: 8px; }
.orc-ai-editor { border-radius: 9px; }
.orc-ai-editor .orc-ai-chart i { background: var(--os-green); box-shadow: none; }

/* Mind-map/lesson tool. */
.orc-lesson-app { min-width: 0; }
.orc-lesson-step { padding: 20px; }
.orc-lesson-drop {
  min-height: 165px;
  background: #f8faff;
  border-color: #9db5eb;
  border-radius: 10px;
}
.orc-lesson-drop:hover,
.orc-lesson-drop.is-dragging { transform: none; }
.orc-lesson-drop > span { color: var(--os-green-dark); background: #fff; border: 1px solid #cbd8ec; border-radius: 9px; box-shadow: none; }
.orc-lesson-result { background: #f3f6fa; border-radius: 12px; }
.orc-lesson-editor,
.orc-editor-section,
.orc-map-branch { border-radius: 9px; box-shadow: none; }
.orc-lesson-preview-wrap { background: #e9eef5; border-radius: 10px; }
.orc-map-center { background: var(--os-green); border-radius: 14px; box-shadow: none; }

/* Dark mode keeps the same restrained hierarchy. */
[data-ostadi-theme="dark"] {
  --os-ink: #edf3fb;
  --os-muted: #a3b1c4;
  --os-green: #6ea2ff;
  --os-green-dark: #92b8ff;
  --os-green-soft: #172c4c;
  --os-purple: #b49aef;
  --os-purple-dark: #c9b7f3;
  --os-purple-soft: #2a2141;
  --os-cream: #101a2a;
  --os-line: #2b3a51;
  --os-card: #111b2b;
}
[data-ostadi-theme="dark"] body { background: #0b1320; }
[data-ostadi-theme="dark"] .ostadi-site-header { background: rgba(11, 19, 32, .96); }
[data-ostadi-theme="dark"] .ostadi-brand .custom-logo-link,
[data-ostadi-theme="dark"] .ostadi-bundled-logo { background: #fff; box-shadow: none; }
[data-ostadi-theme="dark"] .ostadi-hero,
[data-ostadi-theme="dark"] .ostadi-platform-hubs,
[data-ostadi-theme="dark"] .ostadi-how,
[data-ostadi-theme="dark"] .ostadi-page-main { background: #0e1828; }
[data-ostadi-theme="dark"] .ostadi-home-tools { background: #0b1320; }
[data-ostadi-theme="dark"] :where(.ostadi-preview-card, .ostadi-home-tools-grid > a, .ostadi-hub-card, .ostadi-feature-grid article, .ostadi-page-card, .ostadi-content-card, .orc-portal-hero, .orc-lesson-hero, .orc-account-hero) {
  color: var(--os-ink);
  background: #111b2b;
  border-color: var(--os-line);
}
[data-ostadi-theme="dark"] .ostadi-home-tools-grid > a.is-new { color: var(--os-ink); background: #111b2b; }
[data-ostadi-theme="dark"] .ostadi-home-tools-grid > a.is-new small,
[data-ostadi-theme="dark"] .ostadi-hub-card p,
[data-ostadi-theme="dark"] .ostadi-hub-ai p { color: var(--os-muted); }
[data-ostadi-theme="dark"] .ostadi-hub-card li,
[data-ostadi-theme="dark"] .ostadi-hub-ai li { color: #c7d3e4; background: #1a293e; }
[data-ostadi-theme="dark"] .ostadi-privacy-panel { color: var(--os-ink); background: #132a4a; border-color: #2b4b76; }
[data-ostadi-theme="dark"] .ostadi-privacy-panel p,
[data-ostadi-theme="dark"] .ostadi-privacy-panel ul { color: #bac7d8; }
[data-ostadi-theme="dark"] :where(.orc-ai-onboarding, .orc-ai-gate, .orc-doc-card, .orc-library-v2 .orc-doc-card, .orc-ai-panel, .orc-lesson-step) {
  color: #e9f0fa;
  background: #111b2b;
  border-color: #2b3a51;
}
[data-ostadi-theme="dark"] .orc-doc-placeholder,
[data-ostadi-theme="dark"] .orc-lesson-drop,
[data-ostadi-theme="dark"] .orc-top-import-actions { background: #132239; }
[data-ostadi-theme="dark"] .orc-doc-tabs button,
[data-ostadi-theme="dark"] .orc-library-chips a { color: #dce6f5; background: #111b2b; border-color: #34465f; }
[data-ostadi-theme="dark"] .orc-platform-link { color: #e8eff9; background: #111b2b; border-color: #34465f; }
[data-ostadi-theme="dark"] .orc-platform-link small { color: #a3b1c4; }
[data-ostadi-theme="dark"] .orc-platform-link.is-current { color: #fff; background: #315fcf; border-color: #315fcf; }
[data-ostadi-theme="dark"] .orc-platform-link.is-current small { color: rgba(255, 255, 255, .78); }
[data-ostadi-theme="dark"] .orc-doc-tabs button.is-active,
[data-ostadi-theme="dark"] .orc-library-chips a[aria-current] { color: #0b1320; background: #8eb4ff; border-color: #8eb4ff; }

/* Tablet. */
@media (max-width: 1024px) {
  .ostadi-header-inner { gap: 12px; }
  .ostadi-hero-grid { grid-template-columns: 1fr 1fr; gap: 34px; }
  .ostadi-hub-grid { grid-template-columns: 1fr 1fr; }
  .ostadi-hub-lesson { grid-column: 1 / -1; }
  .ostadi-home-tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .orc-doc-grid,
  .orc-library-v2 .orc-doc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  body.ostadi-menu-open { overflow: hidden; }
  .ostadi-primary-nav {
    right: 20px;
    left: 20px;
    max-height: calc(100vh - var(--os-header-height, 73px) - var(--os-admin-offset, 0px) - 16px);
    max-height: calc(100dvh - var(--os-header-height, 73px) - var(--os-admin-offset, 0px) - 16px);
    padding: 8px;
    overflow-y: auto;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(20, 40, 80, .13);
  }
  .ostadi-tools-list { margin-inline: 0; border-radius: 8px; }
  .ostadi-hero-grid { grid-template-columns: 1fr; padding-block: 52px; }
  .ostadi-hero-copy { max-width: 720px; }
  .ostadi-hero-visual { width: min(660px, 100%); }
  .ostadi-feature-grid { grid-template-columns: repeat(3, 1fr); }
  .ostadi-how-grid { gap: 38px; }
}

/* Mobile-first finishing pass. */
@media (max-width: 700px) {
  .ostadi-container { width: min(100% - 28px, 1180px); }
  .ostadi-header-inner { min-height: 64px; gap: 8px; }
  .ostadi-bundled-logo img,
  .custom-logo { width: auto; max-width: 124px; height: 44px; }
  .ostadi-theme-toggle,
  .ostadi-menu-toggle { width: 40px; height: 40px; }
  .ostadi-account-actions .ostadi-header-login,
  .ostadi-account-actions .ostadi-header-wallet { min-height: 38px; padding: 7px 10px; font-size: 12px; }
  .ostadi-primary-nav { right: 14px; left: 14px; width: auto; }
  .ostadi-hero-grid { gap: 34px; padding-block: 38px 42px; }
  .ostadi-hero-copy h1 { font-size: clamp(32px, 10.5vw, 40px); }
  .ostadi-hero-copy > p { font-size: 15px; }
  .ostadi-hero-actions { display: grid; }
  .ostadi-trust-list { grid-template-columns: 1fr; }
  .ostadi-preview-card { padding: 13px; border-radius: 12px; }
  .ostadi-preview-top strong { font-size: 16px; }
  .ostadi-preview-stats { gap: 6px; }
  .ostadi-preview-stats strong { font-size: 16px; }
  .ostadi-home-tools { padding: 23px 0; }
  .ostadi-home-tools-head { gap: 4px; }
  .ostadi-home-tools-grid { grid-template-columns: 1fr; }
  .ostadi-home-tools-grid > a.is-new { order: 0; }
  .ostadi-section { padding-block: 54px; }
  .ostadi-section-heading { margin-bottom: 25px; text-align: start; }
  .ostadi-hub-grid { grid-template-columns: 1fr; }
  .ostadi-hub-lesson { grid-column: auto; }
  .ostadi-hub-card,
  .ostadi-hub-lesson,
  .ostadi-hub-docs,
  .ostadi-hub-ai { grid-template-columns: 46px 1fr; gap: 14px; padding: 20px; }
  .ostadi-hub-icon,
  .ostadi-hub-ai .ostadi-hub-icon { width: 44px; height: 44px; font-size: 22px; }
  .ostadi-hub-card h3 { font-size: 22px; }
  .ostadi-hub-card .ostadi-button { width: 100%; }
  .ostadi-feature-grid { grid-template-columns: 1fr; border-bottom: 0; }
  .ostadi-feature-grid article { padding: 23px 4px; border-inline-start: 0; border-bottom: 1px solid var(--os-line); }
  .ostadi-how-grid { gap: 24px; }
  .ostadi-privacy-panel { grid-template-columns: 44px 1fr; gap: 14px; padding: 20px; }
  .ostadi-privacy-icon { width: 42px; height: 42px; font-size: 22px; }
  .ostadi-privacy-panel ul { grid-column: 1 / -1; }
  .ostadi-final-panel { align-items: stretch; padding: 25px 20px; }
  .ostadi-final-panel .ostadi-button { width: 100%; }
  .ostadi-page-main { padding: 18px 0 48px; }
  .ostadi-page-container { width: min(100% - 16px, 1280px); }
  .ostadi-page-card { padding: 12px; border-radius: 11px; }
  .ostadi-results-page-card { padding: 0; }

  .orc-header { align-items: flex-start; }
  .orc-header h1 { font-size: 27px; }
  .orc-platform-links { gap: 7px; margin-bottom: 14px; }
  .orc-platform-link,
  .orc-app .orc-platform-link { grid-template-columns: 32px minmax(0, 1fr); flex-basis: 148px; min-height: 54px; padding: 7px 8px; column-gap: 7px; border-radius: 8px; }
  .orc-platform-link > span,
  .orc-app .orc-platform-link > span { width: 32px; height: 32px; border-radius: 7px; font-size: 16px; }
  .orc-platform-link strong { font-size: 11px; }
  .orc-platform-link small { font-size: 7px; }
  .orc-top-import-actions { padding: 13px; }
  .orc-top-import-actions :where(.orc-btn, .orc-file-button) { width: 100%; }
  .orc-panel,
  .orc-ai-panel,
  .orc-lesson-step { padding: 15px !important; }
  .orc-stats { grid-template-columns: 1fr 1fr; }
  .orc-stat { padding: 12px; }
  .orc-table-wrap { margin-inline: -4px; padding-inline: 4px; }
  .orc-table-wrap table { min-width: 680px; }

  .orc-portal-hero,
  .orc-library-v2 .orc-portal-hero,
  .orc-lesson-hero,
  .orc-account-hero { align-items: flex-start; padding: 18px; border-radius: 10px; }
  .orc-portal-hero h1,
  .orc-account-hero h1 { font-size: 27px; }
  .orc-portal-icon,
  .orc-lesson-hero-icon { width: 48px; height: 48px; flex-basis: 48px; font-size: 24px; }
  .orc-doc-search { align-items: stretch; flex-direction: column; }
  .orc-doc-tabs { display: flex; flex-wrap: nowrap; padding-bottom: 4px; overflow-x: auto; }
  .orc-doc-tabs button { flex: 0 0 auto; }
  .orc-doc-grid,
  .orc-library-v2 .orc-doc-grid { grid-template-columns: 1fr; }
  .orc-doc-card,
  .orc-library-v2 .orc-doc-card { display: grid; grid-template-columns: 92px minmax(0, 1fr); }
  .orc-doc-cover,
  .orc-library-v2 .orc-doc-cover { width: 92px; height: 100%; min-height: 145px; }
  .orc-doc-card-body,
  .orc-library-v2 .orc-doc-card-body { padding: 13px; }
  .orc-doc-card h2,
  .orc-library-v2 .orc-doc-card h2 { margin-block: 7px 4px; font-size: 15px; }
  .orc-doc-card p,
  .orc-library-v2 .orc-doc-card p { margin-bottom: 9px; font-size: 11px; }
  .orc-doc-card-actions { gap: 7px; margin-top: 10px; padding-top: 9px; }
  .orc-ai-onboarding,
  .orc-ai-gate { padding: 17px; }
  .orc-ai-onboarding-steps { grid-template-columns: 1fr; }
  .orc-ai-layout { grid-template-columns: 1fr; }
  .orc-ai-editor { min-height: 380px; padding: 15px; overflow-x: auto; }
  .orc-ai-editor table { min-width: 580px; }
  .orc-lesson-result { padding: 8px; }
}

@media (max-width: 430px) {
  .ostadi-container { width: min(100% - 20px, 1180px); }
  .ostadi-account-actions .ostadi-header-login,
  .ostadi-account-actions .ostadi-header-wallet { padding-inline: 8px; font-size: 11px; }
  .ostadi-bundled-logo img,
  .custom-logo { max-width: 106px; height: 40px; }
  .ostadi-theme-toggle { width: 38px; height: 38px; }
  .ostadi-menu-toggle { width: 38px; height: 38px; }
  .ostadi-hero-actions .ostadi-button { width: 100%; }
  .ostadi-preview-row { grid-template-columns: minmax(0, 1.3fr) .55fr .8fr; }
  .ostadi-preview-row > span:first-child { min-width: 0; }
  .ostadi-preview-row > span:first-child i { display: none; }
  .orc-stats { grid-template-columns: 1fr 1fr; }
  .orc-stat:first-child { grid-column: 1 / -1; }
  .orc-doc-card,
  .orc-library-v2 .orc-doc-card { grid-template-columns: 76px minmax(0, 1fr); }
  .orc-doc-cover,
  .orc-library-v2 .orc-doc-cover { width: 76px; min-height: 150px; }
}

@media (max-width: 350px) {
  .ostadi-account-actions .ostadi-header-login,
  .ostadi-account-actions .ostadi-header-wallet { max-width: 75px; overflow: hidden; text-overflow: ellipsis; }
  .ostadi-bundled-logo img,
  .custom-logo { max-width: 94px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* Comfortable touch targets without enlarging the fixed header. */
@media (max-width:700px) {
  .ostadi-menu-toggle,.ostadi-theme-toggle { width:44px;height:44px;flex-shrink:0; }
  .ostadi-account-actions .ostadi-header-login,
  .ostadi-account-actions .ostadi-header-wallet { min-height:44px; }
}

/* Categorized tool navigation, shared by desktop and mobile. */
.ostadi-tools-list .ostadi-tools-category{display:block;padding:6px 0;border-top:1px solid var(--border-color,#dbe3ef)}
.ostadi-tools-category>strong{display:block;padding:8px 14px;color:var(--text-muted,#64748b);font-size:.85rem}
.ostadi-tools-category>ul{list-style:none;margin:0;padding:0;display:block;position:static;box-shadow:none;background:transparent}

.ostadi-tools-category>strong>a{padding:0;min-height:0;color:inherit;font:inherit}
