:root {
    --fmw-orange: #E67E22;
    --fmw-orange-soft: #FDEBDC;
    --fmw-ink: #24313F;
    --fmw-muted: #6B7785;
    --fmw-line: #EBEEF2;
    --fmw-bg: #F6F7F9;
}

html, body {
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    background: var(--fmw-bg);
    color: var(--fmw-ink);
    -webkit-font-smoothing: antialiased;
}

/* Barra di scorrimento sempre "riservata": evita il restringimento/allargamento
   del viewport (flickering) quando una pagina passa da corta a lunga. */
@supports (scrollbar-gutter: stable) {
    html { scrollbar-gutter: stable; }
}
@supports not (scrollbar-gutter: stable) {
    html { overflow-y: scroll; }
}

h1:focus { outline: none; }

/* ---------- app bar ---------- */
.fmw-appbar {
    background: #ffffff !important;
    border-bottom: 1px solid var(--fmw-line);
    color: var(--fmw-ink) !important;
    padding-left: 8px;
}

.fmw-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 8px;
    text-decoration: none;
    color: inherit;
}

.fmw-brand-logo {
    height: 30px;
    width: auto;
    max-width: 130px;
    object-fit: contain;
    display: block;
}

.fmw-brand-divider {
    width: 1px;
    height: 26px;
    background: var(--fmw-line);
}

.fmw-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.fmw-brand-title { font-size: .88rem; font-weight: 600; color: var(--fmw-ink); }
.fmw-brand-sub {
    font-size: .7rem;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--fmw-muted);
}

.fmw-user { text-transform: none !important; }
.fmw-user-name {
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .82rem;
}

/* ---------- drawer / nav ---------- */
.fmw-drawer { border-right: 1px solid var(--fmw-line) !important; }
.fmw-nav { padding: 10px 8px; }
.fmw-nav .mud-nav-link {
    border-radius: 10px;
    font-size: .86rem;
    min-height: 42px;
}
.fmw-nav .mud-nav-link.active {
    background: var(--fmw-orange-soft);
    color: #A85A10 !important;
    font-weight: 600;
}
.fmw-nav-caption {
    color: #98A4B0 !important;
    letter-spacing: .09em;
    padding: 10px 14px 2px;
    font-size: .68rem !important;
}

/* ---------- content ---------- */
.fmw-content { padding: 26px 24px 72px; }

.fmw-page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.fmw-page-title { font-size: 1.3rem; font-weight: 600; margin: 0; line-height: 1.25; }
.fmw-page-sub { font-size: .84rem; color: var(--fmw-muted); margin-top: 3px; }

.fmw-card {
    border: 1px solid var(--fmw-line) !important;
    border-radius: 14px !important;
    box-shadow: none !important;
}

.fmw-kpi { min-height: 96px; display: flex; flex-direction: column; justify-content: space-between; }
.fmw-kpi-value { font-size: 1.7rem; font-weight: 600; line-height: 1; }
.fmw-kpi-label { font-size: .76rem; color: var(--fmw-muted); text-transform: uppercase; letter-spacing: .06em; }

.fmw-muted { color: var(--fmw-muted); }
.fmw-loading { display: flex; justify-content: center; padding: 48px; }
.fmw-loading-bar { height: 4px; border-radius: 4px; margin-bottom: 10px; }
.fmw-empty { padding: 44px 16px; text-align: center; color: var(--fmw-muted); font-size: .88rem; }

.fmw-table .mud-table-cell { font-size: .84rem; }
.fmw-clickable { cursor: pointer; }

/* ---------- calendario sale ---------- */
.fmw-cal-scroll { overflow-x: auto; }
.fmw-cal {
    display: flex;
    min-width: 760px;
    border: 1px solid var(--fmw-line);
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
}
.fmw-cal-hours {
    flex: 0 0 58px;
    width: 58px;
    background: #FCFCFD;
    border-right: 1px solid var(--fmw-line);
}
.fmw-cal-spacer { height: 54px; border-bottom: 1px solid var(--fmw-line); }
.fmw-cal-hourlabel {
    height: 34px;
    padding-right: 6px;
    text-align: right;
    font-size: .66rem;
    color: var(--fmw-muted);
    line-height: 34px;
}
.fmw-cal-day { flex: 1 1 0; min-width: 0; border-left: 1px solid #F2F4F7; }
.fmw-cal-day:first-of-type { border-left: 0; }
.fmw-cal-dayhead {
    height: 54px;
    padding: 7px 4px 4px;
    text-align: center;
    background: #FAFBFC;
    border-bottom: 1px solid var(--fmw-line);
}
.fmw-cal-dayhead.today { background: #FFF8F2; }
.fmw-cal-dayhead .dow {
    display: block;
    font-size: .66rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--fmw-muted);
}
.fmw-cal-dayhead .dnum { display: block; font-size: .98rem; font-weight: 600; color: var(--fmw-ink); }
.fmw-cal-body { position: relative; }
.fmw-cal-slot { height: 34px; border-top: 1px solid #F3F5F8; cursor: pointer; }
.fmw-cal-slot:hover { background: #FFF8F2; }
.fmw-cal-slot.weekend { background: #FCFCFD; }

.fmw-booking {
    position: absolute;
    left: 3px;
    right: 3px;
    border-radius: 8px;
    background: var(--fmw-orange-soft);
    border-left: 3px solid var(--fmw-orange);
    font-size: .68rem;
    line-height: 1.15;
    padding: 2px 5px;
    overflow: hidden;
    cursor: pointer;
    color: #7A430F;
    box-shadow: 0 1px 2px rgba(36,49,63,.06);
}
.fmw-booking.cancelled {
    background: #F3F4F6;
    border-left-color: #B0B7BF;
    color: #8A929B;
    text-decoration: line-through;
}
.fmw-booking-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fmw-booking-time { font-size: .64rem; opacity: .85; }

/* ---------- form controls (SSR / login) ---------- */
.fmw-field { display: block; margin-bottom: 14px; }
.fmw-field label { display: block; font-size: .78rem; color: var(--fmw-muted); margin-bottom: 6px; }
.fmw-input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 12px;
    border: 1px solid #DDE3E9;
    border-radius: 10px;
    font-size: .9rem;
    background: #fff;
    color: var(--fmw-ink);
    outline: none;
    font-family: inherit;
}
.fmw-input:focus { border-color: var(--fmw-orange); box-shadow: 0 0 0 3px rgba(230, 126, 34, .12); }
.fmw-btn {
    width: 100%;
    padding: 11px 14px;
    border: 0;
    border-radius: 10px;
    background: var(--fmw-orange);
    color: #fff;
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
    font-family: inherit;
}
.fmw-btn:hover { background: #cf6f14; }
.fmw-remember { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--fmw-muted); margin-bottom: 18px; }

/* ---------- login ---------- */
.fmw-login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(900px 500px at 12% -10%, #FDF0E4 0%, transparent 60%),
        radial-gradient(700px 400px at 95% 105%, #EFF3F7 0%, transparent 55%),
        var(--fmw-bg);
    padding: 24px;
}
.fmw-login-card {
    width: 100%;
    max-width: 392px;
    background: #fff;
    border: 1px solid var(--fmw-line);
    border-radius: 18px;
    padding: 34px 30px 28px;
    box-shadow: 0 18px 50px -30px rgba(36, 49, 63, .35);
}
.fmw-login-logo { height: 34px; margin-bottom: 22px; }
.fmw-login-title { font-size: 1.12rem; font-weight: 600; margin: 0 0 4px; }
.fmw-login-sub { font-size: .82rem; color: var(--fmw-muted); margin-bottom: 22px; }
.fmw-login-error {
    background: #FDECEA;
    border: 1px solid #F5C6C0;
    color: #A93226;
    font-size: .8rem;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 14px;
}
.fmw-login-foot { margin-top: 22px; font-size: .72rem; color: #98A4B0; text-align: center; }

/* ---------- ordinazione (listino + ordine) ---------- */
.fmw-order {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
.fmw-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.fmw-panel-title { font-size: .95rem; font-weight: 600; color: var(--fmw-ink); }
.fmw-panel-sub { font-size: .75rem; color: var(--fmw-muted); margin-top: 1px; }
.fmw-order-search { max-width: 190px; }
.fmw-order-list { max-height: 460px; overflow: auto; margin: 0 -4px; padding: 0 4px; }
.fmw-order-group {
    font-size: .67rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: #98A4B0;
    margin: 14px 0 4px;
}
.fmw-catalog-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 6px;
    border-radius: 9px;
}
.fmw-catalog-row:hover { background: #FAFBFC; }
.fmw-catalog-main { flex: 1; min-width: 0; }
.fmw-catalog-name {
    font-size: .83rem;
    font-weight: 600;
    color: var(--fmw-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fmw-catalog-meta {
    font-size: .72rem;
    color: var(--fmw-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fmw-catalog-price {
    font-size: .8rem;
    color: var(--fmw-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.fmw-qty-badge {
    min-width: 26px;
    text-align: center;
    font-size: .75rem;
    font-weight: 600;
    background: var(--fmw-orange-soft);
    color: #A85A10;
    border-radius: 999px;
    padding: 2px 8px;
}
.fmw-order-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    border-bottom: 1px solid var(--fmw-line);
}
.fmw-order-main { flex: 1; min-width: 0; }
.fmw-order-qty { max-width: 96px; }
.fmw-order-line {
    font-size: .83rem;
    font-weight: 600;
    min-width: 70px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.fmw-order-total {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--fmw-ink);
    font-variant-numeric: tabular-nums;
}

/* ---------- intestazioni sezione form ---------- */
.fmw-section-head { display: flex; align-items: center; gap: 10px; margin: 28px 0 12px; }
.fmw-section-bar { width: 4px; height: 22px; border-radius: 2px; background: var(--fmw-orange); }
.fmw-section-title { font-size: 1.02rem; font-weight: 600; color: var(--fmw-ink); letter-spacing: .01em; }
.fmw-section-line { flex: 1; height: 1px; background: var(--fmw-line); }

/* ---------- chip sale ---------- */
.fmw-room-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.fmw-room-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    border: 1px solid var(--fmw-line);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: .79rem;
    color: var(--fmw-ink);
    background: #fff;
    user-select: none;
    transition: opacity .12s, border-color .12s;
}
.fmw-room-chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.fmw-room-chip.off { opacity: .42; text-decoration: line-through; }
.fmw-room-chip:hover { border-color: #D5DCE3; }

/* ---------- nav ---------- */
.fmw-nav-cta { display: block; margin: 6px 10px 12px; }
.fmw-nav-cta .mud-button-root {
    width: 100%;
    justify-content: center;
    text-transform: none;
    font-weight: 600;
    border-radius: 10px;
    padding: 9px 14px;
}
.fmw-nav-link-row { display: flex; align-items: center; width: 100%; gap: 10px; }
.fmw-nav-count {
    margin-left: auto;
    font-size: .7rem;
    font-weight: 700;
    background: var(--fmw-orange-soft);
    color: #A85A10;
    border-radius: 999px;
    padding: 1px 7px;
    min-width: 22px;
    text-align: center;
}

@media (max-width: 1100px) {
    .fmw-order { grid-template-columns: 1fr; }
    .fmw-order-search { max-width: none; }
}

/* ---------- richiedente ---------- */
.fmw-requester {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    margin-bottom: 6px;
}
@media (max-width: 700px) {
    .fmw-requester { grid-template-columns: 1fr; }
}

/* ---------- card servizi (nuova richiesta) ---------- */
.fmw-service-card {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 100%;
    background: #fff;
    border: 1px solid var(--fmw-line);
    border-radius: 14px;
    padding: 16px 14px;
    cursor: pointer;
    transition: border-color .14s, box-shadow .14s, transform .14s;
}
.fmw-service-card:hover {
    border-color: #F0C9A8;
    box-shadow: 0 10px 28px -22px rgba(36, 49, 63, .55);
    transform: translateY(-1px);
}
.fmw-service-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 12px;
    background: var(--fmw-orange-soft);
    color: var(--fmw-orange);
    display: grid;
    place-items: center;
}
.fmw-service-body { flex: 1; min-width: 0; }
.fmw-service-name {
    font-size: .9rem;
    font-weight: 600;
    color: var(--fmw-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fmw-service-desc {
    font-size: .76rem;
    color: var(--fmw-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fmw-service-arrow { color: #B9C2CB; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
    .fmw-content { padding: 18px 14px 64px; }
    .fmw-brand-text { display: none; }
    .fmw-brand-divider { display: none; }
    .fmw-calendar { grid-template-columns: 48px repeat(7, minmax(0, 1fr)); }
}
