/* ============================================================
   Meus Apês — PWA do hóspede (mobile-first)
   Mesma paleta do app, mas com cara de hospitalidade.
   ============================================================ */

:root {
    --navy: #1A2A3A;
    --navy-2: #2C4A6E;
    --navy-3: #4A7A9C;
    --peach: #E8A87C;
    --peach-soft: #FBE9DC;
    --green: #34D399;
    --amber: #FBBF24;
    --red: #EF4444;
    --ink: #0F172A;
    --muted: #64748B;
    --line: #E2E8F0;
    --bg: #F4F6F9;
    --surface: #FFFFFF;
    --radius: 22px;
    --radius-sm: 14px;
    --shadow: 0 10px 30px rgba(15, 23, 42, .08);
    --shadow-soft: 0 2px 10px rgba(15, 23, 42, .06);
    --nav-h: 68px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body.g-body {
    margin: 0;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 1rem);
}

/* brilho decorativo no topo */
.g-glow {
    position: fixed;
    inset: -20% -30% auto -30%;
    height: 380px;
    background: radial-gradient(60% 60% at 50% 0%, rgba(232, 168, 124, .35), rgba(74, 122, 156, .18) 45%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

a { color: var(--navy-2); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 .3em; line-height: 1.25; letter-spacing: -.015em; }
h1 { font-size: 1.5rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .8em; }

.g-small { font-size: .875rem; }
.g-muted { color: var(--muted); }
.g-center { text-align: center; }

/* ---------------- topo ---------------- */
.g-top {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    max-width: 560px;
    margin: 0 auto;
    padding: calc(env(safe-area-inset-top) + .9rem) 1rem .4rem;
}

.g-brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; }

.g-logo {
    width: 42px; height: 42px;
    display: grid; place-items: center;
    font-size: 1.2rem;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--peach), var(--navy-3));
    box-shadow: var(--shadow-soft);
}

.g-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.g-brand-text strong { font-size: .98rem; letter-spacing: -.01em; }
.g-brand-text small { font-size: .72rem; color: var(--muted); }

.g-who { text-align: right; line-height: 1.2; }
.g-who-name { display: block; font-weight: 700; font-size: .9rem; }
.g-who-sub { display: block; font-size: .72rem; color: var(--muted); }

/* ---------------- conteúdo ---------------- */
.g-main {
    position: relative;
    z-index: 1;
    max-width: 560px;
    margin: 0 auto;
    padding: .5rem 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ---------------- cartões ---------------- */
.g-card {
    background: var(--surface);
    border: 1px solid rgba(15, 23, 42, .05);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.1rem;
}

.g-card-flat {
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-soft);
    padding: .9rem;
}

.g-card-head {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    margin-bottom: .7rem;
}

.g-tile {
    flex: none;
    width: 46px; height: 46px;
    display: grid; place-items: center;
    font-size: 1.35rem;
    border-radius: 15px;
    background: linear-gradient(160deg, #F7F9FC, #EEF3F8);
    border: 1px solid var(--line);
}

.g-tile-lock { background: linear-gradient(160deg, #FDF1E7, #FBE3CE); border-color: #F5D4B8; }
.g-tile-green { background: linear-gradient(160deg, #E8FBF3, #CFF6E5); border-color: #A7EFD2; }

/* ---------------- hero ---------------- */
.g-hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    padding: 1.3rem;
    color: #fff;
    background: linear-gradient(140deg, var(--navy) 0%, var(--navy-2) 55%, var(--navy-3) 100%);
    box-shadow: 0 16px 40px rgba(26, 42, 58, .28);
}

.g-hero::after {
    content: '';
    position: absolute;
    width: 220px; height: 220px;
    right: -90px; top: -110px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232, 168, 124, .55), transparent 65%);
}

.g-hero h1 { font-size: 1.45rem; margin-bottom: .2rem; }
.g-hero p { margin: 0; color: rgba(255, 255, 255, .78); font-size: .9rem; }

.g-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .9rem; }

.g-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .18);
    font-size: .8rem;
    font-weight: 600;
    backdrop-filter: blur(6px);
}

.g-chip-light { background: #F1F5F9; border-color: var(--line); color: var(--ink); }

/* ---------------- código de acesso ---------------- */
.g-code {
    text-align: center;
    padding: 1.2rem 1rem;
    border-radius: var(--radius);
    background: linear-gradient(160deg, #FFF, #F7FBF9);
    border: 1px dashed #B9E9D3;
    box-shadow: var(--shadow);
}

.g-code-value {
    font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: .22em;
    color: var(--navy);
    margin: .2rem 0 .6rem;
}

.g-code.locked {
    border-style: solid;
    border-color: var(--line);
    background: repeating-linear-gradient(135deg, #FBFCFE, #FBFCFE 10px, #F5F7FA 10px, #F5F7FA 20px);
}

.g-code.locked .g-code-value { color: #CBD5E1; letter-spacing: .1em; font-size: 1.6rem; }

/* ---------------- grade de ícones ---------------- */
.g-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .7rem;
}

.g-tile-card {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: .95rem .85rem;
    border-radius: 18px;
    background: var(--surface);
    border: 1px solid rgba(15, 23, 42, .06);
    box-shadow: var(--shadow-soft);
    color: inherit;
    text-decoration: none;
    min-height: 118px;
    transition: transform .15s ease, box-shadow .15s ease;
}

.g-tile-card:active { transform: scale(.98); }
.g-tile-card:hover { text-decoration: none; box-shadow: var(--shadow); }

.g-tile-card .g-ico { font-size: 1.7rem; line-height: 1; }
.g-tile-card strong { font-size: .92rem; font-weight: 700; }
.g-tile-card span.g-sub { font-size: .78rem; color: var(--muted); }

.g-tile-card.is-open { border-color: #F5D4B8; background: linear-gradient(170deg, #FFFDFB, #FFF7F0); }

/* ---------------- formulários ---------------- */
.g-field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .85rem; }
.g-field label { font-size: .85rem; font-weight: 600; color: #334155; }
.g-field .g-hint { font-size: .78rem; color: var(--muted); }
.g-field .g-error { font-size: .78rem; color: #B91C1C; font-weight: 600; }

.g-input,
.g-select,
.g-textarea {
    width: 100%;
    min-height: 52px;
    padding: .75rem .9rem;
    font: inherit;
    font-size: 16px; /* evita zoom no iOS */
    color: var(--ink);
    background: #FBFCFE;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.g-textarea { min-height: 110px; resize: vertical; }

.g-input:focus,
.g-select:focus,
.g-textarea:focus {
    outline: none;
    border-color: var(--navy-3);
    box-shadow: 0 0 0 4px rgba(74, 122, 156, .14);
}

.g-row { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
@media (max-width: 380px) { .g-row { grid-template-columns: 1fr; } }

/* upload */
.g-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    padding: 1.6rem 1rem;
    text-align: center;
    border: 2px dashed #CBD5E1;
    border-radius: var(--radius);
    background: #FBFCFE;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.g-drop:hover, .g-drop.is-drag { border-color: var(--navy-3); background: #F5F9FC; }
.g-drop .g-ico { font-size: 2rem; }
.g-drop input[type="file"] { display: none; }
.g-drop small { color: var(--muted); }

.g-file-chosen { display: none; font-size: .85rem; font-weight: 600; color: #047857; }
.g-file-chosen.is-visible { display: block; }

/* consentimento */
.g-consent {
    display: flex;
    gap: .7rem;
    align-items: flex-start;
    padding: .9rem;
    border-radius: var(--radius-sm);
    background: #F8FAFC;
    border: 1px solid var(--line);
    font-size: .85rem;
    line-height: 1.45;
}

.g-consent input[type="checkbox"] { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--navy-2); flex: none; }

/* ---------------- botões ---------------- */
.g-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    width: 100%;
    min-height: 54px;
    padding: .8rem 1.1rem;
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--navy), var(--navy-2));
    border: 0;
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(26, 42, 58, .22);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.g-btn:hover { text-decoration: none; box-shadow: 0 14px 28px rgba(26, 42, 58, .26); }
.g-btn:active { transform: translateY(1px) scale(.995); }
.g-btn[disabled] { opacity: .55; pointer-events: none; }

.g-btn-peach {
    background: linear-gradient(135deg, #F0B98F, var(--peach));
    color: #3B2415;
    box-shadow: 0 10px 24px rgba(232, 168, 124, .38);
}

.g-btn-ghost {
    background: transparent;
    color: var(--navy-2);
    border: 1.5px solid var(--line);
    box-shadow: none;
}

.g-btn-danger { background: linear-gradient(135deg, #F87171, var(--red)); box-shadow: 0 10px 24px rgba(239, 68, 68, .25); }
.g-btn-sm { min-height: 44px; font-size: .9rem; width: auto; padding: .55rem .9rem; border-radius: 12px; }

.g-actions { display: flex; gap: .6rem; margin-top: 1rem; }
.g-actions .g-btn { flex: 1; }

/* copiar */
.g-copy {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-height: 40px;
    padding: .4rem .8rem;
    font-size: .85rem;
    font-weight: 700;
    color: var(--navy-2);
    background: #EEF4F9;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
}

.g-copy:active { transform: scale(.97); }

/* ---------------- passos ---------------- */
.g-steps {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .3rem;
    padding: .2rem .2rem 0;
}

.g-step { flex: 1; text-align: center; font-size: .7rem; color: var(--muted); }
.g-step .g-dot {
    display: block;
    width: 30px; height: 30px;
    margin: 0 auto .25rem;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: .8rem;
    font-weight: 800;
    background: #E9EEF4;
    color: #94A3B8;
}

.g-step.is-done .g-dot { background: #D1FAE5; color: #047857; }
.g-step.is-current .g-dot { background: var(--peach); color: #3B2415; box-shadow: 0 0 0 4px rgba(232, 168, 124, .25); }
.g-step.is-current { color: var(--ink); font-weight: 700; }

/* ---------------- toasts ---------------- */
.g-toast {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    max-width: 528px;
    margin: .5rem auto 0;
    padding: .8rem .9rem;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    box-shadow: var(--shadow-soft);
    animation: g-slide .25s ease both;
}

.g-toast-success { background: #ECFDF5; border: 1px solid #A7F3D0; color: #065F46; }
.g-toast-error { background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; }

@keyframes g-slide { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------------- navegação inferior ---------------- */
.g-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 10;
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    max-width: 560px;
    margin: 0 auto;
    padding: .35rem .4rem calc(.35rem + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .88);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.g-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .15rem;
    min-height: 54px;
    border-radius: 14px;
    color: var(--muted);
    font-size: .7rem;
    font-weight: 600;
    text-decoration: none;
}

.g-nav a:hover { text-decoration: none; }
.g-nav a.is-active { color: var(--navy); background: #F1F5FB; }
.g-nav-ico { font-size: 1.25rem; line-height: 1; }

/* ---------------- detalhe (acordeão) ---------------- */
.g-detail { border-radius: var(--radius-sm); background: #F8FAFC; border: 1px solid var(--line); }
.g-detail summary {
    list-style: none;
    cursor: pointer;
    padding: .85rem .95rem;
    font-weight: 700;
    font-size: .9rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.g-detail summary::-webkit-details-marker { display: none; }
.g-detail[open] summary { border-bottom: 1px solid var(--line); }
.g-detail .g-detail-body { padding: .85rem .95rem; font-size: .9rem; white-space: pre-line; }

/* assinatura */
.g-sign {
    width: 100%;
    height: 170px;
    border-radius: var(--radius-sm);
    border: 1.5px dashed #CBD5E1;
    background: #fff;
    touch-action: none;
}

/* util */
.g-stack { display: flex; flex-direction: column; gap: .8rem; }
.g-between { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.g-hr { height: 1px; background: var(--line); border: 0; margin: 1rem 0; }
.g-note { font-size: .78rem; color: var(--muted); }
.g-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.g-badge-ok { background: #ECFDF5; color: #047857; }
.g-badge-warn { background: #FFFBEB; color: #B45309; }

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* telas maiores: centraliza como um "celular" confortável */
@media (min-width: 640px) {
    body.g-body { background: linear-gradient(180deg, #EEF2F7, #F4F6F9 40%); }
    .g-main { padding-bottom: 3rem; }
}
