/* Admin panel — page-specific styles. Tokens & components come from /assets/design.css. */

/* ---------- Auth view (same pattern as dashboard) ---------- */
.auth-view {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--accent-soft), transparent 60%),
    var(--bg);
}
.auth-panel {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 32px 28px;
  display: flex; flex-direction: column; gap: 18px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand h1 { font-size: 22px; }
.auth-logo { display: inline-flex; width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent); color: var(--accent-contrast); align-items: center; justify-content: center; flex: none; }
.auth-logo .icon { width: 22px; height: 22px; }
.auth-tagline { margin-top: -8px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-links { display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; text-align: center; }

/* ---------- App shell (same pattern as dashboard) ---------- */
.app { display: flex; flex-direction: column; min-height: 100dvh; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15.5px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .brand-mark { display: inline-flex; width: 28px; height: 28px; border-radius: 7px;
  background: var(--accent); color: var(--accent-contrast); align-items: center; justify-content: center; }
.brand .brand-mark .icon { width: 16px; height: 16px; }

.app-body { display: flex; flex: 1; min-height: 0; }

.sidebar {
  width: 232px; flex: none; padding: 14px 10px;
  display: flex; flex-direction: column; gap: 18px;
  border-right: 1px solid var(--border); background: var(--surface);
  overflow-y: auto;
}
.sidebar-group { display: flex; flex-direction: column; gap: 2px; }
.sidebar-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: var(--radius-sm); color: var(--text-2); font-size: 14px; font-weight: 500;
  cursor: pointer; border: 0; background: transparent; width: 100%; text-align: left;
}
.sidebar-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar-item[aria-current="true"] { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px solid var(--border); }
.sidebar-backdrop { position: fixed; inset: 0; background: var(--backdrop); z-index: 59; }

#navToggle { display: none; }
@media (max-width: 900px) {
  #navToggle { display: inline-flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    transform: translateX(-100%); transition: transform 200ms cubic-bezier(0.2, 0, 0, 1);
    box-shadow: var(--shadow-lg); width: 260px; padding-top: 18px;
  }
  .sidebar.open { transform: translateX(0); }
}

.content { flex: 1; min-width: 0; padding: 20px; max-width: 1200px; margin: 0 auto; width: 100%; }

/* ---------- Section layout ---------- */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.section-head h2 { font-size: 19px; }
.section-sub { font-size: 13.5px; color: var(--text-2); margin: -10px 0 16px; }
.section-block { margin-bottom: 22px; }
.section-block h3 { font-size: 15px; margin-bottom: 10px; }

/* ---------- Stat tiles ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 2px;
}
.stat-tile .stat-value { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.stat-tile .stat-label { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.stat-tile .stat-label .icon { width: 14px; height: 14px; color: var(--text-3); }

/* ---------- Alerts ---------- */
.alert {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px;
  border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 10px;
  border: 1px solid transparent;
}
.alert .icon { width: 16px; height: 16px; margin-top: 2px; flex: none; }
.alert-warning { background: rgb(217 119 6 / 0.1); color: var(--warning); border-color: rgb(217 119 6 / 0.25); }

/* ---------- Usage / progress bars ---------- */
.usage-bar {
  height: 10px; border-radius: 999px; background: var(--surface-3);
  overflow: hidden; border: 1px solid var(--border);
}
.usage-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width 300ms ease; }
.usage-fill.warn { background: var(--warning); }
.usage-fill.crit { background: var(--danger); }
.usage-legend { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--text-2); margin-top: 6px; flex-wrap: wrap; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left; font-size: 11.5px; font-weight: 650; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-3); padding: 9px 12px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table th.num { text-align: right; }
.cell-strong { font-weight: 600; color: var(--text); }
.cell-actions { text-align: right; white-space: nowrap; }

/* Card mode on small screens for tables marked .table-cards */
@media (max-width: 720px) {
  .table-cards .data-table, .table-cards .data-table tbody, .table-cards .data-table tr, .table-cards .data-table td { display: block; }
  .table-cards .data-table thead { display: none; }
  .table-cards .data-table tbody tr {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    margin-bottom: 10px; padding: 6px 0; background: var(--surface);
  }
  .table-cards .data-table td {
    border: 0; padding: 5px 14px; display: flex; justify-content: space-between;
    align-items: center; gap: 12px; text-align: right;
  }
  .table-cards .data-table td::before {
    content: attr(data-label); font-size: 11.5px; font-weight: 650;
    text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); text-align: left;
  }
  .table-cards .data-table td.cell-actions { justify-content: flex-end; }
  .table-cards .data-table td.cell-actions::before { content: none; }
  .table-cards .data-table .num { text-align: right; }
}

/* ---------- Toolbars & forms ---------- */
.toolbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .field { min-width: 160px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.form-grid .form-actions { display: flex; align-items: flex-end; }

.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding-top: 12px; flex-wrap: wrap; }
.pager .pager-status { font-size: 13px; color: var(--text-2); }

/* ---------- Code / copy rows ---------- */
.code-row { display: flex; gap: 8px; align-items: center; }
.code-row .input { font-family: var(--font-mono); font-size: 13px; }
.code-block {
  font-family: var(--font-mono); font-size: 12.5px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; overflow-wrap: anywhere; word-break: break-all;
}

/* ---------- Definition list (settings, installer status) ---------- */
.kv-list { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 6px 18px; font-size: 13.5px; margin: 0; }
.kv-list dt { color: var(--text-2); font-weight: 550; }
.kv-list dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .kv-list { grid-template-columns: 1fr; gap: 2px; }
  .kv-list dd { margin-bottom: 8px; }
}

/* ---------- Upload progress ---------- */
.upload-progress { display: flex; flex-direction: column; gap: 6px; }
.upload-progress .usage-bar { height: 8px; }

/* ---------- Security details cell ---------- */
.details-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }

/* ---------- Misc ---------- */
.section-loading { display: flex; flex-direction: column; gap: 12px; }
.section-loading .skeleton { height: 60px; }
.list-plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list-plain li {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13.5px;
  flex-wrap: wrap;
}
video.admin-player { width: 100%; border-radius: 8px; background: #000; }
