@import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,400,0..1,0&display=block");

:root {
  --sidebar: #0f172a; --sidebar-hover: #1e293b; --sidebar-active: #272c5c;
  --sidebar-text: #cbd5e1; --sidebar-muted: #64748b;
  --accent: #4f46e5; --accent-hover: #4338ca; --accent-soft: #eef2ff;
  --bg: #f1f5f9; --card: #fff; --border: #e2e8f0; --border-strong: #cbd5e1;
  --text: #0f172a; --text2: #475569; --muted: #64748b;
  --danger: #dc2626; --success: #16a34a;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--bg); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* Ícones: Material Symbols (ligaduras: "search", "person"...) */
.ico, .brand-icon, .icon-btn {
  font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal; line-height: 1;
  letter-spacing: normal; text-transform: none; white-space: nowrap; direction: ltr;
  font-feature-settings: 'liga'; -webkit-font-feature-settings: 'liga';
}
.ico { font-size: 20px; }

/* ================= layout ================= */
.layout { display: grid; grid-template-columns: 250px 1fr; height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; min-height: 0; }
.content { display: grid; grid-template-rows: auto auto auto 1fr; padding: 26px 34px; gap: 0; min-width: 0; min-height: 0; }

/* ================= marca ================= */
.brand { display: flex; align-items: center; gap: 12px; padding: 26px 24px 22px; }
.brand-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-size: 24px;
  background: linear-gradient(135deg, #6366f1, #4f46e5); box-shadow: 0 8px 20px -8px rgba(99,102,241,.8); }
.brand-name { color: #fff; font-weight: 700; font-size: 19px; line-height: 1.1; }
.brand-sub { color: var(--sidebar-muted); font-size: 12px; margin-top: 3px; }

/* ================= menu ================= */
nav { display: flex; flex-direction: column; padding: 0 12px; gap: 2px; }
.nav-title { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--sidebar-muted); padding: 14px 16px 8px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 14px; width: 100%; padding: 11px 16px; border: 0; border-radius: 9px;
  background: transparent; color: var(--sidebar-text); font-size: 14.5px; text-align: left; cursor: pointer; transition: background .12s; }
.nav-item:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: #818cf8; }
.nav-item.active .ico { color: #a5b4fc; }
.nav-item .badge { margin-left: auto; font-style: normal; font-size: 10.5px; font-weight: 600; color: #c7d2fe; background: #374151;
  border-radius: 9px; padding: 1px 8px; display: none; }
.nav-item .badge.on { display: inline-block; }

.sidebar-foot { margin-top: auto; padding: 8px 16px 18px; }
.ghost-link { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 9px; border-radius: 9px; color: var(--sidebar-text);
  text-decoration: none; font-size: 13px; }
.ghost-link:hover { background: var(--sidebar-hover); }
.ghost-link .ico { font-size: 17px; }
.user { display: flex; align-items: center; gap: 10px; border-top: 1px solid #1e293b; margin-top: 14px; padding: 16px 8px 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700;
  background: linear-gradient(135deg, #818cf8, #4f46e5); flex: none; }
.user-txt { min-width: 0; flex: 1; }
.user-name { color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-status { color: #4ade80; font-size: 11.5px; margin-top: 2px; }
.user-status.demo { color: #fbbf24; }
.icon-btn { width: 36px; height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--sidebar-muted); font-size: 20px; cursor: pointer; }
.icon-btn:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-foot form { margin: 0; }

/* ================= cabeçalho ================= */
.page-head h1 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
.page-head p { margin: 6px 0 18px; }

/* ================= cards / campos ================= */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; }
.search { padding: 16px 22px 14px; margin-bottom: 8px; }
.search-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 0; }
.field { display: flex; flex-direction: column; }
.w-180 { width: 180px; } .w-220 { width: 220px; } .w-230 { width: 230px; } .w-300 { width: 300px; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.input { display: flex; align-items: center; height: 42px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 9px; background: #fff;
  transition: border-color .12s, box-shadow .12s; }
.input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
.input.error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,.12); }
.input.disabled { background: var(--bg); }
.input input, .input select { border: 0; outline: 0; background: transparent; width: 100%; font-size: 15px; }
.input input::placeholder { color: #94a3b8; }
.check { display: flex; align-items: flex-start; gap: 8px; color: var(--text2); font-size: 13px; cursor: pointer; user-select: none; }
.check-inline { font-size: 12px; line-height: 1.35; padding-bottom: 4px; }
.check-inline small { color: var(--muted); }
.check input { margin-top: 2px; accent-color: var(--accent); }
.erro { color: var(--danger); font-size: 13px; margin: 0 0 12px; min-height: 1em; }

/* ================= botões ================= */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 20px; border-radius: 10px;
  border: 1px solid transparent; font-weight: 600; font-size: 14px; cursor: pointer; transition: background .12s, border-color .12s; white-space: nowrap; }
.btn .ico { font-size: 19px; }
.btn-primary { background: var(--accent); color: #fff; min-width: 150px; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary.cancel { background: #fff; color: var(--text); border-color: var(--border-strong); }
.btn-outline { background: #fff; color: var(--text); border-color: var(--border); height: 36px; padding: 0 14px; font-size: 13px; }
.btn-outline:hover:not(:disabled) { background: var(--bg); border-color: var(--border-strong); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-block { width: 100%; height: 46px; }

/* ================= ações ================= */
.actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0 12px; flex-wrap: wrap; }
.actions-info { font-weight: 600; color: var(--text2); display: flex; gap: 14px; align-items: center; min-width: 0; }
.actions-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.toast { color: var(--success); font-size: 13px; opacity: 0; transition: opacity .2s; }
.toast.on { opacity: 1; }

/* ================= resultado ================= */
.result { position: relative; min-height: 300px; overflow: hidden; padding: 6px; }
.result iframe { width: 100%; height: 100%; border: 0; border-radius: 12px; display: block; background: #fff; }
.placeholder { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 20px; }
.placeholder h2 { color: var(--text); font-weight: 600; font-size: 18px; margin: 16px 0 6px; }
.placeholder p { margin: 4px 0; max-width: 440px; }
.ph-icon { width: 72px; height: 72px; border-radius: 20px; margin: 0 auto; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 34px; }
.spinner { width: 46px; height: 46px; margin: 0 auto; border-radius: 50%; border: 4px solid #e0e7ff; border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.placeholder.erro-rede .ph-icon { background: #fee2e2; color: var(--danger); }

/* ================= histórico ================= */
.historico { position: absolute; inset: 6px; overflow: auto; }
.historico table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.historico th { position: sticky; top: 0; background: #f8fafc; text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: .05em; padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.historico td { padding: 11px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.historico tbody tr { cursor: pointer; }
.historico tbody tr:hover { background: var(--accent-soft); }
.historico .doc { font-weight: 600; white-space: nowrap; }
.historico .resumo { color: var(--text2); max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: #f1f5f9; color: #475569; white-space: nowrap; }
.tag.ok { background: #dcfce7; color: #15803d; } .tag.warn { background: #fef3c7; color: #b45309; } .tag.bad { background: #fee2e2; color: #b91c1c; }
.historico .vazio { padding: 60px 20px; text-align: center; color: var(--muted); }

/* ================= login ================= */
.login-body { background: radial-gradient(1200px 500px at 50% -10%, #312e81 0%, var(--sidebar) 55%); min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-wrap { width: 100%; max-width: 420px; }
.brand-login { padding: 0 6px 26px; }
.login-card { background: #fff; border-radius: 18px; padding: 30px 30px 18px; box-shadow: 0 30px 60px -30px rgba(0,0,0,.6); }
.login-card h1 { margin: 0; font-size: 24px; font-weight: 600; }
.login-card .muted { margin: 6px 0 24px; }
.login-card .input { margin-bottom: 16px; }
.login-card .check { margin: 2px 0 20px; }
.login-card .erro { margin: 14px 0 0; text-align: center; }
.login-foot { display: block; text-align: center; color: #a5b4fc; font-size: 12.5px; margin-top: 20px; text-decoration: none; }
.login-foot:hover { text-decoration: underline; }

/* ================= telas menores ================= */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; min-height: 100vh; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .brand { padding: 14px 16px; }
  .brand-sub { display: none; }
  nav { flex-direction: row; flex-wrap: wrap; padding: 0 8px 10px; width: 100%; }
  .nav-title { display: none; }
  .nav-item { width: auto; padding: 8px 12px; font-size: 13px; gap: 8px; }
  .nav-item.active::before { display: none; }
  .sidebar-foot { display: none; }
  .content { padding: 18px 16px; grid-template-rows: auto auto auto minmax(70vh, 1fr); }
  .field, .w-180, .w-220, .w-230, .w-300 { width: 100%; }
  .btn-primary { width: 100%; }
}
