
:root {
    --bg: #f3f6fa;
    --card: #ffffff;
    --ink: #17253a;
    --muted: #64748b;
    --brand: #0f766e;
    --brand2: #115e59;
    --line: #e2e8f0;
    --danger: #b42318;
    --warn: #b54708;
    --ok: #027a48;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Tahoma, Arial, sans-serif;
    line-height: 1.65;
    background: var(--bg);
    color: var(--ink);
    direction: rtl;
}

a {
    text-decoration: none;
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

/* Topbar */

.topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 76px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 28px;
    box-shadow: 0 2px 12px rgba(15, 23, 42, .035);
    direction: rtl;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 16px;
    font-weight: 800;
    min-width: 0;
}

.brand-mark {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 13px;
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 22px;
    box-shadow: 0 4px 12px rgba(15, 118, 110, .18);
}

/* Main Layout */

.shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: calc(100vh - 76px);
}

.sidebar {
    background: linear-gradient(180deg, #102e31, #102629);
    color: #ecfdf5;
    padding: 22px 12px;
    overflow-y: auto;
}

.sidebar a {
    display: block;
    padding: 12px 15px;
    border-radius: 11px;
    margin: 4px 0;
    font-size: 13px;
    font-weight: 600;
    transition: background .2s, transform .2s;
}

.sidebar a:hover {
    background: #1c4b4c;
    transform: translateX(-2px);
}

.sidebar a.active,
.sidebar a[aria-current="page"] {
    background: #1d5552;
    color: #ffffff;
    box-shadow: inset -3px 0 #5eead4;
}

.main {
    min-width: 0;
    padding: 30px;
    position: relative;
}

.content {
    position: relative;
    z-index: 1;
    max-width: 1600px;
    margin: 0 auto;
}

.content h1 {
    font-size: clamp(23px, 2.2vw, 30px);
    font-weight: 800;
    letter-spacing: -.4px;
}

.content h2 {
    font-size: 21px;
}

.watermark {
    position: fixed;
    inset: 76px 260px 0 0;
    display: grid;
    place-items: center;
    pointer-events: none;
    z-index: 0;
    opacity: .035;
    font-size: 8vw;
    font-weight: 900;
}

.watermark img {
    max-width: 42vw;
    max-height: 42vh;
    object-fit: contain;
    filter: grayscale(1);
}

/* Cards and Statistics */

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

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 17px;
    padding: 21px;
    box-shadow: 0 5px 20px rgba(15, 23, 42, .045);
    transition: box-shadow .2s;
}

.card:hover {
    box-shadow: 0 9px 28px rgba(15, 23, 42, .075);
}

.stat b {
    font-size: 29px;
    display: block;
    margin-top: 8px;
    color: #102e31;
}

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

/* Buttons */

.btn {
    border: 0;
    border-radius: 11px;
    padding: 11px 17px;
    cursor: pointer;
    background: var(--brand);
    color: #fff;
    display: inline-block;
    font-weight: 600;
}

.btn:hover {
    filter: brightness(.95);
}

.btn.secondary {
    background: #eef2f6;
    color: #243043;
}

.btn.danger {
    background: var(--danger);
}

.btn.warn {
    background: var(--warn);
}

/* Grids and Forms */

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

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

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field input,
.field select,
.field textarea {
    border: 1px solid #d5deea;
    border-radius: 10px;
    padding: 10px;
    min-height: 42px;
    background: #fff;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: 2px solid rgba(15, 118, 110, .18);
    border-color: var(--brand);
}

/* Tables */

.table-wrap {
    overflow: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

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

th {
    background: #f8fafc;
    font-weight: 700;
    color: #334155;
}

/* Status Badges */

.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    background: #eef2f6;
}

.badge.ok {
    background: #ecfdf3;
    color: var(--ok);
}

.badge.warn {
    background: #fff7ed;
    color: var(--warn);
}

.badge.danger {
    background: #fef3f2;
    color: var(--danger);
}

/* Notifications */

.flash {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    background: #ecfdf3;
    color: #067647;
}

.errors {
    padding: 12px 14px;
    border-radius: 10px;
    background: #fef3f2;
    color: #b42318;
    margin-bottom: 14px;
}

/* Account Menu */

.account {
    position: relative;
}

.account-btn {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 13px;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    gap: 9px;
    align-items: center;
}

.account-menu {
    display: none;
    position: absolute;
    left: 0;
    top: 50px;
    z-index: 2000;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    min-width: 220px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .12);
    overflow: hidden;
}

.account.open .account-menu {
    display: block;
}

.account-menu a,
.account-menu button {
    width: 100%;
    display: block;
    border: 0;
    background: #fff;
    text-align: right;
    padding: 11px 13px;
    cursor: pointer;
}

.account-menu a:hover,
.account-menu button:hover {
    background: #f5f7fa;
}

.account-menu form {
    margin: 0;
}

.account-menu button {
    color: var(--danger);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #e9eef3;
    display: grid;
    place-items: center;
}

/* Public Pages */

.hero {
    padding: 70px 20px;
    background: linear-gradient(135deg, #0f766e, #164e63);
    color: #fff;
}

.hero-inner {
    max-width: 1100px;
    margin: auto;
}

.public-section {
    max-width: 1100px;
    margin: 28px auto;
    padding: 0 20px;
}

.public-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

/* Login */

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #e6fffb, #f8fafc);
}

.login-card {
    width: min(440px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 26px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .08);
}

.photo {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    object-fit: cover;
    background: #eef2f6;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 24px 0 12px;
}

/* Guardian and Student Portal */

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

.portal-shell .main {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
}

.portal-shell .watermark {
    inset: 76px 0 0 0;
}

.guardian-title {
    margin-top: 0;
}

.child-card {
    margin-bottom: 18px;
}

.child-head {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 16px;
}

.child-head h2 {
    margin: 0 0 6px;
}

.child-placeholder {
    display: grid;
    place-items: center;
    font-size: 24px;
    font-weight: 700;
}

.portal-panel {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    background: #fbfcfe;
    min-height: 120px;
}

.portal-panel h3 {
    margin-top: 0;
}

.dues-title {
    margin-top: 18px;
}

/* Responsive Layout */

@media (max-width: 900px) {
    .topbar {
        height: 68px;
        padding: 0 14px;
    }

    .shell {
        grid-template-columns: 1fr;
        min-height: calc(100vh - 68px);
    }

    .sidebar {
        display: block;
        padding: 10px;
        max-height: 175px;
        overflow-y: auto;
    }

    .sidebar a {
        display: inline-block;
        margin: 3px;
        padding: 9px 11px;
    }

    .main {
        padding: 16px;
    }

    .watermark {
        inset: 68px 0 0 0;
    }

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

    .guardian-title {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .portal-shell .sidebar {
        display: none;
    }

    .portal-shell .watermark {
        inset: 68px 0 0 0;
    }

    .cards {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 480px) {
    .brand {
        font-size: 12px;
    }

    .brand-mark {
        width: 34px;
        height: 34px;
    }

    .card {
        padding: 15px;
    }

    .stat b {
        font-size: 24px;
    }
}

/* AcademyHub Brand and Navigation v1.3 */

.academy-logo {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    object-fit: contain;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 3px;
}

.sidebar-heading {
    color: #a7c9c7;
    font-size: 11px;
    font-weight: 800;
    padding: 18px 15px 7px;
    margin-top: 8px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-heading:first-child {
    margin-top: 0;
    padding-top: 4px;
    border-top: 0;
}

.nav-icon {
    display: inline-flex;
    width: 23px;
    justify-content: center;
    align-items: center;
    margin-left: 7px;
    font-size: 16px;
    vertical-align: middle;
}

.sidebar-powered {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 28px;
    padding: 18px 10px 6px;
    border-top: 1px solid rgba(255,255,255,.12);
    color: #fff;
}

.sidebar-powered img {
    width: 38px;
    height: 38px;
    object-fit: contain;
    border-radius: 10px;
}

.sidebar-powered small {
    display: block;
    font-size: 10px;
    color: #a7c9c7;
}

.sidebar-powered strong {
    display: block;
    font-size: 11px;
}

.watermark img {
    width: min(440px, 65vw);
    max-width: 100%;
    max-height: 55vh;
    object-fit: contain;
    filter: none;
}

@media (max-width: 900px) {
    .sidebar-heading {
        display: block;
        padding: 12px 10px 5px;
    }

    .sidebar-powered {
        margin-top: 12px;
    }
}
/* تقوية ظهور العلامة المائية للأدهم */

.watermark {
    opacity: 0.38;
}