:root {
    --app-bg: #f3f7ff;
    --app-bg-soft: #e7eefc;
    --app-text: #10284a;
    --app-muted: #5f7394;
    --app-border: rgba(16, 40, 74, 0.12);
    --app-surface: rgba(255, 255, 255, 0.9);
    --app-surface-strong: #ffffff;
    --app-primary: #204cb3;
    --app-primary-2: #122f75;
    --app-primary-3: #091b4a;
    --app-accent: #d9b45f;
    --app-accent-soft: #f6ebca;
    --app-hero: linear-gradient(135deg, #0e2158 0%, #204cb3 56%, #2e63d4 100%);
    --app-hero-glow: rgba(217, 180, 95, 0.22);
    --app-shadow: 0 24px 60px rgba(11, 31, 73, 0.12);
}

body {
    margin: 0;
    color: var(--app-text);
    background:
        radial-gradient(circle at top right, rgba(32, 76, 179, 0.08), transparent 22%),
        radial-gradient(circle at bottom left, rgba(217, 180, 95, 0.12), transparent 26%),
        var(--app-bg);
    font-family: "Tajawal", "Segoe UI", Tahoma, sans-serif;
}

body.theme-dark {
    background: #071226;
    color: #edf4ff;
}

.fh-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fh-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(32, 76, 179, 0.1), rgba(217, 180, 95, 0.2));
    border: 1px solid rgba(32, 76, 179, 0.14);
    color: var(--app-primary-2);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.3;
    text-align: center;
    white-space: nowrap;
}

body.theme-dark .fh-badge {
    background: rgba(29, 95, 168, 0.22);
    border-color: rgba(148, 197, 255, 0.22);
    color: #edf4ff;
}

.fh-app {
    min-height: 100vh;
}

.app-shell {
    min-height: 100vh;
}

.page,
.auth-page {
    width: min(1440px, calc(100% - 48px));
    margin: 0 auto;
}

.page {
    padding: 132px 0 48px;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.admin-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 296px minmax(0, 1fr);
    background:
        radial-gradient(circle at top right, rgba(217, 180, 95, 0.16), transparent 18%),
        radial-gradient(circle at bottom left, rgba(32, 76, 179, 0.09), transparent 20%),
        linear-gradient(180deg, #f6f9ff 0%, #eef3ff 58%, #f7f1df 100%);
}

.admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 16px;
    overflow: hidden;
    background:
        radial-gradient(circle at top, rgba(217, 180, 95, 0.18), transparent 24%),
        linear-gradient(180deg, #08173d 0%, #102a67 42%, #163981 100%);
    color: #edf4ff;
    border-inline-end: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 16px 42px rgba(5, 15, 32, 0.18);
    transition: width .24s ease, padding .24s ease;
}

.admin-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
}

.admin-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
    min-width: 0;
}

.admin-sidebar-logo {
    width: 54px;
    height: 54px;
    object-fit: contain;
    background: #fff;
    border-radius: 16px;
    padding: 5px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.admin-sidebar-brand strong,
.admin-sidebar-brand span {
    display: block;
}

.admin-sidebar-brand strong {
    font-size: 22px;
    white-space: nowrap;
}

.admin-sidebar-brand span,
.admin-sidebar-user span {
    color: rgba(237, 244, 255, 0.74);
    font-size: 13px;
}

.admin-sidebar-toggle {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(255,255,255,.08);
    color: #fff;
    border-radius: 14px;
    cursor: pointer;
    font: inherit;
    flex-shrink: 0;
}

.admin-sidebar-user {
    padding: 16px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.04));
    border: 1px solid rgba(255,255,255,.08);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}

.admin-sidebar-user strong {
    display: block;
    margin-bottom: 4px;
    font-size: 18px;
}

.admin-sidebar-groups {
    display: grid;
    gap: 16px;
    overflow: auto;
    padding-inline-end: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(214, 224, 242, 0.42) rgba(255,255,255,0.06);
}

.admin-sidebar-groups::-webkit-scrollbar {
    width: 8px;
}

.admin-sidebar-groups::-webkit-scrollbar-track {
    background: rgba(255,255,255,.06);
    border-radius: 999px;
}

.admin-sidebar-groups::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(214,224,242,0.56), rgba(138,165,211,0.52));
    border-radius: 999px;
    border: 1px solid rgba(11,31,61,0.28);
}

.admin-sidebar-groups::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(232,238,248,0.72), rgba(163,189,232,0.68));
}

.admin-sidebar-group h3 {
    margin: 0 0 10px;
    padding-inline: 6px;
    color: rgba(237,244,255,.62);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
}

.admin-sidebar-links {
    display: grid;
    gap: 8px;
}

.admin-sidebar-link,
.admin-sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 18px;
    color: #edf4ff;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,.06);
    background: rgba(255,255,255,.035);
    font-weight: 700;
    transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.admin-sidebar-link:hover,
.admin-sidebar-logout:hover {
    transform: translateX(-2px);
    background: rgba(255,255,255,.08);
    border-color: rgba(255,255,255,.12);
}

.admin-sidebar-badge {
    width: 38px;
    min-width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255,255,255,.14), rgba(255,255,255,.06));
    border: 1px solid rgba(255,255,255,.09);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
    text-align: center;
    font-size: 11px;
    line-height: 1;
    letter-spacing: .08em;
    font-weight: 900;
}

.admin-sidebar-badge--icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.admin-sidebar-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
}

.admin-sidebar-link.is-active {
    background: linear-gradient(135deg, rgba(32, 76, 179, 0.96), rgba(71, 115, 216, 0.92));
    border-color: rgba(217, 180, 95, 0.34);
    box-shadow: 0 14px 26px rgba(11, 35, 67, 0.3);
}

.admin-sidebar-link.is-active .admin-sidebar-badge {
    background: rgba(255,255,255,.18);
    border-color: rgba(255,255,255,.14);
}

.admin-sidebar-footer {
    margin-top: auto;
}

.admin-sidebar-logout {
    justify-content: center;
    background: rgba(244,63,94,.14);
    border-color: rgba(244,63,94,.22);
    padding-block: 14px;
}

.admin-main {
    min-width: 0;
    padding: 28px;
    overflow-x: hidden;
}

.admin-page-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
    align-items: start;
    gap: 24px;
    margin-bottom: 24px;
}

.admin-page-head > :first-child {
    min-width: 0;
    max-width: 760px;
}

.admin-page-head h1 {
    margin: 0 0 6px;
    font-size: 34px;
}

.admin-page-head p {
    margin: 0;
    color: var(--app-muted);
    line-height: 1.8;
}

.admin-page-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
    align-self: start;
}

.admin-kpi {
    min-width: 0;
    min-height: 98px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255,255,255,.84);
    border: 1px solid var(--app-border);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.admin-kpi strong,
.admin-kpi span {
    display: block;
}

.admin-kpi strong {
    font-size: 28px;
    margin-bottom: 4px;
}

.admin-table-card {
    background: rgba(255,255,255,.86);
    border: 1px solid var(--app-border);
    border-radius: 28px;
    padding: 22px;
    box-shadow: var(--app-shadow);
}

.admin-table-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.admin-table-toolbar h2 {
    margin: 0 0 6px;
}

.admin-table-toolbar p {
    margin: 0;
    color: var(--app-muted);
}

.admin-toolbar-actions {
    min-width: min(100%, 340px);
}

.admin-filter-input {
    width: 100%;
}

.admin-data-table-wrap {
    overflow-x: auto;
}

.admin-data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.admin-data-table th,
.admin-data-table td {
    padding: 16px 14px;
    border-bottom: 1px solid rgba(15,39,69,.08);
    text-align: right;
    vertical-align: top;
}

.admin-data-table th {
    color: var(--app-muted);
    font-size: 13px;
    font-weight: 800;
}

.admin-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 13px;
}

.admin-status.is-active {
    background: rgba(28,150,72,.12);
    color: #1c7b41;
}

.admin-status.is-inactive {
    background: rgba(186,43,43,.1);
    color: #a12a2a;
}

.admin-status.is-live {
    background: rgba(28,150,72,.12);
    color: #1c7b41;
}

.admin-status.is-countdown {
    background: rgba(201,138,18,.14);
    color: #936400;
}

.admin-status.is-ended {
    background: rgba(186,43,43,.1);
    color: #a12a2a;
}

.fh-classroom-admin-head {
    margin-bottom: 24px;
}

.fh-classroom-table-card {
    overflow: hidden;
}

.fh-classroom-table td {
    vertical-align: middle;
}

.fh-classroom-countdown {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(32, 76, 179, 0.08);
    color: var(--app-primary-2);
    font-weight: 800;
    font-size: 13px;
    white-space: nowrap;
}

.fh-classroom-countdown.is-live {
    background: rgba(28,150,72,.12);
    color: #1c7b41;
}

.fh-classroom-access-note {
    display: inline-flex;
    align-items: center;
    max-width: 280px;
    padding: 8px 12px;
    border-radius: 14px;
    background: rgba(15,39,69,.05);
    color: var(--app-muted);
    font-size: 13px;
    line-height: 1.6;
}

.fh-classroom-access-note.is-ready {
    background: rgba(28,150,72,.1);
    color: #1c7b41;
}

.fh-classroom-action-btn {
    min-width: 140px;
}

.fh-classroom-locked {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(72,98,140,.1);
    color: #526780;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.admin-row-details summary,
.admin-create-panel summary {
    cursor: pointer;
    list-style: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(32, 76, 179, 0.08);
    border: 1px solid rgba(32, 76, 179, 0.14);
    color: var(--app-primary-2);
    font-weight: 800;
}

.admin-row-details summary::-webkit-details-marker,
.admin-create-panel summary::-webkit-details-marker {
    display: none;
}

.admin-row-panel,
.admin-create-panel[open] {
    margin-top: 14px;
}

.admin-row-panel {
    min-width: min(100%, 920px);
}

.admin-row-details[open] .admin-row-panel {
    position: static;
    width: auto;
    min-width: 0;
    padding: 18px;
    border-radius: 24px;
    background: rgba(255,255,255,.98);
    border: 1px solid rgba(16, 40, 74, 0.1);
    box-shadow: 0 24px 48px rgba(15,39,69,.12);
}

.admin-inline-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.admin-inline-form > div {
    min-width: 0;
}

.admin-inline-form label {
    display: block;
    min-width: 0;
}

.admin-inline-form label span,
.admin-checkbox span {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
}

.admin-inline-form input,
.admin-inline-form textarea,
.admin-inline-form select {
    width: 100%;
    box-sizing: border-box;
}

.admin-inline-form input[type="file"] {
    padding: 10px 12px;
    background: #fff;
}

.admin-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-checkbox input {
    width: auto;
}

.admin-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.admin-teacher-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.admin-teacher-metric {
    padding: 16px 18px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(32, 76, 179, 0.06), rgba(217, 180, 95, 0.08));
    border: 1px solid rgba(32, 76, 179, 0.12);
}

.admin-teacher-metric span,
.admin-teacher-tools-head p {
    display: block;
    color: var(--app-muted);
}

.admin-teacher-metric strong {
    display: block;
    margin-top: 6px;
    font-size: 22px;
    font-weight: 900;
    color: var(--app-primary-3);
}

.admin-teacher-tools,
.admin-danger-zone {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(15,39,69,.08);
}

.admin-teacher-tools-head h3 {
    margin: 0 0 6px;
    font-size: 18px;
}

.admin-teacher-tools-head p {
    margin: 0 0 14px;
}

.admin-teacher-tool-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.admin-teacher-tool-actions form,
.admin-danger-zone form {
    margin: 0;
}

.admin-danger-zone {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
}

.admin-purchase-form {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.admin-purchase-form select {
    width: auto;
    min-width: 160px;
}

body.admin-sidebar-collapsed .admin-shell {
    grid-template-columns: 104px minmax(0, 1fr);
}

body.admin-sidebar-collapsed .admin-sidebar {
    padding-inline: 12px;
}

body.admin-sidebar-collapsed .admin-sidebar-brand div,
body.admin-sidebar-collapsed .admin-sidebar-user,
body.admin-sidebar-collapsed .admin-sidebar-group h3,
body.admin-sidebar-collapsed .admin-sidebar-link .admin-sidebar-label,
body.admin-sidebar-collapsed .admin-sidebar-footer {
    opacity: 0;
    transform: translateX(6px);
    pointer-events: none;
}

body.admin-sidebar-collapsed .admin-sidebar-link {
    justify-content: center;
    padding-inline: 0;
    min-height: 60px;
    border-radius: 20px;
}

body.admin-sidebar-collapsed .admin-sidebar-head {
    justify-content: center;
}

body.admin-sidebar-collapsed .admin-sidebar-brand {
    display: none;
}

body.admin-sidebar-collapsed .admin-sidebar-badge {
    width: 42px;
    min-width: 42px;
    height: 42px;
    font-size: 11px;
}

body.theme-dark .admin-shell {
    background:
        radial-gradient(circle at top right, rgba(217,180,95,.12), transparent 18%),
        radial-gradient(circle at bottom left, rgba(32,76,179,.16), transparent 20%),
        linear-gradient(180deg, #071021 0%, #0c1730 100%);
}

body.theme-dark .admin-table-card,
body.theme-dark .admin-kpi {
    background: rgba(16,35,58,.92);
    border-color: rgba(255,255,255,.08);
    color: #edf4ff;
}

body.theme-dark .admin-teacher-metric {
    background: linear-gradient(180deg, rgba(23, 60, 116, 0.34), rgba(78, 96, 133, 0.22));
    border-color: rgba(148, 197, 255, 0.14);
}

body.theme-dark .admin-teacher-metric strong {
    color: #edf4ff;
}

body.theme-dark .admin-teacher-tools,
body.theme-dark .admin-danger-zone {
    border-top-color: rgba(255,255,255,.08);
}

body.theme-dark .admin-page-head p,
body.theme-dark .admin-table-toolbar p,
body.theme-dark .admin-data-table th {
    color: #b7c9e0;
}

body.theme-dark .admin-status.is-live {
    background: rgba(46, 204, 113, 0.18);
    color: #8ef0b7;
}

body.theme-dark .admin-status.is-countdown {
    background: rgba(230, 177, 52, 0.18);
    color: #ffd98a;
}

body.theme-dark .admin-status.is-ended {
    background: rgba(186, 43, 43, 0.18);
    color: #ffb8b8;
}

body.theme-dark .fh-classroom-countdown {
    background: rgba(68, 109, 201, 0.18);
    color: #d9e6ff;
}

body.theme-dark .fh-classroom-countdown.is-live {
    background: rgba(46, 204, 113, 0.18);
    color: #8ef0b7;
}

body.theme-dark .fh-classroom-access-note {
    background: rgba(255,255,255,.06);
    color: rgba(226, 236, 255, 0.82);
}

body.theme-dark .fh-classroom-access-note.is-ready {
    background: rgba(46, 204, 113, 0.16);
    color: #9ef0c0;
}

body.theme-dark .fh-classroom-locked {
    background: rgba(128, 154, 201, 0.12);
    color: #c9dafd;
}

body.theme-dark .admin-data-table th,
body.theme-dark .admin-data-table td {
    border-bottom-color: rgba(255,255,255,.08);
}

body.theme-dark .admin-row-details summary,
body.theme-dark .admin-create-panel summary {
    background: rgba(208,172,87,.12);
    border-color: rgba(208,172,87,.18);
    color: #edf4ff;
}

body.theme-dark .admin-row-details[open] .admin-row-panel {
    background: rgba(11,24,48,.98);
    border-color: rgba(148,197,255,.12);
    box-shadow: 0 24px 54px rgba(0,0,0,.34);
}

.landing-page {
    min-height: 100vh;
    padding: 28px 0 48px;
    background:
        radial-gradient(circle at top right, rgba(217, 180, 95, 0.16), transparent 24%),
        radial-gradient(circle at bottom left, rgba(32, 76, 179, 0.16), transparent 30%),
        linear-gradient(180deg, #f7faff 0%, #eef4ff 56%, #f8f2e1 100%);
}

.landing-shell {
    width: min(1440px, calc(100% - 48px));
    margin: 0 auto;
}

.landing-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.landing-brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
}

.landing-brand strong {
    display: block;
    font-size: 30px;
    font-weight: 900;
}

.landing-brand span {
    display: block;
    color: var(--app-muted);
    font-size: 14px;
    font-weight: 700;
}

.landing-actions,
.landing-cta,
.landing-panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.landing-theme-toggle,
.auth-theme-toggle {
    min-height: 48px;
    padding: 12px 16px;
    border-radius: 14px;
}

.landing-theme-toggle {
    background: rgba(9, 27, 74, 0.88);
    color: #f3f8ff;
    border-color: rgba(255, 255, 255, 0.16);
}

.landing-hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: stretch;
}

.landing-copy,
.landing-card {
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(15, 39, 69, 0.08);
    border-radius: 32px;
    padding: 34px;
    box-shadow: var(--app-shadow);
    backdrop-filter: blur(14px);
}

.landing-copy {
    background: linear-gradient(135deg, rgba(9, 27, 74, 0.98) 0%, rgba(32, 76, 179, 0.94) 58%, rgba(71, 115, 216, 0.92) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 520px;
    position: relative;
    overflow: hidden;
}

.landing-copy::before,
.landing-copy::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
}

.landing-copy::before {
    width: 320px;
    height: 320px;
    left: -120px;
    top: 40px;
    background: radial-gradient(circle, rgba(255,255,255,.16) 0%, rgba(255,255,255,0) 70%);
}

.landing-copy::after {
    width: 260px;
    height: 260px;
    left: 80px;
    bottom: -80px;
    background: radial-gradient(circle, var(--app-hero-glow) 0%, rgba(8,24,45,0) 72%);
}

.landing-kicker {
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.14);
    font-weight: 800;
    margin-bottom: 16px;
}

.landing-copy h1 {
    margin: 0 0 12px;
    font-size: 48px;
    line-height: 1.25;
    font-weight: 900;
    max-width: 16ch;
}

.landing-copy p {
    margin: 0 0 20px;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.9;
    font-size: 18px;
    max-width: 72ch;
}

.landing-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 24px 0 8px;
}

.landing-stat {
    padding: 16px 18px;
    border-radius: 22px;
    background: rgba(7, 24, 71, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.landing-stat strong,
.landing-stat span {
    display: block;
}

.landing-stat strong {
    margin-bottom: 6px;
    font-size: 18px;
}

.landing-stat span {
    color: rgba(255, 255, 255, 0.84);
    line-height: 1.7;
}

.landing-points {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 28px;
}

.landing-point {
    padding: 16px;
    border-radius: 22px;
    background: rgba(7, 24, 71, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.landing-point strong {
    display: block;
    margin-bottom: 6px;
    font-size: 18px;
}

.landing-point span {
    display: block;
    line-height: 1.75;
    color: rgba(255, 255, 255, 0.86);
}

.landing-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    align-content: stretch;
}

.landing-card h3,
.landing-card h4 {
    margin: 0 0 10px;
}

.landing-card p {
    margin: 0 0 16px;
    color: var(--app-muted);
    line-height: 1.8;
}

.landing-card-soft {
    background: linear-gradient(180deg, #fff7e4 0%, #ffffff 100%);
}

.landing-demo-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
}

.landing-flow-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.landing-flow-list li {
    padding: 12px 14px;
    border-radius: 16px;
    background: #f4f8ff;
    border: 1px solid var(--app-border);
    font-weight: 700;
}

.landing-demo-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 18px;
    background: #f4f8ff;
    border: 1px solid var(--app-border);
}

.landing-demo-list span {
    color: var(--app-muted);
    font-weight: 700;
}

.auth-links {
    display: grid;
    gap: 8px;
    margin-top: 18px;
}

.auth-links a {
    color: var(--app-primary);
    font-weight: 800;
    text-decoration: none;
}

.auth-card {
    width: min(560px, 100%);
    padding: 32px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(15, 39, 69, 0.12);
}

.auth-card-tools {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 18px;
}

.auth-theme-toggle {
    background: rgba(18, 63, 121, 0.08);
    color: var(--app-text);
    border-color: rgba(18, 63, 121, 0.14);
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.brand-logo {
    width: 74px;
    height: 74px;
    object-fit: contain;
    background: #fff;
    border-radius: 16px;
    padding: 6px;
}

.stack {
    display: grid;
    gap: 14px;
}

.level-test-form {
    gap: 24px;
}

.level-test-list {
    display: grid;
    gap: 18px;
}

.level-test-question {
    padding: 20px;
    border: 1px solid var(--app-border);
    border-radius: 22px;
    background: #f9fbff;
}

.level-test-question-title {
    margin: 0 0 14px;
    font-size: 20px;
    line-height: 1.6;
}

.level-test-options {
    display: grid;
    gap: 10px;
}

.level-test-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--app-border);
    border-radius: 16px;
    background: #fff;
    cursor: pointer;
}

.level-test-option input[type="radio"] {
    width: auto;
    margin: 0;
    accent-color: var(--app-primary);
}

.level-test-option span {
    display: inline;
    margin: 0;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--app-border);
    background: #f7faff;
    color: inherit;
    font: inherit;
}

label span {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 18px;
    padding: 14px 18px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-2));
    color: #fff;
    box-shadow: 0 16px 30px rgba(18, 47, 117, 0.18);
}

.btn-google {
    background: #fff;
    color: #1f2937;
    border: 1px solid rgba(15, 23, 42, 0.12);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.btn-google-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: linear-gradient(135deg, #4285f4, #34a853);
    color: #fff;
    font-weight: 900;
}

.btn-secondary {
    background: var(--app-accent-soft);
    color: #6f5213;
}

.btn-danger {
    background: rgba(176, 37, 63, 0.1);
    color: #8d1f37;
}

.btn-inline {
    padding: 10px 14px;
    border-radius: 12px;
}

.alert {
    margin-bottom: 18px;
    padding: 14px 18px;
    border-radius: 16px;
    font-weight: 700;
}

.alert-success {
    background: rgba(26, 133, 92, 0.12);
    color: #156f4d;
}

.alert-error {
    background: rgba(186, 43, 43, 0.1);
    color: #9d2438;
}

.auth-divider {
    position: relative;
    margin: 18px 0;
    text-align: center;
}

.auth-divider::before {
    content: '';
    position: absolute;
    inset: 50% 0 auto;
    border-top: 1px solid var(--app-border);
}

.auth-divider span {
    position: relative;
    display: inline-block;
    padding: 0 12px;
    background: var(--app-surface);
    color: var(--app-muted);
    font-weight: 800;
}

.table-wrap,
.fh-table-wrap {
    overflow-x: auto;
}

table,
.fh-table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--app-border);
    text-align: right;
}

body.theme-dark .auth-card {
    background: #10233a;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

body.theme-dark .level-test-question {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .level-test-option {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .btn-google {
    background: rgba(255, 255, 255, 0.06);
    color: #edf4ff;
    border-color: rgba(255, 255, 255, 0.1);
}

body.theme-dark .auth-divider span {
    background: #10233a;
}

body.theme-dark .landing-theme-toggle,
body.theme-dark .auth-theme-toggle {
    background: rgba(217, 180, 95, 0.14);
    color: #edf4ff;
    border-color: rgba(208, 172, 87, 0.24);
}

body.theme-dark .landing-page {
    background:
        radial-gradient(circle at top right, rgba(217, 180, 95, 0.14), transparent 24%),
        radial-gradient(circle at bottom left, rgba(32, 76, 179, 0.2), transparent 30%),
        linear-gradient(180deg, #071021 0%, #0c1730 100%);
}

body.theme-dark .landing-card,
body.theme-dark .landing-card-soft {
    background: rgba(12, 29, 58, 0.94);
    border-color: rgba(255, 255, 255, 0.08);
    color: #edf4ff;
}

body.theme-dark .landing-card p,
body.theme-dark .landing-brand span,
body.theme-dark .landing-demo-list span,
body.theme-dark .auth-links a {
    color: #b7c9e0;
}

body.theme-dark .landing-demo-list li {
    background: #0d1c2e;
    border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .landing-flow-list li {
    background: #0d1c2e;
    border-color: rgba(255, 255, 255, 0.08);
    color: #e7f0ff;
}

body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea {
    background: #0d1c2e;
    border-color: rgba(255, 255, 255, 0.08);
    color: #edf4ff;
}

@media (max-width: 768px) {
    .page,
    .auth-page,
    .landing-shell {
        width: min(100% - 20px, 1440px);
    }

    .brand-logo {
        width: 62px;
        height: 62px;
    }

    .landing-nav,
    .landing-hero {
        display: grid;
        grid-template-columns: 1fr;
    }

    .landing-actions,
    .landing-cta,
    .landing-panel-actions,
    .landing-stats,
    .landing-points {
        display: grid;
        grid-template-columns: 1fr;
    }

    .landing-panel {
        grid-template-columns: 1fr;
    }

    .landing-copy h1 {
        font-size: 34px;
        max-width: none;
    }

    .landing-copy p {
        max-width: none;
    }

    .landing-copy {
        min-height: auto;
        padding: 28px;
    }

    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
        height: auto;
    }

    .admin-main {
        padding: 18px;
    }

    .admin-page-head,
    .admin-table-toolbar,
    .admin-page-kpis,
    .admin-inline-form,
    .admin-purchase-form,
    .admin-teacher-tool-actions,
    .admin-teacher-metrics {
        grid-template-columns: 1fr;
        display: grid;
    }

    .admin-page-head > :first-child {
        max-width: none;
    }

    .admin-row-details[open] .admin-row-panel {
        position: static;
        width: auto;
        min-width: 0;
    }

    .admin-danger-zone {
        display: block;
    }
}

:root {
    --fh-font-family: "Tajawal", "Segoe UI", Tahoma, sans-serif;
    --fh-font-size-base: 16px;
    --fh-line-height-base: 1.7;
    --fh-font-size-title: 36px;
    --fh-font-size-subtitle: 17px;
    --fh-font-size-heading: 28px;
    --fh-font-size-card-title: 22px;
    --fh-font-size-item-title: 18px;
    --fh-font-size-meta: 14px;
    --fh-font-size-ui: 15px;
    --fh-font-size-small: 13px;
}

html {
    font-size: var(--fh-font-size-base);
}

body,
button,
input,
select,
textarea,
table,
th,
td {
    font-family: var(--fh-font-family) !important;
    font-size: var(--fh-font-size-base);
    line-height: var(--fh-line-height-base);
    font-weight: 500;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.fh-app,
.app-shell,
.admin-shell,
.page,
.auth-page {
    font-family: var(--fh-font-family);
}

.fh-title,
.landing-copy h1,
.admin-page-head h1 {
    font-size: var(--fh-font-size-title);
    line-height: 1.25;
    font-weight: 900;
}

.fh-subtitle,
.landing-copy p,
.admin-page-head p {
    font-size: var(--fh-font-size-subtitle);
    line-height: 1.8;
    font-weight: 500;
}

.fh-card h3,
.landing-card h3,
.landing-card h4,
.admin-table-toolbar h2,
.fh-auth-title {
    font-size: var(--fh-font-size-card-title);
    line-height: 1.35;
    font-weight: 800;
}

.fh-item-title,
.admin-sidebar-user strong,
.landing-stat strong,
.landing-point strong {
    font-size: var(--fh-font-size-item-title);
    line-height: 1.4;
    font-weight: 800;
}

.fh-item-meta,
.fh-muted,
.fh-activity-content small,
.admin-sidebar-brand span,
.admin-sidebar-user span,
.admin-status,
.fh-item-note {
    font-size: var(--fh-font-size-small);
    line-height: 1.7;
}

.fh-nav-link,
.fh-pill,
.fh-badge,
.fh-btn,
.fh-input,
.admin-row-details summary,
.admin-create-panel summary {
    font-size: var(--fh-font-size-ui);
    line-height: 1.4;
    font-weight: 700;
}

.fh-kpi,
.fh-price {
    line-height: 1.2;
    font-weight: 900;
}

@media (max-width: 768px) {
    :root {
        --fh-font-size-title: 30px;
        --fh-font-size-subtitle: 16px;
        --fh-font-size-card-title: 20px;
        --fh-font-size-item-title: 17px;
        --fh-font-size-ui: 14px;
        --fh-font-size-small: 12px;
    }
}

@media (max-width: 480px) {
    :root {
        --fh-font-size-title: 24px;
        --fh-font-size-subtitle: 14px;
        --fh-font-size-card-title: 18px;
        --fh-font-size-item-title: 16px;
    }
}
