/* TOG - Tour Operator Gestionale - Design system */
:root {
    --font: 'DM Sans', system-ui, sans-serif;
    --bg: #0f1419;
    --bg-card: #1a2332;
    --bg-hover: #243044;
    --border: #2d3a4d;
    --text: #e6edf3;
    --text-muted: #8b9cb3;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #22c55e;
    --warning: #eab308;
    --danger: #ef4444;
    --radius: 10px;
    --radius-chip: 999px;
    --sidebar-w: 260px;
    --sidebar-w-collapsed: 72px;
    --header-h: 56px;
    --focus-outline: 2px solid #3b82f6;
    --focus-offset: 2px;
    --space-xs: clamp(0.25rem, 1vw, 0.35rem);
    --space-sm: clamp(0.5rem, 2vw, 0.75rem);
    --space-md: clamp(0.75rem, 3vw, 1.25rem);
    --space-lg: clamp(1rem, 4vw, 1.5rem);
    --space-xl: clamp(1.25rem, 5vw, 2rem);
    --content-pad: clamp(1rem, 4vw, 1.5rem);
    --content-max: 1400px;
    --font-size-base: clamp(14px, 2vw, 15px);
    --font-size-sm: clamp(0.8rem, 1.5vw, 0.875rem);
    --font-size-lg: clamp(1rem, 2vw, 1.15rem);
}

* {
    box-sizing: border-box;
}
body {
    margin: 0;
    font-family: var(--font);
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
}

/* Login */
.page-login {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 1rem;
    position: relative;
    padding-bottom: 120px;
}
.page-login .login-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-wrap {
    width: 100%;
    max-width: 400px;
}
.page-login .app-footer {
    width: 100%;
    margin-top: auto;
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,.3);
}
.login-brand {
    text-align: center;
    margin-bottom: 1.75rem;
}
.logo-icon {
    display: inline-block;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary);
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}
.login-brand h1 {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
    font-weight: 600;
}
.login-brand p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.login-form label {
    display: block;
    margin-bottom: 1rem;
}
.login-form label span {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}
.login-form input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.login-form .btn {
    margin-top: 0.5rem;
}

/* Checkbox: switch ridotto di 1/6, verde quando attivo, SFONDO ROSSO quando non attivo, misure standard */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1.67rem;
    height: 1rem;
    min-width: 1.67rem;
    min-height: 1rem;
    max-width: 1.67rem;
    max-height: 1rem;
    margin: 0;
    border: none;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.9);
    cursor: pointer;
    vertical-align: middle;
    transition: background 0.2s ease;
    position: relative;
    flex-shrink: 0;
    flex-grow: 0;
}
input[type="checkbox"]::before {
    content: '';
    position: absolute;
    left: 0.125rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: #fff;
    transition: left 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
input[type="checkbox"]:checked {
    background: #7ee504;
}
input[type="checkbox"]:checked::before {
    left: calc(100% - 0.875rem);
}
input[type="checkbox"]:hover {
    opacity: 0.9;
}
input[type="checkbox"]:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-offset);
}

input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1rem;
    height: 1rem;
    min-width: 1rem;
    min-height: 1rem;
    max-width: 1rem;
    max-height: 1rem;
    margin: 0;
    border: 2px solid var(--border);
    border-radius: 50%;
    background: var(--bg-card);
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.2s ease, background 0.2s ease;
}
input[type="radio"]:checked {
    border-color: #7ee504;
    background: var(--bg-card);
}
input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #7ee504;
}
input[type="radio"]:hover {
    border-color: var(--primary);
    opacity: 0.9;
}
input[type="radio"]:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-offset);
}

.status-toggle-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}
.status-toggle-text {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--text-muted);
}
.status-toggle-text.is-active {
    color: #86efac;
}
.status-toggle-text.is-inactive {
    color: #fca5a5;
}
.status-col {
    white-space: nowrap;
}
.status-dot {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
    margin-right: 0.4rem;
    vertical-align: middle;
}
.status-dot.is-online {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}
.status-dot.is-offline {
    background: #ef4444;
    opacity: 0.8;
}
.status-toggle-form {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}
.status-page-save-form {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}
.status-page-save-form .btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}
.template-sections {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
.template-detail {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg);
}
.template-detail summary {
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}
.template-detail[open] {
    background: var(--bg-hover);
}
.tour-settings-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: var(--space-lg) 0;
}
.tour-settings-block-header,
.tour-settings-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-bottom: var(--space-md);
}
.tour-settings-block-header h3,
.tour-settings-section-head h3 {
    margin: 0;
}
.tour-inline-form {
    display: none;
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-hover);
    border-radius: var(--radius);
}

/* Chip: senza sfondo, hover e checked solo bordo/colore */
.chip,
.perm-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.4rem 0.7rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-chip);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    text-align: center;
}
.perm-chip {
    min-width: 5rem;
}
.chip:hover,
.perm-chip:hover {
    border-color: var(--text-muted);
    color: var(--text);
}
.chip:has(input:checked),
.perm-chip:has(input[type="checkbox"]:checked) {
    border-color: var(--primary);
    color: #93c5fd;
}
.chip:focus-visible,
.perm-chip:focus-within {
    outline: var(--focus-outline);
    outline-offset: var(--focus-offset);
}
.perm-chip-text {
    pointer-events: none;
    text-align: center;
}

/* Buttons: stessa base chip (leggeri, hover, focus-visible), testo non sottolineato */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    font: inherit;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius-chip);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-decoration: none;
}
.btn:hover,
.btn:focus {
    text-decoration: none;
}
.btn:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-offset);
}
.btn-block { width: 100%; }
.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}
.btn-secondary,
.btn-indigo {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    border-color: #3b82f6;
}
.btn-secondary:hover,
.btn-indigo:hover {
    background: #3b82f6;
    color: #fff;
}
.btn-success {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
    border-color: var(--success);
}
.btn-success:hover {
    background: var(--success);
    color: #fff;
}
.btn-warning {
    background: rgba(234, 179, 8, 0.2);
    color: #fde047;
    border-color: var(--warning);
}
.btn-warning:hover {
    background: var(--warning);
    color: #000;
}
.btn-cyan {
    background: rgba(6, 182, 212, 0.2);
    color: #67e8f9;
    border-color: #06b6d4;
}
.btn-cyan:hover {
    background: #06b6d4;
    color: #fff;
}
.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-color: var(--danger);
}
.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.875rem; }
.btn-xs { padding: 0.3rem 0.65rem; font-size: 0.75rem; }

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert-error { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.3); }
.alert-success { background: rgba(34, 197, 94, 0.15); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.3); }

/* Layout app */
.app-layout {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.2s ease;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    scrollbar-gutter: stable both-edges;
}
.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    min-height: 52px;
}
.sidebar-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
    letter-spacing: 0.03em;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s;
}
.sidebar-toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-toggle i { font-size: 1rem; transition: transform 0.2s; }
.sidebar.collapsed .sidebar-toggle i { transform: rotate(180deg); }
.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: visible;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    transition: background .15s, color .15s;
}
.sidebar-nav a:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-nav a.active { background: var(--bg-hover); color: var(--text); border-left: 3px solid var(--border); padding-left: calc(1.25rem - 3px); }
/* Iconfont: stessa grandezza del testo; quando sidebar chiusa diventano più grandi (fluid) */
.sidebar-nav .nav-icon {
    flex-shrink: 0;
    width: 1em;
    text-align: center;
    font-size: 1em;
    opacity: 0.9;
    transition: font-size 0.2s ease;
}
.sidebar.collapsed .sidebar-nav .nav-icon {
    font-size: 1.35rem;
}
.sidebar-nav .nav-text {
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.15s;
}
.sidebar.collapsed .sidebar-nav .nav-text {
    width: 0;
    opacity: 0;
    overflow: hidden;
}
.sidebar.collapsed {
    width: var(--sidebar-w-collapsed);
}
.sidebar.collapsed .sidebar-head { padding-left: 0.75rem; padding-right: 0.75rem; justify-content: center; }
.sidebar.collapsed .sidebar-head > div { flex: 0; justify-content: center; }
.sidebar.collapsed .sidebar-head img { height: 2.5rem !important; margin: 0 auto; }
.sidebar.collapsed .sidebar-brand { width: 0; opacity: 0; }
.sidebar.collapsed .sidebar-toggle { margin: 0 auto; }
.sidebar.collapsed .sidebar-nav a { justify-content: center; padding-left: 0.75rem; padding-right: 0.75rem; }
.sidebar-user {
    padding: 1rem 1rem 1rem 1.25rem;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: padding 0.2s;
    margin-top: auto;
}
.sidebar.collapsed .sidebar-user { padding-left: 0.75rem; padding-right: 0.75rem; }
.sidebar-user-info { white-space: nowrap; overflow: hidden; transition: opacity 0.15s; }
.sidebar.collapsed .sidebar-user-info { width: 0; height: 0; opacity: 0; overflow: hidden; padding: 0; margin: 0; }
.sidebar-user-actions .btn { display: inline-flex; align-items: center; gap: 0.4rem; }
.sidebar-user-actions .btn .btn-text { white-space: nowrap; }
.sidebar.collapsed .sidebar-user-actions .btn .btn-text { width: 0; opacity: 0; overflow: hidden; }
.sidebar.collapsed .sidebar-user-actions .btn { padding: 0.5rem; justify-content: center; }
.sidebar.collapsed .sidebar-user-actions .btn i { margin: 0; font-size: 1.1rem; }
.sidebar-user strong { color: var(--text); }

/* Header: pulsante per aprire/riaprire sidebar (nascosto su desktop, visibile su mobile) */
.header-sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    margin-right: 0.75rem;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.header-sidebar-toggle:hover { background: var(--bg-hover); color: var(--text); }
.header-sidebar-toggle i { font-size: 1.15rem; }
.header-sidebar-toggle.visible { display: flex !important; }

.main-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}
.header {
    min-height: var(--header-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--content-pad);
    flex-shrink: 0;
    gap: var(--space-sm);
}
.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 0;
    flex: 1;
}
.header h1 {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.header-user {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
.header-user-menu {
    position: relative;
}
.header-user-menu summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: var(--radius-chip);
    padding: 0.35rem 0.6rem;
}
.header-user-menu summary:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-offset);
}
.header-user-menu summary::-webkit-details-marker {
    display: none;
}
.header-user-menu[open] summary {
    background: var(--bg-hover);
    border-color: var(--border);
}
.user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}
.user-labels {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}
.user-name {
    font-weight: 600;
}
.header-user-menu i.fa-chevron-down {
    font-size: 0.75rem;
    opacity: 0.6;
}
.user-menu-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    min-width: 180px;
    padding: 0.5rem 0;
    display: flex;
    flex-direction: column;
    z-index: 10;
}
.header-user-menu:not([open]) .user-menu-dropdown {
    display: none;
}
.user-menu-dropdown a {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.4rem 1rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.95rem;
}
.user-menu-dropdown a:hover {
    background: var(--bg-hover);
    color: var(--text);
}
/* Link in content: no blue/viola; use .link-badge for badge-style links */
.content a:not(.btn):not(.link-badge):not(.stat-card) {
    color: var(--text);
    text-decoration: none;
}
.content a:not(.btn):not(.link-badge):not(.stat-card):hover {
    text-decoration: underline;
    color: var(--text);
}
/* Badge-style link (clickable ref/ticket): as badge, no blue */
a.link-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 6px;
    color: var(--text);
    background: var(--bg-hover);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
}
a.link-badge:hover {
    background: var(--border);
    border-color: var(--text-muted);
    color: var(--text);
    text-decoration: none;
}
.content {
    flex: 1;
    padding: var(--content-pad);
    overflow-y: auto;
    min-width: 0;
    min-height: 0;
}
.content-inner {
    max-width: var(--content-max);
    margin: 0 auto;
}

/* Cards & tables – fluid */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: var(--space-lg);
}
.card-header {
    padding: var(--space-md) var(--content-pad);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-sm);
}
.card-header h2 {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: 600;
}
/* Scroll orizzontale: il contenitore limita la larghezza; la tabella può espandersi in base al contenuto */
.table-wrap,
.table-responsive {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}
.table-wrap > table,
.table-responsive > table {
    min-width: max-content;
}
table.data-table {
    width: 100%;
    min-width: max-content;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}
table.data-table th,
table.data-table td {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--border);
}
table.data-table th {
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}
table.data-table tr:hover td { background: rgba(255,255,255,0.02); }
table.data-table .num { text-align: right; }
table.data-table .actions { white-space: nowrap; }
table.data-table .actions .btn { margin-right: 0.35rem; }
@media (max-width: 640px) {
    table.data-table th,
    table.data-table td { padding: var(--space-xs) var(--space-sm); font-size: 0.8125rem; }
}

/* Booking list: tabella più leggibile */
.bookings-list-table-wrap .bookings-list-table {
    font-size: var(--font-size-base);
}
.bookings-list-table-wrap .bookings-list-table th,
.bookings-list-table-wrap .bookings-list-table td {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.bookings-list-table-wrap .bookings-list-table thead th {
    background: var(--bg-hover);
    color: var(--text);
    font-weight: 600;
    font-size: 0.875rem;
}
.bookings-list-table-wrap .bookings-list-table tbody tr:nth-child(even) td {
    background: rgba(255,255,255,0.02);
}
.bookings-list-table-wrap .bookings-list-table tbody tr:hover td {
    background: rgba(255,255,255,0.05);
}
.bookings-list-table-wrap .bookings-list-table .actions .btn {
    margin-bottom: 0.25rem;
}
.bookings-list-table-wrap .bookings-notes-cell {
    display: inline-block;
    max-width: 14rem;
    vertical-align: top;
    word-break: break-word;
}
@media (max-width: 640px) {
    .bookings-list-table-wrap .bookings-list-table th,
    .bookings-list-table-wrap .bookings-list-table td { padding: var(--space-sm) var(--space-md); font-size: 0.9rem; }
}

/* Forms – fluid layout, better field impagination */
.form-grid {
    display: grid;
    gap: var(--space-md);
    max-width: 100%;
    width: 100%;
}
.form-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}
.form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}
.form-grid-2 .form-group[style*="grid-column:1/-1"],
.form-grid-3 .form-group[style*="grid-column:1/-1"] {
    grid-column: 1 / -1;
}
.form-group {
    min-width: 0;
}
.form-group label {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    min-width: 0;
    padding: 0.6rem 0.85rem;
    font: inherit;
    font-size: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.form-group textarea { min-height: 80px; resize: vertical; }
/* Card form fields: theme for Cruise, Transfer and all edit pages */
.card input,
.card select,
.card textarea {
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-sizing: border-box;
}
.card input:focus,
.card select:focus,
.card textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Native controls on dark UI: custom chevron on selects; lighten date/spinner icons */
.form-group select:not([multiple]):not([size]),
.card select:not([multiple]):not([size]),
table.data-table select:not([multiple]):not([size]),
.filters-bar select:not([multiple]):not([size]) {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23c8d4e0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    background-size: 1rem 1rem;
    padding-right: 2.35rem;
}
.form-group input[type="date"]::-webkit-calendar-picker-indicator,
.form-group input[type="datetime-local"]::-webkit-calendar-picker-indicator,
.form-group input[type="time"]::-webkit-calendar-picker-indicator,
.form-group input[type="month"]::-webkit-calendar-picker-indicator,
.card input[type="date"]::-webkit-calendar-picker-indicator,
.card input[type="datetime-local"]::-webkit-calendar-picker-indicator,
.card input[type="time"]::-webkit-calendar-picker-indicator,
.card input[type="month"]::-webkit-calendar-picker-indicator,
table.data-table input[type="date"]::-webkit-calendar-picker-indicator,
table.data-table input[type="datetime-local"]::-webkit-calendar-picker-indicator,
table.data-table input[type="time"]::-webkit-calendar-picker-indicator,
table.data-table input[type="month"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(2);
    opacity: 1;
    cursor: pointer;
}
.form-group input[type="date"]::-moz-calendar-picker-indicator,
.card input[type="date"]::-moz-calendar-picker-indicator,
table.data-table input[type="date"]::-moz-calendar-picker-indicator {
    filter: invert(1) brightness(2);
    opacity: 1;
}
.form-group input[type="number"]::-webkit-inner-spin-button,
.form-group input[type="number"]::-webkit-outer-spin-button,
.card input[type="number"]::-webkit-inner-spin-button,
.card input[type="number"]::-webkit-outer-spin-button,
table.data-table input[type="number"]::-webkit-inner-spin-button,
table.data-table input[type="number"]::-webkit-outer-spin-button {
    filter: invert(1) brightness(2);
    opacity: 1;
}

/* Data tables inside cards: inputs/selects respect theme */
table.data-table input,
table.data-table select {
    width: 100%;
    min-width: 0;
    padding: 0.5rem 0.65rem;
    font: inherit;
    font-size: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-sizing: border-box;
}
table.data-table input:focus,
table.data-table select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Disabled input: theme-aware */
.input-disabled,
.card input:disabled,
.card input[readonly].input-disabled {
    background: var(--bg-hover) !important;
    color: var(--text-muted) !important;
    border-color: var(--border) !important;
    cursor: not-allowed;
}

/* Settings Language & Translation Manager: full theme respect */
.settings-translations-content {
    color: var(--text);
}
.settings-translations-content .template-detail {
    background: var(--bg-card);
    border-color: var(--border);
}
.settings-translations-content .template-detail[open] {
    background: var(--bg-hover);
}
.settings-translations-content .template-detail summary {
    color: var(--text);
}
.settings-translations-content .text-muted {
    color: var(--text-muted);
}
.settings-translations-content label,
.settings-translations-content .form-group label {
    color: var(--text-muted);
}
.settings-translations-content input,
.settings-translations-content select,
.settings-translations-content textarea,
.settings-translations-content .form-control {
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
}
.settings-translations-content input:focus,
.settings-translations-content select:focus,
.settings-translations-content textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.settings-translations-content input[type="file"] {
    color: var(--text);
}
.settings-translations-content table.data-table th,
.settings-translations-content table.data-table td {
    border-color: var(--border);
    color: inherit;
}
.settings-translations-content table.data-table th {
    color: var(--text-muted);
}
.settings-translations-content table.data-table tr:hover td {
    background: var(--bg-hover);
}
.settings-translations-content code {
    color: var(--text-muted);
    background: var(--bg-hover);
    border-radius: var(--radius);
    padding: 0.15em 0.4em;
}
.settings-translations-content a {
    color: var(--primary);
}
.settings-translations-content a:hover {
    color: var(--primary-hover);
}
.settings-translations-content .form-actions .btn,
.settings-translations-content .btn {
    border-color: var(--border);
}

.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; max-width: 100%; }
/* Excursion cost table: horizontal scroll + readable fields (zona costi) */
.excursion-costs-scroll,
.transfer-costs-scroll { overflow-x: auto !important; -webkit-overflow-scrolling: touch; width: 100%; max-width: 100%; }
.table-responsive .tour-lines-table,
.table-responsive .cruise-lines-table { min-width: 1100px; width: max-content; table-layout: auto; }
.table-responsive .tour-lines-table th,
.table-responsive .tour-lines-table td,
.table-responsive .cruise-lines-table th,
.table-responsive .cruise-lines-table td { min-width: 0; }
/* Cost tables: same column order as profit (Type, Unit, Label, Description, Amount, Amount Adult, Amount Child, Qty, Total, actions) */
.table-responsive .tour-lines-table th:nth-child(1),
.table-responsive .tour-lines-table td:nth-child(1),
.table-responsive .cruise-lines-table th:nth-child(1),
.table-responsive .cruise-lines-table td:nth-child(1) { min-width: 100px; white-space: nowrap; }
.table-responsive .tour-lines-table th:nth-child(2),
.table-responsive .tour-lines-table td:nth-child(2),
.table-responsive .cruise-lines-table th:nth-child(2),
.table-responsive .cruise-lines-table td:nth-child(2) { min-width: 80px; white-space: nowrap; }
.table-responsive .tour-lines-table th:nth-child(3),
.table-responsive .tour-lines-table td:nth-child(3),
.table-responsive .cruise-lines-table th:nth-child(3),
.table-responsive .cruise-lines-table td:nth-child(3) { min-width: 90px; white-space: nowrap; }
.table-responsive .tour-lines-table th:nth-child(4),
.table-responsive .tour-lines-table td:nth-child(4),
.table-responsive .cruise-lines-table th:nth-child(4),
.table-responsive .cruise-lines-table td:nth-child(4) { min-width: 70px; }
.table-responsive .tour-lines-table th:nth-child(5),
.table-responsive .tour-lines-table td:nth-child(5),
.table-responsive .cruise-lines-table th:nth-child(5),
.table-responsive .cruise-lines-table td:nth-child(5) { min-width: 100px; }
.table-responsive .tour-lines-table th:nth-child(6),
.table-responsive .tour-lines-table td:nth-child(6),
.table-responsive .cruise-lines-table th:nth-child(6),
.table-responsive .cruise-lines-table td:nth-child(6) { min-width: 120px; white-space: nowrap; }
.table-responsive .tour-lines-table th:nth-child(7),
.table-responsive .tour-lines-table td:nth-child(7),
.table-responsive .cruise-lines-table th:nth-child(7),
.table-responsive .cruise-lines-table td:nth-child(7) { min-width: 90px; white-space: nowrap; }
.table-responsive .tour-lines-table th:nth-child(8),
.table-responsive .tour-lines-table td:nth-child(8),
.table-responsive .cruise-lines-table th:nth-child(8),
.table-responsive .cruise-lines-table td:nth-child(8) { min-width: 60px; white-space: nowrap; }
.table-responsive .tour-lines-table th:nth-child(9),
.table-responsive .tour-lines-table td:nth-child(9),
.table-responsive .cruise-lines-table th:nth-child(9),
.table-responsive .cruise-lines-table td:nth-child(9) { min-width: 44px; white-space: nowrap; }
.table-responsive .tour-lines-table th:nth-child(10),
.table-responsive .tour-lines-table td:nth-child(10),
.table-responsive .cruise-lines-table th:nth-child(10),
.table-responsive .cruise-lines-table td:nth-child(10) { min-width: 44px; white-space: nowrap; }
/* Excursion/Tour Active Costs: Total row allineata sotto Total Adult, Total Chd, Total */
.tour-lines-recap-row td.num,
.excursion-profit-recap-row td.num { text-align: right !important; font-variant-numeric: tabular-nums; }
/* Profit tables: same scroll and layout as cost tables */
.table-responsive .tour-profit-lines-table,
.table-responsive .excursion-profit-lines-table,
.table-responsive .cruise-profit-lines-table,
.table-responsive .transfer-profit-lines-table { min-width: 1100px; width: max-content; table-layout: auto; }
.table-responsive .tour-profit-lines-table th,
.table-responsive .tour-profit-lines-table td,
.table-responsive .excursion-profit-lines-table th,
.table-responsive .excursion-profit-lines-table td,
.table-responsive .cruise-profit-lines-table th,
.table-responsive .cruise-profit-lines-table td,
.table-responsive .transfer-profit-lines-table th,
.table-responsive .transfer-profit-lines-table td { min-width: 0; }
.table-responsive .tour-profit-lines-table th:nth-child(1),
.table-responsive .tour-profit-lines-table td:nth-child(1),
.table-responsive .excursion-profit-lines-table th:nth-child(1),
.table-responsive .excursion-profit-lines-table td:nth-child(1),
.table-responsive .cruise-profit-lines-table th:nth-child(1),
.table-responsive .cruise-profit-lines-table td:nth-child(1),
.table-responsive .transfer-profit-lines-table th:nth-child(1),
.table-responsive .transfer-profit-lines-table td:nth-child(1) { min-width: 100px; white-space: nowrap; }
/* col2 = Unit */
.table-responsive .tour-profit-lines-table th:nth-child(2),
.table-responsive .tour-profit-lines-table td:nth-child(2),
.table-responsive .excursion-profit-lines-table th:nth-child(2),
.table-responsive .excursion-profit-lines-table td:nth-child(2),
.table-responsive .cruise-profit-lines-table th:nth-child(2),
.table-responsive .cruise-profit-lines-table td:nth-child(2),
.table-responsive .transfer-profit-lines-table th:nth-child(2),
.table-responsive .transfer-profit-lines-table td:nth-child(2) { min-width: 80px; white-space: nowrap; }
/* col3 = Label */
.table-responsive .tour-profit-lines-table th:nth-child(3),
.table-responsive .tour-profit-lines-table td:nth-child(3),
.table-responsive .excursion-profit-lines-table th:nth-child(3),
.table-responsive .excursion-profit-lines-table td:nth-child(3),
.table-responsive .cruise-profit-lines-table th:nth-child(3),
.table-responsive .cruise-profit-lines-table td:nth-child(3),
.table-responsive .transfer-profit-lines-table th:nth-child(3),
.table-responsive .transfer-profit-lines-table td:nth-child(3) { min-width: 90px; white-space: nowrap; }
/* col4 = Description */
.table-responsive .tour-profit-lines-table th:nth-child(4),
.table-responsive .tour-profit-lines-table td:nth-child(4),
.table-responsive .excursion-profit-lines-table th:nth-child(4),
.table-responsive .excursion-profit-lines-table td:nth-child(4),
.table-responsive .cruise-profit-lines-table th:nth-child(4),
.table-responsive .cruise-profit-lines-table td:nth-child(4),
.table-responsive .transfer-profit-lines-table th:nth-child(4),
.table-responsive .transfer-profit-lines-table td:nth-child(4) { min-width: 70px; }
/* col5 = Amount */
.table-responsive .tour-profit-lines-table th:nth-child(5),
.table-responsive .tour-profit-lines-table td:nth-child(5),
.table-responsive .excursion-profit-lines-table th:nth-child(5),
.table-responsive .excursion-profit-lines-table td:nth-child(5),
.table-responsive .cruise-profit-lines-table th:nth-child(5),
.table-responsive .cruise-profit-lines-table td:nth-child(5),
.table-responsive .transfer-profit-lines-table th:nth-child(5),
.table-responsive .transfer-profit-lines-table td:nth-child(5) { min-width: 100px; }
/* col6 = Amount Adult */
.table-responsive .tour-profit-lines-table th:nth-child(6),
.table-responsive .tour-profit-lines-table td:nth-child(6),
.table-responsive .excursion-profit-lines-table th:nth-child(6),
.table-responsive .excursion-profit-lines-table td:nth-child(6),
.table-responsive .cruise-profit-lines-table th:nth-child(6),
.table-responsive .cruise-profit-lines-table td:nth-child(6),
.table-responsive .transfer-profit-lines-table th:nth-child(6),
.table-responsive .transfer-profit-lines-table td:nth-child(6) { min-width: 120px; white-space: nowrap; }
/* col7 = Amount Child */
.table-responsive .tour-profit-lines-table th:nth-child(7),
.table-responsive .tour-profit-lines-table td:nth-child(7),
.table-responsive .excursion-profit-lines-table th:nth-child(7),
.table-responsive .excursion-profit-lines-table td:nth-child(7),
.table-responsive .cruise-profit-lines-table th:nth-child(7),
.table-responsive .cruise-profit-lines-table td:nth-child(7),
.table-responsive .transfer-profit-lines-table th:nth-child(7),
.table-responsive .transfer-profit-lines-table td:nth-child(7) { min-width: 90px; white-space: nowrap; }
/* col8 = Qty */
.table-responsive .tour-profit-lines-table th:nth-child(8),
.table-responsive .tour-profit-lines-table td:nth-child(8),
.table-responsive .excursion-profit-lines-table th:nth-child(8),
.table-responsive .excursion-profit-lines-table td:nth-child(8),
.table-responsive .cruise-profit-lines-table th:nth-child(8),
.table-responsive .cruise-profit-lines-table td:nth-child(8),
.table-responsive .transfer-profit-lines-table th:nth-child(8),
.table-responsive .transfer-profit-lines-table td:nth-child(8) { min-width: 60px; white-space: nowrap; }
.table-responsive .tour-profit-lines-table th:nth-child(9),
.table-responsive .tour-profit-lines-table td:nth-child(9),
.table-responsive .excursion-profit-lines-table th:nth-child(9),
.table-responsive .excursion-profit-lines-table td:nth-child(9),
.table-responsive .cruise-profit-lines-table th:nth-child(9),
.table-responsive .cruise-profit-lines-table td:nth-child(9),
.table-responsive .transfer-profit-lines-table th:nth-child(9),
.table-responsive .transfer-profit-lines-table td:nth-child(9) { min-width: 44px; white-space: nowrap; }
.table-responsive .tour-profit-lines-table th:nth-child(10),
.table-responsive .tour-profit-lines-table td:nth-child(10),
.table-responsive .excursion-profit-lines-table th:nth-child(10),
.table-responsive .excursion-profit-lines-table td:nth-child(10),
.table-responsive .cruise-profit-lines-table th:nth-child(10),
.table-responsive .cruise-profit-lines-table td:nth-child(10),
.table-responsive .transfer-profit-lines-table th:nth-child(10),
.table-responsive .transfer-profit-lines-table td:nth-child(10) { min-width: 44px; white-space: nowrap; }
.tour-profit-lines-table input,
.excursion-profit-lines-table input,
.cruise-profit-lines-table input,
.transfer-profit-lines-table input,
.tour-profit-lines-table select,
.excursion-profit-lines-table select,
.cruise-profit-lines-table select,
.transfer-profit-lines-table select { width: 100%; min-width: 0; padding: 0.5rem 0.65rem; font: inherit; font-size: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; box-sizing: border-box; }
.tour-profit-lines-table input:focus,
.excursion-profit-lines-table input:focus,
.cruise-profit-lines-table input:focus,
.transfer-profit-lines-table input:focus,
.tour-profit-lines-table select:focus,
.excursion-profit-lines-table select:focus,
.cruise-profit-lines-table select:focus,
.transfer-profit-lines-table select:focus { outline: none; border-color: var(--primary); }
.tour-profit-lines-table .num input,
.excursion-profit-lines-table .num input,
.cruise-profit-lines-table .num input,
.transfer-profit-lines-table .num input { text-align: right; min-width: 4rem; }
.tour-lines-table input,
.cruise-lines-table input,
.tour-lines-table select,
.cruise-lines-table select { width: 100%; min-width: 0; padding: 0.5rem 0.65rem; font: inherit; font-size: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; box-sizing: border-box; }
.tour-lines-table input:focus,
.tour-lines-table select:focus,
.cruise-lines-table input:focus,
.cruise-lines-table select:focus { outline: none; border-color: var(--primary); }
.tour-lines-table .num input,
.cruise-lines-table .num input { text-align: right; min-width: 4rem; }
.tour-lines-recap-detail,
.cruise-lines-recap-detail { border-top: 1px solid var(--border); }
.tour-lines-recap-detail td,
.cruise-lines-recap-detail td { padding-top: var(--space-xs); font-size: 0.875rem; color: var(--text-muted); }
.tour-lines-recap-detail .tour-lines-recap-detail-value,
.cruise-lines-recap-detail .cruise-lines-recap-detail-value { font-variant-numeric: tabular-nums; }
.tour-lines-recap-row,
.cruise-lines-recap-row { border-top: 2px solid var(--border); font-weight: 600; }
.tour-lines-recap-row td,
.cruise-lines-recap-row td { padding-top: var(--space-sm); }
.tour-lines-recap-row .tour-lines-recap-total,
.cruise-lines-recap-row .cruise-lines-recap-total { font-variant-numeric: tabular-nums; }
/* Timing: form fields match theme, duration display */
.timing-fields .form-group input { padding: 0.6rem 0.85rem; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.duration-display { display: block; width: 100%; padding: 0.6rem 0.85rem; font: inherit; font-size: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; min-height: 2.5rem; box-sizing: border-box; }
#excursion-timing-lines-table input[type="text"],
#excursion-timing-lines-table input[type="time"],
#tour-timing-lines-table input[type="text"],
#tour-timing-lines-table input[type="time"] { width: 100%; min-width: 5rem; padding: 0.6rem 0.85rem; font: inherit; font-size: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; box-sizing: border-box; }
#excursion-timing-lines-table input:focus,
#tour-timing-lines-table input:focus { outline: none; border-color: var(--primary); }
#excursion-timing-lines-table,
#tour-timing-lines-table { min-width: 520px; }
#excursion-timing-lines-table .timing-line-partial,
#tour-timing-lines-table .timing-line-partial,
#cruise-timing-lines-table .timing-line-partial { text-align: right; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
#excursion-timing-lines-table .timing-partials-total,
#tour-timing-lines-table .timing-partials-total,
#cruise-timing-lines-table .timing-partials-total { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.duration-display.duration-match { background: rgba(34, 197, 94, 0.2); color: var(--success, #16a34a); padding: 0.35rem 0.5rem; border-radius: 6px; border: 1px solid var(--success, #16a34a); }
#tour-timing-lines-table th,
#tour-timing-lines-table td { padding: var(--space-sm) var(--space-md); }
#cruise-timing-lines-table input[type="time"] { width: 100%; min-width: 5rem; padding: 0.6rem 0.85rem; font: inherit; font-size: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; box-sizing: border-box; }
#cruise-timing-lines-table input:focus { outline: none; border-color: var(--primary); }
#cruise-timing-lines-table { min-width: 520px; }
#cruise-timing-lines-table th,
#cruise-timing-lines-table td { padding: var(--space-sm) var(--space-md); }
.timing-details-footer { display: flex; justify-content: flex-end; align-items: center; margin-top: 0.5rem; }
.excursion-details-details summary::-webkit-details-marker { display: none; }
.excursion-details-details summary::marker { content: none; }
.commission-grid { display: flex; flex-direction: column; gap: var(--space-md); }
.commission-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-sm); }
.commission-label { min-width: 140px; font-size: var(--font-size-sm); color: var(--text-muted); }
.commission-type-switch { display: inline-flex; align-items: center; background: var(--bg-hover); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.commission-type-switch input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.commission-switch-btn { padding: 0.35rem 0.75rem; font-size: 0.8125rem; cursor: pointer; border-radius: 6px; color: var(--text-muted); transition: background 0.15s, color 0.15s; }
.commission-type-switch input:checked + .commission-switch-btn { background: var(--primary); color: #fff; }
.commission-value { width: 100px; padding: 0.5rem 0.65rem; font: inherit; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); }
/* Guest edit form: section titles for better pagination */
.guest-edit-form .guest-form-section {
    margin-top: var(--space-md);
    margin-bottom: 0;
    padding-bottom: var(--space-xs);
}
.guest-edit-form .guest-form-section:first-child {
    margin-top: 0;
}
.guest-edit-form .guest-form-section-title {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.4rem;
}

.form-actions {
    margin-top: var(--space-lg);
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}
@media (max-width: 900px) {
    .form-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .form-grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .form-grid-2 { grid-template-columns: 1fr; }
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 6px;
}
.badge-excursion { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.badge-tour { background: rgba(234, 179, 8, 0.2); color: #fde047; }
.badge-cruise { background: rgba(249, 115, 22, 0.2); color: #fdba74; }
.badge-transfer { background: rgba(120, 53, 15, 0.25); color: #d6d3a2; }
.badge-other { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; }
.badge-paid { background: rgba(34, 197, 94, 0.2); color: #86efac; }
.btn-paid { background: rgba(34, 197, 94, 0.25); color: #86efac; border-color: rgba(34, 197, 94, 0.5); transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease; }
.btn-paid:hover { background: rgba(34, 197, 94, 0.95); color: #fff; border-color: rgb(34, 197, 94); }
.badge-to_pay { background: rgba(234, 179, 8, 0.2); color: #fde047; }
.badge-cancelled { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.badge-pending { background: rgba(139, 156, 179, 0.2); color: var(--text-muted); }
.badge-confirmed { background: rgba(34, 197, 94, 0.2); color: #86efac; }
.badge-completed { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }

/* Booking list: Ref. and Status on one row (no wrap) */
.bookings-ref,
.bookings-to-pay { white-space: nowrap; }

/* Dashboard calendar – elegant layout, day buttons, multiselect, programs panel */
.dashboard-calendar-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-md);
}
.dashboard-calendar-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}
.dashboard-calendar-nav .dashboard-calendar-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    min-width: 11rem;
    text-align: center;
    letter-spacing: 0.02em;
}
.dashboard-calendar-nav .cal-nav-btn {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.dashboard-calendar-nav .cal-nav-btn:hover {
    color: var(--text);
    border-color: var(--text-muted);
    background: var(--bg-hover);
}
.dashboard-calendar-wrap {
    display: block;
    margin-top: var(--space-md);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}
.dashboard-calendar {
    min-width: 0;
    width: 100%;
}
.dashboard-calendar-table {
    width: 100%;
    min-width: max-content;
    border-collapse: separate;
    border-spacing: 0.5rem;
}
.dashboard-calendar-table thead th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0.35rem 0;
    text-align: center;
}
.dashboard-calendar-table td {
    padding: 0.25rem;
    text-align: center;
    vertical-align: top;
    width: 1%;
}
.dashboard-calendar-day {
    min-height: 3.35rem;
    padding: 0.55rem 0.35rem;
    font-size: 0.95rem;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    position: relative;
}
.dashboard-calendar-day:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}
.dashboard-calendar-day.other-month {
    color: var(--text-muted);
    opacity: 0.6;
}
.dashboard-calendar-day.other-month:hover {
    opacity: 0.9;
}
.dashboard-calendar-day.selected {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--primary);
    color: #93c5fd;
}
.dashboard-calendar-day.selected:hover {
    background: rgba(59, 130, 246, 0.22);
}
.dashboard-calendar-day .day-num {
    display: block;
    font-weight: 600;
    line-height: 1.3;
}
.dashboard-calendar-day .day-badge-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    margin-top: 0.2rem;
    flex-wrap: wrap;
}
.dashboard-calendar-day .day-dot {
    display: inline-block;
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.6);
    flex-shrink: 0;
}
.dashboard-calendar-day .day-count {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
    line-height: 1.2;
}
.dashboard-calendar-popover {
    position: sticky;
    top: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    max-height: 20rem;
    overflow-y: auto;
}
.dashboard-calendar-popover[hidden] {
    display: none !important;
}
.dashboard-calendar-popover-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}
.dashboard-calendar-popover-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.dashboard-calendar-popover-list li {
    margin-bottom: 0.35rem;
}
.dashboard-calendar-popover-list li:last-child {
    margin-bottom: 0;
}
.dashboard-calendar-popover-date-cap {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-top: 0.6rem;
    margin-bottom: 0.25rem;
    padding: 0;
    list-style: none;
}
.dashboard-calendar-popover-list li:first-child.dashboard-calendar-popover-date-cap {
    margin-top: 0;
}
.dashboard-calendar-popover-link {
    display: block;
    padding: 0.45rem 0.6rem;
    font-size: 0.875rem;
    color: var(--text);
    background: var(--bg);
    border: 1px solid transparent;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
}
.dashboard-calendar-popover-link:hover {
    background: var(--bg-hover);
    border-color: var(--border);
    color: var(--text);
}
.dashboard-calendar-popover-empty {
    font-size: 0.875rem;
    color: var(--text-muted);
    padding: 0.5rem 0;
}

/* Booking view mode (read-only): disabled fields look like content, not grayed out */
.booking-view-mode input:disabled,
.booking-view-mode select:disabled,
.booking-view-mode textarea:disabled {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--border);
    cursor: default;
    opacity: 1;
}

/* Booking View details: sezioni e dettagli in sola lettura */
.booking-detail-view {
    padding: var(--content-pad);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}
.booking-detail-section {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.booking-detail-section-title {
    margin: 0;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border);
}
.booking-detail-list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.booking-detail-row {
    display: grid;
    grid-template-columns: 10rem 1fr;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border);
    align-items: baseline;
}
.booking-detail-row:last-child {
    border-bottom: none;
}
.booking-detail-row dt {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    font-weight: 500;
}
.booking-detail-row dd {
    margin: 0;
    color: var(--text);
}
.booking-detail-row dd .badge {
    vertical-align: middle;
}
@media (max-width: 520px) {
    .booking-detail-row {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }
}

/* Stats dashboard – fluid grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
}
.stat-card .value { font-size: clamp(0.8rem, 2.2vw, 1.1rem); font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; word-break: break-all; line-height: 1.3; }
.stat-card .label { font-size: var(--font-size-sm); color: var(--text-muted); margin-top: 0.25rem; }
.stat-card.primary .value { color: var(--primary); }
.stat-card.success .value { color: var(--success); }
.stat-card.warning .value { color: var(--warning); }

/* Dashboard stats / quick links – tint backgrounds (match product badges) */
.stat-card.stat-tint-primary {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.35);
}
.stat-card.stat-tint-primary .value { color: var(--primary); }
.stat-card.stat-tint-excursion {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}
.stat-card.stat-tint-excursion .value { color: #93c5fd; }
.stat-card.stat-tint-tour {
    background: rgba(234, 179, 8, 0.12);
    border-color: rgba(234, 179, 8, 0.35);
}
.stat-card.stat-tint-tour .value { color: #fde047; }
.stat-card.stat-tint-cruise {
    background: rgba(249, 115, 22, 0.12);
    border-color: rgba(249, 115, 22, 0.35);
}
.stat-card.stat-tint-cruise .value { color: #fdba74; }
.stat-card.stat-tint-transfer {
    background: rgba(120, 53, 15, 0.25);
    border-color: rgba(180, 83, 9, 0.35);
}
.stat-card.stat-tint-transfer .value { color: #d6d3a2; }
.stat-card.stat-tint-muted {
    background: var(--bg-card);
    border-color: var(--border);
}
.stat-card.stat-tint-muted .value { color: var(--text); }

.dashboard-quick-links .stat-card:hover {
    filter: brightness(1.06);
    border-color: var(--primary);
}

.empty-state-cell {
    padding: var(--space-lg);
    text-align: center;
    vertical-align: middle;
}

/* Filters bar – fluid */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    align-items: center;
    margin-bottom: var(--space-md);
}
.filters-bar input,
.filters-bar select {
    padding: 0.5rem 0.75rem;
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 0;
}
.filters-bar input { min-width: min(160px, 100%); }

/* Empty state */
.empty-state {
    padding: var(--space-xl) var(--content-pad);
    text-align: center;
    color: var(--text-muted);
}
.empty-state p { margin: 0 0 1rem; }

/* Section permissions – responsive */
.section-permissions-grid {
    margin-top: var(--space-sm);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
.section-perm-row {
    display: grid;
    grid-template-columns: minmax(8rem, 1fr) 1fr 1fr;
    align-items: center;
    column-gap: clamp(1rem, 4vw, 2.5rem);
    row-gap: var(--space-sm);
}
.section-perm-label { font-size: var(--font-size-sm); color: var(--text-muted); }
.section-perm-row .perm-chip { justify-self: center; }
@media (max-width: 520px) {
    .section-perm-row {
        grid-template-columns: 1fr;
        gap: var(--space-xs);
    }
    .section-perm-row .perm-chip { justify-self: start; }
}

/* Tour edit: day-by-day – responsive */
.tour-days-block .tour-day { 
    margin-bottom: var(--space-md); 
    transition: opacity 0.2s, transform 0.2s;
    position: relative;
}
.tour-days-block .tour-day.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    cursor: grabbing;
}
.tour-days-block .tour-day.drag-over {
    border-top: 3px solid var(--primary);
    margin-top: var(--space-md);
}
.tour-days-block .tour-day[draggable="true"] {
    cursor: move;
}
.tour-days-block .tour-day[draggable="true"]:hover {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}
.tour-days-block .tour-lines-table input,
.tour-days-block .tour-lines-table select { 
    width: 100%; 
    min-width: 0;
    padding: 0.6rem 0.85rem;
    font: inherit;
    font-size: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.15s;
}
.tour-days-block .tour-lines-table input:focus,
.tour-days-block .tour-lines-table select:focus {
    outline: none;
    border-color: var(--primary);
}
.tour-days-block .tour-lines-table td.num input {
    text-align: right;
    min-width: 5rem;
}
.tour-days-block .tour-lines-table td.num input[name*="[quantity]"] {
    min-width: 4rem;
}
.tour-days-block .card-header .form-grid { min-width: 0; }
.tour-days-block .add-line-btn,
.tour-days-block .remove-day-btn {
    margin-top: 0;
    min-width: 120px;
    width: auto;
    flex-shrink: 0;
}
.tour-days-block .flex.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}
.tour-days-block .tour-line-type-select,
.tour-days-block .tour-line-unit-select {
    width: 100%;
    min-width: 0;
    padding: 0.6rem 0.85rem;
    font: inherit;
    font-size: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.15s;
    cursor: pointer;
}
.tour-days-block .tour-line-type-select:focus,
.tour-days-block .tour-line-unit-select:focus {
    outline: none;
    border-color: var(--primary);
}
.tour-days-block .tour-line-total {
    font-weight: 600;
    color: var(--text);
    padding: 0.6rem 0.85rem;
    text-align: right;
    white-space: nowrap;
}
.tour-days-block .flex.flex-end {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

/* Cruise Details: same as Tour Details (scroll + layout) */
.cruise-days-block .cruise-day {
    margin-bottom: var(--space-md);
    break-inside: avoid;
}
.cruise-days-block .cruise-day.dragging {
    opacity: 0.5;
}
.cruise-days-block .cruise-day.drag-over {
    border-top: 3px solid var(--primary);
    margin-top: var(--space-md);
}
.cruise-days-block .cruise-day[draggable="true"] {
    cursor: move;
}
.cruise-days-block .cruise-day[draggable="true"]:hover {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}
.cruise-days-block .cruise-lines-table input,
.cruise-days-block .cruise-lines-table select {
    width: 100%;
    min-width: 0;
    padding: 0.6rem 0.85rem;
    font: inherit;
    font-size: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.15s;
}
.cruise-days-block .cruise-lines-table input:focus,
.cruise-days-block .cruise-lines-table select:focus {
    outline: none;
    border-color: var(--primary);
}
.cruise-days-block .cruise-lines-table td.num input {
    text-align: right;
    min-width: 5rem;
}
.cruise-days-block .cruise-lines-table td.num input[name*="[quantity]"] {
    min-width: 4rem;
}
.cruise-days-block .card-header .form-grid { min-width: 0; }
.cruise-days-block .add-line-btn,
.cruise-days-block .remove-day-btn {
    margin-top: 0;
    min-width: 120px;
    width: auto;
    flex-shrink: 0;
}
.cruise-days-block .flex.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}
.cruise-days-block .cruise-line-type-select,
.cruise-days-block .cruise-line-unit-select {
    width: 100%;
    min-width: 0;
    padding: 0.6rem 0.85rem;
    font: inherit;
    font-size: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.15s;
    cursor: pointer;
}
.cruise-days-block .cruise-line-type-select:focus,
.cruise-days-block .cruise-line-unit-select:focus {
    outline: none;
    border-color: var(--primary);
}
.cruise-days-block .cruise-line-total {
    font-weight: 600;
    color: var(--text);
    padding: 0.6rem 0.85rem;
    text-align: right;
    white-space: nowrap;
}
.cruise-days-block .flex.flex-end {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    flex-wrap: wrap;
}
.cruise-days-block.excursion-details-card .excursion-details-details > div {
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tour-days-block.excursion-details-card .excursion-details-details > div {
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
@media (max-width: 640px) {
    .cruise-days-block .cruise-lines-table { font-size: 0.8125rem; }
    .cruise-days-block .cruise-lines-table th,
    .cruise-days-block .cruise-lines-table td { padding: var(--space-xs); }
}

/* App Footer */
.app-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: var(--space-lg) 0;
    flex-shrink: 0;
    text-align: center;
}
.footer-content {
    padding-left: var(--content-pad);
    padding-right: var(--content-pad);
}
.footer-inner {
    max-width: min(720px, 100%);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}
.footer-oneline {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: var(--space-xs);
    white-space: nowrap;
}
.footer-oneline .footer-sep {
    color: var(--text-muted);
    font-weight: 400;
    user-select: none;
}
.footer-oneline .footer-app,
.footer-oneline .footer-text {
    font-weight: 600;
    color: var(--text);
}
.footer-logo {
    height: 2rem;
    width: auto;
    object-fit: contain;
}
.footer-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}
.footer-link:hover {
    text-decoration: underline;
}
@media (max-width: 640px) {
    .tour-days-block .tour-lines-table { font-size: 0.8125rem; }
    .tour-days-block .tour-lines-table th,
    .tour-days-block .tour-lines-table td { padding: var(--space-xs); }
}

/* ========== Full responsive: mobile first, fluid ========== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 4px 0 24px rgba(0,0,0,0.3);
        height: auto;
    }
    .sidebar-open .sidebar {
        transform: translateX(0);
    }
    .sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }
    .sidebar.collapsed { width: var(--sidebar-w); }
    .sidebar.collapsed .sidebar-nav .nav-text,
    .sidebar.collapsed .sidebar-user-info { width: auto; opacity: 1; overflow: visible; }
    .header-sidebar-toggle { display: flex !important; }
    .header-sidebar-toggle.visible { display: flex !important; }
}
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
}
@media (min-width: 769px) {
    .sidebar-backdrop { display: none !important; }
}

/* Tour settings – collapsable card, fluid */
.card.collapsed .card-collapsible-content {
    display: none;
}
.card.collapsed .card-header .fa-chevron-down {
    transform: rotate(-90deg);
}
.card-header h2 .fa-chevron-down {
    transition: transform 0.2s ease;
    opacity: 0.6;
}
.tour-settings-grid {
    display: grid;
    gap: var(--space-lg);
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
}
.tour-settings-section {
    min-width: 0;
}
.tour-settings-section h3 {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: 600;
}
.tour-settings-section code {
    font-size: 0.875em;
    padding: 0.2rem 0.4rem;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--primary);
}
@media (max-width: 640px) {
    .tour-settings-grid { grid-template-columns: 1fr; }
}

/* Utilities */
.flex { display: flex; }
.flex-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 0.5rem; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: var(--font-size-sm); }
