:root {
    --bg: #f4f1e8;
    --panel: #fffdfa;
    --line: #d9d0c2;
    --text: #24323d;
    --muted: #66737d;
    --primary: #b22222;
    --primary-dark: #861a1a;
    --success: #1f7a4d;
    --warning: #9a6700;
    --danger: #a12f2f;
    --light: #eef1f4;
    --shadow: 0 18px 35px rgba(36, 50, 61, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(178, 34, 34, 0.08), transparent 32%),
        linear-gradient(180deg, #faf7f0 0%, var(--bg) 100%);
    color: var(--text);
    overflow-x: hidden;
}

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

img {
    max-width: 100%;
}

code,
pre {
    font-family: Consolas, "Courier New", monospace;
}

.shell {
    max-width: 1440px;
    margin: 0 auto;
    padding: 1rem;
}

.topbar,
.nav,
.panel,
.metric {
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.topbar {
    border-radius: 1.25rem;
    padding: 1.2rem 1.4rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.topbar h1 {
    margin: 0;
    font-size: 1.6rem;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav {
    margin-top: 1rem;
    border-radius: 999px;
    padding: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.nav a {
    padding: 0.65rem 1rem;
    border-radius: 999px;
    color: var(--text);
    font-weight: 600;
}

.nav .nav-disabled {
    padding: 0.65rem 1rem;
    border-radius: 999px;
    color: #8b949d;
    font-weight: 600;
    background: #e7ebef;
    cursor: not-allowed;
}

.nav a.active,
.nav a:hover {
    background: var(--primary);
    color: #fff;
}

.content {
    margin-top: 1rem;
    display: grid;
    gap: 1rem;
    min-width: 0;
}

.panel {
    border-radius: 1.25rem;
    padding: 1.2rem;
    min-width: 0;
}

.panel h2,
.panel h3 {
    margin-top: 0;
}

.nested-panel {
    margin-top: 1rem;
    background: rgba(244, 241, 232, 0.55);
    border-radius: 1rem;
    padding: 1rem;
}

.panel-head,
.stack-inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
}

.split {
    display: grid;
    gap: 1rem;
}

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

.split-main {
    grid-template-columns: minmax(0, 1.8fr) minmax(320px, 0.9fr);
}

.grid {
    display: grid;
    gap: 1rem;
}

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

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

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

.compact-grid {
    gap: 0.75rem;
}

.metric {
    border-radius: 1rem;
    padding: 1rem;
}

.metric span {
    color: var(--muted);
    display: block;
    margin-bottom: 0.35rem;
}

.metric strong {
    font-size: 2rem;
}

.stack {
    display: grid;
    gap: 1rem;
    min-width: 0;
}

label {
    display: grid;
    gap: 0.35rem;
    font-weight: 600;
}

label span {
    font-size: 0.95rem;
}

.field-invalid input,
.field-invalid select,
.field-invalid textarea,
.field-invalid-section {
    border-color: rgba(161, 47, 47, 0.55);
}

.field-invalid input,
.field-invalid select,
.field-invalid textarea {
    box-shadow: 0 0 0 3px rgba(161, 47, 47, 0.08);
}

.field-error {
    color: var(--danger);
    font-size: 0.84rem;
    font-weight: 700;
}

.field-invalid-section {
    border: 1px solid rgba(161, 47, 47, 0.3);
    border-radius: 1rem;
    padding: 0.9rem;
    background: rgba(161, 47, 47, 0.03);
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cbbfab;
    border-radius: 0.9rem;
    padding: 0.75rem 0.9rem;
    background: #fff;
    color: var(--text);
}

textarea {
    resize: vertical;
}

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

.checkbox-row input {
    width: auto;
}

.btn {
    border: none;
    border-radius: 999px;
    padding: 0.8rem 1.2rem;
    background: #d8dde2;
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

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

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-warning {
    background: #f0b323;
    color: #1f2428;
}

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

.btn-light {
    background: var(--light);
}

.btn-disabled {
    background: #d7dde3;
    color: #7a8690;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-xs {
    padding: 0.42rem 0.9rem;
    font-size: 0.82rem;
}

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

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-open {
    background: rgba(31, 122, 77, 0.12);
    color: var(--success);
}

.badge-in_progress {
    background: rgba(154, 103, 0, 0.12);
    color: var(--warning);
}

.badge-closed {
    background: rgba(161, 47, 47, 0.12);
    color: var(--danger);
}

.badge-warning {
    background: rgba(240, 179, 35, 0.2);
    color: #755200;
}

.badge-light {
    background: rgba(36, 50, 61, 0.08);
    color: var(--text);
}

.subtle {
    color: var(--muted);
    margin: 0.2rem 0 0;
}

.flash {
    border-radius: 1rem;
    padding: 0.9rem 1rem;
    font-weight: 600;
}

.flash-success {
    background: rgba(31, 122, 77, 0.12);
    color: var(--success);
}

.flash-error {
    background: rgba(161, 47, 47, 0.12);
    color: var(--danger);
}

.flash-warning {
    background: rgba(240, 179, 35, 0.2);
    color: #755200;
}

.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
}

.export-head {
    align-items: center;
}

.export-summary-grid .metric strong {
    font-size: 1.6rem;
}

.export-filters {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.9rem;
    align-items: end;
}

.export-filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding-bottom: 0.55rem;
}

.export-filter-checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.export-filter-checkbox input[type="hidden"] {
    display: none;
}

.export-filter-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.6rem;
    padding-bottom: 0.1rem;
}

.export-table td {
    vertical-align: top;
}

.export-preview-panel {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.export-table-wrap {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.export-table {
    min-width: 1900px;
}

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

th,
td {
    padding: 0.85rem 0.6rem;
    border-bottom: 1px solid #e3dbcf;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

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

.crew-card {
    border: 1px solid #e2d6c7;
    border-radius: 1rem;
    padding: 0.9rem;
    background: #fff;
}

.checkbox-card {
    align-self: end;
    min-height: 3.1rem;
}

.custom-crew-rows {
    display: grid;
    gap: 0.8rem;
}

.custom-crew-row,
.member-row {
    display: grid;
    gap: 0.75rem;
    align-items: end;
    padding: 0.9rem;
    border: 1px solid #e2d8cb;
    border-radius: 1rem;
    background: rgba(255, 253, 250, 0.9);
}

.custom-crew-row {
    grid-template-columns: 1.25fr 1fr 0.8fr auto;
}

.member-row {
    grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(120px, 140px) auto;
}

.member-row-leader {
    justify-content: center;
    min-height: 43px;
}

.custom-crew-remove,
.member-row-remove {
    margin-bottom: 0.1rem;
}

.crew-config-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.crew-config-card {
    display: grid;
    gap: 0.8rem;
}

.crew-config-card-top,
.crew-config-meta,
.event-list-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.crew-config-meta {
    color: var(--muted);
    font-size: 0.84rem;
}

.event-crew-summary .metric strong {
    font-size: 1.2rem;
}

.import-file-field {
    flex: 1 1 320px;
}

.import-preview-panel {
    margin-top: 1rem;
}

.crew-picker-grid {
    display: grid;
    gap: 0.7rem;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.crew-pill {
    position: relative;
    display: block;
    cursor: pointer;
}

.crew-pill input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.crew-pill-body {
    display: grid;
    gap: 0.15rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid #dfd4c8;
    border-radius: 0.95rem;
    background: #fff;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.crew-pill-body strong {
    font-size: 0.96rem;
}

.crew-pill-body small {
    color: var(--muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.crew-pill input:checked + .crew-pill-body {
    border-color: rgba(178, 34, 34, 0.45);
    background: rgba(178, 34, 34, 0.06);
    box-shadow: 0 10px 20px rgba(36, 50, 61, 0.08);
    transform: translateY(-1px);
}

.crew-pill input:disabled + .crew-pill-body {
    background: rgba(31, 122, 77, 0.08);
    border-color: rgba(31, 122, 77, 0.22);
    cursor: default;
}

.timeline {
    display: grid;
    gap: 0.9rem;
}

.timeline-item {
    border-left: 4px solid rgba(178, 34, 34, 0.25);
    padding: 0.2rem 0 0.2rem 1rem;
}

.log-sort-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.log-line {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    align-items: baseline;
    gap: 0.7rem;
    line-height: 1.45;
}

.log-line strong,
.log-line span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.log-grid pre {
    border-radius: 0.8rem;
    padding: 0.8rem;
    background: #f3f5f7;
    overflow: auto;
    margin: 0.75rem 0 0;
}

.auth-panel {
    max-width: 460px;
    margin: 8vh auto;
}

.mobile-header {
    max-width: 760px;
    margin: 0 auto;
}

.mobile-list {
    display: grid;
    gap: 0.8rem;
}

.mobile-card {
    border: 1px solid #dfd4c8;
    border-radius: 1rem;
    padding: 1rem;
    background: #fff;
    display: grid;
    gap: 0.35rem;
}

.dashboard-live-stack {
    display: grid;
    gap: 1rem;
}

.dashboard-status-panel {
    padding-top: 1rem;
}

.dashboard-status-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 1.15rem;
    align-items: start;
}

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

.dashboard-status-legend {
    align-self: center;
}

.dashboard-shell {
    display: grid;
    gap: 1.15rem;
}

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

.dashboard-head h2 {
    margin-bottom: 0.25rem;
}

.dashboard-head-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.dashboard-stat-pill,
.dashboard-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.4rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(178, 34, 34, 0.08);
    border: 1px solid rgba(178, 34, 34, 0.18);
    font-weight: 800;
    color: var(--primary-dark);
}

.dashboard-stat-pill-muted {
    background: rgba(36, 50, 61, 0.06);
    border-color: rgba(36, 50, 61, 0.12);
    color: var(--text);
}

.dashboard-crew-groups {
    display: grid;
    gap: 0.65rem;
}

.dashboard-crew-row {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 0.85rem;
    align-items: center;
}

.dashboard-crew-row-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 800;
}

.dashboard-crew-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.dashboard-crew-legend {
    display: grid;
    gap: 0.55rem;
    margin-top: 0;
}

.dashboard-legend-item {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.65rem;
}

.dashboard-legend-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.9rem;
    min-width: 6.1rem;
    padding: 0.28rem 0.7rem;
    border-radius: 999px;
    border: 1px solid rgba(36, 50, 61, 0.12);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    flex: 0 0 auto;
}

.dashboard-legend-text {
    font-size: 0.84rem;
    color: var(--text);
    white-space: nowrap;
}

.dashboard-legend-text strong {
    color: var(--text);
}

.dashboard-crew-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 2.25rem;
    padding: 0.35rem 0.95rem;
    border-radius: 999px;
    border: 1px solid rgba(36, 50, 61, 0.12);
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    overflow: hidden;
}

.dashboard-crew-pill-free {
    background: rgba(31, 122, 77, 0.16);
    color: #165437;
    border-color: rgba(31, 122, 77, 0.22);
}

.dashboard-crew-pill-not_logged {
    background: rgba(240, 179, 35, 0.22);
    color: #8a5b00;
    border-color: rgba(240, 179, 35, 0.34);
}

.dashboard-crew-pill-busy {
    background: rgba(161, 47, 47, 0.16);
    color: #7f1f1f;
    border-color: rgba(161, 47, 47, 0.22);
}

.dashboard-crew-pill-offline {
    background: #d7dde3;
    color: #56626d;
    border-color: rgba(86, 98, 109, 0.16);
    text-decoration: line-through;
    text-decoration-color: rgba(161, 47, 47, 0.9);
}

.dashboard-crew-pill-offline::after {
    content: "";
    position: absolute;
    inset: -12px;
    background: linear-gradient(135deg, transparent 46%, rgba(161, 47, 47, 0.95) 48%, rgba(161, 47, 47, 0.95) 52%, transparent 54%);
    pointer-events: none;
}

.dashboard-legend-chip-not-logged {
    background: rgba(240, 179, 35, 0.22);
    color: #8a5b00;
    border-color: rgba(240, 179, 35, 0.34);
}

.dashboard-legend-chip-free {
    background: rgba(31, 122, 77, 0.16);
    color: #165437;
    border-color: rgba(31, 122, 77, 0.22);
}

.dashboard-legend-chip-busy {
    background: rgba(161, 47, 47, 0.16);
    color: #7f1f1f;
    border-color: rgba(161, 47, 47, 0.22);
}

.dashboard-legend-chip-offline {
    position: relative;
    background: #d7dde3;
    color: #56626d;
    border-color: rgba(86, 98, 109, 0.16);
    overflow: hidden;
}

.dashboard-legend-chip-offline::after {
    content: "";
    position: absolute;
    inset: -10px;
    background: linear-gradient(135deg, transparent 46%, rgba(161, 47, 47, 0.88) 48%, rgba(161, 47, 47, 0.88) 52%, transparent 54%);
    pointer-events: none;
}

.dashboard-legend-chip-offline {
    text-decoration: line-through;
    text-decoration-color: rgba(161, 47, 47, 0.9);
}

.dashboard-crew-pill span {
    position: relative;
    z-index: 1;
}

.dashboard-crew-pill-content {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 0.02rem;
}

.dashboard-crew-pill-name {
    display: block;
}

.dashboard-crew-pill-content small {
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.2;
    opacity: 0.82;
}

.dashboard-crew-pill-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.dashboard-crew-pill-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(36, 50, 61, 0.12);
}

.dashboard-sections {
    display: grid;
    gap: 1rem;
}

.tracking-layout {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 1rem;
}

.tracking-sidebar {
    align-self: start;
    position: sticky;
    top: 1rem;
}

.tracking-crew-list {
    display: grid;
    gap: 0.75rem;
}

.tracking-crew-link {
    display: grid;
    gap: 0.2rem;
    border: 1px solid #e2d8cb;
    border-radius: 1rem;
    padding: 0.85rem 0.95rem;
    background: rgba(244, 241, 232, 0.48);
    color: var(--text);
}

.tracking-crew-link.is-active {
    border-color: rgba(178, 34, 34, 0.42);
    background: rgba(178, 34, 34, 0.08);
}

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

.tracking-map-box {
    margin-top: 1rem;
    margin-bottom: 1rem;
    min-height: 540px;
}

.dashboard-section {
    border: 1px solid #e2d8cb;
    border-radius: 1.15rem;
    padding: 1rem;
    background: rgba(255, 253, 250, 0.75);
}

.dashboard-section-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.9rem;
}

.dashboard-section-head h3 {
    margin-bottom: 0.2rem;
}

.dashboard-section-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}

.dashboard-table th,
.dashboard-table td {
    font-size: 0.9rem;
}

.dashboard-progressive-inline {
    font-size: 1.1rem;
    letter-spacing: 0.01em;
}

.dashboard-cell-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.35rem;
    max-width: 220px;
}

.dashboard-table-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: rgba(36, 50, 61, 0.06);
    border: 1px solid rgba(36, 50, 61, 0.08);
    font-size: 0.78rem;
    font-weight: 700;
}

.quick-look-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 7.75rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.quick-look-indicator-ok {
    background: rgba(31, 122, 77, 0.12);
    border-color: rgba(31, 122, 77, 0.28);
    color: #175b39;
}

.quick-look-indicator-pending {
    background: rgba(201, 137, 16, 0.12);
    border-color: rgba(201, 137, 16, 0.28);
    color: #8a5c08;
}

.quick-look-indicator-missing {
    background: rgba(36, 50, 61, 0.06);
    border-color: rgba(36, 50, 61, 0.12);
    color: #56636d;
}

.quick-look-indicator-alert {
    background: rgba(178, 34, 34, 0.12);
    border-color: rgba(178, 34, 34, 0.32);
    color: #8f1b1b;
    animation: quick-look-alert-pulse 1.2s ease-in-out infinite;
}

@keyframes quick-look-alert-pulse {
    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(178, 34, 34, 0.2);
    }

    50% {
        opacity: 0.62;
        box-shadow: 0 0 0 6px rgba(178, 34, 34, 0);
    }
}

.dashboard-state-line {
    display: inline-flex;
    align-items: baseline;
    gap: 0.22rem;
    padding: 0.16rem 0;
    font-size: 0.8rem;
    line-height: 1.2;
}

.dashboard-state-line span {
    color: var(--muted);
}

.dashboard-state-line em {
    font-style: normal;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary-dark);
    font-size: 0.68rem;
    font-weight: 800;
}

.dashboard-location-cell {
    display: grid;
    gap: 0.22rem;
    min-width: 200px;
}

.dashboard-location-cell div {
    display: grid;
    gap: 0.05rem;
}

.dashboard-location-cell strong {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.dashboard-sort-btn {
    border: 1px solid #dfd4c8;
    background: #fff;
    color: var(--text);
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.dashboard-sort-btn.is-active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

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

.dashboard-card {
    border: 1px solid #e2d6c7;
    border-radius: 1rem;
    padding: 0.95rem;
    background: #fff;
    display: grid;
    gap: 0.8rem;
}

.dashboard-card-closed {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 241, 235, 0.98));
}

.dashboard-card-top,
.dashboard-card-actions,
.dashboard-card-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.dashboard-progressive {
    font-size: 1.45rem;
    font-weight: 900;
    letter-spacing: 0.02em;
}

.dashboard-closure-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.32rem 0.7rem;
    border-radius: 999px;
    background: rgba(36, 50, 61, 0.08);
    color: var(--text);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

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

.dashboard-label {
    margin-bottom: 0.32rem;
    color: var(--muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 800;
}

.dashboard-chip-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.42rem;
}

.dashboard-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.34rem 0.62rem;
    border-radius: 999px;
    background: rgba(36, 50, 61, 0.06);
    border: 1px solid rgba(36, 50, 61, 0.08);
    font-size: 0.78rem;
    font-weight: 700;
}

.dashboard-chip-wrap-compact {
    gap: 0.36rem;
}

.dashboard-state-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    padding: 0.34rem 0.58rem;
    border-radius: 999px;
    background: rgba(178, 34, 34, 0.05);
    border: 1px solid rgba(178, 34, 34, 0.12);
    font-size: 0.76rem;
    line-height: 1.15;
}

.dashboard-state-chip strong {
    font-size: 0.8rem;
}

.dashboard-state-chip span {
    color: var(--muted);
}

.dashboard-state-chip em {
    font-style: normal;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary-dark);
    font-size: 0.7rem;
    font-weight: 800;
}

.dashboard-location-block {
    display: grid;
    gap: 0.45rem;
    padding: 0.7rem 0.8rem;
    border-radius: 0.85rem;
    background: rgba(244, 241, 232, 0.62);
    border: 1px solid rgba(217, 208, 194, 0.75);
}

.dashboard-location-block div {
    display: grid;
    gap: 0.12rem;
}

.dashboard-location-block strong {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.dashboard-card-foot {
    font-size: 0.84rem;
    color: var(--muted);
}

.map-box {
    min-height: 360px;
    border-radius: 1rem;
    background: linear-gradient(135deg, rgba(178, 34, 34, 0.06), rgba(31, 122, 77, 0.08));
    border: 1px dashed #c5b7a6;
    margin-bottom: 1rem;
    padding: 1rem;
}

.signature-pad {
    width: 100%;
    min-height: 220px;
    border: 1px dashed #cbbfab;
    border-radius: 1rem;
    background: #fff;
    cursor: pointer;
}

.signature-pad.is-pressing {
    border-color: var(--primary);
    box-shadow: inset 0 0 0 2px rgba(178, 34, 34, 0.12);
}

.signature-preview {
    width: 100%;
    max-height: 260px;
    object-fit: contain;
    border: 1px solid #e1d7ca;
    border-radius: 0.8rem;
    background: #fff;
    padding: 0.5rem;
}

.empty {
    color: var(--muted);
}

.collapsible-panel summary {
    cursor: pointer;
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 700;
    list-style: none;
}

.collapsible-panel summary::-webkit-details-marker {
    display: none;
}

.collapsible-panel[open] summary {
    margin-bottom: 1rem;
}

.users-layout {
    align-items: start;
}

.user-create-form,
.user-compact-list,
.user-compact-form {
    display: grid;
    gap: 0.85rem;
}

.user-create-grid,
.user-compact-grid {
    align-items: end;
}

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

.user-password-field {
    grid-column: span 2;
}

.user-compact-card {
    margin-top: 0;
    padding: 0.9rem 1rem;
}

.user-compact-summary {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.user-compact-primary {
    display: grid;
    gap: 0.12rem;
}

.user-compact-primary strong {
    color: var(--text);
}

.user-compact-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.45rem;
}

.user-compact-toggle {
    min-height: 42px;
}

.user-compact-actions,
.user-compact-delete {
    justify-content: flex-end;
    flex-wrap: wrap;
}

.signature-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 24, 28, 0.82);
    display: none;
    align-items: stretch;
    justify-content: stretch;
    padding: 1rem;
    z-index: 9999;
}

.signature-overlay.is-open {
    display: flex;
}

.signature-sheet {
    position: relative;
    width: 100%;
    height: 100%;
    background: #fffdfa;
    border-radius: 1.4rem;
    border: 1px solid #d9d0c2;
    overflow: hidden;
}

.signature-overlay-icon {
    position: absolute;
    top: 0.9rem;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid #d9d0c2;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 8px 18px rgba(36, 50, 61, 0.12);
}

.signature-overlay-icon-left {
    left: 0.9rem;
}

.signature-overlay-icon-right {
    right: 0.9rem;
}

.signature-overlay-icon svg {
    width: 1.15rem;
    height: 1.15rem;
}

.signature-fullscreen-pad {
    width: 100%;
    height: 100%;
    display: block;
    background:
        linear-gradient(180deg, rgba(244, 241, 232, 0.35), rgba(255, 255, 255, 0)),
        #fff;
    touch-action: none;
}

.mobile-assignment-alert {
    position: fixed;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    width: min(92vw, 460px);
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(178, 34, 34, 0.25);
    background: rgba(122, 14, 14, 0.96);
    color: #fff;
    box-shadow: 0 20px 38px rgba(36, 50, 61, 0.24);
    display: grid;
    gap: 0.25rem;
    z-index: 10000;
}

.mobile-assignment-alert strong {
    font-size: 1rem;
}

.mobile-assignment-alert span {
    font-size: 0.92rem;
    opacity: 0.92;
}

.mobile-assignment-alert-close {
    position: absolute;
    top: 0.45rem;
    right: 0.55rem;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    cursor: pointer;
    padding: 0;
    font-size: 1.35rem;
    line-height: 1;
}

.mobile-service-panel {
    gap: 0.85rem;
}

.mobile-service-form {
    display: grid;
}

.long-press-button.is-arming {
    box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0.12);
}

.long-press-button.is-ready {
    opacity: 0.9;
}

.hospital-modal {
    position: fixed;
    inset: 0;
    background: rgba(20, 24, 28, 0.62);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 9998;
}

.hospital-modal.is-open {
    display: flex;
}

.hospital-modal-card {
    width: min(92vw, 460px);
    background: #fffdfa;
    border: 1px solid #d9d0c2;
    border-radius: 1.25rem;
    box-shadow: 0 22px 40px rgba(36, 50, 61, 0.2);
    padding: 1.2rem;
    display: grid;
    gap: 1rem;
}

.report-page {
    gap: 1rem;
}

.report-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.8rem;
}

.report-tabs {
    display: flex;
    gap: 0.4rem;
    flex-wrap: nowrap;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: thin;
}

.report-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    border: 1px solid #d9d0c2;
    background: #f8f4ec;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

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

.report-mode-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.28rem 0.7rem;
    border-radius: 999px;
    background: rgba(36, 50, 61, 0.08);
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.report-filters-compact {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.report-summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.report-cover {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e6dccd;
}

.report-cover-side {
    display: flex;
    align-items: flex-start;
}

.report-document {
    gap: 1rem;
}

.report-print-only {
    display: none !important;
}

.report-table-wrap {
    max-width: 100%;
    overflow-x: auto;
}

.mail-diagnostic-grid {
    align-items: stretch;
}

.mail-diagnostic-item {
    display: grid;
    gap: 0.35rem;
    padding: 0.85rem 0.95rem;
    border: 1px solid rgba(203, 191, 171, 0.85);
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.72);
}

.mail-test-actions {
    grid-column: 1 / -1;
}

.mail-test-result {
    display: grid;
    gap: 0.9rem;
    padding: 1rem;
    border-radius: 1rem;
}

.mail-test-result-success {
    background: rgba(31, 122, 77, 0.08);
    border: 1px solid rgba(31, 122, 77, 0.2);
}

.mail-test-result-error {
    background: rgba(161, 47, 47, 0.06);
    border: 1px solid rgba(161, 47, 47, 0.16);
}

.mail-diagnostic-list {
    margin: 0.4rem 0 0;
    padding-left: 1.1rem;
    color: var(--text);
}

.mail-diagnostic-list li + li {
    margin-top: 0.3rem;
}

.report-table th,
.report-table td {
    vertical-align: top;
    white-space: normal;
}

.report-list-table th,
.report-list-table td {
    white-space: nowrap;
    font-size: 0.82rem;
    padding: 0.42rem 0.48rem;
}

.report-details-cell {
    white-space: normal !important;
    min-width: 34rem;
}

.report-details-block {
    margin-bottom: 0.25rem;
}

.report-details-block strong {
    display: block;
    margin-bottom: 0.08rem;
}

.report-details-block span {
    display: block;
}

.report-details-lines {
    line-height: 1.35;
}

.report-details-inline {
    white-space: nowrap;
}

.report-nowrap {
    white-space: nowrap;
    display: inline-block;
}

.report-card-list {
    display: grid;
    gap: 1rem;
}

.report-card {
    border: 1px solid #e6dccd;
    border-radius: 1.1rem;
    padding: 1rem;
    background: #fff;
    break-inside: avoid;
}

.report-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.report-card-section {
    border: 1px solid #ece3d7;
    border-radius: 0.95rem;
    padding: 0.9rem;
    background: #fffdfa;
}

.report-card-section h4 {
    margin-bottom: 0.7rem;
}

.report-line {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.32rem 0;
    border-bottom: 1px solid rgba(217, 208, 194, 0.55);
    font-size: 0.92rem;
}

.report-line:last-child {
    border-bottom: 0;
}

.report-line-label {
    color: var(--muted);
    font-weight: 700;
    flex: 0 0 42%;
}

.report-line-value {
    text-align: right;
    flex: 1 1 auto;
    min-width: 0;
}

.report-line-stack {
    flex-direction: column;
}

.report-line-stack .report-line-value {
    text-align: left;
}

.report-signature {
    max-width: 360px;
    width: 100%;
}

.report-signature-block {
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(217, 208, 194, 0.55);
    display: grid;
    gap: 0.5rem;
    break-inside: avoid;
}

.report-signature-block strong {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

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

.report-print-card {
    border: 1px solid #e2d8cb;
    border-radius: 1rem;
    padding: 0.9rem;
    background: #fffdfa;
    break-inside: avoid;
}

.report-print-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.report-print-card-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.2fr);
    gap: 0.75rem;
}

.report-print-card-section {
    border: 1px solid #ece3d7;
    border-radius: 0.9rem;
    padding: 0.8rem;
    background: #fff;
}

.report-print-card-section h4 {
    margin: 0 0 0.7rem;
}

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

.report-print-time-item {
    display: grid;
    gap: 0.14rem;
    padding: 0.55rem 0.6rem;
    border-radius: 0.8rem;
    background: rgba(244, 241, 232, 0.58);
    border: 1px solid rgba(217, 208, 194, 0.6);
}

.report-print-time-item strong {
    font-size: 0.76rem;
    letter-spacing: 0.05em;
}

.report-print-time-item span {
    font-weight: 700;
}

.report-print-time-item small {
    color: var(--muted);
}

.report-line-value-left {
    text-align: left;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 10mm;
    }

    @page report-lista {
        size: A4 landscape;
        margin: 10mm;
    }

    @page report-sanitario {
        size: A4 portrait;
        margin: 7mm;
    }

    body {
        background: #fff;
    }

    .report-document-lista {
        page: report-lista;
    }

    .report-document-rettangoli {
        page: report-sanitario;
    }

    .topbar,
    .nav,
    .topbar-user,
    .flash,
    .report-screen-only {
        display: none !important;
    }

    .report-print-only {
        display: block !important;
    }

    .shell,
    .content {
        max-width: none;
        padding: 0;
    }

    .panel {
        background: #fff;
        border: 0;
        box-shadow: none;
        padding: 0;
    }

    .report-cover {
        margin-bottom: 1rem;
    }

    .report-list-screen {
        display: none !important;
    }

    .report-print-card-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.6rem;
        margin-top: 0.75rem;
    }

    .report-print-card {
        border: 1px solid #ccc;
        box-shadow: none;
        page-break-inside: avoid;
        break-inside: avoid;
        font-size: 11px;
    }

    .report-print-card-head {
        margin-bottom: 0.55rem;
    }

    .report-print-card-layout {
        grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.15fr);
        gap: 0.5rem;
    }

    .report-print-card-section {
        padding: 0.55rem;
    }

    .report-print-time-grid {
        gap: 0.35rem;
    }

    .report-print-time-item {
        padding: 0.4rem 0.45rem;
    }

    .report-document-rettangoli .report-cover,
    .report-document-rettangoli .report-summary-grid {
        display: none !important;
    }

    .report-document-rettangoli .report-card-list {
        margin-top: 0;
        display: block;
    }

    .report-document-rettangoli .report-card-sanitario {
        page-break-before: always;
        break-before: page;
        page-break-inside: avoid;
        break-inside: avoid;
        min-height: 0;
        margin: 0;
        padding: 6mm;
        font-size: 9.2px;
        border-radius: 0.7rem;
    }

    .report-document-rettangoli .report-card-sanitario:first-of-type {
        page-break-before: auto;
        break-before: auto;
    }

    .report-document-rettangoli .report-card-head {
        margin-bottom: 0.45rem;
        gap: 0.45rem;
    }

    .report-document-rettangoli .report-card-head h3 {
        margin: 0 0 0.12rem;
        font-size: 1rem;
    }

    .report-document-rettangoli .report-card-head .subtle {
        font-size: 0.76rem;
        line-height: 1.2;
    }

    .report-document-rettangoli .badge {
        padding: 0.2rem 0.38rem;
        font-size: 0.64rem;
    }

    .report-table th,
    .report-table td {
        font-size: 11px;
        padding: 0.35rem 0.4rem;
    }

    .report-card-grid {
        grid-template-columns: 1fr !important;
        gap: 0.6rem;
    }

    .report-card-section {
        padding: 0.65rem;
        break-inside: avoid;
    }

    .report-document-rettangoli .report-card-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 0.35rem;
        align-items: start;
    }

    .report-document-rettangoli .report-card-section {
        padding: 0.38rem 0.42rem;
        border-radius: 0.65rem;
    }

    .report-document-rettangoli .report-card-section h4 {
        margin: 0 0 0.32rem;
        font-size: 0.76rem;
    }

    .report-document-rettangoli .report-line {
        gap: 0.3rem;
        padding: 0.14rem 0;
        font-size: 0.68rem;
        line-height: 1.15;
    }

    .report-document-rettangoli .report-line-label {
        flex-basis: 36%;
        font-size: 0.64rem;
    }

    .report-document-rettangoli .report-line-value,
    .report-document-rettangoli .report-line-stack .report-line-value {
        font-size: 0.68rem;
        line-height: 1.15;
    }

    .report-document-rettangoli .report-signature-block {
        margin-top: 0.3rem;
        padding-top: 0.3rem;
        gap: 0.18rem;
    }

    .report-signature {
        max-width: 320px;
        max-height: 120px;
        object-fit: contain;
    }

    .report-document-rettangoli .report-signature {
        max-width: 100%;
        max-height: 70px;
    }

    .report-summary-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 0.5rem;
    }

    a {
        color: #000;
        text-decoration: none;
    }

    a[href]::after,
    a[href]:after,
    abbr[title]::after,
    abbr[title]:after {
        content: none !important;
    }
}

@media (max-width: 960px) {
    .tracking-layout,
    .split-2,
    .split-main,
    .export-filters,
    .grid-4,
    .grid-3,
    .grid-2,
    .user-compact-grid,
    .log-grid,
    .dashboard-card-grid,
    .dashboard-card-grid-2,
    .custom-crew-row,
    .member-row {
        grid-template-columns: 1fr;
    }

    .topbar,
    .panel-head,
    .stack-inline,
    .user-compact-summary,
    .dashboard-head,
    .dashboard-section-head,
    .export-head,
    .report-top-row,
    .report-cover,
    .report-card-head {
        flex-direction: column;
        align-items: stretch;
    }

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

    .dashboard-status-legend {
        align-self: stretch;
    }

    .dashboard-legend-item {
        flex-wrap: wrap;
    }

    .dashboard-legend-text {
        white-space: normal;
    }

    .nav {
        border-radius: 1.2rem;
    }

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

    .user-password-field {
        grid-column: auto;
    }

    .user-compact-meta,
    .user-compact-actions,
    .user-compact-delete {
        justify-content: flex-start;
    }

    .signature-overlay {
        padding: 0.6rem;
    }

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

    .export-filter-actions {
        justify-content: stretch;
        flex-direction: column;
    }

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

    .report-summary-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }
}
