html {
    overflow-x: hidden;
}

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

body {
    background: linear-gradient(180deg, #f7f3e8 0%, #f1ece2 100%);
    min-height: 100vh;
    color: #2f2418;
    overflow-x: hidden;
}

body.sidebar-open {
    overflow: hidden;
}

.form-control,
.form-select {
    border-radius: 0.85rem;
    border-color: rgba(107, 77, 31, 0.18);
    padding: 0.75rem 0.9rem;
}

.form-control:focus,
.form-select:focus {
    border-color: #9a7b42;
    box-shadow: 0 0 0 0.2rem rgba(154, 123, 66, 0.14);
}

.searchable-select {
    position: relative;
    width: 100%;
}

.searchable-select-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.searchable-select-button {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    padding-right: 2.5rem;
    overflow: hidden;
    background-image: none;
}

.searchable-select-label {
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.searchable-select-button::after {
    content: "";
    position: absolute;
    right: 1rem;
    top: 50%;
    width: 0.65rem;
    height: 0.65rem;
    border-right: 2px solid #6b4d1f;
    border-bottom: 2px solid #6b4d1f;
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
    transition: transform 0.2s ease;
}

.searchable-select-button[aria-expanded="true"]::after {
    transform: translateY(-30%) rotate(-135deg);
}

.searchable-select-button.is-placeholder {
    color: #6c757d;
}

.searchable-select-menu {
    width: 100%;
    min-width: 100%;
    margin-top: 0.45rem !important;
    padding: 0.85rem;
    border: 1px solid rgba(107, 77, 31, 0.18);
    border-radius: 1rem;
    background: #fffdf8;
    box-shadow: 0 1rem 2rem rgba(58, 40, 12, 0.12);
    z-index: 1080;
}

.searchable-select-search {
    margin-bottom: 0.7rem;
}

.searchable-select-search .form-control {
    min-height: 2.4rem;
    padding: 0.5rem 0.8rem;
}

.searchable-select-options {
    max-height: 15rem;
    overflow-y: auto;
    padding-right: 0.15rem;
}

.searchable-select-group + .searchable-select-group {
    margin-top: 0.3rem;
}

.searchable-select-group-label {
    padding: 0.3rem 0.8rem 0.2rem;
    font-size: 0.86rem;
    font-weight: 700;
    color: #6b4d1f;
}

.searchable-select-option {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0.7rem 0.8rem;
    border: 1px solid transparent;
    border-radius: 0.8rem;
    background: transparent;
    color: #4b3720;
    text-align: left;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.searchable-select-option + .searchable-select-option {
    margin-top: 0.15rem;
}

.searchable-select-option:hover,
.searchable-select-option:focus {
    background: rgba(244, 227, 197, 0.55);
    border-color: rgba(107, 77, 31, 0.12);
    color: #3f2c15;
}

.searchable-select-option.is-selected {
    background: rgba(214, 161, 77, 0.18);
    border-color: rgba(154, 123, 66, 0.34);
    color: #3f2c15;
    box-shadow: inset 0 0 0 1px rgba(154, 123, 66, 0.08);
}

.searchable-select-option[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.searchable-select-empty {
    padding-top: 0.2rem;
    color: #7b6650;
    font-size: 0.9rem;
}

.searchable-select.is-invalid .searchable-select-button,
.searchable-select.is-invalid .searchable-select-search .form-control {
    border-color: rgba(220, 53, 69, 0.75);
    box-shadow: 0 0 0 0.14rem rgba(220, 53, 69, 0.12);
}

.select-option-search {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    width: 100%;
}

.select-option-search-input {
    min-height: 2.45rem;
    padding: 0.5rem 0.8rem;
    border-radius: 0.85rem;
}

.select-option-search-empty {
    display: none;
    font-size: 0.82rem;
    color: #8a6d43;
}

.select-option-search-empty.is-visible {
    display: block;
}

.select-option-search.is-invalid .form-select,
.select-option-search.is-invalid .select-option-search-input {
    border-color: rgba(220, 53, 69, 0.75);
    box-shadow: 0 0 0 0.14rem rgba(220, 53, 69, 0.12);
}

.password-field {
    display: flex;
    align-items: stretch;
    gap: 0;
}

.password-field .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.password-toggle {
    min-width: 5.8rem;
    border: 1px solid rgba(107, 77, 31, 0.18);
    border-left: 0;
    border-top-right-radius: 0.85rem;
    border-bottom-right-radius: 0.85rem;
    background: #fffaf0;
    color: #6b4d1f;
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.password-toggle:hover {
    background: #f4e3c5;
}

.password-toggle:focus {
    outline: 0;
    border-color: #9a7b42;
    box-shadow: 0 0 0 0.2rem rgba(154, 123, 66, 0.14);
    position: relative;
    z-index: 2;
}

.password-toggle-shared {
    min-width: 7.25rem;
}

.card {
    border: 0;
    border-radius: 1rem;
    box-shadow: 0 0.75rem 2rem rgba(70, 55, 25, 0.08);
}

.modal-content {
    border: 0;
    border-radius: 1.25rem;
    box-shadow: 0 1rem 3rem rgba(58, 40, 12, 0.18);
}

.modal-dialog {
    max-width: min(1180px, calc(100vw - 2rem));
    margin: 1rem auto;
}

.modal-dialog.modal-lg,
.modal-dialog.modal-xl {
    max-width: min(1360px, calc(100vw - 2rem));
}

.modal-header,
.modal-footer {
    border-color: rgba(107, 77, 31, 0.12);
}

.modal-form-grid .row {
    --bs-gutter-x: 1.1rem;
    --bs-gutter-y: 1rem;
}

.modal-form-grid .form-label {
    margin-bottom: 0.45rem;
}

.section-title {
    font-weight: 700;
    color: #5b4429;
}

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

.badge-soft {
    background: #f4e3c5;
    color: #6b4d1f;
}

.auth-card {
    width: 100%;
    background:
        radial-gradient(circle at top right, rgba(196, 156, 81, 0.18), transparent 35%),
        linear-gradient(180deg, #fffdf8 0%, #fbf4e7 100%);
}

.metric-card {
    background: linear-gradient(135deg, #fff8ed 0%, #f6e9d1 100%);
}

.variance-positive {
    color: #198754;
    font-weight: 700;
}

.variance-negative {
    color: #dc3545;
    font-weight: 700;
}

.receipt-item-card {
    background:
        linear-gradient(180deg, rgba(255, 252, 245, 1) 0%, rgba(250, 244, 232, 1) 100%);
    border-color: rgba(107, 77, 31, 0.12) !important;
}

.receipt-item-remove[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

.receipt-item-remove-compact {
    width: 2.5rem;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.85rem;
    line-height: 1;
    font-weight: 700;
}

.multi-select {
    position: relative;
    width: 100%;
}

.multi-select-toggle {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    padding-right: 2.5rem;
    overflow: hidden;
    background-image: none;
}

.multi-select-toggle > span {
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multi-select-toggle::after {
    content: "";
    position: absolute;
    right: 1rem;
    top: 50%;
    width: 0.65rem;
    height: 0.65rem;
    border-right: 2px solid #6b4d1f;
    border-bottom: 2px solid #6b4d1f;
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
    transition: transform 0.2s ease;
}

.multi-select-toggle[aria-expanded="true"]::after {
    transform: translateY(-30%) rotate(-135deg);
}

.multi-select-menu {
    width: 100%;
    min-width: 100%;
    margin-top: 0.45rem !important;
    padding: 0.85rem;
    border: 1px solid rgba(107, 77, 31, 0.18);
    border-radius: 1rem;
    background: #fffdf8;
    box-shadow: 0 1rem 2rem rgba(58, 40, 12, 0.12);
    z-index: 1080;
}

.multi-select-menu.show {
    display: block;
}

.multi-select-actions {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid rgba(107, 77, 31, 0.08);
}

.multi-select-search {
    margin-bottom: 0.7rem;
}

.multi-select-search .form-control {
    min-height: 2.4rem;
    padding: 0.5rem 0.8rem;
}

.multi-select-action {
    min-height: 2rem;
    border-radius: 999px;
    padding: 0.28rem 0.85rem;
    font-weight: 600;
}

.multi-select-options {
    display: block;
    max-height: 14.5rem;
    overflow-y: auto;
    padding-right: 0.15rem;
}

.multi-select-option {
    display: grid !important;
    grid-template-columns: 1.15rem minmax(0, 1fr);
    align-items: start;
    width: 100%;
    min-width: 100%;
    flex: 0 0 100%;
    gap: 0.7rem;
    margin: 0;
    padding: 0.7rem 0.8rem;
    border: 1px solid transparent;
    border-radius: 0.8rem;
    color: #4b3720;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.multi-select-option + .multi-select-option {
    margin-top: 0.2rem;
}

.multi-select-option:hover {
    background: rgba(244, 227, 197, 0.55);
    border-color: rgba(107, 77, 31, 0.12);
}

.multi-select-option .form-check-input {
    margin: 0.12rem 0 0;
    flex-shrink: 0;
}

.multi-select-option span {
    line-height: 1.4;
    white-space: normal;
}

.multi-select-option.is-selected {
    background: rgba(214, 161, 77, 0.18);
    border-color: rgba(154, 123, 66, 0.34);
    color: #3f2c15;
    box-shadow: inset 0 0 0 1px rgba(154, 123, 66, 0.08);
}

.multi-select-option:focus-within {
    background: rgba(244, 227, 197, 0.62);
    border-color: rgba(154, 123, 66, 0.42);
    box-shadow: 0 0 0 0.18rem rgba(154, 123, 66, 0.12);
}

.multi-select-option-search-hidden {
    display: none !important;
}

.multi-select-empty {
    padding-top: 0.2rem;
    color: #7b6650;
    font-size: 0.9rem;
}

.warehouse-name-lines {
    line-height: 1.45;
    white-space: normal;
}

[data-remove-opening-item][disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    max-width: 100%;
    overflow-x: hidden;
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 18.75rem;
    height: 100vh;
    z-index: 1040;
    padding: 0;
    transition: width 0.25s ease, transform 0.25s ease;
    overflow: hidden;
}

.app-sidebar-inner {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1rem 0.95rem 1rem;
    border-radius: 0 1.7rem 1.7rem 0;
    color: #fff7ea;
    background:
        radial-gradient(circle at top, rgba(232, 188, 96, 0.18), transparent 30%),
        linear-gradient(180deg, #342514 0%, #20160d 100%);
    box-shadow: 0 1.25rem 2.5rem rgba(39, 24, 5, 0.22);
    overflow: hidden;
    position: relative;
}

.app-sidebar-inner::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 9rem;
    background: radial-gradient(circle at top left, rgba(255, 223, 160, 0.18), transparent 55%);
    pointer-events: none;
}

.sidebar-brand-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    color: inherit;
    text-decoration: none;
    min-width: 0;
    flex: 1;
}

.sidebar-brand:hover {
    color: inherit;
}

.sidebar-brand-mark {
    width: 2.8rem;
    height: 2.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #3b2910;
    background: linear-gradient(135deg, #f9e4b4 0%, #d9ab57 100%);
    flex-shrink: 0;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-brand-title {
    font-size: 0.96rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.3;
}

.sidebar-brand-subtitle {
    font-size: 0.74rem;
    color: rgba(255, 247, 234, 0.68);
}

.sidebar-section-label {
    margin: 0 0 0.55rem 0.35rem;
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 247, 234, 0.54);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 247, 234, 0.24) transparent;
    padding-right: 0.2rem;
}

.sidebar-nav::-webkit-scrollbar {
    width: 0.45rem;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 247, 234, 0.22);
    border-radius: 999px;
}

.sidebar-nav-section {
    min-width: 0;
}

.sidebar-section-links {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.8rem 0.85rem;
    border-radius: 1rem;
    color: rgba(255, 247, 234, 0.82);
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid transparent;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.sidebar-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 247, 234, 0.08);
}

.sidebar-link.active {
    color: #1f160d;
    background: linear-gradient(135deg, #f7dfab 0%, #d5a14d 100%);
    border-color: rgba(255, 241, 210, 0.9);
    box-shadow: 0 0.75rem 1.25rem rgba(7, 5, 2, 0.16);
}

.sidebar-link-icon {
    width: 2.35rem;
    height: 2.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.9rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: inherit;
    background: rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.sidebar-link.active .sidebar-link-icon {
    background: rgba(31, 22, 13, 0.1);
}

.sidebar-link-button {
    appearance: none;
    background: rgba(255, 255, 255, 0.05);
    text-align: left;
    cursor: pointer;
}

.sidebar-link-button:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 247, 234, 0.08);
}

.sidebar-link-label {
    font-weight: 500;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}

.sidebar-nav-section-profile {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 247, 234, 0.12);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem;
    margin-bottom: 0.8rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.06);
    min-width: 0;
    overflow: hidden;
}

.sidebar-user-link {
    text-decoration: none;
    color: inherit;
    border: 1px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-user-link:hover {
    color: inherit;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 247, 234, 0.08);
}

.sidebar-user-link.active {
    color: #1f160d;
    background: linear-gradient(135deg, #f7dfab 0%, #d5a14d 100%);
    border-color: rgba(255, 241, 210, 0.9);
    box-shadow: 0 0.75rem 1.25rem rgba(7, 5, 2, 0.16);
}

.sidebar-user-link.active .sidebar-user-name,
.sidebar-user-link.active .sidebar-user-role {
    color: #1f160d;
}

.sidebar-user-link.active .sidebar-user-avatar {
    background: rgba(31, 22, 13, 0.1);
    color: #1f160d;
}

.sidebar-user-avatar {
    width: 2.7rem;
    height: 2.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #2d1f10;
    background: linear-gradient(135deg, #f4ddb0 0%, #c99542 100%);
    flex-shrink: 0;
}

.sidebar-user-meta {
    min-width: 0;
}

.sidebar-user-name {
    font-weight: 600;
    color: #fff7ea;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.8rem;
    color: rgba(255, 247, 234, 0.62);
}

.sidebar-menu-form {
    margin: 0;
}

.sidebar-mobile-close {
    flex-shrink: 0;
    border-radius: 0.8rem;
}

.app-main {
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    padding-left: 18.75rem;
    transition: padding-left 0.25s ease;
    overflow-x: hidden;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem 0;
    background: linear-gradient(180deg, rgba(247, 243, 232, 0.95) 0%, rgba(247, 243, 232, 0.78) 75%, rgba(247, 243, 232, 0) 100%);
    backdrop-filter: blur(8px);
}

.app-topbar-eyebrow {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #8a6d43;
    margin-bottom: 0.15rem;
}

.app-topbar-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #3b2a18;
}

.app-sidebar-toggle {
    width: 2.9rem;
    height: 2.9rem;
    padding: 0;
    border-radius: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0.75rem 1.5rem rgba(48, 33, 10, 0.16);
}

.app-sidebar-toggle-icon,
.app-sidebar-toggle-icon::before,
.app-sidebar-toggle-icon::after {
    width: 1rem;
    height: 0.13rem;
    display: block;
    border-radius: 999px;
    background: #ffffff;
    content: "";
}

.app-sidebar-toggle-icon {
    position: relative;
}

.app-sidebar-toggle-icon::before {
    position: absolute;
    top: -0.35rem;
    left: 0;
}

.app-sidebar-toggle-icon::after {
    position: absolute;
    top: 0.35rem;
    left: 0;
}

.app-content {
    padding: 0 1.25rem 1.5rem;
    overflow-x: hidden;
}

.app-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1035;
    border: 0;
    padding: 0;
    background: rgba(23, 16, 7, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

body.sidebar-collapsed .app-sidebar {
    width: 6.75rem;
}

body.sidebar-collapsed .app-main {
    padding-left: 6.75rem;
}

body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .sidebar-section-label,
body.sidebar-collapsed .sidebar-link-label,
body.sidebar-collapsed .sidebar-user-meta,
body.sidebar-collapsed .sidebar-user-role {
    display: none;
}

body.sidebar-collapsed .sidebar-brand,
body.sidebar-collapsed .sidebar-user-card,
body.sidebar-collapsed .sidebar-link {
    justify-content: center;
}

body.sidebar-collapsed .sidebar-nav-section-profile {
    padding-top: 0.85rem;
}

.settings-section-card {
    padding: 1.2rem;
    border-radius: 1.2rem;
    border: 1px solid rgba(107, 77, 31, 0.1);
    background: linear-gradient(180deg, rgba(255, 252, 245, 0.95) 0%, rgba(251, 245, 235, 0.95) 100%);
}

.settings-preview-card {
    border-radius: 1.25rem;
}

.settings-preview-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0.6rem 0.9rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #6b4d1f;
    background: rgba(214, 161, 77, 0.16);
}

.settings-brand-preview {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

.settings-brand-mark {
    width: 3.1rem;
    height: 3.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    color: #3b2910;
    background: linear-gradient(135deg, #f9e4b4 0%, #d9ab57 100%);
    font-weight: 700;
    letter-spacing: 0.08em;
    flex-shrink: 0;
}

.settings-preview-list {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.settings-preview-row {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.settings-preview-row span {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8a6d43;
}

.settings-preview-row strong {
    line-height: 1.45;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        width: min(20rem, calc(100vw - 2rem));
        transform: translateX(-100%);
    }

    .app-main,
    body.sidebar-collapsed .app-main {
        padding-left: 0;
    }

    .app-topbar {
        padding: 1rem 1rem 0;
    }

    .app-content {
        padding: 0 1rem 1.25rem;
    }

    body.sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .app-sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }
}

@media (max-width: 575.98px) {
    .settings-section-card {
        padding: 1rem;
    }

    .sidebar-link {
        padding: 0.75rem 0.8rem;
    }
}
