@font-face { font-family: "Fraunces"; font-weight: 400; src: url("../../assets/fonts/fraunces-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-weight: 400; font-style: italic; src: url("../../assets/fonts/fraunces-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Work Sans"; font-weight: 400; src: url("../../assets/fonts/work-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Work Sans"; font-weight: 500; src: url("../../assets/fonts/work-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Work Sans"; font-weight: 600; src: url("../../assets/fonts/work-sans-latin-600-normal.woff2") format("woff2"); }

:root {
  --ink: #0B0A08; --ink-2: #171410; --ink-3: #3A342A;
  --gold: #C6A254; --gold-deep: #9C7A34; --gold-soft: #E3C989;
  --paper: #FBF9F4; --paper-2: #F1EBDC; --ok: #5C7A54; --err: #9B3B2E; --warn: #A4741B;
  --line: rgba(198,162,84,.32); --border: #E3DACA; --muted: #776E5F;
  --side-w: 250px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 15px/1.55 "Work Sans", system-ui, sans-serif; color: var(--ink); background: var(--paper); }
a { color: var(--gold-deep); }
h1, h2, h3 { font-family: "Fraunces", Georgia, serif; font-weight: 400; margin: 0 0 12px; line-height: 1.2; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; margin-top: 18px; }
img { max-width: 100%; }
code { background: var(--paper-2); padding: 1px 6px; border-radius: 3px; font-size: .88em; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--gold); padding: 6px 10px; z-index: 100; }

/* Layout */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--ink); color: #DCD3C0; display: flex; flex-direction: column; z-index: 50; border-right: 1px solid var(--line); }
.side-logo { display: block; padding: 22px 20px 18px; border-bottom: 1px solid rgba(198,162,84,.18); }
.side-logo img { width: 100%; height: auto; display: block; }
.side-nav { flex: 1; overflow-y: auto; padding: 10px 0; }
.side-nav a { display: block; padding: 11px 22px; color: #DCD3C0; text-decoration: none; font-size: .92rem; border-left: 3px solid transparent; }
.side-nav a:hover { background: var(--ink-2); color: var(--gold-soft); }
.side-nav a.is-active { background: var(--ink-2); color: var(--gold-soft); border-left-color: var(--gold); font-weight: 500; }
.side-foot { padding: 14px 22px 20px; border-top: 1px solid rgba(198,162,84,.18); display: flex; flex-direction: column; gap: 8px; font-size: .88rem; }
.side-foot a, .side-foot .linkbtn { color: #B9AF9B; text-align: left; }
.main-wrap { margin-left: var(--side-w); min-height: 100vh; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 26px 36px 14px; }
.topbar h1 { font-size: 1.9rem; margin: 0; }
.subtitle { margin: 4px 0 0; color: var(--muted); }
.side-toggle { display: none; background: var(--ink); color: var(--gold-soft); border: 0; width: 42px; height: 42px; font-size: 1.3rem; border-radius: 4px; cursor: pointer; flex: none; }
.content { padding: 10px 36px 120px; max-width: 1400px; }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border: 1px solid var(--ink-3); background: #fff; color: var(--ink); border-radius: 3px; cursor: pointer; font: 500 .82rem "Work Sans", sans-serif; letter-spacing: .04em; text-decoration: none; line-height: 1.2; white-space: nowrap; }
.btn:hover { border-color: var(--gold-deep); color: var(--gold-deep); }
.btn-gold { background: var(--ink); border-color: var(--ink); color: var(--gold-soft); }
.btn-gold:hover { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-danger { color: var(--err); border-color: #E2B8AF; background: #fff; }
.btn-danger:hover { background: var(--err); color: #fff; border-color: var(--err); }
.btn-sm { padding: 6px 11px; font-size: .76rem; }
.btn:disabled { opacity: .5; cursor: wait; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--gold-deep); cursor: pointer; font: inherit; text-decoration: underline; }
.linkbtn.danger { color: var(--err); }
form.inline { display: inline; }

/* Alertas */
.alert { padding: 12px 16px; border-radius: 4px; margin: 0 0 14px; border-left: 4px solid; background: #fff; }
.alert-ok { border-color: var(--ok); background: #EEF4EB; }
.alert-err { border-color: var(--err); background: #F9ECE9; }
.alert-warn { border-color: var(--warn); background: #FBF3E2; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: .7rem; font-weight: 500; letter-spacing: .04em; background: var(--paper-2); color: var(--ink-3); vertical-align: middle; }
.badge-ok { background: #E3EDDF; color: #3F5A38; }
.badge-gold { background: var(--gold); color: var(--ink); }
.badge-muted { background: #ECE7DD; color: var(--muted); }
.badge-warn { background: #F6E4C4; color: #7A5414; }

/* Painéis e grids */
.panel { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 24px; margin-bottom: 22px; }
fieldset.panel { margin: 0 0 22px; }
fieldset.panel legend { font-family: "Fraunces", serif; font-size: 1.25rem; padding: 0 8px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 32px; }
.grid2.tight { gap: 4px 24px; }
.grid2 > .panel { margin-bottom: 0; }
.span2 { grid-column: 1 / -1; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.row-inline { display: flex; flex-wrap: wrap; gap: 0 16px; align-items: flex-end; }
.row-inline .grow, .grow { flex: 1 1 280px; }
.row-inline .narrow { width: 110px; }
.row-inline .btn, .row-inline .check { margin-bottom: 16px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 18px; }
.toolbar .f { margin-bottom: 0; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.box { border: 1px solid var(--border); border-radius: 6px; padding: 14px 16px 4px; margin: 6px 0 16px; }
.box legend { font-weight: 600; font-size: .85rem; padding: 0 6px; }
.danger-zone { margin-top: 10px; display: flex; justify-content: flex-end; }

/* Cards da visão geral */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { display: block; background: var(--ink); color: #DCD3C0; text-decoration: none; padding: 20px; border-radius: 6px 30px 6px 6px; }
.stat strong { display: block; font-family: "Fraunces", serif; font-weight: 400; font-size: 2rem; color: var(--gold-soft); line-height: 1.1; }
.stat span { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; }
.stat:hover { background: var(--ink-2); }
.shortcuts { display: flex; flex-wrap: wrap; gap: 8px; }
.mini-list { margin: 0 0 12px; padding-left: 18px; font-size: .9rem; color: var(--ink-3); }

/* Formulários */
.form .f, .f { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.f > span { font-size: .8rem; font-weight: 600; color: var(--ink-3); }
.f small, .check small { color: var(--muted); font-size: .8rem; }
input[type=text], input[type=email], input[type=url], input[type=password], input[type=number], input[type=date], input:not([type]), select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #D4CAB7; border-radius: 4px; font: 400 .95rem "Work Sans", sans-serif; background: #fff; color: var(--ink);
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(198,162,84,.22); }
input[type=file] { font-size: .85rem; max-width: 100%; }
.check { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--gold-deep); }
.check small { flex-basis: 100%; margin-left: 26px; }
.img-field { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.img-preview { width: 200px; aspect-ratio: 3/4; background: var(--ink); border-radius: 4px 30px 4px 4px; overflow: hidden; display: flex; align-items: center; justify-content: center; flex: none; }
.img-preview img { width: 100%; height: 100%; object-fit: contain; }
.img-preview.is-empty em { color: #8B826F; font-size: .85rem; }
.img-actions { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 8px; }
.savebar { position: sticky; bottom: 0; z-index: 20; display: flex; justify-content: flex-end; gap: 10px; padding: 14px 0; margin-top: 10px; background: linear-gradient(to top, #fff 75%, rgba(255,255,255,0)); border-top: 1px solid var(--border); }
.content > form > .savebar { background: linear-gradient(to top, var(--paper) 75%, rgba(251,249,244,0)); }
.inline-form { display: flex; flex-wrap: wrap; gap: 0 14px; align-items: flex-end; }
.inline-form .f { flex: 1 1 200px; }
.inline-form .btn, .inline-form .check { margin-bottom: 16px; }
.jump { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.jump a { padding: 5px 12px; border: 1px solid var(--border); border-radius: 20px; text-decoration: none; font-size: .8rem; color: var(--ink-3); background: #fff; }
.jump a:hover { border-color: var(--gold); }
fieldset[id] { scroll-margin-top: 16px; }

/* Tabelas */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; padding: 10px; border-bottom: 2px solid var(--border); }
.table td { padding: 10px; border-bottom: 1px solid #EEE7DA; vertical-align: middle; }
.table tr:hover td { background: #FDFBF6; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions > * { margin-left: 4px; }
.table .empty, .empty { text-align: center; color: var(--muted); padding: 26px; }
.thumb-cell { width: 76px; }
.thumb-cell img { width: 60px; height: 76px; object-fit: contain; background: var(--ink); border-radius: 3px 14px 3px 3px; display: block; }
.thumb-cell img.round { width: 56px; height: 56px; object-fit: cover; border-radius: 50%; box-shadow: 0 0 0 2px var(--gold); }
.no-img { display: flex; align-items: center; justify-content: center; width: 60px; height: 76px; background: var(--paper-2); color: var(--muted); font-size: .68rem; border-radius: 3px; text-align: center; }
.no-img.round { width: 56px; height: 56px; border-radius: 50%; font-family: "Fraunces", serif; font-style: italic; font-size: 1rem; background: var(--ink); color: var(--gold-soft); }
.table-edit input { min-width: 130px; padding: 6px 8px; font-size: .88rem; }
.table-edit td:nth-child(2) input { min-width: 240px; }
.docs-table td:first-child { width: 44px; font-family: "Fraunces", serif; font-style: italic; color: var(--gold-deep); font-size: 1.1rem; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.group-edit { margin-bottom: 14px; }
.group-edit summary { cursor: pointer; color: var(--gold-deep); font-size: .88rem; margin-bottom: 10px; }
.course-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.course-summary h2 { margin-bottom: 4px; }
.course-summary p { margin: 0; }
.course-picker .f { flex: 1 1 420px; }

/* Dropzone e progresso */
.dropzone { position: relative; border: 2px dashed #D4CAB7; border-radius: 6px; padding: 28px 18px; text-align: center; background: var(--paper); transition: border-color .2s, background .2s; margin-bottom: 14px; }
.dropzone.is-over { border-color: var(--gold); background: #FBF4E4; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone label { color: var(--ink-3); pointer-events: none; }
.dz-list { list-style: none; margin: 12px 0 0; padding: 0; font-size: .82rem; color: var(--muted); max-height: 140px; overflow: auto; text-align: left; }
.progress { position: relative; height: 26px; background: var(--paper-2); border-radius: 13px; overflow: hidden; margin: 10px 0 14px; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-deep), var(--gold)); transition: width .25s; }
.progress-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 600; }

/* Galeria admin */
.album-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.album-card { display: block; background: #fff; border: 1px solid var(--border); border-radius: 6px 30px 6px 6px; overflow: hidden; text-decoration: none; color: var(--ink); }
.album-card:hover { border-color: var(--gold); }
.album-card .cover { aspect-ratio: 4/3; background: var(--ink); display: flex; align-items: center; justify-content: center; color: #8B826F; font-size: .85rem; }
.album-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.album-card .info { padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.album-card small { color: var(--gold-deep); text-transform: uppercase; letter-spacing: .1em; font-size: .7rem; }
.album-card span { color: var(--muted); font-size: .82rem; }
.photo-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.photo-admin figure { margin: 0; background: var(--paper); border: 1px solid var(--border); border-radius: 4px; padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.photo-admin img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; border-radius: 2px; }
.photo-admin input { padding: 5px 7px; font-size: .82rem; }
.ph-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: .78rem; color: var(--muted); }
.ph-row input { width: 60px; }

/* Importador */
.scan-msg { margin: 10px 0; font-weight: 500; }
.scan-msg.is-error { color: var(--err); }
.import-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; max-height: 560px; overflow: auto; padding: 4px; margin-bottom: 18px; border: 1px solid var(--border); border-radius: 6px; }
.import-item { position: relative; display: block; border: 2px solid transparent; border-radius: 4px; overflow: hidden; background: var(--paper-2); cursor: pointer; }
.import-item.is-on { border-color: var(--gold); }
.import-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.import-item input { position: absolute; top: 6px; left: 6px; width: 20px; height: 20px; accent-color: var(--gold-deep); }
.import-item span { display: block; font-size: .68rem; padding: 4px 6px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.import-item.done::after { content: "✓"; position: absolute; top: 6px; right: 6px; background: var(--ok); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .8rem; }
.import-item.fail::after { content: "!"; position: absolute; top: 6px; right: 6px; background: var(--err); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.import-log { list-style: none; padding: 0; margin: 8px 0 0; font-size: .82rem; max-height: 180px; overflow: auto; color: var(--muted); }

/* Autenticação */
body.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--ink); padding: 20px; }
.auth-box { width: 100%; max-width: 400px; background: var(--paper); padding: 34px; border-radius: 4px 50px 4px 4px; border-top: 3px solid var(--gold); }
.auth-logo { background: var(--ink); padding: 18px 22px; margin: -34px -34px 26px; border-radius: 0 47px 0 0; }
.auth-logo img { display: block; width: 100%; }
.auth-box h1 { font-size: 1.7rem; }
.auth-box .btn { width: 100%; padding: 13px; }
.auth-text { color: var(--ink-3); }
.auth-back { text-align: center; margin: 18px 0 0; font-size: .88rem; }

/* Responsivo */
@media (max-width: 980px) {
  .side { transform: translateX(-100%); transition: transform .25s; }
  .side.is-open { transform: none; box-shadow: 0 0 0 100vmax rgba(11,10,8,.5); }
  .main-wrap { margin-left: 0; }
  .side-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .topbar { padding: 18px 20px 10px; }
  .topbar h1 { font-size: 1.5rem; }
  .content { padding: 8px 20px 110px; }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .content { padding: 6px 14px 110px; }
  .panel { padding: 18px 14px; }
  .row2 { grid-template-columns: 1fr; }
  .img-preview { width: 140px; }
  .table .actions { white-space: normal; }
  .topbar { padding: 14px 14px 8px; }
}
