/* ============================================================
   Convites — App shell (área do cliente / SaaS)
   Design system limpo e profissional. Separado do tema
   festivo das páginas do convidado (tropical.css).
   ============================================================ */

:root {
    /* ---------- Souvenir Affectifs — identidade da marca ----------
       Traço terracota do monograma + rosa blush do logo.
       Paleta quente e afetiva ("memórias afetivas"). */
    --brand: #DD6A3E;          /* terracota — o traço do monograma */
    --brand-600: #C6572E;
    --brand-700: #A8481F;      /* terracota profundo — títulos e links */
    --brand-050: #FBEBE2;      /* pêssego suave — fundos de ícones/badges */
    --accent: #E98AB4;         /* rosa (derivado do blush, legível) */
    --accent-600: #D96E9E;

    --blush: #FAD1E4;          /* rosa blush do logo */
    --blush-050: #FDF1F7;      /* blush lavado — fundos decorativos */

    --bg: #FBF7F3;             /* creme quente */
    --surface: #FFFFFF;
    --surface-2: #FBF6F1;
    --ink: #2B2320;            /* marrom quase preto, quente */
    --muted: #6C5F58;          /* cinza-marrom quente */
    --faint: #9C8E86;
    --border: #EEE5DD;         /* borda quente */
    --border-strong: #E1D5CA;
    --ring: rgba(221, 106, 62, .28);

    --ok: #1E7A47;        --ok-bg: #E6F4EC;
    --warn: #A45B08;      --warn-bg: #FBEFD9;
    --danger: #C0392B;    --danger-bg: #FBEAE7;
    --info: #1D4ED8;      --info-bg: #E7EDFD;

    --shadow-sm: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.07);
    --shadow-md: 0 6px 18px rgba(16,24,40,.09);

    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;

    --fs-display: 'Fraunces', Georgia, serif;
    --fs-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--fs-ui);
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-600); }

img { max-width: 100%; }

/* ---------- Topbar ---------- */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-family: var(--fs-display);
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--brand-700);
    text-decoration: none;
    letter-spacing: -0.01em;
}
.brand .brand-mark {
    display: inline-flex;
    width: 34px; height: 34px;
    align-items: center; justify-content: center;
    background: var(--blush);
    border-radius: 50%;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(168,72,31,.10);
}
.brand .brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand .brand-sub {
    display: block;
    font-family: var(--fs-ui);
    font-weight: 500;
    font-size: .66rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--brand);
    margin-top: 1px;
}
.brand .brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-user {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--muted); font-size: .9rem;
    padding-right: 4px;
}
.topbar-user .avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--brand-050); color: var(--brand-700);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: .85rem;
}

/* ---------- Layout ---------- */
.page {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 28px 20px 64px;
    flex: 1;
}
.page-narrow { max-width: 560px; }

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}
.page-title {
    font-family: var(--fs-display);
    font-weight: 600;
    font-size: 1.6rem;
    line-height: 1.2;
    letter-spacing: -0.015em;
    color: var(--ink);
    margin: 0;
}
.page-subtitle { color: var(--muted); margin: 4px 0 0; font-size: .95rem; }

.breadcrumb {
    display: flex; align-items: center; gap: 6px;
    font-size: .85rem; color: var(--faint);
    margin-bottom: 10px; flex-wrap: wrap;
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand-600); text-decoration: underline; }
.breadcrumb .sep { color: var(--border-strong); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    font-family: inherit;
    font-size: .95rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .06s ease;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn .icon { width: 18px; height: 18px; }

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

.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-600); }

.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand-700); background: var(--brand-050); }

.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

.btn-danger { background: var(--surface); color: var(--danger); border-color: #EEC9C3; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.btn-sm { min-height: 36px; padding: 7px 12px; font-size: .875rem; }
.btn-block { width: 100%; }
.btn[aria-disabled="true"], .btn:disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
}
.card-pad { padding: 24px; }
.card + .card { margin-top: 16px; }

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
    padding: 32px 28px;
}

/* ---------- Stat cards ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 16px 18px;
}
.stat .stat-label {
    display: flex; align-items: center; gap: 7px;
    font-size: .8rem; font-weight: 600; letter-spacing: .02em;
    color: var(--muted); text-transform: uppercase;
}
.stat .stat-value { font-size: 1.9rem; font-weight: 700; margin-top: 6px; color: var(--ink); }
.stat .icon { width: 16px; height: 16px; color: var(--faint); }
.stat.is-ok { border-left: 3px solid var(--ok); }
.stat.is-warn { border-left: 3px solid var(--warn); }
.stat.is-danger { border-left: 3px solid var(--danger); }
.stat.is-brand { border-left: 3px solid var(--brand); }

/* ---------- List rows (eventos, convites, convidados) ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.row-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    transition: border-color .16s ease, box-shadow .16s ease;
}
.row-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.row-main { min-width: 0; }
.row-title { font-weight: 600; color: var(--ink); }
.row-meta { color: var(--muted); font-size: .85rem; margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-meta a { color: var(--brand-600); text-decoration: none; }
.row-meta a:hover { text-decoration: underline; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 560px; }
table.data th, table.data td { padding: 12px 14px; text-align: left; }
table.data thead th {
    background: var(--surface-2);
    color: var(--muted);
    font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0;
}
table.data tbody tr { border-top: 1px solid var(--border); }
table.data tbody tr:hover { background: var(--surface-2); }

/* ---------- Badges / status pills ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 999px;
    font-size: .78rem; font-weight: 600; line-height: 1.4;
    white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { color: var(--ok); background: var(--ok-bg); }
.badge-warn { color: var(--warn); background: var(--warn-bg); }
.badge-danger { color: var(--danger); background: var(--danger-bg); }
.badge-info { color: var(--info); background: var(--info-bg); }
.badge-muted { color: var(--muted); background: var(--surface-2); }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 4px; }
.field { display: flex; flex-direction: column; margin-bottom: 16px; }
.field > label { font-size: .9rem; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.field .help { color: var(--muted); font-size: .82rem; margin-top: 6px; }
.field .err { color: var(--danger); font-size: .82rem; margin-top: 6px; }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: var(--danger); }

.input, input[type="text"].campo, input[type="email"].campo, input[type="password"].campo,
input[type="url"].campo, input[type="date"].campo, input[type="number"].campo,
textarea.campo, select.campo, .campo {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    font-family: inherit;
    font-size: 1rem;
    color: var(--ink);
    background: var(--surface);
    transition: border-color .16s ease, box-shadow .16s ease;
}
.campo:focus, .input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--ring);
}
input[type="color"].campo { padding: 4px; height: 44px; cursor: pointer; }
textarea.campo { min-height: 90px; resize: vertical; line-height: 1.5; }

.field-check { flex-direction: row; align-items: center; gap: 10px; }
.field-check input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--brand); flex-shrink: 0; }
.field-check label { margin: 0; font-weight: 500; }

.form-section { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 20px; }
.form-section:first-of-type { border-top: 0; padding-top: 0; }
.form-section h3 {
    font-size: .82rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--faint); margin: 0 0 14px;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 18px; }

/* ---------- Flash messages ---------- */
.flash-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.flash {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px; border-radius: var(--r-sm); font-size: .92rem;
    border: 1px solid transparent;
}
.flash .icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.flash-success { background: var(--ok-bg); color: #145534; border-color: #C4E6D2; }
.flash-error, .flash-danger { background: var(--danger-bg); color: #8A2318; border-color: #EEC9C3; }
.flash-warning { background: var(--warn-bg); color: #6E3D05; border-color: #EED7AE; }
.flash-info { background: var(--info-bg); color: #14328F; border-color: #C7D5F7; }

/* ---------- Empty state ---------- */
.empty {
    text-align: center;
    padding: 48px 24px;
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-lg);
    color: var(--muted);
}
.empty .empty-icon {
    width: 52px; height: 52px; margin: 0 auto 14px;
    display: flex; align-items: center; justify-content: center;
    background: var(--brand-050); color: var(--brand); border-radius: 14px;
}
.empty h3 { color: var(--ink); margin: 0 0 6px; font-size: 1.05rem; }
.empty p { margin: 0 0 18px; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.toolbar .field { margin: 0; }
.search-input {
    display: flex; align-items: center; gap: 8px;
    border: 1px solid var(--border-strong); border-radius: var(--r-sm);
    padding: 0 12px; background: var(--surface);
}
.search-input .icon { width: 18px; height: 18px; color: var(--faint); flex-shrink: 0; }
.search-input input { border: 0; padding: 11px 0; background: transparent; font-size: 1rem; outline: none; width: 100%; }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
.stack-gap > * + * { margin-top: 16px; }
.icon { display: inline-block; vertical-align: middle; }
.footer-app { text-align: center; padding: 24px 16px 40px; font-size: .8rem; color: var(--faint); }

@media (max-width: 560px) {
    .page { padding: 20px 16px 48px; }
    .page-title { font-size: 1.35rem; }
    .row-item { align-items: flex-start; }
    .row-actions { width: 100%; }
    .row-actions .btn { flex: 1; }
    .btn-row .btn { flex: 1; }
    .topbar-inner { gap: 10px; padding: 0 14px; }
    .brand { font-size: .98rem; }
    .brand .brand-mark { width: 30px; height: 30px; }
    .brand .brand-sub { font-size: .58rem; letter-spacing: .1em; }
}

/* ---------- Banner de verificação de e-mail ---------- */
.verif-banner {
    display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
    background: var(--warn-bg); color: #6E3D05; border-bottom: 1px solid #EED7AE;
    padding: 9px 16px; font-size: .88rem; font-weight: 500;
}
.verif-banner .icon { color: var(--warn); }
.verif-banner a { color: var(--brand-700); font-weight: 700; text-decoration: underline; }

/* ---------- Auth / Cadastro ---------- */
.auth-wide { max-width: 620px; }
.auth-card h1.page-title { font-family: var(--fs-display); }

.field-status { font-size: .8rem; margin-top: 6px; display: block; min-height: 1em; }
.field.is-ok .field-status { color: var(--ok); }
.field.is-bad .field-status { color: var(--danger); }
.field.is-ok input:not([type=checkbox]), .field.is-ok select { border-color: var(--ok); }
.field.is-bad input:not([type=checkbox]), .field.is-bad select { border-color: var(--danger); }

.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 46px; }
.pwd-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 8px; border-radius: 8px; display: inline-flex; }
.pwd-toggle:hover { color: var(--brand-700); background: var(--surface-2); }
.pwd-toggle[aria-pressed="true"] { color: var(--brand); }

.pwd-meter { margin-top: 10px; }
.pwd-meter .bars { display: flex; gap: 6px; }
.pwd-meter .bars i { height: 6px; flex: 1; border-radius: 3px; background: var(--border); transition: background .2s ease; }
.pwd-meter[data-level="1"] .bars i:nth-child(1) { background: var(--danger); }
.pwd-meter[data-level="2"] .bars i:nth-child(-n+2) { background: var(--warn); }
.pwd-meter[data-level="3"] .bars i { background: var(--ok); }
.pwd-meter .pwd-label { font-size: .8rem; font-weight: 600; margin-top: 7px; display: block; color: var(--muted); }
.pwd-meter[data-level="1"] .pwd-label { color: var(--danger); }
.pwd-meter[data-level="2"] .pwd-label { color: var(--warn); }
.pwd-meter[data-level="3"] .pwd-label { color: var(--ok); }

.pwd-reqs { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 7px 16px; }
.pwd-reqs li { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--muted); transition: color .16s ease; }
.pwd-reqs li::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--border-strong); flex-shrink: 0; background-position: center; background-repeat: no-repeat; }
.pwd-reqs li.ok { color: var(--ok); }
.pwd-reqs li.ok::before { border-color: var(--ok); background-color: var(--ok); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5 10 17.5 19.5 6.5'/%3E%3C/svg%3E"); background-size: 11px; }

.tipo-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 6px; }
.tipo-card { position: relative; border: 1.5px solid var(--border); border-radius: var(--r-md); padding: 16px 16px 16px 46px; cursor: pointer; transition: border-color .16s ease, background .16s ease, box-shadow .16s ease; }
.tipo-card:hover { border-color: var(--border-strong); }
.tipo-card.active { border-color: var(--brand); background: var(--brand-050); box-shadow: 0 0 0 1px var(--brand); }
.tipo-card input { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; accent-color: var(--brand); }
.tipo-card .t-title { font-weight: 600; color: var(--ink); font-size: .95rem; }
.tipo-card .t-desc { font-size: .8rem; color: var(--muted); }

.terms-check { display: flex; align-items: flex-start; gap: 11px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; margin: 4px 0 6px; }
.terms-check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--brand); flex-shrink: 0; }
.terms-check label { font-size: .9rem; color: var(--ink); margin: 0; line-height: 1.5; }
.terms-check a { color: var(--brand-700); font-weight: 600; }

.btn[data-loading="1"] { position: relative; color: transparent !important; }
.btn[data-loading="1"]::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: btnspin .7s linear infinite; }
@keyframes btnspin { to { transform: rotate(360deg); } }

.auth-alt { text-align: center; margin: 20px 0 0; color: var(--muted); }
.auth-forgot { display: block; text-align: right; font-size: .85rem; margin-top: -8px; margin-bottom: 8px; }

@media (max-width: 520px) {
    .tipo-cards { grid-template-columns: 1fr; }
    .pwd-reqs { grid-template-columns: 1fr; }
}

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