/* EduAstroBD UI - Bootstrap 5 base with a calm navy / teal brand. */
:root {
    --brand: #1d3c78;
    --brand-2: #0f9d8a;
    --accent: #f59e0b;
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --hover: #f1f4fa;
    --brand-soft: #e8eefb;
    --brand-ink: #1d3c78;
    --line: #e3e7ef;
    --text: #1f2937;
    --text-2: #374151;
    --muted: #6b7280;
    --icon: #64748b;
    --sidebar-w: 248px;
    --topbar-h: 56px;
    --bs-primary: #1d3c78;
    --bs-primary-rgb: 29, 60, 120;
    --bs-link-color: #1d3c78;
    --bs-link-color-rgb: 29, 60, 120;
}

body {
    font-family: "Inter", "Hind Siliguri", system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}

.bn, [lang="bn"] { font-family: "Hind Siliguri", "Inter", sans-serif; }

.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: #16305f; --bs-btn-hover-border-color: #16305f; --bs-btn-active-bg: #122851; }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); }
.text-accent { color: var(--brand-2); }
.text-bg-brand { background: var(--brand); color: #fff; }

/* ---------- App shell ---------- */
.topbar {
    position: sticky; top: 0; z-index: 1030;
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.topbar .brand { color: var(--brand-ink); font-size: 1.1rem; }
.topbar .org-name { max-width: 280px; }
.avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--brand); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 600;
}
.role-teacher .avatar { background: var(--brand-2); }
.role-student .avatar { background: #7c3aed; }
.role-super_admin .avatar { background: #b91c1c; }

.shell { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--line);
}
@media (min-width: 992px) {
    .sidebar { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; flex-shrink: 0; }
}
.content { flex: 1; min-width: 0; padding: 1.25rem; }
@media (min-width: 1200px) { .content { padding: 1.75rem 2rem; } }

.nav-menu { padding: .5rem 0 2rem; }
.nav-menu .nav-title {
    font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
    color: var(--muted); padding: 1rem 1.25rem .35rem;
}
.nav-menu a {
    display: flex; align-items: center; gap: .65rem;
    padding: .45rem 1.25rem; margin: 1px .5rem;
    border-radius: 8px; color: var(--text-2); text-decoration: none; font-size: .92rem;
}
.nav-menu a i { font-size: 1.05rem; color: var(--icon); }
.nav-menu a:hover { background: var(--hover); }
.nav-menu a.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.nav-menu a.active i { color: var(--brand-ink); }

/* ---------- Page pieces ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.4rem; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--muted); font-size: .9rem; }
.page-head .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }

.card { --bs-card-bg: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.card-header { background: var(--surface); border-bottom: 1px solid var(--line); font-weight: 600; }

.stat { padding: 1rem 1.1rem; }
.stat .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.55rem; font-weight: 700; color: var(--text); }
.stat .icon {
    width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
    background: var(--brand-soft); color: var(--brand-ink); font-size: 1.2rem;
}
.stat .icon.teal { background: #e0f5f1; color: var(--brand-2); }
.stat .icon.amber { background: #fef3c7; color: #b45309; }
.stat .icon.red { background: #fee2e2; color: #b91c1c; }

.table { --bs-table-bg: transparent; }
.table > :not(caption) > * > * { padding: .55rem .65rem; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.table-card { overflow-x: auto; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.empty i { font-size: 2rem; display: block; margin-bottom: .5rem; color: var(--line); }

.form-label { font-weight: 500; font-size: .88rem; }
.req::after { content: " *"; color: #dc2626; }

.marks-input { width: 74px; text-align: right; }
.att-btn .btn { min-width: 38px; }

.badge-status { font-weight: 600; }
.status-SUBMITTED { background: #e0e7ff; color: #3730a3; }
.status-VERIFIED { background: #dbeafe; color: #1e40af; }
.status-SELECTED { background: #dcfce7; color: #166534; }
.status-ADMITTED { background: #bbf7d0; color: #14532d; }
.status-WAITING { background: #fef3c7; color: #92400e; }
.status-REJECTED { background: #fee2e2; color: #991b1b; }

.grade-F { color: #b91c1c; font-weight: 700; }
.grade-Aplus { color: #15803d; font-weight: 700; }

.lesson-body img { max-width: 100%; height: auto; }
.lesson-body table { border-collapse: collapse; }
.lesson-body td, .lesson-body th { border: 1px solid var(--line); padding: .35rem .5rem; }

/* ---------- Public pages ---------- */
.public { background: var(--surface); }
.public-nav { border-bottom: 1px solid var(--line); background: var(--surface); }
.public-nav .navbar-brand { color: var(--brand-ink); }
.hero {
    background: linear-gradient(135deg, #102a5c 0%, #1d3c78 55%, #0f9d8a 100%);
    color: #fff; padding: 4.5rem 0 4rem;
}
.hero h1 { font-weight: 800; font-size: clamp(1.9rem, 4vw, 3rem); line-height: 1.15; }
.hero .lead { color: #dbe4ff; }
.feature { padding: 1.25rem; border: 1px solid var(--line); border-radius: 14px; height: 100%; background: var(--surface); }
.feature i { font-size: 1.6rem; color: var(--brand-2); }
.price-card { border: 1px solid var(--line); border-radius: 16px; padding: 1.5rem; height: 100%; background: var(--surface); }
.price-card.featured { border: 2px solid var(--brand-ink); box-shadow: 0 8px 24px rgba(29,60,120,.12); }
.price-card .price { font-size: 2rem; font-weight: 800; }
.public-footer { border-top: 1px solid var(--line); }
.auth-card { max-width: 420px; margin: 3rem auto; }
.wizard-step { border-left: 3px solid var(--brand); padding-left: 1rem; margin-bottom: 1.5rem; }
.wizard-step h2 { font-size: 1.05rem; font-weight: 700; }


/* ---------- Landing page ---------- */
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
.hero-lg { padding: 4.5rem 0 5rem; }
.hero-pill { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: .35rem .9rem; display: inline-block; font-size: .88rem; }
.hero-checks li { color: #dbe4ff; }
.hero-checks i { color: #fbbf24; margin-right: .35rem; }
.landing-mock { background: #fff; color: #1f2937; border-radius: 14px; overflow: hidden; border: 1px solid rgba(255,255,255,.3); font-size: .8rem; }
.landing-mock .mock-bar { display: flex; align-items: center; gap: 6px; padding: .55rem .8rem; background: #eef1f7; border-bottom: 1px solid #e3e7ef; }
.landing-mock .mock-bar > span { width: 10px; height: 10px; border-radius: 50%; background: #f87171; }
.landing-mock .mock-bar > span:nth-child(2) { background: #fbbf24; }
.landing-mock .mock-bar > span:nth-child(3) { background: #34d399; }
.landing-mock .mock-url { margin-left: .6rem; flex: 1; background: #fff; border-radius: 6px; padding: .1rem .6rem; color: #6b7280; font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.landing-mock .mock-body { padding: .9rem; background: #f4f6fb; }
.landing-mock .mock-stat, .landing-mock .mock-card { background: #fff; border: 1px solid #e3e7ef; border-radius: 10px; padding: .6rem .7rem; }
.landing-mock .mock-stat .l { color: #6b7280; font-size: .66rem; text-transform: uppercase; letter-spacing: .04em; }
.landing-mock .mock-stat .v { font-size: 1.15rem; font-weight: 700; }
.landing-mock .mock-title { font-weight: 600; margin-bottom: .4rem; }
.landing-mock .mock-row { display: grid; grid-template-columns: 2.4rem 1fr 3rem 3rem 3rem; padding: .32rem 0; border-top: 1px solid #eef1f7; }
.landing-mock .mock-row.head { color: #6b7280; font-size: .66rem; text-transform: uppercase; border-top: 0; }
.landing-mock .small-card { font-size: .74rem; line-height: 1.45; }
.landing-mock .mock-muted { color: #6b7280; }
.key-facts .kf-value { font-size: 1.45rem; font-weight: 800; color: var(--brand-ink); }
.key-facts .kf-label { font-size: .82rem; color: var(--muted); }
.section-kicker { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-2); margin-bottom: .35rem; }
.section-title { font-weight: 800; font-size: clamp(1.5rem, 3vw, 2.1rem); margin-bottom: .6rem; }
.section-alt { background: var(--bg); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.type-tile { border: 1px solid var(--line); border-radius: 14px; padding: 1rem .5rem; background: var(--surface); height: 100%; }
.type-tile i { font-size: 1.6rem; color: var(--brand-ink); display: block; margin-bottom: .35rem; }
.type-tile div { font-weight: 600; }
.type-tile small { color: var(--muted); }
.feature h3 { font-weight: 700; }
.feature-list { list-style: none; padding-left: 0; margin-bottom: 0; font-size: .86rem; }
.feature-list li { position: relative; padding-left: 1.4rem; margin-bottom: .3rem; color: var(--text-2); }
.feature-list li::before { content: "\F26E"; font-family: "bootstrap-icons"; position: absolute; left: 0; top: 0; color: var(--brand-2); }
.step { position: relative; padding: 1.25rem; border: 1px solid var(--line); border-radius: 14px; height: 100%; background: var(--surface); }
.step-no { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-bottom: .75rem; }
.role-card { padding: 1.25rem; border: 1px solid var(--line); border-radius: 14px; height: 100%; background: var(--surface); }
.role-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; background: var(--brand-soft); color: var(--brand-ink); }
.role-icon.teal { background: #e0f5f1; color: #0f9d8a; }
.role-icon.amber { background: #fef3c7; color: #b45309; }
.role-icon.violet { background: #ede9fe; color: #6d28d9; }
.bd-point { display: flex; gap: .75rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; height: 100%; background: var(--surface); }
.bd-point > i { font-size: 1.4rem; color: var(--brand-2); }
.guardian-band { background: linear-gradient(120deg, #0f9d8a, #1d3c78); color: #fff; }
.info-panel { padding: 1.75rem; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.cta-band { padding: 3rem 1.5rem; border-radius: 20px; color: #fff; background: linear-gradient(135deg, #102a5c 0%, #1d3c78 55%, #0f9d8a 100%); }
.public-footer { background: var(--bg); }
.public-footer .footer-brand { color: var(--brand-ink); }
.accordion-button { font-weight: 600; }
[data-bs-theme="dark"] .role-icon.teal { background: #10403b; color: #4fd1bd; }
[data-bs-theme="dark"] .role-icon.amber { background: #3d2e0b; color: #fbbf24; }
[data-bs-theme="dark"] .role-icon.violet { background: #2e1f5c; color: #c4b5fd; }
[data-bs-theme="dark"] .guardian-band { background: linear-gradient(120deg, #0b6d60, #142b57); }
[data-bs-theme="dark"] .cta-band { background: linear-gradient(135deg, #0a1733 0%, #142b57 55%, #0b6d60 100%); }
[data-bs-theme="dark"] .accordion { --bs-accordion-bg: var(--surface); --bs-accordion-border-color: var(--line); --bs-accordion-active-bg: #1f3366; --bs-accordion-active-color: #dbe4ff; }

/* ---------- Rich text (editor + rendered content) ---------- */
.lesson-body { overflow-wrap: anywhere; }
.lesson-body > :last-child { margin-bottom: 0; }
.lesson-body blockquote { border-left: 3px solid var(--line); padding-left: .75rem; color: var(--muted); }
.lesson-body pre, .lesson-body .ql-code-block-container { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; white-space: pre-wrap; }
.lesson-body .ql-align-center { text-align: center; }
.lesson-body .ql-align-right { text-align: right; }
.lesson-body .ql-align-justify { text-align: justify; }
.lesson-body .ql-indent-1 { padding-left: 2em; }
.lesson-body .ql-indent-2 { padding-left: 4em; }
.lesson-body .ql-indent-3 { padding-left: 6em; }
.lesson-body li[data-list="bullet"] { list-style-type: disc; }
.lesson-body ol:has(> li[data-list="bullet"]) { padding-left: 1.5rem; }
.rich-inline { display: inline-block; vertical-align: top; }
.rich-inline > p { margin-bottom: .2rem; }

.rte { border-radius: 8px; background: var(--surface); }
.rte .ql-toolbar.ql-snow { border-color: var(--line); border-radius: 8px 8px 0 0; background: var(--surface-2); }
.rte .ql-container.ql-snow { border-color: var(--line); border-radius: 0 0 8px 8px; font-family: inherit; font-size: .95rem; }
.rte .ql-editor { min-height: inherit; color: var(--text); }
.rte .ql-editor.ql-blank::before { color: var(--muted); font-style: normal; }
.rte.is-invalid .ql-container.ql-snow, .rte.is-invalid .ql-toolbar.ql-snow { border-color: #dc3545; }
.rte > div:last-child { min-height: inherit; }

/* ---------- Theme toggle / install ---------- */
.theme-toggle { width: 34px; height: 31px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }

/* =====================================================================================
 * Dark mode: Bootstrap 5.3 handles its own components through data-bs-theme="dark";
 * these rules re-colour the app's own pieces.
 * ===================================================================================== */
[data-bs-theme="dark"] {
    color-scheme: dark;
    --bg: #0d1424;
    --surface: #151e33;
    --surface-2: #1a2540;
    --hover: #1e2a47;
    --brand-soft: #1f3366;
    --brand-ink: #8fb0ff;
    --line: #26314a;
    --text: #e5e9f2;
    --text-2: #cfd6e4;
    --muted: #9aa4b8;
    --icon: #8b97ad;
    --bs-body-bg: #0d1424;
    --bs-body-color: #e5e9f2;
    --bs-secondary-bg: #151e33;
    --bs-tertiary-bg: #1a2540;
    --bs-border-color: #26314a;
    --bs-link-color: #8fb0ff;
    --bs-link-color-rgb: 143, 176, 255;
    --bs-link-hover-color: #b5ccff;
    --bs-link-hover-color-rgb: 181, 204, 255;
    --bs-primary-text-emphasis: #b5ccff;
    --bs-primary-bg-subtle: #1f3366;
}
[data-bs-theme="dark"] .btn-primary { --bs-btn-bg: #2f5bb3; --bs-btn-border-color: #2f5bb3; --bs-btn-hover-bg: #3a6ad0; --bs-btn-hover-border-color: #3a6ad0; --bs-btn-active-bg: #284f9d; --bs-btn-disabled-bg: #2f5bb3; --bs-btn-disabled-border-color: #2f5bb3; }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #8fb0ff; --bs-btn-border-color: #4a6fbd; --bs-btn-hover-bg: #2f5bb3; --bs-btn-hover-border-color: #2f5bb3; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #284f9d; }
[data-bs-theme="dark"] .btn-light { --bs-btn-bg: #1e2a47; --bs-btn-border-color: #2b3958; --bs-btn-color: #e5e9f2; --bs-btn-hover-bg: #26345a; --bs-btn-hover-border-color: #33446c; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #2b3a62; --bs-btn-active-color: #fff; }
[data-bs-theme="dark"] .btn-outline-dark { --bs-btn-color: #e5e9f2; --bs-btn-border-color: #5b6880; --bs-btn-hover-bg: #e5e9f2; --bs-btn-hover-color: #0d1424; --bs-btn-hover-border-color: #e5e9f2; }
[data-bs-theme="dark"] .text-bg-light { background-color: #1e2a47 !important; color: #dbe3f2 !important; }
[data-bs-theme="dark"] .text-muted { color: var(--muted) !important; }
[data-bs-theme="dark"] .card { box-shadow: none; }
[data-bs-theme="dark"] .table { --bs-table-color: var(--text); --bs-table-border-color: var(--line); --bs-table-hover-bg: rgba(255,255,255,.035); --bs-table-striped-bg: rgba(255,255,255,.025); }
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select { background-color: #10192d; border-color: #2b3958; }
[data-bs-theme="dark"] .form-control:disabled, [data-bs-theme="dark"] .form-control[readonly] { background-color: #1a2540; }
[data-bs-theme="dark"] .form-control:focus, [data-bs-theme="dark"] .form-select:focus { border-color: #4a6fbd; box-shadow: 0 0 0 .2rem rgba(74,111,189,.25); }
[data-bs-theme="dark"] .dropdown-menu { --bs-dropdown-bg: #18223a; --bs-dropdown-border-color: #2b3958; --bs-dropdown-link-hover-bg: #22305a; }
[data-bs-theme="dark"] .list-group { --bs-list-group-bg: var(--surface); --bs-list-group-border-color: var(--line); }
[data-bs-theme="dark"] .offcanvas { --bs-offcanvas-bg: var(--surface); }
[data-bs-theme="dark"] .text-accent { color: #33c7b2; }
[data-bs-theme="dark"] .stat .icon.teal { background: #10403b; color: #4fd1bd; }
[data-bs-theme="dark"] .stat .icon.amber { background: #3d2e0b; color: #fbbf24; }
[data-bs-theme="dark"] .stat .icon.red { background: #431717; color: #f87171; }
[data-bs-theme="dark"] .status-SUBMITTED { background: #262a5c; color: #c7d2fe; }
[data-bs-theme="dark"] .status-VERIFIED { background: #1c3260; color: #bfdbfe; }
[data-bs-theme="dark"] .status-SELECTED { background: #12402a; color: #bbf7d0; }
[data-bs-theme="dark"] .status-ADMITTED { background: #14532d; color: #dcfce7; }
[data-bs-theme="dark"] .status-WAITING { background: #45330c; color: #fde68a; }
[data-bs-theme="dark"] .status-REJECTED { background: #4c1717; color: #fecaca; }
[data-bs-theme="dark"] .grade-F { color: #f87171; }
[data-bs-theme="dark"] .grade-Aplus { color: #4ade80; }
[data-bs-theme="dark"] .alert-warning { --bs-alert-bg: #3a2e0e; --bs-alert-border-color: #5c4914; --bs-alert-color: #fde68a; }
[data-bs-theme="dark"] .alert-info { --bs-alert-bg: #0f2f3f; --bs-alert-border-color: #164b63; --bs-alert-color: #bae6fd; }
[data-bs-theme="dark"] .alert-success { --bs-alert-bg: #0f3324; --bs-alert-border-color: #175238; --bs-alert-color: #bbf7d0; }
[data-bs-theme="dark"] .alert-danger { --bs-alert-bg: #3b1316; --bs-alert-border-color: #5f1d22; --bs-alert-color: #fecaca; }
[data-bs-theme="dark"] .hero { background: linear-gradient(135deg, #0a1733 0%, #142b57 55%, #0b6d60 100%); }
[data-bs-theme="dark"] .rte .ql-snow .ql-stroke { stroke: #cfd6e4; }
[data-bs-theme="dark"] .rte .ql-snow .ql-fill, [data-bs-theme="dark"] .rte .ql-snow .ql-stroke.ql-fill { fill: #cfd6e4; }
[data-bs-theme="dark"] .rte .ql-snow .ql-picker { color: #cfd6e4; }
[data-bs-theme="dark"] .rte .ql-snow .ql-picker-options { background: #18223a; border-color: #2b3958; }
[data-bs-theme="dark"] .rte .ql-snow.ql-toolbar button:hover .ql-stroke,
[data-bs-theme="dark"] .rte .ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: #8fb0ff; }
[data-bs-theme="dark"] .rte .ql-snow.ql-toolbar button:hover .ql-fill,
[data-bs-theme="dark"] .rte .ql-snow.ql-toolbar button.ql-active .ql-fill { fill: #8fb0ff; }
[data-bs-theme="dark"] .rte .ql-snow .ql-tooltip { background: #18223a; border-color: #2b3958; color: var(--text); box-shadow: none; }
[data-bs-theme="dark"] .rte .ql-snow .ql-tooltip input[type=text] { background: #10192d; border-color: #2b3958; color: var(--text); }
[data-bs-theme="dark"] .landing-mock, [data-bs-theme="dark"] .landing-mock .mock-row { border-color: #2b3958; }
@media (prefers-reduced-motion: no-preference) {
    body, .topbar, .sidebar, .card { transition: background-color .2s ease, border-color .2s ease; }
}
.card-footer.bg-body, .card-header.bg-body { background-color: var(--surface) !important; }

/* =====================================================================================
 * Responsive: phones and tablets
 * ===================================================================================== */
.min-w-0 { min-width: 0; }
.narrow-page { max-width: 1040px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.kv-table th { width: 38%; color: var(--muted); font-weight: 500; font-size: .85rem; }
.kv-table th, .kv-table td { padding: .5rem .9rem !important; }

/* Section pills (in-page navigation), scroll sideways on phones */
.section-tabs { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: thin; }
.section-tabs a { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; padding: .45rem .85rem; border: 1px solid var(--line);
    border-radius: 999px; background: var(--surface); color: var(--text-2); text-decoration: none; font-size: .88rem; font-weight: 500; }
.section-tabs a:hover { background: var(--hover); color: var(--brand-ink); }
section[id] { scroll-margin-top: calc(var(--topbar-h) + 12px); }

/* Organization status badges */
.org-status { font-weight: 600; }
.os-TRIAL { background: #e0f2fe; color: #075985; }
.os-ACTIVE { background: #dcfce7; color: #166534; }
.os-GRACE { background: #fef3c7; color: #92400e; }
.os-SUSPENDED { background: #fee2e2; color: #991b1b; }
.os-ARCHIVED { background: #e5e7eb; color: #374151; }
.os-PENDING_PAYMENT { background: #ede9fe; color: #5b21b6; }
[data-bs-theme="dark"] .os-TRIAL { background: #0c3a52; color: #bae6fd; }
[data-bs-theme="dark"] .os-ACTIVE { background: #12402a; color: #bbf7d0; }
[data-bs-theme="dark"] .os-GRACE { background: #45330c; color: #fde68a; }
[data-bs-theme="dark"] .os-SUSPENDED { background: #4c1717; color: #fecaca; }
[data-bs-theme="dark"] .os-ARCHIVED { background: #2b3348; color: #cbd5e1; }
[data-bs-theme="dark"] .os-PENDING_PAYMENT { background: #2e1f5c; color: #ddd6fe; }

/* Bottom navigation bar (phones / small tablets) */
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035;
    display: flex; justify-content: space-around; align-items: stretch;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(16, 24, 40, .06);
}
.bottom-nav a, .bottom-nav button {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    padding: 6px 2px; border: 0; background: none; border-radius: 10px;
    color: var(--muted); text-decoration: none; font-size: .7rem; font-weight: 500; line-height: 1.1;
}
.bottom-nav i { font-size: 1.25rem; }
.bottom-nav span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bottom-nav a.active { color: var(--brand-ink); background: var(--brand-soft); }
.bottom-nav a:active, .bottom-nav button:active { background: var(--hover); }

@media (max-width: 991.98px) {
    .has-bottom-nav .content { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
    .sidebar.offcanvas-lg { --bs-offcanvas-width: min(300px, 86vw); }
}

@media (max-width: 767.98px) {
    :root { --topbar-h: 54px; }
    .content { padding: .9rem .8rem; }
    .topbar { gap: .35rem !important; padding-left: .6rem !important; padding-right: .6rem !important; }
    .topbar .brand span { font-size: 1rem; }
    .page-head { gap: .6rem; margin-bottom: 1rem; }
    .page-head h1 { font-size: 1.2rem; }
    .page-head > div:first-child { min-width: 0; flex: 1 1 100%; }
    .page-head .actions { margin-left: 0; width: 100%; }
    .page-head .actions > .btn, .page-head .actions > form, .page-head .actions > a { flex: 1 1 auto; }
    .page-head .actions > form .btn { width: 100%; }
    .card-body { padding: .9rem; }
    .stat { padding: .8rem .9rem; }
    .stat .value { font-size: 1.3rem; }
    .form-actions > .btn { flex: 1 1 auto; }
    /* 16px inputs stop iOS from zooming into fields */
    .form-control, .form-select, .input-group-text { font-size: 16px; }
    .btn { min-height: 38px; }
    .btn-sm { min-height: 34px; }
    .modal-dialog { margin: .5rem; }
    .alert { font-size: .9rem; }

    /* Listing tables become cards */
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody { display: block; width: 100%; }
    .table-stack tr { display: block; padding: .65rem .85rem; border-bottom: 1px solid var(--line); }
    .table-stack tr:last-child { border-bottom: 0; }
    .table-stack > :not(caption) > * > *, .table-stack td, .table-stack th {
        display: flex; gap: .75rem; justify-content: space-between; align-items: flex-start;
        padding: .22rem 0 !important; border: 0 !important; text-align: right !important; background: transparent;
    }
    .table-stack td::before { content: attr(data-label); flex: 0 0 40%; max-width: 40%; text-align: left; color: var(--muted);
        font-size: .76rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; padding-top: .15rem; }
    .table-stack td:not([data-label])::before, .table-stack td[data-label=""]::before { display: none; }
    .table-stack td:first-child { display: block; font-size: 1rem; text-align: left !important; padding-bottom: .35rem !important; }
    .table-stack td:first-child::before { display: none; }
    .table-stack td:first-child > * { text-align: left; }
    .table-stack td > div, .table-stack td > b { text-align: inherit; }
    .table-stack td:last-child.text-end, .table-stack td.text-nowrap:last-child { justify-content: flex-end; flex-wrap: wrap; white-space: normal; padding-top: .5rem !important; }
    .table-stack td:last-child.text-end::before, .table-stack td.text-nowrap:last-child::before { display: none; }
    .table-stack td.empty, .table-stack td[colspan] { display: block; text-align: center !important; }
    .table-stack td.empty::before, .table-stack td[colspan]::before { display: none; }
    .table-card { border-radius: 12px; }
}

@media (max-width: 575.98px) {
    .page-head .actions > .btn, .page-head .actions > a.btn { font-size: .85rem; }
    .section-tabs a { padding: .4rem .7rem; font-size: .82rem; }
    .auth-card { margin: 1.25rem auto; }
    .card-footer .btn:not(.btn-sm) { flex: 1 1 auto; }
    .public-nav .navbar-brand img { width: 28px; height: 28px; }
}

@media print {
    .bottom-nav, .topbar, .sidebar { display: none !important; }
}

/* =====================================================================================
 * Public site: green textured theme (landing, sign-up, admission, sign-in pages)
 * ===================================================================================== */
.public-green {
    --brand: #047857;
    --brand-2: #10b981;
    --brand-ink: #046c4e;
    --brand-soft: #dcfce7;
    --bg: #f3faf6;
    --line: #d7eadf;
    --bs-primary: #047857;
    --bs-primary-rgb: 4, 120, 87;
    --bs-link-color: #047857;
    --bs-link-color-rgb: 4, 120, 87;
    --bs-link-hover-color: #065f46;
    --bs-link-hover-color-rgb: 6, 95, 70;
    --leaf-texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.07' stroke-width='1.2'%3E%3Cpath d='M20 60c10-18 30-18 40 0-10 18-30 18-40 0z'/%3E%3Cpath d='M20 60h40'/%3E%3Cpath d='M80 20c8-14 24-14 32 0-8 14-24 14-32 0z'/%3E%3Cpath d='M80 20h32'/%3E%3Cpath d='M80 100c8-14 24-14 32 0-8 14-24 14-32 0z'/%3E%3Cpath d='M80 100h32'/%3E%3C/g%3E%3Cg fill='%23ffffff' fill-opacity='.06'%3E%3Ccircle cx='10' cy='10' r='1.6'/%3E%3Ccircle cx='70' cy='70' r='1.6'/%3E%3Ccircle cx='40' cy='100' r='1.6'/%3E%3Ccircle cx='100' cy='55' r='1.6'/%3E%3C/g%3E%3C/svg%3E");
    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    --dot-texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22'%3E%3Ccircle cx='2' cy='2' r='1.1' fill='%23047857' fill-opacity='.10'/%3E%3C/svg%3E");
}
.public-green .btn-primary { --bs-btn-bg: #047857; --bs-btn-border-color: #047857; --bs-btn-hover-bg: #065f46; --bs-btn-hover-border-color: #065f46;
    --bs-btn-active-bg: #064e3b; --bs-btn-active-border-color: #064e3b; --bs-btn-disabled-bg: #047857; --bs-btn-disabled-border-color: #047857; }
.public-green .btn-outline-primary { --bs-btn-color: #047857; --bs-btn-border-color: #047857; --bs-btn-hover-bg: #047857; --bs-btn-hover-border-color: #047857;
    --bs-btn-hover-color: #fff; --bs-btn-active-bg: #065f46; --bs-btn-active-border-color: #065f46; }
.public-green .text-bg-primary { background-color: #047857 !important; }
.public-green .text-accent { color: #10b981; }
.public-green .form-control:focus, .public-green .form-select:focus { border-color: #34d399; box-shadow: 0 0 0 .2rem rgba(16, 185, 129, .2); }
.public-green .form-check-input:checked { background-color: #047857; border-color: #047857; }
.public-green .public-nav { background: rgba(255, 255, 255, .92); backdrop-filter: saturate(160%) blur(8px); }
.public-green .public-nav .nav-link:hover { color: #047857; }
.public-green .wizard-step { border-left-color: #10b981; }
.public-green .public-footer { background: #ecf7f0 var(--dot-texture); }

/* Hero, guardian band and CTA: deep green with leaf texture + fine grain */
.landing-green .hero,
.public-green .hero {
    position: relative; isolation: isolate;
    background:
        var(--grain),
        var(--leaf-texture),
        radial-gradient(1200px 500px at 85% -10%, rgba(52, 211, 153, .35), transparent 60%),
        radial-gradient(800px 420px at -10% 110%, rgba(250, 204, 21, .14), transparent 60%),
        linear-gradient(140deg, #022c22 0%, #064e3b 38%, #047857 78%, #059669 100%);
}
.landing-green .hero::after {
    content: ""; position: absolute; inset: auto 0 -1px 0; height: 42px; z-index: -1;
    background: var(--surface);
    clip-path: polygon(0 100%, 100% 100%, 100% 0, 75% 60%, 50% 30%, 25% 70%, 0 20%);
}
.landing-green .hero .lead { color: #d1fae5; }
.landing-green .hero-pill { background: rgba(255, 255, 255, .1); border-color: rgba(167, 243, 208, .35); color: #ecfdf5; }
.landing-green .hero-checks li { color: #d1fae5; }
.landing-green .hero-checks i { color: #facc15; }
.landing-green .hero .btn-warning { --bs-btn-bg: #facc15; --bs-btn-border-color: #facc15; --bs-btn-hover-bg: #fde047; --bs-btn-hover-border-color: #fde047; color: #052e16; }
.landing-green .landing-mock { border-color: rgba(167, 243, 208, .35); box-shadow: 0 30px 60px -20px rgba(2, 44, 34, .6) !important; }
.landing-green .landing-mock .mock-stat .v.text-success { color: #047857 !important; }

.landing-green .key-facts .kf-value { color: #047857; }
.landing-green .section-kicker { color: #059669; }
.landing-green .section-alt {
    background: var(--dot-texture), linear-gradient(180deg, #f0fdf4, #ecfdf5);
    border-color: #d1fae5;
}
.landing-green .feature, .landing-green .type-tile, .landing-green .step, .landing-green .role-card,
.landing-green .bd-point, .landing-green .info-panel, .landing-green .price-card {
    border-color: #d7eadf; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.landing-green .feature:hover, .landing-green .type-tile:hover, .landing-green .role-card:hover, .landing-green .bd-point:hover {
    transform: translateY(-2px); border-color: #86efac; box-shadow: 0 10px 24px -12px rgba(4, 120, 87, .35);
}
.landing-green .feature i, .landing-green .bd-point > i, .landing-green .type-tile i { color: #047857; }
.landing-green .feature-list li::before { color: #10b981; }
.landing-green .step-no { background: linear-gradient(135deg, #047857, #10b981); }
.landing-green .role-icon { background: #dcfce7; color: #047857; }
.landing-green .price-card.featured { border-color: #047857; box-shadow: 0 12px 30px -10px rgba(4, 120, 87, .35); }
.landing-green .guardian-band,
.landing-green .cta-band {
    background: var(--grain), var(--leaf-texture), linear-gradient(120deg, #064e3b, #047857 60%, #0d9488);
}
.landing-green .guardian-band .btn-warning, .landing-green .cta-band .btn-warning {
    --bs-btn-bg: #facc15; --bs-btn-border-color: #facc15; --bs-btn-hover-bg: #fde047; --bs-btn-hover-border-color: #fde047; color: #052e16;
}
.landing-green .accordion { --bs-accordion-active-bg: #dcfce7; --bs-accordion-active-color: #065f46; --bs-accordion-btn-focus-box-shadow: 0 0 0 .2rem rgba(16, 185, 129, .2); }

/* Green theme in dark mode */
[data-bs-theme="dark"] .public-green {
    --brand-ink: #6ee7b7;
    --brand-soft: #064e3b;
    --bg: #07140f;
    --surface: #0c1d16;
    --surface-2: #10261d;
    --hover: #12301f;
    --line: #1b3a2c;
    --bs-body-bg: #07140f;
    --bs-link-color: #6ee7b7;
    --bs-link-color-rgb: 110, 231, 183;
    --bs-link-hover-color: #a7f3d0;
    --bs-link-hover-color-rgb: 167, 243, 208;
    --dot-texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22'%3E%3Ccircle cx='2' cy='2' r='1.1' fill='%2334d399' fill-opacity='.08'/%3E%3C/svg%3E");
}
[data-bs-theme="dark"] .public-green .btn-primary { --bs-btn-bg: #059669; --bs-btn-border-color: #059669; --bs-btn-hover-bg: #10b981; --bs-btn-hover-border-color: #10b981; }
[data-bs-theme="dark"] .public-green .btn-outline-primary { --bs-btn-color: #6ee7b7; --bs-btn-border-color: #10b981; --bs-btn-hover-bg: #059669; --bs-btn-hover-border-color: #059669; }
[data-bs-theme="dark"] .public-green .public-nav { background: rgba(12, 29, 22, .9); }
[data-bs-theme="dark"] .public-green .public-footer { background: #0a1913 var(--dot-texture); }
[data-bs-theme="dark"] .landing-green .hero, [data-bs-theme="dark"] .public-green .hero {
    background: var(--grain), var(--leaf-texture),
        radial-gradient(1200px 500px at 85% -10%, rgba(16, 185, 129, .22), transparent 60%),
        linear-gradient(140deg, #011a14 0%, #033d2e 45%, #065f46 100%);
}
[data-bs-theme="dark"] .landing-green .section-alt { background: var(--dot-texture), linear-gradient(180deg, #0a1913, #0c1d16); border-color: #1b3a2c; }
[data-bs-theme="dark"] .landing-green .key-facts .kf-value { color: #6ee7b7; }
[data-bs-theme="dark"] .landing-green .feature i, [data-bs-theme="dark"] .landing-green .bd-point > i, [data-bs-theme="dark"] .landing-green .type-tile i { color: #34d399; }
[data-bs-theme="dark"] .landing-green .role-icon { background: #064e3b; color: #6ee7b7; }
[data-bs-theme="dark"] .landing-green .feature:hover, [data-bs-theme="dark"] .landing-green .type-tile:hover,
[data-bs-theme="dark"] .landing-green .role-card:hover, [data-bs-theme="dark"] .landing-green .bd-point:hover { border-color: #047857; }
[data-bs-theme="dark"] .landing-green .guardian-band, [data-bs-theme="dark"] .landing-green .cta-band {
    background: var(--grain), var(--leaf-texture), linear-gradient(120deg, #022c22, #065f46 60%, #0f766e);
}
[data-bs-theme="dark"] .landing-green .accordion { --bs-accordion-bg: var(--surface); --bs-accordion-border-color: var(--line); --bs-accordion-active-bg: #064e3b; --bs-accordion-active-color: #d1fae5; }
[data-bs-theme="dark"] .landing-green .price-card.featured { border-color: #10b981; }

@media (max-width: 767.98px) {
    .landing-green .hero-lg { padding: 3rem 0 3.5rem; }
    .landing-green .hero h1 { font-size: 1.85rem; }
    .landing-green .hero .btn-lg { width: 100%; }
    .landing-green .cta-band .btn-lg { width: 100%; }
    .landing-green .landing-mock { font-size: .72rem; }
    .landing-green .landing-mock .mock-row { grid-template-columns: 2rem 1fr 2.6rem 2.6rem 2.6rem; }
    .landing-green .key-facts .kf-value { font-size: 1.2rem; }
}
[data-bs-theme="dark"] .landing-green .feature, [data-bs-theme="dark"] .landing-green .type-tile, [data-bs-theme="dark"] .landing-green .step,
[data-bs-theme="dark"] .landing-green .role-card, [data-bs-theme="dark"] .landing-green .bd-point, [data-bs-theme="dark"] .landing-green .info-panel,
[data-bs-theme="dark"] .landing-green .price-card { border-color: var(--line); }
@media (max-width: 575.98px) {
    .landing-green .landing-mock .mock-url { display: none; }
    .landing-green .hero .lead { font-size: 1.05rem; }
}

/* ---------- Organization logos ---------- */
.org-logo, .org-logo-sm, .org-logo-lg, .org-logo-xl, .logo-preview {
    object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 8px; flex-shrink: 0;
}
.org-logo { width: 32px; height: 32px; padding: 2px; }
.org-logo-sm { width: 34px; height: 34px; padding: 2px; }
.org-logo-lg { width: 56px; height: 56px; padding: 4px; border-radius: 12px; }
.org-logo-xl { width: 88px; height: 88px; padding: 6px; border-radius: 16px; }
.logo-preview { width: 72px; height: 72px; padding: 4px; border-radius: 12px; }
.logo-field { display: flex; gap: .9rem; align-items: flex-start; }
.org-brand .org-name { max-width: 260px; font-size: 1rem; color: var(--text); }
@media (max-width: 575.98px) {
    .org-brand .org-name { max-width: 42vw; font-size: .92rem; }
    .org-logo-lg { width: 48px; height: 48px; }
}

/* ---------- Sign-up: how to start ---------- */
.start-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .75rem; }
.start-option { display: flex; gap: .7rem; align-items: flex-start; padding: .9rem 1rem; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--surface); }
.start-option input { margin-top: .3rem; accent-color: var(--brand); }
.start-option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

/* ---------- Payments ---------- */
.pay-info .pay-amount { font-size: 1.05rem; margin-bottom: .75rem; padding: .6rem .8rem; border-radius: 10px; background: var(--brand-soft); color: var(--brand-ink); }
.pay-qrs { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: .75rem; }
.pay-qr { margin: 0; text-align: center; }
.pay-qr img { width: 168px; height: 168px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px; }
.pay-qr figcaption { font-size: .78rem; color: var(--muted); margin-top: .35rem; max-width: 168px; }
.pay-chip { display: inline-block; padding: .05rem .45rem; border-radius: 6px; font-weight: 700; font-size: .72rem; color: #fff; margin-right: .2rem; }
.pay-chip.bkash { background: #e2136e; }
.pay-chip.bangla { background: #006a4e; }
.pay-accounts li { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.pay-accounts li span { color: var(--muted); }
.pay-accounts li:last-child { border-bottom: 0; }
.pay-accounts .pay-bank b { text-align: right; font-weight: 500; }
.pay-note { padding: .5rem .7rem; border-left: 3px solid var(--brand-2); background: var(--surface-2); border-radius: 4px; }
.channel-pills { display: flex; flex-wrap: wrap; gap: .4rem; }
.channel-pill { position: relative; }
.channel-pill input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.channel-pill span { display: inline-block; padding: .4rem .8rem; border: 1.5px solid var(--line); border-radius: 999px; font-size: .88rem; background: var(--surface); }
.channel-pill input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.channel-pill input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.verify-card { border-left: 4px solid #f59e0b; }
.qr-preview { width: 96px; height: 96px; }
.day-bars { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding: .75rem 1rem .5rem; overflow-x: auto; }
.day-bar { flex: 1 0 18px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.day-bar .bar { width: 100%; max-width: 26px; background: linear-gradient(180deg, var(--brand-2), var(--brand)); border-radius: 4px 4px 0 0; min-height: 2px; }
.day-bar small { font-size: .65rem; color: var(--muted); margin-top: 2px; }
@media (max-width: 575.98px) {
    .pay-qr img { width: 140px; height: 140px; }
    .pay-qrs { justify-content: center; }
}
@media print {
    .no-print, .page-head .actions { display: none !important; }
}

/* ---------- Landing: live demo ---------- */
.demo-band { background: var(--dot-texture, none), var(--bg); border-bottom: 1px solid var(--line); }
.demo-card { display: flex; flex-direction: column; padding: 1.25rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.demo-icon { width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-soft); color: var(--brand-ink); font-size: 1.15rem; }
.demo-cred { display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; margin-bottom: 1rem; font-size: .9rem; }
.demo-cred dt { color: var(--muted); font-weight: 500; }
.demo-cred dd { margin: 0; text-align: right; }
.demo-cred code { font-size: .92rem; color: var(--text); background: var(--surface-2); padding: .1rem .4rem; border-radius: 6px; }
