/* ==========================================================================
   HUB-Cidades — e-governo.org
   Frontend stylesheet. Tokens são consumidos do Design System (ds/).
   Para alterar paleta, tipografia, espaçamento → editar ds/tokens/*.css
   ========================================================================== */

@import url("/ds/tokens/index.css");

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background: var(--bg-body);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    line-height: 1.5;
    transition: background var(--transition-base), color var(--transition-base);
}

::selection { background: var(--primary-500); color: var(--text-on-primary); }

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

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-medium); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: width var(--transition-base);
    overflow: hidden;
}

.sidebar-header {
    padding: var(--space-6) var(--space-5);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.brand-name {
    font-size: var(--text-xl);
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 1.5px;
    line-height: 1.2;
}

.brand-domain {
    font-size: var(--text-xs);
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.5px;
    font-weight: 500;
}

.theme-toggle {
    width: 36px; height: 36px;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
    flex-shrink: 0;
}
.theme-toggle:hover { background: rgba(255,255,255,0.14); color: #ffffff; transform: rotate(15deg); }
.theme-toggle svg { width: 18px; height: 18px; }

/* Sidebar collapse toggle */
.sidebar-toggle {
    width: 28px; height: 28px;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-base);
    flex-shrink: 0;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.16); color: #ffffff; }
.sidebar-toggle svg { width: 14px; height: 14px; }
.sidebar.collapsed .sidebar-toggle svg { transform: rotate(180deg); }

/* Estado recolhido (toggle manual) */
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .brand-domain,
.sidebar.collapsed .brand-name,
.sidebar.collapsed .sidebar-version,
.sidebar.collapsed .user-city,
.sidebar.collapsed .user-info,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .theme-toggle,
.sidebar.collapsed .btn-logout span,
.sidebar.collapsed .btn-logout { font-size: 0; }
.sidebar.collapsed .nav-item { justify-content: center; padding: var(--space-3); }
.sidebar.collapsed .sidebar-header { justify-content: center; padding: var(--space-4) var(--space-2); }
.sidebar.collapsed + .content,
body.sidebar-collapsed .content { margin-left: var(--sidebar-collapsed); }

/* User info (popover no rodapé) */
.user-info {
    position: relative;
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid rgba(255,255,255,0.06);
}

.user-trigger {
    display: flex; align-items: center; gap: var(--space-2);
    width: 100%;
    padding: var(--space-2) var(--space-2);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-md);
    color: inherit;
    cursor: pointer;
    text-align: left;
    transition: background var(--transition-fast);
}
.user-trigger:hover { background: rgba(255,255,255,0.08); }
.user-avatar {
    width: 32px; height: 32px; flex-shrink: 0;
    border-radius: 50%;
    background: var(--primary-600);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: var(--text-sm);
}
.user-trigger-text {
    display: flex; flex-direction: column; flex: 1; min-width: 0;
    line-height: 1.2;
}
.user-trigger-text .user-name {
    font-size: var(--text-sm); font-weight: 600; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-trigger-text .user-role {
    font-size: 11px; color: rgba(255,255,255,0.55);
    font-weight: 500; text-transform: none; letter-spacing: 0; margin-top: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-trigger-chevron {
    flex-shrink: 0;
    color: rgba(255,255,255,0.5);
    transition: transform var(--transition-fast);
}
.user-info.open .user-trigger-chevron { transform: rotate(180deg); }

.user-name { font-size: var(--text-base); font-weight: 600; color: #ffffff; }
.user-role {
    font-size: var(--text-xs); color: rgba(155,196,255,0.9);
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; margin-top: 2px;
}
.user-city { font-size: var(--text-xs); color: rgba(255,255,255,0.4); margin-top: 1px; }

.user-popover {
    position: absolute;
    bottom: calc(100% + 6px);
    left: var(--space-4);
    right: var(--space-4);
    background: var(--bg-elevated, #ffffff);
    color: var(--text-primary);
    border: 1px solid var(--border-color, rgba(0,0,0,0.08));
    border-radius: var(--radius-md);
    box-shadow: 0 12px 32px rgba(0,0,0,0.18);
    padding: var(--space-3);
    z-index: 50;
    display: none;
}
.user-info.open .user-popover { display: block; }
.user-popover-head { padding-bottom: var(--space-2); margin-bottom: var(--space-2); border-bottom: 1px solid var(--border-color, rgba(0,0,0,0.08)); }
.user-popover-head .user-name { color: var(--text-primary); font-size: var(--text-base); font-weight: 600; text-transform: none; letter-spacing: 0; }
.user-popover-head .user-role { color: var(--primary-600, #2563eb); font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; margin-top: 2px; }
.user-popover-head .user-city { color: var(--text-tertiary); font-size: var(--text-xs); margin-top: 2px; }
.user-popover-label { font-size: var(--text-xs); color: var(--text-tertiary); margin-bottom: 6px; }
.user-popover-fields { display: grid; gap: 6px; }
.user-popover-select {
    width: 100%; padding: 6px 8px;
    border: 1px solid var(--border-color, rgba(0,0,0,0.12));
    border-radius: var(--radius-sm);
    background: var(--bg-base, #ffffff);
    color: var(--text-primary);
    font-size: var(--text-xs);
}
.user-popover-apply {
    padding: 7px 10px; border: none;
    border-radius: var(--radius-sm);
    background: var(--primary-600); color: #fff;
    font-size: var(--text-xs); font-weight: 600;
    cursor: pointer;
}
.user-popover-apply:hover { background: var(--primary-500); }

/* Navigation */
.nav-menu { list-style: none; padding: var(--space-3) 0; flex: 1; overflow-y: auto; }

.nav-item {
    padding: var(--space-3) var(--space-5);
    cursor: pointer;
    display: flex; align-items: center; gap: var(--space-3);
    font-size: var(--text-base); font-weight: 500;
    color: rgba(255,255,255,0.55);
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    user-select: none;
}

.nav-item:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.92); }
.nav-item.active {
    background: linear-gradient(90deg, rgba(24,85,176,0.28), rgba(24,85,176,0.0));
    color: #ffffff;
    border-left-color: var(--primary-500);
    font-weight: 600;
}

.nav-icon { width: 20px; height: 20px; flex-shrink: 0; opacity: 0.7; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-label { white-space: nowrap; overflow: hidden; }

/* Sidebar footer */
.sidebar-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex; flex-direction: column; gap: var(--space-2);
}

.btn-logout {
    display: flex; align-items: center; justify-content: center; gap: var(--space-2);
    width: 100%; padding: var(--space-2) var(--space-3);
    background: rgba(232,34,7,0.08); color: #f87171;
    border: 1px solid rgba(232,34,7,0.15); border-radius: var(--radius-md);
    font-size: var(--text-sm); font-weight: 500; cursor: pointer;
    font-family: var(--font-family);
    transition: all var(--transition-fast);
}
.btn-logout:hover { background: rgba(232,34,7,0.15); border-color: rgba(232,34,7,0.25); }

.sidebar-version { font-size: 11px; color: rgba(255,255,255,0.25); text-align: center; }

/* ===== MAIN CONTENT ===== */
.content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: var(--space-8) var(--space-10);
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 100vh;
    min-width: 0;
    transition: margin-left var(--transition-base);
    max-width: 100%;
    box-sizing: border-box;
}

.page { display: none; }
.page.active { display: block; animation: pageIn 0.3s ease-out; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== PAGE HEADER ===== */
.page-header {
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--border-light);
}
.page-header h2 {
    font-size: var(--text-2xl); font-weight: 700; color: var(--text-primary);
    margin-bottom: var(--space-1); letter-spacing: -0.3px;
}
.page-header p { color: var(--text-secondary); font-size: var(--text-base); }

/* ===== STAT CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-8);
}
.stats-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) {
    .stats-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .stats-grid.cols-4, .stats-grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    transition: all var(--transition-fast);
    position: relative; overflow: hidden;
    min-width: 0;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transition: height var(--transition-fast);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card:hover::before { height: 4px; }

.stat-value { font-size: var(--text-3xl); font-weight: 800; margin-bottom: var(--space-1); line-height: 1.1; letter-spacing: -0.5px; }
.stat-label { font-size: var(--text-sm); color: var(--text-secondary); font-weight: 500; }

.stat-card.primary::before { background: var(--primary-500); }
.stat-card.primary .stat-value { color: var(--primary-500); }
.stat-card.success::before { background: var(--success-500); }
.stat-card.success .stat-value { color: var(--success-500); }
.stat-card.info::before { background: var(--info-500); }
.stat-card.info .stat-value { color: var(--info-500); }
.stat-card.warning::before { background: var(--warning-500); }
.stat-card.warning .stat-value { color: var(--warning-500); }

/* Cards de operação (PEUC / Cartório / Sinter / DQ) */
.stat-card.peuc::before     { background: var(--module-peuc); }
.stat-card.peuc .stat-value { color: var(--module-peuc); }
.stat-card.cartorio::before     { background: var(--module-cartorio); }
.stat-card.cartorio .stat-value { color: var(--module-cartorio); }
.stat-card.sinter::before     { background: var(--module-sinter); }
.stat-card.sinter .stat-value { color: var(--module-sinter); }
.stat-card.dq::before     { background: var(--module-dq); }
.stat-card.dq .stat-value { color: var(--module-dq); }

/* ===== Permissões: matriz feature × ambiente ===== */
.perm-matrix { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.perm-matrix th, .perm-matrix td {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-light);
    text-align: left;
}
.perm-matrix thead th {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-weight: 600; font-size: 12px;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.perm-matrix th.amb, .perm-matrix td.amb { text-align: center; width: 140px; }
.perm-matrix .feat-name { font-weight: 500; color: var(--text-primary); }
.perm-matrix .feat-cat  { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.perm-matrix tr:hover td { background: var(--bg-hover, rgba(0,0,0,0.02)); }
.perm-matrix input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary-500); }

/* Modal genérico (reaproveitado para permissões) */
.app-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 3000; padding: var(--space-4);
}
.app-modal {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    max-width: 720px; width: 100%;
    max-height: 90vh; overflow: auto;
    padding: var(--space-4);
}
.app-modal-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: var(--space-3); padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-light);
}
.app-modal-head h3 { margin: 0; }
.btn-link {
    background: none; border: none;
    color: var(--primary-500);
    font-family: var(--font-family);
    font-size: var(--text-sm);
    cursor: pointer; padding: 4px 8px;
}
.btn-link:hover { text-decoration: underline; }

.stat-sub {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-top: var(--space-2);
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.section-title {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-secondary);
    margin: var(--space-2) 0 var(--space-4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-5);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.card h3 { font-size: var(--text-md); font-weight: 600; margin-bottom: var(--space-4); color: var(--text-primary); }

.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
    margin-bottom: var(--space-5);
}

/* ===== SEARCH (PADRÃO ds/ia — campo amplo, botão compacto) ===== */
.search-box, .search-inline { display: flex; gap: var(--space-2); margin-bottom: var(--space-4); align-items: stretch; }

.search-box input, .search-inline input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-sm); font-family: var(--font-family);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.search-box input:focus, .search-inline input:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-50);
}
[data-theme="dark"] .search-box input:focus,
[data-theme="dark"] .search-inline input:focus { box-shadow: 0 0 0 3px rgba(91,154,255,0.15); }
.search-box input::placeholder, .search-inline input::placeholder { color: var(--text-tertiary); }

.search-box button, .search-inline button {
    flex: 0 0 auto;
    padding: 10px 18px;
    background: var(--primary-500); color: var(--text-on-primary);
    border: none; border-radius: var(--radius-md);
    font-size: var(--text-sm); font-weight: 600; font-family: var(--font-family);
    cursor: pointer; white-space: nowrap;
    transition: background var(--transition-fast), transform var(--transition-fast);
}
.search-box button:hover, .search-inline button:hover { background: var(--primary-600); }
.search-box button:active, .search-inline button:active { transform: scale(0.98); }

/* Chip — micro etiqueta usada em listas de campos e relacionamentos */
.chip {
    display: inline-block;
    padding: 2px 8px;
    margin: 0 2px;
    border-radius: var(--radius-full);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: var(--text-xs);
    line-height: 1.4;
    border: 1px solid var(--border-color);
    white-space: nowrap;
}

.hint { font-size: var(--text-sm); color: var(--text-tertiary); margin-bottom: var(--space-3); }

.search-filters { display: flex; gap: var(--space-2); margin-bottom: var(--space-5); flex-wrap: wrap; }

.filter-tag {
    padding: var(--space-1) var(--space-4);
    border-radius: var(--radius-full);
    font-size: var(--text-sm); font-weight: 500;
    cursor: pointer;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    user-select: none;
}
.filter-tag:hover { border-color: var(--primary-400); color: var(--primary-500); background: var(--primary-50); }
.filter-tag.active { background: var(--primary-500); color: var(--text-on-primary); border-color: var(--primary-500); }

.search-meta {
    font-size: var(--text-sm); color: var(--text-secondary);
    margin-bottom: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-hover);
    border-radius: var(--radius-md);
}

/* ===== RESULTS ===== */
.results-container { display: flex; flex-direction: column; gap: var(--space-3); }

.result-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    transition: all var(--transition-fast);
}
.result-card:hover { border-color: var(--primary-400); box-shadow: var(--shadow-sm); }

.result-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: var(--space-4); margin-bottom: var(--space-2);
}

.result-project {
    font-size: var(--text-xs); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-sm);
    background: var(--primary-50); color: var(--primary-500);
    flex-shrink: 0; white-space: nowrap;
}
.result-project.airport   { background: var(--danger-50);  color: var(--danger-500); }
.result-project.cad_iptu  { background: var(--success-50); color: var(--success-500); }
.result-project.iptu_2026 { background: var(--info-50);    color: var(--info-500); }
.result-project.cartorio  { background: var(--warning-50); color: var(--warning-500); }
.result-project.cno_obras { background: var(--primary-50); color: var(--primary-500); }

.result-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-2); }
.result-field { display: flex; gap: var(--space-2); font-size: var(--text-sm); padding: var(--space-1) 0; }
.result-field .label { color: var(--text-tertiary); min-width: 90px; flex-shrink: 0; font-weight: 500; }
.result-field .value { color: var(--text-primary); word-break: break-word; }

/* ===== CORRELAÇÕES ===== */
.correlacoes-section { margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--border-light); }
.correlacoes-section h4 {
    font-size: var(--text-base); color: var(--primary-500); margin-bottom: var(--space-4); font-weight: 600;
    display: flex; align-items: center; gap: var(--space-2);
}
.correlacoes-section h4::before {
    content: ''; display: inline-block; width: 3px; height: 16px;
    background: var(--primary-500); border-radius: 2px;
}
.correlacao-group { margin-bottom: var(--space-4); }
.correlacao-group h5 { font-size: var(--text-xs); color: var(--warning-500); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: var(--space-2); font-weight: 600; }
.correlacao-item { background: var(--bg-hover); border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-2); font-size: var(--text-sm); line-height: 1.6; }

/* ===== CATÁLOGO ===== */
.catalogo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--space-5); }

.catalogo-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    transition: all var(--transition-base);
    cursor: pointer;
}
.catalogo-card:hover { border-color: var(--primary-400); box-shadow: var(--shadow-md); transform: translateY(-3px); }
.catalogo-card .card-title { font-size: var(--text-lg); font-weight: 700; margin-bottom: var(--space-2); color: var(--text-primary); }
.catalogo-card .card-desc { font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: var(--space-4); line-height: 1.6; }
.catalogo-card .card-meta { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }

.status-badge {
    display: inline-flex; align-items: center;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.3px;
}
.status-badge.integrado { background: var(--success-50); color: var(--success-500); }
.status-badge.disponivel { background: var(--warning-50); color: var(--warning-500); }
.status-badge.pendente { background: var(--bg-hover); color: var(--text-tertiary); }

.fontes-list { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border-light); }
.fontes-list .fonte-item { font-size: var(--text-xs); color: var(--text-secondary); padding: var(--space-1) 0; display: flex; align-items: center; gap: var(--space-2); }
.fontes-list .fonte-item::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--border-strong); flex-shrink: 0; }

/* ===== STATUS LIST ===== */
.status-list { display: flex; flex-direction: column; }

.status-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: var(--space-3) 0; border-bottom: 1px solid var(--border-light);
    gap: var(--space-3);
}
.status-row:last-child { border-bottom: none; }
.status-row .name {
    font-size: var(--text-base); font-weight: 500;
    display: flex; align-items: center; gap: var(--space-2);
    min-width: 0; flex: 1; overflow: hidden;
    white-space: nowrap; text-overflow: ellipsis;
}

.status-indicator { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-indicator.online { background: var(--success-500); box-shadow: 0 0 6px var(--success-500); }
.status-indicator.offline { background: var(--border-medium); }

.status-row .count { font-size: var(--text-sm); color: var(--text-tertiary); font-weight: 500; flex-shrink: 0; white-space: nowrap; }

/* ===== BAR CHART ===== */
.chart-container { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }

.bar-row { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.bar-row .bar-label {
    font-size: var(--text-sm); width: 120px; flex-shrink: 0;
    text-align: right; color: var(--text-secondary); font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bar-row .bar-track { flex: 1; min-width: 0; height: 28px; background: var(--bg-hover); border-radius: var(--radius-sm); overflow: hidden; }
.bar-row .bar-fill {
    height: 100%; border-radius: var(--radius-sm);
    background: linear-gradient(90deg, var(--primary-500), var(--primary-400));
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; align-items: center; padding-left: var(--space-3);
    font-size: var(--text-xs); font-weight: 600; color: var(--text-on-primary); white-space: nowrap;
}

/* ===== LOADING ===== */
.loading { text-align: center; padding: var(--space-12); color: var(--text-tertiary); }
.spinner { display: inline-block; width: 32px; height: 32px; border: 3px solid var(--border-light); border-top-color: var(--primary-500); border-radius: 50%; animation: spin 0.7s linear infinite; }
.spinner-inline { display: inline-block; width: 11px; height: 11px; border: 2px solid var(--border-light); border-top-color: currentColor; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -1px; margin-right: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== EXPANDED DATA ===== */
.expand-btn {
    font-size: var(--text-xs); color: var(--primary-500); cursor: pointer;
    background: none; border: none; padding: var(--space-1) var(--space-2);
    margin-top: var(--space-2); font-weight: 500; font-family: var(--font-family);
    transition: color var(--transition-fast);
    display: inline-flex; align-items: center; gap: var(--space-1);
}
.expand-btn:hover { color: var(--primary-600); }
.expand-btn::after {
    content: ''; display: inline-block; width: 0; height: 0;
    border-left: 4px solid transparent; border-right: 4px solid transparent;
    border-top: 5px solid currentColor; transition: transform var(--transition-fast);
}

.dados-expandidos {
    display: none; margin-top: var(--space-3); padding: var(--space-4);
    background: var(--bg-hover); border-radius: var(--radius-md);
    font-size: var(--text-xs); max-height: 300px; overflow-y: auto;
    border: 1px solid var(--border-light);
}
.dados-expandidos.aberto { display: block; animation: slideDown 0.2s ease-out; }
@keyframes slideDown { from { opacity: 0; } to { opacity: 1; } }

.dados-expandidos table { width: 100%; border-collapse: collapse; }
.dados-expandidos td { padding: var(--space-1) var(--space-2); border-bottom: 1px solid var(--border-light); vertical-align: top; }
.dados-expandidos td:first-child { color: var(--text-tertiary); width: 200px; font-weight: 500; }

/* ===== PAGINATION ===== */
.pagination { display: flex; justify-content: center; align-items: center; gap: var(--space-2); margin-top: var(--space-5); }
.pagination button {
    padding: var(--space-2) var(--space-4);
    background: var(--bg-surface); border: 1px solid var(--border-light);
    border-radius: var(--radius-md); color: var(--text-primary);
    cursor: pointer; font-size: var(--text-sm); font-family: var(--font-family); font-weight: 500;
    transition: all var(--transition-fast);
}
.pagination button:hover:not(:disabled) { border-color: var(--primary-500); color: var(--primary-500); background: var(--primary-50); }
.pagination button:disabled { opacity: 0.35; cursor: not-allowed; }
.pagination .page-info { font-size: var(--text-sm); color: var(--text-secondary); padding: 0 var(--space-2); font-weight: 500; }

/* ===== LOGIN SCREEN ===== */
.login-screen {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-body);
    align-items: center; justify-content: center;
    z-index: 1000;
    transition: background var(--transition-base);
}

.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: var(--space-10);
    width: 420px; max-width: 95vw;
    box-shadow: var(--shadow-xl);
    transition: all var(--transition-base);
}

.login-header { text-align: center; margin-bottom: var(--space-8); }
.login-header h1 { font-size: var(--text-3xl); font-weight: 800; color: var(--primary-500); letter-spacing: 1px; line-height: 1.2; }
.login-domain { display: block; font-size: var(--text-sm); color: var(--info-500); margin-top: var(--space-1); letter-spacing: 1.5px; font-weight: 600; }
.login-header p { font-size: var(--text-sm); color: var(--text-secondary); margin-top: var(--space-3); line-height: 1.5; }

.login-error {
    background: var(--danger-50); border: 1px solid var(--danger-500);
    border-radius: var(--radius-md); padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm); color: var(--danger-500); margin-bottom: var(--space-4);
}

.login-theme-toggle {
    position: fixed; top: var(--space-5); right: var(--space-5);
    width: 40px; height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-surface); border: 1px solid var(--border-light);
    color: var(--text-secondary); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm); z-index: 1001;
}
.login-theme-toggle:hover { color: var(--primary-500); border-color: var(--primary-400); transform: rotate(15deg); }
.login-theme-toggle svg { width: 18px; height: 18px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: var(--space-4); }
.form-group label { display: block; font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: var(--space-2); font-weight: 500; }
.form-group input, .form-group select {
    width: 100%; padding: var(--space-3) var(--space-4);
    background: var(--bg-input); border: 1px solid var(--border-medium);
    border-radius: var(--radius-md); color: var(--text-primary);
    font-size: var(--text-base); font-family: var(--font-family);
    outline: none; transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-group input:focus, .form-group select:focus { border-color: var(--primary-500); box-shadow: 0 0 0 3px var(--primary-50); }
[data-theme="dark"] .form-group input:focus, [data-theme="dark"] .form-group select:focus { box-shadow: 0 0 0 3px rgba(91,154,255,0.15); }
.form-group input::placeholder { color: var(--text-tertiary); }

.btn-login, .btn-primary {
    width: 100%; padding: var(--space-3) var(--space-4);
    background: var(--primary-500); color: var(--text-on-primary);
    border: none; border-radius: var(--radius-md);
    font-size: var(--text-base); font-weight: 600; font-family: var(--font-family);
    cursor: pointer; transition: all var(--transition-fast);
}
.btn-login:hover, .btn-primary:hover { background: var(--primary-600); }
.btn-login:active, .btn-primary:active { transform: scale(0.99); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.form-msg { font-size: var(--text-sm); padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); margin-bottom: var(--space-3); min-height: 20px; }
.form-msg.success { background: var(--success-50); color: var(--success-500); border: 1px solid var(--success-500); }
.form-msg.error { background: var(--danger-50); color: var(--danger-500); border: 1px solid var(--danger-500); }

/* ===== DATA TABLES ===== */
.data-table-wrapper { overflow-x: auto; border: 1px solid var(--border-light); border-radius: var(--radius-md); background: var(--bg-surface); }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.data-table thead tr { border-bottom: 2px solid var(--border-light); background: var(--bg-subtle, transparent); }
.data-table th { padding: var(--space-2) var(--space-3); text-align: left; color: var(--text-tertiary); font-weight: 600; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; position: sticky; top: 0; background: var(--bg-surface); z-index: 1; }
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--text-primary); background: var(--bg-hover); }
.data-table th .sort-ind { display: inline-block; margin-left: 4px; opacity: 0.35; font-size: 0.9em; }
.data-table th .sort-ind.active { opacity: 1; color: var(--primary-500); }
.data-table td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border-light); color: var(--text-primary); vertical-align: middle; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table tbody tr { transition: background var(--transition-fast); }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr.row-clickable { cursor: pointer; }
.data-table tbody tr.row-clickable:hover { background: var(--bg-hover); box-shadow: inset 3px 0 0 var(--primary-500); }

/* ===== RECORD DRAWER (clique na linha) ===== */
.record-drawer-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 1000;
    display: flex; justify-content: flex-end;
    animation: fadeIn 0.15s ease-out;
}
.record-drawer {
    width: min(640px, 100vw);
    height: 100vh;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-light);
    box-shadow: -4px 0 24px rgba(0,0,0,0.18);
    display: flex; flex-direction: column;
    animation: drawerIn 0.2s ease-out;
}
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.record-drawer-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-light);
}
.record-drawer-title { font-size: var(--text-lg); font-weight: 600; color: var(--text-primary); }
.record-drawer-sub { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: 2px; }
.record-drawer-close {
    background: none; border: none; font-size: 28px; line-height: 1;
    color: var(--text-tertiary); cursor: pointer; padding: 0 var(--space-2);
}
.record-drawer-close:hover { color: var(--text-primary); }
.record-drawer-body { flex: 1; overflow: auto; padding: var(--space-4) var(--space-5); }
.record-drawer-body .data-table td { white-space: normal; max-width: none; word-break: break-word; }
.record-drawer-body .data-table td:first-child { color: var(--text-tertiary); width: 220px; font-weight: 500; vertical-align: top; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1280px) {
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); }
    .stat-value { font-size: var(--text-2xl); }
}

@media (max-width: 1024px) {
    .content { padding: var(--space-6); }
    .grid-2col { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

@media (max-width: 900px) {
    .sidebar { width: var(--sidebar-collapsed); }
    .brand-name { font-size: var(--text-md); }
    .brand-domain, .sidebar-version, .user-city { display: none; }
    .nav-label { display: none; }
    .nav-item { justify-content: center; padding: var(--space-3); }
    .user-info { padding: var(--space-3); text-align: center; }
    .user-name { font-size: var(--text-xs); }
    .content { margin-left: var(--sidebar-collapsed); padding: var(--space-4); }
    .grid-2col { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
    .stat-card { padding: var(--space-4); }
    .login-card { width: 90%; min-width: auto; padding: var(--space-6); }
    .form-row { grid-template-columns: 1fr; }
    .theme-toggle { display: none; }
    .section-title { margin-top: var(--space-4); }
}

@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: var(--space-2); }
    .stat-card { padding: var(--space-3); }
    .stat-value { font-size: var(--text-xl); }
    .stat-label { font-size: var(--text-xs); }
    .stat-sub { display: none; }
    .catalogo-grid { grid-template-columns: 1fr; }
    .result-fields { grid-template-columns: 1fr; }
    .search-filters { gap: var(--space-1); }
    .page-header h2 { font-size: var(--text-xl); }
}

@media (max-width: 420px) {
    .stats-grid { grid-template-columns: 1fr; }
    .content { padding: var(--space-3); }
}

/* ===== UTILITY ===== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ===== RIPTU FULLSCREEN ===== */
.page-riptu-fullscreen.active {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 5;
    animation: pageIn 0.3s ease-out;
}
.riptu-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--line, #e2e8f0);
    background: var(--bg);
    flex-wrap: wrap;
}
.riptu-toolbar-title h2 {
    margin: 0; font-size: 18px; font-weight: 700; line-height: 1.2;
}
.riptu-toolbar-title span {
    font-size: 12.5px; color: var(--text-muted, #64748b);
}
.riptu-toolbar-actions {
    display: flex; align-items: center; gap: 12px;
}
.riptu-toggle {
    display: flex; gap: 0;
    border: 1px solid var(--line, #e2e8f0);
    border-radius: 8px; overflow: hidden;
}
.riptu-toggle-btn {
    background: transparent; border: none; cursor: pointer;
    padding: 7px 16px; font-size: 13px; color: var(--text, inherit);
    font-weight: 600; transition: all .15s;
}
.riptu-toggle-btn:hover { background: var(--accent-soft, rgba(11,61,145,.08)); }
.riptu-toggle-btn.active {
    background: var(--accent, #0b3d91); color: #fff;
}
.riptu-btn-external {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border: 1px solid var(--line, #e2e8f0);
    border-radius: 8px; font-size: 13px; color: var(--text, inherit);
    text-decoration: none; font-weight: 500;
}
.riptu-btn-external:hover {
    border-color: var(--accent, #0b3d91); color: var(--accent, #0b3d91);
}
.riptu-iframe-full {
    flex: 1; width: 100%; border: none; background: var(--bg);
    min-height: 0;
}
@media (max-width: 768px) {
    .page-riptu-fullscreen.active { left: 0; }
    .riptu-toolbar { padding: 10px 14px; }
    .riptu-toolbar-title h2 { font-size: 15px; }
}

/* ===== SINTER / CIB ===== */
.stat-card.danger {
    border-top: 4px solid var(--danger-500);
}
.stat-card.danger .stat-value { color: var(--danger-500); }

.sinter-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-4);
    margin-top: var(--space-3);
}
.sinter-info-item {
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}
.sinter-info-item strong {
    display: block;
    font-size: var(--text-sm);
    color: var(--primary-500);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.sinter-info-item p { margin: 0; font-size: var(--text-sm); color: var(--text-secondary); }
.sinter-info-item code {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 5px;
    font-family: monospace;
    font-size: 0.85em;
}

.sinter-cib-card {
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
.sinter-cib-row {
    display: flex;
    gap: var(--space-4);
    align-items: center;
}
.sinter-cib-row .label {
    width: 100px;
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    font-weight: 500;
    flex-shrink: 0;
}
.sinter-cib-row .value { font-weight: 600; }

.sinter-monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-4);
}
.monitor-card {
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: var(--space-4);
}
.monitor-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    font-size: var(--text-base);
}
.monitor-latencia {
    margin-left: auto;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    background: var(--bg-surface);
    border-radius: 20px;
    padding: 2px 8px;
}
.monitor-url {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    font-family: monospace;
    word-break: break-all;
    margin-bottom: var(--space-2);
}
.monitor-status { font-size: var(--text-sm); font-weight: 500; }
.monitor-detail { font-size: var(--text-xs); color: var(--text-secondary); margin-top: var(--space-1); }

.alert-warn {
    background: var(--warning-50);
    border-left: 4px solid var(--warning-500);
    border-radius: var(--radius-sm);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-primary);
}
.alert-error {
    background: var(--danger-50);
    border-left: 4px solid var(--danger-500);
    border-radius: var(--radius-sm);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    color: var(--danger-600);
}
.btn-secondary {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.15s;
}
.btn-secondary:hover { background: var(--bg-hover); }
.btn-secondary:disabled { opacity: 0.6; cursor: not-allowed; }

.sinter-token-instructions {
    background: var(--info-50);
    border-left: 4px solid var(--info-500);
    border-radius: var(--radius-sm);
    padding: var(--space-4);
    font-size: var(--text-sm);
}
.sinter-token-instructions strong { display: block; margin-bottom: var(--space-2); color: var(--info-500); }
.sinter-token-instructions ol { margin: 0; padding-left: var(--space-5); }
.sinter-token-instructions ol li { margin-bottom: var(--space-1); }
.sinter-token-instructions a { color: var(--primary-500); }
.btn-primary {
    background: var(--primary-500);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-5);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    width: auto;
}
.btn-primary:hover { background: var(--primary-600); }

/* JWT Preview */
.jwt-preview {
    display: flex; flex-direction: column; gap: var(--space-1);
    padding: var(--space-3); border-radius: var(--radius-sm);
    font-size: var(--text-xs); border: 1px solid;
}
.jwt-valid { border-color: var(--success-500); background: var(--success-50); }
.jwt-expired { border-color: var(--danger-500); background: var(--danger-50); }
.jwt-preview-row { display: flex; gap: var(--space-3); align-items: baseline; }
.jwt-preview-row span { width: 120px; color: var(--text-tertiary); flex-shrink: 0; }
.jwt-preview-row strong { font-family: monospace; word-break: break-all; }

/* Token ativo countdown */
.sinter-token-active {
    border: 1px solid var(--success-500);
    background: var(--success-50);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}
.token-active-header {
    display: flex; align-items: center; gap: var(--space-3);
    margin-bottom: var(--space-3);
}
.token-active-header strong { font-size: var(--text-base); }
.token-countdown {
    margin-left: auto;
    font-family: monospace;
    font-size: var(--text-sm);
    font-weight: 700;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    padding: 2px 10px;
}
.token-active-details {
    display: flex; gap: var(--space-6);
    flex-wrap: wrap; font-size: var(--text-sm);
    color: var(--text-secondary);
}
/* ============================================================
   Editor Sinter — telas_sinter_online (stepper + form)
   ============================================================ */
.sinter-editor { display: flex; flex-direction: column; gap: var(--space-4); }

/* Stepper */
.sinter-stepper { background: var(--bg-secondary); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); }
.sinter-stepper-ol {
    list-style: none; margin: 0; padding: 0;
    display: flex; gap: 0; align-items: stretch; justify-content: space-between;
    position: relative;
}
.sinter-stepper-ol::before {
    content: ""; position: absolute; left: 4%; right: 4%; top: 22px;
    height: 2px; background: var(--border-color); z-index: 0;
}
.sinter-step { flex: 1; position: relative; z-index: 1; text-align: center; }
.sinter-step-btn {
    display: flex; flex-direction: column; align-items: center; gap: var(--space-1);
    background: transparent; border: none; cursor: pointer; padding: 0 var(--space-1);
    width: 100%;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    transition: color .15s;
}
.sinter-step-btn:hover { color: var(--primary-700); }
.sinter-step-num {
    width: 44px; height: 44px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--bg-primary); border: 2px solid var(--border-color);
    color: var(--text-secondary); font-weight: 700; font-size: var(--text-base);
    line-height: 1; transition: all .15s;
}
.sinter-step-num.is-check { background: var(--success-500, #16a34a); border-color: var(--success-500, #16a34a); color: white; }
.sinter-step-num.is-warn  { background: var(--warning-400, #fbbf24); border-color: var(--warning-500, #f59e0b); color: #5a3500; }
.sinter-step.is-current .sinter-step-num {
    background: var(--primary-600); border-color: var(--primary-600); color: white;
    box-shadow: 0 0 0 4px rgba(28, 76, 166, 0.18);
}
.sinter-step.is-current .sinter-step-label { color: var(--primary-700); font-weight: 600; }
.sinter-step-label { display: block; }

/* Step panels */
.sinter-panels { background: var(--bg-primary); }
.sinter-step-panel { padding: var(--space-2) var(--space-1); }
.sinter-step-title {
    margin: 0 0 var(--space-3) 0;
    font-size: var(--text-lg);
    font-weight: 600; color: var(--text-primary);
}
.sinter-section-title {
    margin: var(--space-5) 0 var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-color);
    font-size: var(--text-sm); font-weight: 600;
    color: var(--primary-700);
}

/* Form grid */
.sinter-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); margin-bottom: var(--space-3); }
@media (max-width: 900px) { .sinter-grid-3 { grid-template-columns: 1fr; } }

.sinter-field { display: flex; flex-direction: column; gap: 4px; }
.sinter-label {
    font-size: var(--text-sm); font-weight: 500;
    color: var(--primary-700);
    margin-bottom: 2px;
}
.sinter-required-star { color: var(--danger-500); margin-left: 2px; }
.sinter-helper { color: var(--text-tertiary); font-size: var(--text-xs); }

/* Inputs */
.sinter-input {
    width: 100%; box-sizing: border-box;
    padding: 10px var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input, var(--bg-primary));
    color: var(--text-primary);
    font-size: var(--text-sm);
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.sinter-input:focus { outline: none; border-color: var(--primary-500); box-shadow: 0 0 0 3px rgba(28,76,166,0.12); }
.sinter-input.is-readonly { background: var(--bg-secondary); color: var(--text-secondary); cursor: not-allowed; }
/* Gradação de status nos campos */
.sinter-input.is-pending-required {
    border-color: var(--danger-400, #f87171);
    background: var(--danger-50, #fef2f2);
}
.sinter-input.is-pending-required:focus { box-shadow: 0 0 0 3px rgba(220,38,38,0.15); }
.sinter-input.is-pending-optional {
    border-color: var(--warning-400, #fbbf24);
    background: var(--warning-50, #fffbeb);
}
.sinter-input.is-pending-optional:focus { box-shadow: 0 0 0 3px rgba(245,158,11,0.18); }
.sinter-input.is-filled { border-color: var(--success-300, #86efac); }

/* Titulares / partes */
.titular-row, .party-row {
    display: grid; gap: var(--space-2);
    padding: var(--space-2);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-2);
    align-items: center;
}
.titular-row { grid-template-columns: 2fr 1fr 90px 1.4fr 1.4fr 40px; }
.titular-header, .party-header { background: transparent; font-size: var(--text-xs); font-weight: 600; color: var(--text-tertiary); padding: 0 var(--space-2); }
.party-row { grid-template-columns: 2fr 1fr 40px; }
.party-row.party-header-perc, .party-row[data-prefix="adquirente"] { grid-template-columns: 2fr 1fr 1fr 40px; }
.sinter-row-del { padding: 6px 10px; font-size: var(--text-xs); }
.sinter-empty { color: var(--text-tertiary); font-size: var(--text-sm); padding: var(--space-3); text-align: center; }
.sinter-add-btn { margin-top: var(--space-2); margin-bottom: var(--space-3); }

/* Footer (Cancelar / Validar / Salvar) */
.sinter-footer {
    display: flex; align-items: center; gap: var(--space-2);
    padding-top: var(--space-3); border-top: 1px solid var(--border-color);
}

/* Validar result */
.sinter-validar-result { padding: var(--space-3); border-radius: var(--radius-sm); margin-top: var(--space-2); border: 1px solid; }
.sinter-validar-result.ok   { background: var(--success-50, #ecfdf5); border-color: var(--success-300, #6ee7b7); color: var(--success-700, #047857); }
.sinter-validar-result.warn { background: var(--warning-50, #fffbeb); border-color: var(--warning-300, #fcd34d); color: #92400e; }
.sinter-validar-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.sinter-validar-result ul { margin: var(--space-2) 0 0 var(--space-5); }

.sinter-info    { padding: var(--space-2); color: var(--text-secondary); font-size: var(--text-sm); }
.sinter-success { padding: var(--space-2); background: var(--success-50); border: 1px solid var(--success-300); border-radius: var(--radius-sm); color: var(--success-700); }
.sinter-warn    { padding: var(--space-2); background: var(--warning-50); border: 1px solid var(--warning-300); border-radius: var(--radius-sm); color: #92400e; }
.sinter-error   { padding: var(--space-2); color: var(--danger-600); }

/* Score bars */
.sinter-score-card { padding: var(--space-3); background: var(--bg-secondary); border-radius: var(--radius-md); margin: var(--space-3) 0; }
.sinter-score-row { margin-bottom: var(--space-2); }
.sinter-score-head { display: flex; justify-content: space-between; font-size: var(--text-xs); margin-bottom: 4px; }
.sinter-score-track { height: 8px; background: var(--bg-primary); border-radius: 4px; overflow: hidden; }
.sinter-score-fill { height: 100%; transition: width .3s ease; }

/* Finalizar */
.sinter-finalizar-warn {
    background: var(--warning-50, #fffbeb);
    border: 1px solid var(--warning-300, #fcd34d);
    border-radius: var(--radius-sm);
    padding: var(--space-3);
    color: #5a3500;
    margin-bottom: var(--space-3);
}
.sinter-finalizar-warn ul { margin: var(--space-2) 0 0 var(--space-5); }
.sinter-finalizar-ok {
    background: var(--success-50, #ecfdf5);
    border: 1px solid var(--success-300, #6ee7b7);
    border-radius: var(--radius-sm);
    padding: var(--space-3);
    color: var(--success-700, #047857);
    margin-bottom: var(--space-3);
}
.sinter-finalizar-optional { margin-top: var(--space-3); }
.sinter-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--space-2); }
.sinter-chip { padding: 3px 10px; border-radius: 999px; font-size: var(--text-xs); background: var(--bg-secondary); color: var(--text-secondary); }
.sinter-chip-warn { background: var(--warning-50, #fffbeb); color: #92400e; border: 1px solid var(--warning-300, #fcd34d); }

/* Histórico */
.sinter-historico { margin-top: var(--space-3); }
.sinter-historico summary { cursor: pointer; font-weight: 600; padding: var(--space-2); background: var(--bg-secondary); border-radius: var(--radius-sm); }

/* Sinter editor — linhas separadoras entre rows do formulário */
@keyframes sinter-spin { to { transform: rotate(360deg); } }
.sinter-grid-3 { padding-bottom: var(--space-3); border-bottom: 1px solid var(--border-color); }
.sinter-grid-3:last-of-type { border-bottom: none; }
.sinter-step-panel .titular-row,
.sinter-step-panel .party-row { border-bottom: 1px solid var(--border-color); border-radius: 0; }
.sinter-step-panel .titular-row:last-of-type,
.sinter-step-panel .party-row:last-of-type { border-bottom: none; }
/* Inputs com formatter pt-BR alinhados à direita (padrão DS para números) */
.sinter-input.sinter-input-area,
.sinter-input.sinter-input-brl { text-align: right; font-variant-numeric: tabular-nums; }

/* Banner de pendências obrigatórias (topo do editor) */
.sinter-pending-banner { padding: var(--space-3); border-radius: var(--radius-md); border: 1px solid; margin-bottom: var(--space-2); }
.sinter-pending-banner.warn { background: var(--danger-50, #fef2f2); border-color: var(--danger-300, #fca5a5); color: var(--danger-700, #b91c1c); }
.sinter-pending-banner.ok { background: var(--success-50, #ecfdf5); border-color: var(--success-300, #6ee7b7); color: var(--success-700, #047857); display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.sinter-pending-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-2); }
.sinter-pending-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sinter-pending-chip {
    background: white; border: 1px solid var(--danger-300, #fca5a5);
    color: var(--danger-700, #b91c1c);
    padding: 4px 10px; border-radius: 999px;
    font-size: var(--text-xs); font-weight: 500;
    cursor: pointer; transition: background .15s;
}
.sinter-pending-chip:hover { background: var(--danger-100, #fee2e2); }

/* Linhas separadoras entre as "linhas" do formulário (cada .sinter-grid-3 é uma linha) */
.sinter-grid-3 { padding-bottom: var(--space-3); border-bottom: 1px dashed var(--border-color); }
.sinter-grid-3:last-of-type { border-bottom: none; }
/* Detalhes (summary) sem marcador padrão */
details.card summary::-webkit-details-marker { display: none; }
details.card summary::marker { display: none; }

/* Modal Unidade Imobiliária — cada campo num box com fundo/borda visível */
.sinter-field {
    background: var(--bg-surface, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3);
    transition: border-color .15s, box-shadow .15s;
}
.sinter-field:focus-within {
    border-color: var(--primary-500, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.sinter-field.is-pending-required-wrap { border-color: var(--danger-300, #fca5a5); background: var(--danger-50, #fef2f2); }
.sinter-grid-3 { padding-bottom: var(--space-4); border-bottom: 1px solid var(--border-medium, #cbd5e1); margin-bottom: var(--space-4); }
.sinter-grid-3:last-of-type { border-bottom: none; }
/* Input dentro do box do campo: sem borda extra para não duplicar caixa */
.sinter-field .sinter-input { border-color: var(--border-medium, #cbd5e1); }
