/* ==========================================================
   YEGAN BOOTSTRAP THEME
   Global design tokens, layout and reusable components
   ========================================================== */

@font-face {
    font-family: "Vazir";
    src: url("../assets/fonts/Vazir.ttf") format("truetype");
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --yegan-bg: #14B8A6;
    --yegan-fg: #ffffff;
    --y-font-ltr: Inter, Poppins, "Segoe UI", Arial, sans-serif;
    --y-font-rtl: Vazir, Tahoma, "Segoe UI", Arial, sans-serif;
    --y-radius-xs: .5rem;
    --y-radius-sm: .75rem;
    --y-radius-md: 1rem;
    --y-radius-lg: 1.35rem;
    --y-radius-xl: 1.8rem;
    --y-shadow-sm: 0 8px 24px rgb(18 24 40 / 7%);
    --y-shadow-md: 0 18px 55px rgb(18 24 40 / 12%);
    --y-transition: 280ms cubic-bezier(.2,.75,.2,1);
    --y-sidebar-open: 18.25rem;
    --y-sidebar-closed: 11.625rem;
    --y-sidebar-gap: 1rem;
}

html[dir="rtl"] body { font-family: var(--y-font-rtl); }
html[dir="ltr"] body { font-family: var(--y-font-ltr); }

html[data-theme="blue"] {
    --y-primary: #0f7fa8;
    --y-primary-rgb: 15,127,168;
    --y-primary-strong: #075f80;
    --y-primary-soft: #dff4fb;
    --y-accent: #2bb6d6;
    --y-sidebar: #158db5;
    --y-sidebar-2: #0b6f94;
}

html[data-theme="teal"] {
    --y-primary: #0f766e;
    --y-primary-rgb: 15,118,110;
    --y-primary-strong: #115e59;
    --y-primary-soft: #d5f5ef;
    --y-accent: #14b8a6;
    --y-sidebar: #0d9488;
    --y-sidebar-2: #115e59;
}

html[data-theme="maroon"] {
    --y-primary: #7e263d;
    --y-primary-rgb: 126,38,61;
    --y-primary-strong: #57182a;
    --y-primary-soft: #f8e8ed;
    --y-accent: #b54a69;
    --y-sidebar: #963a55;
    --y-sidebar-2: #74243e;
}

html[data-theme="orange"] {
    --y-primary: #a84f0d;
    --y-primary-rgb: 168,79,13;
    --y-primary-strong: #783706;
    --y-primary-soft: #fff0e2;
    --y-accent: #dc792c;
    --y-sidebar: #bf641f;
    --y-sidebar-2: #93430d;
}

html[data-mode="light"] {
    --y-bg: #f4f7fb;
    --y-surface: #ffffff;
    --y-surface-2: #f8fafc;
    --y-text: #192032;
    --y-muted: #6b7280;
    --y-border: #e3e8f0;
    --y-input-bg: #ffffff;
    --y-hover: #f1f5f9;
    --y-table-head: #f7f9fc;
    --y-overlay: rgb(15 23 42 / 46%);
    --y-sidebar: color-mix(in srgb, var(--y-primary) 84%, white);
    --y-sidebar-2: color-mix(in srgb, var(--y-primary-strong) 86%, var(--y-primary));
    --bs-body-bg: var(--y-bg);
    --bs-body-color: var(--y-text);
    --bs-border-color: var(--y-border);
    --bs-primary: var(--y-primary);
    --bs-primary-rgb: var(--y-primary-rgb);
}

html[data-mode="dark"] {
    color-scheme: dark;
    --y-bg: #11131a;
    --y-surface: #191c25;
    --y-surface-2: #20242f;
    --y-text: #eef2f8;
    --y-muted: #9ca6b8;
    --y-border: #303645;
    --y-input-bg: #151821;
    --y-hover: #252a36;
    --y-table-head: #20242f;
    --y-overlay: rgb(0 0 0 / 66%);
    --y-sidebar: color-mix(in srgb, var(--y-primary) 52%, #181b24);
    --y-sidebar-2: color-mix(in srgb, var(--y-primary-strong) 46%, #0f1219);
    --y-primary-soft: rgba(var(--y-primary-rgb), 0.18);
    --bs-body-bg: var(--y-bg);
    --bs-body-color: var(--y-text);
    --bs-border-color: var(--y-border);
    --bs-primary: var(--y-primary);
    --bs-primary-rgb: var(--y-primary-rgb);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--y-bg); }
body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 86% 2%, rgba(var(--y-primary-rgb), 0.1), transparent 30rem),
        var(--y-bg);
    color: var(--y-text);
    text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: rgba(var(--y-primary-rgb), 0.24); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(var(--y-primary-rgb), 0.55) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: rgba(var(--y-primary-rgb), 0.46);
    border: 2px solid transparent;
    border-radius: 999px;
    background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(var(--y-primary-rgb), 0.72); background-clip: padding-box; }

/* Main layout */
.yegan-app {
    display: grid;
    grid-template-columns: var(--y-sidebar-open) minmax(0, 1fr);
    gap: var(--y-sidebar-gap);
    min-height: 100vh;
    padding: 1rem;
    transition: grid-template-columns var(--y-transition);
}
.yegan-app.sidebar-closed { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 992px) {
    .yegan-app.sidebar-closed { grid-template-columns: 0px minmax(0, 1fr); column-gap: 0; }
    .yegan-app { transition: grid-template-columns 240ms ease, column-gap 240ms ease; }
    .yegan-app .yegan-main { grid-column: 2; padding-top: 80px; }
    .yegan-app .yegan-sidebar { position: fixed; inset-inline-start: 1rem; top: 1rem; width: var(--y-sidebar-open); transition: width 240ms ease; }
    .yegan-app .yegan-topbar { position: fixed; inset-block-start: 1rem; inset-inline-end: 1rem; width: calc(100vw - var(--y-sidebar-open) - 3rem); margin: 0; transition: width 240ms ease; }
    .yegan-app .sidebar-panel { transition: height 240ms ease, border-radius 240ms ease; }
    .yegan-app.sidebar-closed .sidebar-panel { height: 64px; }
    .sidebar-closed .yegan-sidebar { position: fixed; inset-inline-start: 1rem; top: 1rem; width: var(--y-sidebar-closed); }
    .yegan-app.sidebar-closed .yegan-topbar { width: calc(100vw - var(--y-sidebar-closed) - 3rem); }
    .sidebar-closed .yegan-content, .sidebar-closed .yegan-footer { width: 100%; }
}
.yegan-main { min-width: 0; display: flex; flex-direction: column; }
.yegan-content { flex: 1; padding: 1.1rem 0 1.5rem; }
.yegan-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem .2rem .2rem;
    color: var(--y-muted);
    font-size: .82rem;
}

/* Sidebar */
.yegan-sidebar { align-self: start; position: sticky; top: 1rem; z-index: 1040; min-width: 0; }
.sidebar-panel {
    width: 100%;
    overflow: hidden;
    border-radius: var(--y-radius-xl);
    background: linear-gradient(155deg, var(--y-sidebar), var(--y-sidebar-2));
    color: #fff;
    box-shadow: var(--y-shadow-md);
    transition: width var(--y-transition), border-radius var(--y-transition), box-shadow var(--y-transition);
}
.sidebar-brand-row {
    display: flex;
    align-items: center;
    gap: .8rem;
    min-height: 64px;
    padding: .62rem .75rem;
    white-space: nowrap;
}
.sidebar-toggle {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    display: grid;
    place-content: center;
    gap: 4px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 8px 20px rgb(0 0 0 / 14%);
    cursor: pointer;
}
.sidebar-toggle span,
.mobile-menu-button span {
    display: block;
    width: 17px;
    height: 2px;
    border-radius: 20px;
    background: #20212c;
    transition: transform var(--y-transition), opacity var(--y-transition);
}
.sidebar-open .sidebar-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.sidebar-open .sidebar-toggle span:nth-child(2) { opacity: 0; }
.sidebar-open .sidebar-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.brand-copy { min-width: 0; display: flex; flex-direction: column; line-height: 1.05; }
.sidebar-brand-lockup { display: inline-flex; align-items: center; gap: .45rem; color: var(--yegan-fg); }
.sidebar-brand-mark { width: 1.8rem; height: 1.8rem; flex: 0 0 auto; }
.brand-copy strong { font-size: 1.05rem; letter-spacing: .08em; }
.brand-copy small { margin-top: .35rem; opacity: .58; font-size: .58rem; letter-spacing: .08em; }
.sidebar-closed .brand-copy small { display: none; }
.yegan-page-loader { min-height: 46vh; display: grid; place-items: center; color: var(--y-primary); }
.finance-transactions-loader { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8rem; font-size: .9rem; font-weight: 600; }
.yegan-inline-loader { display: inline-grid; place-items: center; color: var(--y-primary); }
.yegan-auth-brand-lockup { display: inline-flex; align-items: center; gap: .75rem; color: var(--yegan-fg); }
.yegan-auth-brand-mark { width: 2.8rem; height: 2.8rem; flex: 0 0 auto; }
.yegan-wordmark-art { display: inline-block; width: 7rem; height: 2.35rem; background: currentColor; mask: url("../assets/brand/Yegan_Wordmark_Custom_Theme.svg") center / contain no-repeat; -webkit-mask: url("../assets/brand/Yegan_Wordmark_Custom_Theme.svg") center / contain no-repeat; }
.yegan-auth-brand .yegan-wordmark-art { width: clamp(12rem, 32vw, 19rem); height: clamp(4.5rem, 12vw, 7rem); }
.yegan-topbar-brand { display: inline-flex; align-items: center; }
.yegan-topbar-brand-icon { width: 2.8rem; height: 2.8rem; --yegan-bg: var(--y-primary); --yegan-fg: #fff; }

/* Authentication: a centred, theme-aware sign-in experience. */
.yegan-public-auth { min-height: 100dvh; display: flex; flex-direction: column; }
.yegan-public-auth .auth-layout-shell { flex: 1; min-height: 0; display: grid; place-items: center; padding: clamp(1rem, 3vw, 3rem); }
.yegan-public-auth .auth-body, .yegan-public-auth .auth-shell { width: 100%; min-height: 0; }
.yegan-public-auth .auth-section { display: grid; align-items: center; width: 100%; padding: 0; }
.yegan-public-auth .auth-section .container { width: min(1100px, 100%); max-width: 1100px; }
.auth-login-grid { align-items: stretch; }
.auth-login-card { min-height: 100%; padding: clamp(1.75rem, 3vw, 2.7rem); border: 1px solid var(--y-border); box-shadow: 0 22px 56px rgb(15 23 42 / 10%); }
.auth-login-card .form-control { border-color: var(--y-border); background: var(--y-input-bg); transition: border-color var(--y-transition), box-shadow var(--y-transition), background var(--y-transition); }
.auth-login-card .form-control:focus { border-color: var(--y-primary); box-shadow: 0 0 0 .24rem rgba(var(--y-primary-rgb), .14); }
.auth-password-control { position: relative; display: flex; align-items: center; }
.auth-username-control { position: relative; display: flex; align-items: center; }
.auth-username-control .form-control { min-height: 3.25rem; padding-inline-start: 3.25rem; border-radius: var(--y-radius-md) !important; }
.auth-username-icon { position: absolute; inset-inline-start: .45rem; z-index: 1; width: 2.35rem; height: 2.35rem; display: grid; place-items: center; border-radius: .7rem; color: var(--y-primary); background: var(--y-primary-soft); pointer-events: none; }
.auth-password-control .form-control { min-height: 3.25rem; padding-inline-start: 3.25rem; padding-inline-end: 3rem; border-radius: var(--y-radius-md) !important; }
.auth-password-icon, .auth-password-toggle { position: absolute; z-index: 1; width: 2.5rem; height: 2.5rem; display: grid; place-items: center; border-radius: .72rem; }
.auth-password-icon { inset-inline-start: .4rem; color: var(--y-primary); background: var(--y-primary-soft); }
.auth-password-toggle { inset-inline-end: .4rem; border: 0; color: var(--y-muted); background: transparent; cursor: pointer; transition: color var(--y-transition), background var(--y-transition), transform var(--y-transition); }
.auth-password-toggle:hover { color: var(--y-primary); background: var(--y-primary-soft); transform: translateY(-1px); }
.auth-password-toggle:focus-visible { outline: 2px solid var(--y-primary); outline-offset: 2px; }
.auth-password-toggle[aria-pressed="true"] { color: var(--y-primary); background: color-mix(in srgb, var(--y-primary-soft) 70%, transparent); }
@media (max-width: 991.98px) { .yegan-public-auth .auth-layout-shell { place-items: center; } .auth-login-card { min-height: auto; } }
.yegan-loader-wrap { --yegan-c1: var(--y-primary); --yegan-c2: var(--y-accent); --yegan-c3: var(--y-sidebar); --yegan-c4: var(--y-sidebar-2); --yegan-track: var(--y-primary); --yegan-highlight: var(--yegan-fg); --yegan-duration: 2.8s; }
.sidebar-expandable {
    max-height: calc(100vh - 7rem);
    overflow: hidden;
    opacity: 1;
    transform: translateY(0);
    padding: 0 .65rem .7rem;
    transition: max-height 440ms cubic-bezier(.2,.8,.2,1), opacity 230ms ease, transform 360ms ease, padding 320ms ease;
}
.sidebar-closed .sidebar-expandable {
    max-height: 0;
    opacity: 0;
    transform: translateY(-16px);
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
}
.company-card {
    display: flex;
    flex-direction: column;
    gap: .18rem;
    padding: .78rem .82rem;
    margin-bottom: .65rem;
    border: 1px solid rgb(255 255 255 / 10%);
    border-radius: var(--y-radius-md);
    background: rgb(255 255 255 / 6%);
}
.company-card .company-label { color: var(--y-accent); font-size: .6rem; letter-spacing: .12em; }
.company-card strong { font-size: .84rem; }
.company-card small { font-size: .7rem; color: rgb(255 255 255 / 52%); }
.sidebar-nav { display: flex; flex-direction: column; gap: .2rem; min-height: 0; }
.sidebar-open .sidebar-panel { height: calc(100dvh - 3rem); display: flex; flex-direction: column; }
.sidebar-open .sidebar-brand-row { flex-shrink: 0; }
.sidebar-open .sidebar-expandable { flex: 1; min-height: 0; max-height: none; display: flex; flex-direction: column; padding-bottom: 1.25rem; }
.sidebar-open .sidebar-nav { flex: 1; }
.sidebar-company-context { display: flex; flex-direction: column; gap: .4rem; margin: .75rem 0; padding: .85rem .75rem; border-block: 1px solid rgb(255 255 255 / 25%); }
.sidebar-company-context span { font-size: .8rem; opacity: .8; }
.sidebar-nav > .sidebar-group { margin: 0; padding: 0; flex: 0 0 auto; }
.sidebar-nav > .sidebar-link { margin: 0; flex: 0 0 auto; }
.sidebar-nav > .sidebar-group > .sidebar-link,
.sidebar-nav > .sidebar-link { min-height: 38px; padding-block: .25rem; }
.sidebar-divider { margin-top: auto; border-top: 1px solid rgb(255 255 255 / 35%); padding-top: .4rem; }
.sidebar-profile-link { flex: 0 0 auto; }
.sidebar-link {
    min-height: 42px;
    display: grid;
    grid-template-columns: 34px minmax(0,1fr) auto;
    align-items: center;
    gap: .5rem;
    padding: .35rem .62rem;
    border: 1px solid transparent;
    border-radius: 999px;
    color: rgb(255 255 255 / 76%);
    cursor: pointer;
    list-style: none;
    transition: background var(--y-transition), border-color var(--y-transition), color var(--y-transition), transform var(--y-transition);
}
.sidebar-link::-webkit-details-marker { display: none; }
.sidebar-link:hover {
    color: #fff;
    background: rgb(255 255 255 / 8%);
    border-color: rgb(255 255 255 / 9%);
    transform: translateX(2px);
}
html[dir="rtl"] .sidebar-link:hover { transform: translateX(-2px); }
.sidebar-link.active,
.sidebar-group[open] > .sidebar-link {
    color: #fff;
    background: rgb(255 255 255 / 17%);
    border-color: rgb(255 255 255 / 18%);
    box-shadow: 0 9px 22px rgb(0 0 0 / 12%);
}
.nav-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgb(255 255 255 / 10%);
    font-weight: 800;
}
.nav-text { overflow: hidden; text-overflow: ellipsis; font-size: .82rem; font-weight: 600; }
.group-arrow { transition: transform var(--y-transition); opacity: .68; }
.sidebar-group[open] .group-arrow { transform: rotate(180deg); }
.sidebar-submenu {
    display: grid;
    gap: .25rem;
    margin: .3rem .65rem .5rem 2.55rem;
    padding-inline-start: .9rem;
    border-inline-start: 1px dashed rgb(255 255 255 / 18%);
}
html[dir="rtl"] .sidebar-submenu { margin: .3rem 2.55rem .5rem .65rem; }
.sidebar-submenu a {
    padding: .48rem .62rem;
    border-radius: .7rem;
    color: rgb(255 255 255 / 58%);
    font-size: .74rem;
    transition: all var(--y-transition);
}
.sidebar-submenu a:hover,
.sidebar-submenu a.active { color: #fff; background: rgb(255 255 255 / 7%); }
.sidebar-spacer { min-height: 3.5rem; }
.sidebar-nav-bottom { padding-top: .65rem; border-top: 1px solid rgb(255 255 255 / 8%); }

/* Topbar */
.yegan-topbar {
    position: sticky;
    top: 1rem;
    z-index: 1020;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .55rem .7rem .55rem .82rem;
    border: 1px solid rgb(255 255 255 / 46%);
    border-radius: var(--y-radius-lg);
    background: var(--y-surface);
    box-shadow: none;
}
html[data-mode="dark"] .yegan-topbar { border-color: rgb(255 255 255 / 7%); }
/* Cover the viewport gap above the sticky header; scrolling text must not peek through. */
.yegan-app .yegan-topbar::before {
    content: "";
    position: absolute;
    inset-inline: -1rem;
    bottom: 100%;
    height: 1.1rem;
    pointer-events: none;
    background: var(--y-bg);
}
@media (min-width: 992px) {
    .yegan-app.sidebar-closed .yegan-topbar::before { inset-inline-start: calc(-1 * var(--y-sidebar-closed) - 2rem); }
}
@media (max-width: 767.98px) {
    .yegan-app .yegan-topbar::before { display: none; }
}
.topbar-heading { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.topbar-heading h1 { margin: 0; font-size: 1.22rem; }
.eyebrow { margin: 0 0 .22rem; color: var(--y-primary); font-size: .67rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: .55rem; }
.theme-switcher {
    display: flex;
    gap: .3rem;
    padding: .36rem;
    border: 1px solid var(--y-border);
    border-radius: 999px;
    background: var(--y-surface-2);
}
.theme-dot { width: 19px; height: 19px; border: 3px solid transparent; border-radius: 50%; cursor: pointer; }
.theme-dot.blue { background: #0f7fa8; }
.theme-dot.maroon { background: #7e263d; }
.theme-dot.orange { background: #a84f0d; }
.theme-dot.teal { background: #0f766e; }
.theme-dot.selected { border-color: var(--y-surface); box-shadow: 0 0 0 2px currentColor; }
.topbar-icon,
.mobile-menu-button {
    position: relative;
    min-width: 42px;
    height: 42px;
    display: grid;
    place-content: center;
    border: 1px solid var(--y-border);
    border-radius: 50%;
    background: var(--y-surface);
    color: var(--y-text);
    font-size: .78rem;
    font-weight: 800;
    cursor: pointer;
    transition: all var(--y-transition);
}
.topbar-icon:hover { color: var(--y-primary); border-color: rgba(var(--y-primary-rgb), 0.4); background: var(--y-primary-soft); }
.notification-dot { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border: 2px solid var(--y-surface); border-radius: 50%; background: #e34747; }
.user-button {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .32rem .55rem .32rem .35rem;
    border: 1px solid var(--y-border);
    border-radius: 999px;
    background: var(--y-surface);
    color: var(--y-text);
}
html[dir="rtl"] .user-button { padding: .32rem .35rem .32rem .55rem; }
.avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--y-primary), var(--y-accent));
    color: #fff;
    font-size: .72rem;
    font-weight: 800;
}
.user-copy { display: flex; flex-direction: column; text-align: start; line-height: 1.25; }
.user-copy strong { font-size: .78rem; }
.user-copy small { color: var(--y-muted); font-size: .65rem; }
.mobile-menu-button { display: none; }
.mobile-menu-button span { background: var(--y-text); }
.yegan-dropdown {
    min-width: 12rem;
    padding: .5rem;
    border: 1px solid var(--y-border);
    border-radius: var(--y-radius-md);
    background: var(--y-surface);
    box-shadow: var(--y-shadow-md);
}
.yegan-dropdown .dropdown-item { border-radius: .65rem; color: var(--y-text); font-size: .82rem; }
.yegan-dropdown .dropdown-item:hover { background: var(--y-hover); }

/* Page structure */
.page-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.page-heading h2 { margin: 0 0 .35rem; font-size: clamp(1.45rem, 2vw, 2rem); }
.page-heading p:not(.eyebrow) { margin: 0; color: var(--y-muted); }
.page-heading-actions { display: flex; gap: .6rem; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: .8rem; margin-bottom: .8rem; }
.stat-card,
.yegan-card {
    border: 1px solid var(--y-border);
    border-radius: var(--y-radius-lg);
    background: var(--y-surface);
    box-shadow: var(--y-shadow-sm);
}
.stat-card { display: flex; align-items: center; gap: .75rem; padding: .85rem; }
.stat-icon {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 1rem;
    background: var(--y-primary-soft);
    color: var(--y-primary);
    font-size: 1.15rem;
    font-weight: 900;
}
.stat-card > div:last-child { min-width: 0; display: flex; flex-direction: column; }
.stat-card span { color: var(--y-muted); font-size: .72rem; }
.stat-card strong { margin: .2rem 0; overflow: hidden; text-overflow: ellipsis; font-size: 1.05rem; white-space: nowrap; }
.stat-card small { color: var(--y-muted); font-size: .68rem; }
.positive { color: #178a5b !important; }
.content-grid { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(260px,.7fr); gap: .8rem; margin-bottom: .8rem; }
.stacked-cards { display: grid; align-content: start; gap: .8rem; }
.yegan-card { padding: 1rem; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .9rem; }
.card-heading.compact { margin-bottom: .75rem; }
.card-heading h3 { margin: 0; font-size: 1.05rem; }
.yegan-badge { background: var(--y-primary-soft); color: var(--y-primary); border: 1px solid rgba(var(--y-primary-rgb), 0.2); }
.accent-card {
    overflow: hidden;
    background:
        radial-gradient(circle at 100% 0, rgba(var(--y-primary-rgb), 0.2), transparent 45%),
        var(--y-surface);
}
.accent-card h3 { margin: .2rem 0 .9rem; font-size: 1.75rem; }
.yegan-progress { height: .55rem; border-radius: 999px; background: var(--y-hover); }
.yegan-progress .progress-bar { border-radius: inherit; background: linear-gradient(90deg, var(--y-primary), var(--y-accent)); }
.progress-meta { display: flex; justify-content: space-between; margin-top: .55rem; color: var(--y-muted); font-size: .72rem; }
.activity-list { display: grid; gap: .85rem; }
.activity-item { display: grid; grid-template-columns: 12px 1fr; gap: .65rem; align-items: start; }
.activity-dot { width: 10px; height: 10px; margin-top: .28rem; border: 3px solid var(--y-primary-soft); border-radius: 50%; background: var(--y-primary); box-shadow: 0 0 0 2px rgba(var(--y-primary-rgb), 0.22); }
.activity-item div { display: flex; flex-direction: column; }
.activity-item strong { font-size: .78rem; }
.activity-item small { color: var(--y-muted); font-size: .68rem; }

/* Bootstrap form overrides */
.form-label { color: var(--y-text); font-size: .76rem; font-weight: 700; }
.form-control,
.form-select,
.input-group-text {
    min-height: 42px;
    border-color: var(--y-border);
    border-radius: .8rem;
    background-color: var(--y-input-bg);
    color: var(--y-text);
    padding: .52rem .72rem;
    line-height: 1.25;
    font-size: .82rem;
    box-shadow: none !important;
    transition: border-color var(--y-transition), box-shadow var(--y-transition), background var(--y-transition);
}
.form-control::placeholder { color: color-mix(in srgb, var(--y-muted) 72%, transparent); }
.form-control:focus,
.form-select:focus {
    border-color: rgba(var(--y-primary-rgb), 0.72);
    background-color: var(--y-input-bg);
    color: var(--y-text);
    box-shadow: 0 0 0 .22rem rgba(var(--y-primary-rgb), 0.13) !important;
}
.input-group > .form-control { border-radius: 0 .8rem .8rem 0; }
.input-group > .input-group-text { display: flex; align-items: center; justify-content: center; border-radius: .8rem 0 0 .8rem; color: var(--y-primary); font-weight: 800; line-height: 1; }
html[dir="rtl"] .input-group > .form-control { border-radius: .8rem 0 0 .8rem; }
html[dir="rtl"] .input-group > .input-group-text { border-radius: 0 .8rem .8rem 0; }
.form-check-input {
    border-color: color-mix(in srgb, var(--y-border) 74%, var(--y-muted));
    background-color: var(--y-input-bg);
}
.form-check-input:checked { border-color: var(--y-primary); background-color: var(--y-primary); }
.form-check-input:focus { border-color: var(--y-primary); box-shadow: 0 0 0 .22rem rgba(var(--y-primary-rgb), 0.13); }
.choice-row { display: flex; flex-wrap: wrap; gap: .55rem; }
.choice-card {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 40px;
    padding: .45rem .7rem;
    border: 1px solid var(--y-border);
    border-radius: .8rem;
    background: var(--y-surface-2);
    font-size: .75rem;
    cursor: pointer;
}
.choice-card:has(input:checked) { border-color: rgba(var(--y-primary-rgb), 0.48); background: var(--y-primary-soft); color: var(--y-primary); }
.choice-card input { accent-color: var(--y-primary); }
.form-actions { display: flex; justify-content: flex-end; gap: .6rem; padding-top: .35rem; }
.btn { min-height: 42px; padding: .55rem 1rem; border-radius: .8rem; font-size: .8rem; font-weight: 700; transition: all var(--y-transition); }
.btn-theme {
    border-color: var(--y-primary);
    background: linear-gradient(135deg, var(--y-primary), var(--y-primary-strong));
    color: #fff;
    box-shadow: 0 9px 20px rgba(var(--y-primary-rgb), 0.18);
}
.btn-theme:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 13px 25px rgba(var(--y-primary-rgb), 0.26); }
.btn-soft { border: 1px solid var(--y-border); background: var(--y-surface-2); color: var(--y-text); }
.btn-soft:hover { border-color: rgba(var(--y-primary-rgb), 0.3); background: var(--y-primary-soft); color: var(--y-primary); }

/* Native control icon alignment */
.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    height: 42px;
    padding-block: .5rem;
    background-position: right .72rem center;
    background-size: 16px 12px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}
html[dir="rtl"] .form-select {
    padding-right: .72rem;
    padding-left: 2.25rem;
    background-position: left .72rem center;
}
/* List boxes do not use a dropdown chevron. */
.form-select[multiple], .form-select[size]:not([size="1"]) { background-image: none; }
input[type="date"].form-control,
input[type="time"].form-control,
input[type="datetime-local"].form-control {
    height: 42px;
    display: flex;
    align-items: center;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    width: 17px;
    height: 17px;
    margin: 0;
    padding: 0;
    opacity: .68;
    cursor: pointer;
}

html[data-mode="dark"] .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%239ca6b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}
html[data-mode="dark"] .form-select option {
    background: var(--y-surface);
    color: var(--y-text);
}

.input-group { align-items: stretch; }
.input-group > .form-control,
.input-group > .form-select,
.input-group > .input-group-text { height: 42px; }

/* Data grid */
.data-card { padding: 0; overflow: hidden; }
.table-heading { padding: .9rem .95rem 0; }
.table-tools { display: flex; align-items: center; gap: .55rem; }
.search-box {
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: 0 .68rem;
    border: 1px solid var(--y-border);
    border-radius: .8rem;
    background: var(--y-input-bg);
}
.search-box:focus-within {
    border-color: rgba(var(--y-primary-rgb), 0.72);
    box-shadow: 0 0 0 .22rem rgba(var(--y-primary-rgb), 0.13);
}
.search-box .search-icon {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    display: block;
    color: var(--y-muted);
}
.search-box svg { vertical-align: middle; }
.search-box input { width: 13rem; height: 38px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--y-text); font-size: .78rem; line-height: 1.2; }
.yegan-table-wrap { max-height: 430px; }
.yegan-table {
    --bs-table-color: var(--y-text);
    --bs-table-bg: var(--y-surface);
    --bs-table-border-color: var(--y-border);
    --bs-table-hover-color: var(--y-text);
    --bs-table-hover-bg: var(--y-hover);
    min-width: 820px;
    margin: 0;
    color: var(--y-text) !important;
}
.yegan-table > :not(caption) > * > * { color: var(--y-text); }
.yegan-table thead { position: sticky; top: 0; z-index: 2; }
.yegan-table th {
    padding: .7rem .85rem;
    border-bottom: 1px solid var(--y-border);
    background: var(--y-table-head);
    color: var(--y-muted);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}
.yegan-table td { padding: .72rem .85rem; border-color: var(--y-border); background: var(--y-surface); color: var(--y-text); font-size: .77rem; }
.yegan-table tbody tr:hover td { background: var(--y-hover); }
.status { display: inline-flex; align-items: center; padding: .28rem .55rem; border-radius: 999px; font-size: .65rem; font-weight: 800; }
.status-success { background: #e5f7ef; color: #187a53; }
.status-warning { background: #fff2d8; color: #946315; }
.status-info { background: var(--y-primary-soft); color: var(--y-primary); }
html[data-mode="dark"] .status-success { background: rgb(24 122 83 / 20%); }
html[data-mode="dark"] .status-warning { background: rgb(148 99 21 / 22%); }
.row-menu { border: 0; background: transparent; color: var(--y-muted); letter-spacing: .08em; }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .7rem .95rem; border-top: 1px solid var(--y-border); color: var(--y-muted); font-size: .72rem; }
.pagination-bar { width: 100%; }
.pagination-meta { color: var(--y-muted); }
.pagination-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .55rem; }
.yegan-pagination { display: flex; gap: .28rem; }
.yegan-pagination button {
    min-width: 32px;
    height: 32px;
    border: 1px solid var(--y-border);
    border-radius: .65rem;
    background: var(--y-surface-2);
    color: var(--y-text);
}
.yegan-pagination button.active { border-color: var(--y-primary); background: var(--y-primary); color: #fff; }
.yegan-pagination button:disabled { opacity: .42; }

.mobile-backdrop { display: none; }

/* Accessibility */
:focus-visible { outline: 3px solid rgba(var(--y-primary-rgb), 0.28); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Tablet */
@media (max-width: 1199.98px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .content-grid { grid-template-columns: 1fr; }
    .stacked-cards { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .user-copy { display: none; }
}

/* Mobile sidebar becomes overlay */
@media (max-width: 991.98px) {
    .yegan-app,
    .yegan-app.sidebar-closed { display: block; padding: .8rem; }
    .yegan-sidebar {
        position: fixed;
        top: .8rem;
        inset-inline-start: .8rem;
        width: min(290px, calc(100vw - 1.6rem));
        pointer-events: none;
        visibility: hidden;
        transform: translateY(-12px) scale(.98);
        opacity: 0;
        transition: transform var(--y-transition), opacity var(--y-transition);
    }
    .sidebar-open .yegan-sidebar { visibility: visible; pointer-events: auto; transform: none; opacity: 1; }
    .sidebar-closed .sidebar-expandable { max-height: calc(100vh - 7rem); opacity: 1; transform: none; padding: 0 .65rem .7rem; pointer-events: none; }
    .mobile-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1030;
        display: block;
        visibility: hidden;
        opacity: 0;
        background: var(--y-overlay);
        backdrop-filter: blur(3px);
        transition: opacity var(--y-transition), visibility var(--y-transition);
    }
    .mobile-backdrop.show { visibility: visible; opacity: 1; }
    .mobile-menu-button { display: grid; }
    .yegan-topbar { top: .8rem; }
    .theme-switcher { display: none; }
    body.sidebar-lock { overflow: hidden; }
}

@media (max-width: 767.98px) {
    .yegan-content { padding-top: 1rem; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .stats-grid { grid-template-columns: 1fr; }
    .stacked-cards { grid-template-columns: 1fr; }
    .topbar-heading .eyebrow { display: none; }
    .topbar-heading h1 { font-size: 1rem; }
    .table-heading { align-items: stretch; flex-direction: column; }
    .table-tools { align-items: stretch; }
    .search-box { flex: 1; }
    .search-box input { width: 100%; }
    .table-footer { align-items: flex-start; flex-direction: column; }
    .pagination-actions { width: 100%; justify-content: space-between; }
    .yegan-footer { flex-direction: column; }
}

@media (max-width: 479.98px) {
    .page-heading-actions { width: 100%; }
    .page-heading-actions .btn { flex: 1; }
    .stat-card { padding: .85rem; }
    .yegan-card { padding: .82rem; }
    .form-actions .btn { flex: 1; }
}

/* Shared appearance controls: accessible, persistent segmented buttons. */
.yegan-mode-toggle { display: inline-flex; align-items: center; gap: 3px; padding: 4px; border: 1px solid var(--y-border); border-radius: 12px; background: var(--y-surface-2); }
.yegan-mode-toggle button { border: 0; border-radius: 8px; padding: 7px 10px; background: transparent; color: var(--y-muted); font: inherit; font-size: .75rem; white-space: nowrap; cursor: pointer; }
.yegan-mode-toggle button.selected { background: var(--y-primary); color: white; box-shadow: var(--y-shadow-sm); }
.yegan-mode-toggle button:focus-visible { outline: 2px solid var(--y-primary); outline-offset: 2px; }
.yegan-appearance { flex-wrap: wrap; }
.yegan-appearance .theme-switcher { display: flex; }
.yegan-mode-button { display:inline-grid; place-items:center; flex-shrink:0; width:38px; height:38px; border:1px solid var(--y-border); border-radius:50%; background:var(--y-surface-2); color:var(--y-primary); cursor:pointer; }
.yegan-mode-button:hover { background:var(--y-primary-soft); }
.yegan-mode-button:focus-visible { outline:2px solid var(--y-primary); outline-offset:3px; }
.yegan-mode-button:disabled { cursor:wait; opacity:.6; }
.plan-currency-hidden { display:none!important; }
.company-basic .plan-fx-only { display:none!important; }
.company-basic .transaction-list-table { width:100%; min-width:0!important; table-layout:auto; }
.company-basic .transaction-list-table td.transaction-description-cell { width:auto; min-width:180px; max-width:300px; padding-inline-end:1rem; }
.company-basic .transaction-list-table .transaction-description-cell .transaction-description { width:clamp(180px, 20vw, 300px); max-width:100%; }
.company-basic .journal-filter-bar { gap:1rem; }
.company-basic .journal-filter-bar .data-filter-field:empty { display:none; }
.data-filter-field:empty, .statement-mode-field:empty { display:none; }
.company-basic .reference-currencies th:nth-child(n+4), .company-basic .reference-currencies td:nth-child(n+4) { display:none; }
.company-basic .data-filter-field:has(> .plan-currency-hidden),
.company-basic [class*="col-md-"]:has(> .plan-currency-hidden),
.company-basic [class*="col-lg-"]:has(> .plan-currency-hidden),
.company-basic label:has(> .plan-currency-hidden),
.company-basic .plan-native-currency { display:none!important; }
.reference-tabs { display:flex; flex-wrap:wrap; gap:.5rem; margin:1.5rem 0; padding:.4rem; border-bottom:1px solid var(--y-border); }
.reference-tabs button { border:0; border-bottom:3px solid transparent; padding:.8rem 1.25rem; background:transparent; color:var(--y-muted); font:inherit; font-weight:600; cursor:pointer; }
.reference-tabs button.selected { color:var(--y-primary); border-bottom-color:var(--y-primary); background:var(--y-primary-soft); border-radius:.65rem .65rem 0 0; }

/* Recovery uses the shared theme so all hosts receive the same spacing. */
.auth-login-card.recovery-card { padding: clamp(1.75rem, 4vw, 3rem); }
.recovery-card .recovery-heading { display:flex; flex-direction:column; align-items:flex-start; gap:1rem; margin-bottom:2rem; }
.recovery-card .recovery-heading h3 { margin:0; font-size:clamp(1.5rem, 2.4vw, 1.9rem); line-height:1.35; font-weight:700; letter-spacing:normal; }
.recovery-card .recovery-emblem { display:grid; place-items:center; width:3rem; height:3rem; flex-shrink:0; border-radius:.9rem; background:var(--y-primary-soft); color:var(--y-primary); font-size:1.2rem; }
.recovery-card .form-label { display:block; margin-bottom:.65rem; font-size:.95rem; line-height:1.5; font-weight:600; }
.recovery-card .mb-4 { margin-bottom:1.5rem !important; }
.recovery-card .form-control { min-height:3.5rem; font-size:1rem; }
.recovery-card .btn-primary { min-height:3.5rem; padding:.85rem 1.25rem !important; font-size:1rem; line-height:1.5; font-weight:600; }
.recovery-card .recovery-footer { display:flex; justify-content:center; margin-top:1.75rem; padding-top:1.25rem; border-top:1px solid var(--y-border); }
.recovery-card .recovery-footer a { font-size:.95rem; font-weight:600; line-height:1.6; }
.recovery-card .recovery-notice { display:flex; gap:.75rem; padding:1rem; margin-bottom:1.5rem; border:1px solid var(--y-border); border-radius:var(--y-radius-md); background:var(--y-input-bg); }
.recovery-card .recovery-notice > i { color:var(--y-primary); margin-top:.3rem; }
.recovery-card .recovery-notice p { margin:0; font-size:.9rem; line-height:1.8; }
.recovery-card .recovery-code { text-align:center; font-size:1.6rem; letter-spacing:.4em; font-weight:600; }
.recovery-card .recovery-resend { color:var(--y-link); font-size:.95rem; font-weight:600; padding:.65rem 1rem; }
.recovery-card .recovery-resend:hover { background:var(--y-primary-soft); }
.recovery-card .recovery-heading-success { align-items:center; text-align:center; margin-bottom:1.25rem; }
.recovery-card .recovery-heading-success .recovery-emblem { width:4rem; height:4rem; border-radius:50%; font-size:1.6rem; }
.recovery-card .recovery-success { text-align:center; font-size:1rem; line-height:1.85; margin-bottom:1.5rem; }
.recovery-card .recovery-success p { margin:0; }
.email-verification-card .verification-description { margin:0 0 1.75rem; font-size:.95rem; line-height:1.85; color:var(--y-text); opacity:.8; }
.email-verification-card .recovery-heading { margin-bottom:1rem; }
.email-verification-card .verification-footer { flex-wrap:wrap; align-items:center; gap:.4rem; font-size:.9rem; line-height:1.7; }
.email-verification-card .auth-alert, .email-verification-card .alert { margin-bottom:1.5rem; font-size:.9rem; line-height:1.8; }
