/* =====================================================
   Rhama Automações - Main Stylesheet
   Tema: Industrial refinado, dark, preciso
   ===================================================== */

:root {
  --bg-base:     #0d1117;
  --bg-surface:  #141822;
  --bg-card:     #1a1f2e;
  --bg-input:      #212636;
  --bg-field:      #0b0f18;        /* fundo dos campos — mais escuro que a página */
  --border:        #2a3048;
  --border-input:  rgba(100,130,210,0.38); /* borda visível nos campos */
  --border-focus:  #3B82F6;

  /* Marca Rhama */
  --brand-navy:  #1D3461;
  --accent:      #3B82F6;
  --accent-dim:  rgba(59,130,246,.14);
  --accent-glow: rgba(59,130,246,.32);
  --danger:      #f45b5b;
  --warning:     #f5a623;
  --info:        #60a5fa;

  --text-primary:   #e6ebf5;
  --text-secondary: #99a2bc;
  --text-muted:     #4e566e;

  --sidebar-w: 220px;
  --radius:    10px;
  --radius-sm: 6px;

  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Layout ── */
#app {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo-img {
  height: 28px;
  width: auto;
  display: block;
  opacity: .92;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;            /* habilita overflow dentro de flex column */
  overflow-y: auto;         /* barra de rolagem quando passa do limite */
  overflow-x: hidden;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Barra de rolagem discreta na navegação */
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.sidebar-nav { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 14px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(59,130,246,.2);
}

.nav-item.active svg { stroke: var(--accent); }

/* ── Grupos de navegação colapsáveis ── */
.nav-group { display: flex; flex-direction: column; }

.nav-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-group-header:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-group-header.open  { color: var(--text-primary); }

.nav-group-header-left { display: flex; align-items: center; gap: 10px; }

.nav-group-chevron {
  flex-shrink: 0;
  transition: transform .2s ease;
  stroke: currentColor;
}
.nav-group-chevron.open { transform: rotate(180deg); }

.nav-group-items {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding-left: 12px;
  margin-top: 2px;
  border-left: 1px solid rgba(255,255,255,.07);
  margin-left: 18px;
}
.nav-group-items.open { display: flex; }

.nav-sub-item { font-size: 12.5px; padding: 7px 10px; }

/* ── Sub-grupos aninhados (2º nível: ART / Atestados / Geral / Contratos) ── */
.nav-sub-group { display: flex; flex-direction: column; margin-top: 2px; }

.nav-sub-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 5px 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  cursor: pointer;
  transition: color .15s;
}
.nav-sub-group-header:hover { color: var(--text-secondary); }
.nav-sub-group-header.open  { color: var(--text-secondary); }

.nav-sub-group-chevron {
  flex-shrink: 0;
  transition: transform .2s ease;
  stroke: currentColor;
}
.nav-sub-group-chevron.open { transform: rotate(180deg); }

.nav-sub-group-items {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding-left: 8px;
  border-left: 1px solid rgba(255,255,255,.05);
  margin-left: 6px;
}
.nav-sub-group-items.open { display: flex; }

.nav-sub-sub-item { font-size: 12px; padding: 6px 10px; }

/* ── Tabela de administração ── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: rgba(255,255,255,.02); }
.admin-table input[type="checkbox"] {
  width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent);
}
.admin-status { font-size: 14px; font-weight: 600; }

.version-tag {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
}

/* ── Sidebar toggle button ── */
.sidebar-toggle-btn {
  margin-left: auto;
  flex-shrink: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s;
}
.sidebar-toggle-btn:hover { color: var(--text-primary); background: var(--bg-card); }

/* ── Sidebar mini mode ── */
#app.sidebar-mini .sidebar { width: 56px; overflow: hidden; }
#app.sidebar-mini .main-content { margin-left: 56px; max-width: calc(100vw - 56px); }
#app.sidebar-mini .sidebar-logo-img { display: none; }
#app.sidebar-mini .sidebar-logo { justify-content: center; padding: 14px 8px; }
#app.sidebar-mini .sidebar-toggle-btn { margin-left: 0; }
#app.sidebar-mini .nav-item span,
#app.sidebar-mini .nav-group-header span,
#app.sidebar-mini .nav-group-chevron,
#app.sidebar-mini .nav-section-label { display: none; }
#app.sidebar-mini .nav-item,
#app.sidebar-mini .nav-group-header { justify-content: center; padding: 9px 8px; gap: 0; }
#app.sidebar-mini .nav-group-header-left { gap: 0; }
#app.sidebar-mini .nav-group-items {
  display: flex !important;
  padding-left: 0;
  border-left: none;
  margin-left: 0;
}
#app.sidebar-mini .nav-sub-group-header { display: none; }
#app.sidebar-mini .nav-sub-group-items {
  display: flex !important;
  padding-left: 0;
  border-left: none;
  margin-left: 0;
}
#app.sidebar-mini .sidebar-user-details,
#app.sidebar-mini .version-tag { display: none; }
#app.sidebar-mini .sidebar-user { justify-content: center; gap: 0; }
#app.sidebar-mini .sidebar-footer { align-items: center; padding: 12px 8px; gap: 4px; }

/* Grupo pai ativo em mini mode */
#app.sidebar-mini .nav-group-header.group-active {
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(59,130,246,.2);
}
#app.sidebar-mini .nav-group-header.group-active svg { stroke: var(--accent); }

/* ── Main content ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  max-width: calc(100vw - var(--sidebar-w));
  overflow-x: hidden;
  padding: 32px 36px;
  min-height: 100vh;
}

/* ── Page header ── */
.page-header {
  margin-bottom: 32px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.01em;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Form ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid.cols-1 { grid-template-columns: 1fr; }

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

.form-group.full-width { grid-column: 1 / -1; }

label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}

label .required {
  color: var(--accent);
  font-size: 14px;
  line-height: 1;
}

/* ── Campos editáveis — padrão global ──────────────────────────────────── */
.form-control,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="search"],
select,
textarea {
  background:    var(--bg-field);
  border:        1.5px solid var(--border-input);
  border-radius: 8px;
  color:         var(--text-primary);
  font-family:   var(--font-body);
  font-size:     14px;
  padding:       11px 14px;
  min-height:    42px;
  line-height:   1.4;
  transition:    border-color .18s, box-shadow .18s, background .18s;
  outline:       none;
  width:         100%;
}

/* Placeholder visível mas claramente distinguível do conteúdo */
.form-control::placeholder,
input::placeholder,
textarea::placeholder {
  color: rgba(142,158,195,0.45);
  font-style: italic;
}

/* Focus — borda azul + halo suave */
.form-control:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--border-focus);
  box-shadow:   0 0 0 3px var(--accent-dim);
  background:   var(--bg-field);
  color:        var(--text-primary);
}

/* Disabled — recuado, claramente inativo */
.form-control:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity:        0.45;
  cursor:         not-allowed;
  border-color:   rgba(100,130,210,0.15);
  background:     rgba(0,0,0,0.25);
}

.form-control.error,
input.error,
select.error { border-color: var(--danger) !important; }

select option { background: var(--bg-card); }

textarea { resize: vertical; min-height: 80px; }

.input-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Username preview badge */
.username-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 4px;
  font-size: 12.5px;
  transition: all .2s;
}

.username-preview .username-val {
  font-family: monospace;
  color: var(--accent);
  font-size: 13px;
}

.username-preview .email-val {
  color: var(--text-secondary);
  font-size: 12px;
}

.badge-exists {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

.badge-exists.ok   { background: rgba(0,196,159,.2); color: var(--accent); }
.badge-exists.err  { background: rgba(255,90,95,.15); color: var(--danger); }

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.toggle-label { font-size: 13.5px; color: var(--text-primary); }

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 22px;
  transition: .2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: .2s;
}

.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #0a1612;
}

.btn-primary:hover {
  background: #00ddb3;
  box-shadow: 0 4px 18px var(--accent-glow);
}

.btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

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

.btn-lg { padding: 14px 32px; font-size: 15px; }

/* Action bar */
.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* ── Status / Toast ── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 420px;
}

.toast {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 13.5px;
  line-height: 1.5;
  border-left: 4px solid;
  animation: slideIn .25s ease;
  background: var(--bg-surface);
  box-shadow: 0 8px 28px rgba(0,0,0,.4);
}

.toast.success { border-color: var(--accent); }
.toast.error   { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
.toast.info    { border-color: var(--info); }

.toast-title {
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 3px;
}

.toast.success .toast-title { color: var(--accent); }
.toast.error   .toast-title { color: var(--danger); }
.toast.warning .toast-title { color: var(--warning); }

@keyframes slideIn {
  from { transform: translateX(30px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Etapas de progresso ── */
.etapas-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.etapa-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
}

.etapa-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.etapa-icon.ok      { background: rgba(0,196,159,.2); color: var(--accent); }
.etapa-icon.err     { background: rgba(255,90,95,.15); color: var(--danger); }
.etapa-icon.warn    { background: rgba(245,166,35,.15); color: var(--warning); }
.etapa-icon.loading { background: var(--bg-card); }

.etapa-body { flex: 1; }
.etapa-name { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.etapa-msg  { font-size: 12px; color: var(--text-secondary); }

/* ── Loading spinner ── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Home stats ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 600;
}

/* ── Table ── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid rgba(46,51,71,.5);
  transition: background .14s;
}

tbody tr:hover { background: rgba(30,35,51,.6); }

tbody td {
  padding: 11px 14px;
  color: var(--text-secondary);
  vertical-align: middle;
}

tbody td:first-child { color: var(--text-primary); font-weight: 500; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
}

.badge-green  { background: rgba(59,130,246,.15); color: var(--accent); }
.badge-red    { background: rgba(255,90,95,.12); color: var(--danger); }
.badge-yellow { background: rgba(245,166,35,.12); color: var(--warning); }
.badge-blue   { background: rgba(79,172,254,.12); color: var(--info); }

/* ── Autocomplete ── */
.autocomplete-wrap { position: relative; }

.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  display: none;
}

.autocomplete-list.open { display: block; }

.autocomplete-item {
  padding: 9px 13px;
  cursor: pointer;
  font-size: 13px;
  transition: background .12s;
}

.autocomplete-item:hover { background: var(--accent-dim); color: var(--accent); }

.autocomplete-item .ac-name { font-weight: 500; }
.autocomplete-item .ac-mail { font-size: 11px; color: var(--text-muted); }

/* ── Login Screen ── */
.login-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0d1117 0%, #111828 60%, #0f1825 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 44px 40px 40px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.06);
}

.login-logo {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 32px;
}

.login-logo-img {
  height: 36px;
  width: auto;
  display: block;
}

.login-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--brand-navy);
  margin-bottom: 5px;
}

.login-system-name {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.login-subtitle {
  color: #64748b;
  font-size: 13px;
  margin-bottom: 26px;
}

/* Inputs dentro do card branco */
.login-card label {
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: 11.5px;
  font-weight: 600;
}

.login-card input[type="text"],
.login-card input[type="password"] {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

.login-card input[type="text"]:focus,
.login-card input[type="password"]:focus {
  border-color: var(--brand-navy);
  box-shadow: 0 0 0 3px rgba(29,52,97,.12);
}

.login-card input::placeholder { color: #94a3b8; }

.login-card .btn-primary {
  background: var(--brand-navy);
  color: #ffffff;
}

.login-card .btn-primary:hover {
  background: #254480;
  box-shadow: 0 4px 18px rgba(29,52,97,.35);
}

.login-card .btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.login-error {
  background: rgba(244,91,91,.08);
  border: 1px solid rgba(244,91,91,.3);
  border-radius: var(--radius-sm);
  color: #dc2626;
  font-size: 13px;
  padding: 10px 14px;
  margin-top: 14px;
}

.login-btn {
  width: 100%;
  margin-top: 20px;
  justify-content: center;
}

/* ── Sidebar: usuário logado ── */
.sidebar-footer {
  flex-shrink: 0;           /* nunca encolhe — fica fixo no rodapé */
  padding: 14px 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface); /* mesma cor da sidebar — não vaza nada por baixo */
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.sidebar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(59,130,246,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.sidebar-user-details {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.sidebar-user-handle {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: color .18s, background .18s;
  flex-shrink: 0;
}

.sidebar-logout-btn:hover {
  color: var(--danger);
  background: rgba(255,90,95,.1);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Senha Expirada — banner de status ── */
.senha-status-banner {
  display: flex;
  align-items: center;
  padding: 22px 24px;
  border-left-width: 5px;
}

.senha-status-label {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.senha-status-sub {
  font-size: 13px;
  margin-top: 3px;
  opacity: .8;
}

.senha-status-expired {
  border-color: var(--danger);
  background: rgba(244,91,91,.07);
  color: var(--danger);
}

.senha-status-warning {
  border-color: var(--warning);
  background: rgba(245,166,35,.07);
  color: var(--warning);
}

.senha-status-ok {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.senha-status-unknown {
  border-color: var(--text-muted);
  background: transparent;
  color: var(--text-secondary);
}

.senha-campo {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.senha-campo:last-child { border-bottom: none; }

.senha-campo-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.senha-campo-valor {
  font-size: 13.5px;
  color: var(--text-primary);
  font-family: monospace;
}

/* ── Proxy Aliases ── */
.proxy-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.proxy-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  gap: 10px;
  transition: background .14s;
}

.proxy-item:hover { background: var(--bg-input); }

.proxy-item-primary {
  border-color: rgba(59,130,246,.3);
  background: rgba(59,130,246,.05);
}

.proxy-addr {
  font-family: monospace;
  font-size: 13.5px;
  color: var(--text-primary);
  word-break: break-all;
}

.proxy-item-primary .proxy-addr { color: var(--accent); }

/* ── Aviso de senha expirando ── */
.pwd-warning-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pwd-warning-card {
  background: var(--bg-card);
  border-radius: var(--radius, 10px);
  padding: 36px 40px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.pwd-warning-alert { border-top: 4px solid #f59e0b; }
.pwd-warning-error  { border-top: 4px solid var(--danger); }

.pwd-warning-card h3 {
  margin: 12px 0 8px;
  font-size: 18px;
}

.pwd-warning-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}

.pwd-warning-card .btn {
  margin: 4px;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid.cols-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 650px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .main-content { padding: 20px 16px; }
}

/* =====================================================
   Tema "Rhama Analysis" (opcional) — ativado via
   data-theme="rhama" no <html>, ver app.js:setSigTheme.
   Tokens preservados literalmente da especificação de marca.
   ===================================================== */
html[data-theme="rhama"] {
  /* Sem isso, o Chrome/Edge no Windows aplica o tema nativo ESCURO em
     controles nao totalmente estilizaveis via CSS (select fechado,
     scrollbar, etc.) quando o SO/navegador prefere dark — mesmo com
     background/color customizados no elemento. */
  color-scheme: light;
  --brand-blue:  #0047BB;
  --brand-navy:  #1B365D;
  --brand-cyan:  #0090DA;
  --brand-teal:  #004F59;

  --fg-1: #1B365D;
  --fg-2: #3C4D58;
  --fg-3: #5B6B75;
  --fg-inverse: #FFFFFF;

  --bg-app:    #F4F4F2;
  --bg-card:   #FFFFFF;
  --bg-subtle: #ECEEEB;

  --border:      #DDE1DC;
  --border-soft: #ECEEEA;

  --success: #257226;
  --warning: #B97A1A;
  --danger:  #A3402F;
  --info:    #0090DA;

  --pilar-tecnico: #0047BB;
  --pilar-mercado: #0090DA;
  --pilar-rh:      #94795D;
  --pilar-venda:   #257226;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(27,54,93,.07);
  --shadow-md: 0 8px 24px rgba(27,54,93,.10), 0 2px 6px rgba(27,54,93,.06);

  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-6: 24px; --space-8: 32px; --space-12: 48px;

  --ease: cubic-bezier(.2,.6,.2,1);
  --t-base: 200ms;

  /* ── Ponte: nomes de variável que o resto do main.css já consome ── */
  --bg-base:       var(--bg-app);
  --bg-surface:    var(--bg-card);
  --bg-input:      var(--bg-subtle);
  --bg-field:      var(--bg-subtle);
  --border-input:  var(--border);
  --border-focus:  var(--brand-blue);
  --accent:        var(--brand-blue);
  --accent-dim:    rgba(0,71,187,.12);
  --accent-glow:   rgba(0,71,187,.28);
  --text-primary:   var(--fg-1);
  --text-secondary: var(--fg-2);
  --text-muted:     var(--fg-3);
  --radius: var(--radius-lg);

  /* Tipografia NÃO sobrescrita de propósito — mesma fonte (Syne/DM Sans) do
     tema atual em ambos os temas. Não adicionar @font-face nem trocar
     --font-display/--font-body aqui. */
}

/* ── Correções pontuais: literais hardcoded que não reagem à variável ── */
html[data-theme="rhama"] tbody tr:hover,
html[data-theme="rhama"] .admin-table tbody tr:hover td { background: var(--bg-subtle); }
html[data-theme="rhama"] .btn-primary { color: var(--fg-inverse); }
html[data-theme="rhama"] .btn-primary:hover { background: #00399e; box-shadow: 0 4px 18px rgba(0,71,187,.32); }

/* ── Sidebar continua navy escura com texto branco, mesmo com o app claro ── */
html[data-theme="rhama"] .sidebar,
html[data-theme="rhama"] .sidebar-footer { background: var(--brand-navy); }
html[data-theme="rhama"] .nav-section-label { color: rgba(255,255,255,.55); }
html[data-theme="rhama"] .nav-item,
html[data-theme="rhama"] .nav-group-header,
html[data-theme="rhama"] .nav-sub-group-header { color: rgba(255,255,255,.75); }
html[data-theme="rhama"] .nav-item:hover,
html[data-theme="rhama"] .nav-group-header:hover { background: rgba(255,255,255,.08); color: #fff; }
html[data-theme="rhama"] .nav-group-header.open { color: #fff; }
html[data-theme="rhama"] .nav-sub-group-header:hover,
html[data-theme="rhama"] .nav-sub-group-header.open { color: #fff; }
html[data-theme="rhama"] .sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.4); }
html[data-theme="rhama"] .nav-item.active,
html[data-theme="rhama"] #app.sidebar-mini .nav-group-header.group-active {
  background: rgba(255,255,255,.14);
  color: #fff;
  border-color: rgba(255,255,255,.3);
}
html[data-theme="rhama"] .nav-item.active svg { stroke: #fff; }
/* .sidebar-logout-btn NÃO precisa de override: fica dentro do card branco
   (.sidebar-user usa --bg-card), não direto no fundo navy — a cor padrão
   (var(--text-muted) -> --fg-3) já contrasta bem contra branco. NÃO force
   uma cor clara aqui — isso já foi tentado no Engine e sumiu o botão
   (branco sobre branco). */
html[data-theme="rhama"] .sidebar-toggle-btn { color: rgba(255,255,255,.75); }
html[data-theme="rhama"] .version-tag { color: rgba(255,255,255,.45); }

/* ── Sucesso = verde de verdade (hoje .badge-green é um apelido histórico pro azul) ── */
html[data-theme="rhama"] .badge-green,
html[data-theme="rhama"] .etapa-icon.ok,
html[data-theme="rhama"] .badge-exists.ok,
html[data-theme="rhama"] .senha-status-ok { color: var(--success); }
html[data-theme="rhama"] .badge-green { background: rgba(37,114,38,.12); }

/* ── Toggle de duas bolinhas (sidebar footer) ── */
.sidebar-theme-toggle { display: flex; align-items: center; gap: 8px; padding: 2px 2px 0; }
.theme-dot {
  width: 16px; height: 16px; border-radius: 50%;
  border: none; padding: 0; cursor: pointer;
  transition: transform .15s var(--ease, ease);
}
.theme-dot:hover { transform: scale(1.15); }
.theme-dot-default { background: #1D3461; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.theme-dot-rhama   { background: #F4F4F2; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
html:not([data-theme]) .theme-dot-default {
  box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--accent);
}
html[data-theme="rhama"] .theme-dot-rhama {
  box-shadow: 0 0 0 2px var(--brand-navy), 0 0 0 4px var(--brand-blue);
}
#app.sidebar-mini .sidebar-theme-toggle { display: none; }
