/* Portal do Cliente — estilos próprios (sem CDN, compatível com CSP 'self') */

:root {
  --bg: #f4f6f9;
  --panel: #0f172a;
  --panel-2: #1e293b;
  --line: #24334d;
  --text: #0f172a;
  --muted: #64748b;
  --sidebar-text: #cbd5e1;
  --sidebar-muted: #7c8aa5;
  --accent: #10b981;
  --accent-soft: rgba(16, 185, 129, 0.14);
  --danger: #dc2626;
  --card: #ffffff;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ------------------------------ Login ------------------------------ */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 55%, #0f172a 100%);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.45);
  display: flex;
  flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 1.15rem; margin: 0; letter-spacing: 0.2px; }
.brand.small { font-weight: 600; font-size: 0.9rem; color: #e2e8f0; }
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  flex: none;
}
.login-sub { color: var(--muted); margin: 8px 0 20px; font-size: 0.9rem; }
.login-card label {
  font-size: 0.78rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px;
}
.login-card input {
  border: 1px solid #d7dee8; border-radius: 10px;
  padding: 10px 12px; margin-bottom: 16px; font: inherit;
}
.login-card input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.login-card button[type="submit"] {
  background: var(--accent); color: #fff; border: 0;
  border-radius: 10px; padding: 11px; font-weight: 600;
}
.login-card button[type="submit"]:hover { filter: brightness(0.94); }
.login-card button[disabled] { opacity: 0.6; cursor: wait; }
.login-hint { color: var(--muted); font-size: 0.78rem; margin: 14px 0 0; text-align: center; }
.login-hint code { background: #eef2f7; padding: 1px 5px; border-radius: 5px; }
.form-error { color: var(--danger); font-size: 0.85rem; margin: 0 0 12px; }

/* ------------------------------ Shell ------------------------------ */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 280px; flex: none;
  background: var(--panel);
  display: flex; flex-direction: column;
  color: var(--sidebar-text);
}
.sidebar-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.sidebar-user { margin: 10px 0 2px; font-size: 0.85rem; color: var(--sidebar-text); }
.sidebar-cnpj { margin: 0; font-size: 0.75rem; color: var(--sidebar-muted); }

.menu { flex: 1; overflow-y: auto; padding: 14px 10px; }
.menu-section { margin-bottom: 6px; }
.menu-section > button {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  background: none; border: 0; color: var(--sidebar-text);
  padding: 9px 12px; border-radius: 9px;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
}
.menu-section > button:hover { background: var(--panel-2); }
.menu-section > button:focus-visible { outline: 2px solid var(--accent); }
.chev { transition: transform 0.15s ease; font-size: 0.7rem; }
.menu-section.open .chev { transform: rotate(180deg); }

.menu-items { list-style: none; margin: 4px 0 8px; padding: 0 0 0 14px; }
.menu-section:not(.open) .menu-items { display: none; }
.menu-items button {
  width: 100%; text-align: left; background: none; border: 0;
  color: var(--sidebar-muted); padding: 7px 12px; border-radius: 8px; font-size: 0.88rem;
}
.menu-items button:hover { background: var(--panel-2); color: var(--sidebar-text); }
.menu-items button:focus-visible { outline: 2px solid var(--accent); }
.menu-items button.active { background: var(--accent-soft); color: #6ee7b7; }

.logout {
  border: 0; border-top: 1px solid var(--line);
  background: none; color: var(--sidebar-muted);
  padding: 16px 20px; text-align: left; font-size: 0.88rem;
}
.logout:hover { color: #fca5a5; }

/* ----------------------------- Conteúdo ---------------------------- */
.content { flex: 1; padding: 34px 40px; overflow-y: auto; }
.content-head h1 { margin: 0; font-size: 1.25rem; }
.content-sub { color: var(--muted); font-size: 0.85rem; margin: 6px 0 24px; }

.doc-list {
  list-style: none; margin: 0; padding: 0;
  background: var(--card); border: 1px solid #e4e9f0; border-radius: var(--radius);
  overflow: hidden;
}
.doc-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px 18px; border-bottom: 1px solid #eef1f6;
}
.doc-list li:last-child { border-bottom: 0; }
.doc-name { font-weight: 600; font-size: 0.92rem; margin: 0; overflow-wrap: anywhere; }
.doc-meta { color: var(--muted); font-size: 0.78rem; margin: 3px 0 0; }
.doc-list .dl {
  background: var(--accent); color: #fff; border: 0;
  border-radius: 8px; padding: 7px 14px; font-size: 0.8rem; font-weight: 600; flex: none;
}
.doc-list .dl:hover { filter: brightness(0.94); }
.doc-list .dl:focus-visible { outline: 2px solid #065f46; }

.empty, .loading { color: var(--muted); font-size: 0.9rem; }
.error-msg { color: var(--danger); font-size: 0.9rem; }

/* ---------------------------- Responsivo ---------------------------- */
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; }
  .menu { max-height: 45vh; }
  .content { padding: 22px 18px; }
}

/* ------------------------- Painel Admin ---------------------------- */
.admin-nav {
  display: block; text-decoration: none;
  border-top: 1px solid var(--line);
  color: var(--sidebar-text); padding: 14px 20px; font-size: 0.88rem;
}
.admin-nav:hover { background: var(--panel-2); color: #6ee7b7; }
.admin-link { color: var(--accent); text-decoration: none; font-size: 0.9rem; }
.admin-link:hover { text-decoration: underline; }

.admin-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px; margin-bottom: 32px;
}
.admin-card {
  background: var(--card); border: 1px solid #e4e9f0;
  border-radius: var(--radius); padding: 22px 24px;
}
.admin-card h2 { margin: 0 0 16px; font-size: 1.02rem; }
.admin-card form { display: flex; flex-direction: column; }
.admin-card label {
  font-size: 0.76rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em; margin: 10px 0 5px;
}
.admin-card input, .admin-card select {
  border: 1px solid #d7dee8; border-radius: 9px;
  padding: 9px 11px; font: inherit; background: #fff;
}
.admin-card input:focus, .admin-card select:focus {
  outline: 2px solid var(--accent); border-color: transparent;
}
.admin-card button {
  margin-top: 18px; background: var(--accent); color: #fff; border: 0;
  border-radius: 9px; padding: 10px; font-weight: 600;
}
.admin-card button:hover { filter: brightness(0.94); }
.admin-card button[disabled] { opacity: 0.6; cursor: wait; }

.form-msg { font-size: 0.83rem; margin: 12px 0 0; }
.form-msg.ok { color: #047857; }
.form-msg.err { color: var(--danger); }

.admin-list-wrap h2 { font-size: 1.02rem; margin: 0 0 14px; }

/* ------------------------ Upload em lote --------------------------- */
.dropzone {
  border: 2px dashed #cbd5e1; border-radius: var(--radius);
  padding: 32px; text-align: center; cursor: pointer;
  background: #fff; transition: all 0.15s ease; margin-bottom: 12px;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--accent); background: var(--accent-soft);
}
.dz-text { margin: 0; color: var(--muted); font-size: 0.9rem; }
#btn-enviar {
  background: var(--accent); color: #fff; border: 0; border-radius: 9px;
  padding: 10px 18px; font-weight: 600; margin-bottom: 16px;
}
#btn-enviar:hover:not([disabled]) { filter: brightness(0.94); }
#btn-enviar[disabled] { opacity: 0.5; cursor: not-allowed; }
.ok-text { color: #047857 !important; }
.err-text { color: var(--danger) !important; }
