/* =========================================================
   SINDPD/PI · Gerenciador — interface administrativa
   ========================================================= */
:root {
  --ink: #0b1a33;
  --ink-2: #13284b;
  --ink-3: #1d3a66;
  --brand: #1f5eff;
  --brand-600: #1849cc;
  --brand-50: #eef3ff;
  --brand-100: #dbe5ff;
  --accent: #10b5a3;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e4e8f0;
  --line-2: #d3d9e4;
  --text: #0f1a2b;
  --text-2: #4a5872;
  --text-3: #7d889c;
  --ok: #0f9d6b;
  --ok-50: #e7f7f0;
  --warn: #c27a00;
  --warn-50: #fff5e0;
  --danger: #dc3545;
  --danger-600: #b42332;
  --danger-50: #fdecee;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 26, 43, .06);
  --shadow: 0 1px 2px rgba(15, 26, 43, .05), 0 6px 20px -8px rgba(15, 26, 43, .12);
  --shadow-lg: 0 24px 60px -16px rgba(11, 26, 51, .35);
  --sidebar-w: 268px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body.adm {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
[hidden] { display: none !important; }
.ico { width: 20px; height: 20px; flex: 0 0 auto; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; border-radius: 8px; z-index: 999; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid rgba(31, 94, 255, .35); outline-offset: 2px; }

/* ---------- Estrutura ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: var(--ink);
  background-image: radial-gradient(120% 60% at 0% 0%, rgba(31, 94, 255, .28), transparent 60%);
  color: #c9d4ea; display: flex; flex-direction: column;
  padding: 18px 14px; z-index: 60; overflow-y: auto;
  transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 18px; }
.brand { display: block; flex: 1; min-width: 0; }
.brand-logo { display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 12px; padding: 8px 12px; box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .5); }
.brand-logo img { display: block; height: 42px; width: auto; }
.sidebar .sidebar-close { display: none; color: #c9d4ea; }
.sidebar .sidebar-close:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: #6f82a6; padding: 8px 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: #c9d4ea; font-weight: 500; font-size: 14.5px; position: relative;
  transition: background .15s, color .15s;
}
.nav-link .ico { width: 19px; height: 19px; opacity: .85; }
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link.is-active { background: rgba(31, 94, 255, .22); color: #fff; }
.nav-link.is-active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand); }
.nav-link.is-active .ico { opacity: 1; color: #8fb0ff; }
.nav-badge { margin-left: auto; font-size: 11.5px; font-weight: 700; background: rgba(255, 255, 255, .1); color: #dfe7f7; border-radius: 99px; padding: 1px 8px; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .08); display: flex; flex-direction: column; gap: 2px; }
.nav-danger:hover { background: rgba(220, 53, 69, .16); color: #ffb3bb; }
.backdrop { display: none; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 32px; min-height: 72px;
  background: rgba(243, 245, 249, .86);
  -webkit-backdrop-filter: saturate(180%) blur(12px); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
}
.topbar.is-scrolled { border-bottom-color: var(--line); }
.topbar .menu-btn { display: none; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 22px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-sub { color: var(--text-3); font-size: 13.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--text-3); margin-bottom: 2px; }
.back-link .ico { width: 16px; height: 16px; }
.back-link:hover { color: var(--brand); }
.topbar-user { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--surface);
  padding: 5px 10px 5px 5px; border-radius: 99px; cursor: pointer; font: inherit; color: var(--text);
  box-shadow: var(--shadow-sm);
}
.user-chip:hover { border-color: var(--line-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; background: linear-gradient(135deg, var(--brand), var(--accent)); }
.user-name { font-weight: 600; font-size: 14px; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { width: 16px; height: 16px; transform: rotate(90deg); color: var(--text-3); transition: transform .2s; }
.user-chip[aria-expanded="true"] .chev { transform: rotate(-90deg); }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; opacity: 0; transform: translateY(-4px); pointer-events: none; transition: .15s;
}
.dropdown.is-open { opacity: 1; transform: none; pointer-events: auto; }
.dropdown a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); font-size: 14px; font-weight: 500; }
.dropdown a .ico { width: 18px; height: 18px; color: var(--text-3); }
.dropdown a:hover { background: var(--surface-2); }
.dropdown a.danger { color: var(--danger); }
.dropdown a.danger .ico { color: var(--danger); }

.content { padding: 8px 32px 32px; flex: 1; width: 100%; max-width: 1360px; }
.foot { padding: 18px 32px 26px; color: var(--text-3); font-size: 12.5px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 14px; line-height: 1;
  padding: 11px 16px; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn .ico { width: 18px; height: 18px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px -8px rgba(31, 94, 255, .8); }
.btn-primary:hover { background: var(--brand-600); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--line-2); background: var(--surface-2); color: var(--text); }
.btn-soft { background: var(--brand-50); color: var(--brand-600); }
.btn-soft:hover { background: var(--brand-100); color: var(--brand-600); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-600); color: #fff; }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn.is-disabled, .btn[disabled] { opacity: .45; pointer-events: none; }
.btn.is-loading { pointer-events: none; opacity: .75; }
.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px;
  background: transparent; border: 0; color: var(--text-2); cursor: pointer; flex: 0 0 auto;
}
.icon-btn:hover { background: rgba(15, 26, 43, .06); color: var(--text); }
.icon-btn .ico { width: 19px; height: 19px; }
.act-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2); transition: .15s;
}
.act-btn .ico { width: 17px; height: 17px; }
.act-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-50); }
.act-btn.danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-50); }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }

/* ---------- Cartões ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2 { font-size: 16.5px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.card-head h2 .ico { color: var(--brand); }
.card-head .muted { font-weight: 500; }
.card-body { padding: 22px; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.muted { color: var(--text-3); font-size: 13.5px; }
.count { display: inline-flex; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--brand-50); color: var(--brand-600); font-size: 12px; font-weight: 700; align-items: center; justify-content: center; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-2 > .card + .card { margin-top: 0; }
.grid-editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.sticky { position: sticky; top: 92px; }
.stack > * + * { margin-top: 20px; }

/* ---------- Painel ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 18px; padding: 28px 30px; color: #fff;
  background: linear-gradient(120deg, var(--ink) 0%, var(--ink-3) 60%, #1f5eff 130%);
  box-shadow: var(--shadow);
}
.hero::after { content: ""; position: absolute; right: -60px; top: -80px; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, rgba(16, 181, 163, .45), transparent 65%); }
.hero h2 { font-size: 26px; font-weight: 800; position: relative; z-index: 1; }
.hero p { color: #c9d6f0; margin-top: 6px; position: relative; z-index: 1; max-width: 560px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; position: relative; z-index: 1; }
.hero .btn-ghost { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .18); }
.hero .btn-ghost:hover { background: rgba(255, 255, 255, .18); }
.hero .btn-primary { background: #fff; color: var(--ink); box-shadow: none; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 20px; }
.stat {
  display: flex; align-items: center; gap: 14px; padding: 18px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--brand-100); color: var(--text); }
.stat-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex: 0 0 auto; }
.stat-ico .ico { width: 22px; height: 22px; }
.stat:nth-child(2) .stat-ico { background: #e7f7f4; color: #0d9483; }
.stat:nth-child(3) .stat-ico { background: #fff3e2; color: #c46a00; }
.stat:nth-child(4) .stat-ico { background: #f2ecff; color: #6c3fd6; }
.stat:nth-child(5) .stat-ico { background: #ffeaf0; color: #cf2b5a; }
.stat:nth-child(6) .stat-ico { background: #e8f4ff; color: #0b6fc7; }
.stat strong { display: block; font-size: 24px; font-weight: 800; line-height: 1.1; }
.stat span { color: var(--text-3); font-size: 13.5px; font-weight: 500; }

/* ---------- Abas (seções) ---------- */
.tab-panel { display: none; animation: fadeUp .25s ease; }
.tab-panel.is-active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.section-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.section-toolbar .search { flex: 1; min-width: 220px; }

/* ---------- Formulários ---------- */
.field { display: block; margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.label { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 7px; }
.label .opt { color: var(--text-3); font-weight: 500; }
.hint { display: block; font-size: 12.5px; color: var(--text-3); margin-top: 6px; }
.input, .select, .textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px;
  padding: 11px 13px; transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
.input:hover, .select:hover, .textarea:hover { border-color: #b9c2d3; }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(31, 94, 255, .14); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.select {
  padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237d889c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
}
.input-lg { font-size: 18px; font-weight: 600; padding: 13px 14px; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.input-group { position: relative; display: flex; }
.input-group .input { padding-right: 46px; }
.input-group .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.input-icon { position: relative; }
.input-icon .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 18px; height: 18px; pointer-events: none; }
.input-icon .input { padding-left: 40px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; }
.is-invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 4px rgba(220, 53, 69, .12) !important; }
.field-error { color: var(--danger); font-size: 12.5px; margin-top: 6px; display: block; font-weight: 500; }

.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { cursor: pointer; }
.seg span { display: inline-flex; padding: 8px 12px; border-radius: 99px; border: 1px solid var(--line-2); font-size: 13px; font-weight: 600; color: var(--text-2); background: var(--surface); transition: .15s; }
.seg label:hover span { border-color: var(--brand); color: var(--brand); }
.seg input:checked + span { background: var(--brand); color: #fff; border-color: var(--brand); }
.seg input:focus-visible + span { outline: 3px solid rgba(31, 94, 255, .35); outline-offset: 2px; }

/* Dropzone */
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  border: 2px dashed var(--line-2); border-radius: 14px; padding: 26px 18px; cursor: pointer;
  background: var(--surface-2); transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--brand); background: var(--brand-50); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.dz-ico { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }
.dz-ico .ico { width: 22px; height: 22px; }
.dz-title { font-size: 14px; color: var(--text-2); }
.dz-title strong { color: var(--brand); }
.dz-hint { font-size: 12.5px; color: var(--text-3); }
.dropzone.has-error { border-color: var(--danger); background: var(--danger-50); }
.dz-files { display: grid; gap: 8px; margin-top: 10px; }
.dz-files:empty { display: none; }
.dz-files.as-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.dz-file { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 13.5px; }
.dz-file .ico { color: var(--brand); }
.dz-file .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.dz-file .size { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.dz-file.is-error { border-color: #f3b4bb; background: var(--danger-50); }
.dz-file.is-error .size { color: var(--danger); font-weight: 600; }
.dz-thumb { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.dz-thumb img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.dz-thumb span { display: block; font-size: 11.5px; padding: 5px 7px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dz-thumb.is-error { border-color: var(--danger); }
.dz-thumb.is-error span { color: var(--danger); font-weight: 600; }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #fafbfe; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .t-title { font-weight: 600; color: var(--text); }
.table .t-date { white-space: nowrap; color: var(--text-2); font-variant-numeric: tabular-nums; }
.table .t-actions { width: 1%; white-space: nowrap; }
.table .t-thumb { width: 72px; }
.thumb { width: 64px; height: 46px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; background: var(--surface-2); border: 1px dashed var(--line-2); color: var(--text-3); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.has-img { border-style: solid; border-color: var(--line); }
.thumb .ico { width: 18px; height: 18px; }
a.thumb:hover { border-color: var(--brand); color: var(--brand); }
.date-badge { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 52px; height: 54px; border-radius: 12px; background: var(--brand-50); color: var(--brand-600); line-height: 1; }
.date-badge b { font-size: 19px; font-weight: 800; }
.date-badge small { font-size: 11px; font-weight: 700; text-transform: uppercase; margin-top: 3px; }
.empty { text-align: center; padding: 44px 20px; color: var(--text-3); }
.empty .ico { width: 40px; height: 40px; color: var(--line-2); margin-bottom: 8px; }
.empty strong { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 4px; }
.no-results { display: none; }
.no-results.is-visible { display: block; }

/* Chips de empresa */
.chip { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; letter-spacing: .02em; background: #eef1f6; color: #3c4a63; white-space: nowrap; }
.chip-dataprev { background: #e6f0ff; color: #1849cc; }
.chip-serpro { background: #e5f6ef; color: #0b7a52; }
.chip-emgerpi { background: #fff1df; color: #a75a00; }
.chip-prodater { background: #f1eaff; color: #5b34c2; }
.chip-cobra { background: #ffe9ee; color: #b4234b; }
.chip-etipi { background: #e2f6f8; color: #087489; }
.chip-particulares { background: #f3f0e6; color: #6d5a1e; }
.chip-geral { background: #eceff4; color: #3c4a63; }

/* Paginação */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager-info { font-size: 13px; color: var(--text-3); }
.pager-btns { display: flex; align-items: center; gap: 8px; }
.pager-page { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 0 6px; }

/* Conteúdos */
.content-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.content-item { margin: 0; }
.content-btn {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; font: inherit; cursor: pointer;
  padding: 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); transition: .15s;
}
.content-btn:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-1px); }
.content-btn .ci { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex: 0 0 auto; }
.content-btn .ct { flex: 1; min-width: 0; font-weight: 600; font-size: 14.5px; }
.content-btn .ct small { display: block; color: var(--text-3); font-weight: 500; font-size: 12.5px; margin-top: 2px; }
.content-btn .go { color: var(--text-3); }

/* Galerias */
.gal-list { display: grid; gap: 10px; }
.gal-item { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.gal-ico { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: #f2ecff; color: #6c3fd6; flex: 0 0 auto; }
.gal-info { flex: 1; min-width: 0; }
.gal-info strong { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gal-info span { display: block; color: var(--text-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Fotos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.photo { position: relative; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); aspect-ratio: 4 / 3; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.photo:hover img { transform: scale(1.04); }
.photo-actions { position: absolute; inset: auto 0 0 0; display: flex; justify-content: flex-end; gap: 6px; padding: 10px; background: linear-gradient(transparent, rgba(11, 26, 51, .7)); opacity: 0; transition: opacity .2s; }
.photo:hover .photo-actions, .photo:focus-within .photo-actions { opacity: 1; }
.photo-actions .act-btn { background: rgba(255, 255, 255, .95); border-color: transparent; }
.cover-preview { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); aspect-ratio: 4 / 3; display: grid; place-items: center; color: var(--text-3); text-align: center; }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-preview .ico { width: 40px; height: 40px; color: var(--line-2); }

/* Mensagens */
.msg-list { display: grid; gap: 14px; }
.msg { padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.msg-head { display: flex; align-items: flex-start; gap: 12px; }
.msg-head .avatar { width: 40px; height: 40px; font-size: 15px; flex: 0 0 auto; }
.msg-who { flex: 1; min-width: 0; }
.msg-who strong { display: block; font-size: 15px; }
.msg-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--text-3); margin-top: 2px; }
.msg-meta a { color: var(--text-2); display: inline-flex; align-items: center; gap: 5px; }
.msg-meta .ico { width: 14px; height: 14px; }
.msg-subject { font-weight: 700; margin: 14px 0 6px; font-size: 14.5px; }
.msg-body { color: var(--text-2); font-size: 14.5px; white-space: pre-line; word-wrap: break-word; overflow-wrap: anywhere; }

/* Info list */
.info { display: grid; grid-template-columns: 120px 1fr; gap: 10px 16px; font-size: 14.5px; }
.info dt { color: var(--text-3); font-weight: 500; }
.info dd { margin: 0; font-weight: 600; }

/* Alertas */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px; border-radius: 12px; font-size: 14px; border: 1px solid; }
.alert .ico { width: 20px; height: 20px; margin-top: 1px; }
.alert-danger { background: var(--danger-50); border-color: #f6c2c8; color: #8f1d2a; }
.alert-ok { background: var(--ok-50); border-color: #b5e6d1; color: #0b6b49; }
.alert-info { background: var(--brand-50); border-color: var(--brand-100); color: #1a3f9e; }
.alert-warn { background: var(--warn-50); border-color: #f4dba8; color: #7a4d00; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(11, 26, 51, .5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade .15s; }
.modal-card { position: relative; width: 100%; max-width: 420px; background: var(--surface); border-radius: 18px; padding: 26px; box-shadow: var(--shadow-lg); text-align: center; animation: pop .2s cubic-bezier(.2, .9, .3, 1.2); }
.modal-icon { width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--danger-50); color: var(--danger); }
.modal-icon .ico { width: 26px; height: 26px; }
.modal-card.is-neutral .modal-icon { background: var(--brand-50); color: var(--brand); }
.modal-card h2 { font-size: 19px; font-weight: 800; }
.modal-card p { color: var(--text-2); margin-top: 8px; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }

/* Upload overlay */
.upload-overlay { position: fixed; inset: 0; z-index: 210; display: grid; place-items: center; padding: 20px; background: rgba(11, 26, 51, .55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.upload-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 18px; padding: 28px; text-align: center; box-shadow: var(--shadow-lg); }
.upload-ico { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); animation: bob 1.4s ease-in-out infinite; }
.upload-ico .ico { width: 26px; height: 26px; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.upload-card h2 { font-size: 18px; font-weight: 800; }
.upload-card p { color: var(--text-3); font-size: 13.5px; margin-top: 4px; word-break: break-all; }
.progress { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 18px; }
.progress span { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--accent)); transition: width .2s; }
.upload-pct { font-weight: 700; color: var(--text) !important; font-size: 14px !important; margin-top: 10px !important; font-variant-numeric: tabular-nums; }

/* Toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: grid; gap: 10px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-radius: 12px; background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; animation: toastIn .3s cubic-bezier(.2, .9, .3, 1.2); max-width: 360px; }
.toast .ico { width: 20px; height: 20px; color: #5ee3c1; }
.toast.is-error .ico { color: #ff9aa6; }
.toast.is-out { opacity: 0; transform: translateY(8px); transition: .25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

/* ---------- Login ---------- */
.login-body { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.login-aside {
  position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: var(--ink);
  background-image: radial-gradient(80% 60% at 10% 0%, rgba(31, 94, 255, .55), transparent 60%), radial-gradient(60% 50% at 100% 100%, rgba(16, 181, 163, .4), transparent 60%);
}
.login-aside::before {
  content: ""; position: absolute; inset: 0; opacity: .14;
  background-image: linear-gradient(rgba(255, 255, 255, .5) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .5) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(70% 70% at 30% 40%, #000, transparent); mask-image: radial-gradient(70% 70% at 30% 40%, #000, transparent);
}
.login-aside > * { position: relative; }
.login-aside .brand-logo { display: inline-flex; padding: 12px 16px; border-radius: 14px; }
.login-aside .brand-logo img { height: 56px; }
.login-aside h2 { font-size: 38px; font-weight: 800; line-height: 1.15; letter-spacing: -.02em; max-width: 460px; }
.login-aside h2 em { font-style: normal; color: #7fe7d6; }
.login-aside p { color: #b9c8e6; margin-top: 14px; max-width: 420px; font-size: 15.5px; }
.login-feats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.login-feats span { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 99px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); font-size: 13px; color: #dfe7f7; }
.login-feats .ico { width: 16px; height: 16px; color: #7fe7d6; }
.login-copy { color: #7f93b8; font-size: 12.5px; }
.login-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-box { width: 100%; max-width: 380px; }
.login-box .mobile-logo { display: none; margin-bottom: 26px; }
.login-box .mobile-logo img { height: 52px; }
.login-box h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.login-box .lead { color: var(--text-3); margin: 6px 0 26px; }
.login-box .alert { margin-bottom: 18px; }
.login-box .btn-primary { padding: 14px 18px; font-size: 15px; margin-top: 6px; }
.caps { display: none; color: var(--warn); font-size: 12.5px; margin-top: 6px; font-weight: 600; }
.caps.is-on { display: block; }

/* Resultado de upload */
.result-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.result-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 34px 28px; text-align: center; box-shadow: var(--shadow); }
.result-ico { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; }
.result-ico .ico { width: 30px; height: 30px; }
.is-ok .result-ico { background: var(--ok-50); color: var(--ok); }
.is-error .result-ico { background: var(--danger-50); color: var(--danger); }
.result-card h1 { font-size: 21px; font-weight: 800; }
.result-card p { color: var(--text-2); margin-top: 8px; }
.result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }

/* Editor Jodit */
.jodit-container:not(.jodit_inline) { border-radius: 12px !important; border-color: var(--line-2) !important; overflow: hidden; }
.jodit-toolbar__box:not(:empty) { background: var(--surface-2) !important; border-bottom-color: var(--line) !important; }
.jodit-workplace { font-family: var(--font); }
.jodit-status-bar { background: var(--surface-2) !important; }

/* ---------- Responsivo ---------- */
@media (max-width: 1180px) {
  .grid-editor { grid-template-columns: minmax(0, 1fr); }
  .sticky { position: static; }
}
@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .sidebar .sidebar-close { display: inline-grid; }
  .backdrop { display: block; position: fixed; inset: 0; background: rgba(11, 26, 51, .45); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .25s; }
  body.nav-open .backdrop { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  .main { margin-left: 0; }
  .topbar .menu-btn { display: inline-grid; margin-left: -6px; }
  .topbar { padding: 12px 18px; min-height: 64px; }
  .content { padding: 6px 18px 24px; }
  .foot { padding: 16px 18px 24px; }
  .login-body { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .login-box .mobile-logo { display: block; }
}
@media (max-width: 720px) {
  body.adm { font-size: 14.5px; }
  .topbar-title h1 { font-size: 18px; }
  .page-sub { display: none; }
  .user-name, .chev { display: none; }
  .user-chip { padding: 3px; }
  .card-head, .card-body { padding: 16px; }
  .card-foot, .pager { padding: 12px 16px; }
  .row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .row > .field { margin-bottom: 16px; }
  .hero { padding: 22px 20px; border-radius: 16px; }
  .hero h2 { font-size: 21px; }
  .hero-actions .btn { flex: 1 1 calc(50% - 10px); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .stat-ico { width: 40px; height: 40px; }
  .stat strong { font-size: 21px; }
  .form-actions .btn { flex: 1; }
  .info { grid-template-columns: 1fr; gap: 2px; }
  .info dd { margin-bottom: 10px; }
  .pager-info { width: 100%; text-align: center; }
  .pager-btns { width: 100%; justify-content: space-between; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .photo-actions { opacity: 1; }
  .toasts { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; }

  /* Tabelas viram cartões */
  .table-wrap { overflow: visible; }
  .table.stack-sm thead { display: none; }
  .table.stack-sm, .table.stack-sm tbody, .table.stack-sm tr, .table.stack-sm td { display: block; width: 100%; }
  .table.stack-sm tr { position: relative; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table.stack-sm tbody tr:last-child { border-bottom: 0; }
  .table.stack-sm td { padding: 3px 0; border: 0; }
  .table.stack-sm td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 1px; }
  .table.stack-sm td.t-title { font-size: 15px; padding-right: 0; }
  .table.stack-sm td.t-title::before { display: none; }
  .table.stack-sm .t-inline { display: inline-block; width: auto; margin-right: 14px; }
  .table.stack-sm .t-thumb { float: left; width: auto; margin: 0 12px 6px 0; }
  .table.stack-sm .t-actions { width: 100%; margin-top: 10px; clear: both; }
  .table.stack-sm .actions { justify-content: flex-start; }
  .table.stack-sm .actions .act-btn { width: auto; height: 36px; padding: 0 12px; display: inline-flex; gap: 6px; font-size: 13px; font-weight: 600; }
  .table.stack-sm .actions .act-btn .lbl { display: inline; }
}
.act-btn .lbl { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.head-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn-danger-soft { background: var(--danger-50); color: var(--danger-600); border-color: #f6c2c8; }
.btn-danger-soft:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
@media (max-width: 720px) {
  .head-tools { width: 100%; }
  .head-tools .search { flex: 1 1 100%; min-width: 0 !important; }
  .head-tools .btn-danger-soft { width: 100%; }
  .hide-xs { display: none; }
}
.msg { min-width: 0; }
.msg-meta a { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
@media (max-width: 720px) { .msg { padding: 16px; } .msg-head .avatar { width: 36px; height: 36px; } }
