:root {
    --app-bg: #f5f8fb;
    --app-surface: #ffffff;
    --app-surface-strong: #f8fbfd;
    --app-ink: #102033;
    --app-muted: #65758a;
    --app-border: #dce5ee;
    --app-accent: #2072b8;
    --app-accent-strong: #155f9f;
    --app-cyan: #20e3ff;
    --app-navy: #070a12;
    --app-success: #167c58;
    --app-danger: #b42318;
    --app-warning: #b45309;
    --app-shadow: 0 18px 48px rgba(15, 35, 63, 0.10);
    --app-radius: 8px;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--app-ink);
    background: var(--app-bg);
    text-rendering: optimizeLegibility;
}

a,
.btn-link {
    color: var(--app-accent-strong);
}

a:hover,
.btn-link:hover {
    color: var(--app-accent);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--app-ink);
    letter-spacing: 0;
}

h1 {
    margin-bottom: 1.1rem;
    font-size: 2.6rem;
    font-weight: 850;
    line-height: 1.05;
}

[tabindex="-1"]:focus {
    outline: none;
}

h2 {
    font-weight: 800;
}

.content > h1:first-child {
    margin-bottom: 1.4rem;
}

.btn {
    border-radius: 8px;
    font-weight: 750;
    letter-spacing: 0;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--app-accent) 0%, var(--app-accent-strong) 58%, #0b8ca8 100%);
    border-color: var(--app-accent-strong);
    box-shadow: 0 10px 22px rgba(32, 114, 184, 0.24);
}

.btn-primary:hover,
.btn-primary:focus {
    color: #fff;
    border-color: #0f4f86;
    background: linear-gradient(135deg, #1a65a6 0%, #0f4f86 100%);
}

.btn-outline-primary {
    color: var(--app-accent-strong);
    border-color: rgba(15, 143, 138, 0.36);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    color: #fff;
    background: var(--app-accent-strong);
    border-color: var(--app-accent-strong);
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: rgba(15, 143, 138, 0.52);
    box-shadow: 0 0 0 0.22rem rgba(15, 143, 138, 0.14);
}

.form-control,
.form-select {
    border-color: var(--app-border);
    border-radius: 8px;
    color: var(--app-ink);
    min-height: 2.55rem;
}

.form-control-sm,
.form-select-sm {
    min-height: 2.15rem;
}

.form-label {
    color: var(--app-ink);
    font-size: 0.88rem;
    font-weight: 750;
}

.form-check-label {
    color: var(--app-muted);
}

.table {
    --bs-table-color: var(--app-ink);
    --bs-table-border-color: var(--app-border);
    margin-bottom: 0;
    background: var(--app-surface);
}

.table thead th {
    color: var(--app-muted);
    font-size: 0.72rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    background: var(--app-surface-strong);
    border-bottom: 1px solid var(--app-border);
}

.table tbody td {
    vertical-align: middle;
}

.badge {
    border-radius: 999px;
    padding: 0.4em 0.7em;
    font-weight: 800;
}

.alert {
    border-radius: 8px;
    border-width: 1px;
}

.border.rounded,
section.border.rounded,
details.border.rounded {
    border-color: var(--app-border) !important;
    border-radius: var(--app-radius) !important;
    background: var(--app-surface);
    box-shadow: 0 10px 26px rgba(15, 35, 63, 0.05);
}

details > summary {
    cursor: pointer;
    list-style: none;
}

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

details > summary::after {
    content: "+";
    float: right;
    color: var(--app-muted);
    font-weight: 900;
}

details[open] > summary::after {
    content: "-";
}

code {
    color: #0a6f78;
    background: #ecfdfb;
    border-radius: 6px;
    padding: 0.1rem 0.35rem;
}

.landing-brand {
    display: inline-flex;
    gap: 0.75rem;
    align-items: center;
    color: var(--app-ink);
    font-size: 1.08rem;
    font-weight: 900;
    text-decoration: none;
}

.landing-brand:hover {
    color: var(--app-ink);
}

.landing-brand strong,
.landing-brand small {
    display: block;
}

.landing-brand small {
    margin-top: 0.05rem;
    color: var(--app-muted);
    font-size: 0.68rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.brand-mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, var(--app-navy), var(--app-accent-strong));
    box-shadow: 0 12px 26px rgba(15, 35, 63, 0.18);
}

.tau-logo-card {
    width: 205px;
    height: 48px;
    display: grid;
    place-items: center;
    padding: 0.5rem 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--app-radius);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.22);
}

.tau-logo-card img {
    display: block;
    width: 100%;
    height: auto;
}

.validation-message {
    color: var(--app-danger);
}

.invalid {
    outline: 1px solid var(--app-danger);
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--app-success);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
    background:
        radial-gradient(circle at 16% 14%, rgba(32, 227, 255, 0.16), transparent 30rem),
        radial-gradient(circle at 88% 20%, rgba(32, 114, 184, 0.26), transparent 28rem),
        linear-gradient(180deg, #070a12 0%, #0b1220 100%);
}

.auth-card {
    width: min(100%, 430px);
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--app-radius);
    background: rgba(7, 10, 18, 0.76);
    box-shadow: 0 28px 82px rgba(0, 0, 0, 0.36);
    backdrop-filter: blur(18px);
}

.auth-brand {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    align-items: flex-start;
    margin-bottom: 1.35rem;
    color: #fff;
    text-decoration: none;
}

.auth-brand:hover {
    color: #fff;
}

.auth-brand strong,
.auth-brand small {
    display: block;
    line-height: 1.1;
}

.auth-brand strong {
    font-size: 1.08rem;
}

.auth-brand small {
    margin-top: 0.2rem;
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.tau-kicker {
    width: fit-content;
    margin-bottom: 1rem;
    padding: 0.42rem 0.65rem;
    border: 1px solid rgba(32, 227, 255, 0.28);
    border-radius: 999px;
    color: #9aeaf5;
    background: rgba(32, 227, 255, 0.08);
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.auth-card h1 {
    margin-bottom: 0.45rem;
    color: #fff;
    font-size: 2.1rem;
}

.auth-card .auth-copy {
    margin-bottom: 1.6rem;
    color: rgba(255, 255, 255, 0.68);
}

.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
}

.auth-options > .form-label {
    color: rgba(255, 255, 255, 0.72);
}

.auth-policy-links {
    margin-top: 1.25rem;
    padding-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.55rem;
    align-items: center;
    justify-content: center;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.46);
    font-size: 0.84rem;
}

.auth-policy-links a {
    color: rgba(255, 255, 255, 0.72);
    font-weight: 700;
    text-decoration: none;
}

.auth-policy-links a:hover,
.auth-policy-links a:focus {
    color: #fff;
}

.legal-shell {
    min-height: 100vh;
    padding: 1.25rem 1.5rem 3rem;
    background: var(--app-bg);
}

.legal-header,
.legal-document,
.legal-footer {
    width: min(100%, 980px);
    margin-right: auto;
    margin-left: auto;
}

.legal-nav {
    min-height: 72px;
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
}

.legal-brand {
    display: flex;
    gap: 0.9rem;
    align-items: center;
    color: var(--app-ink);
    text-decoration: none;
}

.legal-brand:hover {
    color: var(--app-ink);
}

.legal-brand .tau-logo-card {
    width: 188px;
    height: 44px;
    box-shadow: 0 12px 28px rgba(15, 35, 63, 0.12);
}

.legal-brand strong,
.legal-brand small {
    display: block;
    line-height: 1.1;
}

.legal-brand strong {
    font-size: 1.06rem;
    font-weight: 900;
}

.legal-brand small {
    margin-top: 0.22rem;
    color: var(--app-muted);
    font-size: 0.68rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.legal-nav-links,
.legal-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.75rem;
    align-items: center;
}

.legal-nav-links a,
.legal-footer a {
    font-weight: 800;
    text-decoration: none;
}

.legal-document {
    margin-top: 2rem;
    padding: 2.4rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    box-shadow: var(--app-shadow);
}

.legal-document h1 {
    margin-bottom: 1.5rem;
}

.legal-document h2 {
    margin-top: 2rem;
    margin-bottom: 0.8rem;
    font-size: 1.35rem;
}

.legal-document p,
.legal-document li {
    color: #344257;
    line-height: 1.72;
}

.legal-document ul {
    margin-top: 0.35rem;
    margin-bottom: 1rem;
    padding-left: 1.25rem;
}

.legal-eyebrow {
    margin-bottom: 0.55rem;
    color: var(--app-muted);
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.legal-footer {
    margin-top: 1.25rem;
    color: var(--app-muted);
    font-size: 0.9rem;
}

.privacy-notice-backdrop {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(7, 10, 18, 0.68);
}

.privacy-notice-panel {
    width: min(100%, 580px);
    padding: 1.6rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    box-shadow: 0 28px 82px rgba(0, 0, 0, 0.32);
}

.privacy-notice-panel h2 {
    margin-bottom: 1rem;
    font-size: 1.65rem;
}

.privacy-notice-panel p {
    color: #344257;
    line-height: 1.62;
}

.darker-border-checkbox.form-check-input {
    border-color: #9aa8b7;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.blazor-error-boundary {
    background: #b32121;
    color: #fff;
    padding: 1rem;
}

.blazor-error-boundary::after {
    content: "Si e verificato un errore.";
}

.template-page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.template-command-panel,
.template-list-panel,
.template-editor-panel {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface);
}

.template-command-panel {
    display: grid;
    grid-template-columns: minmax(260px, 0.75fr) minmax(420px, 1.25fr);
    gap: 1px;
    overflow: hidden;
    background: var(--app-border);
}

.template-command-block {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: var(--app-surface);
}

.template-command-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.65rem;
    align-items: end;
}

.template-command-row .form-label {
    grid-column: 1 / -1;
    margin-bottom: -0.25rem;
}

.template-import-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.template-import-button {
    grid-column: 1 / -1;
    justify-self: end;
    min-width: 110px;
}

.template-import-status {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: fit-content;
    padding: 0.55rem 0.75rem;
    border: 1px solid #bcd7f2;
    border-radius: var(--app-radius);
    background: #eef7ff;
    color: #174d7c;
    font-size: 0.9rem;
}

.template-workspace {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.template-list-panel,
.template-editor-panel {
    padding: 1rem;
}

.template-list-panel {
    position: sticky;
    top: 1rem;
}

.template-panel-title,
.template-editor-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.template-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.template-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    min-height: 48px;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface-strong);
    color: var(--app-ink);
    text-align: left;
}

.template-list-item:hover {
    border-color: #aac6df;
    background: #f2f8fd;
}

.template-list-item.active {
    border-color: var(--app-accent);
    background: #e9f4ff;
    color: #103a5f;
}

.template-list-item span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.template-list-item small {
    flex: 0 0 auto;
    color: var(--app-muted);
}

.template-editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.template-empty-state {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem;
    border: 1px dashed #b7c7d7;
    border-radius: var(--app-radius);
    background: var(--app-surface-strong);
    color: var(--app-muted);
}

.template-empty-state strong {
    color: var(--app-ink);
}

.template-editor-empty {
    min-height: 320px;
    justify-content: center;
    align-items: center;
    text-align: center;
}

@media (max-width: 760px) {
    h1 {
        font-size: 2rem;
    }

    .auth-shell {
        padding: 1rem;
    }

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

    .legal-shell {
        padding: 0.9rem 1rem 2rem;
    }

    .legal-nav {
        align-items: flex-start;
        flex-direction: column;
    }

    .legal-brand .tau-logo-card {
        width: 150px;
        height: 40px;
    }

    .legal-document {
        margin-top: 1.25rem;
        padding: 1.25rem;
    }

    .template-page-heading,
    .template-panel-title,
    .template-editor-header {
        align-items: stretch;
        flex-direction: column;
    }

    .template-command-panel,
    .template-workspace,
    .template-command-row,
    .template-import-grid {
        grid-template-columns: 1fr;
    }

    .template-list-panel {
        position: static;
    }

    .template-editor-actions {
        justify-content: flex-start;
    }
}
.template-editor {
    min-height: 360px;
}

.template-editor-panel .ql-toolbar.ql-snow {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
}

.template-editor-panel .ql-toolbar.ql-snow .ql-formats {
    display: inline-flex;
    align-items: center;
    margin-right: 0.35rem;
}

.template-editor-panel .ql-container.ql-snow .ql-editor {
    min-height: 360px;
}

.send-page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.send-page-stat {
    min-width: 132px;
    padding: 0.9rem 1rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    box-shadow: 0 10px 26px rgba(15, 35, 63, 0.05);
    text-align: right;
}

.send-page-stat span,
.send-page-stat small {
    display: block;
}

.send-page-stat span {
    font-size: 1.9rem;
    font-weight: 900;
    line-height: 1;
}

.send-page-stat small {
    margin-top: 0.3rem;
    color: var(--app-muted);
    font-size: 0.78rem;
    font-weight: 750;
}

.send-composer,
.send-preview-panel,
.send-history {
    background: var(--app-surface);
}

.send-filters {
    padding: 1rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface-strong);
}

.send-document-editor {
    min-height: 520px;
    background: #fff;
    border-radius: 0 0 var(--bs-border-radius) var(--bs-border-radius);
}

.send-document-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    padding: 0.65rem;
    border: 1px solid var(--app-border);
    border-bottom: 0;
    border-radius: var(--bs-border-radius) var(--bs-border-radius) 0 0;
    background: var(--app-surface-strong);
}

.send-document-toolbar-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
    padding-right: 0.5rem;
    border-right: 1px solid var(--app-border);
}

.send-document-toolbar-group:last-child {
    padding-right: 0;
    border-right: 0;
}

.send-document-toolbar .form-select {
    width: auto;
    min-width: 118px;
}

.send-document-toolbar .send-document-size-select {
    min-width: 108px;
}

.send-document-toolbar .btn {
    min-width: 34px;
}

.send-document-toolbar .btn.active,
.send-document-toolbar .btn[aria-pressed="true"] {
    border-color: var(--bs-primary);
    background: var(--bs-primary);
    color: #fff;
}

.send-document-color-control {
    display: inline-flex;
    width: 34px;
    height: 31px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--bs-secondary);
    border-radius: var(--bs-border-radius-sm);
    background: #fff;
    cursor: pointer;
}

.send-document-color-control input[type="color"] {
    width: 42px;
    height: 38px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.address-validation-card {
    padding: 0.95rem 1rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface-strong);
}

.address-validation-card-valid {
    border-color: rgba(25, 135, 84, 0.32);
    background: rgba(25, 135, 84, 0.06);
}

.address-validation-card-review {
    border-color: rgba(255, 193, 7, 0.42);
    background: rgba(255, 193, 7, 0.08);
}

.address-lookup {
    position: relative;
}

.address-lookup-input {
    position: relative;
}

.address-lookup-status {
    position: absolute;
    top: 50%;
    right: 0.7rem;
    transform: translateY(-50%);
    color: var(--app-muted);
    font-size: 0.78rem;
    font-weight: 750;
}

.address-lookup-menu {
    position: absolute;
    z-index: 20;
    width: 100%;
    max-height: 260px;
    overflow-y: auto;
    margin-top: 0.25rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    box-shadow: var(--app-shadow);
}

.address-lookup-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 0;
    border-bottom: 1px solid var(--app-border);
    background: transparent;
    color: var(--app-ink);
    text-align: left;
}

.address-lookup-result:hover,
.address-lookup-result:focus {
    background: var(--app-surface-strong);
}

.address-lookup-result:last-child {
    border-bottom: 0;
}

.address-lookup-result span {
    flex: 0 0 auto;
    color: var(--app-muted);
    font-size: 0.86rem;
}

.address-lookup-empty {
    padding: 0.7rem 0.75rem;
    color: var(--app-muted);
}

.sendings-table td {
    max-width: 280px;
}

.sendings-table .small {
    overflow-wrap: anywhere;
}

.dashboard-shell {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.dashboard-header h1 {
    margin-bottom: 0.45rem;
}

.dashboard-header p,
.dashboard-panel-header p {
    margin: 0;
    color: var(--app-muted);
}

.dashboard-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
}

.dashboard-loaded {
    color: var(--app-muted);
    font-size: 0.86rem;
    font-weight: 750;
}

.dashboard-loading {
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    color: var(--app-muted);
    font-weight: 800;
}

.dashboard-filters,
.dashboard-panel,
.dashboard-kpi,
.dashboard-note {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    box-shadow: 0 10px 26px rgba(15, 35, 63, 0.05);
}

.dashboard-filters {
    padding: 1rem;
}

.dashboard-filter-row {
    display: grid;
    grid-template-columns: repeat(6, minmax(145px, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.dashboard-filter-check {
    min-height: 2.55rem;
    display: flex;
    align-items: center;
}

.dashboard-filter-actions,
.dashboard-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.dashboard-filter-actions {
    margin-top: 0.85rem;
}

.dashboard-tabs {
    padding: 0.35rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface-strong);
}

.dashboard-tabs button {
    min-height: 2.3rem;
    padding: 0.45rem 0.75rem;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--app-muted);
    font-size: 0.9rem;
    font-weight: 850;
}

.dashboard-tabs button:hover,
.dashboard-tabs button:focus {
    background: #eaf3fb;
    color: var(--app-accent-strong);
}

.dashboard-tabs button.active {
    background: var(--app-surface);
    color: var(--app-ink);
    box-shadow: 0 6px 14px rgba(15, 35, 63, 0.08);
}

.dashboard-note {
    padding: 0.75rem 0.9rem;
    color: #6f4d08;
    background: #fff8e7;
    border-color: #f2d58a;
    font-size: 0.92rem;
    font-weight: 700;
}

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

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

.dashboard-panel {
    min-width: 0;
    padding: 1rem;
}

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

.dashboard-panel h2 {
    margin: 0;
    font-size: 1.08rem;
}

.dashboard-panel h3 {
    margin: 0 0 0.65rem;
    font-size: 0.95rem;
}

.dashboard-kpis {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.75rem;
}

.dashboard-kpis.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 1rem;
}

.dashboard-kpi {
    min-height: 108px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.95rem;
    border-top: 4px solid #92a3b8;
}

.dashboard-kpi span {
    color: var(--app-muted);
    font-size: 0.78rem;
    font-weight: 850;
    text-transform: uppercase;
}

.dashboard-kpi strong {
    display: block;
    margin-top: 0.4rem;
    color: var(--app-ink);
    font-size: clamp(1.35rem, 2vw, 1.9rem);
    line-height: 1;
}

.dashboard-kpi small {
    margin-top: 0.55rem;
    color: var(--app-muted);
    font-weight: 750;
}

.dashboard-kpi.primary {
    border-top-color: var(--app-accent);
}

.dashboard-kpi.success {
    border-top-color: var(--app-success);
}

.dashboard-kpi.warning {
    border-top-color: var(--app-warning);
}

.dashboard-kpi.danger {
    border-top-color: var(--app-danger);
}

.dashboard-chart {
    min-height: 300px;
}

.dashboard-chart svg {
    width: 100%;
    height: 260px;
    display: block;
    overflow: visible;
}

.dashboard-chart .grid line {
    stroke: #dfe8f1;
    stroke-width: 1;
}

.dashboard-chart polyline {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3.2;
    vector-effect: non-scaling-stroke;
}

.dashboard-chart polyline.revenue {
    stroke: var(--app-accent);
}

.dashboard-chart polyline.cost {
    stroke: #8b6f47;
}

.dashboard-chart polyline.margin {
    stroke: var(--app-success);
}

.dashboard-chart polyline.forecast {
    stroke-dasharray: 6 5;
}

.dashboard-chart circle {
    vector-effect: non-scaling-stroke;
}

.dashboard-chart .revenue-dot {
    fill: var(--app-accent);
}

.dashboard-chart .forecast-dot {
    fill: #8a4fd1;
}

.dashboard-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 1rem;
    margin-top: 0.35rem;
    color: var(--app-muted);
    font-size: 0.86rem;
    font-weight: 800;
}

.dashboard-chart-legend span::before {
    content: "";
    width: 0.7rem;
    height: 0.7rem;
    display: inline-block;
    margin-right: 0.35rem;
    border-radius: 999px;
    background: #92a3b8;
}

.dashboard-chart-legend .revenue::before {
    background: var(--app-accent);
}

.dashboard-chart-legend .cost::before {
    background: #8b6f47;
}

.dashboard-chart-legend .margin::before {
    background: var(--app-success);
}

.dashboard-chart-legend .forecast-dot-label::before {
    background: #8a4fd1;
}

.dashboard-anomalies,
.dashboard-ranking {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.dashboard-anomaly {
    padding: 0.75rem;
    border: 1px solid var(--app-border);
    border-left-width: 4px;
    border-radius: var(--app-radius);
    background: var(--app-surface-strong);
}

.dashboard-anomaly span {
    color: var(--app-muted);
    font-size: 0.72rem;
    font-weight: 850;
    text-transform: uppercase;
}

.dashboard-anomaly strong {
    display: block;
    margin-top: 0.15rem;
}

.dashboard-anomaly p {
    margin: 0.25rem 0 0;
    color: var(--app-muted);
    font-size: 0.9rem;
}

.dashboard-anomaly.warning {
    border-left-color: var(--app-warning);
}

.dashboard-anomaly.danger {
    border-left-color: var(--app-danger);
}

.dashboard-anomaly.info {
    border-left-color: var(--app-accent);
}

.dashboard-ranking button {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.6rem;
    align-items: center;
    width: 100%;
    padding: 0.55rem 0;
    border: 0;
    border-bottom: 1px solid var(--app-border);
    background: transparent;
    color: var(--app-ink);
    text-align: left;
}

.dashboard-ranking button:last-child {
    border-bottom: 0;
}

.dashboard-ranking span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 800;
}

.dashboard-ranking strong {
    font-weight: 900;
}

.dashboard-ranking em,
.dashboard-breakdown-row em {
    color: var(--app-muted);
    font-style: normal;
    font-size: 0.82rem;
    font-weight: 750;
}

.dashboard-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.dashboard-breakdown-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(120px, 2fr) auto auto;
    gap: 0.65rem;
    align-items: center;
}

.dashboard-breakdown-row span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 800;
}

.dashboard-breakdown-row div {
    height: 0.55rem;
    overflow: hidden;
    border-radius: 999px;
    background: #e8eef5;
}

.dashboard-breakdown-row i {
    display: block;
    height: 100%;
    min-width: 3px;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--app-accent), var(--app-success));
}

.dashboard-breakdown-row strong {
    min-width: 2.6rem;
    text-align: right;
}

.dashboard-month-bars {
    min-height: 260px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
    gap: 0.55rem;
    align-items: end;
}

.dashboard-month-bar {
    height: 240px;
    min-width: 0;
    display: grid;
    grid-template-rows: 1fr auto auto auto;
    gap: 0.35rem;
    align-items: end;
    padding: 0.55rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface-strong);
    color: var(--app-ink);
    text-align: center;
}

.dashboard-month-bar:hover,
.dashboard-month-bar:focus {
    border-color: var(--app-accent);
    background: #f2f8fd;
}

.dashboard-month-bar .bar {
    width: 100%;
    min-height: 4px;
    border-radius: 6px 6px 2px 2px;
    background: linear-gradient(180deg, var(--app-accent), var(--app-success));
}

.dashboard-month-bar strong {
    font-size: 0.86rem;
    line-height: 1.1;
}

.dashboard-month-bar small,
.dashboard-month-bar em {
    color: var(--app-muted);
    font-size: 0.75rem;
    font-style: normal;
    font-weight: 800;
}

.dashboard-heatmap {
    min-width: 720px;
    overflow-x: auto;
}

.dashboard-heatmap-head,
.dashboard-heatmap-row {
    display: grid;
    grid-template-columns: minmax(180px, 1.4fr) repeat(var(--month-count, 12), minmax(52px, 1fr));
    gap: 0.35rem;
    align-items: center;
    margin-bottom: 0.35rem;
}

.dashboard-heatmap-head strong {
    color: var(--app-muted);
    font-size: 0.72rem;
    text-align: center;
    text-transform: uppercase;
}

.dashboard-heatmap .customer-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 0;
    background: transparent;
    color: var(--app-ink);
    text-align: left;
    font-weight: 850;
}

.heat-cell {
    min-height: 34px;
    border: 1px solid rgba(32, 114, 184, 0.18);
    border-radius: 7px;
    background: color-mix(in srgb, var(--app-accent) calc(var(--intensity) * 78%), #f3f7fb);
    color: var(--app-ink);
    font-size: 0.78rem;
    font-weight: 900;
}

.heat-cell:hover,
.heat-cell:focus {
    outline: 2px solid var(--app-accent);
    outline-offset: 1px;
}

.dashboard-risk,
.dashboard-status {
    display: inline-flex;
    align-items: center;
    min-height: 1.6rem;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 850;
}

.dashboard-risk.basso,
.dashboard-status.ok {
    color: #0f5132;
    background: #dff3e8;
}

.dashboard-risk.medio,
.dashboard-status.warning {
    color: #6f4d08;
    background: #fff1c7;
}

.dashboard-risk.alto {
    color: #842029;
    background: #f8d7da;
}

.dashboard-table-scroll {
    max-height: 430px;
    overflow: auto;
}

.dashboard-drilldown {
    border-color: #b7cfe6;
    background: #fbfdff;
}

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

.invoice-shell {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.invoice-header,
.invoice-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.invoice-header h1 {
    margin-bottom: 0.45rem;
}

.invoice-header p,
.invoice-panel-header p {
    margin: 0;
    color: var(--app-muted);
}

.invoice-header-actions,
.invoice-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: flex-end;
    gap: 0.65rem;
}

.invoice-toolbar,
.invoice-panel,
.invoice-kpi {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    box-shadow: 0 10px 26px rgba(15, 35, 63, 0.05);
}

.invoice-toolbar {
    display: grid;
    grid-template-columns: minmax(180px, 230px) minmax(260px, 1fr) auto;
    gap: 1rem;
    align-items: end;
    padding: 1rem;
}

.invoice-kpis {
    display: grid;
    grid-template-columns: 1.15fr repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.invoice-kpi {
    min-height: 92px;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.95rem 1rem;
}

.invoice-kpi-icon {
    width: 3.1rem;
    height: 3.1rem;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 1px solid rgba(32, 114, 184, 0.32);
    border-radius: 999px;
    color: var(--app-accent);
    background: #f4f9fe;
}

.invoice-kpi-icon::before {
    font-weight: 900;
    line-height: 1;
}

.invoice-kpi.send .invoice-kpi-icon {
    color: #fff;
    background: linear-gradient(135deg, var(--app-accent), var(--app-accent-strong));
    border-color: transparent;
    box-shadow: 0 12px 24px rgba(32, 114, 184, 0.26);
}

.invoice-kpi.send .invoice-kpi-icon::before {
    content: "R";
}

.invoice-kpi.customers .invoice-kpi-icon::before {
    content: "C";
}

.invoice-kpi.money .invoice-kpi-icon,
.invoice-kpi.total .invoice-kpi-icon {
    border-color: rgba(22, 124, 88, 0.34);
    color: var(--app-success);
    background: #f3fbf7;
}

.invoice-kpi.money .invoice-kpi-icon::before,
.invoice-kpi.total .invoice-kpi-icon::before {
    content: "€";
    font-size: 1.35rem;
}

.invoice-kpi.vat .invoice-kpi-icon::before {
    content: "%";
    font-size: 1.25rem;
}

.invoice-kpi span:not(.invoice-kpi-icon) {
    color: var(--app-muted);
    font-size: 0.76rem;
    font-weight: 850;
    text-transform: uppercase;
}

.invoice-kpi strong {
    display: block;
    color: var(--app-ink);
    font-size: clamp(1.25rem, 1.7vw, 1.7rem);
    line-height: 1.05;
}

.invoice-kpi small {
    color: var(--app-muted);
    font-weight: 750;
}

.invoice-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(560px, 0.95fr);
    gap: 1rem;
    align-items: start;
}

.invoice-panel {
    min-width: 0;
    padding: 1rem;
}

.invoice-panel-header {
    margin-bottom: 0.9rem;
}

.invoice-panel h2 {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 850;
    text-transform: uppercase;
}

.invoice-table td,
.invoice-table th {
    white-space: nowrap;
}

.invoice-row-warning {
    --bs-table-bg: #fff8ee;
}

.invoice-status-ready,
.invoice-status-warning,
.invoice-status-muted {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 1.65rem;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 850;
}

.invoice-status-ready {
    color: #0f5132;
    background: #dff3e8;
    border: 1px solid #b9e2cc;
}

.invoice-status-warning {
    color: #9a3f00;
    background: #fff3df;
    border: 1px solid #f2c489;
}

.invoice-status-muted {
    color: var(--app-muted);
    background: #eef3f8;
    border: 1px solid var(--app-border);
}

.invoice-kpi.money .invoice-kpi-icon::before,
.invoice-kpi.total .invoice-kpi-icon::before {
    content: "EUR";
    font-size: .78rem;
}

.invoice-status-ready span[aria-hidden="true"] {
    display: none;
}

.invoice-status-ready::before {
    content: "OK";
    font-weight: 900;
}

.invoice-detail {
    overflow: hidden;
}

.invoice-detail-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: .5rem;
}

.invoice-profile-layout {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.invoice-profile-list {
    position: sticky;
    top: 1rem;
}

.invoice-profile-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.invoice-profile-buttons button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface-strong);
    color: var(--app-ink);
    text-align: left;
}

.invoice-profile-buttons button:hover,
.invoice-profile-buttons button:focus {
    border-color: #aac6df;
    background: #f2f8fd;
}

.invoice-profile-buttons button.active {
    border-color: var(--app-accent);
    background: #e9f4ff;
}

.invoice-profile-buttons span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 850;
}

.invoice-profile-buttons small {
    flex: 0 0 auto;
    font-weight: 800;
}

.invoice-profile-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
}

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

@media (max-width: 1180px) {
    .invoice-main-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .send-page-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .send-page-stat {
        text-align: left;
    }

    .dashboard-header,
    .dashboard-panel-header,
    .dashboard-drilldown-grid {
        align-items: stretch;
        flex-direction: column;
        grid-template-columns: 1fr;
    }

    .dashboard-filter-row,
    .dashboard-grid,
    .dashboard-kpis,
    .dashboard-kpis.compact {
        grid-template-columns: 1fr;
    }

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

    .dashboard-breakdown-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .dashboard-breakdown-row div,
    .dashboard-breakdown-row em {
        grid-column: 1 / -1;
    }

    .dashboard-month-bars {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-heatmap {
        min-width: 100%;
    }

    .invoice-header,
    .invoice-panel-header,
    .invoice-header-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .invoice-toolbar,
    .invoice-kpis,
    .invoice-main-grid,
    .invoice-profile-layout,
    .invoice-profile-grid {
        grid-template-columns: 1fr;
    }

    .invoice-toolbar-actions {
        justify-content: flex-start;
    }

    .invoice-kpi {
        min-height: 82px;
    }

    .invoice-profile-list {
        position: static;
    }

    .invoice-profile-span {
        grid-column: auto;
    }
}
