:root {
    --brand: #FFA500;
    --ok: #16a34a;
    --bad: #dc2626;
    --muted: #6b7280;
    --bg: #f8fafc;
    --card: #ffffff;
    --line: #e5e7eb;
    --chip: #f3f4f6;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans";
    color: #111827;
    background: var(--bg);
    height: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Topbar full width */
header.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    width: 100%;
}

.title {
    font-weight: 700;
    letter-spacing: .2px;
}

.count-badge {
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    padding: 10px 10px;
    border-radius: 999px;
}

/* CONTAINER FULL WIDTH + FULL HEIGHT */
.container {
    width: 100%;
    flex: 1 1 auto;
    margin: 0;
    padding: 8px 8px 16px;
}

.table-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}

.table-scroll {
    overflow: auto;
    max-height: calc(100vh - 120px);
}

/* Table */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
}

/* === STILE ARANCIONE TIPO archivio.css === */
thead th {
    background: var(--brand);
    color: #fff;
    text-align: left;
    font-size: 12px;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 10px;
    border-bottom: 2px solid var(--brand);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 5;
}

tbody tr {
    border-bottom: 1px solid #f2c894;
}

tbody tr:nth-child(even) {
    background: #fff8f0;
}

tbody tr:hover {
    background: #ffe5c2;
}

td {
    padding: 10px;
    vertical-align: top;
    line-height: 1.25;
}

.info-cell .sub {
    display: block;
    font-size: 12px;
    color: #4b5563;
    margin-top: 2px;
}

.money {
    font-weight: 700;
    white-space: nowrap;
}

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

.state-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 12px;
    background: var(--chip);
    color: #111827;
}

.state-chip.ok {
    background: #e6f8ea;
    color: #0d6847;
}

.state-chip.bad {
    background: #ffeaea;
    color: #a00000;
}

.bed-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    margin: 0 6px 6px 0;
    border-radius: 999px;
    background: var(--chip);
    border: 1px solid var(--line);
    cursor: help !important;
}

.bed-icon {
    font-size: 12px;
}


.services-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.svc-item {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--chip);
    border: 1px solid var(--line);
    transition: transform .12s ease, box-shadow .12s ease;
}

.svc-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 140, 0, 0.15);
}

.svc-item i {
    font-size: 12px;
}

.photos {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.ph {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: 8px;
    border: 1px solid var(--line);
    object-fit: cover;
    background: #eee;
}

.actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
    transition: box-shadow .2s ease, transform .2s ease;
}

.btn-icon:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(255, 140, 0, .18);
}

.btn-icon.edit {
    color: #1d4ed8;
}

.btn-icon.del {
    color: #b91c1c;
}

.btn-icon i {
    font-size: 16px;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 50;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal .box {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--line);
    padding: 20px;
}

.modal .box .row {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    justify-content: flex-end;
}

.btn {
    border: none;
    cursor: pointer;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 600;
}

/* Cursore con punto interrogativo sui servizi */
.svc-item {
    cursor: help;
}

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

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

.btn.ghost {
    background: #fff;
    border: 1px solid var(--line);
}

@media (max-width: 900px) {
    .table-scroll {
        max-height: calc(100vh - 140px);
    }

    td,
    th {
        padding: 8px;
    }

    .ph {
        width: 40px;
        height: 40px;
    }
}

/* Search input (globale) */
#searchGlobale {
    background: #fff;
    border: 1px solid var(--brand);
    transition: 0.2s ease;
    border-radius: 6px;
    padding: 6px 10px;
}

#searchGlobale:focus {
    border-color: var(--brand);
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 140, 0, 0.25);
}