:root {
    /* Paleta editorial: tinta quase-preta, acento roxo aprofundado, dourado
       sutil como destaque pontual, fundo off-white em vez de cinza chapado. */
    --cor-primaria: #5b21b6;
    --cor-primaria-escura: #3b0f80;
    --cor-dourado: #b8933f;
    --cor-texto: #1c1a22;
    --cor-muted: #6b6478;
    --cor-borda: #e8e3db;
    --cor-fundo: #faf8f5;
    --cor-sucesso: #067a5c;
    --cor-erro: #c22a2a;
    --cor-aviso: #b8720f;

    --fonte-titulo: 'Fraunces', Georgia, 'Times New Roman', serif;
    --fonte-corpo: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 40px;

    --raio: 14px;
    --raio-pequeno: 8px;

    --sombra-sm: 0 1px 2px rgba(28, 26, 34, 0.06), 0 1px 3px rgba(28, 26, 34, 0.08);
    --sombra-md: 0 4px 10px rgba(28, 26, 34, 0.07), 0 2px 4px rgba(28, 26, 34, 0.06);
    --sombra-lg: 0 12px 32px rgba(28, 26, 34, 0.14), 0 4px 12px rgba(28, 26, 34, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--fonte-corpo);
    color: var(--cor-texto);
    background: var(--cor-fundo);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--fonte-titulo); font-weight: 600; letter-spacing: -0.01em; }

a { color: var(--cor-primaria); }
a:hover { color: var(--cor-primaria-escura); }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--space-4);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-5);
    background: #fff;
    border-bottom: 1px solid var(--cor-borda);
    flex-wrap: wrap;
    gap: var(--space-2);
}

.topbar .brand {
    font-family: var(--fonte-titulo);
    font-weight: 600;
    text-decoration: none;
    color: var(--cor-texto);
    font-size: 1.25rem;
    letter-spacing: -0.01em;
}

.topbar nav a {
    margin-left: var(--space-4);
    text-decoration: none;
    color: var(--cor-muted);
    font-size: 0.9rem;
    transition: color 0.15s ease;
}
.topbar nav a:hover { color: var(--cor-primaria); }

.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--raio-pequeno);
    margin-bottom: var(--space-4);
    font-size: 0.95rem;
}
.alert-erro { background: #fbe9e9; color: var(--cor-erro); }
.alert-sucesso { background: #e2f3ee; color: var(--cor-sucesso); }
.alert-aviso { background: #fbf1e0; color: var(--cor-aviso); }

.auth-box {
    max-width: 400px;
    margin: 56px auto;
    background: #fff;
    padding: var(--space-6) var(--space-5);
    border-radius: var(--raio);
    border: 1px solid var(--cor-borda);
    box-shadow: var(--sombra-md);
}
.auth-box h1 { margin-top: 0; font-size: 1.6rem; }

form label {
    display: block;
    margin-bottom: var(--space-3);
    font-size: 0.85rem;
    color: var(--cor-muted);
    font-weight: 500;
}

form input, form select {
    display: block;
    width: 100%;
    padding: 11px 13px;
    margin-top: var(--space-1);
    border: 1px solid var(--cor-borda);
    border-radius: var(--raio-pequeno);
    font-size: 1rem;
    font-family: var(--fonte-corpo);
    color: var(--cor-texto);
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
form input:focus, form select:focus {
    outline: none;
    border-color: var(--cor-primaria);
    box-shadow: 0 0 0 3px rgba(91, 33, 182, 0.12);
}

.btn {
    display: inline-block;
    padding: 11px 20px;
    border-radius: var(--raio-pequeno);
    border: none;
    font-size: 0.95rem;
    font-family: var(--fonte-corpo);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--cor-primaria); color: #fff; box-shadow: var(--sombra-sm); }
.btn-primary:hover { background: var(--cor-primaria-escura); }
.btn-secundario { background: #fff; color: var(--cor-primaria); border: 1px solid var(--cor-primaria); }
.btn-secundario:hover { background: #f5f1fb; }
.btn-bloco { display: block; width: 100%; text-align: center; margin-top: var(--space-2); }

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.cards-resumo {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}
.card-resumo {
    background: #fff;
    border: 1px solid var(--cor-borda);
    border-radius: var(--raio);
    padding: var(--space-4);
    box-shadow: var(--sombra-sm);
}
.card-resumo .label { display: block; font-size: 0.78rem; color: var(--cor-muted); }
.card-resumo .valor { display: block; font-family: var(--fonte-titulo); font-size: 1.5rem; font-weight: 600; margin-top: 2px; }

.tabela-sessoes {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: var(--raio);
    overflow: hidden;
    box-shadow: var(--sombra-sm);
}
.tabela-sessoes th, .tabela-sessoes td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--cor-borda);
    text-align: left;
    font-size: 0.9rem;
}
.tabela-sessoes th { color: var(--cor-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
.tabela-sessoes tr:last-child td { border-bottom: none; }
.tabela-sessoes tr:hover td { background: #faf8f5; }

.badge {
    padding: 3px 11px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #ece7db;
}
.badge-pronta { background: #e2f3ee; color: var(--cor-sucesso); }
.badge-em_curadoria { background: #fbf1e0; color: var(--cor-aviso); }
.badge-selecao_aberta { background: #f1eafb; color: var(--cor-primaria-escura); }
.badge-aguardando_edicao { background: #e2ecfb; color: #1d4ed8; }

section { margin-bottom: var(--space-6); }

.grid-curadoria {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-3);
}

.card-foto {
    position: relative;
    background: #fff;
    border: 2px solid var(--cor-borda);
    border-radius: var(--raio-pequeno);
    overflow: hidden;
    outline: none;
    transition: border-color 0.15s ease;
}
.card-foto:focus { border-color: var(--cor-primaria); }
.card-foto.aprovada { border-color: var(--cor-sucesso); }
.card-foto.rejeitada { opacity: 0.35; border-color: var(--cor-erro); }
.card-foto img { width: 100%; height: 140px; object-fit: cover; display: block; }

.card-foto-acoes {
    display: flex;
    gap: 2px;
    padding: 4px;
    background: rgba(255,255,255,0.92);
}
.card-foto-acoes button {
    flex: 1;
    padding: 5px;
    border: 1px solid var(--cor-borda);
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
}

.score-ia {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(28,26,34,0.65);
    color: #fff;
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 6px;
}

.tag-duplicata {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(91,33,182,0.85);
    color: #fff;
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 6px;
}

.upload-progresso { margin-top: var(--space-3); display: flex; align-items: center; gap: var(--space-3); }
.upload-progresso[hidden] { display: none; }

.link-galeria { margin-top: var(--space-3); display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.link-galeria input {
    max-width: 420px;
    padding: 9px 12px;
    border: 1px solid var(--cor-borda);
    border-radius: var(--raio-pequeno);
    font-family: var(--fonte-corpo);
    background: #fff;
}

/* Galeria pública do cliente — mobile-first */
.galeria-cliente { max-width: 960px; margin: 0 auto; }
.galeria-header { text-align: center; margin-bottom: var(--space-5); padding-top: var(--space-4); }
.galeria-header h1 { font-size: 1.8rem; margin-bottom: var(--space-1); }

.grid-galeria {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}
@media (min-width: 640px) {
    .grid-galeria { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 900px) {
    .grid-galeria { grid-template-columns: repeat(4, 1fr); }
}

.card-galeria {
    position: relative;
    background: #fff;
    border-radius: var(--raio);
    overflow: hidden;
    border: 1px solid var(--cor-borda);
    box-shadow: var(--sombra-sm);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card-galeria:hover { box-shadow: var(--sombra-md); transform: translateY(-2px); }
.card-galeria img { width: 100%; height: 170px; object-fit: cover; display: block; }

.tag-incluida {
    display: block;
    text-align: center;
    background: var(--cor-sucesso);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 5px;
}

.selecionar-extra {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    padding: var(--space-2);
    font-size: 0.85rem;
    font-weight: 500;
}

.carrinho-flutuante {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--cor-borda);
    padding: var(--space-3) var(--space-4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--sombra-lg);
    flex-wrap: wrap;
    gap: var(--space-3);
}
.carrinho-flutuante[hidden] { display: none; }

.erro-checkout {
    color: var(--cor-erro);
    font-size: 0.8rem;
    margin-top: var(--space-1);
}
.erro-checkout[hidden] { display: none; }

.empty { color: var(--cor-muted); text-align: center; padding: var(--space-6) 0; font-family: var(--fonte-titulo); font-size: 1.15rem; }

.grid-worklist {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-3);
    margin-top: var(--space-3);
}
.card-worklist {
    background: #fff;
    border: 1px solid var(--cor-borda);
    border-radius: var(--raio-pequeno);
    overflow: hidden;
    box-shadow: var(--sombra-sm);
}
.card-worklist img { width: 100%; height: 120px; object-fit: cover; display: block; }
.worklist-status {
    display: block;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 5px;
    color: var(--cor-aviso);
    background: #fbf1e0;
}
.worklist-status.ok { color: var(--cor-sucesso); background: #e2f3ee; }
.btn-upload-editada { display: block; text-align: center; cursor: pointer; margin: 0; border-radius: 0; }

/* Tela cheia de Seleção (cliente escolhe fotos, mobile-first) */
.selecao-app {
    position: fixed;
    inset: 0;
    background: #100d18;
    display: flex;
    flex-direction: column;
    z-index: 10;
    font-family: var(--fonte-corpo);
}
.selecao-topo {
    display: flex;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    color: rgba(255,255,255,0.85);
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    background: rgba(16,13,24,0.55);
    backdrop-filter: blur(6px);
}
.selecao-viewer {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.selecao-slide {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.selecao-slide[hidden] { display: none; }
.selecao-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.selecao-controles {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    padding: var(--space-4);
    background: rgba(16,13,24,0.55);
    backdrop-filter: blur(6px);
}
.btn-nav {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 46px;
    height: 46px;
    font-size: 1.4rem;
    cursor: pointer;
    transition: background 0.15s ease;
}
.btn-nav:hover { background: rgba(255,255,255,0.22); }
.btn-favoritar {
    flex: 1;
    max-width: 280px;
    padding: 13px;
    border-radius: 999px;
    border: none;
    background: #fff;
    color: var(--cor-texto);
    font-weight: 600;
    font-family: var(--fonte-corpo);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.btn-favoritar[data-selecionada="1"] { background: var(--cor-dourado); color: #2a2110; }
.selecao-rodape {
    padding: var(--space-4);
    background: #fff;
}
.selecao-rodape #selecao-resumo-extra {
    display: block;
    text-align: center;
    font-size: 0.85rem;
    color: var(--cor-muted);
    margin-bottom: var(--space-2);
}
.muted { color: var(--cor-muted); font-size: 0.9rem; }
