/* ==========================================================
   Yaqeen Design System
   لوحة ألوان مستوحاة من الطابع العربي الإسلامي
   ========================================================== */
:root {
    --bg: #f7f5ee;
    --bg-soft: #fbfaf5;
    --surface: #ffffff;
    --surface-soft: #f3faf7;
    --surface-alt: #eef7f3;
    --text: #0b1f35;
    --text-soft: #26394c;
    --muted: #61717f;
    --border: rgba(16, 62, 74, .13);
    --border-strong: rgba(16, 62, 74, .22);
    --primary: #0f766e;
    --primary-hover: #0d635c;
    --primary-dark: #0b4d4a;
    --primary-soft: #dff4ef;
    --primary-softer: #edf9f6;
    --navy: #0b2239;
    --navy-soft: #112f4d;
    --gold: #c7a45b;
    --gold-soft: rgba(199, 164, 91, .18);
    --danger: #b42318;
    --danger-soft: #fee4e2;
    --success: #087443;
    --success-soft: #dff8ec;
    --warning: #b25e09;
    --warning-soft: #fdecc8;
    --shadow-sm: 0 2px 6px rgba(11, 34, 57, .06);
    --shadow: 0 12px 32px rgba(11, 34, 57, .10);
    --shadow-soft: 0 8px 22px rgba(11, 34, 57, .07);
    --shadow-lg: 0 20px 44px rgba(11, 34, 57, .14);
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
    --ease: cubic-bezier(.4, 0, .2, 1);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    color: var(--text);
    background: var(--bg);
    font-family: "Segoe UI", Tahoma, "Cairo", "Tajawal", Arial, sans-serif;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    background:
        radial-gradient(circle at 88% 8%, rgba(15, 118, 110, .10), transparent 22rem),
        radial-gradient(circle at 9% 28%, rgba(199, 164, 91, .12), transparent 18rem),
        linear-gradient(180deg, var(--bg-soft) 0%, var(--surface-alt) 48%, var(--bg) 100%);
}

a {
    color: inherit;
    text-decoration: none;
    transition: color .18s var(--ease);
}

a:hover {
    color: var(--primary-dark);
}

h1, h2, h3, h4, p {
    margin-top: 0;
}

h1 {
    font-size: clamp(1.55rem, 3vw, 2.55rem);
    line-height: 1.2;
    letter-spacing: -.03em;
    margin-bottom: .4rem;
    color: var(--navy);
    font-weight: 900;
}

h2 {
    font-size: clamp(1.15rem, 2vw, 1.5rem);
    margin-bottom: .6rem;
    color: var(--navy);
    font-weight: 800;
}

h3 {
    font-size: 1.02rem;
    margin-bottom: .4rem;
    color: var(--navy);
    font-weight: 800;
}

p {
    line-height: 1.8;
}

::selection {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

:focus-visible {
    outline: 3px solid rgba(15, 118, 110, .35);
    outline-offset: 2px;
    border-radius: 8px;
}

/* ==========================================================
   Layout Shell
   ========================================================== */
.shell,
.app-shell,
.yaqeen-app {
    min-height: 100vh !important;
    display: block !important;
    grid-template-columns: none !important;
    width: 100% !important;
    max-width: none !important;
}

.main,
.main-content,
.yaqeen-main {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.yaqeen-main {
    padding: 22px 18px 48px !important;
}

.content-container,
.yaqeen-container {
    width: min(1180px, 100%) !important;
    margin-inline: auto !important;
}

/* ==========================================================
   Top Navigation
   ========================================================== */
.yaqeen-top-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 10px 18px;
    background: rgba(250, 250, 246, .88);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(15, 76, 74, .10);
}

.yaqeen-nav-inner {
    width: min(1180px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
}

.yaqeen-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: max-content;
}

.yaqeen-brand-mark,
.yaqeen-brand-mark svg {
    width: 44px;
    height: 36px;
    display: block;
}

.yaqeen-brand-text {
    display: block;
}

.yaqeen-brand strong {
    display: block;
    color: var(--navy);
    font-size: 1.28rem;
    line-height: 1;
    letter-spacing: -.04em;
    font-weight: 900;
}

.yaqeen-brand-text span:last-child,
.yaqeen-brand > span:last-child {
    display: block;
    margin-top: 3px;
    color: var(--primary);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .04em;
}

.yaqeen-nav-links,
.yaqeen-nav-actions,
.page-actions,
.actions,
.hero-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.yaqeen-nav-links {
    justify-content: center;
    min-width: 0;
}

.yaqeen-nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 11px;
    border-radius: 999px;
    color: var(--text-soft);
    font-weight: 800;
    font-size: .86rem;
    transition: color .18s var(--ease), background .18s var(--ease), transform .18s var(--ease);
    white-space: nowrap;
}

.yaqeen-nav-link:hover,
.yaqeen-nav-link.active {
    color: var(--primary-dark);
    background: rgba(15, 118, 110, .08);
    transform: translateY(-1px);
}

.yaqeen-nav-link.active::after {
    content: "";
    position: absolute;
    inset-inline: 26%;
    bottom: 2px;
    height: 2px;
    border-radius: 999px;
    background: var(--gold);
}

.yaqeen-nav-link.user-only {
    background: rgba(15, 118, 110, .06);
}

.yaqeen-nav-link.admin-only {
    background: var(--gold-soft);
    color: #7a5a17;
}

.yaqeen-nav-link.admin-only:hover,
.yaqeen-nav-link.admin-only.active {
    background: rgba(199, 164, 91, .28);
    color: #5c400a;
}

.yaqeen-user-email {
    display: inline-block;
    max-width: 145px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    direction: ltr;
    color: var(--muted);
    font-size: .8rem;
    text-align: left;
    padding: 4px 10px;
    background: rgba(15, 118, 110, .06);
    border-radius: 999px;
}

/* ==========================================================
   Buttons
   ========================================================== */
.btn,
button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 9px 16px;
    border: 0;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    font-size: .9rem;
    box-shadow: 0 8px 18px rgba(15, 118, 110, .22);
    cursor: pointer;
    transition: transform .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease), color .18s var(--ease);
    text-decoration: none;
    line-height: 1;
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-1px);
    background: var(--primary-hover);
    box-shadow: 0 12px 22px rgba(15, 118, 110, .28);
}

.btn:active {
    transform: translateY(0);
}

.btn.dark {
    background: var(--navy);
    box-shadow: 0 8px 18px rgba(11, 34, 57, .22);
}

.btn.dark:hover {
    background: var(--navy-soft);
}

.btn.secondary {
    background: #fff;
    color: var(--primary-dark);
    border: 1px solid var(--border);
    box-shadow: none;
}

.btn.secondary:hover {
    background: var(--primary-softer);
    border-color: rgba(15, 118, 110, .3);
    color: var(--primary-dark);
}

.btn.danger {
    background: var(--danger);
    box-shadow: 0 8px 18px rgba(180, 35, 24, .24);
}

.btn.danger:hover {
    background: #8f1a11;
}

.btn.gold {
    background: var(--gold);
    color: #3a2708;
    box-shadow: 0 8px 18px rgba(199, 164, 91, .28);
}

.btn.gold:hover {
    background: #b68e42;
}

.btn.btn-sm {
    min-height: 32px;
    padding: 6px 11px;
    font-size: .8rem;
}

.btn.btn-lg {
    min-height: 48px;
    padding: 12px 22px;
    font-size: .95rem;
}

.btn.disabled,
.btn:disabled {
    background: #e8ecec;
    color: #6b7a86;
    box-shadow: none;
    cursor: not-allowed;
    pointer-events: none;
}

/* ==========================================================
   Cards & Layout Primitives
   ========================================================== */
.card {
    background: rgba(255, 255, 255, .95);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 20px;
    transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}

.compact-card {
    padding: 16px;
    border-radius: 14px;
}

.grid,
.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.compact-grid {
    gap: 14px;
}

.two-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.page-title,
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.page-title > div:first-child,
.section-heading > div:first-child {
    min-width: 0;
    flex: 1;
}

.page-title h1,
.section-heading h1 {
    font-size: clamp(1.15rem, 2vw, 1.5rem);
    line-height: 1.25;
    margin: 0 0 2px;
    letter-spacing: -.02em;
}

.page-title h2,
.section-heading h2 {
    font-size: clamp(1.05rem, 1.8vw, 1.3rem);
    line-height: 1.25;
    margin: 0 0 2px;
}

.page-title .hero-badge,
.section-heading .hero-badge {
    margin-bottom: 4px;
    padding: 3px 9px;
    font-size: .7rem;
}

.page-title .muted,
.section-heading .muted {
    margin: 0;
    font-size: .85rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.compact-title {
    margin-bottom: 12px;
}

.section-block {
    margin-top: 22px;
}

.compact-section {
    margin-top: 18px;
}

.muted {
    color: var(--muted);
}

.line-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3.1em;
}

/* ==========================================================
   Badges / Pills / Status
   ========================================================== */
.pill,
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .01em;
}

.pill.success,
.badge.success {
    background: var(--success-soft);
    color: var(--success);
}

.badge.soft {
    background: var(--gold-soft);
    color: #7a5a17;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 800;
}

.status-badge::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    opacity: .8;
}

.status-badge.active {
    background: var(--success-soft);
    color: var(--success);
}

.status-badge.inactive {
    background: #f1efe6;
    color: #6b6350;
}

/* ==========================================================
   Empty / Loading States
   ========================================================== */
.empty-state {
    text-align: center;
    padding: 32px 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.empty-state h1,
.empty-state h2,
.empty-state h3 {
    margin-bottom: 2px;
}

.empty-state p {
    color: var(--muted);
    margin-bottom: 10px;
}

.empty-icon {
    width: 68px;
    height: 68px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary-softer), var(--gold-soft));
    color: var(--primary-dark);
    font-size: 1.9rem;
    margin-bottom: 8px;
    box-shadow: inset 0 0 0 1px var(--border);
}

.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 26px;
    background: rgba(255, 255, 255, .82);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    color: var(--muted);
    font-weight: 700;
}

.loading-state::before {
    content: "";
    width: 18px;
    height: 18px;
    border: 3px solid var(--primary-soft);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================
   Hero
   ========================================================== */
.hero {
    display: grid;
    grid-template-columns: 1fr .86fr;
    gap: 24px;
    align-items: center;
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background:
        linear-gradient(90deg, rgba(255,255,255,.94), rgba(255,255,255,.70)),
        radial-gradient(circle at 76% 30%, rgba(15,118,110,.15), transparent 22rem);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

.hero-content {
    min-width: 0;
}

.compact-hero {
    min-height: 360px;
}

.hero-badge {
    display: none;
}

.hero-subtitle {
    margin-bottom: 10px;
    color: var(--primary-dark);
    font-size: clamp(1.05rem, 2vw, 1.5rem);
    font-weight: 900;
}

.hero-text {
    max-width: 620px;
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 1rem;
}

.hero-features {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 16px 0;
    max-width: 580px;
}

.hero-features div {
    padding: 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .78);
    border: 1px solid var(--border);
    transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}

.hero-features div:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.hero-features span,
.hero-features strong,
.hero-features small {
    display: block;
}

.hero-features span {
    font-size: 1.35rem;
    margin-bottom: 4px;
}

.hero-features strong {
    font-size: .9rem;
    color: var(--navy);
}

.hero-features small {
    color: var(--muted);
    font-size: .75rem;
}

.hero-art {
    min-height: 280px;
    display: grid;
    place-items: center;
}

.arch-card {
    position: relative;
    width: min(360px, 100%);
    height: 280px;
    border-radius: 140px 140px 26px 26px;
    background: linear-gradient(180deg, rgba(255, 250, 238, .9), rgba(226, 244, 240, .8));
    border: 5px solid rgba(199, 164, 91, .75);
    box-shadow: 0 24px 46px rgba(11,34,57,.16);
    overflow: hidden;
}

.arch-card::after {
    content: "";
    position: absolute;
    inset: 24px;
    border-radius: 120px 120px 20px 20px;
    border: 2px solid rgba(15, 118, 110, .25);
}

.sun {
    position: absolute;
    top: 55px;
    left: 50%;
    width: 34px;
    height: 34px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: radial-gradient(circle, #18a095 0%, #0f766e 70%);
    box-shadow: 0 0 36px rgba(15,118,110,.4);
    z-index: 2;
}

.plant {
    position: absolute;
    top: 85px;
    left: 50%;
    width: 86px;
    height: 42px;
    background: linear-gradient(135deg, #12877e, #0b4d4a);
    border-radius: 90% 10% 90% 10%;
    z-index: 2;
}

.plant-left {
    transform: translateX(-94px) rotate(13deg);
}

.plant-right {
    transform: translateX(8px) scaleX(-1) rotate(13deg);
}

.book-stack {
    position: absolute;
    left: 50%;
    bottom: 46px;
    width: 230px;
    transform: translateX(-50%);
    z-index: 3;
}

.book {
    height: 44px;
    margin-top: -3px;
    border-radius: 8px 16px 16px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ead49c;
    font-weight: 900;
    letter-spacing: .02em;
    box-shadow: 0 10px 18px rgba(11,34,57,.18);
}

.book-one { background: #0b2239; transform: rotate(-2deg); }
.book-two { background: #0f766e; transform: rotate(1deg); }
.book-three { background: #112f4d; transform: rotate(-1deg); }

/* ==========================================================
   Stats Strip
   ========================================================== */
.stats-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin: -18px auto 0;
    width: min(820px, calc(100% - 28px));
    position: relative;
    z-index: 2;
    overflow: hidden;
    border-radius: 18px;
    background: rgba(255,255,255,.18);
    box-shadow: var(--shadow);
}

.stats-strip div {
    padding: 16px 12px;
    text-align: center;
    background: var(--navy);
    color: #fff;
    transition: background .2s var(--ease);
}

.stats-strip div:hover {
    background: var(--navy-soft);
}

.stats-strip strong {
    display: block;
    font-size: 1.35rem;
    color: #70d0c7;
    font-weight: 900;
}

.stats-strip span {
    display: block;
    margin-top: 3px;
    font-size: .8rem;
    color: rgba(255,255,255,.82);
}

/* ==========================================================
   Admin Stats Grid
   ========================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.stat-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 22px;
    background: rgba(255, 255, 255, .95);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}

.stat-card::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--primary), var(--gold));
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary-softer), var(--gold-soft));
    color: var(--primary-dark);
    font-size: 1.6rem;
    box-shadow: inset 0 0 0 1px var(--border);
}

.stat-card .metric {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--navy);
    line-height: 1;
    letter-spacing: -.03em;
}

.stat-card h3 {
    margin: 4px 0 2px;
}

.stat-card p {
    margin-bottom: 6px;
}

.stat-card .btn {
    align-self: flex-start;
    margin-top: 6px;
}

/* ==========================================================
   Course / Book Cards
   ========================================================== */
.course-card,
.book-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}

.course-card:hover,
.book-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.course-img,
.book-cover {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
}

.book-cover {
    height: 200px;
    object-fit: contain;
    background: linear-gradient(135deg, var(--surface-soft), var(--surface-alt));
    padding: 8px;
}

.course-placeholder {
    height: 140px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #eef8f5, #fff7e4);
    color: var(--primary-dark);
    font-size: 2.2rem;
    border: 1px solid var(--border);
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 0;
}

.card-body-tight {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-height: 0;
}

.card-footer-tight {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}

/* ==========================================================
   Detail Hero / Media
   ========================================================== */
.detail-hero {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 18px;
    align-items: center;
    padding: 16px 18px;
    margin-bottom: 16px;
    background:
        linear-gradient(90deg, rgba(255,255,255,.95), rgba(255,255,255,.75)),
        radial-gradient(circle at 82% 30%, rgba(15,118,110,.12), transparent 18rem);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.detail-hero > div {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.detail-hero h1 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    font-size: clamp(1.15rem, 2vw, 1.5rem);
    line-height: 1.3;
    margin: 0;
    letter-spacing: -.02em;
}

.detail-hero .hero-badge {
    margin-bottom: 0;
    align-self: flex-start;
}

.detail-hero .muted {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    font-size: .9rem;
    line-height: 1.6;
}

.detail-hero .hero-actions {
    margin-top: 4px;
}

.media-preview {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    background: var(--surface-soft);
    grid-column: 1;
    grid-row: 1;
}

.detail-hero > div {
    grid-column: 2;
    grid-row: 1;
}

@media (max-width: 640px) {
    .detail-hero {
        grid-template-columns: 90px 1fr;
        padding: 12px 14px;
        gap: 12px;
    }

    .media-preview {
        height: 90px;
    }

    .detail-hero .muted {
        -webkit-line-clamp: 1;
    }
}

.long-text {
    white-space: pre-wrap;
    line-height: 1.9;
    color: var(--text-soft);
}

/* ==========================================================
   Audio Items
   ========================================================== */
.audio-list {
    display: flex;
    flex-direction: column;
}

.audio-item {
    display: grid;
    grid-template-columns: minmax(160px, 240px) 1fr;
    gap: 14px;
    align-items: center;
    padding: 14px 4px;
    border-bottom: 1px solid var(--border);
}

.audio-item:last-child {
    border-bottom: 0;
}

.audio-item strong {
    color: var(--navy);
    font-weight: 800;
}

audio {
    width: 100%;
    height: 40px;
    border-radius: 999px;
}

audio::-webkit-media-controls-panel {
    background: var(--surface-soft);
}

/* ==========================================================
   Forms
   ========================================================== */
.form-card {
    background: rgba(255, 255, 255, .96);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 22px;
    margin-bottom: 18px;
}

.form-card h2 {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-grid label,
.form-grid > label {
    display: grid;
    gap: 6px;
    color: var(--navy);
    font-weight: 800;
    font-size: .88rem;
}

.form-grid .full,
.form-grid label.full,
.form-grid div.full {
    grid-column: 1 / -1;
}

.form-grid .inline-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 12px;
    align-items: end;
}

.form-grid .inline-row .btn {
    height: 42px;
    align-self: end;
}

@media (max-width: 640px) {
    .form-grid .inline-row {
        grid-template-columns: 1fr;
    }
}

.form-grid .field-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: background .18s var(--ease), border-color .18s var(--ease);
}

.form-grid .field-check:hover {
    background: var(--primary-softer);
    border-color: rgba(15, 118, 110, .3);
}

.form-grid .field-check input {
    width: 18px;
    height: 18px;
    min-height: 18px;
    padding: 0;
    margin: 0;
    accent-color: var(--primary);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    min-height: 42px;
    padding: 10px 12px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: .93rem;
    transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}

input::placeholder,
textarea::placeholder {
    color: #99a4ad;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(15, 118, 110, .14);
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    min-height: auto;
    accent-color: var(--primary);
    cursor: pointer;
}

input[type="file"] {
    padding: 8px;
    background: var(--surface-soft);
    cursor: pointer;
}

input[type="file"]::-webkit-file-upload-button,
input[type="file"]::file-selector-button {
    background: var(--primary);
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 7px 14px;
    font-weight: 800;
    cursor: pointer;
    margin-inline-end: 10px;
    transition: background .18s var(--ease);
}

input[type="file"]::-webkit-file-upload-button:hover,
input[type="file"]::file-selector-button:hover {
    background: var(--primary-dark);
}

textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.7;
}

/* ==========================================================
   Tables
   ========================================================== */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #fff;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border-radius: 14px;
}

.table th,
.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: right;
    font-size: .92rem;
    vertical-align: middle;
}

.table thead th {
    background: linear-gradient(180deg, var(--surface-soft), var(--surface-alt));
    color: var(--navy);
    font-weight: 900;
    font-size: .82rem;
    letter-spacing: .01em;
    text-transform: none;
    border-bottom: 1px solid var(--border-strong);
}

.table tbody tr {
    transition: background .18s var(--ease);
}

.table tbody tr:hover {
    background: rgba(15, 118, 110, .04);
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table td .actions {
    gap: 6px;
    justify-content: flex-end;
}

.table td .actions .btn {
    min-height: 30px;
    padding: 5px 10px;
    font-size: .78rem;
}

/* ==========================================================
   Alerts
   ========================================================== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    font-weight: 700;
    font-size: .92rem;
    line-height: 1.6;
}

.alert::before {
    content: "";
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: .82rem;
    color: #fff;
    margin-top: 1px;
}

.alert.success {
    color: var(--success);
    background: var(--success-soft);
    border-color: rgba(8, 116, 67, .2);
}

.alert.success::before {
    content: "✓";
    background: var(--success);
}

.alert.error {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: rgba(180, 35, 24, .22);
}

.alert.error::before {
    content: "!";
    background: var(--danger);
}

.alert.warning {
    color: var(--warning);
    background: var(--warning-soft);
    border-color: rgba(178, 94, 9, .22);
}

.alert.warning::before {
    content: "!";
    background: var(--warning);
}

.validation-message,
.validation-errors {
    color: var(--danger);
    font-size: .84rem;
    font-weight: 700;
    margin-top: 2px;
}

.validation-errors ul {
    margin: 0;
    padding-inline-start: 18px;
}

/* ==========================================================
   Responsive
   ========================================================== */
/* ==========================================================
   Footer
   ========================================================== */
.yaqeen-footer {
    margin-top: 40px;
    padding: 24px 18px 18px;
    background:
        radial-gradient(circle at 18% 20%, rgba(199, 164, 91, .18), transparent 12rem),
        linear-gradient(180deg, #0b2239 0%, #0a2d38 100%);
    color: rgba(247, 245, 238, .82);
    border-top: 3px solid var(--gold);
}

.yaqeen-footer-inner {
    width: min(1180px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.yaqeen-footer-brand strong {
    display: block;
    color: #fff;
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: -.03em;
}

.yaqeen-footer-brand span {
    color: var(--gold);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .04em;
}

.yaqeen-footer-links {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.yaqeen-footer-links a {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 700;
    color: rgba(247, 245, 238, .82);
    transition: background .18s var(--ease), color .18s var(--ease);
}

.yaqeen-footer-links a:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.yaqeen-footer-copy {
    font-size: .8rem;
    color: rgba(247, 245, 238, .6);
    text-align: left;
}

@media (max-width: 820px) {
    .yaqeen-footer-inner {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .yaqeen-footer-copy {
        text-align: center;
    }
}

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 1040px) {
    .yaqeen-nav-inner {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 8px;
    }

    .yaqeen-nav-links {
        overflow-x: auto;
        width: 100%;
        justify-content: flex-start;
        padding-bottom: 4px;
        flex-wrap: nowrap;
        scrollbar-width: thin;
    }

    .hero {
        grid-template-columns: 1fr;
    }

    .hero-art {
        min-height: 235px;
    }

    .arch-card {
        height: 235px;
        width: min(320px, 100%);
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .yaqeen-main {
        padding: 14px !important;
    }

    .grid,
    .cards-grid,
    .two-columns {
        grid-template-columns: 1fr 1fr;
    }

    .stats-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-top: 12px;
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-title,
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    /* Mobile-friendly tables: cards */
    .table thead {
        display: none;
    }

    .table,
    .table tbody,
    .table tr,
    .table td {
        display: block;
        width: 100%;
    }

    .table tbody tr {
        border: 1px solid var(--border);
        border-radius: 14px;
        padding: 8px;
        margin-bottom: 10px;
        background: #fff;
    }

    .table tbody tr:hover {
        background: #fff;
    }

    .table td {
        border-bottom: 1px dashed var(--border);
        padding: 8px 4px;
        text-align: right;
        display: grid;
        grid-template-columns: 100px 1fr;
        gap: 8px;
        align-items: center;
    }

    .table td:last-child {
        border-bottom: 0;
    }

    .table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-weight: 800;
        font-size: .78rem;
    }

    .audio-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

@media (max-width: 560px) {
    .yaqeen-top-nav {
        padding: 8px 10px;
    }

    .yaqeen-brand-mark,
    .yaqeen-brand-mark svg {
        width: 36px;
        height: 30px;
    }

    .yaqeen-brand strong {
        font-size: 1.1rem;
    }

    .yaqeen-nav-link {
        min-height: 32px;
        padding: 5px 9px;
        font-size: .8rem;
    }

    .hero {
        padding: 18px;
        border-radius: 20px;
    }

    .compact-hero {
        min-height: auto;
    }

    .hero-features,
    .grid,
    .cards-grid,
    .two-columns {
        grid-template-columns: 1fr;
    }

    .hero-art {
        display: none;
    }

    .card,
    .compact-card {
        padding: 14px;
    }

    .course-img,
    .course-placeholder {
        height: 120px;
    }

    .book-cover {
        height: 170px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card .metric {
        font-size: 1.9rem;
    }

    .form-card {
        padding: 16px;
    }
}
