@font-face {
    font-family: 'IRANSansXFaNum';
    src: url('../fonts/IRANSansXFaNum-Regular.woff2') format('woff2'),
         url('../fonts/IRANSansXFaNum-Regular.woff') format('woff'),
         url('../fonts/IRANSansXFaNum-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'IRANSansXFaNum';
    src: url('../fonts/IRANSansXFaNum-Medium.woff2') format('woff2'),
         url('../fonts/IRANSansXFaNum-Medium.woff') format('woff'),
         url('../fonts/IRANSansXFaNum-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'IRANSansXFaNum';
    src: url('../fonts/IRANSansXFaNum-Bold.woff2') format('woff2'),
         url('../fonts/IRANSansXFaNum-Bold.woff') format('woff'),
         url('../fonts/IRANSansXFaNum-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary: #4D81E8;
    --primary-hover: #3B6FD6;
    --primary-soft: rgba(77, 129, 232, 0.12);
    --primary-border: rgba(77, 129, 232, 0.28);

    --bg-canvas: #F3F6FB;
    --bg-surface: #FFFFFF;
    --bg-elevated: #F8FAFC;
    --bg-sidebar: #FFFFFF;
    --bg-topbar: #FFFFFF;

    --text-main: #0F172A;
    --text-muted: #475569;
    --text-subtle: #64748B;

    --border-color: #E2E8F0;
    --border-strong: #CBD5E1;

    --success: #10B981;
    --success-soft: rgba(16, 185, 129, 0.12);
    --warning: #F59E0B;
    --warning-soft: rgba(245, 158, 11, 0.14);
    --danger: #EF4444;
    --danger-soft: rgba(239, 68, 68, 0.12);

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 6px 20px rgba(15, 23, 42, 0.07);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --sidebar-width: 265px;
    --topbar-height: 60px;
    --tabbar-height: 42px;
    --statusbar-height: 32px;
}

[data-theme="dark"] {
    --primary: #5B8EF0;
    --primary-hover: #4D81E8;
    --primary-soft: rgba(91, 142, 240, 0.16);
    --primary-border: rgba(91, 142, 240, 0.35);

    --bg-canvas: #0B1120;
    --bg-surface: #111827;
    --bg-elevated: #1E293B;
    --bg-sidebar: #0F172A;
    --bg-topbar: #0F172A;

    --text-main: #F1F5F9;
    --text-muted: #CBD5E1;
    --text-subtle: #94A3B8;

    --border-color: #1E293B;
    --border-strong: #334155;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.45);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'IRANSansXFaNum', system-ui, -apple-system, sans-serif;
    background: var(--bg-canvas);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* App Shell */
.bnk-shell {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
}

/* Topbar */
.bnk-topbar {
    height: var(--topbar-height);
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.bnk-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
    color: var(--text-main);
    white-space: nowrap;
}
.bnk-brand img {
    height: 34px;
    width: auto;
    border-radius: 8px;
}

.bnk-search-wrap {
    flex: 1;
    max-width: 480px;
    position: relative;
}
.bnk-search-input {
    width: 100%;
    height: 38px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0 38px 0 14px;
    font-size: 13px;
    transition: border-color .2s, box-shadow .2s;
}
.bnk-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.bnk-search-icon {
    position: absolute;
    inset-inline-start: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-subtle);
    pointer-events: none;
}
.bnk-search-results {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 60;
    max-height: 360px;
    overflow-y: auto;
    display: none;
}
.bnk-search-results.open { display: block; }
.bnk-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    cursor: pointer;
}
.bnk-search-item:hover { background: var(--primary-soft); }
.bnk-search-item small { color: var(--text-subtle); margin-inline-start: auto; }

.bnk-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bnk-select-pill {
    height: 34px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0 10px;
    font-size: 12px;
    cursor: pointer;
}

.bnk-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    border: 1px solid var(--border-color);
    background: var(--bg-elevated);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .18s ease;
}
.bnk-icon-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

/* Body Layout */
.bnk-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Sidebar */
.bnk-sidebar {
    width: var(--sidebar-width);
    height: 100%;
    background: var(--bg-sidebar);
    border-inline-end: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 16px;
    transition: transform .25s ease;
    z-index: 35;
}
.bnk-nav-group-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-subtle);
    padding: 14px 16px 6px;
    text-transform: uppercase;
}
.bnk-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    margin: 2px 10px;
    border-radius: 9px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .16s ease;
}
.bnk-nav-item i {
    width: 18px;
    text-align: center;
    font-size: 14px;
}
.bnk-nav-item:hover {
    background: var(--primary-soft);
    color: var(--primary);
}
.bnk-nav-item.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(77, 129, 232, 0.28);
}

.bnk-nav-sub {
    margin: 2px 22px 6px;
    padding-inline-start: 10px;
    border-inline-start: 2px solid var(--border-color);
    display: none;
    flex-direction: column;
    gap: 2px;
}
.bnk-nav-sub.open { display: flex; }
.bnk-nav-sub a {
    padding: 6px 10px;
    border-radius: 7px;
    font-size: 12.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}
.bnk-nav-sub a:hover {
    background: var(--primary-soft);
    color: var(--primary);
}
.bnk-nav-sub a.active {
    background: var(--primary);
    color: #fff;
    font-weight: 700;
}

/* Main Workspace */
.bnk-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
}

/* Multi-Tab Bar */
.bnk-tabbar {
    height: var(--tabbar-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: flex-end;
    padding: 0 12px;
    gap: 4px;
    overflow-x: auto;
}
.bnk-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 9px 9px 0 0;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
}
.bnk-tab.active {
    background: var(--bg-canvas);
    color: var(--primary);
    border-color: var(--border-color);
    font-weight: 700;
    position: relative;
}
.bnk-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    inset-inline: 0;
    height: 2px;
    background: var(--bg-canvas);
}
.bnk-tab-close {
    opacity: .6;
    font-size: 11px;
    padding: 2px 4px;
    border-radius: 4px;
}
.bnk-tab-close:hover { opacity: 1; background: var(--danger-soft); color: var(--danger); }

/* Content Area */
.bnk-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* Cards, Grids & Forms */
.bnk-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}
.bnk-page-title {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.bnk-grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.bnk-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 16px;
}

.bnk-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-sm);
}
.bnk-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}
.bnk-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.bnk-stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.bnk-stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.bnk-stat-value {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
}
.bnk-stat-label {
    font-size: 12px;
    color: var(--text-subtle);
}

/* Buttons */
.bnk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    border-radius: 9px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .18s ease;
}
.bnk-btn-primary {
    background: var(--primary);
    color: #fff;
}
.bnk-btn-primary:hover { background: var(--primary-hover); }
.bnk-btn-outline {
    background: var(--bg-surface);
    border-color: var(--border-strong);
    color: var(--text-main);
}
.bnk-btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.bnk-btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
}
.bnk-btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }

/* Form Inputs */
.bnk-form-group { margin-bottom: 14px; }
.bnk-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-muted);
}
.bnk-input, .bnk-select, .bnk-textarea {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 9px;
    font-size: 13px;
    transition: border-color .18s, box-shadow .18s;
}
.bnk-textarea { height: auto; padding: 10px 12px; min-height: 80px; }
.bnk-input:focus, .bnk-select:focus, .bnk-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* Tables (ERP Grid) */
.bnk-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
}
.bnk-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.bnk-table th {
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-weight: 700;
    text-align: start;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.bnk-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
.bnk-table tr:hover td { background: var(--primary-soft); }

/* Badges */
.bnk-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
}
.bnk-badge-primary { background: var(--primary-soft); color: var(--primary); }
.bnk-badge-success { background: var(--success-soft); color: var(--success); }
.bnk-badge-warning { background: var(--warning-soft); color: var(--warning); }
.bnk-badge-danger { background: var(--danger-soft); color: var(--danger); }

/* Process Flowchart (inspired by screenshots) */
.bnk-flow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 24px 12px;
}
.bnk-flow-node {
    background: var(--bg-elevated);
    border: 1px solid var(--primary-border);
    border-radius: 12px;
    padding: 14px 20px;
    min-width: 155px;
    text-align: center;
    font-weight: 600;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
    transition: transform .18s, border-color .18s;
}
.bnk-flow-node:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    color: var(--primary);
}
.bnk-flow-arrow { color: var(--primary); font-size: 18px; }

/* Bottom Status Bar */
.bnk-statusbar {
    height: var(--statusbar-height);
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    font-size: 12px;
    color: var(--text-subtle);
}
.bnk-statusbar-items {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Toast */
.bnk-toast-container {
    position: fixed;
    bottom: 48px;
    inset-inline-end: 20px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.bnk-toast {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-inline-start: 4px solid var(--primary);
    padding: 12px 16px;
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    font-size: 13px;
    min-width: 240px;
}
.bnk-toast.success { border-inline-start-color: var(--success); }
.bnk-toast.error { border-inline-start-color: var(--danger); }

/* Mobile Web-App Bottom Bar & Responsive */
.bnk-mobile-toggle { display: none; }
.bnk-mobile-nav { display: none; }

@media (max-width: 992px) {
    .bnk-mobile-toggle { display: inline-flex; }
    .bnk-topbar {
        height: auto;
        min-height: 54px;
        padding: 8px 10px;
        gap: 8px;
        flex-wrap: wrap;
    }
    .bnk-brand img { height: 28px; }
    .bnk-topbar-actions {
        gap: 5px;
        flex-wrap: wrap;
        justify-content: flex-end;
        max-width: 100%;
    }
    .bnk-select-pill {
        max-width: 115px;
        font-size: 11px;
        padding: 0 6px;
        height: 32px;
        text-overflow: ellipsis;
    }
    .bnk-icon-btn {
        width: 32px;
        height: 32px;
    }
    .bnk-sidebar {
        position: fixed;
        top: 56px;
        bottom: 58px;
        height: calc(100dvh - 114px);
        inset-inline-start: 0;
        transform: translateX(100%);
        box-shadow: var(--shadow-md);
    }
    [dir="ltr"] .bnk-sidebar { transform: translateX(-100%); }
    .bnk-sidebar.open { transform: translateX(0); }

    .bnk-search-wrap { display: none; }
    .bnk-statusbar { display: none; }
    .bnk-content { padding: 14px 12px 76px; }
    .bnk-grid-2 { grid-template-columns: 1fr; }

    .bnk-mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        inset-inline: 0;
        height: 58px;
        background: var(--bg-surface);
        border-top: 1px solid var(--border-color);
        z-index: 50;
        justify-content: space-around;
        align-items: center;
    }
    .bnk-mobile-nav-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        font-size: 11px;
        color: var(--text-muted);
        background: none;
        border: none;
        cursor: pointer;
    }
    .bnk-mobile-nav-btn.active { color: var(--primary); font-weight: 700; }
}
