@font-face {
    font-family: "Vazirmatn";
    font-style: normal;
    font-weight: 300 900;
    font-display: swap;
    src: url("../fonts/vazirmatn-arabic.woff2") format("woff2");
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}

@font-face {
    font-family: "Vazirmatn";
    font-style: normal;
    font-weight: 300 900;
    font-display: swap;
    src: url("../fonts/vazirmatn-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Vazirmatn";
    font-style: normal;
    font-weight: 300 900;
    font-display: swap;
    src: url("../fonts/vazirmatn-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --bs-body-font-family: "Vazirmatn", Tahoma, sans-serif;
    --bs-font-sans-serif: "Vazirmatn", Tahoma, sans-serif;
    --brand: #ec1f28;
    --brand-dark: #c5161e;
    --brand-deep: #2a1113;
    --brand-soft: #fff0f1;
    --accent: #6e6f71;
    --surface: #ffffff;
    --surface-soft: #f7f7f8;
    --page-bg: #f3f3f4;
    --text: #242528;
    --muted: #6e6f71;
    --border: #dedfe1;
    --success: #188653;
    --success-soft: #e8f7ef;
    --danger: #b42318;
    --shadow-sm: 0 8px 24px rgba(24, 24, 27, .07);
    --shadow-md: 0 18px 55px rgba(24, 24, 27, .11);
    --radius-lg: 22px;
    --radius-md: 16px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
    font-family: var(--bs-body-font-family);
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--page-bg);
    color: var(--text);
    font-family: var(--bs-body-font-family);
    line-height: 1.75;
    direction: rtl;
    -webkit-font-smoothing: antialiased;
}

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

a {
    color: var(--brand);
}


.app-brand {
    min-width: 0;
    gap: 14px;
}

.company-logo {
    display: block;
    width: clamp(158px, 16vw, 210px);
    height: auto;
    flex: 0 0 auto;
    object-fit: contain;
}

.brand-divider {
    width: 1px;
    height: 34px;
    flex: 0 0 auto;
    background: var(--border);
}

.app-navbar {
    min-height: 76px;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid rgba(222, 223, 225, .92);
    box-shadow: 0 5px 18px rgba(24, 24, 27, .05);
    backdrop-filter: blur(14px);
    z-index: 1030;
}

.navbar-brand {
    color: var(--text) !important;
    text-decoration: none;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 13px;
    color: #fff;
    background: linear-gradient(145deg, var(--brand), var(--accent));
    box-shadow: 0 8px 18px rgba(236, 31, 40, .20);
    font-size: 1.1rem;
    font-weight: 800;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.brand-copy strong {
    font-size: .98rem;
    font-weight: 800;
}

.brand-copy small {
    margin-top: 4px;
    color: var(--muted);
    font-size: .68rem;
    font-weight: 400;
}

.nav-link {
    color: #5f6063 !important;
    font-weight: 600;
}

.nav-link:hover {
    color: var(--brand) !important;
}

.nav-user-name {
    max-width: 220px;
    overflow: hidden;
    color: var(--muted);
    font-size: .9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.navbar-toggler {
    border-color: var(--border);
    border-radius: 11px;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 .2rem rgba(236, 31, 40, .12);
}

.btn {
    border-radius: 11px;
    font-weight: 700;
    transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn-brand {
    color: #fff;
    border-color: var(--brand);
    background: linear-gradient(135deg, var(--brand), #d71922);
    box-shadow: 0 8px 20px rgba(236, 31, 40, .18);
}

.btn-brand:hover,
.btn-brand:focus {
    color: #fff;
    border-color: var(--brand-dark);
    background: linear-gradient(135deg, var(--brand-dark), var(--brand));
    box-shadow: 0 10px 25px rgba(236, 31, 40, .24);
}

.btn-brand:disabled {
    color: #fff;
    border-color: #caa2a5;
    background: #caa2a5;
    box-shadow: none;
}

.btn-outline-secondary {
    border-color: #cfd0d2;
    color: #5f6063;
}

.form-label {
    margin-bottom: .55rem;
    color: #3d3e42;
}

.form-control,
.form-select,
.input-group-text {
    min-height: 48px;
    border-color: #d4d5d7;
    border-radius: 12px;
    background-color: #fff;
}

.form-control-lg,
.form-select-lg,
.input-group-lg > .form-control,
.input-group-lg > .input-group-text {
    min-height: 54px;
    font-size: .98rem;
}

.form-control:focus,
.form-select:focus {
    border-color: #e76b71;
    box-shadow: 0 0 0 .22rem rgba(236, 31, 40, .10);
}

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

.form-text,
.text-secondary {
    color: var(--muted) !important;
}

.card-modern {
    border: 1px solid rgba(222, 223, 225, .95);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.eyebrow {
    display: inline-block;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, .72);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .05em;
}

.text-brand {
    color: var(--brand) !important;
}

.section-title {
    color: var(--text);
    font-size: clamp(1.25rem, 2vw, 1.65rem);
    font-weight: 800;
}

.hero-section {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 70px 0 96px;
    color: #fff;
    background:
        radial-gradient(circle at 15% 20%, rgba(236, 31, 40, .25), transparent 30%),
        radial-gradient(circle at 85% 78%, rgba(110, 111, 113, .22), transparent 32%),
        linear-gradient(125deg, #1f2023, var(--brand-deep) 58%, #641016);
}

.hero-section::after {
    content: "";
    position: absolute;
    inset: auto -10% -100px -10%;
    height: 150px;
    z-index: -1;
    border-radius: 50% 50% 0 0;
    background: var(--page-bg);
}

.hero-title {
    max-width: 760px;
    margin: 0 0 16px;
    font-size: clamp(2rem, 4.2vw, 3.6rem);
    font-weight: 900;
    line-height: 1.35;
}

.hero-text {
    max-width: 700px;
    color: rgba(255, 255, 255, .78);
    font-size: clamp(.98rem, 1.3vw, 1.15rem);
}

.hero-visual {
    position: relative;
    width: min(100%, 420px);
    min-height: 240px;
    margin-right: auto;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 32px;
    background: rgba(255, 255, 255, .07);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .24);
    backdrop-filter: blur(10px);
}

.hero-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
}

.hero-orb-one {
    top: 32px;
    left: 48px;
    width: 94px;
    height: 94px;
    background: linear-gradient(145deg, rgba(255, 255, 255, .34), rgba(236, 31, 40, .14));
}

.hero-orb-two {
    right: 58px;
    bottom: 36px;
    width: 130px;
    height: 130px;
    border: 20px solid rgba(255, 255, 255, .08);
}

.hero-stat {
    position: absolute;
    right: 38px;
    bottom: 42px;
    display: flex;
    flex-direction: column;
    padding: 18px 22px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 18px;
    background: rgba(42, 17, 19, .78);
}

.hero-stat span {
    color: rgba(255, 255, 255, .68);
    font-size: .8rem;
}

.hero-stat strong {
    margin-top: 3px;
    font-size: 1.25rem;
}

.content-section {
    padding: 40px 0 70px;
}

.search-section {
    position: relative;
    z-index: 2;
    margin-top: -62px;
}

.search-panel {
    box-shadow: var(--shadow-md);
}

.search-box {
    position: relative;
}

.search-box .form-control {
    padding-right: 48px;
}

.search-icon {
    position: absolute;
    top: 50%;
    right: 17px;
    z-index: 3;
    transform: translateY(-50%);
    color: #77787b;
    font-size: 1.4rem;
    line-height: 1;
    pointer-events: none;
}

.suggestion-list {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    z-index: 1080;
    max-height: 330px;
    overflow-y: auto;
    padding: 7px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(24, 24, 27, .16);
}

.suggestion {
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 11px 13px;
    border: 0;
    border-radius: 10px;
    color: var(--text);
    background: transparent;
    text-align: right;
    cursor: pointer;
}

.suggestion:hover,
.suggestion:focus {
    outline: 0;
    background: var(--brand-soft);
}

.suggestion-title {
    font-size: .9rem;
    font-weight: 800;
}

.suggestion-subtitle {
    margin-top: 2px;
    color: var(--muted);
    font-size: .76rem;
}

.result-loading {
    width: fit-content;
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 24px auto 0;
    padding: 9px 15px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.result-section {
    margin-top: 38px;
}

.result-count {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 6px 13px;
    border: 1px solid #efc2c5;
    border-radius: 999px;
    color: var(--brand);
    background: #fff7f7;
    font-size: .84rem;
    font-weight: 800;
}

.inventory-result-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(24, 24, 27, .055);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.inventory-result-card:hover {
    transform: translateY(-3px);
    border-color: #edb0b4;
    box-shadow: 0 14px 34px rgba(24, 24, 27, .09);
}

.result-product-kicker {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
}

.result-product-name {
    margin: 0;
    color: var(--text);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.65;
}

.stock-pill {
    flex: 0 0 auto;
    padding: 7px 10px;
    border-radius: 999px;
    color: var(--success);
    background: var(--success-soft);
    font-size: .78rem;
    font-weight: 800;
    white-space: nowrap;
}

.branch-block {
    display: flex;
    flex-direction: column;
    padding: 13px 15px;
    border-radius: 13px;
    background: var(--surface-soft);
}

.branch-block strong {
    font-size: .91rem;
}

.branch-block span {
    margin-top: 2px;
    color: var(--muted);
    font-size: .76rem;
}

.result-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.result-meta > div {
    min-width: 0;
}

.result-meta span,
.result-meta strong {
    display: block;
}

.result-meta span {
    margin-bottom: 3px;
    color: var(--muted);
    font-size: .7rem;
}

.result-meta strong {
    overflow: hidden;
    font-size: .79rem;
    font-weight: 700;
    text-overflow: ellipsis;
}

.empty-state {
    padding: 42px 20px;
    border: 1px dashed #d4d5d7;
    border-radius: 20px;
    color: var(--muted);
    background: rgba(255, 255, 255, .7);
    text-align: center;
}

.empty-state h3 {
    margin: 7px 0 5px;
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 800;
}

.empty-icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    color: var(--brand);
    background: var(--brand-soft);
    font-size: 1.55rem;
}

/* Login */
.login-page {
    min-height: calc(100vh - 76px);
    display: flex;
    align-items: center;
    padding: 50px 0 70px;
    background:
        radial-gradient(circle at 12% 16%, rgba(236, 31, 40, .10), transparent 24%),
        radial-gradient(circle at 88% 84%, rgba(110, 111, 113, .10), transparent 26%),
        var(--page-bg);
}

.login-shell {
    max-width: 1030px;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 28px;
    background: #fff;
    box-shadow: 0 26px 70px rgba(24, 24, 27, .13);
}

.login-intro {
    width: 100%;
    min-height: 570px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 54px;
    color: #fff;
    background:
        radial-gradient(circle at 22% 20%, rgba(236, 31, 40, .24), transparent 28%),
        linear-gradient(145deg, #1f2023, var(--brand-deep) 62%, #641016);
}

.login-intro h1 {
    max-width: 430px;
    margin: 0 0 18px;
    font-size: 2.1rem;
    font-weight: 900;
    line-height: 1.55;
}

.login-intro p {
    max-width: 470px;
    margin-bottom: 28px;
    color: rgba(255, 255, 255, .73);
}

.login-feature-list {
    display: grid;
    gap: 12px;
}

.login-feature-list > div {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, .88);
    font-size: .9rem;
}

.login-feature-list span {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
}

.login-form-side {
    min-height: 570px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 50px 54px;
}

.login-form-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 30px;
}

.login-form-header h2 {
    margin: 0 0 4px;
    font-size: 1.55rem;
    font-weight: 900;
}

.login-form-header p {
    margin: 0;
    color: var(--muted);
    font-size: .86rem;
}

.login-icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 14px;
    color: var(--brand);
    background: var(--brand-soft);
    font-size: 1.4rem;
    font-weight: 900;
}

.validation-summary-valid {
    display: none;
}

.login-back-link {
    align-self: center;
    margin-top: 23px;
    color: var(--muted);
    font-size: .84rem;
    font-weight: 700;
    text-decoration: none;
}

.login-back-link:hover {
    color: var(--brand);
}

/* Branch user page */
.user-page {
    min-height: calc(100vh - 76px);
}

.user-hero {
    padding: 46px 0 76px;
    color: #fff;
    background:
        radial-gradient(circle at 15% 25%, rgba(236, 31, 40, .23), transparent 29%),
        linear-gradient(125deg, #1f2023, var(--brand-deep) 60%, #641016);
}

.user-hero h1 {
    margin: 0 0 7px;
    font-size: clamp(1.8rem, 3vw, 2.65rem);
    font-weight: 900;
}

.user-hero p {
    color: rgba(255, 255, 255, .72);
}

.hero-stock-summary {
    min-width: 165px;
    padding: 14px 18px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 15px;
    background: rgba(255, 255, 255, .08);
    backdrop-filter: blur(8px);
}

.hero-stock-summary span,
.hero-stock-summary strong {
    display: block;
}

.hero-stock-summary span {
    color: rgba(255, 255, 255, .66);
    font-size: .73rem;
}

.hero-stock-summary strong {
    margin-top: 3px;
    font-size: 1.35rem;
}

.user-content {
    margin-top: -45px;
    padding-top: 0;
}

.filter-panel {
    position: relative;
    z-index: 5;
    box-shadow: var(--shadow-md);
}

.filter-active {
    outline: 3px solid rgba(236, 31, 40, .12);
}

.product-card {
    position: relative;
    min-height: 190px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 18px;
    color: var(--text);
    background: #fff;
    box-shadow: 0 7px 22px rgba(24, 24, 27, .055);
    cursor: pointer;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.product-card::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 4px;
    background: #d9dadd;
    transition: background-color .2s ease;
}

.product-card:hover {
    transform: translateY(-3px);
    border-color: #e5b2b5;
    box-shadow: 0 14px 34px rgba(24, 24, 27, .10);
}

.product-card.selected {
    border-color: #ec1f28;
    background: #fff7f7;
    box-shadow: 0 0 0 3px rgba(236, 31, 40, .09), 0 14px 34px rgba(24, 24, 27, .09);
}

.product-card.is-available::before {
    background: var(--success);
}

.product-card.is-empty::before {
    background: #a7a8ab;
}

.product-card-copy {
    min-width: 0;
}

.product-label {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: .7rem;
    font-weight: 700;
}

.product-card-title {
    margin: 0 0 5px;
    font-size: 1rem;
    font-weight: 900;
    line-height: 1.7;
}

.product-card-copy small {
    display: block;
    overflow: hidden;
    color: var(--muted);
    font-size: .76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-stock-badge {
    min-width: 66px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 8px 9px;
    border-radius: 13px;
    color: var(--brand-dark);
    background: var(--brand-soft);
}

.product-stock-badge strong {
    font-size: 1.1rem;
    font-weight: 900;
    line-height: 1.25;
}

.product-stock-badge span {
    color: var(--muted);
    font-size: .68rem;
}

.product-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
    padding-top: 13px;
    border-top: 1px solid #eeeeef;
}

.availability-text {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
}

.product-card.is-available .availability-text {
    color: var(--success);
}

.select-hint {
    color: var(--brand);
    font-size: .71rem;
    font-weight: 800;
    white-space: nowrap;
}

.inventory-editor {
    top: 96px;
}

.editor-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.editor-heading h2 {
    margin: 0 0 2px;
    font-size: 1.2rem;
    font-weight: 900;
}

.editor-heading p {
    margin: 0;
    color: var(--muted);
    font-size: .76rem;
}

.editor-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: var(--brand);
    background: var(--brand-soft);
    font-size: 1.15rem;
    font-weight: 900;
}

.selected-product-box {
    min-height: 98px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-bottom: 20px;
    padding: 14px 15px;
    border: 1px dashed #d0d1d3;
    border-radius: 14px;
    color: var(--muted);
    background: #fafafa;
}

.selected-product-box strong {
    color: var(--text);
    font-size: .9rem;
}

.selected-product-box span,
.selected-product-box small {
    margin-top: 3px;
    font-size: .73rem;
}

.selected-product-box.has-selection {
    border-style: solid;
    border-color: #efb7ba;
    background: #fff5f5;
}

.selected-product-box.has-selection span {
    color: var(--brand);
    font-weight: 800;
}

.input-group > .form-control {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

.input-group > .input-group-text {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    color: var(--muted);
    background: #f6f6f7;
}

.alert {
    border-radius: 12px;
    font-size: .84rem;
}

.app-footer {
    padding: 22px 0;
    border-top: 1px solid var(--border);
    color: #5f6063;
    background: #fff;
    font-size: .75rem;
}

@media (max-width: 1199.98px) {
    .inventory-editor {
        position: static !important;
    }
}

@media (max-width: 991.98px) {
    .app-navbar {
        min-height: 68px;
    }

    .navbar-collapse {
        padding-bottom: 12px;
    }

    .hero-section {
        padding: 55px 0 88px;
    }

    .hero-title {
        font-size: clamp(2rem, 7vw, 3rem);
    }

    .search-section {
        margin-top: -50px;
    }

    .login-page {
        min-height: calc(100vh - 68px);
    }

    .login-shell {
        max-width: 620px;
    }

    .login-form-side {
        min-height: auto;
        padding: 42px;
    }

    .user-hero {
        padding: 40px 0 72px;
    }
}

@media (max-width: 767.98px) {
    .brand-copy small {
        display: none;
    }

    .brand-mark {
        width: 38px;
        height: 38px;
        border-radius: 11px;
    }

    .hero-section {
        padding: 45px 0 80px;
    }

    .hero-title {
        margin-bottom: 12px;
        font-size: 2rem;
    }

    .hero-text {
        font-size: .92rem;
    }

    .content-section {
        padding-bottom: 50px;
    }

    .search-section {
        margin-top: -42px;
    }

    .card-modern,
    .search-panel,
    .filter-panel {
        border-radius: 17px;
    }

    .result-meta {
        grid-template-columns: 1fr;
    }

    .login-page {
        padding: 28px 0 45px;
    }

    .login-shell {
        border-radius: 20px;
    }

    .login-form-side {
        padding: 32px 24px;
    }

    .login-form-header {
        margin-bottom: 24px;
    }

    .user-hero {
        padding: 34px 0 70px;
    }

    .hero-stock-summary {
        width: 100%;
    }

    .product-card {
        min-height: 175px;
    }

    .product-card-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .app-footer {
        text-align: center;
    }
}

@media (max-width: 575.98px) {
    .container {
        padding-right: 16px;
        padding-left: 16px;
    }

    .hero-title {
        font-size: 1.72rem;
    }

    .section-title {
        font-size: 1.2rem;
    }

    .form-control-lg,
    .form-select-lg,
    .input-group-lg > .form-control,
    .input-group-lg > .input-group-text {
        min-height: 50px;
        font-size: .9rem;
    }

    .inventory-result-card,
    .product-card {
        padding: 17px;
    }

    .product-card-title,
    .result-product-name {
        font-size: .92rem;
    }

    .login-form-side {
        padding: 27px 18px;
    }

    .login-form-header h2 {
        font-size: 1.3rem;
    }

    .login-icon {
        width: 42px;
        height: 42px;
    }
}


/* Internal UI refinements */
.app-navbar .container {
    gap: 16px;
}

.navbar-collapse {
    min-width: 0;
}

.hero-stat {
    max-width: calc(100% - 40px);
}

.search-panel,
.filter-panel,
.inventory-editor,
.login-shell {
    overflow: visible;
}

.btn-light.border:hover,
.btn-light.border:focus {
    border-color: #d7b1b4 !important;
    background: #fff7f7;
}

.form-control:focus,
.form-select:focus,
.btn:focus-visible,
.product-card:focus-visible,
.suggestion:focus-visible {
    outline: none;
}

.product-card:focus-visible,
.suggestion:focus-visible,
.btn:focus-visible {
    box-shadow: 0 0 0 .22rem rgba(236, 31, 40, .12);
}

@media (max-width: 991.98px) {
    .app-navbar .navbar-collapse {
        margin-top: 10px;
        padding: 12px;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: #fff;
        box-shadow: var(--shadow-sm);
    }

    .app-navbar .navbar-nav {
        width: 100%;
        align-items: stretch !important;
    }

    .app-navbar .navbar-nav .nav-link,
    .app-navbar .navbar-nav .btn {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 767.98px) {
    .company-logo {
        width: 156px;
    }

    .hero-section,
    .user-hero {
        text-align: right;
    }

    .search-panel .btn,
    .filter-panel .btn {
        min-height: 48px;
    }

    .search-panel #clearFilters {
        width: 100%;
    }

    .result-count {
        align-self: flex-start;
    }
}

@media (max-width: 575.98px) {
    .app-navbar .container {
        gap: 8px;
    }

    .company-logo {
        width: 142px;
    }

    .navbar-toggler {
        padding: .38rem .52rem;
    }

    .hero-title {
        line-height: 1.5;
    }

    .search-panel,
    .filter-panel,
    .inventory-editor {
        padding: 18px !important;
    }

    .product-stock-badge {
        min-width: 58px;
    }

    .product-card-footer {
        gap: 6px;
    }

    .login-form-side {
        padding-right: 18px;
        padding-left: 18px;
    }
}

/* Sales terms */
.sales-terms-section {
    margin-top: 38px;
}

.sales-price-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.sales-price-card.cash {
    border-top: 4px solid var(--success);
}

.sales-price-card.installment {
    border-top: 4px solid var(--brand);
}

.sales-price-card > span {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
}

.sales-price-card > strong {
    color: var(--text);
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    font-weight: 900;
    direction: ltr;
    text-align: right;
}

.sales-price-card > small {
    color: var(--muted);
}

.sales-provider-card {
    overflow: hidden;
    padding: 0;
}

.sales-provider-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 19px 22px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #fff, #fbfbfc);
}

.sales-provider-heading > div > span {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
}

.sales-provider-heading h3 {
    margin: 0;
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 900;
}

.provider-plan-count,
.provider-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 5px 10px;
    border-radius: 999px;
    color: var(--brand);
    background: var(--brand-soft);
    font-size: .74rem;
    font-weight: 800;
}

.sales-provider-description {
    margin: 0;
    padding: 13px 22px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    background: #fff;
    font-size: .86rem;
}

.sale-plan-list {
    padding: 8px 22px 18px;
}

.sale-plan-row {
    padding: 17px 0;
    border-bottom: 1px dashed #d9dadd;
}

.sale-plan-row:last-child {
    border-bottom: 0;
}

.sale-plan-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.sale-plan-heading strong {
    font-size: .95rem;
    font-weight: 900;
}

.sale-plan-heading > span {
    flex: 0 0 auto;
    padding: 4px 9px;
    border-radius: 999px;
    color: #55565a;
    background: var(--surface-soft);
    font-size: .76rem;
    font-weight: 800;
}

.sale-plan-values {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.sale-plan-values > div {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid #ececee;
    border-radius: 12px;
    background: #fafafa;
}

.sale-plan-values span {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: .72rem;
}

.sale-plan-values strong {
    display: block;
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: .84rem;
    font-weight: 800;
    direction: ltr;
    text-align: right;
}

.sale-plan-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: .8rem;
}

/* Admin sales dashboard */
.admin-page {
    min-height: calc(100vh - 76px);
}

.admin-hero {
    position: relative;
    overflow: hidden;
    padding: 46px 0 78px;
    color: #fff;
    background:
        radial-gradient(circle at 12% 18%, rgba(236, 31, 40, .26), transparent 31%),
        linear-gradient(125deg, #1f2023, #351216 58%, #76131a);
}

.admin-hero h1 {
    margin: 0 0 9px;
    font-size: clamp(1.8rem, 3.4vw, 2.8rem);
    font-weight: 900;
}

.admin-hero p {
    color: rgba(255, 255, 255, .76);
}

.admin-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(105px, 1fr));
    gap: 10px;
}

.admin-summary-item {
    min-width: 105px;
    padding: 13px 15px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 14px;
    background: rgba(255, 255, 255, .07);
    backdrop-filter: blur(10px);
}

.admin-summary-item span {
    display: block;
    color: rgba(255, 255, 255, .63);
    font-size: .72rem;
}

.admin-summary-item strong {
    display: block;
    margin-top: 2px;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 900;
}

.admin-content {
    position: relative;
    z-index: 2;
    margin-top: -42px;
}

.admin-sticky-card {
    top: 98px;
}

.admin-product-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 900;
}

.admin-card-title {
    margin: 0 0 6px;
    color: var(--text);
    font-size: 1.12rem;
    font-weight: 900;
}

.price-preview {
    display: grid;
    gap: 9px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.price-preview > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 11px;
    border-radius: 10px;
    background: var(--surface-soft);
}

.price-preview span {
    color: var(--muted);
    font-size: .78rem;
}

.price-preview strong {
    font-size: .83rem;
    font-weight: 900;
    direction: ltr;
}

.admin-plan-list,
.provider-admin-list {
    display: grid;
    gap: 12px;
}

.admin-plan-card,
.provider-admin-card {
    overflow: hidden;
}

.admin-plan-card > summary,
.provider-admin-card > summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 17px 19px;
    cursor: pointer;
    list-style: none;
    background: #fff;
}

.admin-plan-card > summary::-webkit-details-marker,
.provider-admin-card > summary::-webkit-details-marker {
    display: none;
}

.admin-plan-card > summary::after,
.provider-admin-card > summary::after {
    content: "+";
    order: -1;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--brand);
    background: var(--brand-soft);
    font-weight: 900;
}

.admin-plan-card[open] > summary::after,
.provider-admin-card[open] > summary::after {
    content: "−";
}

.admin-plan-card > summary > div:first-child,
.provider-admin-card > summary > div:first-child {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.admin-plan-card > summary strong,
.provider-admin-card > summary strong {
    color: var(--text);
    font-size: .95rem;
    font-weight: 900;
}

.provider-admin-card > summary span:not(.status-active):not(.status-inactive) {
    color: var(--muted);
    font-size: .78rem;
}

.plan-summary-values,
.provider-summary-meta {
    margin-right: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 7px;
}

.plan-summary-values > span,
.provider-summary-meta > span {
    padding: 4px 8px;
    border-radius: 999px;
    color: #5f6063;
    background: #f2f2f3;
    font-size: .72rem;
    font-weight: 800;
}

.status-active {
    color: var(--success) !important;
    background: var(--success-soft) !important;
}

.status-inactive {
    color: var(--danger) !important;
    background: #fff0f0 !important;
}

.admin-plan-body {
    padding: 18px 19px 20px;
    border-top: 1px solid var(--border);
    background: #fcfcfd;
}

.money-input {
    font-variant-numeric: tabular-nums;
}

.admin-page .form-check-input:checked {
    border-color: var(--brand);
    background-color: var(--brand);
}

@media (max-width: 991.98px) {
    .admin-summary-grid {
        width: 100%;
    }

    .admin-sticky-card {
        position: static !important;
    }
}

@media (max-width: 767.98px) {
    .sales-provider-heading,
    .sale-plan-heading,
    .admin-plan-card > summary,
    .provider-admin-card > summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .sale-plan-values {
        grid-template-columns: 1fr;
    }

    .plan-summary-values,
    .provider-summary-meta {
        width: 100%;
        margin-right: 0;
        justify-content: flex-start;
    }

    .admin-summary-grid {
        grid-template-columns: 1fr;
    }

    .admin-summary-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .admin-summary-item strong {
        margin-top: 0;
    }
}

@media (max-width: 575.98px) {
    .sales-price-card,
    .sales-provider-heading,
    .sales-provider-description,
    .sale-plan-list,
    .admin-plan-body,
    .admin-plan-card > summary,
    .provider-admin-card > summary {
        padding-right: 16px;
        padding-left: 16px;
    }

    .sales-price-card > strong {
        font-size: 1.15rem;
    }

    .admin-hero {
        padding: 34px 0 66px;
    }

    .admin-content {
        margin-top: -34px;
    }
}

/* Read-only sales preview in branch inventory panel */
.inventory-sales-divider {
    margin: 24px 0 20px;
    border-top: 1px solid var(--border);
}

.branch-sales-heading h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 900;
}

.branch-sales-heading p {
    margin: 3px 0 12px;
    color: var(--muted);
    font-size: .76rem;
}

.branch-sales-preview {
    display: grid;
    gap: 10px;
}

.branch-sales-price,
.branch-sales-provider {
    padding: 12px;
    border: 1px solid #e7e7e9;
    border-radius: 12px;
    background: #fafafa;
}

.branch-sales-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.branch-sales-price span {
    color: var(--muted);
    font-size: .75rem;
}

.branch-sales-price strong {
    color: var(--text);
    font-size: .8rem;
    font-weight: 900;
    direction: ltr;
}

.branch-sales-provider-title {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--text);
    font-size: .82rem;
    font-weight: 900;
}

.branch-sales-provider-title span {
    color: var(--muted);
    font-size: .7rem;
    font-weight: 700;
}

.branch-sales-plan-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 8px;
    padding: 9px 0;
    border-top: 1px dashed #dddddf;
}

.branch-sales-plan-row strong {
    font-size: .76rem;
    font-weight: 800;
}

.branch-sales-plan-row > span {
    color: var(--brand);
    font-size: .7rem;
    font-weight: 800;
}

.branch-sales-plan-row small {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: .7rem;
}

.money-field {
    direction: ltr !important;
    flex-direction: row !important;
}

.money-field .input-group-text {
    direction: rtl !important;
    min-width: 58px;
    justify-content: center;
    white-space: nowrap;
}

.money-field .form-control {
    direction: ltr !important;
    text-align: left;
}

.js-number-input {
    direction: ltr;
    text-align: left;
    font-variant-numeric: tabular-nums;
}

.admin-product-box {
    width: 100%;
    max-width: 100%;
}

.admin-product-box .row > * {
    min-width: 0;
}

.admin-product-box .form-select,
.admin-provider-btn {
    width: 100%;
    height: 52px;
    min-height: 52px;
}

.admin-product-box .form-select {
    max-width: 100%;
}

.admin-product-action {
    min-width: 0;
}

.admin-provider-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
    white-space: normal;
    text-align: center;
    line-height: 1.5;
}

.admin-product-box .form-text {
    line-height: 1.8;
    overflow-wrap: anywhere;
}

.plan-edit-hint {
    color: var(--brand) !important;
    background: var(--brand-soft) !important;
    border: 1px solid rgba(189, 18, 28, 0.16);
    cursor: pointer;
}

.admin-last-update {
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.8;
    text-align: center;
}

.admin-page form button[type="submit"]:disabled {
    cursor: wait;
    opacity: 0.7;
}

@media (max-width: 991.98px) {
    .admin-product-action {
        margin-top: 0;
    }

    .admin-provider-btn {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .admin-product-box {
        padding: 1rem !important;
    }

    .admin-product-box .form-select,
    .admin-provider-btn {
        height: 50px;
        min-height: 50px;
    }

    .admin-product-box .form-select {
        font-size: 0.95rem;
    }

    .admin-provider-btn {
        font-size: 0.9rem;
    }

    .admin-product-box .form-text {
        font-size: 0.8rem;
    }
}
