:root {
    --bg-color: #ffffff;
    --surface-color: #ffffff;
    --surface-soft: #f8fafc;
    --text-color: #233142;
    --heading-color: #002678;
    --primary-color: #002678;
    --hover-color: #0dcaf0;
    --border-color: #e5e7eb;
    --border-muted: #eef2f7;
    --muted-text: #6b7280;
    --success-color: #198754;
    --warning-color: #d18b00;
    --danger-color: #dc3545;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 10px;
    --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 1px 3px rgba(0, 0, 0, 0.08);
    --sidebar-width: 284px;
    --sidebar-collapsed-width: 88px;
    --topbar-height: 62px;
    --transition-fast: 0.18s ease;
    --transition-base: 0.18s ease;
}

body.theme-dark {
    --bg-color: #111827;
    --surface-color: #172233;
    --surface-soft: #1d2a3e;
    --text-color: #e4ecfb;
    --heading-color: #e9efff;
    --primary-color: #9fb8f4;
    --hover-color: #0dcaf0;
    --border-color: #2a3952;
    --border-muted: #32435f;
    --muted-text: #99abc6;
    --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.28);
    --shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-color);
    background: var(--bg-color);
    transition: background-color var(--transition-base), color var(--transition-base);
}

body.page-preload .app-content {
    opacity: 0;
}

body.page-loaded .app-content {
    opacity: 1;
}

a {
    color: inherit;
    text-decoration: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--heading-color);
}

.app-shell {
    min-height: 100vh;
    display: flex;
    background: var(--bg-color);
}

.app-shell__content {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-base);
}

.app-footer {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    text-align: center;
    font-size: 11px;
    color: var(--muted-text);
    padding: 6px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--surface-color);
    z-index: 100;
    transition: color var(--transition-base), background var(--transition-base), border-color var(--transition-base), left var(--transition-base);
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    padding: 12px;
    z-index: 1030;
    transition: width var(--transition-base), padding var(--transition-base), transform var(--transition-base);
}

.app-sidebar__inner,
.topbar,
.panel-card,
.metric-card,
.empty-state,
.topbar-profile,
.topbar-icon-btn,
.dropdown-menu,
.toast,
.system-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    box-shadow: none;
}

.app-sidebar__inner {
    height: calc(100vh - 24px);
    border-radius: var(--radius-lg);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
    background: color-mix(in srgb, var(--surface-color) 88%, var(--heading-color) 12%);
}

.app-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
}

.sidebar-toggle,
.topbar-icon-btn {
    border: 0;
    background: transparent;
    color: var(--heading-color);
}

.sidebar-toggle {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--primary-color) 10%, transparent);
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
    transition: background-color var(--transition-fast);
}

.sidebar-toggle:hover,
.topbar-icon-btn:hover {
    background: color-mix(in srgb, var(--hover-color) 18%, transparent);
}

.sidebar-toggle span {
    width: 15px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.app-sidebar__brand-link {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-mark,
.topbar-profile__avatar,
.empty-state__icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: #ffffff;
    font-weight: 600;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.brand-mark--image {
    background: transparent;
    color: inherit;
    font-weight: 400;
    object-fit: contain;
}

.brand-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.brand-copy strong,
.topbar__title,
.page-header__title,
.panel-card__title,
.metric-card__value,
.empty-state__title {
    color: var(--heading-color);
}

.brand-copy small,
.topbar__eyebrow,
.page-header__eyebrow,
.page-header__subtitle,
.metric-card__label,
.metric-card__trend,
.empty-state__description,
.sidebar-status,
.topbar-profile__meta small,
.check-item,
.sidebar-group__title {
    color: var(--muted-text);
}

.app-sidebar__nav {
    overflow-y: auto;
    padding-right: 2px;
    display: grid;
    gap: 8px;
}

.app-sidebar__nav::-webkit-scrollbar {
    width: 5px;
}

.app-sidebar__nav::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--primary-color) 30%, transparent);
    border-radius: 999px;
}

.sidebar-group {
    display: grid;
    gap: 4px;
}

.sidebar-group__toggle {
    border: 0;
    background: transparent;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 8px;
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast);
}

.sidebar-group__toggle:hover {
    background: color-mix(in srgb, var(--hover-color) 14%, transparent);
}

.sidebar-group__title {
    margin: 0;
    padding: 0;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-size: 11px;
    font-weight: 600;
}

.sidebar-group__chevron {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-text);
    transition: transform var(--transition-fast), color var(--transition-fast);
}

.sidebar-group__chevron svg {
    width: 100%;
    height: 100%;
}

.sidebar-group__items {
    display: grid;
    gap: 2px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height var(--transition-base), opacity var(--transition-fast), padding-top var(--transition-fast);
}

.sidebar-group.is-open .sidebar-group__items {
    max-height: 620px;
    opacity: 1;
    padding-top: 2px;
}

.sidebar-group.is-open .sidebar-group__chevron {
    transform: rotate(180deg);
    color: var(--primary-color);
}

.sidebar-link,
.sidebar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: var(--radius-md);
    padding: 8px 10px;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.sidebar-link {
    color: var(--text-color);
}

.sidebar-link:hover,
.sidebar-link.active {
    color: var(--primary-color);
    background: color-mix(in srgb, var(--hover-color) 18%, transparent);
}

.sidebar-link.active {
    box-shadow: inset 3px 0 0 var(--primary-color);
}

.sidebar-link.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.sidebar-link__icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-link__icon svg,
.theme-icon svg,
.topbar-icon-btn svg {
    width: 100%;
    height: 100%;
}

.sidebar-link__label {
    white-space: nowrap;
    font-size: 13px;
}

.app-sidebar__footer {
    margin-top: auto;
    display: grid;
    gap: 6px;
}

.sidebar-branch-badge,
.sidebar-status {
    background: color-mix(in srgb, var(--surface-color) 88%, var(--primary-color) 12%);
}

.sidebar-branch-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: var(--radius-md);
    padding: 8px 10px;
    border: 1px solid color-mix(in srgb, var(--primary-color) 26%, var(--border-color));
}

.status-dot,
.check-item__dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    flex-shrink: 0;
    background: #10b981;
}

.topbar {
    position: sticky;
    top: 10px;
    z-index: 1020;
    min-height: var(--topbar-height);
    margin: 10px 10px 0;
    border-radius: var(--radius-lg);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.topbar__left,
.topbar__actions,
.topbar-profile,
.page-header,
.check-item {
    display: flex;
    align-items: center;
}

.topbar__left {
    gap: 8px;
    min-width: 0;
}

.topbar__title {
    font-size: 21px;
    line-height: 1.2;
    font-weight: 600;
}

.topbar__eyebrow {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 600;
}

.topbar__subtitle {
    font-size: 11px;
    color: var(--muted-text);
    margin-top: 1px;
}

.topbar__actions {
    gap: 8px;
}

.topbar-icon-btn,
.topbar-profile {
    min-height: 38px;
    border-radius: var(--radius-md);
}

.topbar-icon-btn {
    width: 38px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.theme-icon {
    position: absolute;
    width: 16px;
    height: 16px;
    transition: transform var(--transition-base), opacity var(--transition-base);
}

.theme-icon--moon {
    opacity: 0;
    transform: translateY(10px);
}

body.theme-dark .theme-icon--sun {
    opacity: 0;
    transform: translateY(-10px);
}

body.theme-dark .theme-icon--moon {
    opacity: 1;
    transform: translateY(0);
}

.topbar-profile {
    border: 0;
    padding: 3px 9px;
    gap: 8px;
    color: inherit;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.topbar-profile:hover {
    border-color: color-mix(in srgb, var(--hover-color) 42%, var(--border-color));
}

.topbar-profile__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
}

.topbar-profile__meta strong {
    letter-spacing: 0;
    font-size: 12px;
    font-weight: 600;
}

.topbar-profile__meta small {
    font-size: 12px;
}

.topbar-profile--switcher .topbar-profile__chevron {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-text);
    transition: transform var(--transition-fast), color var(--transition-fast);
}

.topbar-profile--switcher .topbar-profile__chevron svg {
    width: 100%;
    height: 100%;
}

.topbar-profile--switcher[aria-expanded='true'] .topbar-profile__chevron {
    transform: rotate(180deg);
    color: var(--primary-color);
}

.profile-menu {
    min-width: 220px;
    border-radius: var(--radius-lg);
    padding: 6px;
    transform-origin: top right;
    animation: dropdownEnter var(--transition-fast);
}

.profile-menu .dropdown-item {
    border-radius: var(--radius-md);
    font-size: 13px;
    padding: 7px 10px;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.profile-menu .dropdown-item:hover {
    background: color-mix(in srgb, var(--hover-color) 22%, transparent);
    color: var(--primary-color);
}

.app-content {
    padding: 8px 0 18px;
    transition: opacity var(--transition-base);
}

.page-fade-in {
    animation: pageFadeIn var(--transition-base);
}

.page-header {
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-muted);
    margin-bottom: 14px !important;
}

.page-header__brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-header__logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
}

.page-header__eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
    font-weight: 600;
}

.page-header__title {
    font-size: 17px;
    margin: 0;
    line-height: 1.2;
    font-weight: 600;
}

.page-header__subtitle {
    max-width: 760px;
    margin: 3px 0 0;
    font-size: 12px;
}

.system-card,
.panel-card,
.metric-card,
.empty-state {
    border-radius: var(--radius-lg);
    transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.system-card,
.panel-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    box-shadow: none;
}

.system-card:hover,
.panel-card:hover,
.metric-card:hover {
    box-shadow: var(--shadow-soft);
}

.panel-card__header,
.panel-card__body {
    padding: 11px 14px;
}

.panel-card__header {
    border-bottom: 1px solid var(--border-color);
}

.panel-card__title {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted-text);
}

.metric-card {
    padding: 12px 14px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
}

.metric-card__label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin: 0 0 5px;
}

.metric-card__value {
    margin: 0;
    font-size: 19px;
    line-height: 1.15;
    font-weight: 600;
}

.metric-card__trend {
    margin: 4px 0 0;
    font-size: 11px;
}

.table-card .table,
.system-table,
.table {
    margin-bottom: 0;
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table-card .table > :not(caption) > * > *,
.system-table th,
.system-table td,
.table > :not(caption) > * > * {
    padding: 7px 10px;
    border-bottom-color: var(--border-muted);
    color: var(--text-color);
    background: transparent;
    vertical-align: middle;
}

.table-card thead th,
.system-table th,
.table thead th {
    color: var(--muted-text);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--surface-soft);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table tbody tr:hover,
.system-table tbody tr:hover {
    background: color-mix(in srgb, var(--hover-color) 5%, transparent);
}

.table-number {
    text-align: right;
    white-space: nowrap;
}

.table-actions {
    text-align: right;
    white-space: nowrap;
    width: 1%;
    position: relative;
}

/* ─── Sortable column headers ──────────────────────── */
.sortable-header {
    white-space: nowrap;
}

.sortable-header a {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    color: inherit;
    text-decoration: none;
    width: 100%;
}

.sortable-header a:hover {
    color: var(--primary);
}

.sort-icons {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    line-height: 1;
}

.sort-up,
.sort-down {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: 0.3;
    display: block;
}

.sort-up {
    border-bottom: 5px solid currentColor;
}

.sort-down {
    border-top: 5px solid currentColor;
}

.sortable-header.sorted-asc .sort-up {
    opacity: 1;
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.sortable-header.sorted-asc .sort-down {
    opacity: 0.15;
}

.sortable-header.sorted-desc .sort-down {
    opacity: 1;
    color: var(--primary);
    border-top-color: var(--primary);
}

.sortable-header.sorted-desc .sort-up {
    opacity: 0.15;
}

/* ─── Actions dropdown ─────────────────────────────── */
.action-dropdown {
    position: relative;
}

.action-dropdown .btn {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 5px;
}

.action-dropdown__toggle {
    width: 30px;
    height: 28px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
}

.action-dropdown__toggle::after {
    display: none;
}

.action-dropdown .dropdown-menu,
.action-dropdown-menu {
    min-width: 160px;
    padding: 6px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    z-index: 3000 !important;
}

.action-dropdown .dropdown-item {
    font-size: 12px;
    padding: 6px 9px;
    border-radius: 5px;
    color: #233142;
}

.action-dropdown .dropdown-item:hover {
    background: #f0f9ff;
    color: #002678;
}

.action-dropdown .dropdown-item.text-danger {
    color: #dc3545 !important;
}

.action-dropdown .dropdown-item.text-danger:hover {
    background: #fff1f2;
}

.action-dropdown form {
    margin: 0;
}

.action-dropdown button.dropdown-item {
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
}

/* Ensure dropdowns are not clipped by table overflow */
.table-responsive {
    overflow-x: auto;
    overflow-y: visible !important;
}

.system-table-wrap {
    width: 100%;
    overflow: visible !important;
}

.system-card,
.card,
.table-card {
    overflow: visible !important;
}

.dropdown-menu {
    z-index: 1050;
}

.filter-card .panel-card__body {
    padding: 10px 14px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr)) auto;
    gap: 10px;
    align-items: end;
}

.filter-field {
    min-width: 0;
}

.filter-actions {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    white-space: nowrap;
}

.filter-card .form-label {
    display: block;
    margin-bottom: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted-text);
}

.filter-card .form-control,
.filter-card .form-select {
    height: 34px;
    min-height: 34px;
    font-size: 13px;
    border-radius: 5px;
}

.filter-card .btn {
    height: 34px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 5px;
}

body.theme-dark .table tbody tr:hover,
body.theme-dark .system-table tbody tr:hover {
    background: color-mix(in srgb, var(--surface-color) 86%, #ffffff 14%);
}

/* ─── Dashboard metric row tightening ─────────────── */
.metric-row {
    row-gap: 12px;
}

/* ─── Inline data clarity ──────────────────────────── */
.data-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-text);
}

.data-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--heading-color);
}

.form-label {
    color: var(--text-color);
    font-weight: 500;
    font-size: 12px;
    margin-bottom: 4px;
}

.form-control,
.form-select,
textarea.form-control {
    border-radius: var(--radius-md);
    border: 1px solid #d9dee7;
    background-color: var(--surface-color);
    color: var(--text-color);
    min-height: 36px;
    font-size: 13px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

textarea.form-control {
    min-height: 96px;
}

.form-control:focus,
.form-select:focus {
    border-color: color-mix(in srgb, var(--primary-color) 65%, var(--hover-color));
    box-shadow: 0 0 0 0.14rem rgba(0, 38, 120, 0.12);
}

.form-control-sm {
    min-height: 32px;
    font-size: 12px;
    padding: 4px 8px;
}

.invalid-feedback {
    font-size: 12px;
}

.row.align-items-end .mb-3,
.system-form-group {
    margin-bottom: 12px;
}

.row.align-items-end > [class*='col-'].d-flex {
    align-items: flex-end;
}

.row.align-items-end > [class*='col-'].d-flex > .btn,
.row.align-items-end > [class*='col-'].d-flex > .submit-btn {
    margin-bottom: 0;
}

.btn,
.submit-btn {
    min-height: 36px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 13px;
    line-height: 1.2;
    padding: 7px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all var(--transition-fast);
}

.btn-sm {
    min-height: 30px;
    padding: 4px 9px;
    font-size: 12px;
}

.btn-primary,
.submit-btn {
    --bs-btn-bg: var(--primary-color);
    --bs-btn-border-color: var(--primary-color);
    --bs-btn-hover-bg: var(--hover-color);
    --bs-btn-hover-border-color: var(--hover-color);
    --bs-btn-color: #ffffff;
    --bs-btn-hover-color: #002678;
}

.btn-outline-secondary {
    --bs-btn-color: var(--text-color);
    --bs-btn-border-color: var(--border-color);
    --bs-btn-hover-color: var(--primary-color);
    --bs-btn-hover-bg: color-mix(in srgb, var(--hover-color) 20%, transparent);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--hover-color) 40%, var(--border-color));
}

.btn-outline-danger {
    --bs-btn-color: #b42334;
    --bs-btn-border-color: #f2c3cc;
    --bs-btn-hover-color: #ffffff;
    --bs-btn-hover-bg: #c03647;
    --bs-btn-hover-border-color: #c03647;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    background: color-mix(in srgb, var(--primary-color) 12%, transparent);
    color: var(--primary-color);
}

.status-badge--success {
    background: color-mix(in srgb, #198754 18%, transparent);
    color: #198754;
}

.status-badge--warning {
    background: color-mix(in srgb, #ffc107 22%, transparent);
    color: #8f6400;
}

.status-badge--danger {
    background: color-mix(in srgb, #dc3545 18%, transparent);
    color: #c52637;
}

.status-badge--info {
    background: color-mix(in srgb, #0dcaf0 20%, transparent);
    color: #086e84;
}

.alert {
    border-radius: var(--radius-md);
    font-size: 13px;
}

.empty-state {
    padding: 20px 16px;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
    align-items: flex-start;
}

.empty-state__icon {
    width: 32px;
    height: 32px;
    font-size: 14px;
}

.empty-state__title {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}

.empty-state__description {
    margin: 0;
    font-size: 12px;
}

.pagination {
    --bs-pagination-border-radius: 6px;
    --bs-pagination-color: var(--primary-color);
    --bs-pagination-bg: var(--surface-color);
    --bs-pagination-border-color: var(--border-color);
    --bs-pagination-hover-color: var(--primary-color);
    --bs-pagination-hover-bg: color-mix(in srgb, var(--hover-color) 16%, transparent);
    --bs-pagination-hover-border-color: color-mix(in srgb, var(--hover-color) 34%, var(--border-color));
    --bs-pagination-active-bg: var(--primary-color);
    --bs-pagination-active-border-color: var(--primary-color);
}

.toast-container {
    z-index: 1090;
}

.toast {
    min-width: 280px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    animation: toastSlideIn var(--transition-base);
}

.toast .toast-body {
    padding: 10px 12px;
    font-size: 13px;
}

.toast .btn-close {
    transform: scale(0.84);
}

.toast-success {
    background: #f1f8f5;
    color: #195e45;
    border-color: #b9e4d0;
}

.toast-error {
    background: #fdf2f3;
    color: #8e1c2a;
    border-color: #f3c4cb;
}

.toast-warning {
    background: #fff8eb;
    color: #8d6400;
    border-color: #f2deb0;
}

.toast-info {
    background: #eef6fe;
    color: #12466f;
    border-color: #bdd8f4;
}

.pos-branch-alert {
    margin: 0 0 12px;
    border-radius: var(--radius-lg);
    border: 1px solid color-mix(in srgb, var(--warning-color) 38%, var(--border-color));
    background: color-mix(in srgb, var(--warning-color) 6%, var(--surface-color));
    padding: 10px 12px;
}

.pos-branch-alert__title {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 11px;
    font-weight: 600;
    color: color-mix(in srgb, var(--warning-color) 74%, var(--heading-color));
}

.pos-branch-alert__name {
    font-size: 14px;
    font-weight: 600;
    color: var(--heading-color);
}

.pos-branch-alert__hint {
    font-size: 12px;
    color: var(--muted-text);
}

.pos-cart-table .table th,
.pos-cart-table .table td {
    padding: 7px 8px;
    font-size: 12px;
}

.pos-summary {
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
    font-size: 13px;
}

.pos-summary .d-flex {
    margin-bottom: 4px;
}

.receipt-logo {
    max-width: 90px;
    max-height: 90px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto 8px auto;
}

.receipt-page {
    max-width: 740px;
    margin: 0 auto;
}

.receipt-container {
    max-width: 320px;
    margin: 0 auto;
    background: #ffffff;
    color: #1a1a1a;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    line-height: 1.4;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    padding: 14px 12px;
}

.receipt-title {
    text-align: center;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.1em;
    color: #1a1a1a;
    margin: 6px 0;
}

.receipt-header {
    text-align: center;
    margin-bottom: 6px;
}

.receipt-header h2 {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 3px 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.receipt-header p {
    margin: 1px 0;
    font-size: 11px;
    color: #444;
}

.receipt-meta {
    margin: 6px 0;
}

.receipt-meta .meta-row {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 2px;
    font-size: 11px;
}

.receipt-meta .meta-label {
    font-weight: 600;
    color: #555;
    flex-shrink: 0;
    min-width: 60px;
}

.receipt-meta .meta-value {
    text-align: right;
    color: #1a1a1a;
    word-break: break-word;
}

.receipt-separator {
    border: none;
    border-top: 1px dashed #aaa;
    margin: 6px 0;
}

.receipt-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin: 4px 0;
    font-size: 11px;
}

.receipt-table th,
.receipt-table td {
    padding: 3px 2px;
    vertical-align: top;
}

.receipt-table th {
    font-weight: 700;
    border-bottom: 1px solid #1a1a1a;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.receipt-table tbody td {
    border-bottom: 1px dotted #ccc;
}

.receipt-table tbody tr:last-child td {
    border-bottom: none;
}

/* Column widths */
.receipt-table .col-item   { width: 44%; text-align: left; }
.receipt-table .col-qty    { width: 10%; text-align: center; }
.receipt-table .col-price  { width: 22%; text-align: right; }
.receipt-table .col-total  { width: 24%; text-align: right; }

.item-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    line-height: 1.3;
}

.receipt-totals {
    margin: 4px 0;
    font-size: 11px;
}

.receipt-totals .total-row {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 2px;
}

.receipt-totals .total-label {
    color: #555;
    font-weight: 600;
}

.receipt-totals .total-value {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.receipt-totals .grand-total {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a1a;
}

.receipt-totals .grand-total .total-label,
.receipt-totals .grand-total .total-value {
    color: #1a1a1a;
}

.receipt-footer {
    text-align: center;
    font-size: 11px;
    color: #555;
    margin-top: 4px;
}

.report-page {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.report-brand h2 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
    color: #002678;
}

.report-brand p,
.report-title-block p {
    margin: 2px 0;
    font-size: 12px;
    color: #51627f;
}

.report-title-block {
    text-align: right;
}

.report-title-block h1 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #002678;
}

.report-separator {
    border-top: 1px solid #e5e7eb;
    margin: 10px 0;
}

.report-filters {
    font-size: 13px;
    line-height: 1.45;
    color: #233142;
}

.report-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.report-summary-card {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 9px;
    background: #ffffff;
}

.report-summary-card span {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    margin-bottom: 3px;
}

.report-summary-card strong {
    display: block;
    font-size: 13px;
    color: #002678;
}

.report-table-section table th.text-end,
.report-table-section table td.text-end {
    text-align: right;
}

/* ─── Report table ─────────────────────────────────── */
.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-top: 6px;
}

.report-table th,
.report-table td {
    border: 1px solid #c8d0dd;
    padding: 6px 8px;
    vertical-align: top;
    color: #233142;
}

.report-table thead th {
    background: #edf1f8;
    font-weight: 600;
    font-size: 11px;
    color: #002678;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.report-table tbody tr:nth-child(even) {
    background: #f8fafd;
}

.report-table tfoot .totals-row td {
    background: #edf1f8;
    font-weight: 600;
    border-top: 2px solid #002678;
}

.report-table .text-end {
    text-align: right;
    white-space: nowrap;
}

.report-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-size: 12px;
}

.report-page-number {
    font-size: 11px;
    color: #233142;
    text-align: right;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 7px;
}

.app-shell.is-collapsed .app-sidebar {
    width: var(--sidebar-collapsed-width);
    padding-inline: 10px;
}

.app-shell.is-collapsed .app-shell__content {
    margin-left: var(--sidebar-collapsed-width);
}

.app-shell.is-collapsed .app-footer {
    left: var(--sidebar-collapsed-width);
}

.app-shell.is-collapsed .brand-copy,
.app-shell.is-collapsed .sidebar-group__title,
.app-shell.is-collapsed .sidebar-link__label,
.app-shell.is-collapsed .sidebar-branch-badge .sidebar-link__label,
.app-shell.is-collapsed .sidebar-status .sidebar-link__label {
    opacity: 0;
    width: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
}

.app-shell.is-collapsed .sidebar-group__toggle {
    display: none;
}

.app-shell.is-collapsed .brand-mark--image {
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    overflow: hidden;
}

.app-shell.is-collapsed .sidebar-group .sidebar-group__items {
    max-height: none;
    opacity: 1;
    padding-top: 0;
}

.app-shell.is-collapsed .sidebar-link,
.app-shell.is-collapsed .sidebar-branch-badge,
.app-shell.is-collapsed .sidebar-status,
.app-shell.is-collapsed .app-sidebar__brand-link,
.app-shell.is-collapsed .app-sidebar__brand {
    justify-content: center;
}

.app-shell.is-collapsed .sidebar-group {
    gap: 2px;
}

.app-shell.is-collapsed .sidebar-link {
    padding-inline: 0;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        width: min(88vw, 300px);
        transform: translateX(-110%);
    }

    .app-shell__content {
        margin-left: 0;
    }

    .app-shell.is-mobile-open .app-sidebar {
        transform: translateX(0);
    }

    .app-shell.is-mobile-open::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.28);
        z-index: 1025;
    }

    .topbar {
        top: 8px;
        margin: 8px 8px 0;
    }

    .topbar__title {
        font-size: 18px;
    }

    .app-content {
        padding-top: 6px;
    }

    .toast {
        min-width: min(92vw, 320px);
    }
}

@media (max-width: 575.98px) {
    .topbar-profile__meta {
        display: none !important;
    }

    .panel-card__header,
    .panel-card__body,
    .metric-card,
    .empty-state,
    .report-page {
        padding: 12px;
    }

    .page-header {
        align-items: flex-start;
    }

    .report-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1199px) {
    .filter-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }

    .filter-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 767px) {
    .filter-grid {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        justify-content: flex-start;
    }
}

@media print {
    .app-sidebar,
    .app-topbar,
    .sidebar,
    .topbar,
    .no-print,
    .filter-card,
    .report-actions,
    .btn,
    .dropdown,
    .action-column,
    .pagination,
    .toast-container,
    .app-footer,
    .report-summary-grid,
    .report-summary-card,
    .metric-card {
        display: none !important;
    }

    .print-only {
        display: block !important;
    }

    /* Receipt print overrides */
    .receipt-page {
        max-width: 100% !important;
        margin: 0 !important;
    }

    .receipt-container {
        max-width: 100% !important;
        border: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        font-size: 11px !important;
    }

    .receipt-separator {
        border-top: 1px dashed #000 !important;
    }

    .receipt-table th,
    .receipt-table td {
        border-color: #000 !important;
    }

    html,
    body {
        background: #ffffff !important;
        color: #233142 !important;
        font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body.theme-dark {
        --bg-color: #ffffff !important;
        --surface-color: #ffffff !important;
        --surface-soft: #ffffff !important;
        --text-color: #233142 !important;
        --heading-color: #002678 !important;
        --border-color: #d9dee7 !important;
    }

    .app-shell {
        display: block !important;
        min-height: auto !important;
    }

    .app-shell__content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .app-main,
    .app-content,
    .content-wrapper,
    .container,
    .container-fluid {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .report-page {
        width: 100% !important;
        background: #ffffff !important;
        padding: 16px !important;
        box-shadow: none !important;
        border: none !important;
    }

    .card,
    .table-card,
    .metric-card,
    .panel-card {
        box-shadow: none !important;
        border: none !important;
        background: #ffffff !important;
    }

    table {
        width: 100% !important;
        border-collapse: collapse !important;
        font-size: 11px !important;
    }

    table th,
    table td {
        border: 1px solid #000 !important;
        padding: 5px 7px !important;
    }

    table thead th {
        background: #e8e8e8 !important;
        font-weight: 600 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    table tfoot .totals-row td {
        background: #e8e8e8 !important;
        font-weight: 600 !important;
        border-top: 2px solid #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .text-end {
        text-align: right !important;
    }

    .report-summary-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 6px !important;
    }

    .report-summary-card {
        border: 1px solid #000 !important;
        padding: 6px 8px !important;
    }

    thead {
        display: table-header-group !important;
    }

    tfoot {
        display: table-footer-group !important;
    }
}

@keyframes dropdownEnter {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
