@font-face {
    font-family: 'IRANYekanX';
    src: url('../fonts/IRANYekanX-Regular.woff2') format('woff2'), url('../fonts/IRANYekanX-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IRANYekanX';
    src: url('../fonts/IRANYekanX-Medium.woff2') format('woff2'), url('../fonts/IRANYekanX-Medium.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IRANYekanX';
    src: url('../fonts/IRANYekanX-Bold.woff2') format('woff2'), url('../fonts/IRANYekanX-Bold.woff') format('woff');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --app-bg: #f3f6fb;
    --app-surface: #ffffff;
    --app-surface-muted: #f8fafc;
    --app-border: #dce4ef;
    --app-text: #172033;
    --app-muted: #64748b;
    --app-primary: #2457d6;
    --app-primary-dark: #173eaa;
    --app-sidebar: #111a2d;
    --app-sidebar-muted: #9daccc;
    --app-radius-sm: .65rem;
    --app-radius: 1rem;
    --app-radius-lg: 1.35rem;
    --app-shadow: 0 12px 32px rgba(25, 43, 76, .08);
    --app-focus: 0 0 0 .22rem rgba(36, 87, 214, .25);
}

html { min-height: 100%; }

body {
    min-height: 100vh;
    margin: 0;
    background: var(--app-bg);
    color: var(--app-text);
    font-family: 'IRANYekanX', Tahoma, Arial, sans-serif;
    line-height: 1.65;
}

button, input, select, textarea { font: inherit; }
a { text-underline-offset: .18em; }

:focus-visible {
    outline: 2px solid var(--app-primary);
    outline-offset: 2px;
    box-shadow: var(--app-focus);
}

.skip-link {
    position: fixed;
    inset-block-start: .75rem;
    inset-inline-start: .75rem;
    z-index: 2000;
    padding: .65rem 1rem;
    border-radius: var(--app-radius-sm);
    background: var(--app-text);
    color: #fff;
    transform: translateY(-180%);
}

.skip-link:focus { transform: translateY(0); }

.app-shell { min-height: 100vh; }

.app-sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 1030;
    width: 17.5rem;
    flex-direction: column;
    overflow-y: auto;
    padding: 1.25rem;
    background: var(--app-sidebar);
    color: #fff;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 3.25rem;
    color: #fff;
    text-decoration: none;
}

.app-brand:hover { color: #fff; }
.app-brand svg { width: 2.35rem; height: 2.35rem; color: #7ca3ff; }
.app-brand strong { display: block; font-size: 1rem; }
.app-brand small { display: block; color: var(--app-sidebar-muted); font-size: .72rem; }

.sidebar-nav {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-bottom: 1.25rem;
}

.sidebar-nav__group {
    display: grid;
    gap: .2rem;
}

.sidebar-nav__group + .sidebar-nav__group {
    padding-top: .9rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-nav__label {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 0 .75rem .35rem;
    color: var(--app-sidebar-muted);
    font-size: .69rem;
    font-weight: 600;
    letter-spacing: .02em;
}

.sidebar-nav__label::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: rgba(157, 172, 204, .2);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .7rem .8rem;
    border-radius: .75rem;
    color: #dfe7f8;
    font-size: .88rem;
    text-decoration: none;
}

.sidebar-nav a:hover,
.sidebar-nav a.active { background: rgba(124, 163, 255, .16); color: #fff; }
.sidebar-nav a.sidebar-nav__action {
    border: 1px solid rgba(124, 163, 255, .24);
    background: rgba(36, 87, 214, .13);
}
.sidebar-nav a.sidebar-nav__action:hover,
.sidebar-nav a.sidebar-nav__action.active { border-color: rgba(124, 163, 255, .48); background: rgba(36, 87, 214, .28); }
.sidebar-nav svg { flex: 0 0 auto; width: 1.15rem; height: 1.15rem; }

.sidebar-profile {
    margin-top: auto;
    flex: 0 0 auto;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: var(--app-radius);
    background: rgba(255, 255, 255, .05);
    text-align: center;
}

.sidebar-profile strong,
.sidebar-profile small { display: block; }
.sidebar-profile small { color: var(--app-sidebar-muted); }

.app-workspace { min-width: 0; }

.app-topbar {
    position: sticky;
    inset-block-start: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4.4rem;
    padding: .75rem clamp(1rem, 3vw, 2.5rem);
    border-bottom: 1px solid rgba(220, 228, 239, .85);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(12px);
}

.app-topbar__identity { min-width: 0; }
.app-topbar__identity small { display: block; color: var(--app-muted); }
.app-topbar__identity strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-topbar > .d-flex { min-width: 0; }
.app-topbar__actions { display: flex; align-items: center; gap: .5rem; }

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.65rem;
    height: 2.65rem;
    border: 1px solid var(--app-border);
    border-radius: .8rem;
    background: var(--app-surface);
    color: var(--app-text);
}

.icon-button svg { width: 1.25rem; height: 1.25rem; }
.topbar-logout { margin: 0; }
.icon-button--danger { color: #b42318; }
.icon-button--danger:hover { border-color: #f0b4ae; background: #fff0ee; color: #921d14; }

.app-main {
    width: min(100%, 100rem);
    margin-inline: auto;
    padding: clamp(1rem, 3vw, 2.5rem);
}

.app-breadcrumb { margin-bottom: 1rem; color: var(--app-muted); font-size: .78rem; }
.app-breadcrumb a { color: var(--app-muted); text-decoration: none; }

.offcanvas.app-mobile-menu { width: min(88vw, 20rem); background: var(--app-sidebar); color: #fff; }
.app-mobile-menu .btn-close { filter: invert(1); }

.btn { border-radius: .7rem; font-weight: 500; }
.btn-primary { background: var(--app-primary); border-color: var(--app-primary); }
.btn-primary:hover { background: var(--app-primary-dark); border-color: var(--app-primary-dark); }
.form-control, .form-select { min-height: 2.75rem; border-color: #cbd6e5; border-radius: .7rem; }
.form-control:focus, .form-select:focus { border-color: var(--app-primary); box-shadow: var(--app-focus); }
.ltr-control { direction: ltr; text-align: left; }

.card { border-radius: var(--app-radius); }
.table > :not(caption) > * > * { padding: .85rem .8rem; }
.text-muted { color: var(--app-muted) !important; }

@media (min-width: 1200px) {
    .app-workspace { margin-inline-start: 17.5rem; }
}

@media (max-width: 575.98px) {
    .app-topbar { min-height: 4rem; padding-inline: .85rem; }
    .app-topbar__identity small { font-size: .68rem; }
    .app-topbar__identity strong { max-width: 10rem; font-size: .85rem; }
    .app-main { padding: 1rem .75rem 2rem; }
    .app-breadcrumb { margin-bottom: .65rem; }
    .btn { min-height: 2.7rem; }
}

@media (max-width: 350px) {
    .app-topbar { gap: .35rem; }
    .app-topbar__actions { gap: .25rem; }
    .topbar-notifications { display: none; }
    .icon-button { width: 2.45rem; height: 2.45rem; }
    .app-topbar__identity strong { max-width: 8rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
.persian-date-control {
    direction: ltr;
    text-align: left;
    font-variant-numeric: tabular-nums;
    padding-left: 2.75rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%2317223a' stroke-width='1.8'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M16 3v4M8 3v4M3 10h18'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.85rem center;
    background-size: 1.25rem;
}
