@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
@import url("./tokens.css");

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/*
 * A closed <dialog> must leave the page. Any later rule that sets
 * display on a dialog (centered modals use display:flex) would
 * override the user-agent display:none and keep a fixed layer
 * after close(), blocking clicks until a reload.
 */
dialog:not([open]) {
    display: none !important;
}

html {
    scroll-behavior: smooth;
    overflow-x: clip;
}

body {
    font-family: var(--font);
    background: var(--body-gradient);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    overflow-x: clip;
    transition:
        background 0.35s ease,
        color 0.25s ease;
}

a {
    color: inherit;
}

.container {
    width: min(1180px, 92%);
    margin: 0 auto;
}

/* Header / Navigation */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
    transition: background 0.35s ease, border-color 0.25s ease;
}

.header-grid {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem 1.25rem;
    min-height: var(--header-height);
    width: 100%;
    max-width: 100%;
    padding: 0 1.25rem;
    box-sizing: border-box;
}

.header-zone-left {
    justify-self: start;
    grid-column: 1;
    min-width: 0;
    z-index: 2;
}

.header-zone-center {
    justify-self: stretch;
    grid-column: 2;
    min-width: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

.header-zone-right {
    justify-self: end;
    grid-column: 3;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    min-width: 0;
    z-index: 2;
}

.site-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text);
    flex: 0 0 auto;
}

.site-brand-logo-shell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 10px;
    padding: 0.32rem 0.72rem;
    flex-shrink: 0;
}

.site-brand-logo {
    height: 2.35rem;
    width: auto;
    object-fit: contain;
}

.header-tools {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    flex: 0 0 auto;
    flex-wrap: nowrap;
}

.header-nav-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding-right: 0.35rem;
    margin-right: 0.15rem;
    border-right: 1px solid var(--border);
}

.header-nav-meta .nav-link {
    padding: 0.42rem 0.65rem;
    font-size: 0.84rem;
}

.header-account {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-left: 0.15rem;
    padding-left: 0.45rem;
    border-left: 1px solid var(--border);
}

.header-account-mobile {
    display: none;
}

.main-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
}

.main-nav-links {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    flex-wrap: nowrap;
}

.main-nav-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: nowrap;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.48rem 0.72rem;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
    background: var(--bg-soft);
    color: var(--text);
}

.nav-link.active {
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.nav-dropdown {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: stretch;
    flex-shrink: 0;
}

.nav-dropdown > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.nav-dropdown > summary::-webkit-details-marker {
    display: none;
}

.nav-dropdown-toggle::after {
    content: "";
    display: inline-block;
    width: 0.35rem;
    height: 0.35rem;
    margin-left: 0.35rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-0.1rem) rotate(45deg);
    opacity: 0.75;
    vertical-align: middle;
}

.nav-dropdown[open] > .nav-dropdown-toggle::after {
    transform: translateY(0.05rem) rotate(225deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    z-index: 40;
    min-width: 11.5rem;
    padding: 0.35rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
    display: grid;
    gap: 0.15rem;
}

.nav-dropdown-menu-end {
    left: auto;
    right: 0;
}

.nav-dropdown-item {
    display: block;
    padding: 0.55rem 0.7rem;
    border-radius: calc(var(--radius-sm) - 2px);
    color: var(--text);
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 600;
    white-space: nowrap;
}

.nav-dropdown-item:hover,
.nav-dropdown-item:focus-visible {
    background: var(--bg-soft);
    outline: none;
}

.nav-dropdown-item.active {
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.nav-account-dropdown {
    align-items: flex-end;
}

.nav-account-toggle {
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
}

.nav-account-toggle:hover,
.nav-account-dropdown[open] > .nav-account-toggle {
    background: var(--bg-soft);
}

.nav-account-toggle::after {
    content: "";
    display: inline-block;
    width: 0.35rem;
    height: 0.35rem;
    margin-left: 0.45rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-0.85rem) rotate(45deg);
    opacity: 0.7;
    position: absolute;
    right: 0.55rem;
    top: 50%;
}

.nav-account-dropdown {
    position: relative;
}

.nav-account-toggle {
    position: relative;
    padding-right: 1.35rem;
}

.nav-account-dropdown[open] > .nav-account-toggle::after {
    transform: translateY(-0.7rem) rotate(225deg);
}

.nav-toggle {
    display: none;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.75rem;
    font: inherit;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    flex: 0 0 auto;
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* App shell + sidebar */
.app-shell {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - var(--header-height) - 5rem);
}

.app-sidebar {
    width: 17.5rem;
    flex-shrink: 0;
    padding: 1.25rem 1rem 2rem;
    border-right: 1px solid var(--border);
    background: var(--bg-soft);
    position: sticky;
    top: var(--header-height);
    align-self: flex-start;
    max-height: calc(100vh - var(--header-height));
    overflow-y: auto;
}

.app-sidebar:not(:has(> *)) {
    display: none;
}

.app-main {
    flex: 1;
    min-width: 0;
    padding: 1.25rem 0 1.5rem;
}

.app-main-inner {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 0 0.85rem;
}

.sidebar-panel {
    display: grid;
    gap: 1rem;
}

.sidebar-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text);
}

.sidebar-field {
    display: grid;
    gap: 0.35rem;
    margin: 0;
}

.sidebar-field > span {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
}

.sidebar-search-form {
    display: grid;
    gap: 0.65rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-filter-form {
    display: grid;
    gap: 0.85rem;
}

.sidebar-filter-form .filter-grid,
.sidebar-filter-form .report-toolbar-fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.sidebar-filter-form .report-field {
    min-width: 0;
    width: 100%;
}

.sidebar-filter-form .report-field select,
.sidebar-filter-form .report-field input {
    width: 100%;
    box-sizing: border-box;
}

.sidebar-filter-actions {
    display: grid;
    gap: 0.55rem;
}

.sidebar-filter-actions .btn-block,
.btn-block {
    width: 100%;
    justify-content: center;
}

.sidebar-count {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
}

.readiness-panel {
    margin-bottom: 1.25rem;
}

.readiness-checklist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.55rem;
}

.readiness-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 600;
    font-size: 0.92rem;
}

.readiness-item-complete {
    color: var(--success-ink);
}

.readiness-item-pending {
    color: var(--danger-ink);
}

.readiness-mark {
    display: inline-flex;
    width: 1.15rem;
    justify-content: center;
    font-weight: 800;
}

.readiness-help {
    margin: 0.85rem 0 0;
}

.sidebar-export-actions {
    display: grid;
    gap: 0.45rem;
    padding-top: 0.35rem;
    border-top: 1px solid var(--border);
}

.main-content {
    padding-bottom: 0;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 1.25rem;
    text-align: center;
}

.auth-brand-logo {
    width: min(220px, 70vw);
    height: auto;
    max-height: 96px;
    object-fit: contain;
}

.auth-brand-slogan {
    margin: 0;
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 500;
}

.footer-brand {
    display: grid;
    gap: 0.2rem;
}

.footer-slogan {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.language-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.12rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-soft);
    flex: 0 0 auto;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    height: 2.15rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--theme-toggle-bg);
    color: var(--theme-toggle-icon);
    cursor: pointer;
    flex: 0 0 auto;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    background: var(--theme-toggle-hover);
    border-color: rgba(167, 139, 250, 0.45);
    outline: none;
    transform: translateY(-1px);
}

.theme-toggle svg {
    width: 1.05rem;
    height: 1.05rem;
    display: block;
}

.theme-toggle .icon-sun {
    display: none;
}

[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

.lang-link {
    padding: 0.32rem 0.55rem;
    border-radius: 999px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.lang-link:hover {
    color: var(--text);
}

.lang-link.active {
    background: var(--surface);
    color: var(--accent);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

/* Page header */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.35rem;
}

.page-header h2 {
    font-size: clamp(1.55rem, 2.4vw, 1.9rem);
    letter-spacing: -0.03em;
    margin-bottom: 0.25rem;
}

.page-header p {
    color: var(--text-muted);
    max-width: 42rem;
}

.page-actions {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.58rem 1rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-primary {
    background: var(--btn-primary-bg, var(--color-brand));
    border-color: var(--btn-primary-border, var(--color-brand));
    color: var(--btn-primary-text, #ffffff);
}

.btn-primary:hover {
    background: var(--btn-primary-bg-hover, var(--color-brand-hover));
    border-color: var(--btn-primary-bg-hover, var(--color-brand-hover));
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--btn-secondary-bg-hover);
    border-color: var(--border-strong);
}

.btn-edit {
    background: var(--edit-soft);
    color: var(--accent-ink);
    border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
}

.btn-edit:hover {
    background: color-mix(in srgb, var(--accent) 18%, var(--surface));
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-danger:focus-visible {
    box-shadow: 0 0 0 3px var(--danger-soft);
}

.btn-small {
    padding: 0.35rem 0.7rem;
    font-size: 0.82rem;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--bg-soft);
    color: var(--text);
}

.disabled-hint {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.settings-logo-preview {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.settings-logo-image {
    max-height: 4rem;
    width: auto;
    max-width: 12rem;
    object-fit: contain;
}

.status-draft {
    background: var(--warning-soft);
    color: var(--warning-ink);
}

.status-pending {
    background: var(--edit-soft);
    color: var(--edit);
}

.status-approved {
    background: var(--success-soft);
    color: var(--success-ink);
}

.status-rejected {
    background: var(--danger-soft);
    color: var(--danger-ink);
}


.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 0.68rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.95rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Unified select: never use background shorthand (resets repeat → tiled arrows). */
select.form-input,
.sidebar-filter-form select,
.sidebar-filter-form select.form-input,
.report-field select,
.report-field select.form-input,
.form-group select,
.agent-form select,
select.ui-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: var(--surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.5 1.75L6 6.25L10.5 1.75' stroke='%235b6b7c' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 0.75rem 0.5rem;
    padding-right: 2.35rem;
    cursor: pointer;
    color: var(--text);
}

select.form-input::-ms-expand,
.sidebar-filter-form select::-ms-expand,
.report-field select::-ms-expand,
.form-group select::-ms-expand,
.agent-form select::-ms-expand,
select.ui-select::-ms-expand {
    display: none;
}

[data-theme="dark"] select.form-input,
[data-theme="dark"] .sidebar-filter-form select,
[data-theme="dark"] .sidebar-filter-form select.form-input,
[data-theme="dark"] .report-field select,
[data-theme="dark"] .report-field select.form-input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .agent-form select,
[data-theme="dark"] select.ui-select {
    background-color: var(--surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.5 1.75L6 6.25L10.5 1.75' stroke='%2393a0b8' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 0.75rem 0.5rem;
    color: var(--text);
    color-scheme: dark;
}

[data-theme="dark"] select.form-input option,
[data-theme="dark"] .sidebar-filter-form select option,
[data-theme="dark"] .report-field select option,
[data-theme="dark"] .form-group select option,
[data-theme="dark"] .agent-form select option,
[data-theme="dark"] select option {
    background-color: #151f33;
    color: #e8eefc;
}

[data-theme="dark"] select.form-input option:checked,
[data-theme="dark"] .report-field select option:checked,
[data-theme="dark"] select option:checked,
[data-theme="dark"] select.form-input option:hover,
[data-theme="dark"] .report-field select option:hover,
[data-theme="dark"] select option:hover {
    background-color: #1e3a5f;
    color: #ffffff;
}

[hidden] {
    display: none !important;
}

.form-input:hover {
    border-color: #c0cbd8;
}

.input-with-affix {
    position: relative;
}

.input-with-affix .form-input {
    padding-left: 2.35rem;
}

.input-affix {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.3rem;
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 800;
    pointer-events: none;
    z-index: 1;
}

.stat-icon {
    display: inline-flex;
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    margin-bottom: 0.45rem;
    position: relative;
}

.stat-icon::before {
    content: "";
    position: absolute;
    inset: 0.35rem;
    background: currentColor;
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
}

.stat-icon-check::before {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M20 7 10 17l-5-5' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M20 7 10 17l-5-5' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.stat-icon-money::before {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M12 3v18M17 8c0-1.7-2.2-3-5-3s-5 1.3-5 3 2.2 3 5 3 5 1.3 5 3-2.2 3-5 3-5-1.3-5-3' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M12 3v18M17 8c0-1.7-2.2-3-5-3s-5 1.3-5 3 2.2 3 5 3 5 1.3 5 3-2.2 3-5 3-5-1.3-5-3' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.stat-icon-chart::before {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M5 19V10M12 19V5M19 19v-7' stroke='black' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M5 19V10M12 19V5M19 19v-7' stroke='black' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

.stat-icon-home::before {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M4 11 12 4l8 7v9H4v-9Z' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M4 11 12 4l8 7v9H4v-9Z' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.form-input:focus {
    outline: none;
    border-color: var(--input-border-focus, var(--color-brand));
    box-shadow: var(--shadow-focus, 0 0 0 3px var(--input-focus-ring));
}

.password-field {
    position: relative;
}

.password-field .password-input {
    padding-right: 2.75rem;
}

.password-toggle {
    position: absolute;
    right: 0.55rem;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-soft);
}

.password-toggle-hide {
    display: none;
}

.password-toggle.is-visible .password-toggle-show {
    display: none;
}

.password-toggle.is-visible .password-toggle-hide {
    display: inline-flex;
}

.search-form,
.agent-form,
.delete-form,
.form-actions {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
    align-items: center;
}

.agent-form {
    flex-direction: column;
    align-items: stretch;
}

.form-actions {
    margin-top: 0.35rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.92rem;
}

.field-help {
    display: block;
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.field-help[hidden],
#reports-charts-fallback[hidden] {
    display: none !important;
}

.filter-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.95rem;
}

.global-search-form {
    max-width: 760px;
}

/* Flash messages */
.flash-messages {
    margin-bottom: 1rem;
    display: grid;
    gap: 0.55rem;
}

.flash-message {
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-weight: 500;
}

.flash-success {
    background: var(--success-soft);
    color: var(--success-ink);
    border-color: var(--flash-success-border);
}

.flash-error {
    background: var(--flash-error-bg);
    color: var(--flash-error-text);
    border-color: var(--flash-error-border);
}

.flash-warning {
    background: var(--warning-soft);
    color: var(--warning-ink);
    border-color: var(--flash-warning-border);
}

/* Panels / cards */
.panel {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 1.2rem 1.25rem;
    margin-bottom: 1.2rem;
    box-shadow: var(--shadow);
    transition:
        background 0.35s ease,
        border-color 0.25s ease,
        box-shadow 0.35s ease;
}

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

.panel-header h3 {
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}

.panel-danger {
    border-color: var(--panel-danger-border);
    background: var(--panel-danger-bg);
}

.danger-text {
    margin-bottom: 1rem;
    color: var(--danger-ink);
}

.vat-doc-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.95rem 0;
    border-bottom: 1px solid var(--border-soft);
}

.vat-doc-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.vat-doc-meta {
    min-width: 220px;
    flex: 1 1 240px;
}

.vat-doc-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
}

.vat-doc-upload-form {
    margin: 0;
}

.vat-doc-file-input {
    display: none;
}

.vat-doc-file-label {
    cursor: pointer;
    margin: 0;
}

.op-summary-brand {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.op-summary-brand-copy p {
    margin: 0.25rem 0 0;
}

.op-summary-brand-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.docs-category {
    margin-top: 1rem;
    padding-top: 0.35rem;
}

.docs-category-title {
    margin: 0 0 0.35rem;
    color: var(--navy, #001838);
    font-size: 1rem;
}

.docs-multi-item {
    margin-top: 0.55rem;
    padding-top: 0.45rem;
    border-top: 1px dashed var(--border-soft, #d7dee8);
}

.docs-multi-item:first-of-type {
    border-top: none;
    padding-top: 0;
}


.choice-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.45rem;
    font-weight: 500;
}

.choice-row input[type="radio"] {
    margin: 0;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.95rem;
    margin-bottom: 1.2rem;
}

.stats-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 1rem 1.05rem;
    box-shadow: var(--shadow);
    min-height: 96px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-card-accent {
    border-color: var(--stat-accent-border);
    background: var(--stat-accent-bg);
}

.stat-label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.45rem;
}

.stat-value {
    font-size: 1.35rem;
    color: var(--text);
    font-weight: 700;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.money {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
}

.money-emphasis {
    color: var(--accent-ink);
}

/* Badges */
.badge,
.type-tag,
.badge-soft {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.62rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
    border: 1px solid transparent;
}

.badge {
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.type-tag,
.badge-soft {
    background: var(--bg-soft);
    color: var(--text-muted);
    border-color: var(--border);
}

.badge-alto,
.badge-puro {
    background: #dbeafe;
    color: #1e40af;
    border-color: #bfdbfe;
}

.badge-junior,
.badge-rapp {
    background: #ede9fe;
    color: #5b21b6;
    border-color: #ddd6fe;
}

.badge-caba {
    background: #ecfeff;
    color: #0e7490;
    border-color: #a5f3fc;
}

.badge-pba {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

.badge-yes {
    background: var(--success-soft);
    color: var(--success-ink);
    border-color: #a7f3d0;
}

.badge-no {
    background: var(--bg-soft);
    color: var(--text-muted);
    border-color: var(--border);
}

/* Tables */
.table-wrapper,
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    max-width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table.table-dense {
    min-width: 36rem;
}

table.table-fit {
    min-width: 0;
    width: 100%;
}

@media (min-width: 1025px) {
    .table-wrapper.table-scroll-auto {
        overflow-x: visible;
    }

    .table-wrapper.table-scroll-auto table.table-dense {
        min-width: 0;
    }
}

thead {
    background: var(--table-head-bg);
    color: var(--table-head-text);
}

th,
td {
    padding: 0.8rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}

th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}

tbody tr:nth-child(even) {
    background: var(--table-row-even);
}

tbody tr:hover {
    background: var(--table-row-hover);
}

td.actions,
.table-actions {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    vertical-align: middle;
}

td.col-actions {
    width: 1%;
    white-space: nowrap;
}

.col-actions {
    position: sticky;
    right: 0;
    background: var(--surface);
    z-index: 1;
    box-shadow: -6px 0 10px -8px rgba(15, 23, 42, 0.25);
}

thead .col-actions {
    background: var(--table-head-bg);
}

.filters-toolbar {
    display: none;
    align-items: center;
    gap: 0.65rem;
    margin: 0 0 0.85rem;
    flex-wrap: wrap;
}

.filters-active-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-ink);
    font-size: 0.8rem;
    font-weight: 600;
}

.main-nav-tools-mobile {
    display: none;
}

.sticky-actions-bar {
    position: sticky;
    bottom: 0.75rem;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    justify-content: flex-end;
    padding: 0.65rem;
    margin-top: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    opacity: 1;
    box-shadow: var(--shadow);
}

@supports (backdrop-filter: blur(8px)) {
    .sticky-actions-bar {
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(8px);
    }

    [data-theme="dark"] .sticky-actions-bar {
        background: rgba(30, 41, 66, 0.92);
    }
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 1.8rem 1rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
}

.empty-state-title {
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.empty-message,
.empty-state-text {
    color: var(--text-muted);
}

.empty-message a,
.empty-state a {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

.empty-message a:hover,
.empty-state a:hover {
    text-decoration: underline;
}

/* Summary / detail */
.summary-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.85rem;
}

.summary-item {
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
}

.summary-item.highlight {
    background: var(--accent-soft);
    border-color: var(--stat-accent-border);
}

[data-theme="dark"] .badge-alto,
[data-theme="dark"] .badge-puro {
    background: rgba(129, 140, 248, 0.18);
    color: #c7d2fe;
    border-color: rgba(129, 140, 248, 0.35);
}

[data-theme="dark"] .badge-junior,
[data-theme="dark"] .badge-rapp {
    background: rgba(167, 139, 250, 0.18);
    color: #ddd6fe;
    border-color: rgba(167, 139, 250, 0.35);
}

[data-theme="dark"] .badge-caba {
    background: rgba(34, 211, 238, 0.14);
    color: #67e8f9;
    border-color: rgba(34, 211, 238, 0.32);
}

[data-theme="dark"] .badge-pba {
    background: rgba(251, 191, 36, 0.14);
    color: #fcd34d;
    border-color: rgba(251, 191, 36, 0.32);
}

[data-theme="dark"] .btn-secondary {
    background: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .form-input:not(select),
[data-theme="dark"] .nav-search-input {
    background-color: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

[data-theme="dark"] .form-input:hover,
[data-theme="dark"] select.form-input:hover,
[data-theme="dark"] .report-field select:hover {
    border-color: #4b5f82;
}

[data-theme="dark"] .form-input option,
[data-theme="dark"] select.form-input option {
    background-color: #151f33;
    color: #e8eefc;
}

[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .nav-search-input:focus,
[data-theme="dark"] select.form-input:focus {
    border-color: rgba(59, 130, 246, 0.55);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.listing-conflict-actions {
    margin-top: 0.65rem;
}

.summary-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.3rem;
}

.summary-divider {
    border: none;
    border-top: 1px solid var(--border-soft);
}

/* Dashboard layout helpers */
.dashboard-actions .btn-primary:not(:first-child) {
    background: var(--surface);
    color: var(--accent-ink);
    border-color: var(--border);
}

.dashboard-actions .btn-primary:not(:first-child):hover {
    background: var(--accent-soft);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 1.2rem;
}

.dashboard-grid > .panel {
    margin-bottom: 0;
}

/* Session / auth */
.nav-user {
    display: inline-flex;
    flex-direction: column;
    line-height: 1.15;
    padding: 0.2rem 0.6rem;
    border-left: none;
    margin-left: 0;
}

.nav-user-name {
    font-size: 0.88rem;
    font-weight: 700;
}

.nav-user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.nav-user-agent {
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 600;
}

.guest-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex: 1 1 auto;
}

.auth-layout {
    display: flex;
    justify-content: center;
    padding: 2rem 0;
}

.auth-card {
    width: min(420px, 100%);
    margin-bottom: 0;
}

body.is-auth-page .site-brand {
    display: none;
}

body.is-auth-page .site-header {
    min-height: 3.25rem;
    border-bottom: 1px solid var(--border-soft);
}

body.is-auth-page .header-grid {
    justify-content: flex-end;
}

body.is-auth-page .app-main-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
}

body.is-auth-page .flash-messages {
    width: min(420px, 100%);
    margin-bottom: 0.75rem;
}

body.is-auth-page .flash-message {
    padding: 0.65rem 0.85rem;
    border-radius: 0.65rem;
    font-size: 0.9rem;
    text-align: center;
}

body.is-auth-page .site-footer {
    opacity: 0.55;
    padding: 0.45rem 0 0.65rem;
}

.auth-links {
    margin-top: 1.25rem;
    display: grid;
    gap: 0.75rem;
}

.auth-register-prompt {
    margin: 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.auth-register-prompt a {
    color: var(--accent-ink);
    font-weight: 600;
    text-decoration: none;
}

.auth-register-prompt a:hover {
    text-decoration: underline;
}

.color-picker-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.color-picker-row .form-input {
    flex: 1 1 auto;
}

.color-picker-swatch {
    width: 2.55rem;
    height: 2.55rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    flex: 0 0 auto;
}

.color-picker-swatch::-webkit-color-swatch-wrapper {
    padding: 0.2rem;
}

.color-picker-swatch::-webkit-color-swatch {
    border: none;
    border-radius: 0.35rem;
}

.pagination-per-page {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.pagination-per-page label {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
}

.pagination-per-page select {
    width: auto;
    min-width: 5.5rem;
    min-height: 2.25rem;
    padding: 0.35rem 2rem 0.35rem 0.65rem;
}

.vat-calc-form {
    width: min(560px, 100%);
    margin-inline: auto;
}

.vat-calc-form .panel {
    margin-bottom: 1rem;
}

.auth-header {
    margin-bottom: 1.25rem;
}

.auth-links {
    margin-top: 1.25rem;
    display: grid;
    gap: 0.75rem;
}

.code-inputs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 1rem 0 1.25rem;
}

.code-digit {
    width: 2.6rem;
    height: 2.8rem;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    padding: 0;
}

.verify-success-title {
    color: var(--success-ink);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.badge-pending {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--warning-soft);
    color: var(--warning-ink);
    font-size: 0.75rem;
    font-weight: 700;
}

.access-detail {
    display: grid;
    gap: 0.35rem 1.5rem;
    grid-template-columns: max-content 1fr;
    margin: 0;
}

.access-detail dt {
    color: var(--text-muted);
}

.access-detail dd {
    margin: 0;
}

.access-actions {
    display: grid;
    gap: 1.5rem;
}

.secret-once {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--success-soft);
    color: var(--success-ink);
    word-break: break-all;
}

.approval-list {
    display: grid;
    gap: 0.85rem;
}

.approval-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.05rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
}

.approval-item-unread {
    border-color: rgba(167, 139, 250, 0.35);
    background: var(--accent-soft);
}

.approval-item-main h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.approval-item-agent {
    font-weight: 600;
    color: var(--text);
}

.approval-item-summary {
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.nav-bell-link {
    position: relative;
    font-size: 1.05rem;
    line-height: 1;
    padding-inline: 0.55rem;
}

.nav-bell-link .badge-pending {
    position: absolute;
    top: -0.35rem;
    right: -0.2rem;
}

.nav-notifications-link {
    position: relative;
    font-size: 1.05rem;
    line-height: 1;
    padding-inline: 0.55rem;
}

.nav-notifications-link .badge-pending {
    position: absolute;
    top: -0.35rem;
    right: -0.2rem;
}

.nav-notifications-link--mobile-header {
    display: none;
}

.diff-row td:last-child {
    color: var(--accent-ink);
    font-weight: 600;
}

.auth-header h2 {
    font-size: 1.5rem;
    letter-spacing: -0.03em;
    margin-bottom: 0.25rem;
}

.auth-header p {
    color: var(--text-muted);
}

/* Footer */
.site-footer {
    margin-top: auto;
    padding: 0.45rem 0 0.55rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-soft);
    background: transparent;
    font-size: 0.72rem;
    line-height: 1.3;
    opacity: 0.72;
    transition: background 0.35s ease, opacity 0.2s ease;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 0 0.85rem;
}

.footer-brand p {
    margin: 0;
}

.footer-slogan {
    opacity: 0.75;
    font-weight: 500;
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.78rem;
}

.footer-link:hover {
    color: var(--accent-ink);
    text-decoration: underline;
}

.footer-legal {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
}

.dashboard-welcome {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem 0 2rem;
    flex-wrap: wrap;
}

.dashboard-welcome-brand {
    flex-shrink: 0;
}

.dashboard-welcome-logo-shell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-navy);
    border-radius: 12px;
    padding: 0.55rem 1rem;
}

.dashboard-welcome-logo {
    height: 3rem;
    width: auto;
    object-fit: contain;
    display: block;
}

.dashboard-welcome-text {
    min-width: min(100%, 18rem);
}

.dashboard-welcome-text h1 {
    margin: 0;
    font-size: clamp(1.35rem, 3vw, 1.9rem);
    letter-spacing: -0.02em;
}

.dashboard-welcome-app {
    margin: 0.3rem 0 0;
    font-size: 1.05rem;
    color: var(--text-muted);
    font-weight: 600;
}

.dashboard-welcome-org {
    margin: 0.35rem 0 0;
    font-size: 0.92rem;
    color: var(--text-muted);
    font-weight: 600;
}

.dashboard-welcome-only {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: min(52vh, 28rem);
    padding: 2.5rem 0 3rem;
}

.dashboard-welcome-only .dashboard-welcome-text {
    min-width: 0;
}

.property-listing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.inline-delete-form {
    display: inline;
    margin: 0;
}

.property-detail-grid {
    margin: 0;
}

.property-listings-table td {
    vertical-align: middle;
}

.dashboard-home-actions {
    max-width: 52rem;
}
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.dashboard-quick-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: 0.65rem;
    text-decoration: none;
    font-weight: 700;
    border: 1px solid var(--border);
}

a.dashboard-quick-card.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

a.dashboard-quick-card.btn-secondary {
    background: var(--surface);
    color: var(--text);
}

a.dashboard-quick-card.btn-ghost {
    background: transparent;
    color: var(--accent);
}

a.dashboard-quick-card:hover {
    border-color: var(--accent);
}

.report-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 1rem;
}

.report-tab {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 0.95rem;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.report-tab:hover {
    color: var(--accent-ink);
    border-color: var(--accent);
    background: var(--accent-soft);
}

.report-tab.active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}

.report-toolbar {
    margin: 0 0 1.25rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border-soft);
    border-radius: 1rem;
    background:
        linear-gradient(180deg, var(--accent-soft), transparent 52%),
        var(--surface);
    box-shadow: var(--shadow);
}

.report-toolbar-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem 1rem;
    align-items: end;
    justify-content: space-between;
}

.report-toolbar-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
    flex: 1 1 280px;
}

.report-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 140px;
    margin: 0;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
}

.report-field span {
    padding-left: 0.15rem;
}

.report-field select,
.report-field input {
    min-height: 2.55rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    background-color: var(--bg-soft);
    color: var(--text);
    padding: 0.55rem 0.8rem;
    font: inherit;
    font-weight: 600;
}

.report-field select {
    /* Keep unified chevron; only tint the fill. */
    background-color: var(--bg-soft);
    padding-right: 2.35rem;
}

.report-field input[type="month"],
.report-field input[type="date"],
.report-field input[type="text"],
.report-field input.form-input {
    background-color: var(--bg-soft);
}

.report-field select:focus,
.report-field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.report-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.report-download-btn {
    min-width: 4.5rem;
    justify-content: center;
}

.report-active-filters,
.report-official-note {
    margin: 0.75rem 0 0;
    color: var(--text-muted);
}

.report-filters {
    margin-bottom: 0.75rem;
}

.report-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.report-chart-card {
    padding: 0.75rem;
    border: 1px solid var(--border-soft);
    border-radius: 0.65rem;
    background: var(--surface);
}

.report-chart-card h4 {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    color: var(--text);
}

.report-chart-card canvas {
    width: 100% !important;
    max-height: 220px;
}

.report-chart-card--status {
    display: grid;
    gap: 0.75rem;
    align-content: start;
}

.report-chart-card--status canvas {
    max-height: 180px;
    max-width: 220px;
    margin-inline: auto;
}

.chart-status-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.35rem;
}

.chart-status-legend li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.86rem;
    color: var(--text-muted);
}

.chart-status-legend .legend-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text);
    font-weight: 600;
}

.chart-status-legend .legend-swatch {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
    flex-shrink: 0;
}

.chart-status-legend .legend-value {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

[data-theme="dark"] .report-field select,
[data-theme="dark"] .report-field input {
    background-color: var(--surface);
    color: var(--text);
    border-color: var(--border);
    color-scheme: dark;
}

[data-theme="dark"] .report-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.5 1.75L6 6.25L10.5 1.75' stroke='%2393a0b8' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 0.75rem 0.5rem;
}

[data-theme="dark"] .report-field select option {
    background-color: #151f33;
    color: #e8eefc;
}

[data-theme="dark"] .report-field select:focus,
[data-theme="dark"] .report-field input:focus {
    border-color: rgba(59, 130, 246, 0.55);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

[data-theme="dark"] a.dashboard-quick-card.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
}

/* Responsive */
@media (max-width: 1200px) and (min-width: 769px) {
    .main-nav-links .nav-link {
        padding: 0.45rem 0.58rem;
        font-size: 0.84rem;
    }

    .header-nav-meta .nav-link {
        padding: 0.4rem 0.55rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .report-charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-grid {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        gap: 0.55rem 0.65rem;
        padding: 0.6rem 0.75rem;
        align-items: center;
    }

    .header-zone-left {
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
    }

    .header-zone-right {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        gap: 0.35rem;
    }

    .header-zone-center {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: stretch;
        display: none;
        min-width: 0;
    }

    .header-zone-center.is-open {
        display: flex;
    }

    .nav-toggle {
        display: inline-flex;
        min-height: 2.5rem;
        min-width: 2.75rem;
    }

    .header-tools-desktop {
        display: none;
    }

    .nav-notifications-link--mobile-header {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: relative;
        min-width: 2.5rem;
        min-height: 2.5rem;
        padding-inline: 0.4rem;
        font-size: 1.15rem;
    }

    .header-account {
        display: none;
    }

    .main-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
        flex-wrap: nowrap;
        width: 100%;
        max-width: 100%;
        padding: 0.15rem 0 0.35rem;
    }

    .main-nav-links,
    .main-nav-meta,
    .main-nav-tools-mobile {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        border-left: none;
        padding-left: 0;
        margin-left: 0;
        flex-wrap: nowrap;
        gap: 0.2rem;
    }

    .main-nav-tools-mobile {
        padding-top: 0.35rem;
        border-top: 1px solid var(--border);
    }

    .main-nav-tools-mobile .header-nav-meta {
        border-right: none;
        margin-right: 0;
        padding-right: 0;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .main-nav-tools-mobile .language-switcher,
    .main-nav-tools-mobile .theme-toggle {
        align-self: stretch;
        justify-content: center;
        min-height: 2.05rem;
    }

    .header-account-mobile {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.45rem;
        padding-top: 0.35rem;
        border-top: 1px solid var(--border);
        margin: 0;
        border-left: none;
        padding-left: 0;
    }

    .header-account-mobile .nav-user {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    .header-account-mobile .nav-dropdown,
    .header-account-mobile .nav-account-dropdown,
    .main-nav-links .nav-dropdown,
    .main-nav-meta .nav-dropdown,
    .main-nav-tools-mobile .nav-dropdown {
        align-items: stretch;
        width: 100%;
    }

    .header-account-mobile .nav-dropdown-menu,
    .main-nav-links .nav-dropdown-menu,
    .main-nav-meta .nav-dropdown-menu,
    .main-nav-tools-mobile .nav-dropdown-menu {
        position: static;
        min-width: 0;
        width: 100%;
        margin-top: 0.25rem;
        box-shadow: none;
    }

    .nav-link {
        border-radius: var(--radius-sm);
        padding: 0.45rem 0.65rem;
        background: var(--bg-soft);
        white-space: normal;
        flex-shrink: 1;
    }

    .nav-link.active {
        background: var(--accent-soft);
    }

    .filters-toolbar {
        display: flex;
    }

    .filters-toggle {
        min-height: 2.5rem;
        width: auto;
    }

    .app-shell {
        flex-direction: column;
    }

    .app-sidebar {
        display: none;
        width: 100%;
        max-height: none;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 0.85rem 0.85rem 1.1rem;
        order: -1;
    }

    .app-shell.filters-open .app-sidebar {
        display: block;
    }

    .app-sidebar:not(:has(> *)) {
        display: none;
    }

    .app-main {
        padding-top: 1rem;
        min-width: 0;
    }

    .app-main-inner {
        width: min(100% - 1rem, 100%);
        padding: 0 0.5rem;
        max-width: 100%;
        overflow-x: clip;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-actions,
    .form-actions,
    .search-form {
        width: 100%;
    }

    .page-actions .btn,
    .form-actions .btn,
    .search-form .btn {
        min-height: 2.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-group input,
    .form-group select,
    .form-group textarea,
    .form-input,
    .report-field select,
    .report-field input {
        width: 100%;
        max-width: 100%;
        min-height: 2.5rem;
        box-sizing: border-box;
    }

    .col-secondary {
        display: none;
    }

    table.table-dense {
        min-width: 28rem;
    }

    .table-wrapper table:not(.table-dense) {
        min-width: 0;
    }

    .sticky-actions-bar {
        position: sticky;
        bottom: 0.5rem;
        justify-content: stretch;
    }

    .sticky-actions-bar .btn,
    .sticky-actions-bar form {
        flex: 1 1 auto;
    }

    .sticky-actions-bar form .btn {
        width: 100%;
    }

    .panel {
        max-width: 100%;
        overflow-x: clip;
    }

    .stat-card {
        min-width: 0;
    }
}

@media (max-width: 480px) {
    .container {
        width: min(100% - 1rem, 100%);
    }

    .site-brand-logo-shell {
        padding: 0.28rem 0.55rem;
    }

    .site-brand-logo {
        height: 1.85rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-actions .btn,
    .form-actions .btn,
    .search-form .btn,
    .search-form .form-input {
        width: 100%;
    }

    .panel {
        padding: 0.85rem;
    }

    table.table-dense {
        min-width: 24rem;
    }

    th,
    td {
        padding: 0.65rem 0.55rem;
    }

    .btn {
        min-height: 2.5rem;
    }

    .btn-small {
        min-height: 2.25rem;
        padding: 0.45rem 0.65rem;
    }
}


/* ===== UI/UX sprint additions ===== */
:root {
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --control-height: 2.75rem;
}

.panel + .panel,
.panel-spaced {
    margin-top: var(--space-5);
}

.dashboard-welcome {
    padding: var(--space-4) 0 var(--space-5);
    gap: var(--space-3);
    align-items: center;
}

.dashboard-welcome-logo-shell {
    padding: 0.35rem 0.65rem;
    border-radius: 10px;
}

.dashboard-welcome-logo {
    height: 2rem;
}

.dashboard-welcome-text h1 {
    font-size: clamp(1.15rem, 2.6vw, 1.45rem);
}

.dashboard-welcome-org {
    margin-top: 0.2rem;
    font-size: 0.88rem;
}

.results-meta {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.entity-external-id {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.entity-card-list {
    display: grid;
    gap: var(--space-3);
}

.entity-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow);
    display: grid;
    gap: 0.55rem;
}

.entity-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.entity-card-title {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.3;
}

.entity-card-subtitle,
.entity-card-meta {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.entity-card-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    margin: 0;
}

.entity-card-metrics dt {
    margin: 0;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 700;
}

.entity-card-metrics dd {
    margin: 0.2rem 0 0;
    font-size: 0.98rem;
}

.entity-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.cell-stack {
    display: grid;
    gap: 0.15rem;
}

.money {
    white-space: nowrap;
}

.form-input,
.form-group input,
.form-group select,
.form-group textarea,
.report-field select,
.report-field input {
    min-height: var(--control-height);
}

.form-input:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--input-border-focus, var(--color-brand));
    box-shadow: var(--shadow-focus, 0 0 0 3px var(--input-focus-ring));
}

.btn-back {
    font-weight: 600;
}

.btn-inline {
    width: auto;
    align-self: flex-end;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-soft);
}

.pagination-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    width: 100%;
    justify-content: space-between;
}

.pagination-summary {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.86rem;
    font-weight: 600;
}

.pagination-controls {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.pagination-btn,
.pagination-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.15rem;
    min-height: 2.15rem;
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 700;
}

.pagination-btn:hover,
.pagination-page:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.pagination-page.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.pagination-btn.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.pagination-ellipsis {
    min-width: 1.25rem;
    text-align: center;
    color: var(--text-muted);
    font-weight: 700;
}

.panel-header .results-meta-page-size {
    margin-left: auto;
}

.autocomplete-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.autocomplete-field {
    position: relative;
    flex: 1 1 16rem;
    margin-bottom: 0;
}

.autocomplete-list {
    position: absolute;
    z-index: 30;
    left: 0;
    right: 0;
    top: calc(100% + 0.25rem);
    margin: 0;
    padding: 0.35rem;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    max-height: 16rem;
    overflow-y: auto;
}

.autocomplete-option,
.autocomplete-empty {
    padding: 0.7rem 0.75rem;
    border-radius: calc(var(--radius-sm) - 2px);
    font-weight: 600;
}

.autocomplete-option {
    cursor: pointer;
}

.autocomplete-option:hover,
.autocomplete-option.is-active {
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.autocomplete-empty {
    color: var(--text-muted);
    font-weight: 500;
}

.segmented-field {
    border: 0;
    margin: 0 0 0.85rem;
    padding: 0;
    min-width: 0;
}

.segmented-field legend {
    margin-bottom: 0.45rem;
    font-weight: 700;
    font-size: 0.9rem;
}

.segmented-control {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
}

.segmented-option {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    color: var(--text);
    font-weight: 650;
    font-size: 0.88rem;
    text-align: center;
    cursor: pointer;
    user-select: none;
}

.segmented-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented-option:has(input:checked),
.segmented-option.is-selected {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-ink);
    box-shadow: 0 0 0 1px var(--accent);
}

.vat-calc-form .form-group,
.vat-calc-form .form-row,
.vat-calc-form .segmented-field {
    margin-bottom: 0.75rem;
}

.vat-calc-form .panel {
    padding: 1rem;
}

.auth-layout {
    padding-top: 1rem;
    min-height: auto;
}

.auth-brand-logo,
.auth-brand-logo--compact {
    max-height: 2.75rem;
    width: auto;
}

.auth-header h2 {
    margin-top: 0.35rem;
}

.property-hero {
    display: grid;
    gap: 0.55rem;
}

.property-hero-price {
    font-size: 1.35rem;
    font-weight: 750;
}

.property-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 1rem;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.hide-desktop {
    display: grid;
}

.hide-mobile {
    display: none;
}

.app-sidebar.is-empty,
.app-sidebar[hidden] {
    display: none !important;
}

@media (min-width: 769px) {
    .hide-desktop {
        display: none !important;
    }

    .hide-mobile {
        display: block;
    }

    .hide-mobile.table-wrapper {
        display: block;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }

    .site-header .header-grid {
        min-height: var(--header-height);
        padding-top: 0.45rem;
        padding-bottom: 0.45rem;
    }

    .site-brand-logo {
        height: 1.85rem;
    }

    .page-actions .btn-back,
    .page-actions .btn-secondary {
        width: auto;
    }

    .page-actions .btn-primary {
        width: 100%;
    }

    .segmented-control {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .entity-card-metrics {
        grid-template-columns: 1fr;
    }

    .stats-grid,
    .stats-grid-3 {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 481px) and (max-width: 900px) {
    .stats-grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ===== SaaS desktop polish: density + collapsible rail ===== */
:root {
    --radius: 12px;
    --radius-sm: 8px;
    --rail-width: 14.25rem; /* ~228px */
    --rail-collapsed-width: 4.25rem;
    --header-height: 64px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-rail {
    display: none;
}

.app-frame {
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg);
}

.dashboard-period-chip {
    display: inline-flex;
    margin: 0.25rem 0 0;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-ink);
    font-size: 0.74rem;
    font-weight: 700;
}

.saas-kpi-grid {
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.saas-kpi-grid .stat-card {
    border-radius: var(--radius);
    min-height: 84px;
    padding: 0.85rem 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.saas-kpi-grid .stat-card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow);
}

.saas-kpi-grid .stat-value {
    font-size: 1.3rem;
}

.panel {
    border-radius: var(--radius);
    padding: 1rem 1.05rem;
    margin-bottom: 0.85rem;
    background: var(--surface);
    border-color: var(--border-soft);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

[data-theme="dark"] .panel {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

.panel-header {
    margin-bottom: 0.75rem;
}

.panel-header h3 {
    font-size: 0.98rem;
}

.entity-card {
    border-radius: var(--radius);
    background: var(--surface);
    transition: border-color 0.2s ease, transform 0.15s ease;
}

.entity-card:active {
    transform: scale(0.995);
}

.rail-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
    color: #e8eefc;
    cursor: pointer;
    flex-shrink: 0;
}

.rail-toggle:hover {
    background: rgba(59, 130, 246, 0.22);
    border-color: rgba(59, 130, 246, 0.45);
}

.rail-toggle-icon {
    display: block;
    width: 0.55rem;
    height: 0.55rem;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-left: 0.15rem;
    transition: transform 0.18s ease;
}

.rail-toggle-header {
    border-color: var(--border);
    background: var(--bg-soft);
    color: var(--text-muted);
}

.rail-toggle-header:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-ink);
}

.rail-toggle-header .rail-toggle-icon {
    transform: rotate(-135deg);
    margin-left: 0;
    margin-right: 0.15rem;
}

.app-rail-nav .nav-link,
.app-rail-nav .app-nav-link {
    border-radius: var(--radius-sm);
    white-space: normal;
}

@media (min-width: 1025px) {
    body.has-app-rail {
        display: grid;
        grid-template-columns: var(--rail-width) minmax(0, 1fr);
        min-height: 100vh;
        transition: grid-template-columns 0.2s ease;
    }

    html[data-rail="collapsed"] body.has-app-rail {
        grid-template-columns: var(--rail-collapsed-width) minmax(0, 1fr);
    }

    body.has-app-rail .app-rail {
        display: flex;
        flex-direction: column;
        gap: 0.65rem;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        height: 100dvh;
        width: var(--rail-width);
        max-width: var(--rail-width);
        box-sizing: border-box;
        z-index: 40;
        padding: 0.75rem 0.65rem 0.85rem;
        border-right: 1px solid var(--rail-border);
        background: var(--rail-bg);
        color: var(--rail-text);
        overflow-x: hidden;
        overflow-y: hidden;
        transition: width 0.2s ease, max-width 0.2s ease;
    }

    body.has-app-rail .app-rail-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.35rem;
        min-height: 2.5rem;
    }

    body.has-app-rail .app-rail-brand {
        display: inline-flex;
        text-decoration: none;
        min-width: 0;
        flex: 1;
    }

    body.has-app-rail .app-rail-brand .site-brand-logo-shell {
        background: transparent;
        border-radius: 0;
        padding: 0;
        max-width: 100%;
    }

    body.has-app-rail .app-rail-brand .site-brand-logo {
        max-height: 1.85rem;
        width: auto;
        max-width: 100%;
    }

    body.has-app-rail .app-rail-nav {
        display: flex;
        flex-direction: column;
        gap: 0.15rem;
        flex: 1 1 auto;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    body.has-app-rail .app-rail-nav .nav-link {
        color: var(--rail-text-muted);
        background: transparent;
        padding: 0.55rem 0.7rem;
        font-size: 0.88rem;
        line-height: 1.25;
    }

    body.has-app-rail .app-rail-nav .nav-link:hover,
    body.has-app-rail .app-rail-nav .nav-link.active {
        background: var(--rail-active-bg);
        color: var(--rail-active-border);
    }

    body.has-app-rail .app-rail-footer {
        display: grid;
        gap: 0.35rem;
        flex-shrink: 0;
        padding-top: 0.55rem;
        border-top: 1px solid var(--rail-border);
    }

    body.has-app-rail .app-rail-user {
        display: none;
    }

    body.has-app-rail .app-rail-logout {
        display: none;
    }

    body.has-app-rail .header-zone-left,
    body.has-app-rail .header-zone-center,
    body.has-app-rail .nav-toggle {
        display: none !important;
    }

    body.has-app-rail .header-grid {
        grid-template-columns: minmax(0, 1fr) auto;
        min-height: var(--header-height);
        padding-left: 1.25rem;
        padding-right: 1.25rem;
        gap: 1rem;
    }

    body.has-app-rail .header-zone-search {
        display: flex;
        justify-content: center;
        grid-column: 1;
        min-width: 0;
    }

    body.has-app-rail .header-zone-context {
        display: none;
    }

    body.has-app-rail .header-zone-right {
        grid-column: 2;
        justify-self: end;
    }

    body.has-app-rail .header-tools-desktop {
        display: inline-flex;
        align-items: center;
        gap: 0.45rem;
    }

    body.has-app-rail .site-header {
        backdrop-filter: blur(10px);
        background: color-mix(in srgb, var(--header-bg) 92%, transparent);
    }

    body.has-app-rail .app-main {
        padding-top: 1rem;
        padding-bottom: 1.1rem;
    }

    body.has-app-rail .app-frame {
        grid-column: 2;
        min-width: 0;
        background:
            linear-gradient(
                180deg,
                color-mix(in srgb, var(--bg-soft) 65%, transparent) 0%,
                var(--bg) 18rem
            );
    }

    body.has-app-rail .dashboard-welcome-brand {
        display: none;
    }

    body.has-app-rail .dashboard-welcome {
        align-items: flex-start;
        padding: 0.35rem 0 0.85rem;
    }

    .dashboard-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.9rem;
        align-items: start;
    }

    .dashboard-grid > .panel:only-child {
        grid-column: 1 / -1;
    }

    /* Collapsed rail */
    html[data-rail="collapsed"] body.has-app-rail .app-rail {
        width: var(--rail-collapsed-width);
        max-width: var(--rail-collapsed-width);
        padding-left: 0.45rem;
        padding-right: 0.45rem;
        align-items: center;
    }

    html[data-rail="collapsed"] body.has-app-rail .app-rail-top {
        flex-direction: column;
        width: 100%;
    }

    html[data-rail="collapsed"] body.has-app-rail .app-rail-brand {
        justify-content: center;
        flex: 0;
    }

    html[data-rail="collapsed"] body.has-app-rail .app-rail-brand .site-brand-logo-shell {
        padding: 0.35rem;
    }

    html[data-rail="collapsed"] body.has-app-rail .app-rail-brand .site-brand-logo {
        max-height: 1.35rem;
        max-width: 1.85rem;
        object-fit: contain;
    }

    html[data-rail="collapsed"] body.has-app-rail .app-rail-nav,
    html[data-rail="collapsed"] body.has-app-rail .app-rail-footer {
        display: none;
    }

    html[data-rail="collapsed"] body.has-app-rail .rail-toggle .rail-toggle-icon {
        transform: rotate(-135deg);
        margin-left: 0;
        margin-right: 0.12rem;
    }
}

@media (max-width: 1024px) {
    .app-rail,
    .rail-toggle,
    .rail-toggle-header {
        display: none !important;
    }

    .dashboard-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .entity-card {
        padding: 1.05rem 1.15rem;
    }
}

/* ===== Mobile SaaS shell (mockup alignment) ===== */
.entity-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
}

.entity-card-heading-text {
    min-width: 0;
    display: grid;
    gap: 0.15rem;
}

.entity-card-chevron {
    width: 0.55rem;
    height: 0.55rem;
    margin-top: 0.45rem;
    border-right: 2px solid var(--text-muted);
    border-top: 2px solid var(--text-muted);
    transform: rotate(45deg);
    flex-shrink: 0;
    opacity: 0.7;
}

.entity-card-price {
    margin: 0.15rem 0 0;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.month-summary-list {
    display: grid;
    gap: 0.55rem;
}

.entity-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    margin-top: 0.15rem;
}

.entity-card-cta {
    color: var(--accent);
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none;
    white-space: nowrap;
}

.entity-card-cta:hover {
    text-decoration: underline;
    color: var(--accent-hover);
}

.btn-outline {
    background: transparent;
    color: var(--accent-ink);
    border: 1px solid var(--accent);
}

.btn-outline:hover {
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
    display: block;
    width: 1.15rem;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.nav-toggle-bars {
    position: relative;
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
}

.nav-toggle-bars::before {
    top: -6px;
}

.nav-toggle-bars::after {
    top: 6px;
}

.nav-toggle.is-open .nav-toggle-bars {
    background: transparent;
}

.nav-toggle.is-open .nav-toggle-bars::before {
    top: 0;
    transform: rotate(45deg);
}

.nav-toggle.is-open .nav-toggle-bars::after {
    top: 0;
    transform: rotate(-45deg);
}

@media (max-width: 768px) {
    body.has-app-rail .site-header,
    .site-header {
        background: color-mix(in srgb, var(--header-bg) 94%, var(--brand-navy) 6%);
        border-bottom-color: var(--border-soft);
    }

    body.has-app-rail .header-grid,
    .header-grid {
        min-height: 56px;
        padding: 0.45rem 0.85rem;
    }

    .site-brand-logo-shell {
        padding: 0.22rem 0.5rem;
        border-radius: 8px;
    }

    .site-brand-logo:not(.site-brand-logo--lockup) {
        height: 1.7rem;
    }

    .site-brand-logo--lockup {
        display: block;
        width: 100%;
        max-width: 120px;
        height: auto;
        max-height: none;
        object-fit: contain;
    }

    .nav-toggle {
        width: 2.55rem;
        min-width: 2.55rem;
        min-height: 2.55rem;
        padding: 0;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        background: var(--surface);
        color: var(--text);
    }

    .page-header {
        display: grid;
        gap: 0.7rem;
        margin-bottom: 0.75rem;
        align-items: start;
    }

    .page-header-text h2 {
        font-size: 1.35rem;
        letter-spacing: -0.03em;
        margin: 0;
    }

    .page-header-text p,
    .page-header .results-meta {
        margin: 0.2rem 0 0;
        color: var(--text-muted);
        font-size: 0.88rem;
        font-weight: 600;
    }

    .page-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.45rem;
    }

    .page-actions .btn-back {
        order: 2;
    }

    .filters-toolbar {
        margin-bottom: 0.65rem;
    }

    .filters-toggle {
        border-radius: 10px;
        font-weight: 700;
        background: var(--surface);
        border-color: var(--border);
    }

    .app-sidebar {
        background: var(--surface);
        border: 1px solid var(--border-soft);
        border-radius: 14px;
        margin: 0 0 0.85rem;
        padding: 1rem 0.95rem 1rem;
        box-shadow: var(--shadow);
    }

    .sidebar-title {
        font-size: 1.05rem;
        display: flex;
        align-items: center;
        gap: 0.45rem;
    }

    .sidebar-title::before {
        content: "";
        width: 0.85rem;
        height: 0.85rem;
        border: 2px solid var(--accent);
        border-radius: 3px;
        box-shadow: inset 0 -5px 0 -3px var(--accent);
        flex-shrink: 0;
    }

    .sidebar-filter-form .form-group {
        margin-bottom: 0.75rem;
    }

    .sidebar-filter-form label {
        font-size: 0.8rem;
        font-weight: 700;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

    .sidebar-filter-form .form-input:not(select),
    .sidebar-filter-form select.form-input,
    .sidebar-filter-form select {
        min-height: 2.7rem;
        border-radius: 10px;
        background-color: var(--bg-soft);
    }

    .sidebar-filter-form select.form-input,
    .sidebar-filter-form select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.5 1.75L6 6.25L10.5 1.75' stroke='%235b6b7c' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 0.85rem center;
        background-size: 0.75rem 0.5rem;
        padding-right: 2.35rem;
    }

    [data-theme="dark"] .sidebar-filter-form select.form-input,
    [data-theme="dark"] .sidebar-filter-form select {
        background-color: var(--surface);
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.5 1.75L6 6.25L10.5 1.75' stroke='%2393a0b8' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 0.85rem center;
        background-size: 0.75rem 0.5rem;
    }

    .sidebar-filter-actions {
        display: grid;
        gap: 0.55rem;
        margin-top: 0.35rem;
    }

    .sidebar-filter-actions .btn {
        min-height: 2.75rem;
        border-radius: 10px;
        font-weight: 700;
    }

    .sidebar-filter-actions .btn-secondary {
        background: transparent;
        color: var(--accent-ink);
        border-color: var(--accent);
    }

    .sidebar-count {
        display: none;
    }

    .panel.panel-list,
    .panel:has(> .entity-card-list) {
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        margin-bottom: 0.5rem;
    }

    .entity-card-list {
        gap: 0.7rem;
    }

    .entity-card {
        background: var(--surface);
        border: 1px solid var(--border-soft);
        border-radius: 12px;
        padding: 0.95rem 1rem;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
        gap: 0.45rem;
    }

    [data-theme="dark"] .entity-card {
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
        border-color: var(--border);
    }

    .entity-card-title {
        font-size: 1.02rem;
        font-weight: 700;
    }

    .entity-card-subtitle {
        font-size: 0.86rem;
    }

    .entity-card-metrics {
        margin-top: 0.15rem;
        gap: 0.55rem;
    }

    .entity-card-metrics dd.money-emphasis {
        color: var(--accent);
        font-weight: 700;
    }

    .entity-card-footer .entity-card-meta {
        font-size: 0.82rem;
    }

    .entity-card-cta-btn {
        margin-left: auto;
    }

    .entity-card-actions {
        justify-content: flex-end;
    }

    .badge,
    .badge-soft,
    .type-tag {
        border-radius: 999px;
        font-size: 0.72rem;
        padding: 0.22rem 0.55rem;
        font-weight: 700;
    }

    .status-approved,
    .badge.status-approved {
        background: rgba(59, 130, 246, 0.16);
        color: #93c5fd;
        border-color: rgba(59, 130, 246, 0.28);
    }

    [data-theme="light"] .status-approved,
    :root:not([data-theme="dark"]) .status-approved,
    :root:not([data-theme="dark"]) .badge.status-approved {
        background: #dbeafe;
        color: var(--accent-ink);
        border-color: #93c5fd;
    }

    .stats-grid {
        gap: 0.65rem;
    }

    .stat-card {
        min-height: 78px;
        padding: 0.8rem 0.85rem;
    }

    .app-main {
        padding-top: 0.75rem;
        padding-bottom: 1rem;
    }

    .app-main-inner {
        width: min(100% - 0.5rem, 100%);
        padding: 0 0.65rem;
    }

    .site-footer {
        padding: 0.55rem 0 0.75rem;
        font-size: 0.72rem;
    }

    .main-nav.is-open {
        background: var(--surface);
        border: 1px solid var(--border-soft);
        border-radius: 12px;
        padding: 0.55rem;
        margin-top: 0.15rem;
    }

    .main-nav .nav-link {
        background: transparent;
        border: 1px solid transparent;
    }

    .main-nav .nav-link.active {
        background: var(--accent-soft);
        border-color: transparent;
        color: var(--accent-ink);
    }

    /* --- Final mobile polish pass --- */
    :root {
        --header-height: 54px;
        --mobile-gutter: 1rem;
    }

    body.has-app-rail .header-grid,
    .header-grid {
        min-height: var(--header-height);
        padding: 0.35rem var(--mobile-gutter);
    }

    .site-brand-logo {
        height: 1.55rem;
    }

    .app-main {
        padding-top: 0.55rem;
        padding-bottom: 0.75rem;
    }

    .app-main-inner {
        width: 100%;
        max-width: 100%;
        padding: 0 var(--mobile-gutter);
        box-sizing: border-box;
    }

    .dashboard-welcome {
        padding: 0.15rem 0 0.65rem;
        gap: 0.45rem;
    }

    .dashboard-welcome-brand {
        display: none;
    }

    .dashboard-welcome-text h1 {
        font-size: 1.35rem;
        line-height: 1.2;
    }

    .dashboard-welcome-org {
        font-size: 0.84rem;
        margin-top: 0.15rem;
    }

    .dashboard-period-chip {
        margin-top: 0.4rem;
        font-size: 0.72rem;
    }

    .saas-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.6rem;
        margin-bottom: 0.75rem;
    }

    .saas-kpi-grid .stat-card {
        min-height: 0;
        padding: 0.75rem 0.8rem;
        border-radius: 12px;
    }

    .saas-kpi-grid .stat-label {
        font-size: 0.68rem;
        margin-bottom: 0.35rem;
        line-height: 1.25;
    }

    .saas-kpi-grid .stat-value {
        font-size: 1.05rem;
        line-height: 1.2;
    }

    .dashboard-grid.panel-spaced,
    .panel-spaced {
        margin-top: 0.75rem;
    }

    .dashboard-grid {
        gap: 0.75rem;
    }

    .dashboard-grid > .panel,
    .panel.panel-spaced {
        padding: 0.85rem 0.9rem;
        margin-bottom: 0.65rem;
    }

    .month-summary-list {
        display: grid;
        gap: 0.55rem;
    }

    .month-summary-card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.65rem;
        padding: 0.8rem 0.85rem;
        border: 1px solid var(--border-soft);
        border-radius: 12px;
        background: var(--bg-soft);
    }

    .month-summary-main {
        display: grid;
        gap: 0.15rem;
        min-width: 0;
    }

    .month-summary-main strong {
        font-size: 0.95rem;
    }

    .month-summary-main span,
    .month-summary-money {
        color: var(--text-muted);
        font-size: 0.78rem;
        font-weight: 600;
    }

    .month-summary-money {
        display: grid;
        gap: 0.2rem;
        text-align: right;
    }

    .month-summary-money .money-emphasis {
        color: var(--accent);
    }

    .page-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.5rem;
        width: 100%;
    }

    .page-actions .btn,
    .page-actions .btn-primary,
    .page-actions .btn-secondary,
    .page-actions .btn-back {
        width: 100%;
        justify-content: center;
        min-height: 2.7rem;
        order: initial;
    }

    .page-actions .btn-primary {
        order: 0;
    }

    .page-actions .btn-back,
    .page-actions .btn-secondary:not(.btn-primary) {
        order: 1;
    }

    .panel-search {
        padding: 0.85rem 0.9rem;
        margin-bottom: 0.75rem;
    }

    .autocomplete-form {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.55rem;
        align-items: stretch;
    }

    .autocomplete-field {
        width: 100%;
    }

    .autocomplete-list {
        z-index: 30;
        width: 100%;
        max-width: 100%;
        background: var(--surface);
        border: 1px solid var(--border);
        color: var(--text);
    }

    [data-theme="dark"] .autocomplete-list {
        background: #151f33;
        border-color: var(--border);
    }

    .entity-card-agent-main {
        display: flex;
        align-items: center;
        gap: 0.7rem;
        min-width: 0;
    }

    .entity-avatar {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.35rem;
        height: 2.35rem;
        border-radius: 999px;
        background: var(--accent-soft);
        color: var(--accent-ink);
        font-size: 0.78rem;
        font-weight: 800;
        flex-shrink: 0;
    }

    .entity-card-footer-actions {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        padding-top: 0.2rem;
        border-top: 1px solid var(--border-soft);
        margin-top: 0.35rem;
    }

    .sidebar-filter-actions {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .sidebar-filter-actions .btn {
        min-height: 2.55rem;
        font-size: 0.86rem;
        padding-left: 0.55rem;
        padding-right: 0.55rem;
    }

    .pagination {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
    }

    .pagination-controls {
        justify-content: center;
    }

    .pagination-summary {
        text-align: center;
        font-size: 0.8rem;
    }

    .vat-calc-form .panel {
        padding: 0.9rem;
    }

    .vat-calc-form .form-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }

    .vat-calc-form .segmented-control {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.35rem;
        padding: 0.2rem;
        background: var(--bg-soft);
        border: 1px solid var(--border-soft);
        border-radius: 12px;
    }

    .vat-calc-form .segmented-option {
        min-height: 2.35rem;
        padding: 0.4rem 0.45rem;
        font-size: 0.8rem;
        border-radius: 9px;
        background: transparent;
        border-color: transparent;
        box-shadow: none;
    }

    .vat-calc-form .segmented-option:has(input:checked) {
        background: var(--accent);
        color: #fff;
        border-color: var(--accent);
        box-shadow: none;
    }

    .vat-calc-form .form-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.55rem;
        margin-top: 0.35rem;
    }

    .vat-calc-form .form-actions .btn-primary {
        width: 100%;
        min-height: 2.85rem;
    }

    .vat-calc-form .form-actions .btn-ghost {
        width: 100%;
        justify-content: center;
        color: var(--text-muted);
        border: 1px solid var(--border);
        background: transparent;
        min-height: 2.45rem;
    }

    .vat-calc-notice {
        font-size: 0.84rem;
        line-height: 1.4;
        margin-bottom: 0.75rem;
    }

    .site-footer {
        margin-top: 0.35rem;
        padding: 0.4rem 0 0.55rem;
        font-size: 0.68rem;
        opacity: 0.85;
        border-top-color: transparent;
    }

    .footer-content {
        width: 100%;
        padding: 0 var(--mobile-gutter);
        gap: 0.35rem;
    }

    .footer-slogan {
        display: none;
    }

    .main-nav.is-open {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
        padding: 0.5rem 0.55rem 0.55rem;
        border-radius: 12px;
        background: var(--surface);
        border: 1px solid var(--border);
        box-shadow: var(--shadow);
        max-height: calc(100dvh - var(--header-height, 54px) - 4.75rem - env(safe-area-inset-bottom, 0px));
        overflow: hidden;
    }

    .main-nav-links {
        gap: 0.08rem;
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-right: 0.1rem;
    }

    .main-nav-links .nav-link,
    .main-nav-links .app-nav-link {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        width: 100%;
        box-sizing: border-box;
        padding: 0.65rem 0.85rem;
        border-radius: 10px;
        font-size: 0.86rem;
        font-weight: 650;
        background: transparent;
        min-height: 2.35rem;
        line-height: 1.2;
        text-align: left;
        gap: 0.65rem;
    }

    .main-nav-links .nav-link.active,
    .main-nav-links .app-nav-link.active {
        background: var(--accent-soft);
        color: var(--accent-ink);
        justify-content: flex-start;
        text-align: left;
    }

    .main-nav-tools-mobile {
        gap: 0.35rem;
        padding-top: 0.35rem;
        border-top: 1px solid var(--border-soft);
        flex: 0 0 auto;
    }

    .main-nav-tools-mobile .language-switcher {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.3rem;
        width: 100%;
        padding: 0.18rem;
        border-radius: 10px;
        background: var(--bg-soft);
        border: 1px solid var(--border-soft);
    }

    .main-nav-tools-mobile .lang-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 1.9rem;
        border-radius: 8px;
        font-size: 0.8rem;
        font-weight: 800;
        text-decoration: none;
    }

    .main-nav-tools-mobile .lang-link.active {
        background: var(--accent);
        color: #fff;
    }

    .main-nav-tools-mobile .theme-toggle {
        width: 100%;
        min-height: 2.1rem;
        border-radius: 8px;
        justify-content: center;
    }

    .header-account-mobile {
        border-top: 1px solid var(--border-soft);
        padding-top: 0.55rem;
        margin-top: 0.15rem;
    }

    .header-account-mobile .nav-user {
        background: var(--bg-soft);
        border: 1px solid var(--border-soft);
        border-radius: 12px;
        padding: 0.75rem 0.85rem;
    }

    .table-wrapper {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* --- Mobile mockup alignment --- */
    body.has-mobile-bottom-nav {
        padding-bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
    }

    body.has-mobile-bottom-nav .site-footer {
        margin-bottom: 0.25rem;
    }

    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 80;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.15rem;
        padding: 0.4rem 0.35rem calc(0.4rem + env(safe-area-inset-bottom, 0px));
        background: var(--surface);
        border-top: 1px solid var(--border-soft);
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
    }

    .mobile-bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
        min-height: 3.15rem;
        width: 100%;
        box-sizing: border-box;
        padding: 0.3rem 0.15rem;
        border-radius: 10px;
        color: var(--text-muted);
        text-decoration: none;
        font-size: 0.68rem;
        font-weight: 700;
        text-align: center;
    }

    .mobile-bottom-nav-item.active {
        color: var(--accent);
        background: var(--accent-soft);
    }

    .mobile-bottom-nav-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 1.35rem;
        height: 1.35rem;
        margin: 0 auto;
    }

    .mobile-bottom-nav-icon svg {
        width: 100%;
        height: 100%;
        display: block;
    }

    .mobile-bottom-nav-label {
        display: block;
        width: 100%;
        text-align: center;
        line-height: 1.1;
    }

    .mobile-drawer-brand {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 0.75rem;
        padding: 0.35rem 0.25rem 0.85rem;
        border-bottom: 1px solid var(--border-soft);
        margin-bottom: 0.35rem;
        flex: 0 0 auto;
        text-align: left;
    }

    .mobile-drawer-brand-logo {
        display: block;
        width: 100%;
        max-width: 155px;
        height: auto;
        object-fit: contain;
    }

    .mobile-drawer-brand-text {
        display: grid;
        gap: 0.2rem;
        min-width: 0;
        width: 100%;
    }

    .mobile-drawer-brand-text strong {
        font-size: 0.95rem;
        letter-spacing: 0.02em;
        text-transform: uppercase;
        color: var(--text);
    }

    .mobile-drawer-brand-text span {
        font-size: 0.68rem;
        color: var(--text-muted);
        font-weight: 600;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    .mobile-drawer-section {
        padding: 0.3rem 0;
        border-top: 1px solid var(--border-soft);
    }

    .mobile-drawer-prefs {
        display: grid;
        gap: 0.35rem;
    }

    .theme-toggle-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        width: 100%;
        min-height: 2.05rem;
        padding: 0.3rem 0.6rem;
        border-radius: 8px;
        border: 1px solid var(--border-soft);
        background: var(--bg-soft);
        color: var(--text);
        cursor: pointer;
    }

    .theme-toggle-row-label {
        font-size: 0.82rem;
        font-weight: 600;
    }

    .theme-switch {
        position: relative;
        width: 2.3rem;
        height: 1.3rem;
        border-radius: 999px;
        background: #64748b;
        flex: 0 0 auto;
        transition: background 0.2s ease;
    }

    .theme-switch::after {
        content: "";
        position: absolute;
        top: 0.12rem;
        left: 0.12rem;
        width: 1.05rem;
        height: 1.05rem;
        border-radius: 999px;
        background: var(--surface);
        transition: transform 0.2s ease;
    }

    [data-theme="dark"] .theme-switch {
        background: var(--accent);
    }

    [data-theme="dark"] .theme-switch::after {
        transform: translateX(1rem);
    }

    .mobile-drawer-user-card {
        display: flex;
        align-items: center;
        gap: 0.55rem;
        padding: 0.45rem 0.55rem;
        border-radius: 10px;
        background: var(--bg-soft);
        border: 1px solid var(--border-soft);
    }

    .mobile-drawer-user-text {
        display: grid;
        gap: 0.05rem;
        min-width: 0;
    }

    .mobile-drawer-user-text strong {
        font-size: 0.84rem;
    }

    .mobile-drawer-user-text span {
        font-size: 0.72rem;
        color: var(--text-muted);
    }

    .mobile-drawer-logout {
        display: inline-flex;
        margin-top: 0.4rem;
        color: #f87171;
        font-weight: 700;
        text-decoration: none;
        font-size: 0.84rem;
    }

    .mobile-drawer-avatar {
        width: 1.85rem;
        height: 1.85rem;
        font-size: 0.68rem;
    }

    .main-nav-tools-mobile .header-nav-meta {
        gap: 0.35rem;
    }

    .main-nav-tools-mobile .nav-bell-link,
    .main-nav-tools-mobile .nav-dropdown-toggle {
        min-height: 2.05rem;
        padding: 0.35rem 0.65rem;
        font-size: 0.86rem;
    }

    .page-actions-split {
        grid-template-columns: 1.2fr 0.8fr !important;
    }

    .page-actions-stack {
        grid-template-columns: 1fr !important;
    }

    .mobile-inline-filters {
        padding: 0.85rem 0.9rem;
        margin-bottom: 0.75rem;
    }

    .mobile-inline-filters-form {
        display: grid;
        gap: 0.65rem;
    }

    .mobile-inline-filters-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.55rem;
    }

    .mobile-inline-filters .form-group {
        margin: 0;
    }

    .entity-card-metrics-ops {
        grid-template-columns: 1fr 1fr;
    }

    .entity-agent-inline {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
    }

    .entity-avatar-sm {
        width: 1.45rem;
        height: 1.45rem;
        font-size: 0.62rem;
    }

    .entity-card-operation .entity-card-footer {
        justify-content: flex-end;
    }

    .entity-card-ranking .entity-card-heading {
        align-items: center;
    }

    .rank-badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 1.55rem;
        height: 1.55rem;
        border-radius: 999px;
        background: var(--bg-soft);
        border: 1px solid var(--border);
        font-size: 0.75rem;
        font-weight: 800;
        flex-shrink: 0;
    }

    .rank-badge-top {
        background: var(--accent-soft);
        border-color: var(--accent);
        color: var(--accent-ink);
    }

    .stat-icon {
        display: inline-flex;
        width: 1.55rem;
        height: 1.55rem;
        border-radius: 999px;
        background: var(--accent-soft);
        color: var(--accent);
        margin-bottom: 0.45rem;
        position: relative;
    }

    .stat-icon::before {
        content: "";
        position: absolute;
        inset: 0.35rem;
        background: currentColor;
        opacity: 0.95;
        mask-repeat: no-repeat;
        mask-position: center;
        mask-size: contain;
        -webkit-mask-repeat: no-repeat;
        -webkit-mask-position: center;
        -webkit-mask-size: contain;
    }

    .stat-icon-check::before {
        mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M20 7 10 17l-5-5' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M20 7 10 17l-5-5' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    }

    .stat-icon-money::before {
        mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M12 3v18M17 8c0-1.7-2.2-3-5-3s-5 1.3-5 3 2.2 3 5 3 5 1.3 5 3-2.2 3-5 3-5-1.3-5-3' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
        -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M12 3v18M17 8c0-1.7-2.2-3-5-3s-5 1.3-5 3 2.2 3 5 3 5 1.3 5 3-2.2 3-5 3-5-1.3-5-3' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    }

    .stat-icon-chart::before {
        mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M5 19V10M12 19V5M19 19v-7' stroke='black' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E");
        -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M5 19V10M12 19V5M19 19v-7' stroke='black' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E");
    }

    .stat-icon-home::before {
        mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M4 11 12 4l8 7v9H4v-9Z' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
        -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M4 11 12 4l8 7v9H4v-9Z' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
    }

    .input-with-affix {
        position: relative;
    }

    .input-with-affix .form-input {
        padding-left: 2.35rem;
    }

    .input-affix {
        position: absolute;
        left: 0.75rem;
        top: 50%;
        transform: translateY(-50%);
        width: 1.25rem;
        height: 1.25rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 0.3rem;
        background: var(--bg-soft);
        border: 1px solid var(--border-soft);
        color: var(--text-muted);
        font-size: 0.75rem;
        font-weight: 800;
        pointer-events: none;
        z-index: 1;
    }
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: grid !important;
    }

    .mobile-drawer-brand {
        display: flex !important;
    }
}

@media (min-width: 769px) {
    .mobile-inline-filters,
    .mobile-bottom-nav,
    .mobile-drawer-brand {
        display: none !important;
    }

    body.has-mobile-bottom-nav {
        padding-bottom: 0;
    }
}

/* Cash AI / treasury detail */
.cash-page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}
.cash-ai-cta {
    min-height: 44px;
}
.badge-ai,
.badge-review {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    vertical-align: middle;
}
.badge-ai {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
}
.badge-review {
    background: rgba(245, 158, 11, 0.18);
    color: #92400e;
}
.cash-detail-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.cash-detail-amount {
    font-size: 1.25rem;
}
.cash-detail-table th {
    width: 40%;
    color: var(--text-muted, #64748b);
    font-weight: 500;
}
.cash-detail-block {
    margin-top: 1rem;
}
.cash-receipt-thumb {
    display: inline-block;
    max-width: 160px;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.12);
}
.cash-receipt-thumb img {
    display: block;
    width: 100%;
    height: auto;
}
.cash-ai-form-actions {
    display: grid;
    gap: 0.75rem;
}
.cash-ai-analyzing {
    margin-top: 0.75rem;
}
.cash-duplicate-list {
    margin: 0.75rem 0 0;
    padding-left: 1.1rem;
}
@media (max-width: 480px) {
    .cash-page-actions {
        width: 100%;
    }
    .cash-page-actions .btn {
        flex: 1 1 100%;
        text-align: center;
    }
    .cash-ai-cta {
        order: -1;
    }
}

/* Billing / Facturación */
.kpi-row {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.kpi-card {
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.kpi-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}
.billing-kpi-grid {
    margin-bottom: 0.9rem;
    gap: 0.7rem;
}

.billing-kpi-grid .stat-card {
    min-height: 72px;
    padding: 0.72rem 0.85rem;
}

.billing-kpi-grid .stat-label {
    font-size: 0.72rem;
    margin-bottom: 0.28rem;
}

.billing-kpi-grid .stat-value {
    font-size: 1.08rem;
}

.billing-kpi-grid .stat-value.billing-kpi-muted {
    font-size: 0.98rem;
    color: var(--text-muted);
}

.billing-config-details {
    margin-top: 1rem;
    font-size: 0.92rem;
}

.billing-config-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.billing-ai-feedback {
    margin-top: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    background: var(--surface);
}

.billing-ai-found {
    margin: 0 0 0.25rem;
    font-weight: 600;
    color: var(--text);
}

.flash-cta-row {
    margin-top: -0.25rem;
    padding-top: 0;
    border: none;
    background: transparent;
}

.billing-arca-test-banner {
    font-weight: 700;
    color: var(--warning-text, #b45309);
    margin-bottom: 0.75rem;
}

.billing-arca-banner {
    border-color: var(--warning-border, #f59e0b);
    background: var(--warning-bg, rgba(245, 158, 11, 0.08));
}

.billing-arca-config {
    margin-top: 1rem;
}

.billing-arca-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.75rem 1rem;
    margin: 0 0 1rem;
}

.billing-arca-status-grid dt {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.billing-arca-status-grid dd {
    margin: 0.15rem 0 0;
    font-weight: 600;
}

.billing-arca-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.billing-issuer-card .billing-arca-config {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color, #e5e7eb);
}

.billing-review-panel {
    max-width: 36rem;
}

.billing-review-amount {
    font-size: 1.75rem;
    margin: 0 0 1rem;
}

.billing-review-dl {
    margin-bottom: 1.25rem;
}

.billing-review-env {
    margin: 0 0 1rem;
}

.billing-review-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-start;
}

.billing-review-change {
    margin: 0.35rem 0 0;
}

.billing-detail-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0.75rem;
}

.billing-detail-card {
    padding: 0.75rem;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 0.5rem;
}

.billing-detail-card h4 {
    margin: 0 0 0.35rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.billing-detail-desktop {
    display: none;
}

.billing-side-operation {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.billing-side-operation:last-child {
    border-bottom: none;
}

.billing-side-operation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.billing-side-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
    gap: 0.5rem 1rem;
    margin: 0 0 0.75rem;
}

.billing-side-metrics dt {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.billing-side-metrics dd {
    margin: 0.1rem 0 0;
}

.billing-side-amount-form {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border-color, #e5e7eb);
    max-width: 24rem;
}

.billing-side-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

@media (min-width: 768px) {
    .billing-detail-cards {
        display: none;
    }

    .billing-detail-desktop {
        display: block;
    }
}

.billing-issuer-card .billing-issuer-missing {
    margin: 0.35rem 0 0.5rem;
    padding-left: 1.1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.billing-issuer-actions {
    margin-top: 0.5rem;
}

.billing-issuer-action-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.billing-card-list {
    display: grid;
    gap: 0.85rem;
}
.billing-card {
    padding: 1rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    display: grid;
    gap: 0.35rem;
}
.billing-card h4 {
    margin: 0;
}
.money-lg {
    font-size: 1.5rem;
    font-weight: 700;
}
.detail-list {
    display: grid;
    gap: 0.5rem 1rem;
    grid-template-columns: minmax(8rem, 12rem) 1fr;
}
.detail-list dt {
    opacity: 0.7;
}
.detail-list dd {
    margin: 0;
}
.billing-side-block {
    margin: 1rem 0;
    padding: 1rem 0;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}
.billing-side-edit {
    margin-top: 0.75rem;
}
.billing-profile-alert {
    border-left: 4px solid #b45309;
}
.billing-profile-alert ul {
    margin: 0.5rem 0 0;
    padding-left: 1.1rem;
}

.operation-new-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.operation-new-section h3 {
    margin: 0 0 1rem;
    font-size: 1.05rem;
}

.operation-search-mode {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.radio-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 999px;
    cursor: pointer;
}

.operation-sides-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.operation-data-panel .operation-summary-bar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    padding: 1rem;
    margin-bottom: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.operation-summary-stat {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.operation-summary-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.operation-summary-value {
    font-size: 1.15rem;
    color: var(--text);
}

.operation-summary-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.operation-sides-heading {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.operation-sides-stack {
    display: grid;
    gap: 0.75rem;
}

.operation-side-card {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 1rem;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.operation-side-card--active {
    display: grid;
    gap: 0.85rem;
}

.operation-side-card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.operation-side-card h4,
.operation-side-row-title {
    margin: 0;
    font-size: 1rem;
    color: var(--text);
}

.operation-side-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem 1rem;
    margin: 0;
}

.operation-side-metrics div {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
}

.operation-side-metrics dt {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
}

.operation-side-metrics dd {
    margin: 0;
    font-size: 1rem;
    color: var(--text);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.operation-side-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    background: var(--surface);
}

.operation-side-card.is-inactive {
    opacity: 1;
}

.operation-side-card h4 {
    margin: 0 0 0.75rem;
}

.operation-side-result {
    margin: 0 0 0.75rem;
}

.operation-side-toggles {
    display: grid;
    gap: 0.5rem;
}

.operation-new-summary .operation-summary-dl {
    display: grid;
    gap: 0.65rem;
    margin: 0;
}

.operation-new-summary .operation-summary-dl div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.operation-new-summary dt {
    opacity: 0.75;
}

.operation-new-summary dd {
    margin: 0;
    font-weight: 600;
}

#property-search-group .autocomplete-list {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 280px;
    overflow-y: auto;
}

#property-search-group {
    position: relative;
}

@media (max-width: 768px) {
    .operation-sides-grid {
        grid-template-columns: 1fr;
    }

    .operation-data-panel .operation-summary-bar {
        grid-template-columns: 1fr;
    }

    .operation-side-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .billing-invoices-desktop {
        display: none;
    }
}

@media (min-width: 769px) {
    .billing-invoices-mobile {
        display: none;
    }
}

.mobile-only {
    display: block;
}

.desktop-only {
    display: none;
}

@media (min-width: 769px) {
    .mobile-only {
        display: none;
    }

    .desktop-only {
        display: block;
    }
}

.billing-ai-panel {
    margin-bottom: 1rem;
}

.billing-ai-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: stretch;
}

.billing-ai-input {
    flex: 1 1 220px;
    min-height: 2.75rem;
    font-size: 1rem;
}

.billing-kpi-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    font-size: 0.92rem;
}

.billing-kpi-muted {
    color: var(--text-muted);
}

.billing-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.billing-tab {
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
}

.billing-tab.is-active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-ink);
}

.billing-search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
}

.billing-pending-grid {
    display: grid;
    gap: 0.75rem;
}

@media (min-width: 769px) {
    .billing-pending-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

.billing-pending-card {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 1rem;
    display: grid;
    gap: 0.35rem;
}

.billing-pending-meta,
.billing-pending-agent {
    color: var(--text-muted);
    margin: 0;
}

.billing-pending-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.billing-prepare-dl {
    display: grid;
    gap: 0.75rem;
    margin: 1rem 0;
}

.billing-prepare-dl div {
    display: grid;
    gap: 0.15rem;
}

.billing-prepare-amount {
    font-size: 1.35rem;
    font-weight: 700;
}

.billing-side-compact {
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.billing-side-compact:last-child {
    border-bottom: none;
}

.operation-commission-panel .operation-side-metrics {
    margin-bottom: 1rem;
}

.operation-commission-dialog {
    width: min(34rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    padding: 1.25rem;
    border: 0;
    border-radius: 1rem;
    color: var(--text-color);
    background: var(--surface-color);
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

.operation-commission-dialog::backdrop {
    background: rgba(15, 23, 42, 0.62);
}

.operation-commission-dialog .aa-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.operation-commission-dialog .aa-dialog__close {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 1.5rem;
}

