/* Asaris — Design system hôtel 4★ */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;0,700;1,500&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
    --font-display: 'Cormorant Garamond', Georgia, serif;

    --navy: #005696;
    --navy-mid: #004578;
    --navy-light: #0068b8;
    --gold: #e8a317;
    --gold-light: #ffd966;
    --gold-dark: #c47a00;
    --cream: #e8f0f8;
    --cream-dark: #d4e4f2;
    --white: #ffffff;

    --header: var(--navy);
    --header-dark: #081c30;
    --accent: var(--gold);
    --bg: var(--cream);
    --card: var(--white);
    --text: #1a2332;
    --muted: #6b7a8a;
    --ok: #1b6b45;
    --err: #a32020;
    --border: #e2ddd5;
    --border-light: #ece8e2;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 2px 8px rgba(12, 39, 68, .06);
    --shadow-md: 0 8px 28px rgba(12, 39, 68, .08);
    --shadow-lg: 0 16px 48px rgba(12, 39, 68, .12);
    --transition: .2s cubic-bezier(.4, 0, .2, 1);

    --bp-sm: 560px;
    --bp-md: 768px;
    --bp-lg: 900px;
    --bp-xl: 1100px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--navy-mid); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold-dark); }

/* ——— Header ——— */
.app-header {
    position: relative;
    background: linear-gradient(135deg, #0070c0 0%, var(--navy) 50%, var(--header-dark) 100%);
    color: #fff;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    min-height: 68px;
    box-shadow: var(--shadow-md);
}
.app-header::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-dark));
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
}
.header-logo {
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
    border: 2px solid rgba(201, 169, 98, .45);
    object-fit: cover;
}
.header-app {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: .06em;
    line-height: 1.15;
    text-transform: none;
}
.header-module {
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .12em;
    opacity: .75;
    margin-top: 2px;
    color: var(--gold-light);
}
.header-stars {
    display: inline-flex;
    gap: 2px;
    margin-left: 8px;
    font-size: .65rem;
    color: var(--gold);
    vertical-align: middle;
    letter-spacing: 1px;
}

.header-brand-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.header-brand-top {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.header-ops-date {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .16);
    font-size: .78rem;
    font-weight: 500;
    color: rgba(255, 255, 255, .92);
    white-space: nowrap;
    letter-spacing: .02em;
}

.header-ops-date strong {
    font-weight: 800;
    color: #fff;
}

.header-ops-date-icon {
    flex-shrink: 0;
    opacity: .85;
}

.header-ops-lag {
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(198, 40, 40, .35);
    color: #ffcdd2;
    font-size: .68rem;
    font-weight: 800;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 0;
}
.header-user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 6px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 999px;
    font-size: .88rem;
}
.header-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--navy);
    font-weight: 800;
    font-size: .75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.header-user-name { font-weight: 600; opacity: .95; }

/* ——— Buttons ——— */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: none;
    font-family: inherit;
    font-weight: 700;
    font-size: .86rem;
    letter-spacing: .02em;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
}
.btn-primary {
    background: linear-gradient(135deg, var(--navy-mid), var(--navy));
    color: #fff;
    box-shadow: 0 4px 14px rgba(12, 39, 68, .25);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--navy-light), var(--navy-mid));
    box-shadow: 0 6px 20px rgba(12, 39, 68, .3);
    text-decoration: none;
    color: #fff;
    transform: translateY(-1px);
}
.btn-accent {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--navy);
    box-shadow: 0 4px 14px rgba(201, 169, 98, .35);
}
.btn-accent:hover { filter: brightness(1.05); text-decoration: none; color: var(--navy); }
.btn-ghost {
    background: rgba(255, 255, 255, .08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .2);
}
.btn-ghost:hover {
    background: rgba(255, 255, 255, .15);
    border-color: rgba(201, 169, 98, .5);
    text-decoration: none;
    color: #fff;
}

.btn-pwa-install {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #0077b6, #005696);
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 2px 10px rgba(0, 86, 150, 0.35);
    font-size: 0.82rem;
}

.btn-pwa-install:hover {
    background: linear-gradient(135deg, #0096c7, #0077b6);
    text-decoration: none;
    color: #fff !important;
    transform: translateY(-1px);
}

.btn-pwa-install svg {
    flex-shrink: 0;
}

.btn-pwa-refresh,
.btn-pwa-fullscreen {
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: rgba(255, 255, 255, 0.1);
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    cursor: pointer;
}

body.pwa-installed [data-pwa-refresh],
html.pwa-standalone [data-pwa-refresh] {
    display: inline-flex;
}

html.pwa-fullscreen-api body.pwa-installed [data-pwa-fullscreen],
html.pwa-fullscreen-api.pwa-standalone [data-pwa-fullscreen] {
    display: inline-flex;
}

.btn-pwa-refresh:hover,
.btn-pwa-fullscreen:hover {
    background: rgba(255, 255, 255, 0.18);
    text-decoration: none;
    color: #fff !important;
}

.btn-pwa-refresh:disabled {
    opacity: 0.65;
    cursor: wait;
}

.btn-pwa-refresh svg,
.btn-pwa-fullscreen svg {
    flex-shrink: 0;
    pointer-events: none;
}

.btn-pwa-fullscreen .pwa-fs-icon-exit {
    display: none;
}

.btn-pwa-fullscreen.is-active .pwa-fs-icon-enter {
    display: none;
}

.btn-pwa-fullscreen.is-active .pwa-fs-icon-exit {
    display: block;
}

.btn-pwa-fullscreen.is-active .pwa-fs-icon-exit[hidden] {
    display: block;
}

.btn-pwa-refresh.is-busy svg {
    animation: pwa-refresh-spin 0.8s linear infinite;
}

@keyframes pwa-refresh-spin {
    to { transform: rotate(360deg); }
}

/* PWA installée — masquer l'installation, pas le bouton d'actualisation */
body.pwa-installed [data-pwa-install],
body.pwa-installed [data-pwa-install-manual],
body.pwa-installed #pwaInstallBanner,
html.pwa-standalone [data-pwa-install],
html.pwa-standalone [data-pwa-install-manual] {
    display: none !important;
}

/* Mode application (sans barre d'adresse du navigateur) */
html.pwa-standalone,
body.pwa-standalone {
    min-height: 100dvh;
    min-height: 100vh;
}

html.pwa-immersive,
html.pwa-immersive body,
html:fullscreen,
html:fullscreen body,
html:-webkit-full-screen,
html:-webkit-full-screen body {
    min-height: 100%;
    height: 100%;
    overflow: hidden;
}

html.pwa-immersive body.pwa-installed .app-header,
html.pwa-immersive body.pwa-standalone .app-header,
html.pwa-immersive.pwa-standalone .app-header,
html.pwa-immersive .app-header {
    display: none !important;
}

html.pwa-immersive body.pwa-installed .app-footer,
html.pwa-immersive body.pwa-standalone .app-footer,
html.pwa-immersive .app-footer {
    display: none !important;
}

html.pwa-immersive body.pos-portal {
    min-height: 100dvh;
    max-height: 100dvh;
}

html.pwa-immersive body.pos-portal .pos-shell {
    max-width: none;
    margin: 0;
    padding: 0;
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pwa-immersive-floater {
    position: fixed;
    right: max(12px, env(safe-area-inset-right, 0));
    bottom: max(12px, env(safe-area-inset-bottom, 0));
    z-index: 13000;
    display: flex;
    pointer-events: none;
}

.pwa-immersive-floater .btn-pwa-fullscreen {
    display: inline-flex !important;
    pointer-events: auto;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: rgba(0, 77, 64, 0.92);
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}

html:fullscreen body,
html:-webkit-full-screen body {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

body.pwa-standalone {
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
}

body.pwa-standalone .app-header {
    padding-top: max(10px, env(safe-area-inset-top, 0));
}

body.pwa-standalone.pos-fullscreen {
    padding-top: 0;
}

body.pwa-standalone.pos-fullscreen .pos-term-head,
body.pwa-standalone.pos-fullscreen .pos-rpt-hero {
    padding-top: max(10px, env(safe-area-inset-top, 0));
}

.btn-night-audit {
    position: relative;
    overflow: hidden;
    background: linear-gradient(145deg, #2a2a2a 0%, #0a0a0a 45%, #1a1a1a 100%);
    color: #f5f5f5 !important;
    border: 1px solid rgba(255, 255, 255, .14);
    box-shadow:
        0 4px 18px rgba(0, 0, 0, .45),
        inset 0 1px 0 rgba(255, 255, 255, .12),
        inset 0 -1px 0 rgba(0, 0, 0, .5);
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: .78rem;
}
.btn-night-audit::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 30%,
        rgba(255, 255, 255, .14) 48%,
        transparent 66%
    );
    transform: translateX(-120%);
    animation: btnNightAuditShine 4s ease-in-out infinite;
}
.btn-night-audit:hover {
    background: linear-gradient(145deg, #3a3a3a 0%, #111 50%, #222 100%);
    color: #fff !important;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, .55),
        inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn-night-audit.is-pending {
    border-color: rgba(232, 163, 23, .55);
    box-shadow:
        0 0 0 1px rgba(232, 163, 23, .25),
        0 6px 22px rgba(0, 0, 0, .5),
        inset 0 1px 0 rgba(255, 255, 255, .1);
}
.btn-night-audit.is-schedule-blocked {
    opacity: 0.55;
    cursor: not-allowed;
    filter: grayscale(0.4);
}
.btn-night-audit-icon {
    flex-shrink: 0;
    opacity: .9;
}
.btn-night-audit-pulse {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 8px var(--gold);
    animation: btnNightAuditPulse 1.8s ease-in-out infinite;
}
@keyframes btnNightAuditShine {
    0%, 75%, 100% { transform: translateX(-120%); }
    40% { transform: translateX(120%); }
}
@keyframes btnNightAuditPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .5; transform: scale(1.35); }
}

/* ——— Layout ——— */
.main {
    max-width: 1240px;
    margin: 0 auto;
    padding: 32px 24px 56px;
}

.app-footer {
    text-align: center;
    padding: 24px 20px;
    color: var(--muted);
    font-size: .82rem;
    border-top: 1px solid var(--border);
    background: var(--white);
    letter-spacing: .03em;
}
.app-footer strong { color: var(--navy); font-weight: 700; }

/* ——— Cards ——— */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 28px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}
.card h2, .card h3 {
    margin-top: 0;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--navy);
    letter-spacing: .01em;
}
.card h2 { font-size: 1.65rem; }

/* ——— Hub ——— */
.hub-hero {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 60%, #1a4a6e 100%);
    border-radius: var(--radius);
    padding: 36px 40px;
    margin-bottom: 28px;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}
.hub-hero::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -10%;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(201, 169, 98, .15) 0%, transparent 70%);
}
.hub-hero::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.hub-hero .hub-app-name {
    margin: 0 0 4px;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    font-style: italic;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--gold-light);
    position: relative;
    z-index: 1;
}
.hub-hero h2 {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
}
.hub-hero p {
    margin: 0;
    opacity: .82;
    font-size: .95rem;
    position: relative;
    z-index: 1;
}
.hub-hero .hub-date {
    margin-top: 14px;
    font-size: .82rem;
    opacity: .65;
    text-transform: uppercase;
    letter-spacing: .1em;
    position: relative;
    z-index: 1;
}

.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
}
.hub-tile {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    text-align: left;
    transition: all var(--transition);
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.hub-tile::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gold);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition);
}
.hub-tile:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: rgba(201, 169, 98, .4);
    text-decoration: none;
    color: inherit;
}
.hub-tile:hover::before { transform: scaleX(1); }
.hub-tile.disabled {
    opacity: .45;
    pointer-events: none;
    filter: grayscale(.3);
}
.hub-tile-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #eef2f7, #e4eaf2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 1.4rem;
}
.hub-tile.active .hub-tile-icon {
    background: linear-gradient(135deg, rgba(12, 39, 68, .08), rgba(12, 39, 68, .04));
}
.hub-tile h3 {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--navy);
}
.hub-tile p {
    margin: 0;
    font-size: .86rem;
    color: var(--muted);
    line-height: 1.45;
}
.hub-tile-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--cream-dark);
    color: var(--muted);
}

/* ——— KPI ——— */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.kpi {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.kpi-val {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--navy);
}
.kpi-label {
    font-size: .78rem;
    color: var(--muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 600;
}

/* ——— Forms ——— */
.form-grid { display: grid; gap: 16px; }
.form-row { display: grid; gap: 7px; }
.form-row label {
    font-weight: 600;
    font-size: .84rem;
    color: var(--navy);
    letter-spacing: .02em;
}
.form-row input,
.form-row select,
.form-row textarea {
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    background: var(--white);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: none;
    border-color: var(--navy-mid);
    box-shadow: 0 0 0 3px rgba(12, 39, 68, .1);
}
.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

/* ——— Tables ——— */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
table.data th,
table.data td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
}
table.data th {
    background: var(--cream);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    font-weight: 700;
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #faf9f7; }

/* ——— Badges ——— */
.badge {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
}
.st-libre { background: #e8f3ed; color: #1b6b45; }
.st-occupee { background: #e8eef5; color: #1a4a7a; }
.st-sale { background: #faf0e6; color: #9a5e00; }
.st-nettoyage { background: #f3edf5; color: #6a3a7a; }
.st-hors { background: #eceff1; color: #546e7a; }

/* ——— Flash ——— */
.flash {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-weight: 600;
    font-size: .9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.flash-ok {
    background: #edf7f0;
    color: var(--ok);
    border: 1px solid #b8dfc8;
}
.flash-err {
    background: #fdf0f0;
    color: var(--err);
    border: 1px solid #e8b4b4;
}

/* ——— Chambres grid ——— */
.chambres-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}
.chambre-card {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
    transition: border-color var(--transition);
}
.chambre-card .num { font-size: 1.2rem; font-weight: 800; color: var(--navy); }
.chambre-card .type { font-size: .72rem; color: var(--muted); }

/* ——— Login (styles dans login.css — body.login-body) ——— */

/* Legacy login wrap fallback */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--cream);
}

/* ——— Folio ——— */
.folio-total {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--navy);
}
.folio-solde-due { color: var(--err); }
.folio-solde-ok { color: var(--ok); }

.card-lunas { border-left: 4px solid var(--gold); }
.lunas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.lunas-clock {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--navy);
}
.lunas-form { max-width: 640px; }
.form-row-full { grid-column: 1 / -1; }

.subnav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.subnav-link {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: var(--white);
    border: 1px solid var(--border);
    font-weight: 600;
    font-size: .86rem;
    text-decoration: none;
}
.subnav-link.active,
.subnav-link:hover {
    background: var(--navy);
    color: #fff;
    text-decoration: none;
}

@media print {
    .app-header, .subnav, .header-nav, .btn, .app-footer { display: none !important; }
}
