:root {
    --navy: #173b67;
    --navy-2: #244f80;
    --blue: #315f94;
    --blue-soft: #eaf1f8;
    --gold: #c8a75a;
    --gold-soft: #f8f1df;
    --cream: #f8f7f3;
    --white: #fff;
    --text: #243142;
    --muted: #738093;
    --border: #dfe5ec;
    --green: #31815a;
    --green-soft: #e5f4ec;
    --red: #b84d49;
    --red-soft: #f9e8e7;
    --shadow: 0 12px 35px rgba(31, 54, 82, .08);
    --radius: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; background: var(--cream); color: var(--text); line-height: 1.5; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
.wrap { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.eyebrow { display: block; margin-bottom: 5px; color: var(--gold); font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.muted { color: var(--muted); }

/* Public */
.public-hero { color: #fff; background: radial-gradient(circle at 85% -20%, rgba(255,255,255,.2), transparent 36%), linear-gradient(135deg, #102f55, #315f94); padding: 30px 0; }
.hero-inner { min-height: 145px; display: flex; align-items: center; gap: 24px; }
.hero-mark, .brand-symbol { display: grid; place-items: center; flex: 0 0 auto; width: 68px; height: 68px; border: 1px solid rgba(255,255,255,.45); border-radius: 50%; background: rgba(255,255,255,.1); color: #f2dca5; font-family: Georgia, serif; font-size: 2rem; box-shadow: inset 0 0 0 5px rgba(255,255,255,.05); }
.hero-copy { flex: 1; }
.hero-copy h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 4vw, 3.4rem); font-weight: 500; letter-spacing: -.03em; }
.hero-copy p { margin: 8px 0 0; color: rgba(255,255,255,.78); }
.hero-link { padding: 11px 18px; border: 1px solid rgba(255,255,255,.45); border-radius: 999px; text-decoration: none; font-weight: 700; font-size: .9rem; }
.public-main { padding: 34px 0 64px; }
.current-panel, .content-section, .join-section { margin-bottom: 28px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow); }
.current-panel { padding: 28px; border-top: 4px solid var(--gold); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.section-heading h2, .admin-section-title h2 { margin: 0; color: var(--navy); font-family: Georgia, serif; font-size: 1.65rem; font-weight: 600; }
.compact-heading { align-items: center; }
.section-hint { color: var(--muted); font-size: .85rem; }
.current-content { display: flex; align-items: center; gap: 24px; }
.date-emblem { width: 92px; height: 92px; display: grid; place-content: center; flex: 0 0 auto; border-radius: 50%; background: var(--blue-soft); color: var(--navy); text-align: center; }
.date-emblem strong { display: block; font-family: Georgia, serif; font-size: 2rem; line-height: .9; }
.date-emblem span { display: block; margin-top: 7px; font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.current-details h3 { margin: 4px 0; color: var(--navy); font-size: 1.65rem; }
.date-line { margin: 0; color: var(--muted); }
.note-line { margin: 8px 0 0; color: var(--red); font-weight: 600; }
.privacy-note { margin: 12px 0 0; color: var(--muted); font-size: .82rem; }
.content-section { padding: 28px; }
.schedule-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.schedule-card { display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 14px; min-height: 98px; padding: 16px; border: 1px solid var(--border); border-radius: 13px; background: #fff; }
.schedule-card.is-vacant { border-style: dashed; background: #fbfbf9; }
.schedule-date { width: 58px; height: 64px; display: grid; place-content: center; border-radius: 11px; background: var(--blue-soft); color: var(--navy); text-align: center; }
.schedule-date strong { font-size: 1.45rem; line-height: 1; }
.schedule-date span { margin-top: 4px; font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.schedule-info h3 { margin: 1px 0; font-size: 1rem; }
.schedule-info p { margin: 4px 0 0; color: var(--muted); font-size: .78rem; }
.schedule-year { color: var(--muted); font-size: .72rem; }
.join-section { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; }
.join-copy { padding: 38px; color: #fff; background: linear-gradient(150deg, var(--navy), var(--navy-2)); }
.join-copy h2 { margin: 0 0 14px; font-family: Georgia, serif; font-size: 2rem; line-height: 1.15; }
.join-copy p { color: rgba(255,255,255,.76); }
.join-steps { display: grid; gap: 12px; margin-top: 28px; }
.join-steps span { display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.join-steps b { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.12); color: #f2dca5; }
.join-form { padding: 34px; background: #fff; }
.join-form small { display: block; margin-top: 10px; color: var(--muted); text-align: center; }
.compact-section { padding-bottom: 22px; }
.public-search { display: flex; gap: 10px; }
.public-search input { flex: 1; }
.search-results { margin-top: 16px; border-top: 1px solid var(--border); }
.result-row, .mobile-list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.result-row div, .mobile-list-row div { display: grid; }
.result-row span:not(.badge), .mobile-list-row span:not(.badge) { color: var(--muted); font-size: .8rem; }
.history-panel { margin-top: 20px; border-top: 1px solid var(--border); }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.history-panel > summary { padding: 18px 0 0; color: var(--navy); font-weight: 800; }
.history-years { margin-top: 12px; }
.history-years > details { margin-bottom: 8px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; }
.history-years > details > summary { display: flex; justify-content: space-between; padding: 12px 0; font-weight: 800; }
.history-years > details > summary span { color: var(--muted); font-size: .78rem; font-weight: 500; }
.empty-state { display: grid; gap: 4px; padding: 24px; border: 1px dashed var(--border); border-radius: 12px; color: var(--muted); text-align: center; }
.public-footer { padding: 30px 0; color: #dfe8f2; background: #102f55; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.footer-inner div { display: grid; }
.footer-inner span { color: #9eb0c4; font-size: .8rem; }
.footer-inner a { color: #fff; font-size: .85rem; }
.hp-field { position: absolute !important; left: -9999px !important; }

/* Forms/buttons */
label { display: block; margin-bottom: 14px; color: #59677a; font-size: .82rem; font-weight: 750; }
input, select, textarea { width: 100%; margin-top: 5px; padding: 11px 12px; border: 1px solid #cfd8e2; border-radius: 9px; background: #fff; color: var(--text); outline: none; transition: .18s; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(49,95,148,.12); }
textarea { resize: vertical; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 17px; border: 0; border-radius: 9px; background: var(--navy); color: #fff; font-weight: 800; font-size: .88rem; text-decoration: none; cursor: pointer; transition: .18s; }
.btn:hover { background: var(--blue); transform: translateY(-1px); }
.btn-wide { width: 100%; }
.btn-small { min-height: 34px; padding: 7px 11px; font-size: .78rem; }
.btn-light { border: 1px solid var(--border); background: #fff; color: var(--navy); }
.alert { padding: 13px 16px; margin-bottom: 18px; border-radius: 10px; font-size: .9rem; }
.alert-success { background: var(--green-soft); color: var(--green); }
.alert-error { background: var(--red-soft); color: var(--red); }
.badge { display: inline-block; padding: 4px 9px; border-radius: 999px; font-size: .7rem; font-weight: 800; white-space: nowrap; }
.st-agendado { background: #e4edf8; color: var(--navy); }
.st-confirmado { background: var(--green-soft); color: var(--green); }
.st-concluido { background: #edf0f3; color: #657181; }
.st-nao-houve { background: var(--red-soft); color: var(--red); }
.st-especial { background: var(--gold-soft); color: #8b6a20; }
.st-vago { border: 1px dashed #b8c0ca; background: #f6f6f3; color: #7b8490; }

/* Admin */
.admin-page { background: #f3f6f9; }
.admin-shell { min-height: 100vh; }
.admin-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 248px; display: flex; flex-direction: column; padding: 24px 16px; color: #fff; background: linear-gradient(180deg, #112f53, #173b67); }
.brand-block { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-symbol { width: 42px; height: 42px; font-size: 1.2rem; }
.brand-block div:last-child { display: grid; }
.brand-block span { color: #9fb2c7; font-size: .72rem; }
.side-nav { display: grid; gap: 5px; margin-top: 22px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 9px; color: #c9d6e3; text-decoration: none; font-size: .88rem; font-weight: 700; }
.side-nav a:hover, .side-nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.side-nav a b { min-width: 22px; margin-left: auto; padding: 2px 6px; border-radius: 999px; background: var(--gold); color: #17304f; font-size: .68rem; text-align: center; }
.sidebar-footer { display: grid; gap: 10px; margin-top: auto; padding: 18px 10px 0; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-footer a { color: #c9d6e3; font-size: .82rem; text-decoration: none; }
.admin-content { margin-left: 248px; }
.admin-topbar { min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 32px; border-bottom: 1px solid var(--border); background: #fff; }
.admin-topbar h1 { margin: 0; color: var(--navy); font-size: 1.25rem; }
.menu-toggle { display: none; border: 0; background: transparent; color: var(--navy); font-size: 1.5rem; cursor: pointer; }
.admin-main { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 30px 0 70px; }
.admin-section { padding-top: 30px; }
.admin-section-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 15px; margin-bottom: 14px; }
.admin-section-title > span { color: var(--muted); font-size: .8rem; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.stat-card { min-height: 125px; display: grid; align-content: center; padding: 20px; border: 1px solid var(--border); border-radius: 13px; background: #fff; box-shadow: 0 6px 20px rgba(31,54,82,.04); }
.stat-card > span { color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; }
.stat-card strong { margin: 5px 0 1px; color: var(--navy); font-size: 1.65rem; line-height: 1.15; }
.stat-card small { color: var(--muted); }
.primary-stat { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--navy), var(--blue)); }
.primary-stat > span, .primary-stat strong, .primary-stat small { color: #fff; }
.primary-stat small { opacity: .7; }
.dashboard-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; margin-top: 14px; }
.panel-card { border: 1px solid var(--border); border-radius: 13px; background: #fff; box-shadow: 0 6px 20px rgba(31,54,82,.04); }
.current-admin-card, .quick-card { padding: 22px; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.panel-header h3, .form-panel h3 { margin: 0; color: var(--navy); font-size: 1.05rem; }
.current-admin-content { display: flex; align-items: center; gap: 16px; margin: 20px 0 14px; }
.date-emblem.small { width: 68px; height: 68px; }
.date-emblem.small strong { font-size: 1.45rem; }
.current-admin-content h4 { margin: 0 0 3px; font-size: 1.2rem; }
.current-admin-content p, .current-admin-content small { margin: 0; color: var(--muted); }
.text-link { color: var(--blue); font-size: .82rem; font-weight: 800; text-decoration: none; }
.quick-card p { color: var(--muted); font-size: .86rem; }
.quick-generate { display: flex; gap: 9px; margin-top: 18px; }
.quick-generate select { margin: 0; }
.table-panel { overflow: hidden; }
.admin-schedule-list { display: grid; }
.admin-schedule-row { display: grid; grid-template-columns: 56px minmax(180px,1fr) 120px auto; align-items: center; gap: 15px; min-height: 78px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.admin-schedule-row:last-child { border-bottom: 0; }
.admin-schedule-row.is-current { box-shadow: inset 4px 0 var(--gold); background: #fffdf7; }
.date-emblem.tiny { width: 48px; height: 48px; border-radius: 10px; }
.date-emblem.tiny strong { font-size: 1.1rem; }
.date-emblem.tiny span { margin-top: 3px; font-size: .58rem; }
.muted-date { background: #f0f2f4; color: #76818e; }
.schedule-person { display: grid; }
.schedule-person strong { color: var(--text); }
.schedule-person span, .schedule-person small { color: var(--muted); font-size: .76rem; }
.row-actions { display: flex; align-items: center; gap: 7px; }
.row-actions form { margin: 0; }
.icon-btn { padding: 6px 9px; border: 1px solid var(--border); border-radius: 7px; background: #fff; color: var(--blue); font-size: .75rem; font-weight: 800; text-decoration: none; cursor: pointer; }
.icon-btn.danger { color: var(--red); }
.form-panel { padding: 24px; }
.modern-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 16px; }
.full-field, .form-actions { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 9px; }
.queue-layout { display: grid; grid-template-columns: 330px 1fr; gap: 14px; }
.compact-form-panel { align-self: start; }
.stack-form { margin-top: 18px; }
.queue-card { overflow: hidden; }
.queue-list { display: grid; }
.queue-item { display: grid; grid-template-columns: 32px minmax(160px,1fr) minmax(230px,auto) auto; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.queue-item:last-child { border-bottom: 0; }
.queue-number { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--blue-soft); color: var(--navy); font-size: .75rem; font-weight: 800; }
.queue-person { display: grid; }
.queue-person span, .queue-person small { color: var(--muted); font-size: .75rem; }
.queue-schedule { display: flex; align-items: center; gap: 7px; }
.queue-schedule input { min-width: 142px; margin: 0; padding: 7px 8px; font-size: .78rem; }
.compact-list .admin-schedule-row { min-height: 67px; }

/* Auth fallback */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, var(--navy), var(--blue)); }
.auth-box { width: min(410px,100%); padding: 32px; border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.auth-box h1 { margin-top: 0; color: var(--navy); }

@media (max-width: 980px) {
    .stats-grid { grid-template-columns: repeat(2,1fr); }
    .queue-layout { grid-template-columns: 1fr; }
    .queue-item { grid-template-columns: 32px 1fr auto; }
    .queue-schedule { grid-column: 2 / 3; }
}

@media (max-width: 780px) {
    .hero-inner { align-items: flex-start; flex-wrap: wrap; }
    .hero-copy { min-width: calc(100% - 95px); }
    .hero-link { margin-left: 92px; }
    .schedule-grid, .join-section { grid-template-columns: 1fr; }
    .admin-sidebar { transform: translateX(-100%); transition: .22s; }
    .menu-open .admin-sidebar { transform: translateX(0); box-shadow: 20px 0 45px rgba(0,0,0,.2); }
    .admin-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .admin-topbar { padding: 14px 18px; }
    .admin-main { width: min(100% - 28px, 1100px); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .admin-schedule-row { grid-template-columns: 50px 1fr auto; }
    .admin-schedule-row > div:nth-child(3) { grid-column: 2 / 3; }
    .row-actions { grid-column: 3; grid-row: 1 / 3; flex-direction: column; }
}

@media (max-width: 560px) {
    .wrap { width: min(100% - 22px,1120px); }
    .public-hero { padding: 24px 0; }
    .hero-mark { width: 54px; height: 54px; }
    .hero-copy { min-width: calc(100% - 78px); }
    .hero-copy h1 { font-size: 1.85rem; }
    .hero-link { width: 100%; margin: 0; text-align: center; }
    .public-main { padding-top: 20px; }
    .current-panel, .content-section { padding: 20px; }
    .current-content { align-items: flex-start; gap: 14px; }
    .date-emblem { width: 68px; height: 68px; }
    .date-emblem strong { font-size: 1.45rem; }
    .current-details h3 { font-size: 1.25rem; }
    .schedule-card { grid-template-columns: 52px 1fr; }
    .schedule-status { grid-column: 2; }
    .join-copy, .join-form { padding: 25px 20px; }
    .section-heading { align-items: flex-start; }
    .section-hint { display: none; }
    .public-search { display: grid; }
    .footer-inner { align-items: flex-start; flex-direction: column; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
    .stat-card { min-height: 110px; padding: 15px; }
    .stat-card strong { font-size: 1.25rem; }
    .admin-topbar .btn { display: none; }
    .admin-section-title { align-items: flex-start; flex-direction: column; }
    .modern-form { grid-template-columns: 1fr; }
    .modern-form label, .form-actions { grid-column: 1; }
    .queue-item { grid-template-columns: 30px 1fr; }
    .queue-schedule { grid-column: 2; display: grid; grid-template-columns: 1fr auto; }
    .queue-item > form:last-child { grid-column: 2; }
    .admin-schedule-row { grid-template-columns: 44px 1fr; gap: 10px; }
    .admin-schedule-row > div:nth-child(3) { grid-column: 2; }
    .row-actions { grid-column: 2; grid-row: auto; flex-direction: row; }
}
