/* Painel do Admin Master — mesma identidade do painel web atual (admin_uber_theme.css). */
:root {
  --black: #000000;
  --ink: #111111;
  --text: #000000;
  --text-2: #545454;
  --muted: #757575;
  --bg: #F6F6F6;
  --card: #FFFFFF;
  --hover: #F3F3F3;
  --border: #E2E2E2;
  --border-light: #EEEEEE;
  --ok: #05944F;      --ok-bg: #E3F5E8;
  --bad: #E11900;     --bad-bg: #FCE8E6;
  --warn: #8A5A00;    --warn-bg: #FFF8E1;   --warn-dot: #FFC043;
  --info: #276EF1;    --info-bg: #E8F0FE;
  --gold: #C9A03D;
  --radius: 24px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --sidebar: 260px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f1eee8;
  --text: #f1eee8;
  --text-2: #c2beb6;
  --muted: #a39f97;
  --bg: #111214;
  --card: #1b1d20;
  --hover: #25282c;
  --border: #393c41;
  --border-light: #2c2f33;
  --ok: #70dba1; --ok-bg: #183c2b;
  --bad: #ff9e97; --bad-bg: #442525;
  --warn: #edc575; --warn-bg: #3b321e;
  --info: #91bcff; --info-bg: #20324d;
  --shadow: 0 1px 2px #0003;
  --shadow-lg: 0 10px 24px #0005;
}
:root[data-theme="dark"] .nav a.active,
:root[data-theme="dark"] .pagination .current { background: #d5af65; color: #211a0d; border-color: #d5af65; }
:root[data-theme="dark"] .btn:not(.ghost):not(.ok):not(.bad) { background: #d5af65; color: #211a0d; }
:root[data-theme="dark"] .btn.ok { color: #10281a; }
:root[data-theme="dark"] .btn.bad,
:root[data-theme="dark"] .nav .badge { color: #351614; }
.theme-picker { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .8rem; }
.theme-picker select { min-height: 44px; cursor: pointer; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 400 15px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ---------- Estrutura ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 16px;
}
.brand { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 4px 8px 22px; text-decoration: none; }
.brand-logo { display: block; width: 200px; max-width: 100%; height: auto; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px; background: var(--black); color: var(--gold);
  display: grid; place-items: center; font-size: 1.2rem;
}
.brand b { display: block; font-size: 0.95rem; letter-spacing: 0.04em; }
.brand small { display: inline-block; margin-top: 2px; padding: 1px 8px; border-radius: 999px; background: var(--black); color: #fff; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em; }
.nav-label { margin: 18px 12px 6px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text-2); font-weight: 500;
}
.nav a i { width: 18px; text-align: center; }
.nav a:hover { background: var(--hover); color: var(--text); }
.nav a.active { background: var(--black); color: #fff; }
.nav .badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 0.72rem; font-weight: 700; text-align: center; }
.sidebar-foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid var(--border-light); display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--hover); display: grid; place-items: center; font-weight: 700; font-size: 0.8rem; flex: none; }
.sidebar-foot b { display: block; font-size: 0.88rem; }
.sidebar-foot form { margin-left: auto; }

.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 5; min-height: 72px; padding: 12px 32px; flex-wrap: wrap;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.topbar h1 { margin: 0; font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em; }
.content { padding: 28px 32px 48px; display: grid; gap: 24px; }
.btn.menu-toggle { display: none; }

/* ---------- Componentes ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border-light); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px 0; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.card-body { padding: 20px 24px 24px; }
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.stats { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { padding: 20px 22px; display: grid; gap: 6px; text-decoration: none; }
.stat .icon { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--hover); font-size: 1.05rem; }
.stat .value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .label { color: var(--text-2); font-size: 0.9rem; }
a.stat:hover { box-shadow: var(--shadow-lg); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 600; white-space: nowrap;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: var(--ok-bg); }
.pill.bad { color: var(--bad); background: var(--bad-bg); }
.pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.warn::before { background: var(--warn-dot); }
.pill.info { color: var(--info); background: var(--info-bg); }
.pill.muted { color: var(--text-2); background: var(--hover); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { text-align: left; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 14px 16px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
tbody tr:hover { background: var(--hover); }
tbody tr:last-child td { border-bottom: 0; }
td .sub { display: block; color: var(--muted); font-size: 0.8rem; }
td.r, th.r { text-align: right; }
.empty { padding: 36px 24px; text-align: center; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px; border: 1px solid transparent; cursor: pointer;
  font: 600 0.86rem var(--font); text-decoration: none; background: var(--black); color: #fff; white-space: nowrap;
}
.btn:hover { filter: brightness(1.25); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; filter: grayscale(1); transform: none; }
.btn.ghost { background: var(--card); color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--hover); filter: none; }
.btn.ok { background: var(--ok); }
.btn.bad { background: var(--bad); }
.btn.sm { padding: 6px 12px; font-size: 0.8rem; }
.btn:focus-visible, .nav a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link { font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.field { display: grid; gap: 6px; }
.field label { font-size: 0.78rem; font-weight: 600; color: var(--text-2); }
input, select, textarea {
  font: 400 0.9rem var(--font); color: var(--text); background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px; min-width: 0;
}
textarea { width: 100%; min-height: 90px; resize: vertical; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 14px 18px; border-radius: var(--radius-sm); font-weight: 500; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.bad { background: var(--bad-bg); color: var(--bad); }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 20px; margin: 0; }
.kv dt { color: var(--muted); font-size: 0.85rem; }
.kv dd { margin: 0; font-weight: 500; }

.checks { display: flex; gap: 6px; flex-wrap: wrap; }
.doc-link { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); font-size: 0.82rem; font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.doc-link:hover { background: var(--hover); }
.doc-link:focus-visible { outline: 2px solid var(--info); outline-offset: 3px; }
.doc-link-hint { color: var(--muted); font-size: .72rem; font-weight: 400; }
.company-details-card { grid-column: span 2; }
@media (max-width: 900px) {
  .company-details-card { grid-column: auto; }
}
@media (max-width: 640px) {
  .document-review-table, .document-review-table tbody { display: block; }
  .document-review-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .document-review-table tr { display: block; padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .document-review-table tr:last-child { border-bottom: 0; }
  .document-review-table td { display: block; padding: 10px 0; border: 0; text-align: left; overflow-wrap: anywhere; }
  .document-review-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 6px; color: var(--muted); font-size: .75rem; font-weight: 600; }
  .document-review-table .btn { min-height: 44px; white-space: normal; }
  .document-review-table td.r .actions { justify-content: flex-start !important; }
  .company-details-card .kv { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .company-details-card .kv dd { margin-bottom: 12px; overflow-wrap: anywhere; }
}

dialog { color: var(--text); background: var(--card); border: 0; border-radius: var(--radius); padding: 0; width: min(460px, calc(100% - 32px)); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog form { padding: 24px; display: grid; gap: 14px; }
dialog h3 { margin: 0; font-size: 1.1rem; }
dialog .actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
dialog .btn.danger { background: #a83232; color: #fff; border-color: #a83232; }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; padding: 16px 24px 20px; align-items: center; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); text-decoration: none; font-size: 0.85rem; background: var(--card); }
.pagination .current { background: var(--black); color: #fff; border-color: var(--black); }
.pagination .disabled { color: var(--muted); }

/* ---------- Login ---------- */
.login-page {
  --login-gold: #ddb45e;
  position: relative; isolation: isolate;
  min-height: 100vh; min-height: 100dvh; display: grid; align-items: center; justify-items: start;
  padding: 48px clamp(24px, 6vw, 112px); color: #f5eee0; font-family: 'DM Sans', sans-serif;
  background: #101112 url('../images/login-background.jpg') center center / cover no-repeat;
}
.login-ambience { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.login-ambience::before, .login-ambience::after {
  content: ''; position: absolute; width: 65vw; height: 65vw; border-radius: 50%;
  background: radial-gradient(circle, #bb822512, transparent 65%);
  animation: login-glow 18s ease-in-out infinite alternate;
}
.login-ambience::before { top: -35%; left: -25%; }
.login-ambience::after { bottom: -40%; right: -20%; animation-delay: -9s; }
.login-card {
  width: min(400px, 100%); min-width: 0; padding: 36px; display: grid; gap: 24px;
  background: #171819eb;
  border: 1px solid #ffffff0e; border-radius: 12px;
  animation: login-enter .8s ease-out both;
}
.login-card .brand { padding: 0 0 12px; }
.login-card .brand-logo { width: 175px; }
.login-heading { text-align: center; }
.login-card h1 { margin: 0; font-size: 1.35rem; font-weight: 500; letter-spacing: -.03em; line-height: 1.3; }
.login-heading p { margin: 8px 0 0; color: #a5a5a5; font-size: .82rem; }
.login-card .field { gap: 8px; }
.login-card .field label { color: #e0d8c9; font-size: .8rem; font-weight: 500; }
.login-card .field input {
  min-height: 48px; font: inherit; font-size: 16px; scroll-margin-block: 24px;
  width: 100%; min-width: 0; padding: 12px 14px; color: #f5eee0; background: #131415;
  border: 1px solid #ffffff20; border-radius: 6px; color-scheme: dark;
  transition: border-color .2s, box-shadow .2s;
}
.login-card .field input:focus { outline: none; border-color: var(--login-gold); box-shadow: 0 0 0 3px #ddb45e1c; }
.login-remember { display: flex; align-items: center; gap: 9px; color: #b8b3a9; font-size: .8rem; cursor: pointer; }
.login-remember input { width: 16px; height: 16px; margin: 0; accent-color: var(--login-gold); }
.login-card .btn {
  min-height: 48px;
  width: 100%; justify-content: center; padding: 13px 18px; border: 0;
  border-radius: 6px; background: #d5af65; color: #211a0d;
  font-weight: 600; transition: background .2s;
}
.login-card .btn:hover { background: #e0bc79; filter: none; }
.login-card :focus-visible { outline: 2px solid var(--login-gold); outline-offset: 4px; }
.login-footnote { margin: 0; text-align: center; color: #aaa295; font-size: .7rem; }
@keyframes login-enter { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes login-glow { to { transform: translate(20%, 15%) scale(1.2); opacity: .5; } }
@media (max-width: 760px) {
  .login-page {
    justify-items: center;
    background-image: linear-gradient(#10111240, #10111280), url('../images/login-background.jpg');
    background-position: 72% center;
  }
}
@media (max-width: 480px) {
  .login-page {
    padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  .login-card { padding: 28px clamp(16px, 5vw, 24px); gap: 20px; }
  .login-card .brand-logo { width: 160px; }
  .login-remember { min-height: 44px; font-size: .85rem; }
  .login-remember input { width: 20px; height: 20px; flex-shrink: 0; }
  .login-card .alert { overflow-wrap: anywhere; min-width: 0; }
}
@media (max-height: 600px) {
  .login-page {
    align-items: start;
    padding-block: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-bottom));
  }
  .login-card { gap: 16px; padding-block: 24px; }
  .login-card .brand { padding-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .login-page *, .login-page *::before, .login-page *::after { animation: none !important; transition: none !important; }
}

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 20; transform: translateX(-100%); transition: transform 0.2s; box-shadow: var(--shadow-lg); }
  body.menu-open .sidebar { transform: none; }
  .btn.menu-toggle { display: inline-flex; }
  .topbar, .content { padding-inline: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } .btn:active { transform: none; } }

/* Análise de documentos lado a lado */
.review-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.review-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
.review-viewer { position: sticky; top: 16px; }
.viewer-frame { background: var(--hover); border-radius: var(--radius-sm); margin: 0 20px 20px; min-height: 70vh; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.viewer-frame iframe { width: 100%; height: 78vh; border: 0; background: #fff; }
.viewer-frame img { max-width: 100%; max-height: 78vh; object-fit: contain; }
.review-side { display: flex; flex-direction: column; gap: 20px; }
.review-side .card { margin: 0; }
.decision { display: flex; flex-direction: column; gap: 10px; }
.decision textarea { min-height: 90px; }
.quick-reasons { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-reasons .btn { white-space: normal; text-align: left; height: auto; line-height: 1.3; padding-block: 6px; }
.timeline { list-style: none; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.timeline li { border-left: 2px solid var(--border); padding-left: 12px; }
.timeline-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 4px; }
.timeline-note { margin-top: 6px; background: var(--hover); border-radius: 10px; padding: 8px 10px; }
@media (max-width: 980px) {
  .review-layout { grid-template-columns: 1fr; }
  .review-viewer { position: static; }
  .viewer-frame, .viewer-frame iframe { min-height: 55vh; height: 55vh; }
}
