body.admin { background: var(--cream-2); min-height: 100vh; }
body.admin [hidden] { display: none !important; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-box { width: 100%; max-width: 400px; }
.login-box h1 { font-family: var(--script); font-size: 2.6rem; text-align: center; }

.topbar {
    position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
    padding: 14px 4vw; background: var(--white); box-shadow: 0 2px 14px rgba(0,0,0,.05);
}
.topbar h1 { font-family: var(--script); font-size: 2rem; font-weight: 400; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.tabs button {
    background: none; border: 0; padding: 8px 14px; border-radius: 999px; cursor: pointer;
    font-family: var(--sans); font-size: .8rem; font-weight: 500; color: var(--green);
}
.tabs button.active, .tabs button:hover { background: var(--green); color: var(--white); }
.topbar-actions { display: flex; gap: 8px; }

.panel { padding: 30px 4vw 60px; }
.panel h2 { font-size: 1.8rem; margin: 10px 0 16px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 30px; }
.stat { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat span { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stat strong { display: block; font-family: var(--serif); font-size: 2rem; color: var(--green); font-weight: 600; }
.stat small { color: var(--muted); }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar select, .toolbar input[type=search], .field select {
    font-family: var(--sans); padding: 9px 12px; border: 1px solid #ddd5c8; border-radius: 10px; background: var(--white); font-size: .9rem;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--cream-2); vertical-align: top; }
th { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; background: var(--cream); position: sticky; top: 0; }
tr:hover td { background: #fdfbf7; }
td.num { text-align: right; white-space: nowrap; }
td .mini-progress { width: 140px; height: 8px; border-radius: 99px; background: var(--cream-2); overflow: hidden; }
td .mini-progress div { height: 100%; background: linear-gradient(90deg, var(--sage), var(--gold)); }
td .actions { display: flex; gap: 6px; }
td .actions button { background: none; border: 1px solid var(--gold-soft); border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: .78rem; color: var(--green); }
td .actions button.danger { color: var(--danger); border-color: #e9c7c2; }
.muted { color: var(--muted); }

.tag { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.tag.approved, .tag.yes { background: #e3eee1; color: var(--ok); }
.tag.pending { background: #f6edd9; color: #8a6a2b; }
.tag.rejected, .tag.cancelled, .tag.refunded, .tag.no { background: #f5e1de; color: var(--danger); }
.tag.off { background: #eee; color: #777; }

/* Galeria, recados, fotos da festa */
.badge { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 99px; background: var(--rose); color: var(--white); font-size: .68rem; line-height: 18px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 14px; }
.media-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: grid; }
.media-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; cursor: zoom-in; background: var(--cream-2); }
.media-card .media-body { padding: 10px 12px 12px; display: grid; gap: 8px; font-size: .82rem; }
.media-card input { width: 100%; font-family: var(--sans); font-size: .85rem; padding: 7px 10px; border: 1px solid #ddd5c8; border-radius: 8px; background: var(--cream); }
.media-empty { grid-column: 1 / -1; padding: 40px; text-align: center; color: var(--muted); background: var(--white); border-radius: var(--radius); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .85rem; color: var(--green); font-weight: 500; }
.switch input { position: absolute; opacity: 0; }
.switch span { width: 42px; height: 24px; border-radius: 99px; background: #d9d3c4; position: relative; transition: .2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--white); transition: .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { left: 21px; }
.admin-lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(35,36,22,.88); display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.admin-lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* Padrinhos */
.pd-code { margin-bottom: 18px; }
.pd-code code { background: var(--white); padding: 1px 6px; border-radius: 6px; font-size: .85em; }
.pd-block { margin-bottom: 26px; max-width: 900px; }
.pd-block h3, .pd-sub h3 { font-size: 1.4rem; }
.pd-sub { margin-top: 10px; }
.pd-couples { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin: 12px 0 30px; }
.pd-couple, .cb-person { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: grid; gap: 10px; justify-items: center; }
.pd-photo {
    width: 104px; height: 104px; border-radius: 50%; border: 2px dashed var(--gold-soft); background: var(--blush) center/cover no-repeat;
    display: grid; place-items: center; cursor: pointer; font-family: var(--serif); font-size: 1.3rem; color: var(--olive);
}
.pd-photo.has-img { border-style: solid; color: transparent; overflow: hidden; }
.pd-photo img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; user-select: none; }
.pd-row button[hidden] { display: none; }

/* Colaboradores */
.cb-person { background: var(--cream); }
.cb-person input, .cb-person textarea { background: var(--white); }
.cb-person textarea { resize: vertical; }
.cb-group { margin-bottom: 22px; max-width: none; }
.cb-group .toolbar { gap: 12px; margin-bottom: 4px; }
.cb-gtitle { flex: 1; min-width: 200px; font-family: var(--serif) !important; font-size: 1.3rem !important; color: var(--green); }
.cb-people { margin: 6px 0 10px; }
.cb-rank-preview { list-style: none; display: grid; gap: 6px; counter-reset: rk; max-height: 460px; overflow-y: auto; }
.cb-rank-preview li {
    counter-increment: rk; display: grid; grid-template-columns: 28px 56px 1fr auto; gap: 12px; align-items: center;
    padding: 8px 12px; border-radius: 10px; background: var(--cream); font-size: .9rem; transition: opacity .2s;
}
.cb-rank-preview li::before { content: counter(rk) 'º'; font-family: var(--serif); color: var(--gold); font-weight: 600; }
.cb-rank-preview li.muted { grid-template-columns: 1fr; }
.cb-rank-preview li.muted::before { content: none; }
.cb-rank-preview .pd-photo { width: 56px; height: 56px; font-size: 1rem; }
.cb-rank-name { display: grid; gap: 2px; }
.cb-rank-name small { color: var(--muted); font-size: .78rem; }
.cb-rank-preview li.off > :not(.pd-row) { opacity: .4; }
.cb-rank-preview li.off .cb-rank-name { text-decoration: line-through; }
.cb-rank-preview .pd-row { justify-content: flex-end; }
@media (max-width: 600px) {
    .cb-rank-preview li { grid-template-columns: 24px 48px 1fr; }
    .cb-rank-preview .pd-photo { width: 48px; height: 48px; }
    .cb-rank-preview .pd-row { grid-column: 1 / -1; }
}

.crop-box { max-width: 480px; text-align: center; }
.crop-box .form-hint { text-align: center; margin-bottom: 14px; }
.crop-stage {
    position: relative; width: min(400px, 100%); aspect-ratio: 1; margin: 0 auto; overflow: hidden;
    background: #1f221d; border-radius: 12px; cursor: grab; touch-action: none; user-select: none;
}
.crop-stage:active { cursor: grabbing; }
.crop-stage img { position: absolute; max-width: none; pointer-events: none; }
.crop-ring {
    position: absolute; inset: 8%; border-radius: 50%; pointer-events: none;
    border: 2px solid rgba(255, 255, 255, .9); box-shadow: 0 0 0 999px rgba(20, 22, 18, .6);
}
.crop-zoom { display: flex; align-items: center; gap: 10px; max-width: 400px; margin: 16px auto 0; font-size: 1.3rem; color: var(--olive); }
.crop-zoom input { flex: 1; accent-color: var(--olive); }
.crop-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.pd-couple input, .pd-couple select, .pd-manual-card input, .pd-manual-card textarea,
.cb-person input, .cb-person textarea, .cb-gtitle {
    width: 100%; font-family: var(--sans); font-size: .92rem; padding: 9px 12px; border: 1px solid #ddd5c8; border-radius: 10px; background: var(--cream);
}
.pd-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.pd-row button, .pd-mini {
    background: none; border: 1px solid var(--gold-soft); border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: .78rem; color: var(--green);
}
.pd-row button.danger, .pd-mini.danger { color: var(--danger); border-color: #e9c7c2; }
.pd-manual { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; margin: 12px 0 30px; }
.pd-manual-card { display: grid; gap: 12px; }
.pd-image { display: grid; gap: 8px; justify-items: start; }
.pd-image img { max-width: 100%; max-height: 260px; border-radius: 10px; box-shadow: var(--shadow); }
.pd-image .pd-empty { padding: 30px; width: 100%; text-align: center; border: 2px dashed var(--gold-soft); border-radius: 10px; color: var(--muted); }
.pd-palette { display: grid; gap: 8px; }
.pd-color { display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; align-items: center; }
.pd-color input[type=color] { width: 44px; height: 38px; padding: 2px; border-radius: 8px; cursor: pointer; }
.pd-cover { max-width: 420px; }
.pd-footer { text-align: center; margin-top: 10px; }

.field.check { flex-direction: row; display: flex; align-items: center; gap: 10px; align-self: end; padding-bottom: 12px; }
.field.check input { width: 18px; height: 18px; }

/* Lista de convidados */
.guest-filters { margin: 4px 0 8px; }
.guest-filters input[type=search] { flex: 1 1 260px; max-width: 420px; }
.guest-hint { text-align: left; margin: 0 0 12px; }
.guest-group td { background: var(--cream-2, #f3eedf); font-size: .82rem; letter-spacing: .04em; color: var(--green); padding-top: 10px; padding-bottom: 10px; }
.guest-tag { padding: 6px 10px; border-radius: 99px; border: 1px solid #ddd; font-size: .8rem; font-weight: 600; cursor: pointer; background: #fff; }
.guest-tag.tag-certo { background: #e3eee1; color: var(--ok); border-color: #c9dcc5; }
.guest-tag.tag-cortesia { background: #f6edd9; color: #8a6a2b; border-color: #ead9b5; }
.guest-tag.tag-none { color: #777; }
.guest-sugg { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .85rem; margin: 2px 0; }
.link-btn { background: none; border: 0; padding: 0 4px; color: var(--muted); font-size: .75rem; text-decoration: underline; cursor: pointer; }
