@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap');

:root {
    --sc-ink: #16324f;
    --sc-muted: #5b6f86;
    --sc-line: #d7e2ee;
    --sc-panel: rgba(255, 255, 255, 0.94);
    --sc-accent: #0f6a8f;
    --sc-accent-2: #1d8f6f;
    --sc-danger: #a33b3b;
    --sc-header-h: 72px;
    --sc-sidebar-w: 280px;
}

html {
    scroll-behavior: smooth;
}

body.site-body {
    margin: 0;
    min-height: 100vh;
    font-family: 'IBM Plex Sans Arabic', 'Tajawal', sans-serif;
    color: var(--sc-ink);
    background:
        radial-gradient(circle at 10% 0%, rgba(29, 143, 111, 0.12), transparent 32%),
        radial-gradient(circle at 92% 4%, rgba(15, 106, 143, 0.14), transparent 36%),
        linear-gradient(180deg, #eef5f8 0%, #f7fafc 46%, #eef2f5 100%);
}

body.site-body.has-sidebar {
    --sc-content-pad: var(--sc-sidebar-w);
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1100;
    height: var(--sc-header-h);
    display: flex;
    align-items: center;
    backdrop-filter: blur(14px);
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid var(--sc-line);
    box-shadow: 0 8px 24px rgba(22, 50, 79, 0.06);
}

.site-header__inner {
    width: min(1400px, calc(100% - 32px));
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--sc-ink);
    min-width: 0;
}

.site-brand img {
    height: 46px;
    width: auto;
    display: block;
    transition: transform 0.25s ease;
}

.site-brand:hover img {
    transform: scale(1.04);
}

.site-brand__text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.site-brand__name {
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-brand__tag {
    color: var(--sc-muted);
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-header__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.site-nav-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.site-nav-inline a {
    text-decoration: none;
    color: var(--sc-ink);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 12px;
    border-radius: 10px;
    transition: background 0.2s ease, color 0.2s ease;
}

.site-nav-inline a:hover,
.site-nav-inline a.is-active {
    background: #e8f3f7;
    color: var(--sc-accent);
}

.site-lang select {
    appearance: none;
    border: 1px solid var(--sc-line);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235b6f86' d='M6 8L0 0h12z'/%3E%3C/svg%3E") no-repeat left 10px center;
    padding: 8px 12px 8px 28px;
    border-radius: 10px;
    color: var(--sc-ink);
    font: inherit;
    font-size: 0.88rem;
    cursor: pointer;
}

html[dir="rtl"] .site-lang select {
    background-position: right 10px center;
    padding: 8px 28px 8px 12px;
}

.site-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 14px;
    border-radius: 11px;
    border: 0;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease;
}

.site-btn:hover {
    transform: translateY(-1px);
    filter: brightness(0.98);
}

.site-btn--ok { background: var(--sc-accent-2); color: #fff; }
.site-btn--soft { background: var(--sc-accent); color: #fff; }
.site-btn--ghost { background: #eef3f7; color: var(--sc-ink); }
.site-btn--danger { background: var(--sc-danger); color: #fff; }
.site-btn--sm { padding: 7px 10px; font-size: 0.84rem; }

.site-menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid var(--sc-line);
    border-radius: 12px;
    background: #fff;
    color: var(--sc-accent);
    font-size: 1.25rem;
    cursor: pointer;
}

/* Sidebar — ثابتة على اليمين */
.site-sidebar {
    position: fixed;
    top: var(--sc-header-h);
    right: 0;
    left: auto;
    width: var(--sc-sidebar-w);
    height: calc(100vh - var(--sc-header-h));
    z-index: 1050;
    overflow: auto;
    background: linear-gradient(180deg, #0f4d68 0%, #0f6a8f 42%, #147a6a 100%);
    color: #fff;
    box-shadow: -8px 0 28px rgba(15, 50, 70, 0.18);
    transition: transform 0.28s ease;
}

.site-sidebar__head {
    padding: 18px 18px 10px;
}

.site-sidebar__eyebrow {
    margin: 0;
    opacity: 0.75;
    font-size: 0.8rem;
}

.site-sidebar__title {
    margin: 4px 0 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.site-sidebar__menu {
    list-style: none;
    margin: 0;
    padding: 8px 12px 24px;
}

.site-sidebar__group {
    margin-bottom: 8px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.site-sidebar__group-title {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 14px;
    border: 0;
    background: transparent;
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-align: inherit;
}

.site-sidebar__group-title.special {
    color: #ffd4d4;
}

.site-sidebar__group-title .arrow {
    transition: transform 0.2s ease;
    opacity: 0.8;
    font-size: 0.75rem;
}

.site-sidebar__group-title.is-open .arrow {
    transform: rotate(180deg);
}

.site-sidebar__submenu {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0 8px 10px;
}

.site-sidebar__submenu.is-open {
    display: block;
}

.site-sidebar__submenu a {
    display: block;
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    font-size: 0.92rem;
    transition: background 0.2s ease;
}

.site-sidebar__submenu a:hover,
.site-sidebar__submenu a.is-active {
    background: rgba(255, 255, 255, 0.16);
}

.site-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: var(--sc-header-h) 0 0 0;
    background: rgba(15, 30, 45, 0.45);
    z-index: 1040;
}

body.site-body.sidebar-open .site-sidebar-backdrop {
    display: block;
}

/* Content offset — إزاحة المحتوى بعيدًا عن القائمة اليمنى */
.site-body.has-sidebar .site-content-shift {
    margin-right: var(--sc-sidebar-w);
    margin-left: 0;
    transition: margin 0.28s ease;
}

/* Footer */
.site-footer {
    margin-top: 40px;
    border-top: 1px solid var(--sc-line);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
}

.site-footer__inner {
    width: min(1100px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 22px;
    display: grid;
    gap: 18px;
    text-align: center;
    justify-items: center;
}

.site-footer__brand {
    display: grid;
    gap: 8px;
    justify-items: center;
}

.site-footer__brand img {
    height: 44px;
    width: auto;
}

.site-footer__brand strong {
    font-size: 1.05rem;
    color: var(--sc-ink);
}

.site-footer__brand p {
    margin: 0;
    color: var(--sc-muted);
    max-width: 42ch;
    line-height: 1.7;
}

.site-footer__meta {
    color: var(--sc-muted);
    font-size: 0.86rem;
}

.site-footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    justify-content: center;
}

.site-footer__links a {
    color: var(--sc-accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.site-footer__links a:hover {
    text-decoration: underline;
}

/* Auth pages */
.auth-page {
    min-height: calc(100vh - var(--sc-header-h) - 160px);
    display: grid;
    place-items: center;
    padding: 28px 16px 40px;
}

.auth-card {
    width: min(440px, 100%);
    background: var(--sc-panel);
    border: 1px solid var(--sc-line);
    border-radius: 22px;
    padding: 28px 24px;
    box-shadow: 0 18px 40px rgba(22, 50, 79, 0.08);
    animation: siteRise 0.45s ease both;
}

.auth-card--wide {
    width: min(520px, 100%);
}

.auth-card__eyebrow {
    margin: 0 0 6px;
    color: var(--sc-accent);
    font-weight: 700;
    font-size: 0.88rem;
}

.auth-card h1 {
    margin: 0;
    font-size: clamp(1.45rem, 3vw, 1.9rem);
    color: var(--sc-ink);
}

.auth-card__lead {
    margin: 8px 0 0;
    color: var(--sc-muted);
    line-height: 1.7;
}

.auth-form {
    display: grid;
    gap: 14px;
    margin-top: 20px;
}

.auth-field {
    display: grid;
    gap: 6px;
}

.auth-field label {
    font-weight: 600;
    font-size: 0.92rem;
}

.auth-field input,
.auth-field select,
.auth-field textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--sc-line);
    border-radius: 12px;
    padding: 12px 14px;
    font: inherit;
    color: var(--sc-ink);
    background: #fff;
}

.auth-field input:focus,
.auth-field select:focus,
.auth-field textarea:focus {
    outline: none;
    border-color: var(--sc-accent);
    box-shadow: 0 0 0 3px rgba(15, 106, 143, 0.12);
}

.auth-alert {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: 12px;
    margin-top: 16px;
    line-height: 1.6;
}

.auth-alert--ok {
    background: #e8f6ee;
    color: #1f7a4d;
    border: 1px solid #bfe5cd;
}

.auth-alert--err {
    background: #fdecec;
    color: #a33b3b;
    border: 1px solid #f0c2c2;
}

.auth-links {
    margin-top: 18px;
    display: grid;
    gap: 8px;
    text-align: center;
    color: var(--sc-muted);
    font-size: 0.92rem;
}

.auth-links a {
    color: var(--sc-accent);
    font-weight: 700;
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

.auth-actions {
    display: grid;
    gap: 8px;
}

.home-hero {
    width: min(920px, calc(100% - 32px));
    margin: 36px auto 48px;
    padding: 42px 28px;
    border-radius: 28px;
    background:
        linear-gradient(145deg, rgba(15, 106, 143, 0.92), rgba(29, 143, 111, 0.88)),
        #0f6a8f;
    color: #fff;
    text-align: center;
    box-shadow: 0 24px 50px rgba(15, 70, 90, 0.22);
    animation: siteRise 0.5s ease both;
}

.home-hero h1 {
    margin: 0;
    font-size: clamp(1.7rem, 4vw, 2.5rem);
    line-height: 1.35;
}

.home-hero p {
    margin: 14px auto 0;
    max-width: 46ch;
    line-height: 1.8;
    opacity: 0.95;
}

.home-hero__actions {
    margin-top: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.home-hero__actions .site-btn--ghost {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

@keyframes siteRise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
    .site-brand__tag { display: none; }

    .site-menu-toggle { display: inline-flex; align-items: center; justify-content: center; }

    .site-sidebar {
        transform: translateX(110%);
        right: 0;
        left: auto;
    }

    body.site-body.sidebar-open .site-sidebar,
    .site-sidebar.is-open {
        transform: translateX(0);
    }

    .site-body.has-sidebar .site-content-shift {
        margin-right: 0;
        margin-left: 0;
    }
}

body.site-body.has-sidebar .finance-page {
    min-height: calc(100vh - var(--sc-header-h, 72px));
}

@media (min-width: 981px) {
    body.site-body.has-sidebar .finance-shell--wide {
        max-width: 1240px;
    }
}

@media (max-width: 640px) {
    .site-brand__name { font-size: 0.92rem; }
    .site-brand img { height: 40px; }
    .site-header__actions .site-btn { padding: 8px 10px; font-size: 0.82rem; }
    .auth-card { padding: 22px 18px; border-radius: 18px; }
    .home-hero { padding: 32px 18px; border-radius: 22px; }
}
