@font-face { font-family: "Vazirmatn"; src: url("fonts/Vazirmatn-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("fonts/Vazirmatn-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --ink: #0c0d12; --ink2: #4d4a49; --ink3: #77716d; --line: #e7e0da; --paper: #f6f1ed; --card: #fffcf9;
  --brand: #b9360e; --brand-deep: #0c0d12; --teal: #b9360e; --gold: #fe5722;
  --good: #0e9f6e; --good-bg: #e7f7f0; --bad: #c0392b; --bad-bg: #fdecea; --warn-bg: #fff6e0;
  --radius: 14px;
  --paper: oklch(0.974 0.006 55); --card: oklch(0.995 0.003 55);
}
* { box-sizing: border-box; }
html { font-family: "Vazirmatn", system-ui, sans-serif; color: var(--ink); background: var(--paper); }
body { margin: 0; line-height: 1.55; font-size: 15px; }
a { color: var(--brand); text-decoration: none; }
h1 { font-size: 24px; margin: 8px 0 18px; }
h2 { font-size: 17px; margin: 0 0 14px; }
.muted { color: var(--ink3); margin: 0; }
.small { font-size: 13px; }
.link { font-weight: 700; }
.eyebrow { color: var(--brand); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 3px; }

.bar { position: sticky; top: 0; z-index: 5; display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
  padding: 12px 22px; background: var(--brand-deep); color: #f6f2ee; }
.brand { color: #f6f2ee; font-weight: 700; display: flex; gap: 10px; align-items: center; }
.mark, .login-mark { display: inline-block; width: 32px; height: 32px; object-fit: contain; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-link { color: #c9c1bb; padding: 6px 12px; border-radius: 8px; font-weight: 700; font-size: 14px; }
.nav-link.is-on, .nav-link:hover { background: rgba(254,87,34,.16); color: #ffb497; }
.bar-end { margin-inline-start: auto; display: flex; gap: 10px; align-items: center; }
.langs { display: flex; gap: 2px; }
.langs-center { justify-content: center; margin-top: 18px; }
.lang { color: inherit; opacity: .65; padding: 4px 8px; border-radius: 8px; font-size: 13px; }
.lang.is-on { opacity: 1; background: rgba(127,127,127,.18); }

/* One workspace frame for admin, teacher and student pages. */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 256px minmax(0, 1fr); }
.sidebar { height: 100vh; position: sticky; top: 0; align-self: start; overflow-y: auto; display: flex; flex-direction: column; padding: 27px 15px 16px; background: #141419; color: #f8f4f0; }
.side-brand { color: #f8f4f0; display: flex; align-items: center; gap: 12px; padding: 0 11px 29px; font: 800 19px/1.1 system-ui, sans-serif; letter-spacing: .09em; }
.side-brand:hover { color: #f8f4f0; }
.side-brand .mark { width: 40px; height: 40px; }
.side-brand span { display: grid; gap: 4px; }
.side-brand small { font-size: 9px; letter-spacing: .26em; color: #aaa6a4; }
.side-label { margin: 0 13px 9px; color: #969397; font-size: 11px; font-weight: 700; }
.side-group-secondary { border-top: 1px solid #2a2a30; padding-top: 23px; margin-top: 22px; }
.side-nav { display: grid; gap: 3px; }
.side-nav .nav-link { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 10px 13px; color: #c8c6c7; border-radius: 10px; font-weight: 600; line-height: 1.3; transition: background-color 180ms ease-out, color 180ms ease-out; }
.side-nav .nav-link:hover { color: #f8f4f0; background: #29292e; }
.side-nav .nav-link.is-on { color: #ffb99d; background: #34231e; }
.side-icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.side-nav .nav-link.is-on .side-icon { color: #fe5722; opacity: 1; }
.side-bottom { margin-top: auto; padding-top: 26px; }
.side-bottom > .side-nav { padding-bottom: 15px; }
.side-account { border-top: 1px solid #2a2a30; padding: 17px 9px 10px; display: flex; align-items: center; gap: 11px; min-width: 0; }
.account-avatar { width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; background: #513124; color: #ffb99d; font-weight: 800; }
.account-details { display: grid; min-width: 0; line-height: 1.35; }
.account-details strong, .account-details small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-details strong { font-size: 13px; color: #f8f4f0; }
.account-details small { font-size: 11px; color: #aaa6a4; }
.side-logout { border: 0; background: transparent; color: #aaa6a4; padding: 7px 9px; font: inherit; font-size: 12px; cursor: pointer; }
.side-logout:hover { color: #f8f4f0; }
.workspace { min-width: 0; }
.workspace-top { height: 66px; display: flex; align-items: center; gap: 18px; padding: 0 clamp(24px, 3.5vw, 52px); border-bottom: 1px solid var(--line); background: #fffcf9; }
.workspace-name { color: var(--ink3); font-size: 13px; font-weight: 600; }
.workspace-name span { color: #bfb4ac; margin: 0 8px; }
.workspace-top .bar-end { margin-inline-start: auto; }
.workspace-top .langs { padding: 3px; background: #f2ece7; border-radius: 9px; }
.workspace-top .lang { color: var(--ink2); opacity: 1; }
.workspace-top .lang.is-on { color: var(--ink); background: #fff; box-shadow: 0 1px 4px #21130d17; }
.mobile-nav { display: none; }
.mobile-logout { display: none; }
.app-shell .page { max-width: 1320px; margin: 0 auto; padding: 38px clamp(24px, 3.5vw, 52px) 72px; }

.page { max-width: 1000px; margin: 0 auto; padding: 30px 18px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.narrow { max-width: 480px; }
.page-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.page-head h1 { margin-bottom: 4px; }
.actions { display: flex; gap: 8px; }

.btn { font: inherit; font-weight: 700; font-size: 14px; border: 1px solid transparent; border-radius: 10px; padding: 9px 16px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; padding: 12px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: #922d0d; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-ghost { background: #fff; color: var(--ink2); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink3); }
.btn-wa { background: #25d366; color: #0b3d1f; }

.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink2); font-weight: 700; }
input, select { font: inherit; font-size: 15px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); min-width: 0; }
textarea { font: inherit; font-size: 15px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); width: 100%; resize: vertical; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-color: var(--brand); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.inline { display: inline; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters input { flex: 1 1 240px; }

.alert { border-radius: 12px; padding: 12px 14px; margin: 0 0 16px; font-weight: 700; }
.alert-good { background: var(--good-bg); color: var(--good); }
.alert-bad { background: var(--bad-bg); color: var(--bad); }
.alert-warn { background: var(--warn-bg); color: #8a5a00; }

.course-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.course { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.course-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.course-title { font-weight: 700; font-size: 18px; color: var(--ink); }
.pill { background: #ffe9df; color: var(--brand); border-radius: 999px; padding: 3px 10px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.stats div { padding: 2px 0; }
.stats dt { font-size: 12px; color: var(--ink3); }
.stats dd { margin: 0; font-size: 20px; font-weight: 700; }
.make { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.field-count { width: 82px; }
.field-grow { flex: 1 1 160px; }
.payment-check { flex: 1 0 100%; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink2); cursor: pointer; }
.payment-check input { width: 18px; height: 18px; padding: 0; margin: 0; accent-color: var(--brand); flex: 0 0 18px; }
.course .make { padding-top: 10px; border-top: 1px solid var(--line); }
.course .link { font-size: 13px; }

.fresh { border-color: var(--gold); background: #fff6f1; }
.code-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.code-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px; background: var(--paper); border-radius: 12px; }
.code-create { display: grid; grid-template-columns: minmax(170px, .8fr) minmax(0, 2fr); gap: 24px; align-items: start; }
.code-create h2 { margin-bottom: 4px; }
.code-create-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }
.code-create-form .payment-check { grid-column: 1 / -1; }
.code-create-form .btn { justify-self: start; }
.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 22px; font-weight: 700; letter-spacing: 2px; margin-inline-end: auto; }
.code-sm { font-size: 15px; letter-spacing: 1px; }

.table-wrap { overflow-x: auto; }
.table-panel { padding: 0; overflow: hidden; }
.list-filters { margin: 22px 0 14px; }
.list-filters select { min-width: 155px; }
.course-table th, .course-table td { padding: 16px 20px; }
.course-table tbody tr:hover { background: #fff8f3; }
.table-title { display: block; font-weight: 700; font-size: 15px; color: var(--ink); }
.table-title:hover { color: var(--brand); }
.course-table td small { display: block; margin-top: 2px; }
.empty-row { padding: 30px; text-align: center; color: var(--ink3); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: start; color: var(--ink3); font-size: 12px; font-weight: 700; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.end { text-align: end; white-space: nowrap; }
tr.is-off td { color: var(--ink3); }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #eef1f5; color: var(--ink2); }
.tag-good { background: var(--good-bg); color: var(--good); }
.tag-bad { background: var(--bad-bg); color: var(--bad); }

.student-head { display: flex; justify-content: space-between; margin-bottom: 10px; }
.owned { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
.owned li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 10px; background: var(--paper); border-radius: 10px; }
.owned li > span:first-child { margin-inline-end: auto; font-weight: 700; }
.permission-grid { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.permission-grid legend { padding: 0 6px; font-size: 13px; font-weight: 700; color: var(--ink2); }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.check input { accent-color: var(--brand); width: 18px; height: 18px; }
.role-members { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 18px; }
.role-members h3 { font-size: 14px; margin: 0 0 10px; }
.member { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.member span { display: grid; }
.member small { color: var(--ink3); }
.role-members .make { margin-top: 16px; }
.portal-hero { background: linear-gradient(90deg, rgba(12,13,18,.96) 0%, rgba(12,13,18,.78) 48%, rgba(12,13,18,.2) 100%), url('/portal/sama-learning-hero.png') center / cover; color: #fff; border-radius: 22px; min-height: 210px; padding: 30px 34px; margin-bottom: 30px; display: flex; justify-content: space-between; align-items: center; gap: 24px; overflow: hidden; }
[dir="rtl"] .portal-hero { background-image: linear-gradient(270deg, rgba(12,13,18,.96) 0%, rgba(12,13,18,.78) 48%, rgba(12,13,18,.2) 100%), url('/portal/sama-learning-hero.png'); }
.portal-hero > div { max-width: 680px; position: relative; z-index: 1; }
.portal-hero .eyebrow { color: #ff9671; }
.portal-hero h1 { font-size: clamp(26px, 4vw, 36px); line-height: 1.2; margin: 0 0 9px; }
.portal-hero p:last-child { color: #ddd7d2; margin: 0; }
.portal-hero img { width: 106px; height: 106px; object-fit: contain; opacity: .85; flex: none; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 22px 0 13px; }
.section-head h2 { font-size: 22px; margin: 0; }
.portal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 15px; margin-bottom: 22px; }
.course-tile { background: var(--card); border: 1px solid var(--line); border-radius: 17px; overflow: hidden; display: flex; flex-direction: column; }
.course-tile > img { width: 100%; height: 138px; object-fit: cover; background: linear-gradient(130deg, #0c0d12, #79311b); }
.tile-body { padding: 15px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; flex: 1; }
.tile-body h3 { font-size: 17px; line-height: 1.35; margin: 2px 0 0; }
.tile-body .btn { margin-top: auto; }
.tile-link { color: var(--brand); font-weight: 800; text-decoration: none; margin-top: 4px; display: inline-flex; gap: 8px; align-items: center; }
.tile-link:hover { text-decoration: underline; }
.course-detail { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; align-items: start; }
.course-cover { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 16px; background: var(--ink); }
.course-section-title { margin: 24px 0 8px; font-size: 17px; }
.outline-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.outline-row strong { display: block; }
.outline-row small { color: var(--ink3); }
.phone-note { background: #fff6f0; border-color: #f7c3ad; }
.progress { width: 100%; height: 6px; border-radius: 99px; background: #e8ddd5; overflow: hidden; margin-top: auto; }
.progress span { display: block; height: 100%; background: var(--gold); border-radius: inherit; }
.redeem-panel { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; background: #fff6f0; border-color: #f7c3ad; }
.redeem-panel .make { flex: 1 1 320px; }
.empty-panel { padding: 26px; border-style: dashed; }
.empty-panel h3 { margin: 0 0 5px; }
.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: 15px; padding: 17px; display: grid; }
.metric strong { font-size: 24px; line-height: 1.2; }
.metric span { color: var(--ink3); font-size: 13px; }
.teacher-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.teacher-form .field-full { grid-column: 1 / -1; }
.teacher-form .btn { justify-self: start; }
.lesson-list { list-style: none; padding: 0; margin: 0 0 18px; }
.lesson-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding: 10px 0; }
.lesson-list li span:first-child { display: grid; }
.lesson-list small { color: var(--ink3); }
.lesson-list .lesson-admin { display: block; }
.lesson-admin-head, .lesson-admin-actions { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.lesson-admin-actions { margin-top: 10px; justify-content: flex-start; }
.lesson-admin-actions form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lesson-admin-actions .upload-status { max-width: 240px; }
.lesson-admin-actions details { flex: 1 1 100%; }
.lesson-admin-actions summary { cursor: pointer; width: max-content; }
.lesson-edit { margin-top: 12px; }
.lesson-poster-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.lesson-poster-editor form { display: flex; flex: 1 1 300px; flex-wrap: wrap; align-items: end; gap: 10px; }
.lesson-poster-editor .field { min-width: min(100%, 210px); }
.poster-copy { display: grid; flex: 1 1 180px; gap: 3px; }
.poster-copy small { line-height: 1.35; }
.lesson-poster-preview, .lesson-poster-placeholder { width: 112px; height: 72px; object-fit: cover; border-radius: 10px; flex: none; }
.lesson-poster-placeholder { display: grid; place-items: center; background: var(--ink); color: var(--gold); font-size: 21px; }
.publish-panel { display: flex; justify-content: space-between; align-items: center; gap: 20px; }

.login { min-height: 90vh; display: grid; place-items: center; }
.login-card { width: min(420px, 100%); text-align: center; padding: 30px 26px; }
.login-card .stack { text-align: start; margin-top: 20px; }
.login-mark { width: 52px; height: 52px; margin-bottom: 10px; }

@media (max-width: 640px) {
  .bar { padding: 10px 14px; }
  .bar-end { margin-inline-start: 0; width: 100%; justify-content: space-between; }
  .course-grid { grid-template-columns: 1fr; }
  .page-head { align-items: stretch; }
  .portal-hero { padding: 24px; }
  .portal-hero img { width: 64px; height: 64px; }
  .metric-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .metric { padding: 12px; }
  .metric strong { font-size: 20px; }
  .teacher-form { grid-template-columns: 1fr; }
  .teacher-form .field-full { grid-column: auto; }
  .course-detail { grid-template-columns: 1fr; }
}

@media (max-width: 850px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .workspace-top { height: auto; min-height: 64px; padding: 10px 16px; flex-wrap: wrap; position: sticky; top: 0; z-index: 10; }
  .workspace-name { font-size: 14px; }
  .mobile-nav { display: block; position: relative; }
  .mobile-nav summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 7px 11px; font-weight: 700; }
  .mobile-nav summary::-webkit-details-marker { display: none; }
  .mobile-nav summary::before { content: '☰'; font: 18px/1 system-ui, sans-serif; }
  .mobile-links { position: absolute; inset-inline-start: 0; top: calc(100% + 8px); width: min(270px, calc(100vw - 32px)); display: grid; gap: 2px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 50px #16111724; }
  .mobile-links .nav-link { min-height: 44px; display: flex; align-items: center; gap: 10px; color: var(--ink2); padding: 10px; }
  .mobile-links .nav-link.is-on { background: #fff0e8; color: var(--brand); }
  .workspace-top .bar-end { width: auto; }
  .mobile-logout { display: block; }
  .app-shell .page { padding: 24px 16px 56px; }
  .code-create { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .workspace-top .bar-end { width: 100%; justify-content: space-between; }
  .code-create-form { grid-template-columns: 1fr; }
}

/* Trainer profiles and catalog artwork share the dashboard's form vocabulary. */
.content-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr); gap: 24px; align-items: start; }
.trainer-thumb { width: 42px; height: 42px; object-fit: cover; border-radius: 50%; }
.portrait-preview { width: min(240px, 100%); aspect-ratio: 1; object-fit: cover; border-radius: 18px; margin-block: 12px 20px; }
.profile-review { margin-block: 24px; }
.profile-copy { white-space: pre-wrap; overflow-wrap: anywhere; }
.course-cover-preview { width: min(520px, 100%); aspect-ratio: 16 / 9; object-fit: cover; border-radius: 16px; margin-block-end: 18px; }
.toolbar, .row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.toolbar { justify-content: space-between; margin-block-end: 20px; }
@media (max-width: 760px) { .content-grid { grid-template-columns: 1fr; } }

.layout-sections { list-style: none; padding: 0; display: grid; gap: 14px; margin-block-start: 22px; }
.layout-section { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: var(--card); }
.layout-section-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-block-end: 14px; }
.drag-mark { font-size: 23px; color: var(--ink3); margin-inline-end: 8px; cursor: grab; }
.layout-titles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.layout-section.is-dragging { opacity: .5; }
.order-input { max-width: 88px; }
.layout-save { position: sticky; bottom: 0; background: var(--paper); border-top: 1px solid var(--line); padding-block: 16px; }
.subject-topics details { margin-block: 12px; }
.subject-topics summary { cursor: pointer; font-weight: 700; }
.subject-topics details[open] summary { margin-block-end: 18px; }
.subject-topics summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 5px; }
@media (max-width: 760px) { .layout-titles { grid-template-columns: 1fr; } }

/* A stable workspace: each language owns its content scrollbar. */
body:has(.app-shell) { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
.test-environment { flex: none; padding: 8px 20px; background: var(--brand-deep); color: #f8f4f0; text-align: center; font-size: 12px; }
.app-shell { flex: 1; min-height: 0; width: 100%; }
.sidebar { height: 100%; min-height: 0; }
.workspace { height: 100%; min-height: 0; overflow-y: auto; scrollbar-gutter: stable; }
html[dir="rtl"] .workspace { direction: rtl; }
.workspace-top { position: sticky; top: 0; z-index: 10; background: var(--card); }
.app-shell .page { padding-top: 28px; }
.page:focus { outline: none; }
.page[aria-busy="true"] { opacity: .65; transition: opacity 120ms ease-out; }
.workspace-top::after { content: ''; position: absolute; inset-inline: 0; bottom: 0; height: 2px; background: var(--gold); transform: scaleX(0); transform-origin: left; }
.workspace:has([aria-busy="true"]) .workspace-top::after { transform: scaleX(.65); transition: transform 500ms ease-out; }
.result-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 26px 0 16px; }
.result-heading h2 { margin: 0; font-size: 19px; }
.directory-search { display: grid; gap: 6px; margin: 18px 0 22px; color: var(--ink2); font-size: 13px; font-weight: 700; }
.directory-search input { width: 100%; min-height: 44px; }
.media-library { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 285px), 1fr)); gap: 24px; align-items: stretch; }
.media-course { background: var(--card); border: 1px solid var(--line); border-radius: 17px; overflow: hidden; min-width: 0; display: flex; flex-direction: column; box-shadow: 0 2px 5px #21130d05; transition: box-shadow 180ms ease-out, border-color 180ms ease-out; }
.media-course:hover { border-color: #cbbfb5; box-shadow: 0 8px 24px #21130d0b; }
.media-cover { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--ink); }
.media-cover img { width: 100%; height: 100%; display: block; object-fit: cover; }
.cover-state { position: absolute; inset-inline-start: 14px; top: 14px; border: 1px solid #fffcf94d; box-shadow: 0 2px 8px #0c0d1220; }
.media-body { padding: 18px 20px 16px; flex: 1; display: flex; flex-direction: column; }
.media-body h2 { font-size: 18px; line-height: 1.45; margin: 8px 0 13px; overflow-wrap: anywhere; }
.media-body h2 a { color: var(--ink); }
.media-description { min-height: 2.8em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 12px; }
.media-meta, .media-counts { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.media-meta { margin-top: auto; color: var(--ink2); }
.media-meta strong { color: var(--ink); white-space: nowrap; }
.media-counts { color: var(--ink3); padding-top: 8px; }
.media-body footer { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.media-body footer .link { font-size: 13px; }
.media-course[hidden], [data-search-item][hidden], [data-list-empty][hidden] { display: none !important; }
.editor-overview { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(240px, 1fr); gap: 28px; align-items: center; margin: 24px 0 30px; }
.workspace-preview { margin: 0; min-width: 0; }
.workspace-preview video, .workspace-preview > img { width: 100%; aspect-ratio: 16 / 9; display: block; object-fit: cover; border-radius: 16px; background: var(--ink); }
.workspace-preview figcaption { display: flex; align-items: center; gap: 10px; padding-top: 10px; color: var(--ink3); font-size: 12px; }
.editor-identity h2 { font-size: 26px; line-height: 1.5; margin: 8px 0 12px; }
.editor-identity .media-meta { margin: 18px 0 14px; justify-content: flex-start; }
.editor-identity .btn { margin-top: 20px; }
.lesson-visual { width: 128px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; flex: none; }
.lesson-admin-head .lesson-copy { flex: 1; display: grid; gap: 5px; min-width: 140px; }
.lesson-admin-head { justify-content: flex-start; }
.lesson-admin-head .tag { margin-inline-start: auto; }
.lesson-list .lesson-admin { padding-block: 18px; }
.lesson-admin-actions { padding-inline-start: 140px; }
.outline-image { width: 90px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; flex: none; }
.people-library { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 20px; align-items: start; }
.people-library .student { margin: 0; padding: 22px; }
.person-monogram { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: #f6e9df; color: var(--brand); font-size: 23px; font-weight: 700; flex: none; }
.student-head { flex-wrap: wrap; gap: 12px; align-items: center; }
.person-copy { flex: 1; min-width: 150px; }
.person-copy h2 { font-size: 17px; margin: 0 0 5px; }
.person-copy .small { overflow-wrap: anywhere; }
.student-head > .btn { margin-top: 4px; width: 100%; justify-content: center; }
.student-access { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.student-access summary { cursor: pointer; color: var(--brand); font-weight: 700; font-size: 13px; }
.student-access[open] summary { margin-bottom: 16px; }
.student-access .owned li { flex-wrap: wrap; gap: 8px; }
.directory-pagination { display: flex; gap: 16px; align-items: center; justify-content: center; margin-top: 26px; }
.person-portrait { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; }
.trainer-card { padding: 24px; }
.trainer-card header { display: flex; align-items: center; gap: 16px; }
.trainer-card h2 { font-size: 18px; margin: 0 0 6px; }
.trainer-card footer { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; }
.trainer-card .expertise { min-height: 3em; margin-top: 18px; }
@media(max-width: 700px) {
  .editor-overview { grid-template-columns: 1fr; gap: 20px; }
  .editor-identity h2 { font-size: 22px; }
  .lesson-admin-actions { padding-inline-start: 0; }
  .lesson-visual { width: 96px; }
  .media-library { gap: 18px; }
  .workspace-name { display: none; }
  .workspace-top .bar-end { width: auto; margin-inline-start: auto; }
}
@media(prefers-reduced-motion: reduce) { .page, .workspace-top::after, .media-course { transition: none !important; } }
.code-create-form .field-full { grid-column: 1 / -1; }
.course-picker { border: 0; padding: 0; margin: 0; min-width: 0; }
.course-picker legend { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.course-picker > input { width: 100%; margin-bottom: 12px; }
.course-picker-options { display: grid; gap: 8px; max-height: 260px; overflow-y: auto; padding: 3px; scrollbar-gutter: stable; }
.course-pick { display: flex; align-items: center; gap: 12px; cursor: pointer; min-height: 74px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.course-pick:has(:checked) { background: #fff0e8; border-color: var(--brand); }
.course-pick input { accent-color: var(--brand); flex: none; width: 18px; height: 18px; }
.course-pick img { width: 80px; height: 48px; object-fit: cover; border-radius: 7px; }
.course-pick span { display: grid; gap: 4px; min-width: 0; }
.course-pick strong { font-size: 13px; }
.course-pick small { font-size: 12px; color: var(--ink3); }
.course-pick[hidden] { display: none; }
.code-library { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(100%,265px),1fr)); gap: 16px; }
.code-ticket { padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); }
.code-ticket header { display: flex; align-items: center; gap: 10px; min-height: 54px; }
.code-ticket header img { width: 64px; height: 42px; object-fit: cover; border-radius: 7px; flex: none; }
.code-ticket header strong { font-size: 13px; line-height: 1.45; }
.ticket-code { margin: 18px 0 12px; padding: 13px; text-align: center; background: var(--paper); border: 1px dashed #d4c8be; border-radius: 8px; font-size: 22px; }
.ticket-status { margin: 10px 0; }
.code-ticket footer { display: flex; gap: 8px; margin-top: 14px; min-height: 30px; }
.create-disclosure > summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer; color: var(--brand); font-weight: 700; list-style: none; }
.create-disclosure > summary::-webkit-details-marker { display: none; }
.create-disclosure > summary span { font-size: 24px; }
.create-disclosure[open] .code-create { margin-top: 22px; }
.create-disclosure summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }

[dir="rtl"] .workspace-top::after { transform-origin: right; }
#course-lessons { scroll-margin-top: 90px; }
.lesson-admin-actions .video-upload-disclosure { flex: 0 1 auto; }
.video-upload-disclosure[open] { flex-basis: 100%; }
.video-upload-disclosure .video-upload { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.lesson-poster-disclosure { margin-top: 12px; }
.lesson-poster-disclosure > summary { cursor: pointer; font-size: 13px; width: max-content; }
