/* ============================================================
   BRecovery — Design System v2
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700;0,14..32,800&display=swap');

:root {
  /* Core palette */
  --c-indigo-4: #818cf8;
  --c-indigo-5: #6366f1;
  --c-indigo-6: #4f46e5;
  --c-cyan:     #06b6d4;
  --c-emerald:  #10b981;
  --c-orange:   #f97316;
  --c-red:      #ef4444;
  --c-blue:     #3b82f6;

  /* Semantic */
  --primary:       var(--c-indigo-6);
  --primary-light: var(--c-indigo-4);
  --success:       var(--c-emerald);
  --warning:       var(--c-orange);
  --danger:        var(--c-red);
  --info:          var(--c-blue);

  /* Surfaces */
  --bg:      #05091a;
  --surf-1:  #0b1128;
  --surf-2:  #111b36;
  --surf-3:  #192342;
  --surf-4:  #223050;
  --border:  rgba(129,140,248,.1);
  --border-h:rgba(129,140,248,.3);

  /* Text */
  --tx-1: #e8eaf6;
  --tx-2: #7986a8;
  --tx-3: #3d4f6e;

  /* Structure */
  --sidebar-w:           240px;
  --sidebar-collapsed-w: 60px;
  --topbar-h:            60px;
  --radius:              10px;
  --radius-lg:           14px;

  /* Shadows / glow */
  --shadow:    0 4px 24px rgba(0,0,0,.55);
  --shadow-lg: 0 12px 48px rgba(0,0,0,.65);
  --glow:      0 0 28px rgba(99,102,241,.25);
}

/* ── LIGHT THEME ───────────────────────────────────────── */
[data-theme="light"] {
  --bg:      #f0f2f5;
  --surf-1:  #ffffff;
  --surf-2:  #f5f6f8;
  --surf-3:  #e8eaef;
  --surf-4:  #d8dbe3;
  --border:  rgba(0,0,0,.10);
  --border-h:rgba(0,0,0,.20);
  --tx-1:    #111318;
  --tx-2:    #3d4556;
  --tx-3:    #6b7385;
  --shadow:    0 1px 8px rgba(0,0,0,.06);
  --shadow-lg: 0 6px 24px rgba(0,0,0,.10);
  --glow:      0 0 16px rgba(99,102,241,.08);
  --c-indigo-4: #6366f1;
}
[data-theme="light"] body {
  background-color: var(--bg);
}
[data-theme="light"] #sidebar {
  background: var(--surf-1);
  border-right: 1px solid var(--border);
}
[data-theme="light"] #sidebar .sidebar-link {
  color: var(--tx-2);
}
[data-theme="light"] #sidebar .sidebar-link:hover {
  color: var(--tx-1);
}
[data-theme="light"] #topbar {
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] .login-page {
  background-color: var(--bg);
}
[data-theme="light"] .login-card {
  background: #ffffff;
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}
[data-theme="light"] .sidebar-user .avatar {
  color: #fff;
}
[data-theme="light"] .sidebar-user .uname {
  color: var(--tx-1);
}
[data-theme="light"] .sidebar-user .urole {
  color: var(--tx-2);
}
[data-theme="light"] .modal-box {
  background: var(--surf-1);
}
[data-theme="light"] .toast-msg {
  background: var(--surf-1);
  color: var(--tx-1);
  border-color: var(--border);
}
[data-theme="light"] .form-control,
[data-theme="light"] .form-select {
  background: #fff;
  border-color: var(--border);
  color: var(--tx-1);
}
[data-theme="light"] .form-control::placeholder {
  color: var(--tx-3);
}
[data-theme="light"] .form-select option {
  background: #fff;
  color: var(--tx-1);
}
[data-theme="light"] .log-box {
  background: #f8f9fc;
  border-color: var(--border);
}
[data-theme="light"] .log-box .log-info    { color: #2563eb; }
[data-theme="light"] .log-box .log-success { color: #059669; }
[data-theme="light"] .log-box .log-warning { color: #d97706; }
[data-theme="light"] .log-box .log-error   { color: #dc2626; }
[data-theme="light"] .log-box .log-ts      { color: #64748b; }
[data-theme="light"] .alert-success { background: rgba(16,185,129,.08); border-color: rgba(16,185,129,.25); color: #047857; }
[data-theme="light"] .alert-danger  { background: rgba(239,68,68,.08);  border-color: rgba(239,68,68,.25);  color: #b91c1c; }
[data-theme="light"] .alert-warning { background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.25); color: #92400e; }
[data-theme="light"] .alert-info    { background: rgba(59,130,246,.08); border-color: rgba(59,130,246,.25); color: #1d4ed8; }
[data-theme="light"] .sidebar-link.active {
  background: rgba(99,102,241,.10);
  color: var(--c-indigo-6);
}
[data-theme="light"] .sidebar-link.active::before {
  background: var(--c-indigo-6);
}
[data-theme="light"] .card {
  background: #fff;
  border-color: var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
[data-theme="light"] .stat-card {
  background: #fff;
  border-color: var(--border);
}
[data-theme="light"] .stat-card:hover {
  box-shadow: 0 2px 12px rgba(99,102,241,.10);
}
[data-theme="light"] .stat-value {
  color: var(--tx-1);
}
[data-theme="light"] .stat-label {
  color: var(--tx-2);
}
[data-theme="light"] thead th {
  background: var(--surf-2);
  color: var(--tx-2);
}
[data-theme="light"] tbody td {
  color: var(--tx-1);
}
[data-theme="light"] .text-muted {
  color: var(--tx-2) !important;
}
[data-theme="light"] .btn-ghost {
  background: #fff;
  border-color: var(--border);
  color: var(--tx-1);
}
[data-theme="light"] .btn-ghost:hover {
  background: var(--surf-3);
}
[data-theme="light"] .badge-success  { background: rgba(16,185,129,.12); color: #047857; }
[data-theme="light"] .badge-warning  { background: rgba(249,115,22,.12); color: #c2410c; }
[data-theme="light"] .badge-danger   { background: rgba(239,68,68,.12);  color: #b91c1c; }
[data-theme="light"] .badge-info     { background: rgba(59,130,246,.12); color: #1d4ed8; }
[data-theme="light"] .badge-primary  { background: rgba(99,102,241,.12); color: #4338ca; }
[data-theme="light"] .badge-secondary{ background: rgba(100,116,139,.10); color: #475569; }
[data-theme="light"] .progress-wrap {
  background: var(--surf-3);
}
[data-theme="light"] .progress-label {
  color: var(--tx-2);
}
[data-theme="light"] .card-header-row h2 {
  color: var(--tx-1);
}
[data-theme="light"] .form-label {
  color: var(--tx-2);
}
[data-theme="light"] .form-hint {
  color: var(--tx-3);
}
[data-theme="light"] .cron-preset {
  background: #fff;
  border-color: var(--border);
  color: var(--tx-2);
}
[data-theme="light"] .theme-toggle {
  background: var(--surf-2);
  border-color: var(--border);
  color: var(--tx-2);
}
[data-theme="light"] .topbar-btn {
  background: var(--surf-2);
  border-color: var(--border);
  color: var(--tx-2);
}
[data-theme="light"] .user-dropdown {
  background: #fff;
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}
[data-theme="light"] .ud-item {
  color: var(--tx-2);
}
[data-theme="light"] .ud-item:hover {
  background: var(--surf-2);
  color: var(--tx-1);
}
[data-theme="light"] .disk-gauge-info .big {
  color: var(--tx-1);
}
[data-theme="light"] .disk-gauge-info .sub {
  color: var(--tx-2);
}
[data-theme="light"] .fw-600 {
  color: var(--tx-1);
}
[data-theme="light"] .fs-sm,
[data-theme="light"] .fs-xs {
  color: var(--tx-2);
}
[data-theme="light"] .fb-toolbar {
  background: var(--surf-2);
}
[data-theme="light"] .fb-item:hover {
  background: rgba(99,102,241,.08);
}
[data-theme="light"] .modal-close {
  background: var(--surf-3);
  color: var(--tx-2);
}
[data-theme="light"] code {
  color: var(--c-indigo-6);
  background: rgba(99,102,241,.06);
  border-radius: 4px;
  padding: 1px 5px;
}

/* Theme toggle */
.theme-toggle {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--surf-3); border: 1px solid var(--border);
  color: var(--tx-2); display: grid; place-items: center;
  cursor: pointer; font-size: .85rem;
  transition: background .15s, color .15s;
}
.theme-toggle:hover { background: var(--surf-4); color: var(--tx-1); }
.theme-toggle .fa-sun   { display: none; }
.theme-toggle .fa-moon  { display: inline; }
[data-theme="light"] .theme-toggle .fa-sun  { display: inline; }
[data-theme="light"] .theme-toggle .fa-moon { display: none; }

/* System info dropdown */
.sysinfo-wrapper { position: relative; }
.sysinfo-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--surf-2); border: 1px solid var(--border-h);
  border-radius: var(--radius); min-width: 240px; padding: 14px 16px;
  box-shadow: var(--shadow-lg); z-index: 1000;
}
.sysinfo-dropdown.show { display: block; }
.sysinfo-header {
  font-weight: 700; font-size: .9rem; color: var(--tx-1);
  margin-bottom: 10px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.sysinfo-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0; font-size: .78rem; color: var(--tx-2);
}
.sysinfo-sep {
  height: 1px; background: var(--border); margin: 8px 0;
}
.sysinfo-label {
  font-size: .7rem; font-weight: 600; color: var(--tx-3);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px;
}

/* ── RESET ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background-color: var(--bg);
  color: var(--tx-1);
  min-height: 100vh;
}

/* ── SCROLLBAR ─────────────────────────────────────────── */
::-webkit-scrollbar              { width: 5px; height: 5px; }
::-webkit-scrollbar-track        { background: var(--surf-1); }
::-webkit-scrollbar-thumb        { background: var(--surf-4); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover  { background: var(--c-indigo-5); }

/* ── SIDEBAR ───────────────────────────────────────────── */
#sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--surf-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width .3s cubic-bezier(.4,0,.2,1), transform .3s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
  will-change: width, transform;
}

/* Brand */
.sidebar-brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo {
  height: 28px; width: auto;
  flex-shrink: 0;
}
.sidebar-logo-sm {
  height: 28px; width: auto;
  display: none;
  flex-shrink: 0;
}
.sidebar-brand .sidebar-logo {
  height: 40px;
}
.sidebar-brand .sidebar-logo-sm {
  height: 34px;
}
.sidebar-collapsed .sidebar-logo { display: none; }
.sidebar-collapsed .sidebar-logo-sm { display: block; margin: 0 auto; }
.btn-collapse-sidebar {
  width: 26px; height: 26px;
  border: 1px solid var(--border);
  background: var(--surf-3);
  color: var(--tx-2);
  border-radius: 7px;
  display: grid; place-items: center;
  cursor: pointer;
  font-size: .75rem;
  flex-shrink: 0;
  transition: background .15s, color .15s, transform .25s;
}
.btn-collapse-sidebar:hover { background: var(--surf-4); color: var(--tx-1); }

/* Nav */
.sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  color: var(--tx-2);
  text-decoration: none;
  font-size: .875rem;
  border-radius: 8px;
  margin-bottom: 2px;
  transition: background .15s, color .15s;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}
.sidebar-link i { width: 18px; text-align: center; flex-shrink: 0; font-size: .9rem; }
.sidebar-link .link-label { overflow: hidden; flex: 1; transition: opacity .2s ease, width .2s ease; }
.sidebar-link:hover { background: var(--surf-3); color: var(--tx-1); }
.sidebar-link.active {
  background: rgba(99,102,241,.18);
  color: var(--c-indigo-4);
  font-weight: 600;
}
.sidebar-link.active::before {
  content: '';
  position: absolute; left: 0; top: 20%; height: 60%; width: 3px;
  background: var(--c-indigo-4);
  border-radius: 0 3px 3px 0;
}

/* Footer */
.sidebar-footer {
  padding: 10px 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  text-decoration: none;
  transition: background .15s;
}
.sidebar-user:hover { background: var(--surf-3); }
.sidebar-user .avatar {
  width: 32px; height: 32px;
  background: var(--surf-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: grid; place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}
.sidebar-user .avatar img {
  width: 78%;
  height: 78%;
  object-fit: contain;
}
.sidebar-user .uname { font-size: .82rem; font-weight: 600; color: var(--tx-1); white-space: nowrap; }
.sidebar-user .urole { font-size: .7rem; color: var(--tx-2); white-space: nowrap; }
.sidebar-user .user-info { flex: 1; overflow: hidden; }
.sidebar-user .user-dots { color: var(--tx-3); font-size: .75rem; flex-shrink: 0; transition: color .15s; }
.sidebar-user:hover .user-dots { color: var(--tx-2); }
.sidebar-collapsed .sidebar-user .user-dots { display: none; }

/* User dropdown */
.user-dropdown {
  display: none;
  position: absolute; bottom: 72px; left: 8px; right: 8px;
  background: var(--surf-2);
  border: 1px solid var(--border-h);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--shadow-lg);
  z-index: 1100;
  animation: modalIn .15s ease;
}
.user-dropdown.open { display: block; }
.ud-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 7px;
  color: var(--tx-2); text-decoration: none;
  font-size: .82rem; transition: background .12s, color .12s;
}
.ud-item i { width: 16px; text-align: center; font-size: .8rem; }
.ud-item:hover { background: var(--surf-3); color: var(--tx-1); }
.ud-item.active { color: var(--c-indigo-4); }
.ud-item.ud-danger:hover { background: rgba(239,68,68,.12); color: var(--danger); }
.ud-sep { height: 1px; background: var(--border); margin: 4px 0; }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 999;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

/* ── DESKTOP COLLAPSE ──────────────────────────────────── */
.sidebar-collapsed #sidebar { width: var(--sidebar-collapsed-w); }
.sidebar-collapsed .sidebar-brand {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  height: auto;
  min-height: var(--topbar-h);
}
.sidebar-collapsed .brand-name,
.sidebar-collapsed .link-label,
.sidebar-collapsed .sidebar-user .uname,
.sidebar-collapsed .sidebar-user .urole,
.sidebar-collapsed .sidebar-footer .btn-logout { opacity: 0; width: 0; overflow: hidden; pointer-events: none; transition: opacity .15s ease, width .15s ease; }
.sidebar-collapsed .sidebar-link { justify-content: center; padding: 10px 8px; }
.sidebar-collapsed .sidebar-link i { margin: 0; }
.sidebar-collapsed .sidebar-link .link-label { width: 0; opacity: 0; pointer-events: none; }
.sidebar-collapsed .sidebar-link.active::before { display: none; }
.sidebar-collapsed .sidebar-user { justify-content: center; }
.sidebar-collapsed .sidebar-user .user-info { display: none; }
.sidebar-collapsed .btn-collapse-sidebar i { transform: rotate(180deg); }
.sidebar-collapsed .btn-collapse-sidebar { margin: 0; }
.sidebar-collapsed #main-wrapper { margin-left: var(--sidebar-collapsed-w); }
.sidebar-collapsed .user-dropdown { left: 60px; bottom: 10px; right: auto; min-width: 180px; }

/* ── MAIN WRAPPER ──────────────────────────────────────── */
#main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .3s cubic-bezier(.4,0,.2,1);
  will-change: margin-left;
}

/* ── TOPBAR ────────────────────────────────────────────── */
#topbar {
  height: var(--topbar-h);
  background: rgba(11,17,40,.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 900;
}
#topbar .page-title { font-size: .95rem; font-weight: 600; flex: 1; color: var(--tx-1); }
.btn-sidebar-toggle {
  display: none;
  background: none; border: none;
  color: var(--tx-2); font-size: 1.1rem;
  cursor: pointer; padding: 6px 8px; border-radius: 7px;
  transition: background .15s, color .15s;
}
.btn-sidebar-toggle:hover { background: var(--surf-3); color: var(--tx-1); }
.topbar-actions { display: flex; gap: 7px; align-items: center; }
.topbar-btn {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--surf-3); border: 1px solid var(--border);
  color: var(--tx-2); display: grid; place-items: center;
  cursor: pointer; font-size: .85rem; text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}
.topbar-btn:hover { background: var(--surf-4); color: var(--tx-1); border-color: var(--border-h); }

/* ── CONTENT ───────────────────────────────────────────── */
#content { flex: 1; padding: 24px 22px; }
.content-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px;
  margin-bottom: 22px; flex-wrap: wrap;
}
.content-header h1 { font-size: 1.25rem; font-weight: 700; }
.content-header p  { color: var(--tx-2); font-size: .85rem; margin-top: 3px; }

/* ── CARDS ─────────────────────────────────────────────── */
.card {
  background: var(--surf-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color .2s;
}
.card-header-row {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 18px; gap: 10px;
}
.card-header-row h2 { font-size: .97rem; font-weight: 600; }
.card-header-row h2 i { margin-right: 7px; color: var(--c-indigo-4); opacity: .8; }

/* Stat cards */
.stat-card {
  background: var(--surf-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; gap: 16px; align-items: center;
  transition: border-color .2s, box-shadow .2s;
}
.stat-card:hover { border-color: var(--border-h); box-shadow: var(--glow); }
.stat-icon {
  width: 46px; height: 46px;
  border-radius: 11px;
  display: grid; place-items: center;
  font-size: 1.25rem; flex-shrink: 0;
}
.stat-icon.indigo { background: rgba(99,102,241,.15); color: var(--c-indigo-4); }
.stat-icon.green  { background: rgba(16,185,129,.15); color: var(--success); }
.stat-icon.amber  { background: rgba(249,115,22,.15); color: var(--warning); }
.stat-icon.blue   { background: rgba(59,130,246,.15); color: var(--info); }
.stat-icon.red    { background: rgba(239,68,68,.15);  color: var(--danger); }
.stat-icon.cyan   { background: rgba(6,182,212,.15);  color: var(--c-cyan); }
.stat-value { font-size: 1.55rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .78rem; color: var(--tx-2); margin-top: 4px; }

/* ── TABLES ────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .865rem; }
thead th {
  background: var(--surf-2);
  padding: 10px 14px; text-align: left;
  font-weight: 600; color: var(--tx-2);
  font-size: .76rem; text-transform: uppercase;
  letter-spacing: .05em; white-space: nowrap;
}
thead th:first-child { border-radius: 8px 0 0 8px; }
thead th:last-child  { border-radius: 0 8px 8px 0; }
tbody tr { border-bottom: 1px solid var(--border); transition: background .12s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surf-2); }
tbody td { padding: 11px 14px; color: var(--tx-1); vertical-align: middle; }

/* ── FORMS ─────────────────────────────────────────────── */
.form-label { display: block; font-size: .8rem; font-weight: 600; color: var(--tx-2); margin-bottom: 5px; }
.form-control, .form-select {
  width: 100%;
  background: var(--surf-2);
  border: 1px solid var(--border);
  color: var(--tx-1);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: .875rem;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
  font-family: inherit;
}
.form-control:focus, .form-select:focus {
  border-color: var(--c-indigo-5);
  box-shadow: 0 0 0 3px rgba(99,102,241,.2);
}
.form-control::placeholder { color: var(--tx-3); }
.form-select option { background: var(--surf-1); color: var(--tx-1); }
.form-group   { margin-bottom: 15px; }
.form-grid-2  { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3  { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-hint    { font-size: .73rem; color: var(--tx-2); margin-top: 4px; }

/* ── BUTTONS ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 17px; border-radius: 8px;
  font-size: .875rem; font-weight: 600;
  cursor: pointer; border: none; text-decoration: none;
  transition: filter .15s, transform .1s;
  white-space: nowrap; font-family: inherit;
}
.btn:hover  { filter: brightness(1.12); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-sm       { padding: 5px 11px; font-size: .79rem; }
.btn-primary  { background: var(--c-indigo-5); color: #fff; }
.btn-success  { background: var(--success); color: #fff; }
.btn-warning  { background: var(--warning); color: #fff; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-info     { background: var(--info);    color: #fff; }
.btn-ghost    { background: var(--surf-3); color: var(--tx-1); border: 1px solid var(--border); }
.btn-ghost:hover { filter: none; background: var(--surf-4); border-color: var(--border-h); }

/* ── BADGES ────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 9px;
  border-radius: 99px; font-size: .72rem; font-weight: 600;
}
.badge-success  { background: rgba(16,185,129,.18); color: var(--success); }
.badge-warning  { background: rgba(249,115,22,.18); color: var(--warning); }
.badge-danger   { background: rgba(239,68,68,.18);  color: var(--danger); }
.badge-info     { background: rgba(59,130,246,.18); color: var(--info); }
.badge-primary  { background: rgba(99,102,241,.18); color: var(--c-indigo-4); }
.badge-secondary{ background: rgba(100,116,139,.15);color: var(--tx-2); }

/* ── PROGRESS ──────────────────────────────────────────── */
.progress-wrap { background: var(--surf-3); border-radius: 99px; height: 7px; overflow: hidden; }
.progress-bar {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--c-indigo-6), var(--c-indigo-4));
  transition: width .4s ease;
  position: relative; overflow: hidden;
}
.progress-bar::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.15), transparent);
  animation: shimmer 1.8s infinite;
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}
.progress-bar.green { background: linear-gradient(90deg, #059669, #34d399); }
.progress-bar.amber { background: linear-gradient(90deg, #d97706, #fbbf24); }
.progress-bar.red   { background: linear-gradient(90deg, #dc2626, #f87171); }
.progress-label { display: flex; justify-content: space-between; font-size: .75rem; color: var(--tx-2); margin-top: 5px; }

/* ── LOG BOX ───────────────────────────────────────────── */
.log-box {
  background: #040810;
  border: 1px solid var(--border);
  border-radius: 10px; padding: 14px;
  height: 320px; overflow-y: auto;
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: .78rem; line-height: 1.65;
}
.log-box .log-info    { color: #93c5fd; }
.log-box .log-success { color: #6ee7b7; }
.log-box .log-warning { color: #fcd34d; }
.log-box .log-error   { color: #fca5a5; }
.log-box .log-ts      { color: #334155; margin-right: 8px; }

/* ── MODALS ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65); backdrop-filter: blur(3px);
  display: none; place-items: center; z-index: 2000;
}
.modal-overlay.open { display: grid; }
.modal-box {
  background: var(--surf-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 26px;
  width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto;
  position: relative;
  animation: modalIn .2s ease;
  box-shadow: var(--shadow-lg);
}
.modal-box.modal-lg { max-width: 760px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: var(--surf-3); border: none;
  width: 28px; height: 28px; border-radius: 50%;
  color: var(--tx-2); cursor: pointer;
  display: grid; place-items: center; font-size: .8rem;
  transition: background .15s, color .15s;
}
.modal-close:hover { background: var(--danger); color: #fff; }
.modal-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 18px; padding-right: 34px; }

/* ── ALERTS ────────────────────────────────────────────── */
.alert {
  padding: 11px 15px; border-radius: 9px;
  font-size: .865rem;
  display: flex; gap: 9px; align-items: flex-start;
  margin-bottom: 14px;
}
.alert-success { background: rgba(16,185,129,.12); border: 1px solid rgba(16,185,129,.3); color: #6ee7b7; }
.alert-danger  { background: rgba(239,68,68,.12);  border: 1px solid rgba(239,68,68,.3);  color: #fca5a5; }
.alert-warning { background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.3); color: #fde68a; }
.alert-info    { background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.3); color: #93c5fd; }

/* ── DISK GAUGE ────────────────────────────────────────── */
.disk-gauge-wrap { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.disk-gauge-info { text-align: center; }
.disk-gauge-info .big { font-size: 1.4rem; font-weight: 700; }
.disk-gauge-info .sub { font-size: .75rem; color: var(--tx-2); }

/* ── TOAST ─────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 22px; right: 22px;
  z-index: 9999; display: flex; flex-direction: column; gap: 9px;
  pointer-events: none;
}
.toast-msg {
  background: var(--surf-2);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px;
  font-size: .85rem; color: var(--tx-1);
  box-shadow: var(--shadow);
  pointer-events: all;
  display: flex; align-items: center; gap: 9px;
  animation: toastIn .28s ease;
  max-width: 310px;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(28px); }
  to   { opacity: 1; transform: translateX(0); }
}
.toast-msg.success { border-left: 3px solid var(--success); }
.toast-msg.error   { border-left: 3px solid var(--danger); }
.toast-msg.warning { border-left: 3px solid var(--warning); }
.toast-msg.info    { border-left: 3px solid var(--info); }

/* ── TABS ──────────────────────────────────────────────── */
.tab-nav {
  display: flex; gap: 4px;
  border-bottom: 2px solid var(--border); margin-bottom: 20px;
}
.tab-btn {
  padding: 8px 16px; background: none; border: none;
  color: var(--tx-2); font-size: .875rem; font-weight: 500;
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
  font-family: inherit; transition: color .15s, border-color .15s;
}
.tab-btn.active { color: var(--c-indigo-4); border-bottom-color: var(--c-indigo-4); }
.tab-btn:hover:not(.active) { color: var(--tx-1); }
.tab-pane        { display: none; }
.tab-pane.active { display: block; }

/* ── CRON SCHEDULE ─────────────────────────────────────── */
.cron-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cron-preset {
  padding: 4px 11px; font-size: .77rem; border-radius: 99px;
  background: var(--surf-3); color: var(--tx-2);
  border: 1px solid var(--border); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.cron-preset:hover,
.cron-preset.sel { background: rgba(99,102,241,.2); color: var(--c-indigo-4); border-color: var(--c-indigo-5); }

/* ── LOGIN ─────────────────────────────────────────────── */
.login-page {
  position: relative;
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background-color: var(--bg);
}
.login-card {
  background: rgba(11,17,40,.92);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 38px 34px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
}
.login-logo {
  display: flex; align-items: center;
  justify-content: center; margin-bottom: 10px;
}
.login-logo img { height: 38px; width: auto; }
.login-logo img {
  height: 64px;
  max-width: 100%;
}
.login-title {
  text-align: center; font-size: 1.3rem; font-weight: 700;
  color: var(--tx-1); margin: 0 0 4px;
}
.login-ver { text-align: center; font-size: .68rem; color: var(--tx-3); margin-top: 0; margin-bottom: 22px; }
.login-theme-toggle {
  position: absolute; top: 18px; right: 18px;
  background: var(--surf-2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--tx-2);
  width: 32px; height: 32px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; transition: background .2s, color .2s;
}
.login-theme-toggle:hover { background: var(--surf-3); color: var(--tx-1); }
.input-icon-wrap { position: relative; }
.input-icon-wrap .ico {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--tx-3); font-size: .85rem; pointer-events: none;
}
.input-icon-wrap .form-control { padding-left: 34px; }
.btn-full { width: 100%; justify-content: center; padding: 11px; font-size: .92rem; }

/* ── FOLDER BROWSER ────────────────────────────────────── */
.fb-toolbar {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surf-2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.fb-toolbar .fb-path {
  flex: 1; font-size: .82rem; font-weight: 600;
  color: var(--tx-1); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.fb-list {
  max-height: 360px; overflow-y: auto;
  padding: 8px;
}
.fb-item {
  display: flex; align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: .86rem;
  color: var(--tx-1);
  cursor: pointer;
  transition: background .12s;
}
.fb-item:hover { background: rgba(99,102,241,.12); }
.fb-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.input-with-btn {
  display: flex; gap: 0;
}
.input-with-btn .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.input-with-btn .btn-browse {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  white-space: nowrap;
  padding: 0 14px;
  background: var(--surf-3);
  border: 1px solid var(--border);
  border-left: none;
  color: var(--tx-1);
  font-size: .82rem;
  cursor: pointer;
  transition: background .15s;
}
.input-with-btn .btn-browse:hover {
  background: rgba(99,102,241,.2);
  color: var(--c-indigo-4);
}

/* ── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 900px) {
  /* Mobile: sidebar off-screen via transform, ignora collapse */
  #sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); width: var(--sidebar-w) !important; }
  #sidebar.open { transform: translateX(0); }
  #main-wrapper { margin-left: 0 !important; }
  #topbar .btn-sidebar-toggle { display: block; }
  .btn-collapse-sidebar { display: none !important; }
  /* Reseta collapse state no mobile */
  .sidebar-collapsed #sidebar { width: var(--sidebar-w) !important; }
  .sidebar-collapsed .sidebar-brand {
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    height: var(--topbar-h);
    min-height: auto;
  }
  .sidebar-collapsed .brand-name,
  .sidebar-collapsed .link-label,
  .sidebar-collapsed .sidebar-user .uname,
  .sidebar-collapsed .sidebar-user .urole { opacity: 1; width: auto; pointer-events: auto; }
  .sidebar-collapsed .sidebar-link { justify-content: flex-start; padding: 9px 11px; }
  .sidebar-collapsed .sidebar-link .link-label { width: auto; opacity: 1; pointer-events: auto; }
  .sidebar-collapsed .sidebar-user { justify-content: flex-start; }
  .sidebar-collapsed .sidebar-user .user-info { display: block; }
  .sidebar-collapsed .user-dropdown { left: 8px; right: 8px; bottom: 72px; min-width: auto; }
  .sidebar-collapsed .sidebar-logo { display: inline-block; }
  .sidebar-collapsed .sidebar-logo-sm { display: none; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  #content  { padding: 14px 11px; }
  .modal-box { padding: 18px 15px; }
  .login-card { padding: 26px 18px; }
  
}

/* ── UTILITIES ─────────────────────────────────────────── */
.gap-8   { gap: 8px; }
.gap-12  { gap: 12px; }
.grid-cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-cols-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-cols-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.flex            { display: flex; }
.flex-wrap       { flex-wrap: wrap; }
.align-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-4  { margin-top: 4px; }   .mt-6  { margin-top: 6px; }
.mt-12 { margin-top: 12px; }  .mt-16 { margin-top: 16px; }  .mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; } .mb-6  { margin-bottom: 6px; }
.mb-12 { margin-bottom: 12px; }.mb-16 { margin-bottom: 16px; }.mb-24 { margin-bottom: 24px; }
.me-1  { margin-right: 4px; } .me-2 { margin-right: 8px; }
.ms-auto { margin-left: auto; }
.text-muted   { color: var(--tx-2); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info    { color: var(--info); }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.fs-sm  { font-size: .82rem; }.fs-xs    { font-size: .72rem; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.d-none { display: none !important; }
.w-100  { width: 100%; }
@media (max-width: 900px) {
  .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }
}

/* ── BACKUP WIZARD STEPS ─────────────────────────────────── */
.backup-steps {
  display: flex;
  gap: 0;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--surf-3);
  margin-bottom: 16px;
}
.backup-steps .step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  color: var(--tx-2);
  font-size: .85rem;
  position: relative;
  flex: 1;
}
.backup-steps .step::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 8px solid var(--surf-3);
}
.backup-steps .step:last-child::after { display: none; }
.backup-steps .step .step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surf-3);
  color: var(--tx-2);
  font-weight: 700;
  font-size: .8rem;
  flex-shrink: 0;
}
.backup-steps .step.active .step-number {
  background: var(--c-indigo-4);
  color: #fff;
}
.backup-steps .step.done .step-number {
  background: var(--success);
  color: #fff;
}
.backup-steps .step.active {
  color: var(--tx-1);
  font-weight: 600;
}
.backup-steps .step.done {
  color: var(--success);
}
.backup-step-panel {
  padding: 4px 0;
}

/* ── FILE TREE ───────────────────────────────────────────── */
.file-tree-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--surf-3);
  border-radius: var(--radius) var(--radius) 0 0;
  font-family: monospace;
  font-size: .82rem;
  color: var(--tx-2);
}
.file-tree-container {
  border: 1px solid var(--surf-3);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  max-height: 380px;
  overflow-y: auto;
  background: var(--surf-1);
}
.file-item {
  display: flex;
  align-items: center;
  padding: 6px 14px;
  border-bottom: 1px solid var(--surf-2);
  font-size: .85rem;
  transition: background .15s;
}
.file-item:hover {
  background: var(--surf-2);
}
.file-item:last-child {
  border-bottom: none;
}
.file-item-back {
  cursor: pointer;
  color: var(--tx-2);
  font-style: italic;
}
.file-item-back:hover {
  color: var(--tx-1);
  background: var(--surf-2);
}
.file-item-check {
  margin-right: 10px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.file-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--c-indigo-4);
  cursor: pointer;
}
.file-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-item-dir .file-item-name {
  font-weight: 600;
}
.file-item-size {
  flex-shrink: 0;
  margin-left: 12px;
  min-width: 60px;
  text-align: right;
}

/* ── CONFIRM SUMMARY ─────────────────────────────────────── */
.confirm-summary {
  background: var(--surf-1);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.confirm-item {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: .9rem;
}
.confirm-item .text-muted {
  min-width: 80px;
}

/* ── STEP RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 600px) {
  .backup-steps .step-label { display: none; }
  .backup-steps .step { padding: 8px 12px; justify-content: center; }
  .file-tree-container { max-height: 260px; }
}
