@font-face {
    font-family: "Vazirmatn";
    src: url("../lib/vazirmatn/Vazirmatn-Regular.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("../lib/vazirmatn/Vazirmatn-Bold.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}

/* ---------- Theme ----------
   --bs-body-bg stays white because Bootstrap uses it for inputs and cards;
   the page itself gets its own (tinted) background so fields stand out. */
:root {
    --bs-body-font-family: "Vazirmatn", Tahoma, sans-serif;
    --bs-body-color: #1f2a37;
    --bs-primary: #1e5b96;
    --bs-primary-rgb: 30, 91, 150;
    --bs-link-color: #1e5b96;
    --bs-link-color-rgb: 30, 91, 150;
    --bs-link-hover-color: #154370;
    --bs-link-hover-color-rgb: 21, 67, 112;
    --bs-border-color: #dde3ea;
    --bs-border-radius: .65rem;
    --bs-border-radius-sm: .5rem;
    --bs-border-radius-lg: .9rem;

    --app-page-bg: #eef2f7;
    --app-brand-dark: #16355a;
    --app-muted: #6b7686;
    --app-line: #e6ebf1;
    --app-soft: #f6f8fb;
    --app-shadow: 0 1px 2px rgba(22, 53, 90, .04), 0 6px 18px rgba(22, 53, 90, .06);
    --app-input-border: #cfd8e3;
    --app-input-border-hover: #a9b7c7;
    --app-focus-border: #5b8fc6;
    --app-focus-ring: 0 0 0 .25rem rgba(30, 91, 150, .2);
    --app-label-color: #3b4757;

    --app-topbar-height: 3.5rem;
    --app-sidebar-width: 16.5rem;
}

body {
    background-color: var(--app-page-bg);
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    font-weight: 600;
}

.btn-primary {
    box-shadow: 0 6px 14px rgba(30, 91, 150, .2);
    --bs-btn-bg: #1e5b96;
    --bs-btn-border-color: #1e5b96;
    --bs-btn-hover-bg: #184c7e;
    --bs-btn-hover-border-color: #184c7e;
    --bs-btn-active-bg: #154370;
    --bs-btn-active-border-color: #154370;
    --bs-btn-disabled-bg: #1e5b96;
    --bs-btn-disabled-border-color: #1e5b96;
    --bs-btn-focus-shadow-rgb: 30, 91, 150;
}

.btn-outline-primary {
    --bs-btn-color: #1e5b96;
    --bs-btn-border-color: #1e5b96;
    --bs-btn-hover-bg: #1e5b96;
    --bs-btn-hover-border-color: #1e5b96;
    --bs-btn-active-bg: #184c7e;
    --bs-btn-active-border-color: #184c7e;
    --bs-btn-focus-shadow-rgb: 30, 91, 150;
}

.btn-outline-secondary {
    --bs-btn-bg: #fff;
    --bs-btn-color: #4a5668;
    --bs-btn-border-color: var(--app-input-border);
    --bs-btn-hover-color: #1f2a37;
    --bs-btn-hover-bg: #e8edf3;
    --bs-btn-hover-border-color: var(--app-input-border-hover);
    --bs-btn-active-color: #1f2a37;
    --bs-btn-active-bg: #dde4ec;
    --bs-btn-active-border-color: var(--app-input-border-hover);
}

/* Icon button attached to an input (e.g. show password). */
.btn-input-addon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-inline: .8rem;
    color: #5b6878;
    background-color: #f6f8fb;
    border: 1px solid var(--app-input-border);
}

.btn-input-addon:hover,
.btn-input-addon:focus-visible {
    color: var(--bs-primary);
    background-color: #e8eef6;
    border-color: var(--app-input-border-hover);
}

/* ---------- Form fields ---------- */

.form-label {
    color: var(--app-label-color);
    font-size: .88rem;
    font-weight: 600;
    margin-bottom: .35rem;
}

.form-control,
.form-select {
    min-height: 2.65rem;
    background-color: #fcfdfe;
    border-color: var(--app-input-border);
}

.form-control:focus,
.form-select:focus {
    background-color: #fff;
}

.form-control-sm,
.form-select-sm {
    min-height: 0;
}

.input-validation-error {
    border-color: #e0798a;
    background-color: #fff8f9;
}

.form-control:hover:not(:disabled),
.form-select:hover:not(:disabled) {
    border-color: var(--app-input-border-hover);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--app-focus-border);
    box-shadow: var(--app-focus-ring);
}

.form-control::placeholder {
    color: #9aa5b4;
}

.form-control:disabled,
.form-select:disabled {
    background-color: #eef1f5;
    color: #6b7686;
    border-color: #d5dce5;
}

.form-text {
    color: #6b7686;
}

/* Fields flagged by server or client validation. */
.input-validation-error,
.input-validation-error:hover:not(:disabled) {
    border-color: #d63c4a;
}

.input-validation-error:focus {
    border-color: #d63c4a;
    box-shadow: 0 0 0 .25rem rgba(214, 60, 74, .2);
}

/* ---------- Checkboxes and switches ---------- */

.form-check-input {
    background-color: #fff;
    border: 1.5px solid #93a2b5;
}

.form-check-input:hover:not(:disabled) {
    border-color: var(--bs-primary);
}

.form-check-input:focus {
    border-color: var(--app-focus-border);
    box-shadow: var(--app-focus-ring);
}

.form-check-input:checked,
.form-check-input:indeterminate {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.form-switch .form-check-input {
    --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2393a2b5'/%3e%3c/svg%3e");
}

.form-switch .form-check-input:focus:not(:checked) {
    --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%235b8fc6'/%3e%3c/svg%3e");
}

.form-switch .form-check-input:checked {
    --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

/* ---------- Dropdowns ---------- */

.dropdown-menu {
    --bs-dropdown-link-active-bg: var(--bs-primary);
    --bs-dropdown-border-color: var(--bs-border-color);
}

/* Values that are always Latin (usernames, phone numbers, passwords) read left-to-right. */
.ltr {
    direction: ltr;
    unicode-bidi: plaintext;
}

input.ltr {
    text-align: left;
}

/* Amounts keep left-to-right order (number then symbol) inside right-to-left text. */
.money {
    direction: ltr;
    unicode-bidi: isolate;
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

.pagination {
    --bs-pagination-color: var(--bs-primary);
    --bs-pagination-hover-color: #154370;
    --bs-pagination-focus-color: #154370;
    --bs-pagination-focus-box-shadow: var(--app-focus-ring);
    --bs-pagination-active-bg: var(--bs-primary);
    --bs-pagination-active-border-color: var(--bs-primary);
}

/* Segmented choice (e.g. opening balance status) built from radio buttons in a .btn-group: a soft track with the
   chosen option raised on it. */
.btn-group:has(> .btn-check) {
    padding: .25rem;
    gap: .15rem;
    border-radius: .8rem;
    background: var(--app-soft);
    border: 1px solid var(--app-line);
}

.btn-group:has(> .btn-check) > .btn {
    flex: 1;
    border: 0;
    border-radius: .6rem !important;
    margin: 0 !important;
    background: transparent;
    color: var(--app-muted);
    box-shadow: none;
}

.btn-group:has(> .btn-check) > .btn:hover {
    color: var(--app-brand-dark);
    background: rgba(255, 255, 255, .6);
}

.btn-group:has(> .btn-check) > .btn-check:checked + .btn {
    background: #fff;
    color: var(--app-brand-dark);
    box-shadow: 0 2px 6px rgba(22, 53, 90, .12);
}

.btn-group:has(> .btn-check) > .btn-check:focus-visible + .btn {
    outline: 2px solid var(--app-focus-border);
}

/* ---------- App shell ----------
   Dark sidebar (brand, collapsible groups, user card) beside a light top bar.
   Below the lg breakpoint the sidebar becomes an off-canvas drawer. */

:root {
    --app-sidebar-bg: #14305a;
    --app-sidebar-bg-end: #0e2342;
    --app-sidebar-text: #c3d0e0;
    --app-sidebar-muted: #8197b3;
    --app-sidebar-hover: rgba(255, 255, 255, .07);
    --app-sidebar-active: rgba(255, 255, 255, .13);
    --app-sidebar-accent: #5aa9ff;
}

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

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-content {
    flex: 1 1 auto;
    padding: 1rem;
}

@media (min-width: 768px) {
    .app-content {
        padding: 1.5rem;
    }
}

/* Sidebar */

.app-sidebar {
    --bs-offcanvas-width: 17.5rem;
    --bs-offcanvas-bg: var(--app-sidebar-bg);
    color: var(--app-sidebar-text);
}

@media (min-width: 992px) {
    .app-sidebar-col {
        flex: 0 0 var(--app-sidebar-width);
        position: sticky;
        top: 0;
        height: 100vh;
        background: linear-gradient(180deg, var(--app-sidebar-bg) 0%, var(--app-sidebar-bg-end) 100%);
        box-shadow: 1px 0 6px rgba(0, 0, 0, .12);
        z-index: 1030;
    }

    .app-sidebar {
        height: 100%;
    }
}

@media (max-width: 991.98px) {
    .app-sidebar {
        background: linear-gradient(180deg, var(--app-sidebar-bg) 0%, var(--app-sidebar-bg-end) 100%);
    }
}

.app-sidebar-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

/* Same dashed routes as the sign-in page, fainter, with a soft light at the top. Clipped on its own so the
   collapsed sidebar's flyouts can still leave the rail. */
.app-sidebar-art {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    background: radial-gradient(circle at 85% 0%, rgba(91, 143, 198, .3), transparent 40%);
}

.app-sidebar-art .route-art path {
    stroke: rgba(255, 255, 255, .07);
}

/* No dots here: behind menu text they read as noise. */
.app-sidebar-art .route-art circle {
    display: none;
}

/* Painted above the decoration (positioned, later in the document). */
.app-sidebar-brand,
.app-sidebar-scroll,
.app-sidebar-user {
    position: relative;
}

.app-sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: 1rem 1rem .9rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.app-brand-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    color: #fff;
    text-decoration: none;
    min-width: 0;
}

.app-brand-link:hover {
    color: #fff;
}

.app-brand-mark {
    flex: 0 0 2.6rem;
    width: 2.6rem;
    height: 2.6rem;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .3));
}

.app-brand-name {
    display: block;
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.3;
}

.app-brand-subtitle {
    display: block;
    font-size: .7rem;
    color: var(--app-sidebar-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-sidebar-close {
    border: 0;
    background: transparent;
    color: var(--app-sidebar-text);
    padding: .25rem;
    border-radius: .4rem;
}

.app-sidebar-close:hover {
    background: var(--app-sidebar-hover);
    color: #fff;
}

.app-sidebar-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .2) transparent;
}

.app-nav {
    padding: .75rem .6rem 1rem;
}

.app-nav-group {
    margin-top: .6rem;
}

.app-nav-group-toggle {
    display: flex;
    align-items: center;
    gap: .55rem;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--app-sidebar-muted);
    font-size: .8rem;
    font-weight: 700;
    padding: .5rem .75rem;
    border-radius: .5rem;
    text-align: start;
}

.app-nav-group-toggle:hover {
    color: #fff;
    background: var(--app-sidebar-hover);
}

.app-nav-group-toggle span {
    flex: 1 1 auto;
}

.app-nav-chevron {
    transition: transform .2s ease;
}

.app-nav-group-toggle[aria-expanded="false"] .app-nav-chevron {
    transform: rotate(90deg);
}

.app-nav-items {
    padding: .2rem 0 .1rem;
    margin-inline-start: .95rem;
    border-inline-start: 1px solid rgba(255, 255, 255, .1);
}

.app-nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: .7rem;
    width: 100%;
    padding: .6rem .8rem;
    margin: .1rem 0;
    border: 0;
    border-radius: .55rem;
    background: transparent;
    color: var(--app-sidebar-text);
    text-decoration: none;
    font-size: .925rem;
    text-align: start;
}

.app-nav-items .app-nav-link {
    margin-inline-start: .45rem;
    width: calc(100% - .45rem);
}

.app-nav-link .icon {
    flex: 0 0 auto;
    opacity: .85;
}

.app-nav-link:hover {
    background: var(--app-sidebar-hover);
    color: #fff;
}

.app-nav-link.active {
    background: var(--app-sidebar-active);
    color: #fff;
    font-weight: 700;
}

.app-nav-link.active::before {
    content: "";
    position: absolute;
    inset-inline-start: -.45rem;
    top: .45rem;
    bottom: .45rem;
    width: 3px;
    border-radius: 3px;
    background: var(--app-sidebar-accent);
}

.app-nav-link.active .icon {
    opacity: 1;
    color: var(--app-sidebar-accent);
}

.app-nav-logout:hover {
    color: #ff9b9b;
}

.app-sidebar-user {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .85rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
    background: rgba(0, 0, 0, .12);
}

.app-sidebar-user-text {
    min-width: 0;
}

.app-sidebar-user-name {
    display: block;
    color: #fff;
    font-size: .875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-sidebar-user-role {
    display: block;
    color: var(--app-sidebar-muted);
    font-size: .75rem;
}

.app-avatar {
    flex: 0 0 2.25rem;
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #5aa9ff 0%, #2b6cb0 100%);
    color: #fff;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25);
}

.app-avatar-sm {
    flex-basis: 1.9rem;
    width: 1.9rem;
    height: 1.9rem;
}

/* Flyout title: only used when the sidebar is collapsed. */
.app-nav-flyout-title {
    display: none;
}

/* Collapsed sidebar (desktop): every main group becomes a tile (icon + title). Hovering or clicking a tile opens
   its items in a flyout panel next to the rail, so the user picks from one short list instead of many icons. */
@media (min-width: 992px) {
    .app-sidebar-col {
        transition: flex-basis .2s ease;
    }

    .sidebar-collapsed {
        --app-sidebar-width: 5.75rem;
    }

    .sidebar-collapsed .app-sidebar-brand {
        justify-content: center;
        padding-inline: .5rem;
    }

    .sidebar-collapsed .app-brand-link > span:not(.app-brand-mark),
    .sidebar-collapsed .app-sidebar-user-text,
    .sidebar-collapsed .app-nav-chevron {
        display: none;
    }

    /* The flyouts must be able to leave the rail. */
    .sidebar-collapsed .app-sidebar,
    .sidebar-collapsed .app-sidebar-inner,
    .sidebar-collapsed .app-sidebar-scroll {
        overflow: visible;
    }

    .sidebar-collapsed .app-nav {
        padding: .6rem .45rem;
    }

    /* Tiles: the dashboard link and each group's header. */
    .sidebar-collapsed .app-nav-home,
    .sidebar-collapsed .app-nav-group-toggle {
        flex-direction: column;
        justify-content: center;
        gap: .3rem;
        width: 100%;
        margin: 0;
        padding: .55rem .2rem;
        border-radius: .6rem;
        color: var(--app-sidebar-text);
        font-size: .7rem;
        font-weight: 400;
        line-height: 1.35;
        text-align: center;
    }

    .sidebar-collapsed .app-nav-group-toggle span,
    .sidebar-collapsed .app-nav-home span {
        flex: 0 0 auto;
    }

    .sidebar-collapsed .app-nav-group-toggle .icon {
        width: 20px;
        height: 20px;
    }

    .sidebar-collapsed .app-nav-group {
        position: relative;
        margin-top: .25rem;
    }

    .sidebar-collapsed .app-nav-group.has-active > .app-nav-group-toggle,
    .sidebar-collapsed .app-nav-home.active {
        background: var(--app-sidebar-active);
        color: #fff;
    }

    .sidebar-collapsed .app-nav-group.has-active > .app-nav-group-toggle .icon {
        color: var(--app-sidebar-accent);
    }

    .sidebar-collapsed .app-nav-home.active::before {
        display: none;
    }

    .sidebar-collapsed .app-nav:not(.has-flyout-open) .app-nav-group:hover > .app-nav-group-toggle,
    .sidebar-collapsed .app-nav-group.flyout-open > .app-nav-group-toggle {
        background: var(--app-sidebar-hover);
        color: #fff;
    }

    /* Flyout panel, opened beside the rail (towards the page content). */
    .sidebar-collapsed .app-nav-group > .collapse,
    .sidebar-collapsed .app-nav-group > .collapsing {
        display: none !important;
        position: absolute;
        top: 0;
        inset-inline-start: 100%;
        z-index: 1040;
        min-width: 15rem;
        height: auto !important;
        padding-inline-start: .55rem; /* invisible bridge, so the pointer can travel from the tile to the panel */
    }

    /* One flyout at a time: hover opens it unless another group was opened by click (site.js keeps them exclusive). */
    .sidebar-collapsed .app-nav:not(.has-flyout-open) .app-nav-group:hover > .collapse,
    .sidebar-collapsed .app-nav-group.flyout-open > .collapse {
        display: block !important;
    }

    .sidebar-collapsed .app-nav-group > .collapse > .app-nav-flyout-title,
    .sidebar-collapsed .app-nav-group > .collapse > .app-nav-items {
        background: linear-gradient(180deg, var(--app-sidebar-bg) 0%, var(--app-sidebar-bg-end) 100%);
    }

    .sidebar-collapsed .app-nav-flyout-title {
        display: block;
        padding: .7rem 1rem .5rem;
        border-radius: .7rem .7rem 0 0;
        color: var(--app-sidebar-muted);
        font-size: .78rem;
        font-weight: 700;
        box-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .25);
    }

    .sidebar-collapsed .app-nav-group > .collapse > .app-nav-items {
        margin: 0;
        padding: .1rem .45rem .5rem;
        border: 0;
        border-radius: 0 0 .7rem .7rem;
        box-shadow: 0 .75rem 1.25rem rgba(0, 0, 0, .25);
    }

    .sidebar-collapsed .app-nav-items .app-nav-link {
        width: 100%;
        margin-inline-start: 0;
    }

    .sidebar-collapsed .app-nav-items .app-nav-link.active::before {
        inset-inline-start: 0;
    }

    .sidebar-collapsed .app-sidebar-user {
        justify-content: center;
        padding-inline: .5rem;
    }
}
/* Top bar */

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: .75rem;
    height: var(--app-topbar-height);
    padding: 0 1rem;
    background-color: #fff;
    border-bottom: 1px solid var(--bs-border-color);
    box-shadow: 0 1px 3px rgba(16, 24, 40, .05);
}

@media (min-width: 768px) {
    .app-topbar {
        padding: 0 1.5rem;
    }
}

.app-topbar-toggle {
    border: 0;
    background: transparent;
    color: #16355a;
    padding: .35rem;
    border-radius: .5rem;
}

.app-topbar-toggle:hover {
    background: #eef3f9;
}

.app-topbar-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: #16355a;
    text-decoration: none;
}

.app-topbar-title {
    font-weight: 700;
    color: #16355a;
}

.app-user-button {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    max-width: 15rem;
    border: 1px solid var(--bs-border-color);
    background: #fff;
    color: #1f2a37;
    border-radius: 2rem;
    padding: .2rem .35rem .2rem .75rem;
}

.app-user-button:hover,
.app-user-button[aria-expanded="true"] {
    background: #f3f7fb;
    border-color: var(--app-input-border);
}

/* ---------- Home dashboard ---------- */

/* Tones of the icon chips: a tint background with the solid color for the icon. */
.kpi-blue { --tone: #2a78d6; --tone-bg: #e8f1fc; }
.kpi-green { --tone: #14966a; --tone-bg: #e3f5ee; }
.kpi-orange { --tone: #d9622b; --tone-bg: #fcece3; }
.kpi-purple { --tone: #6650d6; --tone-bg: #eeebfb; }
.kpi-teal { --tone: #0e8a9b; --tone-bg: #e1f3f5; }
.kpi-red { --tone: #d63a4a; --tone-bg: #fbe8ea; }

.home-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1.75rem 1.5rem;
    border-radius: 1.25rem;
    color: #fff;
    background:
        radial-gradient(circle at 12% 120%, rgba(91, 143, 198, .45), transparent 45%),
        radial-gradient(circle at 90% -20%, rgba(91, 169, 255, .35), transparent 40%),
        linear-gradient(135deg, var(--app-brand-dark) 0%, #1b4a7a 55%, #1e5b96 100%);
    box-shadow: 0 14px 34px rgba(22, 53, 90, .22);
}

.home-hero-content {
    position: relative;
    min-width: 0;
}

.home-hero-date {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .25rem .7rem;
    border-radius: 2rem;
    background: rgba(255, 255, 255, .12);
    font-size: .82rem;
}

.home-hero-title {
    margin: .75rem 0 .35rem;
    font-size: 1.6rem;
    font-weight: 800;
}

.home-hero-text {
    margin: 0;
    max-width: 38rem;
    opacity: .85;
    font-size: .92rem;
}

.home-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 1.25rem;
}

.home-hero-action {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem .95rem;
    border-radius: .7rem;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .22);
    color: #fff;
    font-size: .88rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s, transform .15s;
}

.home-hero-action:hover {
    background: rgba(255, 255, 255, .24);
    color: #fff;
    transform: translateY(-1px);
}

.home-hero-mark {
    position: relative;
    flex: none;
    width: 7.5rem;
    height: 7.5rem;
    opacity: .9;
    filter: drop-shadow(0 10px 22px rgba(0, 0, 0, .3));
}

.home-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14.5rem, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.home-kpi {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: 1rem 1.1rem;
    border-radius: 1rem;
    background: #fff;
    border: 1px solid var(--bs-border-color);
    box-shadow: 0 2px 8px rgba(22, 53, 90, .05);
    color: inherit;
    text-decoration: none;
    transition: transform .15s, box-shadow .15s;
}

/* A thin tone bar on the reading edge. */
.home-kpi::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 4px;
    background: var(--tone);
}

.home-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(22, 53, 90, .1);
    color: inherit;
}

.home-kpi-icon,
.home-section-icon,
.home-shortcut-icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--tone-bg);
    color: var(--tone);
}

.home-kpi-icon {
    width: 2.9rem;
    height: 2.9rem;
    border-radius: .85rem;
}

.home-kpi-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.home-kpi-title {
    font-size: .8rem;
    color: #6b7686;
}

.home-kpi-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--app-brand-dark);
    white-space: nowrap;
}

.home-kpi-hint {
    font-size: .74rem;
    color: #8a94a3;
}

.home-panel {
    border-radius: 1rem;
    overflow: hidden;
}

.home-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .9rem 1.1rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.home-panel-header h2 {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin: 0;
    font-size: .95rem;
    font-weight: 700;
    color: var(--app-brand-dark);
}

.home-panel-header h2 svg {
    color: var(--bs-primary);
}

.home-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: #6b7686;
    font-size: .9rem;
}

.home-list,
.home-notes {
    list-style: none;
    margin: 0;
    padding: 0;
}

.home-list li + li,
.home-notes li + li {
    border-top: 1px solid #eef1f5;
}

.home-list-link {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .15rem 1rem;
    padding: .75rem 1.1rem;
    color: inherit;
    text-decoration: none;
}

.home-list-link:hover {
    background: #f6f9fc;
    color: inherit;
}

.home-list-main {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.home-list-meta {
    grid-row: 2;
    font-size: .8rem;
    color: #6b7686;
}

.home-list-value {
    grid-row: 1 / span 2;
    grid-column: 2;
    align-self: center;
    font-weight: 700;
    color: var(--app-brand-dark);
}

.home-notes li {
    padding: .8rem 1.1rem;
}

.home-notes p {
    margin: 0 0 .25rem;
    white-space: pre-line;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: .9rem;
}

.home-notes span {
    font-size: .76rem;
    color: #8a94a3;
}

.home-section {
    margin-bottom: 1.5rem;
}

.home-section-title {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-bottom: .85rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--app-brand-dark);
}

.home-section-icon {
    width: 1.9rem;
    height: 1.9rem;
    border-radius: .6rem;
}

.home-shortcuts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
    gap: .75rem;
}

.home-shortcut {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .85rem 1rem;
    border-radius: .9rem;
    background: #fff;
    border: 1px solid var(--bs-border-color);
    color: inherit;
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}

.home-shortcut:hover {
    border-color: var(--tone);
    box-shadow: 0 8px 20px rgba(22, 53, 90, .08);
    transform: translateY(-1px);
    color: inherit;
}

.home-shortcut-icon {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: .75rem;
    transition: background .15s, color .15s;
}

.home-shortcut:hover .home-shortcut-icon {
    background: var(--tone);
    color: #fff;
}

.home-shortcut-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.home-shortcut-title {
    font-weight: 700;
    color: var(--app-brand-dark);
}

.home-shortcut-desc {
    font-size: .78rem;
    color: #6b7686;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .home-hero {
        padding: 1.35rem 1.1rem;
    }

    .home-hero-title {
        font-size: 1.3rem;
    }

    .home-hero-mark {
        display: none;
    }

    .home-hero-action {
        flex: 1 1 auto;
        justify-content: center;
    }

    .home-kpis {
        grid-template-columns: 1fr 1fr;
        gap: .6rem;
    }

    .home-kpi {
        flex-direction: column;
        align-items: flex-start;
        gap: .5rem;
        padding: .85rem;
    }

    .home-kpi-value {
        font-size: 1rem;
        white-space: normal;
    }
}
/* ---------- Pages ---------- */

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem 1rem;
    margin-bottom: 1.25rem;
}

.page-header h1 {
    font-size: 1.45rem;
    font-weight: 800;
    margin: 0;
    color: var(--app-brand-dark);
}

/* Added by PageHeaderTagHelper: the path above the heading, the section's icon and the page's description. */
.page-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    margin-bottom: .6rem;
    font-size: .8rem;
    color: var(--app-muted);
}

.page-breadcrumb a {
    color: var(--app-muted);
    text-decoration: none;
}

.page-breadcrumb a:hover {
    color: var(--bs-primary);
}

.page-breadcrumb [aria-current] {
    color: var(--app-brand-dark);
    font-weight: 600;
}

.page-title {
    display: flex;
    align-items: center;
    gap: .9rem;
    min-width: 0;
}

.page-icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: .95rem;
    background: var(--tone-bg);
    color: var(--tone);
}

.page-subtitle {
    margin: .15rem 0 0;
    color: var(--app-muted);
    font-size: .86rem;
}

/* A page's own line under the title (e.g. "پارت ۱۲") lines up with the title text, next to the icon. */
.page-title ~ .small {
    margin-top: .25rem !important;
    padding-inline-start: 3.9rem;
}

.card {
    --bs-card-border-radius: 1rem;
    --bs-card-inner-border-radius: calc(1rem - 1px);
    --bs-card-cap-bg: #fafbfd;
    background-color: #fff;
    border: 1px solid var(--app-line);
    box-shadow: var(--app-shadow);
}

.card > .table-responsive:first-child,
.card > .table-responsive:last-child {
    border-radius: inherit;
}

a.card:hover {
    border-color: rgba(var(--bs-primary-rgb), .45);
    box-shadow: 0 4px 12px rgba(16, 24, 40, .08);
}

.table {
    --bs-table-hover-bg: #f7f9fc;
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: .8rem .7rem;
    border-color: #eef1f5;
}

.table thead th {
    font-size: .78rem;
    color: var(--app-muted);
    font-weight: 600;
    white-space: nowrap;
    background-color: #fafbfd;
    border-bottom-color: var(--app-line);
    padding-top: .7rem;
    padding-bottom: .7rem;
}

/* "Nothing found" rows. */
.table td.text-center.text-body-secondary {
    padding-top: 2.25rem !important;
    padding-bottom: 2.25rem !important;
}

/* The form's buttons stay at hand at the bottom of the screen while a long form scrolls. */
.form-actions {
    position: sticky;
    bottom: .5rem;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 1.5rem;
    padding: .75rem .85rem;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(8px);
    border: 1px solid var(--app-line);
    border-radius: 1rem;
    box-shadow: 0 -4px 18px rgba(22, 53, 90, .08);
}

.form-actions .btn-primary {
    min-width: 8rem;
}

/* Soft badges (types, labels). */
.badge {
    border-radius: 2rem;
    padding: .35em .75em;
    font-weight: 700;
}

.badge.text-bg-light {
    background-color: #eef2f7 !important;
    color: #3b4757 !important;
    border-color: transparent !important;
}

/* Comfortable touch targets and full-width actions on phones. */
@media (max-width: 575.98px) {
    .form-actions .btn,
    .page-header .btn {
        flex: 1 1 100%;
    }

    .form-control,
    .form-select {
        min-height: 2.75rem;
    }
}

.credentials-value {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: .15em;
}

/* ---------- Detail pages ---------- */

.stat-card .card-body {
    padding: .9rem 1rem;
}

.stat-label {
    font-size: .8rem;
    color: #6b7686;
    margin-bottom: .25rem;
}

.stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: #16355a;
}

.detail-list dt {
    font-weight: 400;
    color: #6b7686;
}

.detail-list dd {
    font-weight: 700;
}

.table-totals td {
    font-weight: 700;
    background-color: #f6f8fb;
    border-top: 2px solid #dde3ea;
}

.import-errors li + li {
    margin-top: .25rem;
}

.section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #16355a;
    margin: 1.75rem 0 .85rem;
}

/* ---------- Vehicle cost cards (vehicle page) ---------- */

.cost-card {
    display: flex;
    flex-direction: column;
    scroll-margin-top: calc(var(--app-topbar-height) + 1rem);
}

.cost-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.cost-card-title {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-width: 0;
}

.cost-card-title h3 {
    font-size: .95rem;
    font-weight: 700;
    margin: 0 0 .1rem;
}

.cost-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 2.1rem;
    height: 2.1rem;
    border-radius: .6rem;
    color: #1e5b96;
    background-color: #e7eff8;
}

.cost-status {
    font-size: .72rem;
    font-weight: 700;
}

.cost-status-done {
    color: #18794e;
}

.cost-status-empty {
    color: #8a96a6;
}

.cost-card-amount {
    font-size: 1.05rem;
    font-weight: 700;
    color: #16355a;
    white-space: nowrap;
}

.cost-card-body {
    flex: 1 1 auto;
    padding: .85rem 1rem;
}

.cost-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    padding: 0 1rem .85rem;
}

.cost-card-actions:empty {
    display: none;
}

.cost-lines {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .35rem 1.25rem;
    margin: 0;
    font-size: .875rem;
}

.cost-lines-single {
    grid-template-columns: minmax(0, 1fr);
}

.cost-lines > div {
    display: flex;
    justify-content: space-between;
    gap: .5rem;
    padding-bottom: .3rem;
    border-bottom: 1px dashed #e4e9ef;
}

.cost-lines dt {
    font-weight: 400;
    color: #6b7686;
}

.cost-lines dd {
    margin: 0;
    font-weight: 700;
    text-align: end;
}

.cost-lines .cost-line-total dt,
.cost-lines .cost-line-total dd {
    color: #16355a;
}

@media (max-width: 575.98px) {
    .cost-lines {
        grid-template-columns: minmax(0, 1fr);
    }
}

.cost-files {
    margin-top: .85rem;
}

/* ---------- Attachments ---------- */

.attachment-list {
    list-style: none;
    padding: 0;
    margin: 0 0 .5rem;
}

.attachment-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .4rem .6rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    background-color: #fff;
}

.attachment-list li + li {
    margin-top: .35rem;
}

.attachment-list-new:empty {
    display: none;
}

.attachment-list-new li {
    margin-top: .35rem;
    font-size: .85rem;
    background-color: #f6f8fb;
}

.attachment-link {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-width: 0;
    text-decoration: none;
}

/* ---------- Cost forms: section titles and live totals ---------- */

.cost-form-card {
    max-width: 62rem;
}

.form-section-title {
    font-size: .9rem;
    font-weight: 700;
    color: #3b4757;
    margin: 1.5rem 0 .75rem;
    padding-bottom: .4rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.calc-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .75rem;
    margin: 1rem 0;
}

.calc-row > * {
    flex: 1 1 13rem;
}

.calc-box {
    padding: .55rem .85rem;
    border-radius: .55rem;
    background-color: #f1f5f9;
    border: 1px solid #e1e7ee;
}

.calc-box-primary {
    background-color: #e7eff8;
    border-color: #b9cfe6;
}

.calc-label {
    font-size: .78rem;
    color: #5b6878;
}

.calc-value {
    display: block;
    font-weight: 700;
    font-size: 1.05rem;
    color: #16355a;
    text-align: end;
}

.calc-box-primary .calc-value {
    font-size: 1.2rem;
}

.return-line {
    padding: .85rem 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .6rem;
    background-color: #fbfcfd;
}

.return-line + .return-line {
    margin-top: .75rem;
}

.return-line-title {
    font-weight: 700;
    margin-bottom: .5rem;
}

.return-line .calc-box {
    margin-top: 1.95rem;
}

@media (max-width: 575.98px) {
    .return-line .calc-box {
        margin-top: 0;
    }
}

/* ---------- Balances, statements and financial effect ---------- */

.balance-tag {
    display: inline-block;
    padding: .05rem .45rem;
    border-radius: 1rem;
    font-size: .75rem;
    font-weight: 700;
    vertical-align: middle;
}

.balance-debtor {
    background: #fde8ea;
    color: #b42335;
}

.balance-creditor {
    background: #e3f4ea;
    color: #1d7a45;
}

.statement-table .statement-opening td {
    background-color: #f6f8fb;
    font-weight: 700;
}

.statement-description {
    min-width: 14rem;
}

/* ---------- Searchable drop-down lists (site.js) ---------- */

/* The real select stays in the form for posting and validation, but out of sight. */
.ss-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
    opacity: 0;
    pointer-events: none;
}

.ss {
    position: relative;
}

.ss-toggle {
    display: block;
    width: 100%;
    text-align: start;
    background-color: #fff;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ss-toggle.ss-placeholder .ss-text {
    color: #6b7686;
}

.ss-panel {
    position: absolute;
    top: calc(100% + .25rem);
    inset-inline: 0;
    z-index: 1060;
    min-width: 14rem;
    padding: .5rem;
    background: #fff;
    border: 1px solid var(--app-input-border);
    border-radius: .6rem;
    box-shadow: 0 .75rem 1.5rem rgba(16, 32, 56, .15);
}

.ss-up .ss-panel {
    top: auto;
    bottom: calc(100% + .25rem);
}

.ss-list {
    list-style: none;
    margin: .4rem 0 0;
    padding: 0;
    max-height: 17rem;
    overflow-y: auto;
}

.ss-group {
    padding: .45rem .6rem .2rem;
    font-size: .75rem;
    font-weight: 700;
    color: #6b7686;
}

.ss-option {
    padding: .45rem .6rem;
    border-radius: .4rem;
    cursor: pointer;
}

.ss-option[aria-selected="true"] {
    font-weight: 700;
    color: var(--bs-primary);
}

.ss-option.active {
    background: #e7eff8;
}

.ss-option.disabled {
    color: #a3adba;
    cursor: default;
}

.ss-empty {
    padding: .5rem .6rem;
}

/* ---------- Paging bar (server lists and tables paged in the browser) ---------- */

.pager-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1rem;
    padding: .55rem 1rem;
    border-top: 1px solid var(--bs-border-color);
}

.pager-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem 1rem;
}

.pager-size {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin: 0;
}

.pager-size .form-select {
    width: auto;
    min-width: 4.75rem;
    min-height: 0;
}

.pager-hidden {
    display: none;
}

@media print {
    .pager-hidden {
        display: table-row !important;
    }
}

/* Permissions grid: one section per menu group. */
.permission-group-header th,
.permission-group-header td {
    background-color: #eef3f9 !important;
    color: #16355a;
    font-weight: 700;
    font-size: .875rem;
}

/* A validation summary with no errors is rendered as an empty placeholder for client-side validation; it must not
   show up as an empty red alert. */
.validation-summary-valid {
    display: none !important;
}

/* ---------- Notes ---------- */

.note-card {
    border-top: 3px solid #f2c94c;
}

.note-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.9;
}

.note-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    border-top: 1px dashed var(--bs-border-color);
}

/* ---------- Activity history ---------- */

.audit-table td {
    vertical-align: top;
}

.audit-changes {
    min-width: 16rem;
    font-size: .875rem;
}

.audit-changes summary {
    cursor: pointer;
    list-style-position: inside;
}

.audit-change-chip {
    display: inline-block;
    margin: 0 0 .2rem .25rem;
    padding: .05rem .45rem;
    border-radius: 1rem;
    background: #eef3f9;
    color: #3b4757;
    font-size: .75rem;
}

.audit-change-list {
    margin: .5rem 0 0;
    padding: .5rem .65rem;
    border-radius: .5rem;
    background: #f6f8fb;
}

.audit-change-list > div {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem .75rem;
    padding: .2rem 0;
}

.audit-change-list > div + div {
    border-top: 1px dashed #e1e7ee;
}

.audit-change-list dt {
    min-width: 9rem;
    font-weight: 400;
    color: #6b7686;
}

.audit-change-list dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.audit-old {
    color: #a33a2f;
    text-decoration: line-through;
    text-decoration-color: rgba(163, 58, 47, .4);
}

.audit-new {
    color: #18794e;
    font-weight: 700;
}

/* ---------- Receipts and payments ---------- */

.cash-description {
    max-width: 22rem;
    white-space: normal;
    font-size: .875rem;
    color: #4a5668;
}

.voucher {
    max-width: 52rem;
    margin: 0 auto;
    padding: 1.5rem 1.75rem;
    background: #fff;
    border: 1.5px solid #16355a;
    border-radius: .75rem;
}

.voucher-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: .9rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #16355a;
}

.voucher-org {
    font-size: .85rem;
    color: #5b6878;
}

.voucher-title {
    margin: .2rem 0 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: #16355a;
}

.voucher-meta {
    margin: 0;
    min-width: 12rem;
}

.voucher-meta > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.voucher-meta dt {
    font-weight: 400;
    color: #6b7686;
}

.voucher-meta dd {
    margin: 0;
    font-weight: 700;
}

.voucher-text {
    font-size: 1.05rem;
    line-height: 2.3;
    margin-bottom: .75rem;
}

.voucher-amount {
    font-size: 1.2rem;
}

.voucher-description {
    padding: .6rem .8rem;
    border-radius: .5rem;
    background: #f6f8fb;
}

.voucher-signatures {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    text-align: center;
}

.voucher-sign-title {
    padding-bottom: 3.25rem;
    font-weight: 700;
    color: #3b4757;
    border-bottom: 1px dashed #8fa1b7;
}

.voucher-sign-name {
    margin-top: .35rem;
    font-size: .85rem;
    color: #6b7686;
}

.voucher-foot {
    margin-top: 1.5rem;
    font-size: .75rem;
    color: #8a96a6;
}

@media print {
    .voucher {
        max-width: none;
        border-radius: 0;
    }
}

/* ---------- Modal dialog (confirmations and messages) ---------- */

.app-modal .modal-dialog {
    max-width: 26rem;
}

.app-modal .modal-content {
    border: 0;
    border-radius: 1rem;
    box-shadow: 0 1.25rem 3rem rgba(16, 32, 56, .25);
    overflow: hidden;
}

.app-modal-body {
    padding: 1.75rem 1.5rem 1.25rem;
    text-align: center;
}

.app-modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.75rem;
    height: 3.75rem;
    margin-bottom: .9rem;
    border-radius: 50%;
    color: var(--app-modal-accent);
    background-color: var(--app-modal-accent-bg);
    box-shadow: 0 0 0 .45rem var(--app-modal-accent-ring);
}

.app-modal-icon > span {
    display: none;
}

.app-modal[data-variant="danger"] .app-modal-icon-danger,
.app-modal[data-variant="warning"] .app-modal-icon-warning,
.app-modal[data-variant="error"] .app-modal-icon-error,
.app-modal[data-variant="question"] .app-modal-icon-question,
.app-modal[data-variant="info"] .app-modal-icon-info,
.app-modal[data-variant="success"] .app-modal-icon-success {
    display: inline-flex;
}

.app-modal {
    --app-modal-accent: #1e5b96;
    --app-modal-accent-bg: #e7eff8;
    --app-modal-accent-ring: #f2f6fb;
}

.app-modal[data-variant="danger"],
.app-modal[data-variant="error"] {
    --app-modal-accent: #c0392b;
    --app-modal-accent-bg: #fdecea;
    --app-modal-accent-ring: #fef6f5;
}

.app-modal[data-variant="warning"] {
    --app-modal-accent: #b7791f;
    --app-modal-accent-bg: #fdf3e1;
    --app-modal-accent-ring: #fefaf2;
}

.app-modal[data-variant="success"] {
    --app-modal-accent: #18794e;
    --app-modal-accent-bg: #e3f4ec;
    --app-modal-accent-ring: #f2faf6;
}

.app-modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #16355a;
    margin-bottom: .5rem;
}

.app-modal-message {
    margin: 0;
    color: #4a5668;
    line-height: 1.9;
    white-space: pre-line;
}

.app-modal-actions {
    display: flex;
    gap: .6rem;
    padding: 0 1.5rem 1.5rem;
}

.app-modal-actions .btn {
    flex: 1 1 0;
    min-height: 2.6rem;
}

.app-modal.fade .modal-dialog {
    transform: scale(.94);
    transition: transform .18s ease-out;
}

.app-modal.show .modal-dialog {
    transform: none;
}

.effect-tabs {
    --bs-nav-pills-link-active-bg: #1e5b96;
    --bs-nav-link-color: #1e5b96;
    --bs-nav-link-hover-color: #154370;
    padding: .2rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .55rem;
    background-color: #f6f8fb;
}

.effect-tabs .nav-link {
    padding: .3rem 1.1rem;
    font-size: .875rem;
}

.effect-check {
    margin-top: .75rem;
    padding: .5rem .75rem;
    border-radius: .5rem;
    font-size: .875rem;
    font-weight: 700;
}

.effect-check-ok {
    background: #e3f4ea;
    color: #1d7a45;
}

.effect-check-error {
    background: #fde8ea;
    color: #b42335;
}

/* ---------- Printing / PDF ---------- */

.print-only {
    display: none;
}

@media print {
    @page {
        size: A4 landscape;
        margin: 10mm;
    }

    body {
        background: #fff !important;
        font-size: 11px;
    }

    .app-sidebar-col,
    .app-topbar,
    .no-print,
    .alert,
    .btn,
    .pagination {
        display: none !important;
    }

    .print-only {
        display: block;
    }

    .app-content {
        padding: 0 !important;
    }

    .card {
        border: 1px solid #c9d1db !important;
        box-shadow: none !important;
    }

    .table-responsive {
        overflow: visible !important;
    }

    .table > :not(caption) > * > * {
        padding: .3rem .4rem;
    }

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

    .print-header {
        margin-bottom: 4mm;
        padding-bottom: 3mm;
        border-bottom: 2px solid #16355a;
    }

    .print-header-brand {
        font-size: 10px;
        color: #5b6878;
    }

    .print-header-title {
        font-size: 16px;
        font-weight: 700;
        color: #16355a;
    }

    .print-header-subtitle,
    .print-header-date {
        font-size: 11px;
    }

    .stat-card .card-body {
        padding: .4rem .6rem;
    }
}

/* ---------- Plates ---------- */

/* Display: Iranian truck plates (letter ع) are yellow; transit plates are white. */
.plate {
    display: inline-flex;
    align-items: stretch;
    direction: ltr;
    border: 1.5px solid #2a2f36;
    border-radius: .3rem;
    background: #fff;
    font-weight: 700;
    font-size: .85rem;
    line-height: 1.6;
    white-space: nowrap;
    overflow: hidden;
    font-variant-numeric: tabular-nums;
}

.plate-ir {
    background: #ffd84d;
}

.plate .plate-main {
    padding: 0 .45rem;
}

/* Each part isolated so the Persian letter cannot reorder the digits around it. */
.plate .plate-main > span {
    unicode-bidi: isolate;
}

.plate .plate-letter {
    margin: 0 .3rem;
}

.plate .plate-region {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 .35rem;
    border-left: 1.5px solid #2a2f36;
    line-height: 1;
}

.plate .plate-region small {
    font-size: .5rem;
    font-weight: 400;
}

/* Afghan plates: five digits, with the plate's city in a side box. */
.plate-af {
    border-color: #1f6f43;
    background: #f1fbf5;
}

.plate .plate-city {
    display: inline-flex;
    align-items: center;
    padding: 0 .4rem;
    border-left: 1.5px solid #1f6f43;
    background: #1f6f43;
    color: #fff;
    font-size: .72rem;
    font-weight: 400;
    direction: rtl;
}

.chain-source {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: .75rem 1.25rem;
    padding: .85rem 1rem;
    margin-bottom: .5rem;
    border: 1px dashed #b9cfe6;
    border-radius: .6rem;
    background-color: #f5f9fd;
}

.plate-digits-input {
    font-weight: 700;
    letter-spacing: .25em;
}

/* Afghan vehicles in the lot table: shaded and marked on the start edge, right under their source vehicle. */
.chain-row > td {
    background-color: #f6fbf8;
}

.chain-row > td:first-child {
    box-shadow: inset -3px 0 0 #1f6f43;
}

.plate-cell .plate-secondary {
    margin-top: .3rem;
}

.chain-link {
    display: block;
    margin-top: .2rem;
    font-size: .75rem;
    color: #6b7686;
    white-space: normal;
}

/* Input: one box per plate part, laid out like the physical plate. */
.plate-input {
    display: flex;
    align-items: stretch;
    direction: ltr;
    max-width: 22rem;
    border: 1px solid var(--app-input-border);
    border-radius: var(--bs-border-radius);
    background-color: #fff;
    overflow: hidden;
}

.plate-input-ir {
    background-color: #fff6cc;
}

.plate-input:hover {
    border-color: var(--app-input-border-hover);
}

.plate-input:focus-within {
    border-color: var(--app-focus-border);
    box-shadow: var(--app-focus-ring);
}

.plate-input input {
    flex: 1 1 0;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    text-align: center;
    font-weight: 700;
    letter-spacing: .12em;
    padding: .45rem .25rem;
}

.plate-input input::placeholder {
    color: #b3bcc8;
    font-weight: 400;
}

.plate-input .plate-letter {
    display: flex;
    align-items: center;
    padding: 0 .55rem;
    font-weight: 700;
    color: #1f2a37;
}

.plate-input .plate-divider {
    width: 1px;
    background: #dde3ea;
}

.plate-input .plate-region {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 0 0 4.2rem;
    border-left: 1px solid var(--app-input-border);
}

.plate-input .plate-region small {
    font-size: .6rem;
    color: #5b6878;
    line-height: 1;
    padding-top: .2rem;
}

.plate-input .plate-region input {
    width: 100%;
    padding-top: .1rem;
}

/* ---------- Date fields and Solar Hijri date picker ----------
   The picker's own stylesheet loads before this file, so these rules re-theme it to the app's palette. */

.date-input .form-control[readonly] {
    background-color: #fff;
    cursor: pointer;
    /* The field stays LTR (so 1405/07/24 keeps its order) but sits on the right like the other Persian fields;
       the «انتخاب از تقویم» placeholder is Persian text and is laid out right to left. */
    text-align: right;
}

.date-input .form-control::placeholder {
    direction: rtl;
}

.date-input .input-group-text {
    background-color: #f6f8fb;
    border-color: var(--app-input-border);
    color: var(--bs-primary);
    cursor: pointer;
}

jdp-container {
    --jdp-day-size: 42px;
    --jdp-color-0: #fff;
    --jdp-color-1: #f3f6fa;
    --jdp-color-2: #e6eef7;
    --jdp-color-3: #b9c4d2;
    --jdp-color-4: #7a8698;
    --jdp-color-5: #1f2a37;
    --jdp-primary: #1e5b96;
    --jdp-red: #d63c4a;
    font-family: var(--bs-body-font-family);
    padding: .75rem 0 .6rem;
    border-radius: 1rem;
    box-shadow: 0 0 0 1px rgba(16, 24, 40, .06), 0 16px 40px rgba(16, 24, 40, .18);
}

jdp-container .jdp-years,
jdp-container .jdp-months {
    align-items: center;
    gap: .3rem;
    font-size: 1rem;
    vertical-align: middle;
}

/* The year drop-down is enough on its own; its +/- buttons left too little room to show four digits. */
jdp-container .jdp-years .jdp-icon-plus,
jdp-container .jdp-years .jdp-icon-minus {
    display: none;
}

jdp-container .jdp-years {
    width: 32%;
}

jdp-container .jdp-months {
    width: 58%;
}

jdp-container .jdp-year select,
jdp-container .jdp-month select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: .35rem .5rem;
    border-radius: .55rem;
    background: var(--jdp-color-1);
    color: #16355a;
    font-weight: 700;
    text-align-last: center;
}

jdp-container .jdp-year:hover,
jdp-container .jdp-month:hover {
    filter: none;
}

jdp-container .jdp-year select:hover,
jdp-container .jdp-month select:hover {
    background: var(--jdp-color-2);
}

jdp-container .jdp-icon-plus,
jdp-container .jdp-icon-minus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: .55rem;
    background: var(--jdp-color-1);
    color: var(--jdp-primary);
    transition: background-color .15s ease, color .15s ease;
}

jdp-container .jdp-icon-plus svg,
jdp-container .jdp-icon-minus svg {
    fill: currentColor;
    width: 1.25rem;
    padding: .1rem;
}

jdp-container .jdp-icon-plus:not(.not-in-range):hover,
jdp-container .jdp-icon-minus:not(.not-in-range):hover {
    background: var(--jdp-primary);
    color: #fff;
}

jdp-container .jdp-days-header {
    margin-top: .75rem;
    padding-bottom: .15rem;
    background: transparent;
    border-bottom: 1px solid var(--jdp-color-2);
}

jdp-container .jdp-day-name {
    font-weight: 700;
    font-size: .8rem;
    color: var(--jdp-color-4);
}

jdp-container .jdp-days {
    padding-top: .35rem;
}

jdp-container .jdp-day {
    border-radius: .6rem;
    font-variant-numeric: tabular-nums;
}

jdp-container .jdp-day:not(.disabled-day) {
    border-radius: .6rem;
}

jdp-container .jdp-day:not(.disabled-day):hover {
    background: var(--jdp-color-2);
    color: var(--jdp-primary);
    transform: none;
}

jdp-container .jdp-day.today {
    border-color: transparent;
    background: rgba(30, 91, 150, .1);
    color: var(--jdp-primary);
    font-weight: 700;
}

jdp-container .jdp-day.selected {
    box-shadow: 0 4px 10px rgba(30, 91, 150, .35);
    font-weight: 700;
}

jdp-container .jdp-day.not-in-month {
    opacity: .3;
}

jdp-container .jdp-day.disabled-day {
    opacity: .12;
}

jdp-container .jdp-footer {
    gap: .5rem;
    margin-top: .25rem;
    padding: .6rem .75rem 0;
    border-top: 1px solid var(--jdp-color-2);
}

jdp-container .jdp-btn-today,
jdp-container .jdp-btn-close {
    padding: .4rem 1rem;
    border-radius: .55rem;
    font-weight: 700;
    transition: background-color .15s ease, color .15s ease;
}

jdp-container .jdp-btn-today {
    background: rgba(30, 91, 150, .1);
    color: var(--jdp-primary);
}

jdp-container .jdp-btn-today:not(.disabled-btn):hover {
    background: var(--jdp-primary);
    color: #fff;
}

jdp-container .jdp-btn-close {
    background: var(--jdp-color-1);
    color: #3b4757;
}

jdp-container .jdp-btn-close:hover {
    background: var(--jdp-color-2);
}

/* Phones: a bottom sheet with larger touch targets. */
@media only screen and (max-width: 481px) {
    jdp-container {
        --jdp-day-size: 46px;
        padding-bottom: calc(.75rem + env(safe-area-inset-bottom));
        border-radius: 1.25rem 1.25rem 0 0;
    }
}

/* ---------- Sign-in pages (_SimpleLayout) ---------- */

.auth-body {
    background: var(--app-page-bg);
}

.auth-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* Brand panel: a compact band on phones, the right half on desktops. */
.auth-hero {
    position: relative;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(circle at 85% 15%, rgba(91, 143, 198, .45), transparent 45%),
        linear-gradient(155deg, var(--app-brand-dark) 0%, #1b4a7a 55%, #1e5b96 100%);
    padding: 1.75rem 1.25rem 4.5rem;
}

/* Dashed routes (_RouteArt) behind the brand panel and the sidebar. */
.route-art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.route-art path {
    fill: none;
    stroke: rgba(255, 255, 255, .12);
    stroke-width: 2;
    stroke-dasharray: 10 12;
}

.route-art circle {
    fill: rgba(255, 255, 255, .22);
}

/* The app's mark (_LogoMark), drawn for dark backgrounds. */
.logo-mark {
    display: block;
    width: 100%;
    height: 100%;
}

.logo-mark-tile {
    fill: rgba(255, 255, 255, .14);
    stroke: rgba(255, 255, 255, .35);
}

.logo-mark-drop {
    fill: #fff;
}

.logo-mark-shine {
    fill: none;
    stroke: #5b8fc6;
    stroke-width: 2.2;
    stroke-linecap: round;
}

.auth-hero-content {
    position: relative;
    max-width: 30rem;
    margin: 0 auto;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: .9rem;
}

.auth-logo {
    flex: none;
    width: 3.25rem;
    height: 3.25rem;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .25));
}

.auth-brand-name {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.2;
}

.auth-brand-subtitle {
    font-size: .9rem;
    opacity: .85;
}

.auth-features {
    display: none;
    list-style: none;
    padding: 0;
    margin: 2.75rem 0 0;
}

.auth-features li {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    padding: .85rem 0;
    border-top: 1px solid rgba(255, 255, 255, .12);
}

.auth-features li:first-child {
    border-top: 0;
}

.auth-feature-icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: .75rem;
    background: rgba(255, 255, 255, .12);
}

.auth-features strong {
    display: block;
    font-weight: 700;
}

.auth-features small {
    display: block;
    opacity: .8;
    font-size: .85rem;
}

/* Form panel: the card overlaps the band on phones. */
.auth-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 1rem 1.25rem;
}

.auth-card {
    width: 100%;
    max-width: 26rem;
    margin-top: -3rem;
    position: relative;
    background: #fff;
    border-radius: 1.1rem;
    box-shadow: 0 18px 45px rgba(22, 53, 90, .16), 0 2px 6px rgba(22, 53, 90, .06);
    padding: 1.75rem 1.5rem;
}

/* Pages that still wrap their content in a card (password change, error) blend into the panel. */
.auth-card .card {
    border: 0;
    box-shadow: none;
    background: transparent;
}

.auth-card .card-body {
    padding: 0 !important;
}

.auth-heading {
    margin-bottom: 1.5rem;
}

.auth-heading h1 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--app-brand-dark);
    margin-bottom: .35rem;
}

.auth-heading p {
    color: #6b7686;
    font-size: .9rem;
    margin: 0;
}

.auth-input .input-group-text {
    background: #f4f7fb;
    border-color: var(--app-input-border);
    color: #6b7686;
}

.auth-input:focus-within .input-group-text {
    color: var(--bs-primary);
    border-color: var(--app-focus-border);
}

.auth-input .form-control {
    padding-top: .6rem;
    padding-bottom: .6rem;
}

.auth-capslock {
    display: flex;
    align-items: center;
    gap: .3rem;
    margin-top: .35rem;
    color: #9a6700;
}

.auth-capslock[hidden] {
    display: none;
}

.auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding-top: .7rem;
    padding-bottom: .7rem;
    font-weight: 700;
    border-radius: .65rem;
    box-shadow: 0 8px 18px rgba(30, 91, 150, .28);
}

.auth-help {
    margin: 1.25rem 0 0;
    text-align: center;
    color: #6b7686;
    font-size: .82rem;
}

.auth-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    color: #8a94a3;
    font-size: .78rem;
}

@media (min-width: 992px) {
    .auth-shell {
        flex-direction: row;
    }

    .auth-hero {
        flex: 0 0 44%;
        display: flex;
        align-items: center;
        padding: 3rem 3.5rem;
    }

    .auth-hero-content {
        margin: 0;
    }

    .auth-brand-name {
        font-size: 2.1rem;
    }

    .auth-logo {
        width: 4rem;
        height: 4rem;
    }

    .auth-features {
        display: block;
    }

    .auth-panel {
        justify-content: center;
        padding: 2rem;
    }

    .auth-card {
        margin-top: auto;
        padding: 2.25rem 2rem;
    }

    .auth-footer {
        margin-top: auto;
    }
}
/* ---------- Permissions grid ---------- */

.permission-grid th,
.permission-grid td {
    text-align: center;
    vertical-align: middle;
}

.permission-grid th:first-child,
.permission-grid td:first-child {
    text-align: start;
}

.permission-grid .form-check-input {
    width: 1.35em;
    height: 1.35em;
    float: none;
    margin: 0;
}

/* ---------- Reports dashboard charts (server-rendered SVG, see SvgCharts) ---------- */

.dashboard-heading {
    font-size: .95rem;
    font-weight: 700;
    color: #6b7686;
    margin-bottom: .75rem;
}

.chart-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: .15rem;
}

.chart-subtitle {
    font-size: .8rem;
    color: #6b7686;
    margin-bottom: .5rem;
}

.chart {
    display: block;
    width: 100%;
    height: auto;
    font-family: var(--bs-body-font-family);
    overflow: visible;
    /* SVG coordinates run left to right; Persian labels set their own direction. */
    direction: ltr;
}

.chart-tick {
    font-size: 14px;
    fill: #6b7686;
}

.chart-tick-year {
    font-size: 12px;
}

.chart-label {
    font-size: 16px;
    fill: #212529;
}

.chart-value {
    font-size: 15px;
    font-weight: 700;
    fill: #212529;
}

.chart-band:hover .chart-band-bg {
    fill: rgba(22, 53, 90, .06);
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem 1rem;
    list-style: none;
    padding: 0;
    margin: 0 0 .5rem;
    font-size: .8rem;
    color: #212529;
}

.chart-legend li {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.chart-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex: none;
}

.chart-empty {
    padding: 2.5rem 1rem;
    text-align: center;
    color: #6b7686;
}

.chart-data {
    margin-top: .5rem;
    font-size: .85rem;
}

.chart-data summary {
    cursor: pointer;
    color: var(--bs-link-color);
    width: fit-content;
}

.chart-data table {
    margin-top: .5rem;
}

.step-marks {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    max-width: 17rem;
}

.step-mark {
    font-size: .72rem;
    padding: .1rem .4rem;
    border-radius: .35rem;
    border: 1px dashed #ced4da;
    color: #8a939e;
    white-space: nowrap;
}

.step-mark.step-done {
    border: 1px solid #a3cfbb;
    background: #e8f5ee;
    color: #146c43;
}

@media print {
    .chart-card {
        break-inside: avoid;
    }

    .chart-data summary {
        display: none;
    }
}

/* ---------- Shared page components ---------- */

/* A record with its icon (e.g. a person and its type). */
.entity {
    display: flex;
    align-items: center;
    gap: .7rem;
}

.entity-avatar {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: .8rem;
    background: var(--tone-bg);
    color: var(--tone);
}

.entity-name {
    display: block;
    font-weight: 700;
    color: var(--app-brand-dark);
    text-decoration: none;
}

a.entity-name:hover {
    color: var(--bs-primary);
}

.entity-sub {
    display: block;
    font-size: .76rem;
    font-weight: 400;
    color: var(--app-muted);
}

/* Soft colored label (uses the kpi-* tones). */
.chip {
    display: inline-flex;
    align-items: center;
    padding: .2rem .6rem;
    border-radius: 2rem;
    background: var(--tone-bg);
    color: var(--tone);
    font-size: .76rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-dot {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .84rem;
    color: var(--app-muted);
}

.status-dot::before {
    content: "";
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    background: #adb5bd;
}

.status-dot.is-on {
    color: #146c43;
}

.status-dot.is-on::before {
    background: #20c997;
    box-shadow: 0 0 0 3px rgba(32, 201, 151, .18);
}

/* Row actions: quiet icon buttons in tables, labelled buttons on cards. */
.row-actions {
    display: inline-flex;
    gap: .25rem;
}

.row-actions form {
    display: inline-flex;
    margin: 0;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    width: 2.2rem;
    height: 2.2rem;
    padding: 0;
    border: 0;
    border-radius: .6rem;
    background: transparent;
    color: var(--app-muted);
    text-decoration: none;
    transition: background .15s, color .15s;
}

.icon-btn > span {
    display: none;
}

.icon-btn:hover {
    background: rgba(var(--bs-primary-rgb), .1);
    color: var(--bs-primary);
}

.icon-btn.is-danger:hover {
    background: rgba(220, 53, 69, .1);
    color: #dc3545;
}

/* Filter tabs that also show how many records each holds. */
.type-tabs {
    display: flex;
    gap: .5rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    padding-bottom: .15rem;
    scrollbar-width: none;
}

.type-tab {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .5rem .9rem;
    border-radius: 2rem;
    background: #fff;
    border: 1px solid var(--app-line);
    color: #3b4757;
    font-size: .88rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color .15s, background .15s;
}

.type-tab:hover {
    border-color: #c9d4e1;
    color: var(--app-brand-dark);
}

.type-tab.active {
    background: var(--app-brand-dark);
    border-color: var(--app-brand-dark);
    color: #fff;
}

.type-tab-dot {
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    background: var(--tone);
}

.type-tab-count {
    min-width: 1.6rem;
    padding: .05rem .45rem;
    border-radius: 1rem;
    background: var(--app-soft);
    color: var(--app-muted);
    font-size: .75rem;
    text-align: center;
}

.type-tab.active .type-tab-count {
    background: rgba(255, 255, 255, .18);
    color: #fff;
}

/* Search line on top of a list (inside its card). */
.list-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    padding: .9rem 1rem;
    border-bottom: 1px solid var(--app-line);
}

.list-toolbar-info {
    margin-inline-start: auto;
    color: var(--app-muted);
    font-size: .82rem;
}

.search-box {
    flex: 1 1 18rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    padding: 0 .85rem;
    height: 2.65rem;
    border-radius: .7rem;
    background: var(--app-soft);
    border: 1px solid transparent;
    color: var(--app-muted);
    transition: border-color .15s, background .15s, box-shadow .15s;
}

.search-box:focus-within {
    background: #fff;
    border-color: var(--app-focus-border);
    box-shadow: var(--app-focus-ring);
}

.search-box input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--bs-body-color);
}

.search-box-clear {
    display: inline-flex;
    color: var(--app-muted);
}

.empty-state {
    padding: 3rem 1rem;
    text-align: center;
}

.empty-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4.5rem;
    height: 4.5rem;
    margin-bottom: .75rem;
    border-radius: 1.5rem;
    background: var(--app-soft);
    color: #9aa6b5;
}

.empty-state h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--app-brand-dark);
}

.empty-state p {
    color: var(--app-muted);
    font-size: .9rem;
}

/* Forms in numbered sections, optionally with a side column (preview, tips). */
.form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 19rem;
    gap: 1.25rem;
    align-items: start;
}

.form-section {
    margin-bottom: 1.25rem;
    padding: 1.25rem 1.35rem 1.4rem;
    background: #fff;
    border: 1px solid var(--app-line);
    border-radius: 1rem;
    box-shadow: var(--app-shadow);
}

.form-section-head {
    display: flex;
    align-items: flex-start;
    gap: .8rem;
    margin-bottom: 1.1rem;
}

.form-section-head h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--app-brand-dark);
}

.form-section-head p {
    margin: .1rem 0 0;
    color: var(--app-muted);
    font-size: .82rem;
}

.form-section-num {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: .6rem;
    background: rgba(var(--bs-primary-rgb), .1);
    color: var(--bs-primary);
    font-weight: 800;
    font-size: .9rem;
}

.required-mark {
    color: #dc3545;
    font-weight: 700;
}

.field-error {
    display: block;
    margin-top: .3rem;
    color: #c4314b;
    font-size: .8rem;
}

.field-error:empty {
    display: none;
}

/* An icon inside a field, on the right (the reading start), also for left-to-right inputs such as phone numbers. */
.input-icon {
    position: relative;
}

.input-icon > svg {
    position: absolute;
    top: 50%;
    right: .85rem;
    z-index: 1;
    transform: translateY(-50%);
    color: #9aa6b5;
    pointer-events: none;
}

.input-icon > .form-control {
    padding-right: 2.5rem;
}

/* Choice cards: radio buttons with an icon and a hint. */
.choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: .75rem;
}

.choice-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    margin: 0;
    padding: .9rem;
    border-radius: .9rem;
    border: 1.5px solid var(--app-line);
    background: #fff;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.choice-card:hover {
    border-color: #c9d4e1;
}

.choice-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice-card-icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: .75rem;
    background: var(--tone-bg);
    color: var(--tone);
}

.choice-card-text strong {
    display: block;
    color: var(--app-brand-dark);
}

.choice-card-text small {
    display: block;
    color: var(--app-muted);
    font-size: .76rem;
    line-height: 1.5;
}

.choice-card-check {
    position: absolute;
    top: .6rem;
    inset-inline-end: .6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 50%;
    background: var(--tone);
    color: #fff;
    opacity: 0;
    transform: scale(.6);
    transition: opacity .15s, transform .15s;
}

.choice-card:has(input:checked) {
    border-color: var(--tone);
    background: var(--tone-bg);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 15%, transparent);
}

.choice-card:has(input:checked) .choice-card-icon {
    background: var(--tone);
    color: #fff;
}

.choice-card:has(input:checked) .choice-card-check {
    opacity: 1;
    transform: none;
}

.choice-card:has(input:focus-visible) {
    outline: 2px solid var(--app-focus-border);
    outline-offset: 2px;
}

.form-aside {
    position: sticky;
    top: calc(var(--app-topbar-height) + 1rem);
}

.preview-card {
    padding: 1.2rem;
    background: linear-gradient(160deg, #fff 0%, #f5f8fc 100%);
    border: 1px solid var(--app-line);
    border-radius: 1rem;
    box-shadow: var(--app-shadow);
}

.preview-card-title {
    margin-bottom: .8rem;
    font-size: .78rem;
    font-weight: 700;
    color: var(--app-muted);
}

.form-tips {
    list-style: none;
    margin: 1.1rem 0 0;
    padding: 1rem 0 0;
    border-top: 1px dashed var(--app-line);
    font-size: .8rem;
    color: var(--app-muted);
}

.form-tips li {
    display: flex;
    gap: .45rem;
    margin-bottom: .5rem;
}

.form-tips svg {
    flex: none;
    margin-top: .2rem;
    color: #20a776;
}

/* Receipt / payment summary: the amount in the kind's color and the chosen person. */
.cash-preview-amount {
    margin-top: 1rem;
    padding: .7rem .9rem;
    border-radius: .8rem;
    background: var(--tone-bg);
    color: var(--tone);
    font-size: 1.45rem;
    font-weight: 800;
    direction: ltr;
    text-align: right;
}

.cash-preview-person {
    margin-top: .6rem;
    font-weight: 700;
    color: var(--app-brand-dark);
}

@media screen and (max-width: 991.98px) {
    .form-layout {
        grid-template-columns: 1fr;
    }

    .form-aside {
        position: static;
        order: -1;
    }

    /* A long summary (receipt / payment) goes after the fields, so they stay at the top. */
    .form-aside.form-aside-end {
        order: 0;
    }

    .form-aside .form-tips {
        display: none;
    }
}

@media screen and (max-width: 767.98px) {
    .page-header h1 {
        font-size: 1.2rem;
    }

    .page-icon {
        width: 2.6rem;
        height: 2.6rem;
    }

    .page-subtitle {
        font-size: .8rem;
    }

    .card:has(> .table-responsive > .table-cards) > .list-toolbar {
        padding: 0 0 .75rem;
        border: 0;
    }

    .list-toolbar-info {
        width: 100%;
        margin: 0;
    }

    .row-actions {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        gap: .5rem;
    }

    .row-actions form {
        flex: 1 1 auto;
    }

    .icon-btn {
        flex: 1 1 auto;
        width: auto;
        height: 2.5rem;
        padding: 0 .75rem;
        white-space: nowrap;
        border: 1px solid var(--app-line);
        color: #3b4757;
    }

    .row-actions form .icon-btn {
        width: 100%;
    }

    .icon-btn > span {
        display: inline;
        font-size: .85rem;
    }

    .icon-btn.is-danger {
        color: #c4314b;
        border-color: rgba(220, 53, 69, .35);
    }

    .form-section {
        padding: 1rem;
    }
}
/* ---------- Responsive card lists ----------
   <table class="table-cards">: a normal table on wide screens; below 768px every row becomes a card.
   Cell roles: rc-title (card heading), rc-sub (small line under it), rc-key (big figures, two per line),
   rc-more (folded under "جزئیات بیشتر"), rc-actions (buttons; a dropdown menu is laid out as buttons),
   rc-hide (table only). Any other cell is a "label: value" line (site.js marks it rc-line). Labels come from the
   column headers (site.js copies them to data-label), the "جزئیات بیشتر" button is added by site.js to rows
   that have rc-more cells, and tfoot cells spanning several columns become the summary card's heading. */

.table-cards .rc-toggle,
.table-cards .rc-only,
.filter-toggle {
    display: none !important;
}

/* iPhone Safari zooms the whole page into any field whose text is smaller than 16px (small selects, the search box of
   a searchable list...). On phones and tablets every typable field is at least 16px. */
@media screen and (max-width: 991.98px) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
    select,
    textarea {
        font-size: max(16px, 1em) !important;
    }
}

/* Screens only: a printed list (about 700px wide on A4) stays a table. */
@media screen and (max-width: 767.98px) {
    /* The list's own card frame goes away (each row is a card); a card with a heading keeps its frame. */
    .card:not(:has(> .card-header)):has(> .table-responsive > .table-cards),
    .card:not(:has(> .card-header)):has(> .table-cards) {
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .table-responsive:has(> .table-cards) {
        overflow: visible;
    }

    .card:has(> .card-header) .table-cards {
        padding: .75rem;
    }

    .table-cards {
        display: flex;
        flex-direction: column;
        gap: .75rem;
        margin: 0;
        --bs-table-bg: transparent;
        --bs-table-hover-bg: transparent;
        --bs-table-striped-bg: transparent;
    }

    .table-cards thead {
        display: none;
    }

    .table-cards tbody,
    .table-cards tfoot {
        display: flex;
        flex-direction: column;
        gap: .75rem;
    }

    /* The totals come first, as a summary card. */
    .table-cards tfoot {
        order: -1;
    }

    .table-cards tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: .3rem .9rem;
        padding: .9rem 1rem;
        background: #fff;
        border: 1px solid var(--bs-border-color);
        border-radius: .9rem;
        box-shadow: 0 2px 8px rgba(22, 53, 90, .06);
    }

    .table-cards tr.pager-hidden {
        display: none;
    }

    .table-cards tr.chain-row {
        border-inline-start: 4px solid #e0a100;
    }

    .table-cards tfoot tr,
    .table-cards tr.table-totals {
        background: #eef4fb;
        border-color: #cfdcec;
    }

    .table-cards td,
    .table-cards tbody th {
        display: block !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        text-align: start !important;
        white-space: normal;
        width: auto !important;
    }

    .table-cards td:empty,
    .table-cards .rc-hide {
        display: none !important;
    }

    /* A cell written left to right (user names, phone numbers) keeps the card's label on the right. */
    .table-cards td.ltr {
        direction: rtl;
    }

    /* Text shown only on cards (e.g. the word "پارت" before a lot number used as the heading). */
    .table-cards .rc-only {
        display: inline !important;
    }

    /* A row with a single cell (e.g. "nothing found"). */
    .table-cards .rc-single > td {
        grid-column: 1 / -1;
        text-align: center !important;
    }

    .table-cards .rc-title,
    .table-cards .rc-sub,
    .table-cards .rc-line,
    .table-cards .rc-more,
    .table-cards .rc-toggle,
    .table-cards .rc-actions {
        grid-column: 1 / -1;
    }

    /* Card order is fixed whatever the column order: heading, line, figures, lines, details, toggle, buttons. */
    .table-cards .rc-title { order: 1; }
    .table-cards .rc-sub { order: 2; }
    .table-cards .rc-key { order: 3; }
    .table-cards .rc-line { order: 4; }
    .table-cards .rc-more { order: 5; }
    .table-cards .rc-toggle { order: 6; }
    .table-cards .rc-actions { order: 7; }

    .table-cards .rc-title {
        display: flex !important;
        flex-wrap: wrap;
        align-items: center;
        gap: .4rem;
        font-weight: 700;
        font-size: 1rem;
    }

    .table-cards .rc-title > div,
    .table-cards .rc-title .plate-secondary,
    .table-cards .rc-title .chain-link {
        flex-basis: 100%;
        margin: 0;
        font-weight: 400;
    }

    .table-cards .rc-sub {
        color: #6b7686;
        font-size: .82rem;
    }

    .table-cards .rc-sub > div {
        display: inline;
        margin-inline-start: .35rem;
    }

    .table-cards .rc-key {
        margin-top: .4rem;
        font-weight: 700;
        font-size: 1.05rem;
        color: var(--app-brand-dark);
    }

    .table-cards .rc-key > div {
        font-size: .8rem;
        font-weight: 400;
    }

    .table-cards .rc-key[data-label]::before,
    .table-cards .rc-line[data-label]::before,
    .table-cards .rc-more[data-label]::before {
        content: attr(data-label);
        color: #6b7686;
        font-size: .76rem;
        font-weight: 400;
    }

    .table-cards .rc-key::before {
        display: block;
    }

    /* "label: value" lines: label in the first column, the value (one or more lines) in the second. */
    .table-cards .rc-line,
    .table-cards .rc-open .rc-more {
        display: block !important;
        position: relative;
        padding-inline-start: 8.25rem !important;
        font-size: .9rem;
    }

    .table-cards .rc-line[data-label]::before,
    .table-cards .rc-more[data-label]::before {
        position: absolute;
        inset-inline-start: 0;
        width: 7.5rem;
    }

    .table-cards .rc-open .rc-more[data-label]::before {
        top: .45rem;
    }

    /* Values sit next to their label, left-to-right ones (phone numbers, amounts) included. */
    .table-cards .rc-line .ltr,
    .table-cards .rc-more .ltr {
        text-align: right !important;
    }

    /* Full-width content (e.g. the change list of the activity history) with its label above. */
    .table-cards .rc-wide {
        grid-column: 1 / -1;
        order: 4;
        padding-top: .45rem !important;
        border-top: 1px dashed var(--bs-border-color) !important;
    }

    .table-cards .rc-wide[data-label]::before {
        content: attr(data-label);
        display: block;
        color: #6b7686;
        font-size: .76rem;
        margin-bottom: .2rem;
    }

    .table-cards .rc-more {
        display: none !important;
    }

    .table-cards .rc-open .rc-more {
        padding-top: .45rem !important;
        border-top: 1px dashed var(--bs-border-color) !important;
    }

    .table-cards .rc-toggle {
        display: block !important;
        margin-top: .35rem;
    }

    .table-cards .rc-toggle .btn {
        display: inline-flex;
        align-items: center;
        gap: .25rem;
        text-decoration: none;
        font-size: .85rem;
    }

    .table-cards .rc-toggle svg {
        transition: transform .15s;
    }

    .table-cards .rc-open .rc-toggle svg {
        transform: rotate(180deg);
    }

    .table-cards .rc-toggle-open,
    .table-cards .rc-open .rc-toggle-closed {
        display: none;
    }

    .table-cards .rc-open .rc-toggle-open {
        display: inline;
    }

    /* Buttons: large and easy to tap; an "عملیات" dropdown is shown as its items. */
    .table-cards .rc-actions {
        margin-top: .5rem;
        padding-top: .65rem !important;
        border-top: 1px solid var(--bs-border-color) !important;
    }

    .table-cards .rc-actions > *:not(.dropdown),
    .table-cards .rc-actions .dropdown-menu {
        display: flex !important;
        flex-wrap: wrap;
        gap: .5rem;
    }

    .table-cards .rc-actions .btn,
    .table-cards .rc-actions .dropdown-item {
        flex: 1 1 auto;
        padding-top: .45rem;
        padding-bottom: .45rem;
    }

    .table-cards .rc-actions > .d-flex,
    .table-cards .rc-actions > .btn-group {
        justify-content: stretch;
    }

    .table-cards .rc-actions form {
        display: flex;
        flex: 1 1 auto;
        margin: 0;
    }

    .table-cards .rc-actions form > .btn,
    .table-cards .rc-actions form > .dropdown-item {
        width: 100%;
    }

    .table-cards .rc-actions .dropdown-toggle,
    .table-cards .rc-actions .dropdown-divider {
        display: none !important;
    }

    .table-cards .rc-actions .dropdown-menu {
        position: static !important;
        inset: auto !important;
        transform: none !important;
        float: none;
        min-width: 0;
        padding: 0;
        margin: 0;
        border: 0;
        box-shadow: none !important;
        background: transparent;
    }

    .table-cards .rc-actions .dropdown-menu > li {
        display: flex;
        flex: 1 1 auto;
    }

    .table-cards .rc-actions .dropdown-menu > li:has(> .dropdown-divider) {
        display: none;
    }

    .table-cards .rc-actions .dropdown-item {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        border: 1px solid var(--app-input-border);
        border-radius: var(--bs-border-radius-sm);
        font-size: .875rem;
        text-align: center;
        white-space: nowrap;
    }

    .table-cards .rc-actions .dropdown-item.text-danger {
        border-color: rgba(220, 53, 69, .55);
    }

    /* Filters fold behind a "فیلتر" button (added by site.js) so the list starts at the top of the screen. */
    .filter-toggle {
        display: inline-flex !important;
        align-items: center;
        gap: .35rem;
    }

    .filter-panel:not(.is-open) {
        display: none;
    }
}

@media print {
    /* A printed list shows every column, also those hidden on narrow screens (d-none d-md-table-cell...). */
    th.d-none[class*="-table-cell"],
    td.d-none[class*="-table-cell"] {
        display: table-cell !important;
    }

    .table-cards .rc-toggle,
    .row-actions,
    .list-toolbar,
    .type-tabs,
    .filter-toggle {
        display: none !important;
    }
}
/* ---------- Installable app: install guide, dashboard banner and sign-in link ---------- */

.install-banner {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin-bottom: 1.25rem;
    padding: .85rem 1rem;
    background: #fff;
    border: 1px solid #cfe0f3;
    border-inline-start: 4px solid var(--bs-primary);
    border-radius: 1rem;
    box-shadow: var(--app-shadow);
}

.install-banner[hidden] {
    display: none;
}

.install-banner-icon img {
    display: block;
    border-radius: .7rem;
}

.install-banner-text {
    flex: 1;
    min-width: 0;
}

.install-banner-text strong {
    display: block;
    color: var(--app-brand-dark);
}

.install-banner-text > span {
    display: block;
    color: var(--app-muted);
    font-size: .82rem;
}

.install-banner .btn-close {
    flex: none;
}

.auth-install {
    margin-top: .75rem;
    text-align: center;
}

.auth-install .btn-link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-weight: 600;
    text-decoration: none;
}

.install-guide .modal-header {
    align-items: flex-start;
}

.install-guide-head {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex: 1;
}

.install-guide-head img {
    border-radius: .8rem;
    box-shadow: 0 4px 12px rgba(22, 53, 90, .2);
}

.install-guide .modal-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--app-brand-dark);
}

.install-device {
    margin-top: .15rem;
    color: var(--app-muted);
    font-size: .8rem;
}

.install-lead {
    color: #3b4757;
    line-height: 1.9;
}

.install-steps {
    list-style: none;
    counter-reset: step;
    margin: 0;
    padding: 0;
}

.install-steps > li {
    position: relative;
    counter-increment: step;
    padding: 0 2.6rem 1rem 0;
    line-height: 2;
}

.install-steps > li::before {
    content: counter(step, persian);
    position: absolute;
    top: .1rem;
    right: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    background: rgba(var(--bs-primary-rgb), .1);
    color: var(--bs-primary);
    font-weight: 800;
    font-size: .9rem;
}

.install-steps > li:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 2.1rem;
    bottom: .2rem;
    right: .88rem;
    border-right: 2px dashed var(--app-line);
}

.install-steps small {
    display: block;
    color: var(--app-muted);
    font-size: .8rem;
    line-height: 1.8;
}

/* A button of the phone or browser, drawn the way the user will see it. */
.install-key {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    margin: 0 .1rem;
    padding: .05rem .5rem;
    border: 1px solid #d5dee9;
    border-radius: .5rem;
    background: #f6f8fb;
    color: var(--app-brand-dark);
    font-weight: 700;
    white-space: nowrap;
    vertical-align: middle;
    line-height: 1.7;
}

.install-key svg {
    color: #0a7aff;
}

.install-note {
    display: flex;
    gap: .4rem;
    margin: .5rem 0 0;
    padding: .65rem .8rem;
    border-radius: .7rem;
    background: #f0f6fd;
    color: #2c4c70;
    font-size: .84rem;
    line-height: 1.8;
}

.install-note svg {
    flex: none;
    margin-top: .3rem;
}

.install-link {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin-top: .75rem;
    padding: .6rem .75rem;
    border: 1px dashed #c9d4e1;
    border-radius: .7rem;
}

.install-link:empty {
    display: none;
}

.install-link-url {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    font-weight: 700;
    color: var(--app-brand-dark);
}

.install-done {
    display: flex;
    gap: .75rem;
    color: #146c43;
}

.install-done p {
    margin: .25rem 0 0;
    color: #3b4757;
}

.install-benefits {
    display: grid;
    gap: .45rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--app-line);
    color: var(--app-muted);
    font-size: .82rem;
}

.install-benefits div {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.install-benefits svg {
    color: var(--bs-primary);
}

@media screen and (max-width: 575.98px) {
    .install-banner {
        flex-wrap: wrap;
    }

    .install-banner-text {
        flex-basis: calc(100% - 6rem);
    }

    .install-banner .btn-primary {
        flex: 1 1 100%;
        order: 5;
    }
}

@media print {
    .install-banner {
        display: none !important;
    }
}