:root {
  color-scheme: dark;
  --bg: #111315;
  --panel: #1a1d20;
  --panel-2: #22262a;
  --border: #343a40;
  --text: #e8eaed;
  --muted: #9aa4ad;
  --blue: #4c8df6;
  --green: #3fbf72;
  --yellow: #d6a93a;
  --red: #e05b5b;
  --bluegray: #7890a8;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Segoe UI, Arial, sans-serif;
}
.login-body {
  align-items: center;
  display: flex;
  min-height: 100vh;
  justify-content: center;
  padding: 24px;
}
.login-shell {
  padding: 0;
  width: min(440px, 100%);
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 18px;
  padding: 28px;
}
.login-logo {
  display: block;
  max-height: 86px;
  max-width: 100%;
  object-fit: contain;
}
.login-form {
  display: grid;
  gap: 12px;
}
.app-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: #151719;
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  padding: 0 4px 16px;
}
.brand-logo {
  display: block;
  height: 44px;
  margin: 0 0 10px;
  max-width: 190px;
  object-fit: contain;
  object-position: left center;
  width: 100%;
}
.brand h1 {
  font-size: 18px;
  line-height: 1.25;
}
nav {
  display: grid;
  gap: 6px;
}
.sidebar-user {
  border-top: 1px solid var(--border);
  bottom: 18px;
  display: grid;
  gap: 8px;
  left: 14px;
  padding-top: 14px;
  position: absolute;
  right: 14px;
}
.sidebar-user span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-item {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  justify-content: flex-start;
  text-align: left;
  width: 100%;
}
.nav-item:hover,
.nav-item.active {
  background: var(--panel-2);
  border-color: var(--border);
  color: var(--text);
}
.topbar {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 0 0 18px;
}
h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 0; }
p { color: var(--muted); margin: 0; }
main {
  min-width: 0;
  padding: 20px 24px 36px;
  position: relative;
}
.view { display: none; }
.view.active { display: block; }
button, input, select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  min-height: 38px;
  padding: 8px 10px;
}
button { cursor: pointer; font-weight: 650; }
button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}
.client-edit-link {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  display: inline-flex;
  font-weight: 650;
  justify-content: center;
  min-width: 58px;
  padding: 6px 10px;
  text-decoration: none;
}
.primary { background: var(--blue); border-color: var(--blue); color: white; }
.hidden { display: none; }
.actions { align-items: center; display: flex; gap: 12px; }
.loading { color: var(--muted); }
.summary-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.metric {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: default;
  padding: 14px;
  text-align: left;
  width: 100%;
}
.metric span { color: var(--muted); display: block; font-size: 12px; }
.metric strong { display: block; font-size: 26px; margin-top: 8px; }
.metric-green span,
.metric-green strong { color: #6ee69a; }
.metric-yellow span,
.metric-yellow strong { color: #f2c94c; }
.metric-orange span,
.metric-orange strong { color: #ff9f43; }
.metric-red span,
.metric-red strong { color: #ff6b6b; }
.metric-purple span,
.metric-purple strong { color: #d9b6ff; }
.metric.clickable {
  cursor: pointer;
}
.metric.clickable:hover {
  border-color: var(--blue);
  background: #1d232a;
}
.charts {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  margin-top: 18px;
}
.charts > div, .table-wrap, .clients-panel, .users-panel, .errors-panel, .settings-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}
.chart-canvas {
  height: 230px;
  position: relative;
}
.chart-canvas canvas {
  height: 100% !important;
  min-height: 0;
  width: 100% !important;
}
.chart-wide {
  grid-column: 1 / -1;
}
.chart-title {
  font-size: 15px;
  margin: 0 0 12px;
  text-align: center;
}
.chart-values {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 12px;
  margin-top: 10px;
}
.chart-values span strong {
  color: var(--text);
}
.source-label {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  white-space: nowrap;
}
.source-icon {
  flex: 0 0 auto;
  height: 16px;
  object-fit: contain;
  width: 16px;
}
.chart-values .chart-total {
  border-left: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
  padding-left: 12px;
}
.status-descriptions {
  border-top: 1px solid var(--border);
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
}
.status-descriptions span {
  color: var(--muted);
  display: flex;
  font-size: 11px;
  gap: 6px;
  line-height: 1.25;
}
.status-descriptions strong {
  color: var(--text);
  min-width: 104px;
}
.filters {
  display: grid;
  gap: 10px;
  grid-template-columns: 1.2fr repeat(3, 1fr) auto auto;
  margin: 18px 0 12px;
}
.check { align-items: center; color: var(--muted); display: flex; gap: 8px; white-space: nowrap; }
.check input { min-height: auto; }
.table-wrap { overflow-x: auto; padding: 0; }
table { border-collapse: collapse; min-width: 1100px; width: 100%; }
th, td { border-bottom: 1px solid var(--border); padding: 11px 12px; text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
td { font-size: 13px; }
.file-cell { color: var(--muted); max-width: 340px; overflow-wrap: anywhere; }
.badge {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
}
.OK { background: color-mix(in srgb, var(--green), transparent 76%); color: #90e0b0; }
.Atenção { background: color-mix(in srgb, var(--yellow), transparent 76%); color: #f0cd6a; }
.Crítico { background: color-mix(in srgb, var(--red), transparent 76%); color: #ff9b9b; }
.Urgente { background: color-mix(in srgb, #b967ff, transparent 76%); color: #d9b6ff; }
.Sem, .Data, .Não { background: color-mix(in srgb, var(--bluegray), transparent 76%); color: #b7c6d7; }
.clients-panel, .users-panel { margin-top: 18px; }
.errors-panel { margin-top: 18px; }
.settings-panel { margin-top: 18px; }
.storage-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.storage-tabs {
  align-items: end;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 18px;
  padding: 18px 20px 0;
}
.storage-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  min-height: 54px;
  padding: 8px 10px 12px;
}
.storage-tab .source-icon,
.connector-card h3 .source-icon {
  height: 18px;
  width: 18px;
}
.storage-tab.active {
  border-bottom-color: #78aefc;
  color: var(--text);
}
.storage-tab-panel {
  display: none;
  padding: 34px 32px;
}
.storage-tab-panel.active {
  display: block;
}
.connector-layout {
  display: grid;
  gap: 36px;
  grid-template-columns: 380px minmax(460px, 1fr);
}
.connector-card {
  display: grid;
  gap: 8px;
}
.connector-card h3 {
  font-size: 20px;
  margin: 0 0 6px;
}
.connector-card p {
  line-height: 1.35;
  margin-bottom: 8px;
}
.placeholder-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  min-height: 220px;
  padding: 18px;
}
.section-title { align-items: center; display: flex; gap: 16px; justify-content: space-between; margin-bottom: 12px; }
.section-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}
.section-actions input {
  min-width: 260px;
}
.error-list { display: grid; gap: 8px; }
.error-item {
  border-left: 3px solid var(--red);
  color: var(--muted);
  padding: 8px 10px;
  background: #1d2023;
}
.error-item strong { color: var(--text); display: block; margin-bottom: 4px; }
#clientForm {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1.5fr 1.5fr auto auto;
}
.client-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 14px;
  overflow-x: auto;
}
.clients-table {
  border-collapse: collapse;
  width: 100%;
}
.clients-table th,
.clients-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  vertical-align: middle;
}
.clients-table th {
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  text-transform: uppercase;
}
.clients-table td {
  font-size: 13px;
  line-height: 1.25;
}
.clients-table tbody tr:hover {
  background: #1d2023;
}
.clients-table tbody tr:last-child td {
  border-bottom: 0;
}
.client-row-action {
  text-align: right;
  width: 170px;
}
.client-row-action > * + * {
  margin-left: 8px;
}
.source-status {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  height: 22px;
  justify-content: center;
  line-height: 1;
  width: 22px;
}
.source-status.ok {
  background: rgba(63, 191, 114, 0.18);
  color: #6ee69a;
}
.source-status.missing {
  background: rgba(224, 91, 91, 0.18);
  color: #ff8a8a;
}
.clients-table th:nth-child(4),
.clients-table th:nth-child(5),
.clients-table td:nth-child(4),
.clients-table td:nth-child(5) {
  text-align: center;
  width: 96px;
}
.users-panel {
  max-width: 1180px;
}
.users-table {
  table-layout: fixed;
}
.users-table th:nth-child(1),
.users-table td:nth-child(1) {
  width: 34%;
}
.users-table th:nth-child(2),
.users-table td:nth-child(2) {
  width: 24%;
}
.users-table th:nth-child(3),
.users-table td:nth-child(3) {
  width: 18%;
}
.users-table th:nth-child(4),
.users-table td:nth-child(4) {
  text-align: center;
  width: 100px;
}
.users-table th:nth-child(5),
.users-table td:nth-child(5) {
  text-align: right;
  width: 170px;
}
.users-table td {
  height: 50px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.client-edit-panel {
  background: #171a1d;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 1.2fr 1.8fr auto auto auto;
  margin-top: 10px;
  padding: 12px;
}
.client-editor-page {
  margin-top: 14px;
}
.client-editor-form {
  background: #171a1d;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  padding: 14px;
}
.client-editor-form .client-actions {
  align-items: end;
  grid-column: 1 / -1;
}
.client-actions {
  display: flex;
  gap: 8px;
}
.user-form {
  background: #171a1d;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: 1.2fr 0.8fr 0.8fr 0.7fr auto;
  margin-top: 14px;
  padding: 14px;
}
.user-form .client-actions,
.user-form .test-result {
  grid-column: 1 / -1;
}
.status-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
}
.status-pill.active {
  background: rgba(63, 191, 114, 0.18);
  color: #6ee69a;
}
.status-pill.inactive {
  background: rgba(224, 91, 91, 0.18);
  color: #ff8a8a;
}
.editable-client label {
  min-width: 0;
}
.editable-client input {
  width: 100%;
}
.settings-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, 1fr);
}
.settings-grid.two { grid-template-columns: repeat(2, minmax(280px, 1fr)); }
.settings-grid.single { grid-template-columns: minmax(280px, 560px); }
.settings-grid.status-settings { grid-template-columns: minmax(620px, 820px); }
.drive-config-layout {
  display: grid;
  gap: 14px;
  grid-template-columns: 340px minmax(360px, 1fr) 340px;
}
.drive-card textarea {
  min-height: 80px;
}
.toggle-row {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 10px;
}
.toggle-row input {
  min-height: auto;
}
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.success-button {
  background: #0aa66a;
  border-color: #0aa66a;
  color: white;
}
.folder-explorer {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}
.current-folder {
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px;
}
.current-folder span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}
.folder-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  max-width: 620px;
  min-height: 320px;
  padding: 10px;
}
.folder-item {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
}
.folder-item:last-child {
  border-bottom: 0;
}
.back-button {
  margin-top: 10px;
}
fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px;
}
legend { color: var(--text); font-weight: 700; padding: 0 6px; }
label { color: var(--muted); display: grid; gap: 6px; font-size: 13px; }
.status-rules {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}
.status-rule-row {
  align-items: center;
  background: #171a1d;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1fr) 110px 110px;
  padding: 12px;
}
.status-rule-row strong {
  color: var(--text);
  display: block;
  font-size: 13px;
  margin-top: 6px;
}
.status-rule-row input {
  min-height: 34px;
}
.rule-badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 9px;
}
.rule-badge.attention {
  background: rgba(214, 169, 58, 0.18);
  color: #f2c94c;
}
.rule-badge.critical {
  background: rgba(255, 159, 67, 0.18);
  color: #ff9f43;
}
.rule-badge.urgent {
  background: rgba(224, 91, 91, 0.18);
  color: #ff6b6b;
}
.rule-badge.no-backup {
  background: rgba(185, 103, 255, 0.18);
  color: #d9b6ff;
}
input[readonly] {
  color: var(--text);
  opacity: 0.92;
}
textarea {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  min-height: 120px;
  padding: 10px;
  resize: vertical;
}
.settings-actions {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 14px;
}
.muted { color: var(--muted); }
.test-result {
  color: var(--muted);
  margin: 0;
  min-height: 18px;
}
.test-result.success { color: #90e0b0; }
.test-result.error { color: #ff9b9b; }
@media (max-width: 1100px) {
  .summary-grid, .charts { grid-template-columns: repeat(2, 1fr); }
  .filters, #clientForm, .settings-grid.two, .drive-config-layout, .connector-layout { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    height: auto;
    position: static;
  }
  nav { grid-template-columns: repeat(2, 1fr); }
  .storage-tabs {
    align-items: stretch;
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(2, 1fr);
    padding: 12px;
  }
  .storage-tab {
    border: 1px solid transparent;
    border-radius: 6px;
  }
  .storage-tab.active {
    border-color: var(--border);
  }
  .storage-tab-panel {
    padding: 16px;
  }
  .topbar, .section-title { align-items: stretch; flex-direction: column; }
  main { padding: 14px; }
  .summary-grid, .charts, .filters, #clientForm, .client-edit-panel, .client-editor-form, .user-form, .settings-grid, .settings-grid.two, .settings-grid.single, .drive-config-layout, .connector-layout { grid-template-columns: 1fr; }
  .status-rule-row { grid-template-columns: 1fr; }
  .clients-table { min-width: 680px; }
}
