﻿:root {
    --primary: #155b7d;
    --primary-dark: #0f435d;
    --secondary: #1d7f72;
    --accent: #d99a20;
    --surface: #ffffff;
    --surface-soft: #f4f7f9;
    --border: #d9e2e8;
    --text: #0f2433;
    --muted: #647788;
    --danger: #c3262e;
    --success: #138a4f;
    --radius-lg: 22px;
    --radius-md: 14px;
    --touch-target: 48px;
}

* {
    box-sizing: border-box;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: "Noto Kufi Arabic", Tahoma, Arial, sans-serif;
    color: var(--text);
    background: var(--surface-soft);
}

a {
    text-decoration: none;
}

img {
    -webkit-user-drag: none;
    user-select: none;
}

.login-shell {
    min-height: 100vh;
    background: #eef4f7;
}

.number-cell,
.num,
.amount,
.grid-input[type="number"],
.ltr {
    font-variant-numeric: tabular-nums;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: radial-gradient(circle at 22% 15%, rgba(255,255,255,.98), rgba(238,244,247,.84) 48%, rgba(222,233,240,.76));
}

.login-panel {
    direction: ltr;
    width: min(100%, 920px);
    min-height: 540px;
    display: grid;
    grid-template-columns: 45% 55%;
    background: #fff;
    border: 2px solid #0d2a3f;
    border-radius: 42px;
    overflow: hidden;
    box-shadow: 0 24px 72px rgba(15,36,51,.2);
}

.login-showcase {
    direction: rtl;
    position: relative;
    display: grid;
    place-items: center;
    min-width: 0;
    padding: 32px;
    background: #fff;
    overflow: hidden;
    border-inline-start: 1px solid rgba(15,36,51,.12);
}

    .login-showcase::before, .login-showcase::after {
        content: "";
        position: absolute;
        pointer-events: none;
        opacity: .58;
        background-repeat: no-repeat;
        background-size: contain;
    }

    .login-showcase::before {
        inset-block: 0;
        inset-inline-end: -24px;
        width: 190px;
        background-image: linear-gradient(92deg, transparent 18%, rgba(21,91,125,.16) 20%, transparent 23%), linear-gradient(100deg, transparent 30%, rgba(217,154,32,.6) 32%, transparent 34%);
        transform: skewX(-9deg);
    }

    .login-showcase::after {
        inset-block-end: -60px;
        inset-inline-start: -54px;
        width: 240px;
        height: 300px;
        border-radius: 50%;
        border-inline-end: 3px solid rgba(217,154,32,.62);
        border-inline-start: 22px solid rgba(21,91,125,.08);
        transform: rotate(-18deg);
    }

.login-showcase-logo {
    position: relative;
    z-index: 1;
    width: min(78%, 440px);
    height: 420px;
    object-fit: contain;
    filter: drop-shadow(0 14px 22px rgba(15,36,51,.12));
}

.login-card {
    direction: rtl;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96));
    padding: 28px 30px 30px;
}

.login-title-block {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 13px;
    border-bottom: 2px solid rgba(238,111,13,.42);
    position: relative;
}

    .login-title-block::after {
        content: "";
        position: absolute;
        inset-inline-start: 0;
        bottom: -3px;
        width: 86px;
        height: 5px;
        border-radius: 999px;
        background: #ee6f0d;
    }

    .login-title-block h1 {
        margin: 0;
        color: #3b3e42;
        font-size: clamp(28px, 3.1vw, 42px);
        line-height: 1.25;
        font-weight: 900;
    }

    .login-title-block svg {
        width: 34px;
        height: 34px;
        color: #ee6f0d;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
        flex: 0 0 auto;
    }

.login-form {
    display: grid;
    gap: 9px;
}

.login-validation ul {
    margin-bottom: 0;
    padding-inline-start: 18px;
}

.login-validation:not(:empty) {
    border: 1px solid rgba(195,38,46,.35);
    border-radius: 8px;
    background: #fff5f5;
    color: var(--danger) !important;
    padding: 9px 12px;
    font-weight: 800;
}

.login-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text);
    font-weight: 800;
}

.login-input-wrap, .login-context-field, .login-context-select {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    grid-template-rows: 1fr;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    border: 2px solid #e5e7ea;
    border-radius: 9px;
    background: #fff;
    padding: 0 9px 0 4px;
    box-shadow: inset 0 1px 2px rgba(15,36,51,.04), 0 2px 8px rgba(15,36,51,.05);
    transition: border-color .16s, box-shadow .16s, background .16s;
}

    .login-input-wrap:focus-within {
        border-color: rgba(21,91,125,.5);
        background: #fff;
        box-shadow: 0 0 0 4px rgba(21,91,125,.08);
    }

    .login-input-wrap svg, .login-context-field svg, .login-context-select svg {
        grid-column: 2;
        grid-row: 1;
        width: 29px;
        height: 29px;
        justify-self: center;
        color: #5d6b77;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.75;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .login-input-wrap .form-control {
        grid-column: 1;
        grid-row: 1;
        min-height: 44px;
        border: 0;
        box-shadow: none;
        background: transparent;
        padding: 0 6px;
        font-weight: 800;
        color: var(--text);
        text-align: center;
    }

        .login-input-wrap .form-control::placeholder {
            color: #8b99a6;
            font-weight: 700;
        }

.password-box {
    grid-template-columns: 38px minmax(0, 1fr) 44px;
    padding-inline-start: 5px;
}

    .password-box > svg {
        grid-column: 3;
    }

    .password-box .form-control {
        grid-column: 2;
    }

.toggle-password {
    grid-column: 1;
    grid-row: 1;
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #5d6b77;
    padding: 0;
}

    .toggle-password svg {
        width: 20px;
        height: 20px;
        stroke-width: 1.8;
    }

    .toggle-password.is-visible {
        background: #e8f3f7;
        border-color: var(--primary);
    }

    .toggle-password:hover {
        border-color: var(--primary);
        background: #edf6fa;
    }

.login-context-field span, .login-context-select span {
    display: block;
    grid-column: 1;
    grid-row: 1;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.login-context-field.is-loading {
    border-color: rgba(217,154,32,.65);
    background: #fffaf0;
}

.login-context-field.is-error {
    border-color: rgba(195,38,46,.55);
    background: #fff5f5;
}

.login-context-select.d-none {
    display: none;
}

.login-context-select .form-select {
    grid-column: 1;
    grid-row: 1;
    border: 0;
    box-shadow: none;
    min-height: 44px;
    font-weight: 800;
    text-align: center;
    background-color: transparent;
}

.login-context-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.login-context-select {
    min-height: 48px;
    padding-inline-end: 8px;
    position: relative;
}

    .login-context-select::before {
        content: "";
        position: absolute;
        inset-inline-start: 10px;
        inset-block-start: 50%;
        transform: translateY(-30%);
        width: 0;
        height: 0;
        border-inline: 5px solid transparent;
        border-top: 6px solid #6d7881;
    }

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
    margin: 2px 0 4px;
}

.check-line {
    display: flex;
    gap: 9px;
    align-items: center;
    margin: 0;
    color: var(--muted);
    cursor: pointer;
}

    .check-line input {
        width: 16px;
        height: 16px;
        accent-color: var(--primary);
    }

.login-secure-note {
    color: var(--secondary);
    font-weight: 700;
    white-space: nowrap;
}

.login-action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.login-submit, .login-cancel {
    width: 100%;
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 6px;
    font-weight: 900;
    box-shadow: 0 8px 18px rgba(15,36,51,.08);
}

    .login-submit svg {
        width: 20px;
        height: 20px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
        transform: scaleX(-1);
    }

.login-password-link {
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d4d9de;
    border-radius: 6px;
    background: #fff;
    color: #1f2d38;
    font-weight: 900;
    text-decoration: none;
}

    .login-password-link:hover {
        color: var(--primary);
        background: #f8fafb;
    }

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

    .btn-primary:hover {
        background: var(--primary-dark);
        border-color: var(--primary-dark);
    }

.btn-success {
    background: var(--success);
    border-color: var(--success);
}

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
    background: linear-gradient(to left, var(--primary-dark) 0 260px, var(--surface-soft) 260px 100%);
}

.app-sidebar {
    background: var(--primary-dark);
    color: #fff;
    padding: 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255,255,255,.16);
}

    .brand-box img {
        width: 58px;
        height: 76px;
        object-fit: contain;
        background: #fff;
        border-radius: 12px;
        padding: 5px;
    }

    .brand-box span {
        display: block;
        opacity: .75;
        font-size: 12px;
    }

.side-nav {
    display: grid;
    gap: 8px;
    margin-top: 18px;
}

    .side-nav a {
        color: #e9f6fb;
        padding: 11px 12px;
        border-radius: 10px;
    }

        .side-nav a:hover {
            background: rgba(255,255,255,.11);
        }

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

.app-topbar {
    min-height: 66px;
    background: var(--primary);
    color: #fff;
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 10px 18px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 10px 30px rgba(15,36,51,.16);
}

.topbar-logo {
    width: 36px;
    height: 44px;
    object-fit: contain;
    background: #fff;
    border-radius: 9px;
    padding: 3px;
}

.menu-toggle {
    display: none;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 24px;
}

.page-title {
    font-weight: 800;
    font-size: 18px;
    flex: 1;
}

.user-chip {
    display: grid;
    line-height: 1.4;
    text-align: left;
    direction: rtl;
}

    .user-chip small {
        opacity: .75;
    }

.content-wrap {
    padding: 18px;
}

.page-card, .welcome-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 8px 20px rgba(15,67,93,.06);
    margin-bottom: 16px;
}

.welcome-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

    .welcome-panel h1 {
        color: var(--primary);
        margin: 0 0 8px;
    }

.dashboard-hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-radius: 16px;
    padding: 22px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    box-shadow: 0 12px 28px rgba(15,67,93,.16);
}

    .dashboard-hero h1 {
        margin: 4px 0 8px;
        font-size: 26px;
        font-weight: 900;
    }

    .dashboard-hero p {
        margin: 0;
        opacity: .88;
    }

    .dashboard-hero .eyebrow {
        display: inline-flex;
        padding: 3px 10px;
        border-radius: 999px;
        background: rgba(255,255,255,.14);
        font-size: 12px;
    }

.hero-separator {
    display: inline-block;
    margin: 0 8px;
    opacity: .6;
}

.hero-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.summary-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

    .summary-meta > div {
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 13px 15px;
        box-shadow: 0 6px 16px rgba(15,67,93,.05);
    }

    .summary-meta span {
        display: block;
        color: var(--muted);
        font-size: 12px;
        margin-bottom: 6px;
    }

    .summary-meta strong {
        display: block;
        color: var(--text);
        font-size: 14px;
    }

.dashboard-alert {
    border-right: 4px solid var(--danger);
    color: var(--danger);
    font-weight: 700;
}

.dashboard-section {
    margin-top: 18px;
}

.icon-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.financial-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

    .financial-grid.compact {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

        .financial-grid.compact .financial-card:nth-last-child(-n+2) {
            grid-column: span 2;
        }

.financial-card {
    position: relative;
    overflow: hidden;
    min-height: 126px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 17px;
    box-shadow: 0 8px 20px rgba(15,67,93,.06);
}

    .financial-card::before {
        content: "";
        position: absolute;
        inset-block: 0;
        inset-inline-end: 0;
        width: 5px;
        background: var(--card-accent, var(--primary));
    }

    .financial-card::after {
        content: "";
        position: absolute;
        inset-inline-start: 14px;
        inset-block-start: 14px;
        width: 42px;
        height: 42px;
        border-radius: 12px;
        background: color-mix(in srgb, var(--card-accent, var(--primary)) 14%, #fff);
    }

.card-icon {
    position: absolute;
    inset-inline-start: 23px;
    inset-block-start: 23px;
    z-index: 1;
    width: 24px;
    height: 24px;
    color: var(--card-accent, var(--primary));
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.financial-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 11px;
    padding-inline-start: 58px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.financial-card strong {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding-right: 58px;
    font-size: clamp(16px, 1.18vw, 20px);
    line-height: 1.35;
    color: var(--text);
    direction: ltr;
    text-align: right;
    unicode-bidi: plaintext;
    margin-bottom: 9px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
}

.financial-card small {
    display: block;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.7;
    padding-inline-start: 58px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tone-blue {
    --card-accent: #155b7d;
}

.tone-green, .tone-success {
    --card-accent: #138a4f;
}

.tone-red, .tone-danger {
    --card-accent: #c3262e;
}

.tone-gold {
    --card-accent: #d99a20;
}

.tone-teal {
    --card-accent: #1d7f72;
}

.tone-cyan {
    --card-accent: #1699b7;
}

.tone-orange {
    --card-accent: #ee6f0d;
}

.tone-violet {
    --card-accent: #7c4fd6;
}

.tone-slate {
    --card-accent: #607080;
}

.quick-grid, .summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

    .quick-card, .summary-grid > div {
        background: #fff;
        border: 1px solid var(--border);
        border-right: 4px solid var(--primary);
        padding: 16px;
        border-radius: 12px;
    }

        .quick-card span, .summary-grid span, .invoice-head span {
            display: block;
            color: var(--muted);
            font-size: 12px;
            margin-bottom: 6px;
        }

        .quick-card strong, .summary-grid strong, .invoice-head strong {
            font-size: 18px;
        }

.filter-grid, .form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
}

.filter-actions, .form-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.responsive-table {
    width: 100%;
    overflow-x: auto;
}

.erpx-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 960px;
}

    .erpx-table th {
        background: var(--primary);
        color: #fff;
        padding: 11px 10px;
        border: 1px solid #fff;
        white-space: nowrap;
        text-align: center;
    }

    .erpx-table td {
        padding: 9px 10px;
        border: 1px solid var(--border);
        background: #fff;
        vertical-align: middle;
    }

    .erpx-table tr:nth-child(even) td {
        background: #f9fbfc;
    }

.ltr {
    direction: ltr;
    text-align: left;
    unicode-bidi: plaintext;
}

.status-pill {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
}

    .status-pill.draft {
        background: #fff7e3;
        color: #8a5c00;
    }

    .status-pill.posted {
        background: #e6f5ec;
        color: var(--success);
    }

.row-actions {
    white-space: nowrap;
}

.pager-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-top: 14px;
    color: var(--muted);
}

.empty-inline, .empty-state {
    text-align: center;
    padding: 32px;
    color: var(--muted);
}

    .empty-state h1 {
        color: var(--primary);
        font-size: 52px;
    }

    .empty-state.danger h1 {
        color: var(--danger);
    }

.invoice-head {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    gap: 14px;
    align-items: center;
}

.head-actions, .inline-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.invoice-meta {
    grid-template-columns: minmax(300px, 1.1fr) minmax(220px, .8fr) minmax(220px, .8fr) minmax(260px, 1fr);
    align-items: end;
}

.invoice-meta .form-control,
.invoice-meta .form-select {
    min-height: 38px;
}

.invoice-meta label {
    margin-bottom: 4px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 800;
}

.span-2 {
    grid-column: span 2;
}

.lookup-box {
    display: flex;
    gap: 8px;
}

.lookup-icon-btn {
    min-width: 64px;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

    .section-title h2 {
        font-size: 17px;
        margin: 0;
        color: var(--primary);
    }

.grid-input {
    width: 100%;
    min-width: 92px;
    border: 1px solid transparent;
    background: transparent;
    padding: 6px;
}

    .grid-input:focus {
        background: #fff;
        border-color: var(--primary);
        outline: 0;
        box-shadow: 0 0 0 2px rgba(21,91,125,.12);
    }

.grid-lookup {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 52px;
    gap: 4px;
    align-items: center;
}

    .grid-lookup .grid-input {
        min-width: 120px;
    }

.grid-lookup-btn {
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--primary);
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 12px;
    font-weight: 700;
}

    .grid-lookup-btn:hover {
        background: #e8f2f7;
        border-color: var(--primary);
    }

.modal-search-bar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-bottom: 14px;
}

.lookup-results-table {
    min-width: 640px;
}

    .lookup-results-table .lookup-row {
        cursor: pointer;
    }

        .lookup-results-table .lookup-row:hover td {
            background: #eaf4f8;
        }

.edit-table td {
    padding: 3px;
}

.edit-table {
    table-layout: fixed;
    min-width: 1180px;
}

.edit-table .col-line-no {
    width: 54px;
}

.edit-table .col-product-code {
    width: 190px;
}

.edit-table .col-item-name {
    width: 270px;
}

.edit-table .col-pack {
    width: 130px;
}

.edit-table .col-packing {
    width: 118px;
}

.edit-table .col-qty {
    width: 110px;
}

.edit-table .col-price {
    width: 130px;
}

.edit-table .col-discount {
    width: 115px;
}

.edit-table .col-tax {
    width: 115px;
}

.edit-table .col-net {
    width: 130px;
}

.edit-table .col-action {
    width: 82px;
}

.edit-table th {
    white-space: nowrap;
}

.edit-table td,
.edit-table th {
    vertical-align: middle;
}

.edit-table .grid-input {
    min-width: 0;
    min-height: 34px;
    border-radius: 6px;
}

.edit-table .item-name,
.edit-table .product-code {
    min-width: 0;
}

.edit-table .row-no {
    text-align: center;
    font-weight: 800;
}

.edit-table .disc-amt,
.edit-table .tax-amt,
.edit-table .net-amt,
.edit-table .qty,
.edit-table .price {
    direction: ltr;
    text-align: end;
}

.line-actions {
    display: flex;
    justify-content: flex-start;
    padding-top: 14px;
}

.line-actions .btn {
    min-width: 132px;
    min-height: 40px;
    font-weight: 800;
}

.sticky-summary {
    position: sticky;
    bottom: 0;
    background: var(--surface-soft);
    padding-top: 12px;
}

.form-actions {
    justify-content: flex-start;
    margin-bottom: 24px;
}

@media (max-width: 980px) {
    .login-page {
        min-height: 100dvh;
        padding: 12px;
        align-items: start;
    }

    .login-panel {
        width: min(100%, 620px);
        min-height: 0;
        grid-template-columns: 1fr;
        border-radius: 28px;
    }

    .login-showcase {
        order: 1;
        min-height: 260px;
        padding: 18px;
        border-inline-start: 0;
        border-bottom: 1px solid rgba(15,36,51,.1);
    }

    .login-showcase-logo {
        width: min(78%, 330px);
        height: 230px;
    }

    .login-card {
        order: 2;
        padding: 22px 18px 24px;
    }

    .login-title-block {
        margin-bottom: 16px;
    }

        .login-title-block h1 {
            font-size: 30px;
        }

    .login-input-wrap {
        min-height: var(--touch-target);
    }

        .login-input-wrap .form-control {
            min-height: 46px;
        }

    .login-submit, .login-cancel, .login-password-link {
        min-height: var(--touch-target);
    }

    .login-options {
        align-items: flex-start;
        flex-direction: column;
    }

    .app-shell {
        grid-template-columns: 1fr;
        background: var(--surface-soft);
    }

    .app-sidebar {
        position: fixed;
        right: -280px;
        width: 260px;
        z-index: 100;
        transition: right .2s;
        box-shadow: -20px 0 40px rgba(15,36,51,.18);
    }

    body.sidebar-open .app-sidebar {
        right: 0;
    }

    .menu-toggle {
        display: inline-block;
    }

    .topbar-logo {
        width: 32px;
        height: 38px;
    }

    .user-chip {
        display: none;
    }

    .filter-grid, .form-grid, .invoice-meta, .invoice-head, .quick-grid, .summary-grid, .financial-grid, .financial-grid.compact, .summary-meta {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: span 1;
    }

    .welcome-panel, .dashboard-hero {
        align-items: stretch;
        flex-direction: column;
    }

        .dashboard-hero h1 {
            font-size: 22px;
        }

    .content-wrap {
        padding: 12px;
    }

    .page-card, .welcome-panel {
        padding: 14px;
        border-radius: 12px;
    }

    .filter-actions, .form-actions, .head-actions, .inline-form {
        flex-direction: column;
        align-items: stretch;
    }

        .filter-actions .btn, .form-actions .btn, .head-actions .btn, .inline-form .btn {
            width: 100%;
            min-height: 44px;
        }

    .responsive-table {
        margin-inline: -2px;
        padding-bottom: 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .erpx-table {
        min-width: 860px;
    }

    .edit-table {
        min-width: 1060px;
    }

    .section-title {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

        .section-title .btn {
            min-height: 44px;
        }

    .sticky-summary {
        position: static;
    }

    .modal-search-bar {
        grid-template-columns: 1fr;
    }
}

.password-page {
    max-width: 760px;
    margin-inline: auto;
}

.password-form {
    display: grid;
    gap: 18px;
}

.password-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 800;
}

.password-input {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    padding-inline-start: 5px;
}

.password-input:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(21,91,125,.08);
}

.password-input .form-control {
    grid-column: 2;
    min-height: 48px;
    border: 0;
    box-shadow: none;
}

.password-input .toggle-password {
    grid-column: 1;
}

.password-strength {
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.password-strength[data-score="0"],
.password-strength[data-score="1"] {
    color: var(--danger);
}

.password-strength[data-score="2"] {
    color: #a16207;
}

.password-strength[data-score="3"],
.password-strength[data-score="4"] {
    color: var(--success);
}

@media (max-width: 520px) {
    .login-page {
        padding: 0;
        background: #fff;
    }

    .login-panel {
        width: 100%;
        min-height: 100dvh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .login-showcase {
        min-height: 210px;
        padding: 10px 14px;
    }

        .login-showcase::before {
            width: 118px;
            opacity: .34;
        }

        .login-showcase::after {
            width: 150px;
            height: 190px;
            opacity: .34;
        }

    .login-showcase-logo {
        width: min(88%, 280px);
        height: 190px;
    }

    .login-card {
        justify-content: flex-start;
        padding: 16px 14px 18px;
    }

    .login-title-block {
        margin-bottom: 14px;
        padding-bottom: 10px;
    }

        .login-title-block h1 {
            font-size: 27px;
        }

        .login-title-block svg {
            width: 29px;
            height: 29px;
        }

    .login-context-grid, .login-action-row {
        grid-template-columns: 1fr;
    }

    .password-box {
        grid-template-columns: 38px minmax(0, 1fr) 42px;
    }

    .app-topbar {
        gap: 10px;
        min-height: 62px;
        padding-inline: 12px;
    }

    .page-title {
        font-size: 15px;
    }

    .brand-box img {
        width: 48px;
        height: 62px;
    }
}

@media (max-width: 760px) {
    .invoice-lines {
        padding: 12px;
    }

    .invoice-lines .responsive-table {
        overflow: visible;
        margin-inline: 0;
    }

    .edit-table {
        min-width: 0;
        table-layout: auto;
        border-collapse: separate;
        border-spacing: 0 12px;
    }

    .edit-table colgroup,
    .edit-table thead {
        display: none;
    }

    .edit-table,
    .edit-table tbody,
    .edit-table tr,
    .edit-table td {
        display: block;
        width: 100%;
    }

    .edit-table tr {
        overflow: hidden;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 10px 22px rgba(15,36,51,.06);
    }

    .edit-table td {
        display: grid;
        grid-template-columns: 104px minmax(0, 1fr);
        gap: 10px;
        align-items: center;
        min-height: 46px;
        padding: 8px 10px;
        border-bottom: 1px solid #edf2f5;
    }

    .edit-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        font-weight: 800;
    }

    .edit-table td:last-child {
        border-bottom: 0;
    }

    .edit-table .grid-input,
    .edit-table .grid-lookup {
        width: 100%;
        min-width: 0;
    }

    .edit-table .grid-lookup {
        grid-template-columns: minmax(0, 1fr) 58px;
    }

    .edit-table .remove-line {
        width: 100%;
        min-height: 38px;
    }

    .line-actions {
        position: sticky;
        bottom: 0;
        z-index: 20;
        margin-inline: -12px;
        padding: 10px 12px;
        background: linear-gradient(180deg, rgba(246,249,251,0), var(--surface-soft) 24%);
    }

    .line-actions .btn {
        width: 100%;
        min-height: 46px;
    }

    .form-actions {
        position: sticky;
        bottom: 0;
        z-index: 21;
        padding: 10px 12px;
        margin-inline: -12px;
        background: var(--surface-soft);
        border-top: 1px solid var(--border);
    }
}

@media print {
    .app-sidebar, .app-topbar, .head-actions, .btn {
        display: none !important;
    }

    .app-shell {
        display: block;
    }

    .content-wrap {
        padding: 0;
    }

    .page-card, .summary-grid > div {
        box-shadow: none;
        border-color: #999;
    }

    body {
        background: #fff;
    }
}
