/* =====================================================================
   Estrela do Norte — Painel administrativo
   ===================================================================== */
:root {
  --pine-950: #071a14; --pine-900: #0b261e; --pine-800: #123b2e; --pine-700: #1c4d3d; --pine-100: #e3ebe6; --pine-50: #f1f5f2;
  --berry: #a3242e; --gold: #c6a15b; --gold-light: #e7d4a6; --gold-dark: #94733a;
  --bg: #f6f3ec; --card: #ffffff; --ink: #1a1f1c; --ink-soft: #3a423e; --muted: #6b746f; --line: #e8e2d5; --line-soft: #f0ebe1;
  --success: #2f7a4f; --warning: #a8701c; --danger: #b3261e; --info: #2b5f86;
  --radius: 14px; --sidebar: 256px;
  --font-display: "Fraunces", Georgia, serif;
  --font-ui: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-ui); font-size: 14px; line-height: 1.55; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; color: var(--pine-900); margin: 0 0 .5em; line-height: 1.2; }
.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Layout */
.shell { display: grid; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--pine-950); color: rgba(255,255,255,.72); display: flex; flex-direction: column; transform: translateX(-100%); transition: transform .3s cubic-bezier(.22,1,.36,1); z-index: 50; }
.sidebar.is-open { transform: none; box-shadow: 20px 0 60px -20px rgba(0,0,0,.5); }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand svg { width: 36px; height: 36px; }
.sidebar-brand strong { display: block; font-family: var(--font-display); font-weight: 500; font-size: 18px; color: #fff; line-height: 1.1; }
.sidebar-brand small { font-size: 9px; letter-spacing: .3em; text-transform: uppercase; color: var(--gold-light); }
.sidebar nav { flex: 1; overflow-y: auto; padding: 10px 10px 20px; }
.nav-section { padding: 16px 12px 6px; font-size: 10.5px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: rgba(255,255,255,.38); }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; font-weight: 600; font-size: 13.5px; transition: background-color .15s, color .15s; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.is-active { background: rgba(198,161,91,.16); color: var(--gold-light); }
.nav-item .count { margin-left: auto; background: var(--berry); color: #fff; font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 999px; }
.sidebar-foot { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12.5px; }
.sidebar-foot a { color: var(--gold-light); }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px 18px; background: rgba(246,243,236,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 20px; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.topbar .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--pine-800); color: var(--gold-light); display: grid; place-items: center; font-weight: 800; }
.menu-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; }
.content { padding: 20px 18px 60px; max-width: 1440px; }
.backdrop { position: fixed; inset: 0; background: rgba(7,26,20,.45); z-index: 40; display: none; }
.backdrop.is-open { display: block; }
@media (min-width: 1024px) {
  .shell { grid-template-columns: var(--sidebar) 1fr; }
  .sidebar { transform: none; position: sticky; top: 0; height: 100vh; }
  .menu-btn { display: none; }
  .content { padding: 28px 32px 80px; }
  .topbar { padding: 14px 32px; }
}

/* Componentes */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--pine-800); background: var(--pine-800); color: #fff; font-weight: 700; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: background-color .15s, transform .15s; }
.btn:hover { background: var(--pine-700); }
.btn:active { transform: scale(.98); }
.btn-outline { background: #fff; color: var(--pine-900); border-color: var(--line); }
.btn-outline:hover { background: var(--pine-50); border-color: var(--pine-700); }
.btn-danger { background: #fff; color: var(--danger); border-color: #f0c8c3; }
.btn-danger:hover { background: #fbecea; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--pine-950); }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-link { background: none; border: 0; padding: 0; color: var(--pine-800); font-weight: 700; cursor: pointer; text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-actions .intro { color: var(--muted); max-width: 760px; margin: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.card h2 { font-size: 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpi span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kpi strong { display: block; font-size: 24px; font-weight: 800; color: var(--pine-900); margin-top: 4px; letter-spacing: -.01em; }
.kpi small { color: var(--muted); }
.kpi.is-accent { background: var(--pine-900); border-color: var(--pine-900); }
.kpi.is-accent span { color: var(--gold-light); }
.kpi.is-accent strong { color: #fff; }
.kpi.is-accent small { color: rgba(255,255,255,.6); }

/* Tabelas */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:hover td { background: #fcfbf8; }
.table .thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--line-soft); }
.table .num { text-align: right; white-space: nowrap; }
.table .muted { color: var(--muted); font-size: 12.5px; }
.table a.strong { font-weight: 700; color: var(--pine-900); }
.table a.strong:hover { color: var(--berry); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 800; white-space: nowrap; }
.pill-success { background: #e4f2ea; color: var(--success); }
.pill-warning { background: #fbf1df; color: var(--warning); }
.pill-danger { background: #f8e4e2; color: var(--danger); }
.pill-info { background: #e3edf5; color: var(--info); }
.pill-muted { background: var(--line-soft); color: var(--muted); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }

/* Filtros e paginação */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filters input, .filters select { height: 38px; border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 0 12px; font-size: 13.5px; }
.filters input[type=search] { min-width: 220px; flex: 1; }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 16px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs a { padding: 10px 14px; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-size: 13.5px; }
.tabs a.is-active { color: var(--pine-900); border-color: var(--gold); }
.tabs a .n { font-size: 11px; color: var(--muted); margin-left: 4px; }
.pagination { display: flex; gap: 6px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 34px; height: 34px; display: grid; place-items: center; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-weight: 700; font-size: 13px; }
.pagination .is-current { background: var(--pine-800); color: #fff; border-color: var(--pine-800); }

/* Formulários */
.form-grid { display: grid; gap: 0 16px; }
@media (min-width: 720px) { .form-grid.cols-2 { grid-template-columns: 1fr 1fr; } .form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); } .form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }
.field { display: grid; gap: 5px; margin-bottom: 14px; }
.field > label, .field .label { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.field .hint { font-size: 12px; color: var(--muted); }
.field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 14px; transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 96px; resize: vertical; }
.field textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; min-height: 160px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--pine-700); box-shadow: 0 0 0 3px rgba(28,77,61,.1); }
.field input[type=color] { padding: 4px; height: 42px; width: 80px; }
.check { display: flex; gap: 9px; align-items: center; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--pine-800); }
.form-actions { position: sticky; bottom: 0; z-index: 10; display: flex; gap: 10px; justify-content: flex-end; padding: 14px 0; margin-top: 16px; background: linear-gradient(transparent, var(--bg) 30%); }
.image-field { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.image-field img { width: 120px; height: 80px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--line-soft); }
.images-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.image-tile { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.image-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--line-soft); }
.image-tile .meta { padding: 8px; display: grid; gap: 6px; }
.image-tile input { width: 100%; height: 32px; border: 1px solid var(--line); border-radius: 7px; padding: 0 8px; font-size: 12px; }
.variant-table input, .variant-table select { width: 100%; min-width: 70px; height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font-size: 13px; background: #fff; }
.dropzone { border: 1.5px dashed var(--line); border-radius: 12px; padding: 18px; text-align: center; background: var(--pine-50); color: var(--muted); }
.secret-input { display: flex; gap: 8px; align-items: center; }
.secret-input input { flex: 1; }
.copy-box { display: flex; gap: 8px; }
.copy-box input { flex: 1; font-family: ui-monospace, monospace; font-size: 12.5px; background: var(--pine-50) !important; }

/* Alertas */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; font-size: 13.5px; }
.alert-success { background: #ecf6f0; border-color: #c7e3d2; color: #1f5a39; }
.alert-error { background: #fbecea; border-color: #f0c8c3; color: #8a1f17; }
.alert-info { background: #edf3f8; border-color: #cddbe8; color: #23496a; }
.alert-warning { background: #fdf5e6; border-color: #f0dcb2; color: #7a5212; }

/* Gráfico */
.chart { width: 100%; height: 240px; }
.chart .bar { fill: var(--pine-700); transition: fill .15s; }
.chart .bar:hover { fill: var(--gold); }
.chart .axis { fill: var(--muted); font-size: 10px; font-family: var(--font-ui); }
.chart .grid-line { stroke: var(--line-soft); }
.chart-tip { position: fixed; pointer-events: none; background: var(--pine-950); color: #fff; font-size: 12px; padding: 6px 10px; border-radius: 8px; z-index: 100; display: none; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: center; font-size: 13.5px; }
.checklist .dot { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.checklist .ok .dot { background: #e4f2ea; color: var(--success); }
.checklist .no .dot { background: #fbf1df; color: var(--warning); }
.checklist .no a { margin-left: auto; font-weight: 700; color: var(--pine-800); font-size: 12.5px; }
.bar-list { display: grid; gap: 10px; }
.bar-list .row { display: grid; gap: 4px; }
.bar-list .row div { display: flex; justify-content: space-between; font-size: 13px; }
.bar-list .track { height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.bar-list .track span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--pine-700)); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 16px; bottom: 0; width: 2px; background: var(--line-soft); }
.timeline li:last-child::after { display: none; }
.timeline small { display: block; color: var(--muted); }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 600; word-break: break-word; }
pre.log { background: var(--pine-950); color: #d9e4dd; padding: 14px; border-radius: 10px; font-size: 11.5px; overflow: auto; max-height: 420px; white-space: pre-wrap; }
.demo-flag { background: repeating-linear-gradient(-45deg, #fff4d6, #fff4d6 10px, #ffecbd 10px, #ffecbd 20px); border: 1.5px dashed #c58a16; color: #6b4a07; padding: 10px 14px; border-radius: 10px; font-weight: 700; margin-bottom: 14px; }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(120% 80% at 20% 0%, var(--pine-700), var(--pine-950)); }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 20px; padding: 32px; box-shadow: 0 40px 80px -40px rgba(0,0,0,.6); }
.login-card .brand { text-align: center; margin-bottom: 24px; }
.login-card .brand svg { width: 56px; height: 56px; margin: 0 auto 10px; }
.login-card h1 { font-size: 24px; text-align: center; margin: 0; }
.login-card p { text-align: center; color: var(--muted); margin: 4px 0 0; font-size: 13px; }
.sortable-row { cursor: grab; }
.section-row { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; margin-bottom: 10px; }
.section-row .handle { color: var(--muted); display: grid; place-items: center; cursor: grab; }
.section-row.is-off { opacity: .6; }
