/* Sivis ERP - Design system */
:root {
    --primary: #0A6174;
    --primary-hover: #0d7a90;
    --primary-dark: #084d5c;
    --primary-light: rgba(10, 97, 116, 0.12);
    --danger: #dc3545;
    --danger-hover: #c82333;
    --surface: #f8fafb;
    --surface-card: #ffffff;
    --text: #1a2b33;
    --text-muted: #5f737c;
    --border: #e2e8ec;
    --sidebar-width: 280px;
    --header-height: 56px;
    --radius: 10px;
    --shadow: 0 2px 12px rgba(10, 97, 116, 0.08);
    --shadow-lg: 0 8px 30px rgba(10, 97, 116, 0.12);
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background: var(--surface);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text);
    margin-top: 0;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
}

/* Main app shell: content left, sidebar right */
.app-shell {
    display: flex;
    min-height: 100vh;
    flex-direction: row;
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 2rem 2rem;
    margin-left: var(--sidebar-width);
}

/* Sidebar (left) */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.sidebar-brand {
    padding: 1.5rem 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    padding: 1rem 0;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border-left: 3px solid #fff;
    margin-left: 0;
    padding-left: calc(1.5rem - 3px);
}

.sidebar-nav .nav-icon {
    width: 22px;
    height: 22px;
    opacity: 0.9;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-nav .nav-icon svg {
    width: 20px;
    height: 20px;
}

/* Sidebar: parent item con sotto-menu */
.sidebar-nav-parent {
    margin-bottom: 0;
}

.sidebar-nav .nav-link-parent {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s, color 0.2s;
}

.sidebar-nav .nav-link-parent:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-nav .nav-link-parent .nav-chevron {
    margin-left: auto;
    width: 18px;
    height: 18px;
    opacity: 0.8;
    transition: transform 0.2s;
}

.sidebar-nav .nav-link-parent.open .nav-chevron {
    transform: rotate(180deg);
}

.sidebar-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out;
}

.sidebar-submenu.open {
    max-height: 140px;
}

.sidebar-nav .nav-link-sub {
    padding-left: calc(1.5rem + 22px + 0.75rem);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    font-size: 0.9375rem;
}

.sidebar-nav .nav-link-sub .nav-icon {
    width: 18px;
    height: 18px;
}

.sidebar-nav .nav-link-sub .nav-icon svg {
    width: 16px;
    height: 16px;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Cards */
.card-sivis {
    background: var(--surface-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 1.5rem;
}

a.card-sivis {
    display: block;
    transition: box-shadow 0.2s, border-color 0.2s;
}

a.card-sivis:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

/* Buttons */
.btn-primary-sivis {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: background 0.2s;
}

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

.btn-primary-sivis:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary-sivis {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-secondary-sivis:hover {
    background: var(--border);
}

.btn-danger-sivis {
    background: #dc3545;
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-danger-sivis:hover {
    background: #c82333;
}

/* Link-style buttons for table actions (Modifica/Elimina) */
.btn-link-sivis {
    background: transparent;
    border: 1px solid currentColor;
    color: var(--primary);
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    white-space: nowrap;
}

.btn-link-sivis:hover {
    background: rgba(0, 0, 0, 0.04);
}

.btn-link-sivis:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem 1.5rem;
}

.form-grid .full-width {
    grid-column: 1 / -1;
}

.crud-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Full-screen popup modal */
.popup-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--surface-card);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.popup-fullscreen .popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}

.popup-fullscreen .popup-title {
    margin: 0;
    font-size: 1.25rem;
}

.popup-fullscreen .popup-close {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.popup-fullscreen .popup-close:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.popup-fullscreen .popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem 2rem;
}

/* Tabs */
.tabs-sivis {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
}

.tabs-sivis .tab-btn {
    padding: 0.75rem 1.25rem;
    border: none;
    background: none;
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    margin-bottom: -2px;
    border-bottom: 2px solid transparent;
    transition: color 0.2s;
}

.tabs-sivis .tab-btn:hover {
    color: var(--primary);
}

.tabs-sivis .tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Form inputs */
.input-sivis {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--surface-card);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-sivis:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.input-sivis::placeholder {
    color: var(--text-muted);
}

label.input-label {
    display: block;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.375rem;
    font-size: 0.9375rem;
}

/* Tables */
.table-sivis {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.table-sivis th,
.table-sivis td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table-sivis th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--surface);
}

.table-sivis tbody tr:hover {
    background: var(--primary-light);
}

/* Riga contratto storico (dopo trasformazione) */
.table-sivis tbody tr.riga-storico {
    background: rgba(0, 0, 0, 0.02);
}

.table-sivis tbody tr.riga-storico:hover {
    background: var(--primary-light);
}

.table-sivis .table-icon {
    width: 20px;
    height: 20px;
    color: var(--primary);
    vertical-align: middle;
    margin-right: 0.5rem;
}

/* Tabella contratti – colonna Azioni con più pulsanti compatti */
.table-sivis .th-azioni {
    min-width: 320px;
    white-space: nowrap;
}

.table-sivis .td-azioni {
    vertical-align: middle;
}

.azioni-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.btn-azione {
    padding: 0.35rem 0.6rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

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

.btn-azione-secondary:hover {
    background: var(--border);
}

.btn-azione-cessazione {
    background: rgba(220, 53, 69, 0.08);
    color: #b02a37;
    border-color: rgba(220, 53, 69, 0.3);
}

.btn-azione-cessazione:hover {
    background: rgba(220, 53, 69, 0.15);
}

.btn-azione-danger {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border-color: rgba(220, 53, 69, 0.25);
}

.btn-azione-danger:hover {
    background: rgba(220, 53, 69, 0.2);
}

.pannello-azione-contratto {
    padding: 1rem 1.25rem;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.page-header .page-title-icon {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

/* Dashboard – hero */
.dashboard-hero {
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(10, 97, 116, 0.06) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
}

.dashboard-hero-content {
    max-width: 640px;
}

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

.dashboard-hero-subtitle {
    margin: 0.35rem 0 0;
    font-size: 1rem;
    color: var(--text-muted);
}

/* Dashboard – grid layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.dashboard-main {
    min-width: 0;
}

/* Dashboard – numeri chiave */
.dashboard-stats-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.dashboard-stat-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 1.25rem 1.5rem;
    min-width: 140px;
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}

.dashboard-stat-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.dashboard-stat-card-muted .dashboard-stat-number {
    color: var(--text-muted);
}

.dashboard-stat-icon {
    width: 28px;
    height: 28px;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.dashboard-stat-icon svg {
    width: 100%;
    height: 100%;
}

.dashboard-stat-number {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.dashboard-stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Dashboard – grafici */
.dashboard-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 700px) {
    .dashboard-charts-row {
        grid-template-columns: 1fr;
    }
}

.dashboard-chart-card {
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem;
}

.dashboard-chart-title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.dashboard-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.dashboard-bar-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 0.75rem;
}

.dashboard-bar-label {
    font-size: 0.8125rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.dashboard-bar-track {
    height: 8px;
    background: var(--surface);
    border-radius: 999px;
    overflow: hidden;
    min-width: 60px;
}

.dashboard-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-hover) 100%);
    border-radius: 999px;
    transition: width 0.5s ease-out;
}

.dashboard-bar-value {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary);
    min-width: 1.5rem;
    text-align: right;
}

/* Dashboard – donut */
.dashboard-donut-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.dashboard-donut {
    position: relative;
    width: 160px;
    height: 160px;
}

.dashboard-donut-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.dashboard-donut-bg {
    fill: none;
    stroke: var(--surface);
    stroke-width: 3.2;
}

.dashboard-donut-segment {
    fill: none;
    stroke-width: 3.2;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease-out;
}

.dashboard-donut-attuali {
    stroke: var(--primary);
}

.dashboard-donut-cessati {
    stroke: var(--text-muted);
    opacity: 0.85;
}

.dashboard-donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.dashboard-donut-total {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.dashboard-donut-total-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.dashboard-donut-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.dashboard-donut-legend-item {
    font-size: 0.875rem;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.dashboard-donut-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dashboard-donut-legend-dot.dashboard-donut-attuali {
    background: var(--primary);
}

.dashboard-donut-legend-dot.dashboard-donut-cessati {
    background: var(--text-muted);
}

/* Dashboard – sidebar accesso rapido */
.dashboard-sidebar {
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem;
    position: sticky;
    top: calc(var(--header-height) + 1rem);
}

.dashboard-sidebar-title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.dashboard-quick-links {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.dashboard-quick-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    font-size: 0.9375rem;
    transition: background 0.2s, color 0.2s;
}

.dashboard-quick-link:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.dashboard-quick-link-icon {
    width: 22px;
    height: 22px;
    color: var(--primary);
    flex-shrink: 0;
}

.dashboard-quick-link-icon svg {
    width: 100%;
    height: 100%;
}

/* Users page – search bar */
.users-search-wrap {
    margin-top: 1.5rem;
}

.users-search-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 520px;
    padding: 0 1rem 0 1rem;
    background: var(--surface-card);
    border: 2px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(10, 97, 116, 0.06);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.users-search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.users-search-icon {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.users-search-input {
    flex: 1;
    min-width: 0;
    padding: 0.875rem 0;
    border: none;
    background: none;
    font-size: 1rem;
    color: var(--text);
    font-family: inherit;
}

.users-search-input::placeholder {
    color: var(--text-muted);
}

.users-search-input:focus {
    outline: none;
}

.users-search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: var(--surface);
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.users-search-clear:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.users-search-clear svg {
    width: 16px;
    height: 16px;
}

.users-search-result-hint {
    margin: 0.5rem 0 0 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Global search (layout) */
.global-search-wrap {
    position: relative;
    max-width: 560px;
    width: 100%;
    margin-bottom: 1rem;
}

.global-search-input {
    width: 100%;
    padding: 0.65rem 0.875rem 0.65rem 2.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--surface-card);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.global-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.global-search-input::placeholder {
    color: var(--text-muted);
}

.global-search-icon-wrap {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.global-search-icon-wrap svg {
    width: 18px;
    height: 18px;
}

.global-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    max-height: 320px;
    overflow-y: auto;
    z-index: 200;
}

.global-search-result-item {
    display: block;
    width: 100%;
    padding: 0.6rem 0.75rem;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border);
}

.global-search-result-item:last-child {
    border-bottom: none;
}

.global-search-result-item:hover {
    background: var(--primary-light);
}

.global-search-result-item .result-title {
    font-weight: 500;
    display: block;
}

.global-search-result-item .result-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.global-search-result-item .result-kind {
    font-size: 0.75rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.2rem;
}

/* Changelog trigger icon (small, non-intrusive) */
.changelog-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.changelog-trigger:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.changelog-trigger svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 767px) {
    .global-search-wrap {
        max-width: none;
    }
}

/* Report page – filter panel */
.report-filters-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(10, 97, 116, 0.04);
}

.report-filters-panel .report-panel-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.report-type-row {
    margin-bottom: 1.5rem;
}

.report-type-row .input-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.report-type-row .input-sivis {
    max-width: 280px;
    padding: 0.625rem 2rem 0.625rem 1rem;
    font-weight: 500;
    background: var(--surface-card);
    border: 2px solid var(--border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.report-type-row .input-sivis:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.report-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem 1.75rem;
}

.report-filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.report-filter-field .input-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0;
}

.report-filter-field .input-sivis {
    padding: 0.625rem 0.875rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-card);
    font-size: 0.9375rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.report-filter-field .input-sivis:hover {
    border-color: #c5d1d8;
}

.report-filter-field .input-sivis:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.report-filter-group {
    margin-top: 1.25rem;
}

.report-filter-group:first-child {
    margin-top: 0;
}

.report-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.report-date-presets {
    grid-column: 1 / -1;
}

.report-preset-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.report-preset-chip {
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-card);
    color: var(--text);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.report-preset-chip:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.report-preview-wrap {
    margin-top: 0.5rem;
}

.report-empty-state {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.report-empty-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin: 0 auto 1rem;
    display: block;
}

.report-empty-title {
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.25rem;
    font-size: 1.125rem;
}

.report-empty-hint {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.9375rem;
}

/* Report documenti: tipologie multiple (checkbox) */
.report-doc-tipologie {
    grid-column: 1 / -1;
}
.report-doc-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}
.report-doc-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--text);
}
.report-doc-checkbox input {
    width: 1rem;
    height: 1rem;
}

/* Solo la cella Scadenza in rosso se scaduto/in scadenza */
.report-doc-cell-scaduta {
    background-color: #fef2f2;
    color: #b91c1c;
    font-weight: 600;
    border-left: 2px solid #dc2626;
}

.table-sortable .th-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.table-sortable .th-sortable:hover {
    color: var(--primary);
}

.doc-scadenza-scaduto {
    color: #c53030;
    font-weight: 600;
}

.doc-scadenza-ok {
    color: var(--text-muted);
}

/* Blazor error UI */
#blazor-error-ui {
    color-scheme: light only;
    background: #b32121;
    color: #fff;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Validation */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

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

.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;
}

h1:focus {
    outline: none;
}

/* Login page */
.login-box {
    width: 100%;
    max-width: 420px;
    background: var(--surface-card);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    padding: 2.5rem;
}

.login-box .login-logo {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-box .login-logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
    letter-spacing: -0.03em;
}

.login-box .login-logo p {
    margin: 0.375rem 0 0;
    font-size: 0.9375rem;
    color: var(--text-muted);
}

.login-box .form-group {
    margin-bottom: 1.25rem;
}

.login-box .btn-submit {
    width: 100%;
    padding: 0.875rem 1.5rem;
    margin-top: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.login-box .btn-submit:hover {
    background: var(--primary-hover);
}

.login-box .login-error {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(229, 0, 0, 0.08);
    border-radius: 8px;
    color: #c00;
    font-size: 0.9375rem;
}

/* Licenza e Poligono: date inputs and displayed dates more readable */
.licenza-poligono-dates input[type="date"],
.licenza-poligono-dates input.input-sivis,
.licenza-poligono-dates .input-sivis {
    font-size: 1rem !important;
    min-width: 160px;
    padding: 0.5rem 0.6rem;
    line-height: 1.35;
}
.licenza-poligono-dates .date-range-display {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
}
.licenza-poligono-dates .tiri-date-item {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
}

/* ========== RESPONSIVE: tablet e telefono ========== */

/* Barra superiore mobile: hamburger + titolo (visibile solo sotto 992px) */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #fff;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem;
    z-index: 101;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.mobile-topbar .sidebar-toggle {
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.mobile-topbar .sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
}

.mobile-topbar .sidebar-toggle svg {
    width: 24px;
    height: 24px;
}

.mobile-topbar .mobile-title {
    font-weight: 600;
    font-size: 1.125rem;
    margin: 0;
}

/* Overlay quando la sidebar è aperta su mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
    transition: opacity 0.2s;
}

.sidebar-overlay.open {
    display: block;
}

/* Wrapper tabelle: scroll orizzontale su tutti i dispositivi */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-wrap .table-sivis {
    min-width: 600px;
}

/* Tab responsive: scroll orizzontale se molte tab */
.tabs-sivis {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
}

.tabs-sivis .tab-btn {
    white-space: nowrap;
    flex-shrink: 0;
}

@media (max-width: 991px) {
    .app-main {
        margin-left: 0;
        padding: 1rem;
        padding-top: calc(var(--header-height) + 1rem);
    }

    .app-sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease-out;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
    }

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

    .mobile-topbar {
        display: flex;
    }
}

@media (max-width: 767px) {
    .app-main {
        padding: 0.75rem;
        padding-top: calc(var(--header-height) + 0.75rem);
    }

    .card-sivis {
        padding: 1rem;
    }

    .page-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .page-header h1 {
        font-size: 1.35rem;
    }

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

    .report-filters-panel {
        padding: 1rem 1.25rem;
    }

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

    .report-type-row .input-sivis {
        max-width: none;
    }

    .report-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .report-actions .btn-primary-sivis,
    .report-actions .btn-secondary-sivis {
        width: 100%;
    }

    .popup-fullscreen .popup-body {
        padding: 1rem;
    }

    .popup-fullscreen .popup-header {
        padding: 0.75rem 1rem;
    }

    .crud-actions {
        flex-direction: column;
    }

    .crud-actions .btn-primary-sivis,
    .crud-actions .btn-secondary-sivis,
    .crud-actions .btn-danger-sivis {
        width: 100%;
    }

    .table-sivis th,
    .table-sivis td {
        padding: 0.625rem 0.5rem;
        font-size: 0.875rem;
    }

    .table-sivis .th-azioni {
        min-width: 200px;
    }

    .azioni-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-azione {
        width: 100%;
    }

    .users-search-bar {
        max-width: none;
    }

    .login-box {
        margin: 1rem;
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .app-main {
        padding: 0.5rem;
        padding-top: calc(var(--header-height) + 0.5rem);
    }

    .card-sivis {
        padding: 0.75rem;
    }

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

    .page-header .page-title-icon {
        width: 28px;
        height: 28px;
    }

    .btn-primary-sivis {
        width: 100%;
    }

    .report-filters-panel {
        padding: 0.75rem 1rem;
    }

    .report-preset-chips {
        flex-direction: column;
    }

    .report-preset-chip {
        width: 100%;
        text-align: center;
    }

    .table-sivis th,
    .table-sivis td {
        padding: 0.5rem 0.35rem;
        font-size: 0.8125rem;
    }
}

/* --- CRM: panoramica, contatti, form modale --- */
.crm-overview-wrap {
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.crm-overview-hero {
    position: relative;
    padding: 2rem 2rem 1.75rem;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 42%, #0a8fa8 100%);
    color: #fff;
}

.crm-overview-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 60% at 100% 0%, rgba(255, 255, 255, 0.12), transparent 55%);
    pointer-events: none;
}

.crm-overview-hero-inner {
    position: relative;
    z-index: 1;
    max-width: 720px;
}

.crm-overview-kicker {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    opacity: 0.85;
    margin: 0 0 0.5rem;
    font-weight: 600;
}

.crm-overview-title {
    margin: 0 0 0.5rem;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #fff;
}

.crm-overview-desc {
    margin: 0;
    font-size: 1rem;
    line-height: 1.55;
    opacity: 0.92;
    color: rgba(255, 255, 255, 0.95);
}

.crm-overview-stats {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    padding: 1.25rem 2rem 1.75rem;
    background: var(--surface-card);
    border-bottom: 1px solid var(--border);
}

.crm-stat {
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
}

.crm-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.crm-stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.crm-modules {
    padding: 1.75rem 2rem 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.crm-module-card {
    display: flex;
    flex-direction: column;
    padding: 1.35rem 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface-card);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
    position: relative;
    overflow: hidden;
}

.crm-module-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.2s;
}

.crm-module-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}

.crm-module-card:hover::before {
    opacity: 1;
}

.crm-module-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.crm-module-card h2 {
    font-size: 1.15rem;
    margin: 0 0 0.5rem;
}

.crm-module-card p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    flex: 1;
}

.crm-module-cta {
    margin-top: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.crm-module-card:hover .crm-module-cta {
    color: var(--primary-hover);
}

.crm-overview-footnote {
    padding: 0 2rem 1.75rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

/* Contatti: toolbar e tabella */
.crm-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    margin: 1.25rem 0 1.5rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-card) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.crm-toolbar-field {
    flex: 1;
    min-width: 200px;
}

.crm-toolbar-field--narrow {
    flex: 0 1 200px;
    min-width: 160px;
}

.crm-search-wrap {
    position: relative;
}

.crm-search-wrap .crm-search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.crm-search-wrap input.input-sivis {
    padding-left: 2.5rem;
}

.crm-contacts-table-wrap {
    margin-top: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table-sivis.crm-contacts-table tbody tr {
    transition: background 0.15s;
}

.table-sivis.crm-contacts-table tbody tr:hover {
    background: var(--primary-light);
}

.crm-lead-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    white-space: nowrap;
}

.crm-lead--new {
    background: rgba(99, 102, 241, 0.15);
    color: #4338ca;
}

.crm-lead--contacted {
    background: rgba(14, 165, 233, 0.15);
    color: #0369a1;
}

.crm-lead--qualified {
    background: rgba(245, 158, 11, 0.18);
    color: #b45309;
}

.crm-lead--customer {
    background: rgba(34, 197, 94, 0.18);
    color: #15803d;
}

.crm-lead--lost {
    background: rgba(148, 163, 184, 0.25);
    color: #475569;
}

.crm-tag-pill {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    margin: 0 0.2rem 0.2rem 0;
    background: color-mix(in srgb, var(--tag-bg) 16%, transparent);
    color: var(--text-muted);
    border: 1px solid color-mix(in srgb, var(--tag-bg) 32%, transparent);
}

/* Form modale contatto */
.popup-fullscreen.crm-contact-popup .popup-header {
    padding: 1.25rem 1.75rem;
    border-bottom: none;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #0d7a90 100%);
    color: #fff;
}

.popup-fullscreen.crm-contact-popup .popup-title {
    color: #fff;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.popup-fullscreen.crm-contact-popup .popup-close {
    color: rgba(255, 255, 255, 0.85);
}

.popup-fullscreen.crm-contact-popup .popup-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.crm-popup-head {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.crm-popup-avatar {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.crm-popup-sub {
    margin: 0.2rem 0 0;
    font-size: 0.875rem;
    opacity: 0.88;
    font-weight: 400;
}

.popup-fullscreen.crm-contact-popup .popup-body {
    padding: 1.75rem 2rem 2.5rem;
    background: linear-gradient(180deg, #f0f7f9 0%, var(--surface) 120px);
}

.crm-form-section {
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.35rem;
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(10, 97, 116, 0.06);
}

.crm-form-section:last-of-type {
    margin-bottom: 0;
}

.crm-form-section-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0 0 1.1rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.crm-form-section-title svg {
    flex-shrink: 0;
    color: var(--primary);
    opacity: 0.95;
}

.crm-form-section .form-grid {
    gap: 0.9rem 1.25rem;
}

.crm-form-section .input-label {
    font-size: 0.8125rem;
}

.crm-tag-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.crm-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.crm-tag-chip:hover {
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    color: var(--text);
}

.crm-tag-chip.is-on {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
    box-shadow: 0 0 0 1px rgba(10, 97, 116, 0.08);
}

.crm-tag-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.crm-form-footer {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

@media (max-width: 640px) {
    .crm-overview-hero {
        padding: 1.5rem 1.25rem 1.25rem;
    }

    .crm-overview-stats,
    .crm-modules,
    .crm-overview-footnote {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .popup-fullscreen.crm-contact-popup .popup-body {
        padding: 1.25rem 1rem 2rem;
    }
}
