*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f1117;
  color: #e2e8f0;
  height: 100%;
  overflow: hidden;
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #161824; border-radius: 3px; }
::-webkit-scrollbar-thumb { background: #2d3148; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3d4468; }
::-webkit-scrollbar-corner { background: #161824; }
* { scrollbar-width: thin; scrollbar-color: #2d3148 #161824; }

/* LOGIN */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-box {
  background: #1a1d27;
  border: 1px solid #2d3148;
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
}
.login-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.app-brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.app-brand-icon {
  flex-shrink: 0;
  display: block;
  border-radius: 5px;
}
.app-brand-text {
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
}
.login-header .app-brand-text { font-size: 22px; line-height: 1.2; margin: 0; }
.login-header .app-brand-icon { width: 26px; height: 26px; }
#login-error { color: #f87171; font-size: 13px; margin-top: 10px; display: none; }

/* LANGUAGE */
.lang-switch { display: inline-flex; border: 1px solid #2d3148; border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.lang-btn {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.lang-btn:hover { color: #e2e8f0; background: #252840; }
.lang-btn.lang-btn-active { background: #6366f1; color: #fff; }

/* FORMS */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: #94a3b8; margin-bottom: 6px; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: #0f1117;
  border: 1px solid #2d3148;
  border-radius: 8px;
  padding: 10px 14px;
  color: #e2e8f0;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: #6366f1; }
.form-group textarea { font-size: 12px; font-family: ui-monospace, 'Cascadia Code', monospace; resize: vertical; min-height: 80px; }
.form-hint { color: #64748b; font-size: 12px; font-weight: 400; }
.form-section-divider { border-top: 1px solid #2d3148; margin: 20px 0 16px; padding-top: 16px; }
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: #e2e8f0;
  margin-bottom: 4px;
  user-select: none;
}
.checkbox-row input[type="checkbox"] { width: 16px; height: 16px; margin-top: 2px; accent-color: #6366f1; flex-shrink: 0; }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: opacity .15s, background .15s;
  white-space: nowrap;
}
.btn:hover { opacity: .85; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: #6366f1; color: #fff; }
.btn-danger  { background: #ef4444; color: #fff; }
.btn-success { background: #22c55e; color: #fff; }
.btn-ghost   { background: transparent; border: 1px solid #2d3148; color: #94a3b8; }
.btn-sm      { padding: 6px 12px; font-size: 13px; }
.btn-full    { width: 100%; justify-content: center; }
.btn-icon-only { padding: 6px 8px; min-width: 32px; }
.btn-node-del,
.btn-node-upd {
  background: none;
  border: none;
  cursor: pointer;
  color: #475569;
  padding: 3px 5px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color .15s, background .15s;
}
.btn-node-del:hover { color: #ef4444; background: rgba(239,68,68,.15); }
.btn-node-upd:hover:not(:disabled) { color: #6366f1; background: rgba(99,102,241,.15); }
.btn-node-upd:disabled { opacity: .35; cursor: not-allowed; }
.node-item-body {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.node-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}
.node-item-meta {
  font-size: 11px;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
  margin-top: 1px;
}
.node-item.active .node-item-meta { color: #94a3b8; }

/* LAYOUT */
#app { display: none; flex-direction: column; height: 100%; }
header {
  background: #1a1d27;
  border-bottom: 1px solid #2d3148;
  padding: 0 16px 0 20px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}
header .logo {
  flex-shrink: 0;
}
header .logo .app-brand-text {
  font-size: 16px;
}
header .logo .app-brand-icon {
  width: 22px;
  height: 22px;
}
.header-storage-wrap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  scrollbar-width: thin;
  scrollbar-color: #4b5563 transparent;
  -webkit-overflow-scrolling: touch;
}
.header-storage-wrap.is-scrollable {
  cursor: grab;
}
.header-storage-wrap.is-scrollable.is-dragging {
  cursor: grabbing;
  user-select: none;
}
.header-storage-wrap::-webkit-scrollbar {
  height: 6px;
}
.header-storage-wrap::-webkit-scrollbar-track {
  background: transparent;
}
.header-storage-wrap::-webkit-scrollbar-thumb {
  background: #4b5563;
  border-radius: 3px;
}
.header-storage-wrap::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}
.header-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  max-width: 55%;
}
.header-toolbar #header-username {
  color: #94a3b8;
  font-size: 13px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.main { display: flex; flex: 1; min-height: 0; overflow: hidden; }

/* SIDEBAR */
aside {
  width: 240px;
  background: #1a1d27;
  border-right: 1px solid #2d3148;
  padding: 16px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
aside h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #64748b;
  margin-bottom: 10px;
  padding: 0 8px;
  flex-shrink: 0;
}
#nodes-list { flex: 1; overflow-y: auto; min-height: 0; }
.node-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #cbd5e1;
  transition: background .1s;
}
.node-item:hover { background: #252840; }
.node-item.active { background: #252840; color: #f8fafc; }
#nav-stats-item.active { background: #252840; color: #f8fafc; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-online  { background: #22c55e; }
.dot-offline { background: #475569; }
.add-node-btn { flex-shrink: 0; margin-top: 8px; }

.node-env-path { font-size: 11px; color: #475569; margin: 0 0 8px; font-family: ui-monospace, monospace; word-break: break-all; }
.node-env-pending { font-size: 12px; color: #f59e0b; margin: 0 0 10px; }
.node-env-unsupported { font-size: 13px; color: #94a3b8; margin: 0 0 10px; }
.node-env-modal-footer { justify-content: flex-start; gap: 8px; }
.node-env-textarea {
  width: 100%;
  box-sizing: border-box;
  background: #0f1117;
  border: 1px solid #2d3148;
  border-radius: 8px;
  color: #e2e8f0;
  padding: 10px 12px;
  font-size: 12px;
  font-family: ui-monospace, 'Cascadia Code', monospace;
  resize: vertical;
  min-height: 160px;
}
.node-env-textarea:focus { outline: none; border-color: #6366f1; }
.btn-warning { background: #f59e0b; color: #1a1d27; }
.btn-warning:hover { background: #fbbf24; }
.sidebar-footer { border-top: 1px solid #2d3148; margin-top: 10px; padding-top: 10px; flex-shrink: 0; }

/* CONTENT */
.content { flex: 1; padding: 24px; overflow: hidden; min-height: 0; display: flex; flex-direction: column; }
.page { display: none; }
.page.active { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 20px; font-weight: 600; }
.page-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-header-title { display: flex; align-items: center; gap: 10px; }

/* PAGE-NODE sections */
#configs-section { flex-shrink: 0; margin-bottom: 0; }
#jobs-section { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 32px; }
#jobs-section > .page-header { margin-bottom: 16px; }
.jobs-card { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }

/* SCROLLABLE TABLE WRAPPERS */
.table-scroll { overflow-y: auto; }
.configs-card .table-scroll { max-height: 264px; }
.jobs-card .table-scroll { flex: 1; overflow-y: auto; min-height: 0; }

/* TABLE */
.card { background: #1a1d27; border: 1px solid #2d3148; border-radius: 12px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  background: #161824;
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #64748b;
  font-weight: 500;
}
.table-scroll th,
.explorer-table-wrap.table-scroll th {
  position: sticky;
  top: 0;
  z-index: 1;
}
td { padding: 12px 16px; border-top: 1px solid #2d3148; color: #cbd5e1; vertical-align: middle; }
tr:hover td { background: #1e2235; }
.table-actions { text-align: right; white-space: nowrap; width: 1%; }
.table-actions-inner { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; }
.badge-success      { background: #14532d; color: #4ade80; }
.badge-error        { background: #450a0a; color: #f87171; }
.badge-running      { background: #1e3a5f; color: #60a5fa; }
.badge-pending      { background: #1c1917; color: #a8a29e; }
.badge-uploading    { background: #1e3a5f; color: #93c5fd; }
.badge-transferring { background: #2d1b4e; color: #c4b5fd; }

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #1a1d27;
  border: 1px solid #2d3148;
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 500px;
  max-height: min(90vh, 900px);
  overflow-y: auto;
}
.modal.modal-md { max-width: 560px; }
.modal.modal-lg { max-width: 640px; }
.modal.modal-xl { max-width: 720px; }
.modal h2 { font-size: 18px; margin-bottom: 20px; color: #f8fafc; }
.modal .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}
.modal-intro { font-size: 13px; color: #94a3b8; margin-bottom: 20px; line-height: 1.5; }

/* CODE / COPY BLOCKS */
.code-block-wrap { position: relative; margin-bottom: 16px; }
.code-block {
  display: block;
  background: #0f1117;
  padding: 14px 80px 14px 14px;
  border-radius: 8px;
  font-size: 12px;
  word-break: break-all;
  color: #a5f3fc;
  border: 1px solid #2d3148;
  line-height: 1.45;
}
.code-block-wrap .btn { position: absolute; top: 8px; right: 8px; }
.job-timing-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}
.job-timing-table th,
.job-timing-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #2d3148;
  font-size: 13px;
}
.job-timing-table th {
  color: #64748b;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.job-timing-total {
  padding: 12px 14px;
  background: #0f1117;
  border: 1px solid #2d3148;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
}

.log-pre {
  background: #0f1117;
  padding: 14px;
  border-radius: 8px;
  font-size: 12px;
  white-space: pre-wrap;
  max-height: 400px;
  overflow: auto;
  color: #a5f3fc;
  border: 1px solid #2d3148;
  font-family: ui-monospace, 'Cascadia Code', monospace;
  line-height: 1.45;
}

/* PANELS */
.panel-inset {
  margin-top: 8px;
  padding: 10px 12px;
  background: #0f1117;
  border: 1px solid #2d3148;
  border-radius: 8px;
}
.panel-inset .storage-bar-track { margin-bottom: 0; }
.storage-meta { font-size: 11px; color: #94a3b8; white-space: nowrap; }
.text-error { font-size: 12px; color: #f87171; }
.text-muted { font-size: 12px; color: #64748b; }

/* EMPTY STATE */
.empty { padding: 48px; text-align: center; color: #475569; }
.empty p { margin-top: 8px; font-size: 14px; }

/* WELCOME */
#page-welcome .welcome-text { color: #64748b; font-size: 15px; margin-top: 8px; line-height: 1.5; }

/* STATS */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
  flex-shrink: 0;
}
@media (max-width: 900px) {
  .stats-cards { grid-template-columns: repeat(2, 1fr); }
}
.stats-card { background: #1a1d27; border: 1px solid #2d3148; border-radius: 12px; padding: 20px 24px; }
.stats-card-val { font-size: 32px; font-weight: 700; color: #f8fafc; line-height: 1; margin-bottom: 6px; }
.stats-card-lbl { font-size: 13px; color: #64748b; }
.stats-date-input {
  background: #0f1117;
  border: 1px solid #2d3148;
  border-radius: 8px;
  padding: 6px 10px;
  color: #e2e8f0;
  font-size: 13px;
  outline: none;
}
.stats-date-input:focus { border-color: #6366f1; }
.stats-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stats-chart-card { padding: 20px; flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.stats-chart-card canvas { display: block; width: 100%; }
.stats-chart-card-main { min-height: 0; }
.stats-chart-sub { font-size: 11px; color: #64748b; margin: -6px 0 10px; line-height: 1.45; }
.stats-chart-wrap--main { height: 380px; min-height: 380px; }
.stats-chart-wrap--speed { height: 280px; min-height: 280px; }
.stats-chart-wrap--volume { height: 240px; min-height: 240px; }
.stats-chart-wrap--main canvas,
.stats-chart-wrap--speed canvas,
.stats-chart-wrap--volume canvas { height: 100%; min-height: inherit; }
.stats-chart-legend { display: flex; gap: 16px; margin-top: 12px; flex-shrink: 0; }
.stats-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #94a3b8; }

#page-stats.active { overflow: hidden; }
#stats-pdf-host {
  position: fixed;
  left: -20000px;
  top: 0;
  width: 688px;
  z-index: -1;
  pointer-events: none;
}
.stats-scroll { flex: 1; overflow-y: auto; min-height: 0; padding-right: 4px; }
.stats-section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: #64748b; margin: 8px 0 12px; font-weight: 600;
}
.stats-sticky-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  margin: 0 0 12px;
  padding: 0;
  background: #0f1117;
}
.stats-filters-compact {
  padding: 8px 10px;
  margin: 0;
}
.stats-filters-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
}
.stats-filter-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.stats-filter-period {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.stats-filter-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #64748b;
  white-space: nowrap;
}
.stats-filter-sep {
  width: 1px;
  height: 22px;
  background: #2d3148;
  flex-shrink: 0;
}
.stats-filter-select {
  min-width: 118px;
  max-width: 168px;
}
.stats-filter-date {
  width: 132px;
  min-width: 132px;
}
.stats-filter-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}
.stats-filter-refresh,
.stats-filter-pdf {
  flex-shrink: 0;
}
.stats-period-divider {
  border: 0;
  border-bottom: 1px solid #2d3148;
  margin: 0 0 16px;
}
.stats-filters {
  overflow: visible;
  position: relative;
  padding: 14px 16px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.stats-filters-toolbar {
  margin-bottom: 0;
}
.stats-date-sep {
  color: #64748b;
}
.stats-filters select.stats-date-input {
  position: relative;
  z-index: 41;
  min-width: 140px;
}
.stats-cards-live { margin-bottom: 16px; }
.stats-card-delta { font-size: 11px; color: #64748b; margin-top: 6px; min-height: 14px; }
.stats-card-delta.positive { color: #4ade80; }
.stats-card-delta.negative { color: #f87171; }
.stats-rate-good { color: #4ade80 !important; }
.stats-rate-warn { color: #fbbf24 !important; }
.stats-rate-bad { color: #f87171 !important; }
.stats-period-btn.active { background: #312e81; border-color: #6366f1; color: #e0e7ff; }
.stats-charts-row { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; margin-bottom: 20px; align-items: stretch; }
@media (max-width: 1100px) { .stats-charts-row { grid-template-columns: 1fr; } }
.stats-chart-head { font-size: 13px; color: #64748b; margin-bottom: 12px; flex-shrink: 0; }
.stats-chart-wrap { position: relative; flex: 1; min-height: 200px; }
.stats-chart-tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  background: #1e2130; border: 1px solid #3d4468; border-radius: 8px;
  padding: 8px 10px; font-size: 12px; color: #e2e8f0; line-height: 1.5;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); white-space: nowrap;
}
.stats-cards-timing { grid-template-columns: repeat(4, 1fr); margin-bottom: 20px; }
.stats-cards-storage { grid-template-columns: repeat(3, 1fr); margin-bottom: 12px; }
@media (max-width: 900px) {
  .stats-cards-timing { grid-template-columns: repeat(2, 1fr); }
}
.stats-card-sm { padding: 14px 16px; }
.stats-card-val-sm { font-size: 20px !important; }
.stats-tables-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 1100px) { .stats-tables-row { grid-template-columns: 1fr; } }
.stats-table-card { padding: 16px; }
.stats-mini-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.stats-mini-table th, .stats-mini-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid #2d3148; }
.stats-mini-table th { color: #64748b; font-weight: 600; font-size: 10px; text-transform: uppercase; }
.stats-mini-table-wrap { margin-bottom: 20px; }
.stats-recent-errors { padding: 16px; margin-bottom: 20px; }
.stats-recent-row {
  display: flex; align-items: flex-start; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid #2d3148; font-size: 13px;
}
.stats-recent-row:last-child { border-bottom: none; }
.stats-recent-meta { flex: 1; min-width: 0; }
.stats-recent-title { color: #e2e8f0; font-weight: 500; }
.stats-recent-log { color: #64748b; font-size: 12px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-recent-actions { display: flex; gap: 6px; flex-shrink: 0; }

.settings-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #64748b;
  margin-bottom: 10px;
}
.settings-disk-panel {
  background: #0f1117;
  border: 1px solid #2d3148;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 20px;
}
.settings-disk-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 13px;
}
.settings-disk-row span:first-child { color: #94a3b8; }
.settings-disk-free { padding-top: 8px; margin-bottom: 10px; border-top: 1px solid #2d3148; }

.header-storage {
  display: flex;
  align-items: stretch;
  gap: 0;
  max-width: 140px;
  flex-shrink: 0;
}
.header-storage-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
  padding-left: 6px;
}
.header-storage-title {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.header-storage-icon { width: 13px; height: 13px; flex-shrink: 0; color: #64748b; }
.header-storage-name {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.header-storage-bar {
  width: 100%;
  min-width: 64px;
  height: 6px;
  border-radius: 3px;
  background: #2d3148;
  position: relative;
  overflow: hidden;
}
.header-storage-usage {
  font-size: 10px;
  color: #64748b;
  white-space: nowrap;
  line-height: 1.2;
}
.header-storage-quota {
  font-size: 9px;
  color: #818cf8;
  white-space: nowrap;
  line-height: 1.2;
}
.storage-bar-track {
  height: 6px;
  border-radius: 3px;
  background: #2d3148;
  position: relative;
  overflow: hidden;
  margin-bottom: 8px;
}
.bar-used {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: #6366f1;
  border-radius: 3px;
  transition: width .3s, background .3s;
}
.header-storage-sep {
  display: block;
  flex-shrink: 0;
  align-self: stretch;
  width: 1px;
  min-height: 100%;
  background: #3d4260;
  border-radius: 1px;
  margin: 0 2px;
}
.header-storage-unavailable { color: #475569; }

.alert-banner {
  display: block;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-banner-success { background: #14532d; color: #4ade80; }
.alert-banner-warn    { background: #451a03; color: #fbbf24; }
.alert-banner-info    { background: #1e3a5f; color: #60a5fa; }

/* LUCIDE ICONS */
svg.lucide {
  display: inline-block;
  vertical-align: middle;
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
  flex-shrink: 0;
}
.btn-icon-only svg.lucide { width: 16px; height: 16px; }

/* BACKUP EXPLORER */
#page-explorer.active { overflow: hidden; }
.explorer-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
  padding-bottom: 8px;
}
.explorer-hint {
  font-size: 13px;
  color: #94a3b8;
  margin: 0 0 16px;
  line-height: 1.5;
  max-width: 720px;
}
.explorer-loading {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 16px;
}
.explorer-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.explorer-empty {
  color: #64748b;
  font-size: 13px;
  padding: 8px 0;
}
.explorer-loc.card {
  overflow: visible;
}
.explorer-loc > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-size: 15px;
  font-weight: 600;
  color: #f8fafc;
  border-radius: 12px;
}
.explorer-loc > summary::-webkit-details-marker { display: none; }
.explorer-loc > summary::before {
  content: '';
  width: 0;
  height: 0;
  border-left: 6px solid #64748b;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  flex-shrink: 0;
  transition: transform .15s ease;
}
.explorer-loc[open] > summary::before { transform: rotate(90deg); }
.explorer-loc > summary .explorer-loc-icon {
  width: 18px;
  height: 18px;
  color: #818cf8;
  flex-shrink: 0;
}
.explorer-size {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
}
.explorer-loc > summary .explorer-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
  background: #0f1117;
  border: 1px solid #2d3148;
  border-radius: 999px;
  padding: 2px 10px;
}
.explorer-loc-body {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.explorer-loc-body > .alert-banner { margin-bottom: 0; }
.explorer-folder {
  border: 1px solid #2d3148;
  border-radius: 10px;
  background: #0f1117;
  overflow: hidden;
}
.explorer-folder > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  border-bottom: 1px solid transparent;
}
.explorer-folder-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.explorer-folder-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.explorer-folder-head-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  margin-left: auto;
}
.explorer-folder-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.explorer-chk-col {
  width: 36px;
  text-align: center;
  vertical-align: middle;
}
.explorer-chk-col input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #6366f1;
  cursor: pointer;
  vertical-align: middle;
}
.explorer-folder[open] > summary {
  border-bottom-color: #2d3148;
}
.explorer-folder > summary::-webkit-details-marker { display: none; }
.explorer-folder > summary::before {
  content: '';
  width: 0;
  height: 0;
  border-left: 5px solid #64748b;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  flex-shrink: 0;
  transition: transform .15s ease;
}
.explorer-folder[open] > summary::before { transform: rotate(90deg); }
.explorer-folder > summary .explorer-folder-icon {
  width: 16px;
  height: 16px;
  color: #94a3b8;
  flex-shrink: 0;
}
.explorer-folder > summary .explorer-count {
  flex-shrink: 0;
  min-width: 28px;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
  background: #1a1d27;
  border: 1px solid #2d3148;
  border-radius: 999px;
  padding: 2px 8px;
  line-height: 1.3;
}
.explorer-table-wrap.table-scroll {
  max-height: min(360px, 50vh);
  overflow: auto;
}
.explorer-table-wrap table { font-size: 13px; }
.explorer-filename {
  max-width: min(320px, 40vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 12px;
  color: #a5f3fc;
}
.explorer-muted { color: #64748b; font-size: 13px; }
.explorer-warn { color: #fbbf24; font-size: 13px; }
.explorer-retention-ok { color: #94a3b8; font-size: 13px; }
.explorer-indent { padding: 12px 14px; font-size: 13px; color: #64748b; }

@media (max-width: 1100px) {
  .header-toolbar { max-width: 100%; }
  .header-left { flex-wrap: wrap; }
}
