/* ===================== DESIGN TOKENS ===================== */
:root {
  /* cores neutras */
  --color-white: #FFFFFF;
  --color-bg-subtle: #F8F9FA;
  --color-bg-muted: #ECEFF3;
  --color-border: #D9DDE3;
  --color-text: #1F2937;
  --color-text-secondary: #6B7280;

  /* cores de marca / estado */
  --color-primary: #2563EB;
  --color-primary-hover: #1D4ED8;
  --color-primary-soft: #EFF4FE;
  --color-success: #16A34A;
  --color-warning: #F59E0B;
  --color-error: #DC2626;

  /* legado (mantido por compatibilidade com o restante do CSS) */
  --accent-navy: var(--color-primary);

  /* tipografia */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* raio e sombra padronizados */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-xs: 0 1px 2px rgba(16,24,40,.05);
  --shadow-sm: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
  --shadow-md: 0 4px 16px rgba(16,24,40,.08);
  --transition-fast: 150ms ease;
}
html.dark { --accent-navy: #3b82f6; }

/* ===================== RESET & BASE ===================== */
* { box-sizing: border-box; }
html, body {
  max-width: 100vw;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}
body {
  font-family: var(--font-sans);
  background: var(--color-bg-subtle);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
html.dark, html.dark body { background-color: #0f172a; color: #f8fafc; }
h1, h2, h3, h4 { font-family: var(--font-sans); letter-spacing: -0.01em; }
.hidden { display: none !important; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.dark ::-webkit-scrollbar-track { background: #0f172a; }
.dark ::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
.dark ::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ===================== LOGIN ===================== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #1e293b;
  padding: 24px;
}
.login-box { width: 100%; max-width: 380px; }
.login-logo-wrap { display: flex; justify-content: center; margin-bottom: 18px; }
.login-logo {
  width: 88px; height: 88px; border-radius: 50%; object-fit: cover; object-position: 50% 22%;
  box-shadow: 0 0 0 4px #fff, var(--shadow-md);
  border: 2px solid var(--color-border);
}
.login-title { font-size: 22px; font-weight: 700; color: var(--color-text); letter-spacing: -0.02em; margin: 0 0 24px; text-align: center; }
.login-form { display: flex; flex-direction: column; gap: 18px; }
.login-error {
  background: #FEF2F2; border: 1px solid #FECACA; color: var(--color-error);
  font-size: 13px; padding: 12px 14px; border-radius: var(--radius-sm); display: flex; gap: 8px; align-items: flex-start;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--color-text-secondary); }
.field input, .field select, .field textarea {
  width: 100%; background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  padding: 11px 14px; font-size: 14px; color: var(--color-text); transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.btn-primary {
  background: var(--color-primary); color: #fff; font-weight: 600; padding: 12px 16px; border: none;
  border-radius: var(--radius-sm); font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background var(--transition-fast);
}
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-primary.full { width: 100%; margin-top: 4px; }
.login-forgot-wrap { padding-top: 4px; }
.link-btn { background: none; border: none; color: #2563EB; font-size: 14px; font-weight: 500; text-decoration: none; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* ===================== APP SHELL ===================== */
.app-shell { display: flex; min-height: 100vh; }
.mobile-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 40; }
.sidebar {
  width: 248px; flex-shrink: 0; background: var(--color-white);
  color: var(--color-text); display: flex; flex-direction: column; height: 100vh; position: fixed; top: 0; left: 0; z-index: 50;
  border-right: 1px solid var(--color-border);
}
.sidebar-header { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid var(--color-border); }
.sidebar-logo { width: 34px; height: 34px; background: var(--color-bg-muted); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink:0; overflow: hidden; }
img.sidebar-logo { object-fit: cover; object-position: 50% 22%; border: 1px solid var(--color-border); }
.sidebar-title { display: flex; flex-direction: column; line-height: 1.25; overflow: hidden; }
.sidebar-title strong { font-size: 13.5px; white-space: nowrap; color: var(--color-text); }
.sidebar-title span { font-size: 11px; color: var(--color-text-secondary); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; color: var(--color-text-secondary); background: none; border: none; text-align: left;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.nav-item:hover { background: var(--color-bg-subtle); color: var(--color-text); }
.nav-item.active { background: var(--color-primary-soft); color: var(--color-primary); font-weight: 600; border-left: 3px solid var(--color-primary); padding-left: 9px; }
.nav-item svg { flex-shrink: 0; }
.nav-icon { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 16px; height: 16px; }
.nav-group { margin-top: 8px; }
.nav-group:first-child { margin-top: 0; }
.nav-group-label {
  display: flex; align-items: center; gap: 6px; padding: 10px 12px 4px; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: #9CA3AF; white-space: nowrap;
}
.nav-home-item { margin-bottom: 6px; border-radius: var(--radius-md); }
.nav-home-item.active {
  background: var(--color-primary); color: #fff; border-left: none; padding-left: 12px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .35);
}
.nav-home-item.active:hover { background: var(--color-primary-hover); color: #fff; }
html.dark .nav-home-item.active { background: var(--accent-navy); color: #fff; box-shadow: 0 2px 10px rgba(59,130,246,.4); }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--color-border); }
.sidebar-logout { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; background: none; border: 1px solid var(--color-border); color: var(--color-error); padding: 9px; border-radius: var(--radius-sm); font-weight: 600; font-size: 13px; transition: background var(--transition-fast); }
.sidebar-logout:hover { background: #FEF2F2; }
html.dark .sidebar { background: #0f172a; border-color: #334155; color: #f8fafc; }
html.dark .sidebar-header { border-color: #334155; }
html.dark .sidebar-title strong { color: #f8fafc; }
html.dark .nav-item:hover { background: #1e293b; color: #f8fafc; }
html.dark .nav-item.active { background: rgba(59,130,246,.15); color: #93c5fd; }
html.dark .sidebar-footer { border-color: #334155; }

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-left: 248px; }
.topbar {
  height: 60px; background: var(--color-white); border-bottom: 1px solid var(--color-border); display: flex; align-items: center;
  padding: 0 24px; gap: 14px; position: sticky; top: 0; z-index: 30;
}
.dark .topbar { background: #1e293b; border-color: #334155; }
.page-title { font-size: 16px; font-weight: 600; margin: 0; flex: 1; color: var(--color-text); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { background: none; border: 1px solid var(--color-border); width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: var(--color-text-secondary); position: relative; transition: background var(--transition-fast), color var(--transition-fast); }
.icon-btn:hover { background: var(--color-bg-subtle); color: var(--color-text); }
.dark .icon-btn { background: #334155; color: #e2e8f0; }
.mobile-only { display: none; }
.notif-wrap { position: relative; }
.notif-badge { position: absolute; top: -4px; right: -4px; background: #dc2626; color: #fff; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 3px; }
.notif-panel { position: absolute; right: 0; top: 46px; width: 320px; max-height: 400px; overflow-y: auto; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.15); z-index: 60; }
.dark .notif-panel { background: #1e293b; border-color: #334155; }
.notif-item { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.dark .notif-item { border-color: #334155; }
.notif-item strong { display: block; font-size: 13px; margin-bottom: 2px; }
.notif-item span { color: #64748b; font-size: 12px; }
.notif-empty { padding: 24px; text-align: center; color: #94a3b8; font-size: 13px; }
.qt-dropdown-wrap { position: relative; }
.qt-dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; max-height: 360px; overflow-y: auto; background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--radius-sm); box-shadow: 0 10px 30px rgba(0,0,0,.15); z-index: 60; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.dark .qt-dropdown-menu { background: #1e293b; border-color: #334155; }
.qt-dropdown-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: none; background: transparent; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--color-text); text-align: left; cursor: pointer; transition: background var(--transition-fast); }
.qt-dropdown-item:hover { background: var(--color-primary-soft); color: var(--color-primary); }
.dark .qt-dropdown-item { color: #e2e8f0; }
.dark .qt-dropdown-item:hover { background: #334155; color: #fff; }
.qt-dropdown-item .dqa-icon { display: flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex-shrink: 0; }
.qt-dropdown-item .dqa-icon svg { width: 18px; height: 18px; }
.smart-search-card { position: relative; margin-bottom: 20px; padding: 14px 16px; }
.smart-search-wrap { position: relative; display: flex; align-items: center; }
.smart-search-icon { position: absolute; left: 10px; color: #9CA3AF; pointer-events: none; }
.smart-search-input { width: 100%; padding: 8px 12px 8px 32px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-size: 13px; background: transparent; color: var(--color-text); }
.smart-search-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-soft); }
.smart-search-results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); max-height: 420px; overflow-y: auto; background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--radius-sm); box-shadow: 0 14px 34px rgba(0,0,0,.16); z-index: 70; padding: 6px; }
.dash-smart-search { flex: 0 1 220px; min-width: 140px; max-width: 220px; }
.dash-smart-search .smart-search-results { width: 320px; left: auto; right: 0; }
.dark .smart-search-results { background: #1e293b; border-color: #334155; }
.smart-search-group-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #94a3b8; padding: 8px 10px 4px; }
.smart-search-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: none; background: transparent; border-radius: 6px; text-align: left; cursor: pointer; transition: background var(--transition-fast); }
.smart-search-item:hover { background: var(--color-primary-soft); }
.dark .smart-search-item:hover { background: #334155; }
.smart-search-item .ssi-icon { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--color-bg-subtle); color: var(--color-primary); flex-shrink: 0; }
.dark .smart-search-item .ssi-icon { background: #334155; }
.smart-search-item .ssi-body { display: flex; flex-direction: column; min-width: 0; }
.smart-search-item .ssi-body strong { font-size: 13px; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.smart-search-item .ssi-body span { font-size: 12px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.smart-search-empty { padding: 20px; text-align: center; color: #94a3b8; font-size: 13px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding-left: 10px; border-left: 1px solid #e2e8f0; }
.dark .user-chip { border-color: #334155; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: #2563EB; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.user-chip-text { display: flex; flex-direction: column; line-height: 1.2; }
.user-chip-text strong { font-size: 13px; }
.user-chip-text span { font-size: 11px; color: #64748b; text-transform: capitalize; }

.page-content { padding: 24px; max-width: 1500px; width: 100%; margin: 0 auto; }

.webview-wrap { display: flex; flex-direction: column; gap: 12px; height: calc(100vh - 160px); min-height: 480px; }
.webview-card { flex: 1; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.webview-iframe { flex: 1; width: 100%; height: 100%; min-height: 420px; border: 0; border-radius: var(--radius-md); }
.webview-iframe-crop { flex: 1; position: relative; overflow: hidden; border-radius: var(--radius-md); min-height: 420px; }
.webview-iframe-cropped { position: absolute; top: calc(-1 * var(--crop, 0px)); left: 0; width: 100%; height: calc(100% + var(--crop, 0px)); min-height: unset; }
.webview-fallback-note { padding: 10px 16px; margin: 0; font-size: 12px; }
.webview-search-bar { display: flex; gap: 8px; }
.webview-search-bar input { flex: 1; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); font-size: 14px; }
.dark .webview-search-bar input { background: #1e293b; border-color: #334155; color: #e2e8f0; }

/* ===================== GENERIC UI ===================== */
.card { background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-xs); }
.dark .card { background: #1e293b; border-color: #334155; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2,1fr);} .grid-3 { grid-template-columns: repeat(2,1fr);} }
@media (max-width: 640px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.stat-card { display: flex; flex-direction: column; gap: 6px; }
.stat-card .stat-label { font-size: 12px; font-weight: 600; color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; color: var(--color-text); }
.stat-card .stat-icon { width: 38px; height: 38px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.dash-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) { .dash-stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .dash-stats-grid { grid-template-columns: 1fr; } }
.stat-card-v2 { display: flex; flex-direction: column; padding: 18px 20px; }
.stat-card-v2-icon { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.stat-card-v2-label { font-size: 13px; font-weight: 600; color: var(--color-text-secondary); margin-bottom: 6px; }
.stat-card-v2-value { font-size: 26px; font-weight: 800; color: var(--color-text); line-height: 1; margin-bottom: 8px; }
.stat-card-v2-delta { font-size: 12px; font-weight: 700; margin-bottom: 10px; }
.stat-card-v2-delta.up { color: var(--color-success); }
.stat-card-v2-delta.down { color: #dc2626; }
.stat-card-v2-spark { width: 100%; height: 44px; display: block; }

.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.section-header h3 { font-size: 15px; font-weight: 700; margin: 0; color: var(--color-text); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.search-input-wrap { position: relative; flex: 1; min-width: 220px; }
.search-input-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #9CA3AF; }
.search-input-wrap input[type=text] { padding-left: 36px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; border: none; transition: background var(--transition-fast); }
.btn-primary-sm { background: var(--color-primary); color: #fff; }
.btn-primary-sm:hover { background: var(--color-primary-hover); }
.btn-secondary { background: var(--color-white); color: var(--color-text); border: 1px solid var(--color-border); padding: 9px 16px; border-radius: var(--radius-sm); font-weight: 600; font-size: 13px; transition: background var(--transition-fast); }
.dark .btn-secondary { background: #334155; color: #e2e8f0; border-color: #475569; }
.btn-secondary:hover { background: var(--color-bg-subtle); }
.btn-danger { background: var(--color-error); color: #fff; padding: 9px 16px; border-radius: var(--radius-sm); border: none; font-size: 13px; font-weight: 600; transition: background var(--transition-fast); }
.btn-danger:hover { background: #B91C1C; }
.btn-ghost { background: none; border: none; color: var(--color-text-secondary); padding: 6px; border-radius: 6px; transition: background var(--transition-fast); }
.btn-ghost:hover { background: var(--color-bg-subtle); color: var(--color-text); }
.dark .btn-ghost:hover { background: #334155; color: #f8fafc; }

select, input[type=text], input[type=email], input[type=tel], input[type=date], input[type=time], input[type=number], input[type=password], textarea {
  border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13.5px; background: var(--color-white); color: var(--color-text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-soft); }
.dark select, .dark input, .dark textarea { background: #334155; border-color: #475569; color: #f8fafc; }
textarea { resize: vertical; min-height: 70px; width: 100%; }
label.form-label { font-size: 12px; font-weight: 600; color: var(--color-text-secondary); margin-bottom: 4px; display: block; }
.dark label.form-label { color: #cbd5e1; }
.form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 12px 16px; background: var(--color-bg-subtle); color: var(--color-text-secondary); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--color-border); }
.dark th { background: #0f172a; color: #cbd5e1; border-color: #334155; }
td { padding: 12px 16px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.dark td { border-color: #334155; }
tr:hover td { background: var(--color-bg-subtle); }
.dark tr:hover td { background: #263449; }
.table-wrap { overflow-x: auto; overflow-y: hidden; border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.dark .table-wrap { border-color: #334155; }
.table-wrap table, table.standalone-table { border-radius: var(--radius-md); overflow: hidden; }

.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; border: 1px solid; white-space: nowrap; }
.badge-emerald { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.badge-amber { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.badge-blue { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.badge-indigo { background: #e0e7ff; color: #3730a3; border-color: #a5b4fc; }
.badge-rose { background: #ffe4e6; color: #9f1239; border-color: #fda4af; }
.badge-slate { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }
.badge-pending-alert { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .02em; background: #fff7ed; color: #b45309; border: 1px solid #fdba74; white-space: nowrap; box-shadow: 0 1px 2px rgba(180,83,9,0.08); }
.badge-pending-alert::before { content: ''; flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: #f59e0b; animation: pending-pulse 1.8s infinite; }
@keyframes pending-pulse { 0% { box-shadow: 0 0 0 0 rgba(245,158,11,0.55); } 70% { box-shadow: 0 0 0 6px rgba(245,158,11,0); } 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0); } }
.dark .badge-pending-alert { background: #451a03; color: #fdba74; border-color: #b45309; }
.dark .badge-emerald { background: #052e18; color: #6ee7b7; border-color: #15803d; }
.dark .badge-amber { background: #451a03; color: #fbbf24; border-color: #92400e; }
.dark .badge-blue { background: #172554; color: #93c5fd; border-color: #1d4ed8; }
.dark .badge-indigo { background: #1e1b4b; color: #c7d2fe; border-color: #4338ca; }
.dark .badge-rose { background: #4c0519; color: #fda4af; border-color: #9f1239; }
.dark .badge-slate { background: #334155; color: #e2e8f0; border-color: #475569; }

.empty-state { text-align: center; padding: 50px 20px; color: #94a3b8; }
.empty-state svg { margin-bottom: 10px; opacity: .5; }

.pending-alert-box { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 10px; padding: 10px 14px; font-size: 13px; font-weight: 600; margin-bottom: 16px; }
.dark .pending-alert-box { background: #451a03; color: #fde68a; border-color: #92400e; }
.return-note-banner { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: 600; margin: 6px 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dark .return-note-banner { background: #431407; color: #fed7aa; border-color: #9a3412; }
tr.row-pending td { background: #fffbeb; }
.dark tr.row-pending td { background: #3a2a06; }
.linked-info-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.dark .linked-info-box { background: #1e293b; border-color: #334155; }

/* modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 20px; }
.modal-box { background: var(--color-white); border-radius: var(--radius-lg); width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; padding: 24px; box-shadow: var(--shadow-md); }
.dark .modal-box { background: #1e293b; color: #f8fafc; }
.modal-box.small { max-width: 400px; }
.modal-box.large { max-width: 900px; }
.link-oficio-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; max-height: 50vh; overflow-y: auto; }
.link-oficio-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1.5px solid var(--color-border); border-radius: var(--radius-sm); }
.link-oficio-row.active { border-color: #22c55e; background: rgba(34,197,94,.08); }
.dark .link-oficio-row { border-color: #334155; }
.modal-box h3 { margin: 0 0 6px; font-size: 17px; font-weight: 700; color: var(--color-text); }
.modal-box p { color: var(--color-text-secondary); font-size: 13.5px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal-close { position: absolute; top: 18px; right: 18px; background: var(--color-bg-subtle); border: none; width: 32px; height: 32px; border-radius: var(--radius-sm); }
.modal-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--color-text); color: #fff; padding: 12px 20px; border-radius: var(--radius-md); font-size: 13px; font-weight: 500; z-index: 2100; box-shadow: var(--shadow-md); max-width: 90vw; }

.kanban { display: grid; grid-template-columns: repeat(4, minmax(260px,1fr)); gap: 14px; overflow-x: auto; }
@media (max-width: 900px) { .kanban { grid-template-columns: 1fr; } }
.kanban-col { background: #f1f5f9; border-radius: 12px; padding: 12px; min-height: 200px; }
.dark .kanban-col { background: #0f172a; }
.kanban-col-header { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 13px; margin-bottom: 10px; padding: 0 4px; }
.kanban-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; margin-bottom: 10px; cursor: pointer; }
.dark .kanban-card { background: #1e293b; border-color: #334155; }
.kanban-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.kanban-card .k-title { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.kanban-card .k-meta { font-size: 11px; color: #64748b; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid #e2e8f0; margin-bottom: 18px; overflow-x: auto; }
.dark .tabs { border-color: #334155; }
.tab-btn { padding: 10px 16px; font-size: 13px; font-weight: 700; color: #64748b; background: none; border: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab-btn.active { color: #2563EB; border-color: #2563EB; }
.dark .tab-btn.active { color: #93c5fd; border-color: #93c5fd; }

.list-row { display: flex; align-items: center; justify-content: space-between; padding: 12px; border: 1px solid #e2e8f0; border-radius: 10px; margin-bottom: 8px; }
.dark .list-row { border-color: #334155; }
.list-row:hover { border-color: #94a3b8; }

.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { display: flex; align-items: center; gap: 8px; }
.text-muted { color: #64748b; font-size: 12px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

.checkbox-tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border: 1px solid #cbd5e1; border-radius: 999px; font-size: 11px; font-weight: 600; cursor: pointer; user-select: none; }
.checkbox-tag.active { background: #2563EB; color: #fff; border-color: #2563EB; }

.stepper-dots { display:flex; gap:6px; }

/* Projeto de Lei form highlight boxes */
.pl-highlight-box { padding: 14px; border-radius: var(--radius-md); border: 1px solid var(--color-border); background: var(--color-bg-subtle); transition: all .15s; }
.dark .pl-highlight-box { background: #0f172a; border-color: #334155; }
.pl-highlight-box.approved { background: #ecfdf5; border-color: #6ee7b7; box-shadow: 0 0 0 2px rgba(16,185,129,.15); }
.pl-highlight-box.amber { background: #fffbeb; border-color: #fde68a; }
.dark .pl-highlight-box.approved { background: #052e18; border-color: #15803d; box-shadow: 0 0 0 2px rgba(16,185,129,.2); }
.dark .pl-highlight-box.amber { background: #451a03; border-color: #92400e; }
.pl-highlight-title { font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: #475569; display: flex; align-items: center; gap: 6px; }
.dark .pl-highlight-title { color: #cbd5e1; }
.pl-highlight-box.approved .pl-highlight-title { color: #15803D; }
.dark .pl-highlight-box.approved .pl-highlight-title { color: #6ee7b7; }
#pl-sanctioned-check { color: #94a3b8; }
.pl-highlight-box.approved #pl-sanctioned-check { color: #15803D; }
.dark .pl-highlight-box.approved #pl-sanctioned-check { color: #6ee7b7; }
.login-error .icon { color:#b91c1c; }

/* ===================== HONRARIAS & DEMANDAS (redesign) ===================== */
.page-header-icon {
  width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--color-primary-soft); color: var(--color-primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.page-header-title-wrap { display: flex; align-items: flex-start; gap: 14px; }
.page-header-inline-select { display: flex; flex-direction: column; gap: 4px; margin-right: 4px; }
.page-header-inline-select label { font-size: 10px; font-weight: 700; color: #9CA3AF; text-transform: uppercase; letter-spacing: .05em; }
.page-header-inline-select select { min-width: 170px; }

.grid-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) { .grid-5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .grid-5 { grid-template-columns: 1fr; } }

.stat-icon-blue { background: var(--color-primary-soft); color: var(--color-primary); }
.stat-icon-emerald { background: #ECFDF3; color: var(--color-success); }
.stat-icon-amber { background: #FEF6E7; color: #92400e; }
.stat-icon-rose { background: #ffe4e6; color: #9f1239; }
.stat-icon-slate { background: var(--color-bg-muted); color: var(--color-text-secondary); }
.dark .stat-icon-blue { background: #172554; color: #93c5fd; }
.dark .stat-icon-emerald { background: #052e18; color: #6ee7b7; }
.dark .stat-icon-amber { background: #451a03; color: #fbbf24; }
.dark .stat-icon-rose { background: #4c0519; color: #fda4af; }
.dark .stat-icon-slate { background: #334155; color: #cbd5e1; }
.stat-card .stat-sub { font-size: 11.5px; color: #9CA3AF; }
.stat-value.value-blue { color: var(--color-primary); }
.stat-value.value-emerald { color: var(--color-success); }
.stat-value.value-amber { color: #92400e; }
.stat-value.value-rose { color: #9f1239; }
.dark .stat-value.value-blue { color: #93c5fd; }
.dark .stat-value.value-emerald { color: #6ee7b7; }
.dark .stat-value.value-amber { color: #fbbf24; }
.dark .stat-value.value-rose { color: #fda4af; }

.progress-track { width: 100%; height: 6px; background: var(--color-bg-muted); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.dark .progress-track { background: #334155; }
.progress-fill { height: 100%; background: var(--color-primary); border-radius: 999px; }

.filter-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; margin-bottom: 12px; }
@media (max-width: 1100px) { .filter-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 640px) { .filter-grid { grid-template-columns: repeat(2, 1fr); } }
.filter-field label { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: #94a3b8; margin-bottom: 4px; display: block; }
.filter-field select { width: 100%; }

.demands-toolbar-card { margin-bottom: 18px; }
.demands-toolbar-tabs { margin-bottom: 14px; }
.demands-toolbar-tabs .tab-btn { display: inline-flex; align-items: center; gap: 6px; }
.demands-filter-panel { margin-top: 14px; padding-top: 14px; border-top: 1px solid #e2e8f0; }
.dark .demands-filter-panel { border-color: #334155; }
.demands-filter-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }

.honr-card { display: flex; flex-direction: column; gap: 8px; }
.honr-card-title { font-size: 14.5px; font-weight: 700; color: var(--color-text); }
.honr-card-obj { font-size: 12.5px; color: var(--color-text-secondary); line-height: 1.5; margin: 0; }
.honr-card-meta { font-size: 11.5px; color: var(--color-text-secondary); display: flex; gap: 6px; align-items: flex-start; }
.honr-card-divider { border-top: 1px solid var(--color-border); margin: 6px 0 2px; }
.dark .honr-card-divider { border-color: #334155; }
.honr-empty-box { text-align: center; padding: 14px; color: #9CA3AF; font-size: 12.5px; font-style: italic; background: var(--color-bg-subtle); border-radius: var(--radius-sm); }
.dark .honr-empty-box { background: #0f172a; }

.demand-card { display: flex; justify-content: space-between; gap: 16px; background: var(--color-white); border: 1px solid var(--color-border); border-left: 3px solid #9CA3AF; border-radius: var(--radius-md); padding: 16px 18px; margin-bottom: 12px; flex-wrap: wrap; box-shadow: var(--shadow-xs); }
.dark .demand-card { background: #1e293b; border-color: #334155; }
.demand-card.dc-triagem { border-left-color: var(--color-warning); }
.demand-card.dc-redacao { border-left-color: var(--color-primary); }
.demand-card.dc-orgao { border-left-color: #f97316; }
.demand-card.dc-resolved { border-left-color: var(--color-success); }
.demand-card.dc-overdue { border-left-color: var(--color-error); }
.dc-main { flex: 1; min-width: 240px; }
.dc-badges-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.dc-title { font-size: 14.5px; font-weight: 700; margin: 8px 0 6px; color: var(--color-text); }
.dc-meta-row { font-size: 12.5px; color: var(--color-text-secondary); display: flex; gap: 14px; flex-wrap: wrap; }
.dc-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.dc-actions-label { font-size: 10px; font-weight: 700; color: #9CA3AF; text-transform: uppercase; letter-spacing: .04em; }
.dc-actions-btns { display: flex; gap: 6px; align-items: center; }

.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.dot-amber { background: var(--color-warning); }
.dot-blue { background: var(--color-primary); }
.dot-orange { background: #ea580c; }
.dot-emerald { background: var(--color-success); }
.dot-slate { background: var(--color-text-secondary); }
.dot-rose { background: var(--color-error); }

/* ===================== PAGE HEADER BOX (screens redesign) ===================== */
.page-header-box {
  background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 22px 26px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
  box-shadow: var(--shadow-xs);
}
.dark .page-header-box { background: #1e293b; border-color: #334155; }
.page-header-box h1 { font-size: 22px; font-weight: 700; margin: 0 0 6px; display:flex; align-items:center; gap:10px; color: var(--color-text); }
.page-header-box p { margin: 0; color: var(--color-text-secondary); font-size: 13.5px; max-width: 620px; }
.page-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.toolbar-box {
  background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 14px 16px;
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px;
}
.dark .toolbar-box { background: #1e293b; border-color: #334155; }
.toolbar-box .search-input-wrap { flex: 2; min-width: 260px; }
.toolbar-box select { min-width: 170px; }

.btn-purple { background: #6d28d9; color: #fff; }
.btn-purple:hover { background: #5b21b6; }
.btn-green { background: var(--color-success); color: #fff; }
.btn-green:hover { background: #15803D; }
.btn-navy { background: var(--color-text); color: #fff; }
.btn-navy:hover { background: #111827; }
.btn-outline-green { display: inline-flex; align-items: center; gap: 6px; background: #ECFDF3; color: #15803D; border: 1px solid #86EFAC; font-weight: 600; border-radius: 999px; box-shadow: 0 1px 2px rgba(5,150,105,0.06); transition: background .15s, color .15s, box-shadow .15s; }
.btn-outline-green:hover:not(:disabled) { background: var(--color-success); color: #fff; border-color: var(--color-success); box-shadow: 0 2px 8px rgba(5,150,105,0.28); }
.btn-outline-green:disabled { box-shadow: none; }
.dark .btn-outline-green { background: #052e18; color: #6ee7b7; border-color: #15803d; }
.dark .btn-outline-green:hover:not(:disabled) { background: var(--color-success); color: #fff; border-color: var(--color-success); }
.btn-sm-full { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; }
.btn-pill-green { display: inline-flex; align-items: center; gap: 6px; background: var(--color-success); color: #fff; border: none; border-radius: 999px; font-weight: 600; font-size: 12px; padding: 6px 14px; box-shadow: 0 1px 2px rgba(5,150,105,0.15); transition: background .15s, box-shadow .15s; cursor: pointer; }
.btn-pill-green:hover { background: #15803D; box-shadow: 0 2px 8px rgba(5,150,105,.3); }

.btn-softcam {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px 9px 10px;
  background: #EEF2FF; color: #4338CA; border: 1px solid #C7D2FE; border-radius: 999px;
  font-weight: 600; font-size: 13px; text-decoration: none; cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s, border-color .15s, transform .15s;
}
.btn-softcam-icon { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: #E0E7FF; color: #4F46E5; flex-shrink: 0; transition: background .15s, color .15s; }
.btn-softcam-ext { opacity: .55; transition: opacity .15s; }
.btn-softcam:hover { background: #4F46E5; color: #fff; border-color: #4F46E5; box-shadow: 0 4px 12px rgba(79,70,229,.32); transform: translateY(-1px); }
.btn-softcam:hover .btn-softcam-icon { background: rgba(255,255,255,.2); color: #fff; }
.btn-softcam:hover .btn-softcam-ext { opacity: .9; }
.dark .btn-softcam { background: #1e1b4b; color: #c7d2fe; border-color: #3730a3; }
.dark .btn-softcam-icon { background: #312e81; color: #a5b4fc; }
.dark .btn-softcam:hover { background: #4F46E5; color: #fff; border-color: #4F46E5; }
.dark .btn-softcam:hover .btn-softcam-icon { background: rgba(255,255,255,.2); color: #fff; }

.inline-status-select {
  width: 100%; font-weight: 700; font-size: 12px; padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--color-white); border: 1.5px solid var(--color-border);
}
.dmd-doc-select {
  width: 100%; font-size: 11.5px; padding: 5px 6px; border-radius: var(--radius-sm);
  background: var(--color-white); border: 1.5px solid var(--color-border); max-width: 170px;
}
.dark .dmd-doc-select { background: #0f172a; border-color: #334155; color: #f8fafc; }
.dark .inline-status-select { background: #0f172a; }
.inline-status-select.badge-emerald { color: #15803D; border-color: #6ee7b7; }
.inline-status-select.badge-amber { color: #92400e; border-color: #fcd34d; }
.inline-status-select.badge-blue { color: #1e40af; border-color: #93c5fd; }
.inline-status-select.badge-indigo { color: #3730a3; border-color: #a5b4fc; }
.inline-status-select.badge-rose { color: #9f1239; border-color: #fda4af; }
.inline-status-select.badge-slate { color: #334155; border-color: #cbd5e1; }
.dark .inline-status-select.badge-emerald { color: #6ee7b7; border-color: #15803d; }
.dark .inline-status-select.badge-amber { color: #fbbf24; border-color: #92400e; }
.dark .inline-status-select.badge-blue { color: #93c5fd; border-color: #1d4ed8; }
.dark .inline-status-select.badge-indigo { color: #c7d2fe; border-color: #4338ca; }
.dark .inline-status-select.badge-rose { color: #fda4af; border-color: #9f1239; }
.dark .inline-status-select.badge-slate { color: #e2e8f0; border-color: #475569; }
.inline-status-hint { font-size: 10.5px; color: #94a3b8; margin-top: 4px; }
.inline-obs-textarea {
  width: 100%; min-height: 60px; font-size: 12.5px; padding: 8px 10px; border-radius: 8px; border: 1px solid #e2e8f0;
}
.parecer-relator-fixed {
  width: 100%; margin-top: 6px; font-size: 12px; padding: 7px 10px; border-radius: 8px;
  background: #f8fafc; border: 1px solid #e2e8f0; color: #475569; cursor: default;
}
.dark .parecer-relator-fixed { background: #0f172a; border-color: #334155; color: #cbd5e1; }
.parecer-relator-fixed strong { color: inherit; }
.origin-cell { font-size: 12.5px; color: #64748b; font-style: italic; }
.link-cell { display: flex; flex-direction: column; gap: 6px; min-width: 160px; }
.link-cell .btn { justify-content: center; font-size: 12px; padding: 8px 12px; }
.pl-number-badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 6px; font-size: 11px; font-weight: 700; background: #f1f5f9; color: #334155; margin-right: 6px; }
.dark .pl-number-badge { background: #334155; color: #e2e8f0; }
.pl-type-badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 6px; font-size: 10.5px; font-weight: 700; background: #eef2ff; color: #4338ca; }
.dark .pl-type-badge { background: #312e81; color: #c7d2fe; }
.row-title-cell strong { display: block; font-size: 14px; margin: 6px 0 2px; }
.row-title-cell .sub { font-size: 11.5px; color: #94a3b8; display: block; margin-top: 2px; }

/* group headers (contacts) */
.contact-group { background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 20px; }
.dark .contact-group { background: #1e293b; border-color: #334155; }
.contact-group-header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; font-weight: 700; font-size: 14px; }
.contact-group-header.dinho { background: #EFF4FF; color: #1e3a8a; border-bottom: 1px solid #bfdbfe; }
.dark .contact-group-header.dinho { background: #0f1f47; color: #bfdbfe; border-bottom-color: #1e3a8a; }
.contact-group-header.external { background: var(--color-bg-subtle); color: var(--color-text); border-bottom: 1px solid var(--color-border); }
.dark .contact-group-header.external { background: #0f172a; color: #f1f5f9; border-color: #334155; }
.contact-group-count { background: rgba(0,0,0,.06); padding: 1px 9px; border-radius: 999px; font-size: 12px; }
.dark .contact-group-count { background: rgba(255,255,255,.12); }
.contact-group table { border: none; }
.avatar-circle { width: 32px; height: 32px; border-radius: 50%; background: var(--color-primary-soft); color: var(--color-primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; margin-right: 8px; }
.dark .avatar-circle { background: #172554; color: #93c5fd; }
.pagination-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; font-size: 12.5px; color: var(--color-text-secondary); }
.page-nav-btn { width: 28px; height: 28px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); background: var(--color-white); display: inline-flex; align-items: center; justify-content: center; }
.dark .page-nav-btn { background: #334155; border-color: #475569; }

/* calendar month grid */
.cal-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .cal-layout { grid-template-columns: 1fr; } }
.cal-card { background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-xs); }
.dark .cal-card { background: #1e293b; border-color: #334155; }
.cal-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-card-header h3 { font-size: 16px; font-weight: 700; margin: 0; text-transform: capitalize; color: var(--color-text); }
.cal-nav-btn { width: 30px; height: 30px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); background: var(--color-white); display: inline-flex; align-items: center; justify-content: center; transition: background var(--transition-fast); }
.cal-nav-btn:hover { background: var(--color-bg-subtle); }
.dark .cal-nav-btn { background: #334155; border-color: #475569; color: #f1f5f9; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-dow { text-align: center; font-size: 11px; font-weight: 700; color: #9CA3AF; padding: 8px 0; text-transform: uppercase; }
.cal-day {
  min-height: 78px; border-radius: var(--radius-sm); padding: 6px; cursor: pointer; position: relative;
  border: 1px solid transparent; transition: background .12s;
}
.cal-day:hover { background: var(--color-bg-subtle); }
.dark .cal-day:hover { background: #263449; }
.cal-day.other-month .cal-day-num { color: #cbd5e1; }
.dark .cal-day.other-month .cal-day-num { color: #475569; }
.cal-day.selected { background: var(--color-primary-soft); border-color: #bfdbfe; }
.dark .cal-day.selected { background: #1e3a5f; border-color: #3b5f82; }
.cal-day-num { font-size: 13px; font-weight: 600; color: var(--color-text); }
.cal-day.today .cal-day-num {
  background: var(--color-primary); color: #fff; width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}
.cal-day-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--color-primary); display: inline-block; margin-top: 3px; margin-right: 2px; }

.cal-view-toggle { display: inline-flex; gap: 4px; background: var(--color-bg-subtle); border-radius: var(--radius-sm); padding: 3px; margin-bottom: 14px; }
.dark .cal-view-toggle { background: #0f172a; }
.cal-view-btn { font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 6px; color: var(--color-text-secondary); background: transparent; transition: background .12s, color .12s; }
.cal-view-btn:hover { color: var(--color-text); }
.cal-view-btn.active { background: var(--color-white); color: var(--color-primary); box-shadow: var(--shadow-xs); }
.dark .cal-view-btn.active { background: #334155; color: #93c5fd; }

.cal-range-grid { display: grid; gap: 8px; }
.cal-range-grid-7 { grid-template-columns: repeat(7, 1fr); }
.cal-range-grid-15 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 900px) { .cal-range-grid-7, .cal-range-grid-15 { grid-template-columns: repeat(3, 1fr); } }
.cal-range-day {
  min-height: 96px; border-radius: var(--radius-sm); padding: 8px; cursor: pointer;
  border: 1px solid var(--color-border); transition: background .12s, border-color .12s;
}
.cal-range-day:hover { background: var(--color-bg-subtle); }
.dark .cal-range-day { border-color: #334155; }
.dark .cal-range-day:hover { background: #263449; }
.cal-range-day.selected { background: var(--color-primary-soft); border-color: #bfdbfe; }
.dark .cal-range-day.selected { background: #1e3a5f; border-color: #3b5f82; }
.cal-range-day-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-range-dow { font-size: 10px; font-weight: 700; color: #9CA3AF; text-transform: uppercase; }
.cal-range-num { font-size: 13px; font-weight: 600; color: var(--color-text); }
.cal-range-day.today .cal-range-num {
  background: var(--color-primary); color: #fff; width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11px;
}
.cal-range-events { display: flex; flex-direction: column; gap: 3px; }
.cal-range-chip {
  font-size: 10.5px; font-weight: 600; color: var(--color-primary); background: var(--color-primary-soft);
  border-radius: 4px; padding: 2px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dark .cal-range-chip { background: #1e3a5f; color: #93c5fd; }
.cal-range-more { font-size: 10px; font-weight: 700; color: #9CA3AF; padding: 1px 5px; }
.cal-side-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.cal-side-header strong { font-size: 12.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--color-text-secondary); }
.cal-side-header span { font-size: 11.5px; color: #9CA3AF; }
.dark .cal-side-header strong { color: #cbd5e1; }
.cal-side-date { font-weight: 600; font-size: 14px; margin: 10px 0 14px; text-transform: capitalize; color: var(--color-text); }
.cal-event-item { padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; transition: border-color var(--transition-fast); }
.dark .cal-event-item { border-color: #334155; }
.cal-event-item:hover { border-color: var(--color-primary); }
.cal-event-time { font-size: 11px; font-weight: 700; color: var(--color-primary); }
.dark .cal-event-time { color: #93c5fd; }
.cal-event-title { font-size: 13px; font-weight: 600; margin-top: 3px; color: var(--color-text); }

/* dark-header modal variant */
.modal-box.modal-dark-top { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.modal-header-dark {
  background: #1F2937; color: #fff; padding: 20px 24px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-shrink: 0;
}
.modal-header-dark h3 { color: #fff; margin: 0 0 4px; font-size: 17px; }
.modal-header-dark p { color: #c9d6e8; margin: 0; font-size: 12.5px; }
.modal-header-dark .modal-close { position: static; background: rgba(255,255,255,.12); color: #fff; }
.modal-body-pad { padding: 22px 24px; overflow-y: auto; flex: 1 1 auto; }
.field-label-caps { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-secondary); margin-bottom: 6px; display: block; }
.dark .field-label-caps { color: #94a3b8; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: #334155; margin: 4px 0 14px; }
.dark .checkbox-row { color: #cbd5e1; }

/* ---- New Demand form: protocol box, section headers, origin toggle, upload ---- */
.protocol-info-box { background: var(--color-bg-subtle); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.dark .protocol-info-box { background: #0f172a; border-color: #334155; }
.protocol-info-box .protocol-number { font-size: 18px; font-weight: 700; color: var(--color-text); margin-top: 3px; }
.dark .protocol-info-box .protocol-number { color: #f8fafc; }
.protocol-badge-navy { background: var(--color-primary); color: #fff; padding: 6px 14px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 700; letter-spacing: .03em; white-space: nowrap; }

.form-section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 22px 0 14px; }
.form-section-title.first { margin-top: 0; }
.fst-left { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .03em; color: var(--color-text); text-transform: uppercase; }
.dark .fst-left { color: #e2e8f0; }
.fst-num { width: 22px; height: 22px; border-radius: 50%; background: var(--color-primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.ai-badge { background: var(--color-text); color: #fff; padding: 5px 12px; border-radius: 999px; font-size: 10.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }

.origin-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.origin-toggle-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); background: var(--color-white); font-weight: 600; font-size: 13px; color: var(--color-text-secondary); cursor: pointer; transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast); }
.dark .origin-toggle-btn { background: #0f172a; border-color: #334155; color: #cbd5e1; }
.origin-toggle-btn.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.readonly-info-field { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-bg-subtle); font-size: 13px; font-weight: 600; color: var(--color-text); }
.dark .readonly-info-field { background: #0f172a; border-color: #334155; color: #cbd5e1; }

.upload-dropzone { border: 2px dashed var(--color-border); border-radius: var(--radius-md); padding: 26px; text-align: center; cursor: pointer; color: var(--color-text-secondary); font-size: 12.5px; font-weight: 600; transition: border-color var(--transition-fast), background var(--transition-fast); }
.upload-dropzone:hover { border-color: var(--color-primary); background: var(--color-primary-soft); }
.dark .upload-dropzone { border-color: #475569; }
.dark .upload-dropzone:hover { background: #0f172a; }
.upload-dropzone svg { display: block; margin: 0 auto 8px; opacity: .5; }
.dash-event-list { display: flex; flex-direction: column; gap: 8px; }
.dash-event-row { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-md); cursor: pointer; transition: border-color var(--transition-fast), background var(--transition-fast); }
.dash-event-row:hover { border-color: var(--color-primary); background: var(--color-primary-soft); }
.dark .dash-event-row { border-color: #334155; }
.dark .dash-event-row:hover { background: #0f172a; }
.dash-event-time { display: flex; align-items: baseline; background: var(--color-primary-soft); color: var(--color-primary); border-radius: var(--radius-sm); padding: 7px 10px; font-weight: 700; flex-shrink: 0; min-width: 60px; justify-content: center; }
.dash-event-time .t-hh { font-size: 15px; }
.dash-event-time .t-mm { font-size: 12px; opacity: .85; }
.dash-event-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dash-event-body strong { font-size: 13.5px; color: var(--color-text); }
.dash-event-loc { font-size: 11.5px; color: var(--color-text-secondary); }
.dark .dash-event-loc { color: #94a3b8; }
.upload-preview-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.upload-preview-item { position: relative; width: 74px; height: 74px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--color-border); }
.upload-preview-item img { width: 100%; height: 100%; object-fit: cover; }

.dash-quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.dash-quick-action-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 16px 10px;
  cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--color-text); text-align: center;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}
.dash-quick-action-btn:hover { background: var(--color-primary-soft); border-color: var(--color-primary); transform: translateY(-2px); }
.dark .dash-quick-action-btn { background: #0f172a; border-color: #334155; color: #f8fafc; }
.dark .dash-quick-action-btn:hover { background: #1e293b; }
.dash-quick-action-btn .dqa-icon { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; }
.dash-quick-action-btn .dqa-icon svg { width: 20px; height: 20px; }
@media (max-width: 640px) { .dash-quick-actions { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); } }

.dash-pie-wrap { display: flex; align-items: center; gap: 32px; flex-wrap: wrap; }
.dash-pie-svg { flex-shrink: 0; }
.dash-pie-legend { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 8px; }
.dash-pie-legend-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.dash-pie-swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.dash-pie-legend-name { flex: 1; font-weight: 500; color: var(--color-text); }
.dark .dash-pie-legend-name { color: #f8fafc; }
.dash-pie-legend-count { font-weight: 600; color: var(--color-text); white-space: nowrap; }
.dark .dash-pie-legend-count { color: #f8fafc; }
@media (max-width: 640px) { .dash-pie-wrap { flex-direction: column; align-items: flex-start; } }

.dash-widgets-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .dash-widgets-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .dash-widgets-grid { grid-template-columns: 1fr; } }

.dash-bar-list { display: flex; flex-direction: column; gap: 12px; }
.dash-bar-row { display: grid; grid-template-columns: 100px 1fr 70px; align-items: center; gap: 10px; }
.dash-bar-label { font-size: 13px; font-weight: 600; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-bar-track { height: 8px; border-radius: 999px; background: var(--color-bg-subtle); overflow: hidden; }
.dark .dash-bar-track { background: #334155; }
.dash-bar-fill { height: 100%; border-radius: 999px; }
.dash-bar-value { font-size: 12px; font-weight: 700; color: var(--color-text); text-align: right; white-space: nowrap; }

.dash-widget-link { display: inline-block; margin-top: 14px; font-size: 13px; font-weight: 600; color: var(--color-primary); text-decoration: none; }
.dash-widget-link:hover { text-decoration: underline; }

.dash-donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.dash-donut-svg-wrap { position: relative; width: 150px; height: 150px; flex-shrink: 0; }
.dash-donut-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; display: flex; flex-direction: column; align-items: center; }
.dash-donut-center strong { font-size: 22px; font-weight: 800; color: var(--color-text); line-height: 1.1; }
.dash-donut-center span { font-size: 11px; color: #94a3b8; }
.dash-donut-legend { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 8px; }
.dash-donut-legend-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.dash-donut-legend-name { flex: 1; font-weight: 600; color: var(--color-text); white-space: nowrap; }
.dash-donut-legend-count { white-space: nowrap; }

.photo-view-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 4px; }
.photo-view-item { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid #e2e8f0; aspect-ratio: 4/3; background: #f1f5f9; }
.dark .photo-view-item { border-color: #334155; background: #0f172a; }
.photo-view-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-view-download { position: absolute; bottom: 6px; right: 6px; background: rgba(15,23,42,.75); color: #fff; border-radius: 6px; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; text-decoration: none; line-height: 1; }
.photo-view-download:hover { background: rgba(15,23,42,.92); }
.upload-preview-remove { position: absolute; top: 2px; right: 2px; background: rgba(15,23,42,.75); color: #fff; border: none; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; line-height: 1; cursor: pointer; }

.of-history-list { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.of-history-item { display: flex; gap: 10px; align-items: flex-start; }
.of-history-dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--color-primary); margin-top: 5px; }
.dark .of-history-dot { background: #93c5fd; }
.of-history-action { font-size: 13px; font-weight: 600; color: var(--color-text); line-height: 1.4; }
.dark .of-history-action { color: #f8fafc; }
.of-history-meta { font-size: 11px; color: #9CA3AF; margin-top: 1px; }

/* ---- Demand list: table row layout (adapted from Projetos de Lei grid) ---- */
.dmd-title-cell strong { display: block; font-size: 14px; margin: 6px 0 2px; }
.dmd-title-cell .sub { font-size: 11.5px; color: #94a3b8; display: block; margin-top: 2px; }
.dmd-org-prazo { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.dmd-org-prazo .dmd-prazo-date { font-weight: 700; }
.dmd-org-prazo .dmd-prazo-date.overdue { color: #dc2626; }
.dmd-contact-cell { font-size: 12.5px; }
.dmd-contact-cell .sub { color: #94a3b8; }
.dmd-stage-info { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.dmd-stage-sub { font-size: 11px; }

.btn-whatsapp-followup { margin-top: 6px; display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 7px; background: #e8f9ef; color: #0f7a3d; border: 1px solid #86efac; font-size: 10.5px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.btn-whatsapp-followup:hover { background: #d3f5e0; }
.dark .btn-whatsapp-followup { background: #052e18; color: #6ee7b7; border-color: #15803d; }
.btn-whatsapp-followup.pulse-alert { background: #fef2f2; color: #b91c1c; border-color: #fca5a5; animation: dmdPulseAlert 1.5s infinite; }
.dark .btn-whatsapp-followup.pulse-alert { background: #450a0a; color: #fca5a5; border-color: #b91c1c; }
@keyframes dmdPulseAlert {
  0% { box-shadow: 0 0 0 0 rgba(220,38,38,.55); }
  70% { box-shadow: 0 0 0 7px rgba(220,38,38,0); }
  100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); }
}

/* ===================== DARK MODE OPTIMIZATIONS ===================== */
/* Utility classes replacing hardcoded inline colors so text/backgrounds
   adapt correctly when the "modo noturno" theme is active. */
.heading-navy { color: #2563EB; }
.dark .heading-navy { color: #93c5fd; }
.heading-pink { color: #ec4899; }
.dark .heading-pink { color: #f9a8d4; }
.text-danger-strong { color: #dc2626; }
.dark .text-danger-strong { color: #fca5a5; }
.card-subtle-bg { background: #f8fafc; }
.dark .card-subtle-bg { background: #0f172a; }
.select-navy-strong { font-weight: 700; color: #2563EB; }
.dark .select-navy-strong { color: #93c5fd; }

.info-box-indigo { background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 10px; padding: 12px 14px; color: inherit; }
.dark .info-box-indigo { background: #1e1b4b; border-color: #4338ca; }
.info-box-slate { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 14px; color: inherit; }
.dark .info-box-slate { background: #0f172a; border-color: #334155; }
.info-box-amber { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; color: #92400e; }
.dark .info-box-amber { background: #451a03; border-color: #92400e; color: #fde68a; }

/* ===================== MAPA - Local da Demanda (picker) ===================== */
.map-picker-hint { margin: 0 0 8px; font-size: 12.5px; }
.map-picker {
  width: 100%; height: 240px; border-radius: 12px; border: 1px solid #e2e8f0;
  overflow: hidden; margin-bottom: 6px; background: #f1f5f9; cursor: crosshair;
}
.dark .map-picker { border-color: #334155; background: #0f172a; }
.map-picker-status {
  font-size: 12px; font-weight: 600; color: var(--color-text); background: #ECFDF3;
  border: 1px solid #bbf7d0; border-radius: var(--radius-sm); padding: 7px 12px; margin-bottom: 14px;
}
.dark .map-picker-status { background: #052e1a; border-color: #14532d; color: #bbf7d0; }
.map-picker .leaflet-popup-content-wrapper,
.territorial-map .leaflet-popup-content-wrapper { border-radius: 10px; }

/* ---- Demand detail view (read-only): map, photo gallery, description box ---- */
.dd-detail-map { height: 220px; margin: 4px 0 22px; cursor: default; }
.dd-protocol-highlight { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; background: var(--color-primary-soft); border: 1px solid #BFDBFE; border-radius: var(--radius-md); padding: 12px 16px; margin: 4px 0 18px; }
.dark .dd-protocol-highlight { background: #1e3a5f; border-color: #2563EB; }
.dd-protocol-highlight-num { font-size: 14px; font-weight: 800; letter-spacing: .02em; color: var(--color-primary); }
.dark .dd-protocol-highlight-num { color: #93c5fd; }
.dd-protocol-highlight-sep { color: var(--color-text-secondary); }
.dd-protocol-highlight-subj { font-size: 14px; font-weight: 600; color: var(--color-text); }
.dd-note-box { background: var(--color-bg-subtle); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 14px 16px; margin-top: 4px; }
.dark .dd-note-box { background: #0f172a; border-color: #334155; }
.dd-note-box p { margin: 4px 0 0; font-size: 13.5px; line-height: 1.55; color: var(--color-text); white-space: pre-wrap; }
.dd-photo-block { margin-top: 16px; }
.dd-photo-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--color-primary-soft); color: var(--color-primary); font-size: 10.5px; font-weight: 700; margin-left: 6px; }
.dark .dd-photo-count { background: #1e3a8a; color: #bfdbfe; }
.dd-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-top: 10px; }
.dd-photo-item { position: relative; display: block; aspect-ratio: 1 / 1; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--color-border); }
.dd-photo-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.dd-photo-item:hover img { transform: scale(1.06); }
.dd-photo-zoom { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; background: rgba(15,23,42,0); opacity: 0; transition: background .15s, opacity .15s; }
.dd-photo-item:hover .dd-photo-zoom { background: rgba(15,23,42,.35); opacity: 1; }

/* ===================== MAPA TERRITORIAL (aba Maps) ===================== */
.territorial-map-wrap { display: flex; flex-direction: column; gap: 12px; height: calc(100vh - 160px); min-height: 480px; }
.territorial-map-filters { display: flex; gap: 12px; flex-wrap: wrap; }
.territorial-map-filters .filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 180px; }
.territorial-map-filters label { font-size: 11.5px; font-weight: 700; color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: .03em; }
.territorial-map-filters select {
  padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); font-size: 13px; background: var(--color-white); color: var(--color-text);
}
.dark .territorial-map-filters select { background: #1e293b; border-color: #334155; color: #f8fafc; }
.territorial-map-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; font-weight: 600; color: var(--color-text-secondary); }
.dark .territorial-map-legend { color: #cbd5e1; }
.territorial-map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.territorial-map-legend i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.territorial-map { flex: 1; width: 100%; min-height: 420px; border-radius: var(--radius-md); border: 1px solid var(--color-border); overflow: hidden; }
.dark .territorial-map { border-color: #334155; }
