/* ==========================================================================
   SisOC-DF — Sistema de Rastreio e Gestão de OCs
   
   Visual institucional · Concebido e desenvolvido por Glauco Gonçalves - GEFIN/COAFO/SODF
   ========================================================================== */

:root,
[data-theme="light"] {
  --bg-app: #F3F4F6;
  --bg-surface: #FFFFFF;
  --bg-surface-elevated: #F7F8FA;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F3F5F8;
  --bg-input: #FFFFFF;

  --border-subtle: #DCE0E6;
  --border-soft: #ECEEF2;
  --border-hover: #A9B3C1;
  --border-focus: #1C5FAA;
  --focus-ring: 0 0 0 3px rgba(28, 95, 170, 0.18);

  --text-primary: #172131;
  --text-secondary: #4A5565;
  --text-muted: #6B7483;

  --gov-navy: #0E2A47;
  --gov-navy-deep: #0A1F36;
  --gov-gold: #D9A400;
  --nav-text: #C9D4E2;

  --brand-blue: #1C5FAA;
  --brand-blue-hover: #174F8F;
  --brand-blue-bg: #EEF3FA;
  --brand-gradient: #1C5FAA;

  --color-emerald: #1B6E3F;
  --color-emerald-bg: #E5F3EA;
  --color-emerald-border: #B9DEC6;

  --color-rose: #A3261A;
  --color-rose-bg: #FCEBE9;
  --color-rose-border: #F2C4BE;

  --color-amber: #8A5300;
  --color-amber-bg: #FFF3DB;
  --color-amber-border: #F1D7A0;

  --color-indigo: #1C5FAA;
  --color-indigo-bg: #EEF3FA;
  --color-indigo-border: #C4D5EC;

  --shadow-sm: 0 1px 2px rgba(10, 31, 54, 0.04);
  --shadow-md: 0 4px 12px rgba(10, 31, 54, 0.08);
  --shadow-lg: 0 20px 48px rgba(10, 31, 54, 0.22);
  --shadow-card: 0 1px 2px rgba(10, 31, 54, 0.04);

  --radius: 4px;
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --transition-fast: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
  --transition-smooth: var(--transition-fast);
}

[data-theme="dark"] {
  --bg-app: #0B1724;
  --bg-surface: #102133;
  --bg-surface-elevated: #14283D;
  --bg-card: #102133;
  --bg-card-hover: #183049;
  --bg-input: #0D1C2C;

  --border-subtle: #22394F;
  --border-soft: #1A3045;
  --border-hover: #3A5470;
  --border-focus: #5B9BE0;
  --focus-ring: 0 0 0 3px rgba(91, 155, 224, 0.25);

  --text-primary: #E8EEF5;
  --text-secondary: #A9B8CB;
  --text-muted: #8496AC;

  --gov-navy: #081726;
  --gov-navy-deep: #06111D;
  --nav-text: #A9B8CB;

  --brand-blue: #3C7FCB;
  --brand-blue-hover: #4A8DD8;
  --brand-blue-bg: rgba(60, 127, 203, 0.14);
  --brand-gradient: #3C7FCB;

  --color-emerald: #5CC48A;
  --color-emerald-bg: rgba(92, 196, 138, 0.12);
  --color-emerald-border: rgba(92, 196, 138, 0.3);

  --color-rose: #F08A7E;
  --color-rose-bg: rgba(240, 138, 126, 0.12);
  --color-rose-border: rgba(240, 138, 126, 0.32);

  --color-amber: #E8B44E;
  --color-amber-bg: rgba(232, 180, 78, 0.12);
  --color-amber-border: rgba(232, 180, 78, 0.32);

  --color-indigo: #7FAEE6;
  --color-indigo-bg: rgba(127, 174, 230, 0.12);
  --color-indigo-border: rgba(127, 174, 230, 0.3);

  --shadow-sm: none;
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.5);
  --shadow-card: none;
}

/* ===================== RESET & BASE ===================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand-blue);
  text-decoration: none;
}

a:hover {
  color: var(--brand-blue-hover);
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

/* Faixa institucional GDF */
.gov-strip {
  background: var(--gov-navy-deep);
  color: #E6ECF3;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 7px 28px;
  border-bottom: 3px solid var(--gov-gold);
}

.gov-strip-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.gov-strip strong {
  letter-spacing: .08em;
  font-weight: 700;
}

.gov-strip-sep {
  opacity: .45;
}

.gov-strip-right {
  opacity: .8;
}

/* ===================== LOGIN ===================== */
.login-container {
  min-height: 100vh;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
}

.login-aside {
  background: var(--gov-navy);
  color: #fff;
  padding: 56px clamp(28px, 6vw, 80px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
}

.login-aside-content {
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 520px;
}

.login-aside-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-aside-brand .brand-mark {
  width: 40px;
  height: 40px;
  font-size: 14px;
}

.login-aside-brand-name {
  display: flex;
  flex-direction: column;
}

.login-aside-brand-name span:first-child {
  font-size: 20px;
  font-weight: 700;
}

.login-aside-brand-name span:last-child {
  font-size: 12px;
  color: #A9B8CB;
}

.login-aside h1 {
  font-size: clamp(30px, 3.4vw, 42px);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -.02em;
  text-wrap: balance;
}

.login-aside p {
  font-size: 16px;
  line-height: 1.6;
  color: var(--nav-text);
  text-wrap: pretty;
}

.login-aside-params {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, .18);
}

.login-aside-params div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.login-aside-params span:first-child {
  font-size: 11px;
  letter-spacing: .08em;
  color: #A9B8CB;
}

.login-aside-params span:last-child {
  font-family: var(--font-mono);
  font-size: 15px;
}

.login-aside-credit {
  font-size: 12px;
  color: #A9B8CB;
}

.brand-mark {
  border: 1.5px solid rgba(255, 255, 255, .5);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: var(--bg-surface);
}

.login-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.login-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-header h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-label-row {
  display: flex;
  justify-content: space-between;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-field {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition-fast);
}

select.input-field {
  padding: 0 10px;
}

.input-with-icon .input-field {
  padding-left: 38px;
  padding-right: 44px;
  height: 44px;
  font-size: 15px;
}

.input-field:hover {
  border-color: var(--border-hover);
}

.input-field:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--focus-ring);
}

.input-field::placeholder {
  color: var(--text-muted);
}

.btn-toggle-pass {
  position: absolute;
  right: 6px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-toggle-pass:hover {
  color: var(--brand-blue);
  background: var(--brand-blue-bg);
}

.btn-toggle-pass svg {
  width: 17px;
  height: 17px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  background: var(--brand-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-primary:hover {
  background: var(--brand-blue-hover);
}

.btn-login {
  width: 100%;
  margin-top: 4px;
}

.login-footer-security {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.login-footer-security svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--text-muted);
}

/* ===================== ESTRUTURA DO APP ===================== */
.app-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.app-sidebar {
  background: var(--gov-navy);
  color: var(--nav-text);
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px;
}

.sidebar-brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark-img {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  object-fit: contain;
  flex-shrink: 0;
}

.login-aside-brand .brand-mark-img {
  width: 44px;
  height: 44px;
}

.btn-toggle-sidebar {
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: var(--radius);
  color: var(--nav-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.btn-toggle-sidebar:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff;
  border-color: rgba(255, 255, 255, .3);
}

.btn-toggle-sidebar svg {
  transition: transform .2s ease;
}

.sidebar-brand .brand-mark {
  width: 34px;
  height: 34px;
  font-size: 12px;
}

.sidebar-brand-name {
  display: flex;
  flex-direction: column;
}

.sidebar-brand-name strong {
  font-size: 16px;
  color: #fff;
}

.sidebar-brand-name span {
  font-size: 11px;
  color: #8FA2BA;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .1em;
  color: #7F93AD;
  padding: 0 10px 6px;
}

.sidebar-label+.sidebar-link {
  margin-top: 0;
}

.sidebar-nav .sidebar-label:not(:first-child) {
  padding-top: 18px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--nav-text);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-fast);
}

.sidebar-link svg {
  flex-shrink: 0;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, .06);
  color: #fff;
}

.sidebar-link.active {
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-weight: 500;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, .12);
  padding: 16px 8px 0;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gov-gold);
  color: var(--gov-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  font-size: 11.5px;
  color: #8FA2BA;
}

.sidebar-actions {
  display: flex;
  gap: 8px;
}

.sidebar-actions .btn-icon {
  background: transparent;
  border-color: rgba(255, 255, 255, .2);
  color: var(--nav-text);
}

.sidebar-actions .btn-icon:hover {
  background: rgba(255, 255, 255, .06);
  color: #fff;
  border-color: rgba(255, 255, 255, .35);
}

.btn-logout-full {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: var(--radius);
  color: var(--nav-text);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-logout-full:hover {
  background: rgba(255, 255, 255, .06);
  color: #fff;
}

.btn-icon {
  width: 36px;
  height: 36px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.btn-icon:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ===================== CABEÇALHO DA PÁGINA ===================== */
.main-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.breadcrumb {
  display: flex;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.breadcrumb-sep {
  opacity: .6;
}

.header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.header-left h1 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.2;
}

.header-parameters {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 13px;
  color: var(--text-secondary);
}

.param-tag {
  display: flex;
  gap: 5px;
  align-items: baseline;
}

.param-lbl {
  color: var(--text-muted);
}

.param-val {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.header-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Logo Oficial no Cabeçalho */
.header-branding-group {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.header-logo-container {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header-logo-img {
  height: 46px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  display: block;
}

.header-logo-dark {
  display: none;
}

[data-theme="dark"] .header-logo-light {
  display: none;
}

[data-theme="dark"] .header-logo-dark {
  display: block;
}

.header-branding-divider {
  width: 1px;
  height: 42px;
  background: var(--border-subtle);
  opacity: .8;
}

.header-text-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ===================== CONTEÚDO ===================== */
.main-container {
  width: 100%;
  max-width: 1480px;
  padding: 24px 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.alert-banner-pro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--color-rose-bg);
  border: 1px solid var(--color-rose-border);
  border-radius: var(--radius);
}

.alert-pro-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.alert-pro-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-rose);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

[data-theme="dark"] .alert-pro-icon {
  color: #0B1724;
}

.alert-pro-icon svg {
  width: 16px;
  height: 16px;
}

.alert-pro-text h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-rose);
  margin-bottom: 2px;
}

.alert-pro-text p {
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-alert-pro-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  background: var(--bg-surface);
  color: var(--color-rose);
  border: 1px solid var(--color-rose);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.btn-alert-pro-action:hover {
  background: var(--color-rose);
  color: #fff;
}

/* KPIs — painel único com divisórias */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
}

.kpi-card {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-right: 1px solid var(--border-soft);
}

.kpi-card:last-child {
  border-right: none;
}

.kpi-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kpi-icon-box {
  display: none;
}

.kpi-header::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--brand-blue);
  flex-shrink: 0;
}

.kpi-card-pending .kpi-header::before {
  background: var(--color-rose);
}

.kpi-card-adjust .kpi-header::before {
  background: var(--color-amber);
}

.kpi-card-paid .kpi-header::before {
  background: var(--color-emerald);
}

.kpi-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.kpi-currency {
  font-size: 13px;
  color: var(--text-muted);
}

.kpi-number {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.kpi-value-pending .kpi-number {
  color: var(--color-rose);
}

.kpi-footer {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.kpi-badge {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.kpi-subtext {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Barra de filtros e ações */
/* Barra de filtros e ações em 2 linhas estruturadas */
.controls-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.controls-filters-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
}

.controls-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  width: 100%;
}

.controls-actions-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.controls-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 220px;
}

.search-svg {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input-field {
  width: 100%;
  height: 38px;
  padding: 0 32px 0 34px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13.5px;
  transition: var(--transition-fast);
}

.search-input-field:hover {
  border-color: var(--border-hover);
}

.search-input-field:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--focus-ring);
}

.btn-clear-search {
  position: absolute;
  right: 6px;
  width: 26px;
  height: 26px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
}

.btn-clear-search:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.select-wrapper {
  position: relative;
  flex-shrink: 0;
}

.select-custom {
  appearance: none;
  height: 38px;
  padding: 0 32px 0 12px;
  background: var(--bg-input) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7483' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13.5px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.select-custom:hover {
  border-color: var(--border-hover);
}

.select-custom:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--focus-ring);
}

.date-range-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  height: 38px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  white-space: nowrap;
  flex-shrink: 0;
}

.date-range-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.date-range-sep {
  color: var(--text-muted);
  font-size: 12px;
}

.date-input-custom {
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-mono);
  padding: 2px 4px;
  outline: none;
  cursor: pointer;
  width: 125px;
}

.date-input-custom:focus {
  background: var(--bg-card-hover);
  border-radius: 2px;
}

.btn-reset-filters {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.btn-reset-filters:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.btn-action-primary,
.btn-action-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.btn-action-primary {
  background: var(--brand-blue);
  color: #fff;
  border: 1px solid var(--brand-blue);
}

.btn-action-primary:hover {
  background: var(--brand-blue-hover);
  border-color: var(--brand-blue-hover);
}

.btn-action-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  font-weight: 500;
  padding: 0 14px;
}

.btn-action-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.btn-reset-filters {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-hover);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.btn-reset-filters:hover {
  background: var(--bg-card-hover);
  border-color: var(--color-rose);
  color: var(--color-rose);
}

/* ===================== TABELA DE OCs ===================== */
.datatable-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
}

.datatable-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.datatable-title-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.datatable-title-box h3 {
  font-size: 15px;
  font-weight: 600;
}

.datatable-counter {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 1px 7px;
  border-radius: 3px;
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-soft);
}

.datatable-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.table-container {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-hover) transparent;
}

.table-container::-webkit-scrollbar {
  height: 6px;
}

.table-container::-webkit-scrollbar-track {
  background: transparent;
}

.table-container::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 4px;
}

.pro-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.pro-table th {
  padding: 9px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.pro-table th:first-child,
.pro-table td:first-child {
  padding-left: 14px;
}

.pro-table th:last-child,
.pro-table td:last-child {
  padding-right: 14px;
}

.pro-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  color: var(--text-primary);
}

.pro-table tbody tr:last-child td {
  border-bottom: none;
}

.pro-table tbody tr:hover td {
  background: var(--bg-card-hover);
}

.pro-table tr.row-status-pending td:first-child {
  box-shadow: inset 3px 0 0 var(--color-rose);
}

.oc-doc-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.oc-code-pill {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13.5px;
}

.oc-event-sub {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
}

.cell-currency {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13.5px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.status-pill-select {
  appearance: none;
  height: 30px;
  padding: 0 26px 0 10px;
  border-radius: 3px;
  border: 1px solid transparent;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236B7483' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  transition: var(--transition-fast);
}

.status-pill-select:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

.status-pill-pending {
  background-color: var(--color-rose-bg);
  color: var(--color-rose);
  border-color: var(--color-rose-border);
}

.status-pill-adjust {
  background-color: var(--color-amber-bg);
  color: var(--color-amber);
  border-color: var(--color-amber-border);
}

.status-pill-paid {
  background-color: var(--color-emerald-bg);
  color: var(--color-emerald);
  border-color: var(--color-emerald-border);
}

.status-pill-select option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.ob-resolved-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ob-code-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  background: none;
  border: none;
  padding: 0;
}

.ob-code-pill svg {
  color: var(--color-emerald);
}

.ob-date-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

.ob-pending-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--color-rose);
  font-size: 13px;
  font-weight: 600;
}

.tempo-badge {
  font-size: 13px;
  white-space: nowrap;
  color: var(--text-secondary);
}

.tempo-critical {
  color: var(--color-rose);
  font-weight: 600;
}

.tempo-resolved {
  color: var(--text-muted);
}

.cell-note-input {
  width: 100%;
  height: 32px;
  padding: 0 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--text-primary);
  font-size: 13px;
  transition: var(--transition-fast);
}

.cell-note-input:hover {
  border-color: var(--border-subtle);
  background: var(--bg-input);
}

.cell-note-input:focus {
  outline: none;
  background: var(--bg-input);
  border-color: var(--border-focus);
  box-shadow: var(--focus-ring);
}

.cell-note-input::placeholder {
  color: var(--text-muted);
}

.btn-trail-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 9px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  color: var(--brand-blue);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.btn-trail-action:hover {
  background: var(--brand-blue-bg);
  border-color: var(--brand-blue);
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.app-footer strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ===================== MODAIS ===================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 31, 54, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn .15s ease-out;
}

.modal-box {
  width: 100%;
  max-width: 600px;
  max-height: calc(100vh - 48px);
  background: var(--bg-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scaleUp .18s ease-out;
}

.modal-box-large {
  max-width: 980px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-title-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-blue-bg);
  color: var(--brand-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-title-icon svg {
  width: 18px;
  height: 18px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
}

/* Abas sublinhadas */
.tab-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: -24px -24px 4px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.tab-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 44px;
  padding: 0 12px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13.5px;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 transparent;
  transition: var(--transition-fast);
}

.tab-pill-btn:hover {
  color: var(--text-primary);
}

.tab-pill-btn.active {
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--brand-blue);
}

.tab-content-pane {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Usuários */
.users-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
}

.users-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
}

.users-table th {
  padding: 9px 12px;
  background: var(--bg-surface-elevated);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.users-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-soft);
}

.users-table tbody tr:last-child td {
  border-bottom: none;
}

.user-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
}

.user-status-pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.user-status-active {
  color: var(--color-emerald);
}

.user-status-inactive {
  color: var(--text-muted);
}

.btn-user-action {
  height: 26px;
  padding: 0 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.btn-user-action:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-edit-user:hover {
  color: var(--brand-blue) !important;
  border-color: var(--brand-blue) !important;
  background: var(--brand-blue-bg) !important;
}

.btn-toggle-status:hover {
  color: var(--color-amber) !important;
  border-color: var(--color-amber-border) !important;
  background: var(--color-amber-bg) !important;
}

.btn-reset-pass:hover {
  color: var(--brand-blue) !important;
  border-color: var(--border-hover) !important;
}

.btn-delete-user:hover {
  color: var(--color-rose) !important;
  border-color: var(--color-rose-border) !important;
  background: var(--color-rose-bg) !important;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-actions-end {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

/* Importação */
.dropzone-box {
  border: 1.5px dashed var(--border-hover);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-surface-elevated);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: var(--transition-fast);
}

.dropzone-box:hover,
.dropzone-box.dragover {
  border-color: var(--brand-blue);
  background: var(--brand-blue-bg);
}

.dropzone-circle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--brand-blue-bg);
  color: var(--brand-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.dropzone-circle svg {
  width: 22px;
  height: 22px;
}

.dropzone-box h4 {
  font-size: 15px;
  font-weight: 600;
}

.dropzone-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.paste-textarea {
  width: 100%;
  height: 150px;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  resize: vertical;
}

.paste-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--focus-ring);
}

.notice-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-soft);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.notice-box svg {
  flex-shrink: 0;
  color: var(--brand-blue);
  margin-top: 2px;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: #172131;
  color: #fff;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight .2s ease-out;
}

[data-theme="dark"] .toast {
  background: #E8EEF5;
  color: #0B1724;
}

.toast-success {
  box-shadow: inset 0 3px 0 #2E9B5B, var(--shadow-lg);
}

.toast-error {
  box-shadow: inset 0 3px 0 #D9483A, var(--shadow-lg);
}

.toast-info {
  box-shadow: inset 0 3px 0 #3C7FCB, var(--shadow-lg);
}

/* Trilha / Timeline */
.trail-timeline {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: 24px;
  gap: 18px;
}

.trail-timeline::before {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 5px;
  width: 2px;
  background: var(--border-soft);
}

.trail-item {
  position: relative;
}

.trail-dot {
  position: absolute;
  left: -24px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--bg-surface);
}

.trail-dot-blue {
  background: var(--brand-blue);
}

.trail-dot-rose {
  background: var(--color-rose);
}

.trail-dot-emerald {
  background: var(--color-emerald);
}

.trail-card {
  padding: 0;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13px;
  color: var(--text-secondary);
}

.trail-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-primary);
}

/* Animações */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes scaleUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(16px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}


/* Destaque de autoria */
.login-aside-credit {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 18px;
  border: 1px solid rgba(217, 164, 0, .45);
  border-radius: var(--radius);
  background: rgba(217, 164, 0, .08);
  max-width: 420px;
}

.login-aside-credit .credit-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gov-gold);
}

.login-aside-credit .credit-name {
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -.01em;
}

.login-aside-credit .credit-dept {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--nav-text);
}

.footer-credit {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg-surface);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.footer-credit strong {
  font-size: 14px;
  color: var(--text-primary);
}

.footer-credit .credit-dept {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--brand-blue);
}


.sidebar-credit {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 10px 12px;
  border: 1px solid rgba(217, 164, 0, .45);
  border-radius: var(--radius);
  background: rgba(217, 164, 0, .08);
}

.sidebar-credit .credit-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gov-gold);
}

.sidebar-credit strong {
  font-size: 14px;
  color: #fff;
}

.sidebar-credit .credit-dept {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--nav-text);
}

.modal-credit {
  margin-right: auto;
  font-size: 12px;
  color: var(--text-muted);
}

.modal-credit strong {
  color: var(--text-primary);
  font-weight: 600;
}

@media (max-width: 640px) {
  .modal-credit {
    display: none;
  }
}

/* Sidebar Recolhida (Desktop) */
@media (min-width: 901px) {
  .app-screen.sidebar-collapsed {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .app-screen.sidebar-collapsed .app-sidebar {
    width: 68px;
    padding: 16px 8px;
    align-items: center;
    overflow-x: hidden;
  }

  .app-screen.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding: 0;
    width: 100%;
  }

  .app-screen.sidebar-collapsed .sidebar-brand-name,
  .app-screen.sidebar-collapsed .sidebar-label,
  .app-screen.sidebar-collapsed .sidebar-link span,
  .app-screen.sidebar-collapsed .sidebar-credit,
  .app-screen.sidebar-collapsed .user-details,
  .app-screen.sidebar-collapsed .btn-logout-full span {
    display: none !important;
  }

  .app-screen.sidebar-collapsed .sidebar-brand-group {
    display: none;
  }

  .app-screen.sidebar-collapsed .btn-toggle-sidebar {
    margin: 0 auto;
  }

  .app-screen.sidebar-collapsed .btn-toggle-sidebar svg {
    transform: rotate(180deg);
  }

  .app-screen.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 10px 0;
    width: 44px;
    border-radius: var(--radius);
  }

  .app-screen.sidebar-collapsed .sidebar-nav {
    align-items: center;
    width: 100%;
  }

  .app-screen.sidebar-collapsed .sidebar-footer {
    padding: 12px 0 0;
    align-items: center;
    width: 100%;
  }

  .app-screen.sidebar-collapsed .user-pill {
    justify-content: center;
  }

  .app-screen.sidebar-collapsed .sidebar-actions {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
  }

  .app-screen.sidebar-collapsed .btn-logout-full {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius);
  }
}

/* Responsividade Geral */
@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-card:nth-child(2) {
    border-right: none;
  }

  .kpi-card:nth-child(-n+2) {
    border-bottom: 1px solid var(--border-soft);
  }
}

@media (max-width: 900px) {
  .app-screen {
    grid-template-columns: 1fr;
    display: block;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
  }

  .app-sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 31, 54, .5);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
  }

  .sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }

  .main-header {
    padding: 14px 16px;
  }

  .main-header-top-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
  }

  .btn-mobile-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    color: var(--text-primary);
    cursor: pointer;
    flex-shrink: 0;
  }

  .btn-mobile-menu:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
  }

  .main-container {
    padding: 16px 16px 32px;
    gap: 16px;
  }

  .btn-toggle-sidebar {
    display: none !important;
  }
}

@media (min-width: 901px) {

  .btn-mobile-menu,
  .sidebar-backdrop {
    display: none !important;
  }
}

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

  .kpi-card {
    border-right: none !important;
    border-bottom: 1px solid var(--border-soft);
  }

  .kpi-card:last-child {
    border-bottom: none;
  }

  .controls-filters-row,
  .controls-actions-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .controls-actions-left,
  .controls-actions-right {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .search-field {
    max-width: none;
    width: 100%;
  }

  .select-wrapper,
  .select-custom {
    width: 100%;
  }

  .date-range-picker {
    width: 100%;
    justify-content: space-between;
  }

  .btn-action-primary,
  .btn-action-secondary,
  .btn-reset-filters {
    width: 100%;
    justify-content: center;
  }

  .header-branding-divider {
    display: none;
  }

  .header-branding-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header-logo-img {
    height: 38px;
    max-width: 190px;
  }

  .header-parameters {
    font-size: 12px;
    gap: 8px;
  }

  .modal-box {
    width: 95vw !important;
    max-height: 94vh;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 14px 16px;
  }

  .modal-credit {
    display: none;
  }
}

/* ==========================================================================
   MELHORIAS: PAINEL ANALÍTICO, ORDENAÇÃO, INTERVALO DE DATAS E AUDITORIA
   ========================================================================== */

/* 1. Painel Gráfico Executivo */
.analytics-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition-smooth);
}

.analytics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-surface-elevated);
}

.analytics-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.analytics-icon-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: var(--brand-blue-bg);
  color: var(--brand-blue);
}

.analytics-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.analytics-subtitle {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin: 2px 0 0;
}

.btn-toggle-analytics {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-toggle-analytics:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.analytics-body {
  padding: 18px 20px;
  transition: all 0.25s ease;
}

.analytics-body.collapsed {
  display: none;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
}

.chart-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.chart-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.chart-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
}

.dot-rose {
  background: #DC2626;
}

.dot-emerald {
  background: #16A34A;
}

.chart-container-svg {
  width: 100%;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.chart-container-svg svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 210px;
}

.chart-container-breakdown {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  min-height: 180px;
}

.breakdown-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.breakdown-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
}

.breakdown-label {
  font-weight: 500;
  color: var(--text-secondary);
}

.breakdown-count {
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.breakdown-track {
  height: 8px;
  background: var(--border-soft);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.breakdown-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* 2. Ordenação de Colunas na Tabela */
.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: var(--transition-fast);
}

.sortable-th:hover {
  background-color: var(--bg-card-hover);
  color: var(--brand-blue);
}

.th-content {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.th-content-right {
  justify-content: flex-end;
  width: 100%;
}

.th-content-center {
  justify-content: center;
  width: 100%;
}

.sort-indicator {
  font-size: 0.72rem;
  opacity: 0.35;
  transition: var(--transition-fast);
  color: var(--text-muted);
}

.sort-indicator.active {
  opacity: 1;
  color: var(--brand-blue);
  font-weight: bold;
}

/* 3. Seletor de Intervalo de Datas */
.date-range-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  font-size: 0.78rem;
}

.date-range-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.date-range-sep {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.date-input-custom {
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.78rem;
  font-family: var(--font-mono);
  padding: 2px 4px;
  outline: none;
  cursor: pointer;
}

.date-input-custom:focus {
  background: var(--bg-card-hover);
  border-radius: 2px;
}

/* 4. Auditoria e Vínculo Manual na Trilha */
.trail-section-divider {
  margin: 16px 0 12px;
  border: 0;
  border-top: 1px dashed var(--border-subtle);
}

.trail-section-title {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.manual-link-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 8px;
}

.manual-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.manual-ob-input {
  flex: 1;
  padding: 6px 10px;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text-primary);
  text-transform: uppercase;
}

.btn-manual-save {
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--brand-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.btn-manual-save:hover {
  background: var(--brand-blue-hover);
}

.btn-manual-reset {
  padding: 6px 10px;
  font-size: 0.78rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.btn-manual-reset:hover {
  color: var(--color-rose);
  border-color: var(--color-rose-border);
}

.audit-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  margin-top: 8px;
  padding-right: 4px;
}

.audit-history-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--brand-blue);
  border-radius: 3px;
  font-size: 0.78rem;
}

.audit-history-time {
  font-family: var(--font-mono);
  font-size: 0.70rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.audit-history-content {
  flex: 1;
}

.audit-history-user {
  font-weight: 600;
  color: var(--text-primary);
}

.audit-history-action {
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Responsividade adicional */
@media (max-width: 1200px) {
  .charts-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@media (max-width: 900px) {
  .controls-filters-row {
    flex-direction: column;
    align-items: stretch;
  }

  .controls-actions-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .controls-actions-left,
  .controls-actions-right {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .controls-actions-left button,
  .controls-actions-right button {
    width: 100%;
    justify-content: center;
  }

  .date-range-picker {
    width: 100%;
    justify-content: space-between;
  }
}

/* Impressão */
@media print {

  .gov-strip,
  .app-sidebar,
  .controls-card,
  .alert-banner-pro,
  .header-right,
  .toast-container,
  .btn-trail-action {
    display: none !important;
  }

  .app-screen {
    display: block;
  }

  body {
    background: #fff;
  }
}