/* ==========================================================
   Editais EEUM – folha de estilos única
   Tema claro/escuro automático, responsivo, sem dependências
   ========================================================== */
:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --brand: #1d4ed8;
    --brand-hover: #1e40af;
    --brand-soft: #e8efff;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --ok: #15803d;
    --ok-soft: #dcfce7;
    --warn: #b45309;
    --warn-soft: #fef3c7;
    --info-soft: #e0f2fe;
    --nav-1: #0b1b3a;
    --nav-2: #11295a;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .08);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0a1020;
        --surface: #111a2e;
        --surface-2: #0e1628;
        --text: #e6ebf5;
        --muted: #94a3b8;
        --border: #1f2c47;
        --brand: #60a5fa;
        --brand-hover: #93c5fd;
        --brand-soft: #14284d;
        --danger: #f87171;
        --danger-soft: #3b1418;
        --ok: #4ade80;
        --ok-soft: #10301d;
        --warn: #fbbf24;
        --warn-soft: #3a2a0a;
        --info-soft: #0c2a3d;
        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
    }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.55; min-height: 100vh; }
img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.ico { flex: none; vertical-align: -3px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 6px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar {
    position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 8px;
    padding: 20px 14px; color: #e2e8f0;
    background: linear-gradient(180deg, var(--nav-2), var(--nav-1));
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 8px; }
.brand:hover { text-decoration: none; }
.brand img { width: 46px; height: auto; }
.brand span { display: flex; flex-direction: column; line-height: 1.2; }
.brand strong { font-size: 1.1rem; }
.brand small { color: #94a3b8; font-size: .75rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav-out {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
    color: #cbd5e1; font-weight: 500; font-size: .95rem; transition: background .15s, color .15s;
}
.nav a:hover, .nav-out:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(96,165,250,.18); color: #fff; box-shadow: inset 3px 0 0 #60a5fa; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.1); }
.nav-out.login { background: rgba(96,165,250,.18); color: #fff; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #3b82f6; color: #fff; font-weight: 700; }
.who { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.who strong { color: #fff; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { color: #94a3b8; font-size: .75rem; }

.main-col { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: none; }
#content { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 32px 28px 24px; }
.footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 18px; }
.scrim { display: none; }

/* ---------- Cabeçalho de página ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 1.7rem; }
.page-head p { color: var(--muted); margin-top: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

/* ---------- Cartões ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 24px; }
.card + .card { margin-top: 18px; }
.card.narrow { max-width: 560px; }
.card.wide { max-width: 860px; }
.card h2 { font-size: 1.1rem; margin-bottom: 4px; }
.card .sub { color: var(--muted); font-size: .9rem; margin-bottom: 18px; }
.card.empty { text-align: center; padding: 48px 24px; }
.card.empty p { color: var(--muted); margin: 6px 0 18px; }
.card.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }

/* ---------- Botões ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px;
    border-radius: 10px; border: 1px solid transparent; font: inherit; font-size: .92rem; font-weight: 600;
    cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
@media (prefers-color-scheme: dark) { .btn-primary { color: #0a1020; } }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--muted); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: .84rem; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---------- Formulários ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-weight: 600; font-size: .88rem; }
.field .req { color: var(--danger); }
.field .hint { color: var(--muted); font-size: .8rem; }
.field .err { color: var(--danger); font-size: .82rem; font-weight: 600; }
input[type=text], input[type=password], input[type=email], input[type=url], input[type=date], input[type=time],
input[type=number], input[type=search], input[type=file], select, textarea {
    width: 100%; padding: 10px 12px; font: inherit; font-size: .95rem; color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
input[disabled], select[disabled] { opacity: .6; cursor: not-allowed; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; max-height: 260px; overflow: auto; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .88rem; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.check:hover { background: var(--brand-soft); }
.check input { margin-top: 3px; accent-color: var(--brand); }
.check.disabled { opacity: .45; }

/* ---------- Alertas / badges ---------- */
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; border: 1px solid transparent; font-weight: 500; }
.alert-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.alert-erro { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-aviso { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert-info { background: var(--info-soft); color: var(--text); }
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; letter-spacing: .01em; }
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- Tabelas ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
td.acoes { white-space: nowrap; }
td.acoes .actions { flex-wrap: nowrap; }
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 360px; }
.search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 38px; }

/* ---------- Filtros ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin-bottom: 20px; }
.filters .field { min-width: 170px; flex: 1; }
.filters .field.grow { flex: 2; min-width: 240px; }

/* ---------- Editais ---------- */
.results { color: var(--muted); font-size: .9rem; margin-bottom: 12px; }
.edital { display: grid; grid-template-columns: 84px 1fr; gap: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); transition: box-shadow .2s, transform .2s; }
.edital + .edital { margin-top: 14px; }
.edital:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.edital-date { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand); padding: 10px 6px; height: fit-content; }
.edital-date .d { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.edital-date .m { text-transform: uppercase; font-weight: 700; letter-spacing: .08em; font-size: .78rem; }
.edital-date .y { font-size: .74rem; opacity: .8; }
.edital-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.edital-title { font-size: 1.08rem; margin-bottom: 8px; overflow-wrap: anywhere; }
.edital-student, .edital-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; color: var(--text); font-size: .92rem; }
.edital-student .ico, .edital-meta .ico { margin-right: 4px; color: var(--muted); }
.edital-meta { color: var(--muted); margin-top: 4px; }
.edital-meta span { display: inline-flex; align-items: center; }
.edital-more { margin-top: 12px; }
.edital-more summary { cursor: pointer; font-weight: 600; color: var(--brand); font-size: .9rem; list-style: none; width: fit-content; }
.edital-more summary::-webkit-details-marker { display: none; }
.edital-more summary::after { content: " ▾"; }
.edital-more[open] summary::after { content: " ▴"; }
.edital-more dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); font-size: .92rem; }
.edital-more dt { color: var(--muted); font-weight: 600; }
.edital-more dd { overflow-wrap: anywhere; }
.edital-more .actions { margin-top: 14px; }

/* ---------- Paginação ---------- */
.pagination { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 26px 0 4px; }
.pagination a, .pagination span { min-width: 38px; height: 38px; display: inline-grid; place-items: center; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: .9rem; }
.pagination a:hover { border-color: var(--brand); text-decoration: none; }
.pagination a.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .disabled, .pagination .gap { opacity: .45; background: transparent; border-color: transparent; }

/* ---------- Início ---------- */
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 28px; align-items: center; background: linear-gradient(135deg, var(--nav-2), var(--nav-1)); color: #e2e8f0; border-radius: 20px; padding: 36px; box-shadow: var(--shadow); overflow: hidden; }
.hero .eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 700; color: #93c5fd; }
.hero h1 { font-size: 2.1rem; color: #fff; margin: 8px 0 12px; }
.hero p { color: #cbd5e1; margin-bottom: 22px; max-width: 46ch; }
.hero img { border-radius: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, .35); aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.hero .btn-ghost { background: transparent; color: #e2e8f0; border-color: rgba(255,255,255,.3); }
.hero .btn-ghost:hover { background: rgba(255,255,255,.1); }
.hero .btn-primary { background: #3b82f6; color: #fff; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 32px 0 12px; }
.section-title h2 { font-size: 1.2rem; }

/* ---------- Perfil ---------- */
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 12px 16px; margin: 6px 0 4px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { overflow-wrap: anywhere; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg); }
.login-art { position: relative; background: linear-gradient(160deg, var(--nav-2), var(--nav-1)); color: #e2e8f0; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.login-art::before { content: ""; position: absolute; inset: 0; background: url("../imagens/school_image.webp") center / cover; opacity: .22; mix-blend-mode: luminosity; }
.login-art > * { position: relative; }
.login-art img.logo { width: 72px; }
.login-art h2 { font-size: 2rem; color: #fff; margin-bottom: 10px; }
.login-art p { max-width: 40ch; color: #cbd5e1; }
.login-form-wrap { display: grid; place-items: center; padding: 32px; }
.login-box { width: 100%; max-width: 400px; }
.login-box h1 { font-size: 1.6rem; margin-bottom: 6px; }
.login-box .sub { color: var(--muted); margin-bottom: 24px; }
.login-box form { display: flex; flex-direction: column; gap: 16px; }
.login-box .back { display: inline-flex; gap: 6px; align-items: center; margin-top: 20px; font-size: .9rem; color: var(--muted); }

/* ---------- Embed (editais2.php) ---------- */
body.embed { background: transparent; }
body.embed #content-embed { max-width: 960px; margin: 0 auto; padding: 16px; }

/* ---------- Responsivo ---------- */
@media (max-width: 960px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: 280px; transform: translateX(-100%); transition: transform .25s ease; overflow-y: auto; }
    .nav-toggle:checked ~ .shell .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
    .scrim { position: fixed; inset: 0; z-index: 30; background: rgba(2, 6, 23, .5); }
    .nav-toggle:checked ~ .shell .scrim { display: block; }
    .topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
    .topbar-title { font-weight: 700; }
    .icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); cursor: pointer; }
    #content { padding: 20px 16px; }
    .hero { grid-template-columns: 1fr; padding: 24px; }
    .login-page { grid-template-columns: 1fr; }
    .login-art { display: none; }
}
@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .edital { grid-template-columns: 1fr; gap: 12px; }
    .edital-date { flex-direction: row; gap: 8px; justify-content: flex-start; padding: 8px 12px; width: fit-content; }
    .edital-date .d { font-size: 1.2rem; }
    .edital-more dl, .kv { grid-template-columns: 1fr; gap: 2px 0; }
    .edital-more dd, .kv dd { margin-bottom: 8px; }
    .page-head h1 { font-size: 1.4rem; }
    .hero h1 { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
