:root {
  --pri: #0e5e6f; --acc: #ef7d57; --ink: #182a30; --muted: #65767b; --bg: #f3f1ec; --card: #fff;
  --line: #e3ded3; --ok: #1f9d55; --err: #c0392b; --warn: #d68910; --wa: #1fae55;
  --r: 14px; --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* , *::before, *::after { box-sizing: border-box; }
body { margin: 0; font: 15px/1.55 var(--sans); color: var(--ink); background: var(--bg); }
a { color: var(--pri); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; margin-top: 1.2em; }
img { max-width: 100%; }
.ico { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.muted { color: var(--muted); }
.small, .help { font-size: .82rem; }
.help { color: var(--muted); margin: 4px 0 0; }
.center { text-align: center; }
code { background: #f1ede4; padding: 1px 6px; border-radius: 6px; font-size: .85em; }

/* Layout */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 250px; background: #0c2a31; color: #cfdcde; display: flex; flex-direction: column; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
.sidebar.open { transform: none; box-shadow: 0 0 60px rgba(0,0,0,.4); }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 18px; color: #fff; text-decoration: none; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-brand svg { width: 36px; height: 36px; flex: none; }
.side-brand small { display: block; font-weight: 500; font-size: .75rem; color: #8fa7ab; }
.sidebar nav { flex: 1; overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a, .side-foot a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #cfdcde; text-decoration: none; font-weight: 500; }
.sidebar nav a:hover, .side-foot a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: var(--pri); color: #fff; }
.sidebar nav span { flex: 1; }
.badge { background: var(--acc); color: #fff; font-size: .72rem; padding: 1px 8px; border-radius: 999px; }
.side-foot { padding: 10px; border-top: 1px solid rgba(255,255,255,.08); }
.main { min-height: 100vh; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.topbar h1 { font-size: 1.2rem; margin: 0; }
.side-toggle { background: none; border: 0; padding: 6px; cursor: pointer; color: var(--ink); }
.side-toggle .ico { width: 24px; height: 24px; }
.content { padding: 20px 16px 80px; max-width: 1200px; }
@media (min-width: 960px) {
  .sidebar { transform: none; }
  .main { margin-left: 250px; }
  .side-toggle { display: none; }
  .topbar { padding: 18px 32px; }
  .content { padding: 28px 32px 80px; }
}

/* Componentes */
.card { background: var(--card); border-radius: var(--r); padding: 20px; box-shadow: 0 1px 0 var(--line), 0 8px 24px -18px rgba(0,0,0,.25); margin-bottom: 20px; }
.card.empty { text-align: center; color: var(--muted); padding: 40px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.btn { display: inline-flex; align-items: center; gap: 6px; justify-content: center; padding: 10px 18px; background: var(--pri); color: #fff; border: 1.5px solid var(--pri); border-radius: 10px; font: 600 .9rem var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: #fff; color: var(--pri); }
.btn-danger { background: #fff; color: var(--err); border-color: #e9b8b2; }
.btn-wa { background: var(--wa); border-color: var(--wa); }
.btn-sm { padding: 6px 12px; font-size: .82rem; }
.btn-block { width: 100%; }
.btn-row, .quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; }
.alert-ok { background: #e7f6ed; color: #145c33; border: 1px solid #b9e3c8; }
.alert-err { background: #fdecea; color: #8a1f17; border: 1px solid #f5c2bd; }
.alert-info { background: #e8f3f6; color: #0b4a58; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: #eee; color: #555; white-space: nowrap; vertical-align: middle; }
.pill.ok { background: #e7f6ed; color: #145c33; }
.pill.off { background: #f3f0ea; color: #8a8a8a; }
.pill.warn { background: #fdf2e2; color: #9a5b00; }
.st-nova { background: #fde7df; color: #b2441f; }
.st-respondida { background: #e8f3f6; color: #0b4a58; }
.st-confirmada { background: #e7f6ed; color: #145c33; }
.st-cancelada { background: #f1efea; color: #888; }
.back { text-decoration: none; font-weight: 600; font-size: .9rem; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.search { display: flex; gap: 6px; flex-wrap: wrap; }
.search input { padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; min-width: 200px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 14px; border-radius: 999px; background: #fff; border: 1.5px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 600; font-size: .85rem; }
.chip.active { background: var(--pri); border-color: var(--pri); color: #fff; }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 16px; border-bottom: 2px solid var(--line); }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a.active { color: var(--pri); border-color: var(--pri); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: #fff; border-radius: var(--r); padding: 18px; text-decoration: none; color: var(--ink); box-shadow: 0 1px 0 var(--line); }
.stat strong { display: block; font-size: 2rem; line-height: 1; color: var(--pri); }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.accent { background: var(--acc); }
.stat.accent strong, .stat.accent span { color: #fff; }
.checklist { border-left: 4px solid var(--warn); }
.checklist ul { margin: 0; padding: 0; list-style: none; }
.checklist li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.checklist li:first-child { border-top: 0; }
.checklist a { font-weight: 700; white-space: nowrap; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.list li a { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; }
.list .muted { font-size: .85rem; }
.detail-grid { display: grid; gap: 20px; }
@media (min-width: 1000px) { .detail-grid { grid-template-columns: 1.3fr 1fr; } }
.dl { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; margin: 0; }
.dl dt { color: var(--muted); font-size: .85rem; }
.dl dd { margin: 0; }

/* Tabelas */
.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #faf8f4; }
.table tr.is-new td { background: #fffaf6; }
.table td a { text-decoration: none; }
.table.compact th, .table.compact td { padding: 8px; }
.thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; display: block; background: #eee; }
.w-thumb { width: 80px; } .w-ord { width: 90px; } .w-act { width: 1%; }
.actions { white-space: nowrap; text-align: right; }
.ord { width: 70px; padding: 6px 8px; border: 1.5px solid var(--line); border-radius: 8px; font: inherit; }
.table-foot { padding: 12px 14px; display: flex; gap: 10px; align-items: center; }
@media (max-width: 700px) {
  .table thead { display: none; }
  .table tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .table td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 6px 14px; }
  .table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .8rem; }
  .actions { text-align: left; }
}

/* Formulários */
.form label, .field > label, .label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
.form label { margin-bottom: 14px; }
.field > label { margin-bottom: 6px; }
.form input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]), .form select, .form textarea, .photo-item input:not([type=checkbox]):not([type=radio]) {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; background: #fff; color: var(--ink);
}
.field > input, .field > select, .field > textarea { margin-top: 0 !important; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--pri); box-shadow: 0 0 0 3px rgba(14,94,111,.15); }
.form textarea.code { font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.form fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 0 0 16px; }
.form legend { font-weight: 700; padding: 0 6px; }
.form-grid { display: grid; gap: 18px; }
@media (min-width: 760px) { .form-grid { grid-template-columns: 1fr 1fr; } .field.wide { grid-column: 1 / -1; } }
.check { display: inline-flex !important; align-items: center; gap: 8px; font-weight: 500 !important; cursor: pointer; margin: 0 !important; }
.check input { width: 18px; height: 18px; accent-color: var(--pri); }
.check.danger { color: var(--err); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check.pill { padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 999px; background: #fff; font-size: .85rem; color: var(--ink); }
.check.pill:has(input:checked) { border-color: var(--pri); background: #e8f3f6; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 20px; }
.form-actions.sticky { position: sticky; bottom: 0; background: rgba(255,255,255,.95); padding: 14px 0 4px; border-top: 1px solid var(--line); }
.gallery-form .form-actions.sticky { background: rgba(243,241,236,.95); padding: 14px 0; }
.form-inline { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-top: 14px; }
.form-inline label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .85rem; }
.form-inline input:not([type=checkbox]) { padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; min-width: 220px; }
.img-field { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.img-preview { width: 220px; height: 140px; object-fit: cover; border-radius: 10px; background: #f1ede4; border: 1.5px solid var(--line); }
.img-preview.empty { visibility: hidden; width: 0; border: 0; }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input { width: 56px; height: 40px; border: 0; padding: 0; background: none; cursor: pointer; }
.danger-zone { margin-top: 8px; }

/* Editor */
.editor { border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; }
.editor-bar { display: flex; gap: 4px; flex-wrap: wrap; padding: 6px; background: #faf8f4; border-bottom: 1px solid var(--line); }
.editor-bar button { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; cursor: pointer; font: 600 .82rem var(--sans); color: var(--ink); }
.editor-bar button:hover { border-color: var(--pri); }
.editor-bar .right { margin-left: auto; }
.editor textarea { border: 0 !important; border-radius: 0 !important; margin: 0 !important; min-height: 320px; }
.editor-preview { padding: 16px 20px; min-height: 320px; background: #fff; }
.editor-preview img { max-width: 100%; border-radius: 8px; }

/* Fotos */
.subcard { margin-top: 28px; padding-top: 20px; border-top: 1px dashed var(--line); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 14px 0; }
.photo-grid.big { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.photo-item { background: #fff; border-radius: 12px; padding: 8px; box-shadow: 0 1px 0 var(--line); display: grid; gap: 6px; }
.photo-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; display: block; background: #eee; }
.photo-item input:not([type=checkbox]):not([type=radio]) { margin: 0 !important; padding: 6px 8px !important; font-size: .85rem; }
.photo-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .82rem; }
.photo-row .ord { width: 58px; }
.dropzone { display: block; border: 2px dashed #c9c2b3; border-radius: 14px; padding: 24px; text-align: center; cursor: pointer; background: #faf8f4; color: var(--muted); font-weight: 600; position: relative; margin: 0 !important; }
.dropzone:hover, .dropzone.over { border-color: var(--pri); background: #eef6f7; color: var(--pri); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone span { display: inline-flex; gap: 8px; align-items: center; }
.multi-preview { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.multi-preview img { width: 84px; height: 64px; object-fit: cover; border-radius: 8px; }
.upload-card h2 { margin-bottom: 12px; }

/* Login / instalação */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, #0c2a31, #0e5e6f); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 28px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); }
.auth-card h1 { font-size: 1.5rem; }
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; }
.auth-brand svg { width: 44px; height: 44px; }
.auth-brand strong { display: block; font-size: 1.1rem; }
.auth-brand small { color: var(--muted); }
.prose h2 { font-size: 1.4rem; } .prose p { margin: 0 0 1em; }
