:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --text: #17202a;
  --muted: #667085;
  --line: #e4e7ec;
  --primary: #0f8a5f;
  --primary-dark: #096847;
  --dark: #101828;
  --warn: #b42318;
  --blue: #155eef;
  --yellow: #b7791f;
  --radius: 16px;
  --shadow: 0 14px 40px rgba(16, 24, 40, .10);
}

body.dark-theme {
  --bg: #0f172a;
  --surface: #111c2f;
  --surface-2: #0b1220;
  --surface-3: #1f2a3d;
  --text: #f8fafc;
  --muted: #a8b3c7;
  --line: #273449;
  --dark: #020617;
  --shadow: 0 14px 40px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, Segoe UI, Arial, sans-serif; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
input, select, textarea { color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
textarea { resize: vertical; min-height: 76px; }

.app-shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar { background: #0b1220; color: #fff; padding: 20px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 28px; }
.brand-icon { width: 44px; height: 44px; display: grid; place-items: center; background: rgba(255,255,255,.12); border-radius: 14px; }
.brand strong { display: block; font-size: 16px; }
.brand span { display: block; color: #b6c2d1; font-size: 13px; margin-top: 2px; }
.nav-btn { width: 100%; text-align: left; border: 0; background: transparent; color: #d0d5dd; padding: 12px 14px; border-radius: 12px; margin-bottom: 6px; }
.nav-btn:hover, .nav-btn.active { background: rgba(255,255,255,.12); color: #fff; }
.sidebar-note { margin-top: 28px; padding: 14px; border-radius: 14px; background: rgba(255,255,255,.08); }
.sidebar-note strong, .sidebar-note span { display: block; }
.sidebar-note span { color: #b6c2d1; font-size: 12px; margin-top: 6px; line-height: 1.35; }

.main { padding: 22px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 20px; }
.title-block { min-width: 220px; }
h1 { margin: 0; font-size: 28px; letter-spacing: -.03em; }
h2 { margin: 0; font-size: 18px; }
p { margin: 6px 0 0; color: var(--muted); }
.topbar-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; }
.date-filter { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 700; }
.date-filter input { width: 150px; }
.btn { border: 0; border-radius: 12px; padding: 11px 14px; font-weight: 800; color: #fff; background: var(--primary); transition: transform .15s ease, opacity .15s ease; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--primary); }
.btn.dark { background: var(--dark); }
.btn.secondary { background: var(--surface-3); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: #fee4e2; color: #b42318; border: 1px solid #fecdca; }
.btn.small { padding: 8px 10px; border-radius: 10px; font-size: 13px; }
.file-label { display: inline-block; }
.icon-btn { width: 36px; height: 36px; border: 0; border-radius: 10px; background: var(--surface-3); color: var(--text); font-size: 22px; }
.view { display: none; }
.view.active { display: block; }
.hint-box { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--line)); color: var(--text); padding: 12px 14px; border-radius: 14px; margin-bottom: 14px; }

.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: 0 6px 18px rgba(16,24,40,.04); }
.kpi-card span { color: var(--muted); font-size: 13px; }
.kpi-card strong { display: block; font-size: 28px; margin-top: 8px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 18px rgba(16,24,40,.04); margin-bottom: 18px; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 18px; border-bottom: 1px solid var(--line); }
.compact-head { padding-bottom: 10px; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.table-wrap { overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 980px; }
.data-table th { background: var(--surface-2); color: var(--muted); text-transform: uppercase; font-size: 12px; letter-spacing: .04em; text-align: left; padding: 12px; border-bottom: 1px solid var(--line); }
.data-table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
.data-table tr:last-child td { border-bottom: 0; }
.actions-cell { display: flex; flex-wrap: wrap; gap: 6px; }
.empty { padding: 20px; color: var(--muted); }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 900; white-space: nowrap; }
.badge.sep { color: #7a2e0e; background: #fef0c7; }
.badge.wait { color: #1849a9; background: #d1e9ff; }
.badge.route { color: #5925dc; background: #ebe9fe; }
.badge.done, .badge.ready { color: #027a48; background: #d1fadf; }
.badge.cancel { color: #b42318; background: #fee4e2; }
.badge.neutral { color: var(--muted); background: var(--surface-3); }

.kanban { display: grid; grid-template-columns: repeat(5, minmax(260px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 10px; }
.kanban-col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-height: 420px; overflow: hidden; }
.kanban-head { display: flex; justify-content: space-between; align-items: center; padding: 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-weight: 900; text-transform: uppercase; }
.kanban-drop { min-height: 340px; padding: 12px; transition: background .12s ease; }
.kanban-drop.drag-over { background: color-mix(in srgb, var(--primary) 9%, transparent); outline: 2px dashed var(--primary); outline-offset: -7px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; box-shadow: 0 8px 20px rgba(16,24,40,.06); }
.card[draggable="true"] { cursor: grab; }
.card.dragging { opacity: .55; transform: rotate(1deg); }
.card-title { font-weight: 900; margin-bottom: 6px; }
.card-meta { color: var(--muted); font-size: 12px; line-height: 1.55; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.report-panel { padding: 18px; min-height: 230px; }
.report-row { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.report-row:last-child { border-bottom: 0; }
.report-row b { text-align: right; }
.filters-grid, .settings-grid { padding: 18px; display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 14px; }
.filters-grid label, .settings-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 800; }
.full { grid-column: 1 / -1; }
.filter-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }

.modal-root { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 18px; background: rgba(2, 6, 23, .55); z-index: 50; }
.modal-root.active { display: flex; }
.modal { background: var(--surface); color: var(--text); border-radius: 18px; width: min(880px, 96vw); max-height: 92vh; overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); }
.modal.small { width: min(560px, 96vw); }
.modal-head { padding: 18px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px; overflow: auto; max-height: calc(92vh - 132px); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface-2); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 800; }
.form-grid .full { grid-column: 1 / -1; }
.check-row { display: flex !important; grid-template-columns: none !important; align-items: center; gap: 8px !important; }
.check-row input { width: auto; }
.preview-ticket { width: 320px; background: #fff; color: #000; font-family: monospace; border: 1px dashed #333; padding: 12px; margin: 0 auto; }
.preview-ticket .center { text-align: center; font-weight: 900; }
.preview-ticket .line { border-top: 1px dashed #000; margin: 8px 0; }

.toast { position: fixed; right: 20px; bottom: 20px; background: var(--dark); color: #fff; padding: 12px 14px; border-radius: 12px; box-shadow: var(--shadow); transform: translateY(24px); opacity: 0; transition: .2s ease; z-index: 60; max-width: 360px; }
.toast.show { opacity: 1; transform: translateY(0); }

@media print {
  body * { visibility: hidden !important; }
  .print-area, .print-area * { visibility: visible !important; }
  .print-area { position: absolute; left: 0; top: 0; width: 100%; }
}

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .topbar { flex-direction: column; align-items: stretch; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-grid, .filters-grid, .settings-grid { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(5, 280px); }
}

.import-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 18px;
}
.step-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: var(--surface-soft);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.step-card strong {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  flex: 0 0 auto;
}
.import-preview { margin-top: 18px; }
.code-block {
  white-space: pre-wrap;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  overflow: auto;
  max-height: 440px;
  font-size: 12px;
}
@media (max-width: 980px) {
  .import-steps { grid-template-columns: 1fr; }
}

/* ===== V4: Login, administradores e recuperação de senha ===== */
body:not(.authenticated) .app-shell { display: none; }
body.authenticated .auth-screen { display: none; }
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--primary) 18%, transparent), transparent 32%),
    linear-gradient(135deg, #0b1220, #111827 52%, #0f172a);
}
.auth-card {
  width: min(520px, 96vw);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 26px;
}
.auth-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.auth-logo { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--primary); color: #fff; font-size: 24px; }
.auth-brand h1 { font-size: 24px; }
.auth-pane { display: grid; gap: 12px; }
.auth-pane h2 { font-size: 20px; }
.auth-pane label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 800; }
.auth-alert { border-radius: 14px; padding: 12px; margin-bottom: 14px; border: 1px solid #fecdca; background: #fee4e2; color: #b42318; font-weight: 800; }
.auth-alert.ok { border-color: #abefc6; background: #d1fadf; color: #027a48; }
.auth-note { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.link-btn { border: 0; background: transparent; color: var(--primary); font-weight: 900; padding: 8px; justify-self: center; }
.recovery-code { border: 1px dashed var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); border-radius: 14px; padding: 12px; font-weight: 900; }
.user-chip { display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--text); font-weight: 900; }
.status-dot { display: inline-flex; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 900; }
.status-dot.active { color: #027a48; background: #d1fadf; }
.status-dot.inactive { color: #b42318; background: #fee4e2; }
.admin-help { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ===== V5: UX, fontes, login estilo WordPress, dados e backups ===== */
:root {
  --border: var(--line);
  --surface-soft: var(--surface-2);
  --font-system: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  --font-inter: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-serif: Georgia, Cambria, "Times New Roman", serif;
}
body[data-font="system"] { font-family: var(--font-system); }
body[data-font="inter"] { font-family: var(--font-inter); }
body[data-font="serif"] { font-family: var(--font-serif); }
body.compact-density input,
body.compact-density select,
body.compact-density textarea { padding: 7px 9px; border-radius: 8px; }
body.compact-density .btn { padding: 8px 10px; border-radius: 9px; }
body.compact-density .data-table td { padding: 8px; font-size: 13px; }
body.compact-density .data-table th { padding: 9px; }
body.compact-density .panel-head { padding: 13px; }

/* Login mais clean, inspirado no WordPress */
body:not(.authenticated) {
  --bg: #f0f0f1;
  --surface: #ffffff;
  --text: #1d2327;
  --muted: #50575e;
  --line: #c3c4c7;
}
.auth-screen {
  background: #f0f0f1 !important;
  padding: 32px 16px;
  align-items: start;
}
.auth-card {
  width: 360px;
  max-width: calc(100vw - 32px);
  border-radius: 0;
  border: 1px solid #c3c4c7;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  padding: 24px;
  margin-top: 28px;
}
.auth-brand {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 8px;
  margin-bottom: 20px;
}
.auth-logo {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  font-size: 30px;
  background: var(--primary);
}
.auth-brand h1 {
  font-size: 22px;
  letter-spacing: -.02em;
}
.auth-brand p { margin-top: 2px; font-size: 13px; }
.auth-pane { gap: 14px; }
.auth-pane h2 { font-size: 18px; margin-top: 2px; }
.auth-pane label {
  color: #1d2327;
  font-size: 13px;
  font-weight: 500;
}
.auth-pane input {
  border-radius: 4px;
  border-color: #8c8f94;
  background: #fff;
  padding: 9px 10px;
}
.auth-pane .btn.primary {
  width: 100%;
  border-radius: 4px;
  background: #2271b1;
  padding: 10px 12px;
}
.auth-pane .btn.secondary { border-radius: 4px; }
.remember-row {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  color: #3c434a !important;
}
.remember-row input { width: auto; }
.link-btn {
  justify-self: start;
  padding-left: 0;
  color: #2271b1;
  font-weight: 500;
}
.auth-alert { border-radius: 4px; font-size: 13px; }
.recovery-code { border-radius: 4px; }

.tools-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  gap: 16px;
}
.wide-card { grid-column: 1 / -1; }
.data-card { min-height: 0; }
.stack-actions {
  padding: 18px;
  display: grid;
  gap: 10px;
  align-items: start;
}
.stack-actions .btn, .stack-actions .file-label { width: 100%; text-align: center; }
.flat-panel { box-shadow: none; margin: 14px 18px 18px; }
.compact-steps { margin: 16px 18px 0; }
.logs-wrap { max-height: 360px; }
.address-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 10px;
}

@media (max-width: 980px) {
  .tools-grid { grid-template-columns: 1fr; }
}

/* ===== V6: limpeza visual, login enxuto e tipografia confortável ===== */
[hidden] { display: none !important; }

:root {
  --text: #20252d;
  --muted: #667085;
}

body {
  font-weight: 400;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3,
.brand strong,
.auth-brand h1,
.card-title,
.kanban-head,
.panel-head h2,
.report-panel h2 {
  font-weight: 650 !important;
  letter-spacing: -0.015em;
}

h1 { font-size: 26px; }
h2 { font-size: 17px; }
p { color: var(--muted); font-weight: 400; }

strong, b { font-weight: 650; }

.btn,
.nav-btn,
.link-btn,
.date-filter,
.user-chip,
.badge,
.status-dot,
.data-table th,
.form-grid label,
.filters-grid label,
.settings-grid label,
.auth-pane label,
.auth-alert,
.card-title,
.kanban-head,
.preview-ticket .center,
.recovery-code {
  font-weight: 600 !important;
}

.btn {
  box-shadow: none;
  letter-spacing: 0;
}

.btn:hover { transform: none; opacity: .92; }

.data-table th {
  letter-spacing: .025em;
  font-size: 11.5px;
}

.data-table td,
.card-meta,
.report-row,
.sidebar-note span,
.brand span {
  font-weight: 400;
}

.badge,
.status-dot {
  font-size: 11.5px;
}

/* Login: uma única etapa visível por vez, sem rolagem longa */
body:not(.authenticated) {
  background: #f0f0f1;
}

.auth-screen {
  min-height: 100vh;
  display: flex !important;
  align-items: flex-start;
  justify-content: center;
  padding: 38px 16px;
  background: #f0f0f1 !important;
}

.auth-card {
  width: 360px;
  max-width: calc(100vw - 32px);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.auth-brand {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 7px;
  margin: 0 0 20px;
}

.auth-logo {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  font-size: 28px;
}

.auth-brand h1 {
  font-size: 22px;
  color: #1d2327;
  margin: 0;
}

.auth-brand p {
  font-size: 13px;
  color: #646970;
  margin: 0;
}

.auth-alert {
  margin: 0 0 14px;
  border-radius: 3px;
  padding: 9px 10px;
  font-size: 13px;
}

.auth-pane {
  background: #fff;
  border: 1px solid #c3c4c7;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  padding: 22px 24px 24px;
  display: grid;
  gap: 13px;
}

.auth-pane h2 {
  margin: 0 0 3px;
  font-size: 18px;
  color: #1d2327;
}

.auth-pane p {
  margin: 0 0 5px;
  font-size: 14px;
  color: #646970;
  line-height: 1.45;
}

.auth-pane label {
  color: #1d2327;
  font-size: 13px;
  gap: 5px;
}

.auth-pane input {
  min-height: 38px;
  border-radius: 3px;
  border: 1px solid #8c8f94;
  background: #fff;
  padding: 7px 9px;
  font-size: 15px;
  font-weight: 400;
}

.auth-pane input:focus {
  border-color: #2271b1;
  box-shadow: 0 0 0 1px #2271b1;
}

.auth-pane .btn.primary,
.auth-pane .btn.secondary {
  width: 100%;
  min-height: 40px;
  border-radius: 3px;
  font-size: 14px;
  font-weight: 600 !important;
  padding: 9px 12px;
}

.auth-pane .btn.primary { background: #2271b1; }
.auth-pane .btn.secondary { background: #f6f7f7; color: #1d2327; border: 1px solid #c3c4c7; }

.remember-row {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  color: #3c434a !important;
  font-weight: 400 !important;
}

.remember-row input {
  min-height: auto;
  width: 16px;
  height: 16px;
  padding: 0;
}

.link-btn {
  justify-self: start;
  padding: 0;
  margin-top: 8px;
  color: #2271b1;
  font-size: 13px;
  font-weight: 400 !important;
}

.recovery-code {
  border-radius: 3px;
  padding: 10px;
  font-size: 13px;
  background: #f6f7f7;
}

/* Em primeiro acesso, não mostra campos de login/recuperação juntos. */
#loginForm[hidden],
#setupForm[hidden],
#recoveryForm[hidden] {
  display: none !important;
}

/* App: menos peso visual em geral */
.sidebar { font-weight: 400; }
.nav-btn { font-weight: 500 !important; }
.brand strong { font-size: 15px; }
.panel,
.kpi-card,
.card,
.modal {
  box-shadow: 0 4px 14px rgba(16,24,40,.035);
}

.kpi-card strong { font-weight: 650; font-size: 26px; }
.card-title { font-size: 14px; }
.card-meta { font-size: 12.5px; color: var(--muted); }

@media (max-height: 760px) {
  .auth-screen { padding-top: 22px; }
  .auth-logo { width: 54px; height: 54px; font-size: 24px; }
  .auth-brand { margin-bottom: 14px; }
  .auth-pane { padding: 18px 20px; gap: 10px; }
}

/* ===== V7: opções de primeiro administrador ===== */
.setup-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin: 4px 0 2px;
}
.setup-mode {
  min-height: 34px;
  border: 1px solid #c3c4c7;
  background: #f6f7f7;
  color: #1d2327;
  border-radius: 3px;
  padding: 7px 8px;
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
}
.setup-mode.active {
  background: #2271b1;
  border-color: #2271b1;
  color: #fff;
}
.setup-block { display: none; gap: 12px; }
.setup-block.active { display: grid; }
.auth-pane select,
.auth-pane input[type="file"] {
  min-height: 38px;
  border-radius: 3px;
  border: 1px solid #8c8f94;
  background: #fff;
  padding: 7px 9px;
  font-size: 14px;
  font-weight: 400;
}
.setup-inline-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.setup-inline-options .remember-row { margin: 0; }
.setup-generate-password { margin: 0 !important; white-space: nowrap; }
.password-hint {
  color: #646970;
  font-size: 12px;
  line-height: 1.35;
  margin-top: -6px;
}
.setup-advanced {
  border: 1px solid #dcdcde;
  border-radius: 3px;
  background: #fbfbfc;
  padding: 10px 12px;
}
.setup-advanced summary {
  cursor: pointer;
  color: #2271b1;
  font-size: 13px;
  font-weight: 400;
}
.setup-advanced[open] {
  display: grid;
  gap: 10px;
}
.setup-advanced[open] summary { margin-bottom: 2px; }
.auth-mini-panel {
  border-left: 3px solid #2271b1;
  background: #f6f7f7;
  color: #3c434a;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
  font-size: 13px;
  line-height: 1.42;
}
.auth-mini-panel strong {
  color: #1d2327;
  font-weight: 500;
}
.auth-mini-panel span { color: #646970; }
@media (max-width: 420px) {
  .setup-mode-tabs { grid-template-columns: 1fr; }
  .setup-inline-options { align-items: flex-start; flex-direction: column; }
}


/* ===== V9 PROFISSIONAL: separação real entre login e aplicativo + visual limpo ===== */
[hidden] { display: none !important; }
body.auth-only .app-shell,
body:not(.authenticated) .app-shell { display: none !important; }
body.authenticated .auth-screen,
body.authenticated #authScreen { display: none !important; }
body.authenticated .app-shell { display: grid !important; }

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --text: #1f2937;
  --muted: #667085;
  --line: #e5e7eb;
  --primary: #2271b1;
  --primary-dark: #135e96;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(15, 23, 42, .075);
}

html { background: #f0f0f1; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif !important;
  font-size: 14px;
  font-weight: 400 !important;
  color: var(--text);
  background: var(--bg);
}

.auth-screen {
  min-height: 100vh;
  width: 100%;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: center !important;
  padding: 56px 18px 32px !important;
  background: #f0f0f1 !important;
}
.auth-card {
  width: 390px !important;
  max-width: calc(100vw - 36px) !important;
  margin: 0 auto !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.auth-brand {
  margin: 0 0 22px !important;
  display: grid !important;
  justify-items: center !important;
  text-align: center !important;
  gap: 8px !important;
}
.auth-logo {
  width: 58px !important;
  height: 58px !important;
  border-radius: 13px !important;
  font-size: 25px !important;
  background: #0f8a5f !important;
  box-shadow: 0 5px 16px rgba(15, 138, 95, .18) !important;
}
.auth-brand h1 {
  margin: 0 !important;
  font-size: 22px !important;
  line-height: 1.15 !important;
  font-weight: 600 !important;
  letter-spacing: -.02em !important;
  color: #1d2327 !important;
}
.auth-brand p {
  margin: 0 !important;
  font-size: 13px !important;
  color: #646970 !important;
}
.auth-pane {
  background: #fff !important;
  border: 1px solid #dcdcde !important;
  border-radius: 2px !important;
  box-shadow: 0 1px 2px rgba(0,0,0,.04) !important;
  padding: 24px !important;
  display: grid !important;
  gap: 13px !important;
}
.auth-pane[hidden] { display: none !important; }
.auth-pane h2 {
  margin: 0 !important;
  color: #1d2327 !important;
  font-size: 19px !important;
  font-weight: 500 !important;
  letter-spacing: -.01em !important;
}
.auth-pane p {
  margin: 0 0 2px !important;
  color: #646970 !important;
  font-size: 14px !important;
  line-height: 1.48 !important;
  font-weight: 400 !important;
}
.auth-pane label {
  display: grid !important;
  gap: 6px !important;
  color: #1d2327 !important;
  font-size: 13px !important;
  line-height: 1.35 !important;
  font-weight: 500 !important;
}
.auth-pane input,
.auth-pane select,
.auth-pane input[type="file"] {
  width: 100% !important;
  min-height: 38px !important;
  border-radius: 3px !important;
  border: 1px solid #8c8f94 !important;
  background: #fff !important;
  color: #1d2327 !important;
  padding: 7px 9px !important;
  font-size: 15px !important;
  font-weight: 400 !important;
  box-shadow: 0 0 0 transparent !important;
}
.auth-pane input:focus,
.auth-pane select:focus {
  border-color: #2271b1 !important;
  box-shadow: 0 0 0 1px #2271b1 !important;
}
.auth-pane .btn.primary,
.auth-pane .btn.secondary {
  width: 100% !important;
  min-height: 40px !important;
  border-radius: 3px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  padding: 9px 12px !important;
}
.auth-pane .btn.primary { background: #2271b1 !important; }
.auth-pane .btn.primary:hover { background: #135e96 !important; opacity: 1 !important; }
.auth-pane .btn.secondary { background: #f6f7f7 !important; color: #1d2327 !important; border: 1px solid #c3c4c7 !important; }
.auth-alert {
  margin: 0 0 14px !important;
  border-radius: 3px !important;
  padding: 9px 10px !important;
  font-size: 13px !important;
  line-height: 1.35 !important;
  font-weight: 400 !important;
  border-left: 4px solid #d63638 !important;
  background: #fff !important;
  color: #1d2327 !important;
  box-shadow: 0 1px 1px rgba(0,0,0,.04) !important;
}
.auth-alert.ok { border-left-color: #00a32a !important; }
.remember-row {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  font-weight: 400 !important;
  color: #3c434a !important;
}
.remember-row input {
  width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  padding: 0 !important;
}
.link-btn {
  background: transparent !important;
  border: 0 !important;
  color: #2271b1 !important;
  font-weight: 400 !important;
  font-size: 13px !important;
  padding: 2px 0 !important;
  justify-self: start !important;
}
.setup-mode-tabs {
  grid-template-columns: 1fr !important;
  gap: 6px !important;
  margin: 2px 0 4px !important;
}
.setup-mode {
  text-align: left !important;
  min-height: 36px !important;
  border-radius: 3px !important;
  padding: 8px 10px !important;
  font-size: 13px !important;
  font-weight: 400 !important;
}
.setup-mode.active {
  background: #eef6fc !important;
  color: #135e96 !important;
  border-color: #72aee6 !important;
}
.setup-block.active { display: grid !important; gap: 12px !important; }
.setup-inline-options { align-items: center !important; }
.password-hint { color: #646970 !important; font-size: 12px !important; line-height: 1.35 !important; }
.setup-advanced,
.auth-mini-panel,
.recovery-code {
  border-radius: 3px !important;
  background: #f6f7f7 !important;
  border: 1px solid #dcdcde !important;
  color: #3c434a !important;
  font-size: 13px !important;
  font-weight: 400 !important;
}

.app-shell {
  grid-template-columns: 260px minmax(0, 1fr) !important;
  min-height: 100vh !important;
}
.sidebar {
  background: #111827 !important;
  padding: 18px 16px !important;
  border-right: 1px solid rgba(255,255,255,.08) !important;
}
.brand-icon { background: rgba(255,255,255,.10) !important; border-radius: 12px !important; }
.brand strong { font-size: 15px !important; font-weight: 600 !important; }
.brand span { font-size: 12px !important; color: #cbd5e1 !important; }
.nav-btn {
  border-radius: 9px !important;
  padding: 10px 12px !important;
  margin-bottom: 4px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  color: #d1d5db !important;
}
.nav-btn.active,
.nav-btn:hover { background: rgba(255,255,255,.10) !important; color: #fff !important; }
.main { padding: 24px !important; }
.topbar { background: transparent !important; align-items: center !important; margin-bottom: 22px !important; }
h1 { font-size: 26px !important; font-weight: 600 !important; letter-spacing: -.025em !important; }
h2 { font-size: 18px !important; font-weight: 600 !important; }
p { font-weight: 400 !important; color: var(--muted) !important; }
.btn { border-radius: 8px !important; font-weight: 500 !important; box-shadow: none !important; }
.btn:hover { transform: none !important; opacity: .92 !important; }
.kpi-card,
.panel,
.card,
.kanban-col,
.modal { border-color: #e5e7eb !important; box-shadow: 0 3px 14px rgba(15, 23, 42, .045) !important; }
.kpi-card strong { font-size: 25px !important; font-weight: 600 !important; }
.data-table th { font-weight: 600 !important; font-size: 11px !important; }
.data-table td { font-weight: 400 !important; font-size: 13.5px !important; }
.badge, .status-dot { font-weight: 600 !important; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr !important; }
  .sidebar { position: static !important; height: auto !important; }
  .auth-screen { padding-top: 28px !important; }
}

/* V10 - histórico, pendências e virada de data */
.daily-alert {
  margin: -8px 0 18px;
}
.daily-alert-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid #f1d08a;
  background: #fff8e6;
  color: #5f4200;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
}
.dark-theme .daily-alert-content {
  background: rgba(251, 191, 36, .12);
  border-color: rgba(251, 191, 36, .35);
  color: #fde68a;
}
.pending-list {
  display: grid;
  gap: 10px;
}
.pending-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}
.pending-card > div:first-child {
  display: grid;
  gap: 4px;
}
.pending-card strong {
  font-size: 14px;
  font-weight: 600;
}
.pending-card span {
  font-size: 12.5px;
  color: var(--muted);
}
.history-summary-panel {
  margin-bottom: 16px;
}
.history-filters-grid .full {
  grid-column: 1 / -1;
}
.soft-empty {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 18px;
  background: rgba(148, 163, 184, .07);
}
#historyTable td:last-child {
  min-width: 260px;
}
@media (max-width: 900px) {
  .daily-alert-content,
  .pending-card {
    align-items: stretch;
    flex-direction: column;
  }
}
