/* ============================================================
   Remas Document Manager — Admin Panel CSS
   Dark enterprise theme
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg-base:     #0d1117;
  --bg-card:     #161b22;
  --bg-elevated: #1c2128;
  --bg-hover:    #21262d;
  --border:      #30363d;
  --border-light:#21262d;

  --text-1: #f0f6fc;
  --text-2: #c9d1d9;
  --text-3: #8b949e;
  --text-4: #484f58;

  --blue:   #58a6ff;
  --green:  #3fb950;
  --yellow: #d29922;
  --red:    #f85149;
  --purple: #bc8cff;
  --orange: #ffa657;

  --sidebar-w: 250px;
  --nav-h:     60px;
  --radius:    8px;
  --radius-lg: 12px;
  --shadow:    0 1px 3px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.2);
  --transition: 0.18s ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-2);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* ══════════════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════════════ */
.login-root {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-base);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow);
}
.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
  gap: 12px;
}
.login-logo-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, #1f6feb, #388bfd);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.login-logo h1 { font-size: 1.3rem; color: var(--text-1); font-weight: 700; }
.login-logo p  { font-size: .8rem; color: var(--text-3); }
.login-error {
  background: rgba(248,81,73,.12);
  border: 1px solid rgba(248,81,73,.4);
  color: var(--red);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: .82rem;
  margin-bottom: 16px;
  display: none;
}
.login-error.show { display: block; }

/* ══════════════════════════════════════════════════════════════
   ADMIN LAYOUT
   ══════════════════════════════════════════════════════════════ */
.admin-root {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform var(--transition);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #1f6feb, #388bfd);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.sidebar-brand-name {
  font-size: .88rem;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.2;
}
.sidebar-brand-sub {
  font-size: .7rem;
  color: var(--text-3);
}
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
}
.sidebar-section-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-4);
  padding: 8px 10px 4px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-3);
  font-size: .83rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
  margin-bottom: 1px;
}
.sidebar-link:hover {
  background: var(--bg-hover);
  color: var(--text-1);
  text-decoration: none;
}
.sidebar-link.active {
  background: rgba(88,166,255,.12);
  color: var(--blue);
}
.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .8; }
.sidebar-link.active svg { opacity: 1; }
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}
.sidebar-user-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, #1f6feb, #bc8cff);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name { font-size: .8rem; font-weight: 600; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: .68rem; color: var(--text-3); }
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--red);
  font-size: .82rem;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  margin-top: 4px;
  transition: background var(--transition);
}
.sidebar-logout:hover { background: rgba(248,81,73,.1); }
.sidebar-logout svg { width: 15px; height: 15px; }

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Layout aliases — alternate structure used by some admin pages
   (.app-layout/.main-wrap mirror .admin-root/.main-content) */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}
.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  color: var(--text-2);
  cursor: pointer;
}
.mobile-menu-btn svg { width: 18px; height: 18px; display: block; }

/* ── Top Navbar ───────────────────────────────────────────── */
.topnav {
  height: var(--nav-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}
.topnav-title { font-size: 1rem; font-weight: 700; color: var(--text-1); }
.topnav-right { display: flex; align-items: center; gap: 12px; }
.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  color: var(--text-2);
  cursor: pointer;
}
.menu-toggle svg { width: 18px; height: 18px; display: block; }

/* ── Page body ────────────────────────────────────────────── */
.page-body {
  padding: 28px 28px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
}
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 1.35rem; font-weight: 700; color: var(--text-1); }
.page-header p  { font-size: .82rem; color: var(--text-3); margin-top: 2px; }

/* ══════════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.card-title { font-size: .88rem; font-weight: 700; color: var(--text-1); }
.card-subtitle { font-size: .76rem; color: var(--text-3); margin-top: 2px; }

/* ── Stat Cards ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow);
}
.stat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-icon.blue   { background: rgba(88,166,255,.15); }
.stat-icon.green  { background: rgba(63,185,80,.15); }
.stat-icon.yellow { background: rgba(210,153,34,.15); }
.stat-icon.purple { background: rgba(188,140,255,.15); }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--text-1); line-height: 1; }
.stat-label { font-size: .75rem; color: var(--text-3); margin-top: 4px; }

/* ══════════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
thead th {
  text-align: left;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
thead th:first-child { border-radius: 6px 0 0 0; }
thead th:last-child  { border-radius: 0 6px 0 0; }
tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
tbody td { padding: 11px 14px; font-size: .82rem; vertical-align: middle; }
.table-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
.table-empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.table-empty h3 { font-size: .95rem; color: var(--text-2); margin-bottom: 6px; }
.table-empty p  { font-size: .8rem; }

/* ══════════════════════════════════════════════════════════════
   FORMS & INPUTS
   ══════════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}
.form-group label .req { color: var(--red); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-1);
  padding: 9px 12px;
  font-size: .84rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(88,166,255,.15);
}
.input::placeholder { color: var(--text-4); }
.input:disabled { opacity: .5; cursor: not-allowed; }
.select { -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
.select option { background: var(--bg-card); }
.textarea { resize: vertical; min-height: 80px; }
.form-help { font-size: .74rem; color: var(--text-3); margin-top: 4px; }
.form-error { font-size: .74rem; color: var(--red); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Upload Drop Zone ────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--blue);
  background: rgba(88,166,255,.06);
}
.drop-zone-icon { font-size: 2.5rem; margin-bottom: 12px; }
.drop-zone h3 { font-size: .95rem; color: var(--text-1); margin-bottom: 6px; }
.drop-zone p  { font-size: .78rem; color: var(--text-3); }
.drop-zone input[type="file"] { display: none; }
.drop-zone.has-file { border-color: var(--green); background: rgba(63,185,80,.06); }

/* ── File preview ────────────────────────────────────────── */
.file-preview {
  display: none;
  align-items: center;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-top: 12px;
}
.file-preview.show { display: flex; }
.file-preview-icon { font-size: 1.6rem; }
.file-preview-name { font-size: .82rem; font-weight: 600; color: var(--text-1); }
.file-preview-size { font-size: .74rem; color: var(--text-3); }
.file-preview-remove { margin-left: auto; background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 1rem; padding: 4px; transition: color var(--transition); }
.file-preview-remove:hover { color: var(--red); }

/* ══════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: .82rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity var(--transition), background var(--transition), border-color var(--transition), transform 0.1s;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 14px; height: 14px; }
.btn-primary  { background: #1f6feb; color: #fff; border-color: #1f6feb; }
.btn-primary:hover { background: #388bfd; border-color: #388bfd; }
.btn-success  { background: #238636; color: #fff; border-color: #238636; }
.btn-success:hover { background: #2ea043; border-color: #2ea043; }
.btn-danger   { background: #da3633; color: #fff; border-color: #da3633; }
.btn-danger:hover { background: #f85149; border-color: #f85149; }
.btn-outline  { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-outline:hover { background: var(--bg-hover); color: var(--text-1); }
.btn-ghost    { background: transparent; color: var(--text-3); border-color: transparent; padding: 6px 10px; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-1); }
.btn-sm { padding: 5px 10px; font-size: .76rem; }
.btn-lg { padding: 10px 22px; font-size: .9rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ══════════════════════════════════════════════════════════════
   BADGES & PILLS
   ══════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.badge-green  { background: rgba(63,185,80,.15);   color: var(--green); }
.badge-red    { background: rgba(248,81,73,.15);   color: var(--red); }
.badge-blue   { background: rgba(88,166,255,.15);  color: var(--blue); }
.badge-yellow { background: rgba(210,153,34,.15);  color: var(--yellow); }
.badge-purple { background: rgba(188,140,255,.15); color: var(--purple); }
.badge-gray   { background: rgba(139,148,158,.15); color: var(--text-3); }

/* ══════════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  backdrop-filter: blur(3px);
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  box-shadow: 0 8px 32px rgba(0,0,0,.6);
  animation: modalIn .18s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: .95rem; font-weight: 700; color: var(--text-1); }
.modal-close {
  background: none; border: none; color: var(--text-3); cursor: pointer;
  padding: 4px; border-radius: 4px; transition: color var(--transition);
}
.modal-close:hover { color: var(--text-1); }
.modal-close svg { width: 18px; height: 18px; display: block; }
.modal-body    { padding: 22px; }
.modal-footer  { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  max-width: 360px;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  animation: toastIn .22s ease;
  min-width: 260px;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
.toast.removing { animation: toastOut .22s ease forwards; }
@keyframes toastOut {
  to { opacity: 0; transform: translateX(30px); max-height: 0; padding: 0; margin: 0; }
}
.toast-icon { font-size: 1.1rem; line-height: 1; flex-shrink: 0; margin-top: 1px; }
.toast-text { flex: 1; }
.toast-title { font-size: .82rem; font-weight: 700; color: var(--text-1); }
.toast-msg   { font-size: .78rem; color: var(--text-3); margin-top: 2px; }
.toast.success .toast-icon { color: var(--green); }
.toast.error   .toast-icon { color: var(--red); }
.toast.warning .toast-icon { color: var(--yellow); }
.toast.info    .toast-icon { color: var(--blue); }
.toast-close   { background: none; border: none; color: var(--text-4); cursor: pointer; padding: 0; font-size: .9rem; line-height: 1; }
.toast-close:hover { color: var(--text-2); }

/* ══════════════════════════════════════════════════════════════
   FILTERS BAR
   ══════════════════════════════════════════════════════════════ */
.filters-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.filters-bar .input,
.filters-bar .select {
  width: auto;
  min-width: 140px;
}
.search-input { min-width: 220px !important; }

/* ══════════════════════════════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════════════════════════════ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.pagination-info { font-size: .78rem; color: var(--text-3); }
.pagination-btns { display: flex; gap: 6px; }

/* ══════════════════════════════════════════════════════════════
   PUBLIC LINK PREVIEW
   ══════════════════════════════════════════════════════════════ */
.link-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-top: 12px;
}
.link-preview-label { font-size: .7rem; color: var(--text-3); white-space: nowrap; }
.link-preview-url   { font-size: .82rem; color: var(--blue); font-family: monospace; word-break: break-all; }
.link-preview-copy  { margin-left: auto; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════════
   VERSION HISTORY
   ══════════════════════════════════════════════════════════════ */
.version-row td:first-child { font-variant-numeric: tabular-nums; }
.version-current { color: var(--green); font-weight: 700; }

/* ══════════════════════════════════════════════════════════════
   MISCELLANEOUS
   ══════════════════════════════════════════════════════════════ */
.text-muted    { color: var(--text-3) !important; }
.text-primary  { color: var(--text-1) !important; }
.text-blue     { color: var(--blue) !important; }
.text-green    { color: var(--green) !important; }
.text-red      { color: var(--red) !important; }
.text-yellow   { color: var(--yellow) !important; }
.fw-bold       { font-weight: 700; }
.font-mono     { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; }
.mt-2 { margin-top: 8px; }  .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .65s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 300px; gap: 14px; color: var(--text-3); font-size: .85rem;
}

/* Status dot */
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.dot-green  { background: var(--green); }
.dot-red    { background: var(--red); }
.dot-yellow { background: var(--yellow); }

/* Divider */
hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-250px); width: 250px; }
  .sidebar.open { transform: translateX(0); }
  .main-content, .main-wrap { margin-left: 0; }
  .menu-toggle, .mobile-menu-btn { display: flex; }
  .page-body { padding: 20px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 99;
    display: none;
  }
  .sidebar-overlay.show { display: block; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; }
  .filters-bar .input, .filters-bar .select { width: 100%; }
}

/* ══════════════════════════════════════════════════════════════
   UPLOAD PAGE
   ══════════════════════════════════════════════════════════════ */
.upload-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) { .upload-layout { grid-template-columns: 1fr; } }

.doc-info-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.doc-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,.05));
}
.doc-info-row:last-child { border-bottom: none; }
.doc-info-label { font-size: .75rem; color: var(--text-3); min-width: 110px; }
.doc-info-value { font-size: .83rem; color: var(--text-1); display: flex; align-items: center; gap: 6px; }
.link-preview-inline { font-size: .82rem; color: var(--blue); font-family: monospace; word-break: break-all; }

.btn-icon-sm {
  background: none; border: none; cursor: pointer; padding: 2px 4px;
  color: var(--text-3); border-radius: 4px; display: inline-flex; align-items: center;
  transition: color .15s, background .15s;
}
.btn-icon-sm:hover { color: var(--text-1); background: var(--bg-elevated); }
.btn-icon-sm.text-danger { color: var(--red); }

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--blue);
  background: rgba(88,166,255,.05);
}
.drop-zone-icon { color: var(--text-3); margin-bottom: 10px; }
.drop-zone-text { font-size: .93rem; color: var(--text-2); margin-bottom: 4px; }
.drop-zone-sub  { font-size: .82rem; color: var(--text-3); }
.link-btn { background: none; border: none; color: var(--blue); cursor: pointer; padding: 0; font-size: inherit; }
.link-btn:hover { text-decoration: underline; }
.drop-zone-limit { margin-top: 10px; font-size: .75rem; color: var(--text-3); }

/* File preview */
.file-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.file-preview-icon { color: var(--red); flex-shrink: 0; }
.file-preview-info { flex: 1; min-width: 0; }
.file-preview-name { font-size: .86rem; color: var(--text-1); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-preview-size { font-size: .75rem; color: var(--text-3); margin-top: 2px; }

/* Upload progress */
.upload-progress { margin-top: 16px; }
.progress-bar-wrap {
  height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 6px;
}
.progress-bar { height: 100%; background: var(--blue); border-radius: 3px; transition: width .2s; }
.progress-label { font-size: .8rem; color: var(--text-3); }

/* Info steps */
.info-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; }
.info-steps li { display: flex; gap: 14px; align-items: flex-start; }
.step-num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--blue); color: #fff;
  font-size: .75rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.info-steps li p { font-size: .82rem; color: var(--text-3); margin: 4px 0 0; }
.info-steps li strong { font-size: .88rem; color: var(--text-1); }

/* Requirements list */
.req-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.req-list li { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--text-2); }

/* Version mini rows */
.version-mini-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,.05));
}
.version-mini-row:last-child { border-bottom: none; }
.version-mini-info { display: flex; align-items: center; gap: 8px; }
.version-mini-date { font-size: .78rem; color: var(--text-3); }
.version-mini-size { font-size: .78rem; color: var(--text-3); }
.version-badge {
  font-size: .72rem; font-weight: 700; padding: 2px 6px;
  border-radius: 4px; background: var(--bg-elevated); color: var(--text-3); border: 1px solid var(--border);
}
.version-badge.current { color: var(--green); border-color: var(--green); background: rgba(63,185,80,.1); }
.empty-state-sm { font-size: .82rem; color: var(--text-3); padding: 12px 0; text-align: center; }

/* Form layout helpers */
.form-actions { margin-top: 24px; }
.optional { color: var(--text-3); font-size: .75rem; font-weight: 400; }
.required  { color: var(--red); }

/* ══════════════════════════════════════════════════════════════
   VERSION HISTORY PAGE
   ══════════════════════════════════════════════════════════════ */
.filter-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.doc-url-display { display: flex; align-items: center; gap: 8px; padding-bottom: 2px; }
.version-num { font-variant-numeric: tabular-nums; font-weight: 600; font-size: .88rem; }
.row-highlight td { background: rgba(63,185,80,.04); }
.notes-cell { font-size: .81rem; color: var(--text-3); max-width: 200px; }
.loading-cell { text-align: center; padding: 40px; }
.error-cell   { text-align: center; padding: 40px; color: var(--red); font-size: .85rem; }
.spinner-wrap { display: flex; justify-content: center; padding: 20px; }

/* ══════════════════════════════════════════════════════════════
   USERS PAGE
   ══════════════════════════════════════════════════════════════ */
.username-cell { font-family: monospace; font-size: .88rem; color: var(--text-1); }
.input-with-toggle { position: relative; }
.input-with-toggle .form-input { padding-right: 40px; }
.input-eye-btn {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-3); cursor: pointer; padding: 4px;
}
.input-eye-btn:hover { color: var(--text-1); }
.modal-desc { font-size: .88rem; color: var(--text-2); margin-bottom: 16px; }

/* ══════════════════════════════════════════════════════════════
   AUDIT LOGS PAGE
   ══════════════════════════════════════════════════════════════ */
.wrap-filters { flex-wrap: wrap; }
.audit-table th, .audit-table td { font-size: .8rem; }
.log-time { font-size: .77rem; color: var(--text-3); white-space: nowrap; }
.ip-cell  { font-family: monospace; font-size: .77rem; color: var(--text-3); }
.detail-cell { font-size: .78rem; color: var(--text-3); max-width: 160px; }
.log-row:hover { background: var(--bg-elevated); }

/* Detail grid (reused in logs & settings) */
.detail-grid { display: flex; flex-direction: column; gap: 0; }
.detail-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 8px 0; border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,.05));
}
.detail-row:last-child { border-bottom: none; }
.detail-row-full { flex-direction: column; gap: 4px; }
.detail-key { font-size: .75rem; color: var(--text-3); min-width: 110px; padding-top: 2px; }
.detail-val { font-size: .84rem; color: var(--text-1); }
.detail-ua  { font-family: monospace; font-size: .74rem; word-break: break-all; }
.modal-lg   { max-width: 640px; }

/* Additional pagination pieces */
.page-indicator { font-size: .82rem; color: var(--text-3); }
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; gap: 10px; }
.pagination-controls { display: flex; align-items: center; gap: 10px; }

/* badge colours */
.badge-orange  { background: rgba(251,149,29,.15); color: #fb951d; border: 1px solid rgba(251,149,29,.3); }
.badge-purple  { background: rgba(188,140,255,.15); color: #bc8cff; border: 1px solid rgba(188,140,255,.3); }

/* ══════════════════════════════════════════════════════════════
   SETTINGS PAGE
   ══════════════════════════════════════════════════════════════ */
.settings-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) { .settings-layout { grid-template-columns: 1fr; } }

.input-with-suffix { position: relative; }
.input-with-suffix .form-input { padding-right: 48px; }
.input-suffix {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: .8rem; color: var(--text-3); pointer-events: none;
}
.url-preview-box {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px; margin-top: 12px;
}
.url-preview-label { font-size: .72rem; color: var(--text-3); margin-bottom: 4px; }
.url-preview-value { font-family: monospace; font-size: .82rem; color: var(--blue); word-break: break-all; }

.form-actions-row {
  display: flex; gap: 12px; align-items: center; margin-top: 8px; flex-wrap: wrap;
}

.path-list { display: flex; flex-direction: column; gap: 10px; }
.path-item { }
.path-label { font-size: .72rem; color: var(--text-3); margin-bottom: 3px; }
.path-value code { font-size: .82rem; background: var(--bg-base); padding: 3px 8px; border-radius: 4px; color: var(--green); }

.backup-steps { padding-left: 18px; margin: 10px 0; display: flex; flex-direction: column; gap: 6px; }
.backup-steps li { font-size: .83rem; color: var(--text-2); }
.backup-steps code { font-size: .8rem; background: var(--bg-base); padding: 1px 6px; border-radius: 3px; color: var(--green); }

.code-block {
  background: var(--bg-base); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; margin-top: 12px; overflow-x: auto;
}
.code-block code { font-size: .78rem; color: var(--green); line-height: 1.8; white-space: pre; }

.info-text { font-size: .84rem; color: var(--text-2); margin-bottom: 14px; }
.info-text code { font-size: .8rem; background: var(--bg-base); padding: 1px 5px; border-radius: 3px; color: var(--yellow); }

/* badge-info alias */
.badge-info { background: rgba(88,166,255,.15); color: var(--blue); border: 1px solid rgba(88,166,255,.3); }
