/* ═══════════════════════════════════════════════════════════════════════
   RN Backup — Design System v2 ("Copper")
   ───────────────────────────────────────────────────────────────────────
   Linguagem: SaaS premium claro sobre neutros QUENTES (família stone —
   mantém a identidade acolhedora pedida na v1, sem o look "creme antigo"),
   ação primária em quase-preto (padrão shadcn/Linear), acento cobre
   reservado pra marca/estado ativo/foco. Uma única fonte (Inter variável,
   servida localmente em /lib/fonts — zero dependência externa), ícones
   Lucide inline via app.js.

   Regra de ouro: cor de status só aparece onde ELA é a informação.
   Todo o resto é neutro.
   ═══════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: "Inter";
  src: url("/lib/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* superfícies */
  --bg: #f7f6f3;
  --bg-elev: #efede8; /* legado */
  --bg-card: #ffffff;
  --bg-inset: #f2f0ec;

  /* traços */
  --border: #e9e6e0;
  --border-strong: #d8d4cc;

  /* texto */
  --text: #211d19;
  --text-mid: #57514a;
  --text-dim: #8a837a;

  /* marca */
  --accent: #9a5237;
  --accent-hover: #834430;
  --accent-soft: rgba(154, 82, 55, 0.09);
  --ring: rgba(154, 82, 55, 0.28);

  /* status (dessaturados de propósito — confortáveis em uso prolongado) */
  --ok: #3e7a52;
  --ok-soft: #e7f0ea;
  --warn: #9a6b1f;
  --warn-soft: #f7efdd;
  --error: #b04a41;
  --error-soft: #f9e9e7;
  --info: #3d6a8a;
  --info-soft: #e7eef4;
  --offline: #989186;
  --offline-soft: #edebe7;

  /* aliases legados usados em estilos inline das páginas antigas */
  --success: var(--ok);
  --warning: var(--warn);
  --muted: var(--text-dim);

  /* geometria */
  --radius-sm: 7px;
  --radius: 10px;
  --radius-lg: 14px;

  /* sombras — quase imperceptíveis de propósito */
  --shadow-xs: 0 1px 2px rgba(28, 22, 16, 0.05);
  --shadow-sm: 0 1px 3px rgba(28, 22, 16, 0.07), 0 1px 2px rgba(28, 22, 16, 0.04);
  --shadow-md: 0 4px 14px rgba(28, 22, 16, 0.09);
  --shadow-lg: 0 12px 40px rgba(28, 22, 16, 0.16);

  --font-sans: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --sidebar-w: 232px;
}

/* ── Base ───────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.55;
  letter-spacing: -0.006em;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv05", "cv11", "ss01";
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

::selection { background: rgba(154, 82, 55, 0.18); }

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

/* Scrollbars discretos */
* { scrollbar-width: thin; scrollbar-color: #d3cfc7 transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #d3cfc7; border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: #bcb7ad; }
*::-webkit-scrollbar-track { background: transparent; }

.mono, .tnum { font-variant-numeric: tabular-nums; }

svg.lucide { flex: 0 0 auto; vertical-align: -0.155em; }

/* ── Sidebar ────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 18px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
}
.sidebar .brand .brand-mark {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #a85a3c, #7e3f28);
  color: #fff;
  border-radius: 9px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), var(--shadow-xs);
}
.sidebar .brand .brand-sub {
  display: block;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-dim);
  margin-top: 1px;
}

.sidebar nav { flex: 1; padding: 4px 12px; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  margin-bottom: 2px;
  color: var(--text-mid);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border-left: none;
  transition: background 0.12s ease, color 0.12s ease;
}
.sidebar nav a .lucide { color: var(--text-dim); transition: color 0.12s ease; }
.sidebar nav a:hover { color: var(--text); background: var(--bg-inset); }
.sidebar nav a:hover .lucide { color: var(--text-mid); }
.sidebar nav a.active {
  color: var(--text);
  font-weight: 600;
  background: var(--bg-inset);
}
.sidebar nav a.active .lucide { color: var(--accent); }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-dim);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user .avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  color: var(--text-mid);
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 650;
  flex: 0 0 auto;
}
.sidebar-user .user-meta { flex: 1; min-width: 0; }
.sidebar-user .user-email {
  font-size: 12px; font-weight: 500; color: var(--text-mid);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user .user-build { font-size: 10.5px; color: var(--text-dim); }
.sidebar-user .logout-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  transition: background 0.12s ease, color 0.12s ease;
}
.sidebar-user .logout-btn:hover { color: var(--error); background: var(--error-soft); }

/* ── Área de conteúdo ───────────────────────────────────────────────── */
.content {
  flex: 1;
  min-width: 0;
  padding: 28px 36px 48px;
  max-width: 1440px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}
.page-header h1 {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.022em;
  margin: 0;
}
.page-header .subtitle { color: var(--text-dim); font-size: 13px; margin-top: 3px; font-weight: 400; }

/* ── Botões ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: #24201c;
  color: #fff;
  border: 1px solid #24201c;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 550;
  letter-spacing: -0.004em;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.13s ease, border-color 0.13s ease, color 0.13s ease, box-shadow 0.13s ease;
  box-shadow: var(--shadow-xs);
}
.btn:hover { background: #3a342e; border-color: #3a342e; opacity: 1; }
.btn:active { background: #171412; }
.btn:disabled { opacity: 0.55; cursor: default; box-shadow: none; }

.btn.secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-mid);
}
.btn.secondary:hover { background: var(--bg-inset); color: var(--text); border-color: var(--border-strong); }
.btn.secondary:active { background: var(--border); }

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-mid);
  box-shadow: none;
}
.btn.ghost:hover { background: var(--bg-inset); color: var(--text); }

.btn.danger {
  background: var(--bg-card);
  border-color: rgba(176, 74, 65, 0.35);
  color: var(--error);
}
.btn.danger:hover { background: var(--error-soft); border-color: var(--error); }

.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }

/* chip de atualização de versão (mantido da v1, refinado) */
.btn-update {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--warn-soft);
  border: 1px solid rgba(154, 107, 31, 0.32);
  color: var(--warn);
  border-radius: 999px;
  padding: 2.5px 10px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.13s ease;
}
.btn-update:hover { background: #f1e4c8; }
.btn-update:disabled { opacity: 0.6; cursor: default; }

/* ── Formulários ────────────────────────────────────────────────────── */
input[type=text], input[type=password], input[type=email], input[type=number], select, textarea {
  font-family: inherit;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.45;
  transition: border-color 0.13s ease, box-shadow 0.13s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}
input:disabled, select:disabled { background: var(--bg-inset); color: var(--text-dim); }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a837a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  padding-right: 30px;
}

.modal-label, label.field-label {
  display: block;
  font-size: 12px;
  font-weight: 550;
  color: var(--text-mid);
  margin: 14px 0 5px;
  letter-spacing: -0.003em;
}

/* ── KPIs ───────────────────────────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 13px;
  box-shadow: var(--shadow-xs);
}
.kpi-card .label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: -0.002em;
  display: flex; align-items: center; gap: 6px;
}
.kpi-card .label::before {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--border-strong);
  display: none;
}
.kpi-card .value {
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.03em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.kpi-card.ok .label::before { display: inline-block; background: var(--ok); }
.kpi-card.warn .label::before { display: inline-block; background: var(--warn); }
.kpi-card.error .label::before { display: inline-block; background: var(--error); }
.kpi-card.offline .label::before { display: inline-block; background: var(--offline); }
.kpi-card.ok .value, .kpi-card.warn .value, .kpi-card.error .value, .kpi-card.offline .value { color: var(--text); }
.kpi-card.error .value { color: var(--error); }
.kpi-card.warn .value { color: var(--warn); }

/* ── Painéis / grids ────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-xs);
}
.panel h2 {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.panel h2 .lucide { color: var(--text-dim); }
.panel h2.os-header { display: flex; align-items: center; gap: 10px; }
.panel h2.os-header img { width: 22px; height: 22px; object-fit: contain; }

/* ── Donut ──────────────────────────────────────────────────────────── */
.donut-wrap { display: flex; align-items: center; gap: 28px; }
.donut {
  width: 132px; height: 132px; border-radius: 50%;
  background: conic-gradient(
    var(--ok) 0 var(--p-ok),
    var(--warn) var(--p-ok) var(--p-warn),
    var(--error) var(--p-warn) var(--p-error),
    var(--offline) var(--p-error) 100%
  );
  position: relative;
}
.donut::after {
  content: '';
  position: absolute; inset: 16px;
  background: var(--bg-card); border-radius: 50%;
}
.donut-legend { font-size: 12.5px; color: var(--text-mid); }
.donut-legend div { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.donut-legend .dot { width: 8px; height: 8px; border-radius: 50%; }

/* ── Barras de tendência ────────────────────────────────────────────── */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar { width: 100%; max-width: 44px; background: var(--error); opacity: 0.85; border-radius: 4px 4px 2px 2px; min-height: 2px; }
.bar-label { font-size: 11px; color: var(--text-dim); margin-top: 7px; font-variant-numeric: tabular-nums; }

/* ── Listas ─────────────────────────────────────────────────────────── */
.attention-list { list-style: none; margin: 0; padding: 0; }
.attention-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.attention-list li:last-child { border-bottom: none; padding-bottom: 0; }
.attention-list li:first-child { padding-top: 0; }
.attention-list .who { font-weight: 600; letter-spacing: -0.008em; }
.attention-list .what { color: var(--text-dim); font-size: 12.5px; }

/* ── Badges e indicadores de status ─────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 550;
  letter-spacing: -0.002em;
  border: 1px solid transparent;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.error { background: var(--error-soft); color: var(--error); }
.badge.offline { background: var(--offline-soft); color: #6f6960; }

.conn { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; }
.conn.online { color: var(--ok); }
.conn.offline { color: var(--text-dim); }
.conn.uninstalled { color: var(--error); }

/* ── Tabelas ────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 550;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tr:hover td { background: transparent; }
tbody tr:hover td { background: rgba(28, 22, 16, 0.018); }
.clickable-row { cursor: pointer; }
.group-header td {
  font-weight: 600; font-size: 12px;
  background: var(--bg-inset);
  color: var(--text-mid);
  padding: 6px 12px;
}
.group-header:hover td { background: var(--bg-inset); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 0 2px; }

.table-scroll { overflow-x: auto; }

/* ── Cards de servidor (grid de Backups) ────────────────────────────── */
.server-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  margin-bottom: 14px;
  overflow: hidden;
}
.server-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to bottom, rgba(28,22,16,0.012), transparent);
}
.server-card-head .server-name {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.012em;
  display: flex; align-items: center; gap: 8px;
}
.server-card-head .server-name .lucide { color: var(--text-dim); }
.server-card-head .server-meta {
  color: var(--text-dim);
  font-size: 12px;
  display: inline-flex; align-items: center; gap: 6px;
}
.server-card-head .head-actions { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
/* Largura fixa por coluna — os cards ficam empilhados e as colunas
   PRECISAM alinhar verticalmente entre um card e outro (aprendizado da
   v1: sem isso cada tabela calcula larguras próprias e a grade "dança"
   de um servidor pro outro). */
.server-card table { font-size: 12.8px; table-layout: fixed; min-width: 980px; }
.server-card table th:nth-child(1), .server-card table td:nth-child(1) { width: 10%; }
.server-card table th:nth-child(2), .server-card table td:nth-child(2) { width: 13%; overflow: hidden; text-overflow: ellipsis; }
.server-card table th:nth-child(3), .server-card table td:nth-child(3) { width: 14%; white-space: nowrap; }
.server-card table th:nth-child(4), .server-card table td:nth-child(4) { width: 15%; white-space: nowrap; }
.server-card table th:nth-child(5), .server-card table td:nth-child(5) { width: 13%; white-space: nowrap; }
.server-card table th:nth-child(6), .server-card table td:nth-child(6) { width: 9%; white-space: nowrap; }
.server-card table th:nth-child(7), .server-card table td:nth-child(7) { width: 11%; white-space: nowrap; }
.server-card table th:first-child, .server-card table td:first-child { padding-left: 18px; }
.server-card table th:last-child, .server-card table td:last-child { padding-right: 12px; width: 52px; }
/* Job com erro vira DUAS linhas (dados + linha do erro): a divisória fica
   só embaixo da segunda. Job sem erro é uma linha normal. */
.server-card tr.job-row-top.has-bottom td { border-bottom: none; padding-bottom: 4px; }
.server-card tr.job-row-bottom td { padding-top: 0; padding-bottom: 11px; }
.server-card tbody tr:last-child td { border-bottom: none; }
.server-card .job-name { font-weight: 550; color: var(--text); }
.server-card .tool-cell { color: var(--text-mid); }
.server-card td.cell-dim { color: var(--text-dim); font-variant-numeric: tabular-nums; }

.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; }
.status-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.status-dot.online { color: var(--ok); }
.status-dot.online::before { box-shadow: 0 0 0 3px rgba(62, 122, 82, 0.15); }
.status-dot.offline { color: var(--text-dim); }
.status-dot.uninstalled { color: var(--error); }

/* compat: páginas antigas que ainda usam .server-block */
.server-block { margin-bottom: 20px; }
.server-block .server-title { font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.server-block .table-scroll { overflow-x: auto; }
.server-block table td { padding: 8px 10px; }

/* ── Barra de progresso ─────────────────────────────────────────────── */
.progress-bar {
  width: 100%; min-width: 90px; max-width: 220px; height: 5px; margin-top: 5px;
  background: var(--bg-inset); border: 1px solid var(--border);
  border-radius: 99px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ok), #4f9265);
  border-radius: 99px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: var(--ok);
  max-width: 100%; overflow: hidden;
}
.progress-label .progress-label-text {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.progress-label .spin { animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Menu suspenso (ações por linha) ────────────────────────────────── */
.menu-wrap { position: relative; display: inline-block; }
.menu-trigger {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim);
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.12s ease, color 0.12s ease;
}
.menu-trigger:hover, .menu-wrap.open .menu-trigger { background: var(--bg-inset); color: var(--text); }
.menu {
  position: absolute;
  right: 0; top: calc(100% + 4px);
  min-width: 178px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 5px;
  z-index: 60;
  display: none;
  animation: menuIn 0.12s ease;
}
.menu-wrap.open .menu { display: block; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.menu button {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  background: none; border: none; cursor: pointer;
  font-family: inherit;
  font-size: 12.8px; font-weight: 500;
  color: var(--text-mid);
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background 0.1s ease, color 0.1s ease;
}
.menu button .lucide { color: var(--text-dim); }
.menu button:hover { background: var(--bg-inset); color: var(--text); }
.menu button:hover .lucide { color: var(--text-mid); }
.menu button.danger { color: var(--error); }
.menu button.danger .lucide { color: var(--error); }
.menu button.danger:hover { background: var(--error-soft); }
.menu .menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }

/* ── Layout da página Backups (rail + grid) ─────────────────────────── */
.backups-layout {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.backups-rail {
  position: sticky; top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}
@media (max-width: 860px) {
  .backups-layout { grid-template-columns: minmax(0, 1fr); }
  .backups-rail { position: static; max-height: none; overflow-y: visible; }
  .client-rail { display: flex; flex-wrap: wrap; gap: 4px; }
  .client-rail li { margin-bottom: 0; }
}

/* ── Rail de clientes (página Backups) ──────────────────────────────── */
.client-rail { list-style: none; margin: 0; padding: 0; }
.client-rail li {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-mid);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.client-rail li .lucide { color: var(--text-dim); }
.client-rail li:hover { background: var(--bg-inset); color: var(--text); }
.client-rail li.active { background: var(--bg-inset); color: var(--text); font-weight: 600; }
.client-rail li.active .lucide { color: var(--accent); }
.rail-search { position: relative; margin-bottom: 10px; }
.rail-search input { width: 100%; padding-left: 32px; }
.rail-search .lucide {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim); pointer-events: none;
}

/* ── Estado vazio ───────────────────────────────────────────────────── */
.empty-state {
  color: var(--text-dim);
  font-size: 13px;
  padding: 36px 20px;
  text-align: center;
}
.empty-state .empty-icon {
  width: 40px; height: 40px;
  margin: 0 auto 10px;
  border-radius: 12px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
}
.empty-state .empty-title { font-weight: 600; color: var(--text-mid); font-size: 13.5px; margin-bottom: 2px; }

/* ── Skeleton ───────────────────────────────────────────────────────── */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--bg-inset);
  border-radius: 6px;
  min-height: 12px;
}
.skeleton::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.65), transparent);
  animation: shimmer 1.4s infinite;
  transform: translateX(-100%);
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* ── Toast ──────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 20px; right: 20px;
  z-index: 300;
  display: flex; flex-direction: column; gap: 8px;
  max-width: 380px;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: #211d19;
  color: #f5f2ee;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 11px 14px;
  font-size: 12.8px;
  line-height: 1.5;
  animation: toastIn 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.toast .lucide { margin-top: 1px; }
.toast.ok .lucide { color: #7fbf94; }
.toast.error .lucide { color: #e3958d; }
.toast.warn .lucide { color: #d9b36b; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.toast.hide { opacity: 0; transform: translateY(6px); transition: all 0.22s ease; }

/* ── Misc legado ────────────────────────────────────────────────────── */
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.error-text { color: var(--error); font-size: 12px; margin-top: 10px; }
.hint { color: var(--text-dim); font-size: 12px; margin: 0 0 12px; }
.steps { font-size: 13px; line-height: 1.9; padding-left: 20px; margin: 0; color: var(--text-mid); }
.steps li { margin-bottom: 4px; }
.steps strong { color: var(--text); }

.code-block {
  background: #221e1a;
  color: #e8e2da;
  border: 1px solid #38322c;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12.3px;
  line-height: 1.65;
  overflow-x: auto;
  margin: 0 0 12px;
  white-space: pre-wrap;
  word-break: break-all;
}
.code-block-wrap { position: relative; }
.code-block-wrap .code-block { padding-right: 84px; }
.code-block-wrap .copy-btn {
  position: absolute; top: 9px; right: 9px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  color: #cfc8bf;
  border-radius: 6px; padding: 4px 11px;
  font-family: inherit;
  font-size: 11.5px; font-weight: 550; cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.code-block-wrap .copy-btn:hover { color: #fff; background: rgba(255,255,255,0.15); }

/* ── Tabs ───────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  background: none; border: none;
  font-family: inherit;
  color: var(--text-dim);
  font-size: 13.5px; font-weight: 550;
  padding: 9px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  letter-spacing: -0.008em;
  transition: color 0.12s ease;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }

/* ── Modal ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(24, 19, 14, 0.42);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 22px 24px;
  width: 400px; max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
  animation: modalIn 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.05);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal h2 { font-size: 15px; font-weight: 650; letter-spacing: -0.015em; margin: 0 0 14px; }
.modal input, .modal select { width: 100%; margin-bottom: 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.modal.modal-wide { width: 820px; }
.modal-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.modal-section:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
.modal-section:first-of-type .modal-label:first-child { margin-top: 0; }
.modal-section-title {
  font-size: 11px; font-weight: 650; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-dim); margin-bottom: 2px;
}
.modal-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 760px) {
  .modal.modal-wide { width: 92vw; }
  .modal-grid-2 { grid-template-columns: 1fr; }
}

/* ── Login ──────────────────────────────────────────────────────────── */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; width: 100%;
  background:
    radial-gradient(700px 420px at 78% -8%, rgba(154, 82, 55, 0.07), transparent 62%),
    radial-gradient(560px 380px at 12% 108%, rgba(154, 82, 55, 0.05), transparent 60%),
    var(--bg);
  padding: 20px;
}
.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 36px 34px 30px;
  width: 372px;
  max-width: 100%;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-brand .brand-mark {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #a85a3c, #7e3f28);
  color: #fff;
  border-radius: 11px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), var(--shadow-sm);
}
.login-brand h1 { font-size: 17px; font-weight: 650; letter-spacing: -0.02em; margin: 0; }
.login-brand .brand-sub { font-size: 12px; color: var(--text-dim); margin-top: 1px; }
.login-box .field-label { margin-top: 0; }
.login-box input { width: 100%; margin-bottom: 14px; padding: 9px 12px; font-size: 13.5px; }
.login-box .btn { width: 100%; padding: 9px 14px; font-size: 13.5px; margin-top: 4px; }
.login-error {
  display: flex; align-items: center; gap: 8px;
  background: var(--error-soft);
  border: 1px solid rgba(176, 74, 65, 0.25);
  color: var(--error);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 12.5px;
  margin-bottom: 14px;
}
.login-footer { text-align: center; margin-top: 18px; font-size: 11.5px; color: var(--text-dim); }

/* ── Responsivo ─────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .content { padding: 22px 24px 40px; }
}
@media (max-width: 960px) {
  :root { --sidebar-w: 60px; }
  .sidebar .brand { justify-content: center; padding: 16px 0 14px; }
  .sidebar .brand .brand-text { display: none; }
  .sidebar nav { padding: 4px 8px; }
  .sidebar nav a { justify-content: center; padding: 10px; }
  .sidebar nav a .nav-label { display: none; }
  .sidebar-footer { padding: 10px 8px; }
  .sidebar-user { flex-direction: column; gap: 8px; }
  .sidebar-user .user-meta { display: none; }
  .page-header { flex-direction: column; }
  .page-header .page-actions { width: 100%; }
}
@media (max-width: 700px) {
  .content { padding: 16px 14px 36px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .modal { padding: 18px; }
}

/* Rodapé "Minha conta" (botão) + menu popover — padrão do RN Remote */
button.sidebar-user {
  width: 100%; background: none; border: 1px solid transparent;
  padding: 6px; margin: 0; border-radius: var(--radius-sm, 6px);
  cursor: pointer; text-align: left; font: inherit; color: inherit;
  transition: background 0.12s ease, border-color 0.12s ease;
}
button.sidebar-user:hover { background: var(--bg-inset); border-color: var(--border); }
.sidebar-user .user-chevron { display: flex; color: var(--text-dim); flex: 0 0 auto; }

.ui-menu {
  position: fixed; z-index: 3000; min-width: 210px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: 5px; opacity: 0; transform: translateY(2px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.ui-menu.open { opacity: 1; transform: none; }
.ui-menu-label {
  padding: 8px 10px 6px; font-size: 10.5px; font-weight: 650;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim);
}
.ui-menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.ui-menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border: 0; background: none; border-radius: var(--radius-sm, 6px);
  font: inherit; font-size: 13px; color: var(--text); cursor: pointer; text-align: left;
}
.ui-menu-item:hover, .ui-menu-item:focus-visible { background: var(--bg-inset); outline: none; }
.ui-menu-item .lucide { color: var(--text-mid); }
.ui-menu-item.danger, .ui-menu-item.danger .lucide { color: var(--error); }
.ui-menu-item.danger:hover { background: var(--error-soft); }

/* Modal "Alterar senha" */
.cp-head { display: flex; align-items: center; gap: 12px; }
.cp-icon {
  width: 36px; height: 36px; border-radius: 10px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-inset); border: 1px solid var(--border); color: var(--text-mid);
}
.cp-titles { flex: 1; min-width: 0; }
.cp-user { margin: 2px 0 0; font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-close { background: none; border: 0; cursor: pointer; color: var(--text-dim); padding: 6px; border-radius: var(--radius-sm, 6px); display: flex; }
.cp-close:hover { background: var(--bg-inset); color: var(--text); }
