/* ====================================================
   Global design system — tyzxwl.cn
   Responsive-first, single CSS file.
   ==================================================== */

/* ---------- CSS Variables ---------- */
:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --muted: #6b7280;
  --brand: #4f6ef7;
  --brand2: #3b5bdb;
  --brand-light: #eef2ff;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --thead: #f8fafc;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --transition: 0.2s ease;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- Layout Shell ---------- */
.app {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: transform var(--transition), box-shadow var(--transition);
  padding: 0 0 24px;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.brand-badge {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
}
.brand-title { font-weight: 700; font-size: 15px; color: var(--text); line-height: 1.2; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }

.side-section {
  padding: 14px 16px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
}
.side-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: #374151;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  overflow: hidden;
}
.side-nav a:hover { background: var(--brand-light); color: var(--brand2); }
.side-nav a.active {
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  color: #fff;
  font-weight: 600;
}
.side-nav a .iconify { font-size: 17px; flex-shrink: 0; }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
  backdrop-filter: blur(2px);
}

/* ---------- Main Area ---------- */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-w);
  transition: margin-left var(--transition);
}

/* ---------- Topbar ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  box-shadow: var(--shadow);
}
.topbar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
/* Hamburger toggle button */
.sidebar-toggle {
  display: none;
  width: 36px; height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  align-items: center; justify-content: center;
  color: var(--muted);
  flex-shrink: 0;
  transition: background var(--transition);
}
.sidebar-toggle:hover { background: var(--brand-light); color: var(--brand); }
.sidebar-toggle .iconify { font-size: 20px; }

.topbar-title { font-weight: 700; font-size: 16px; }
.topbar-hint { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* ---------- Content ---------- */
.content {
  flex: 1;
  padding: 24px 24px 32px;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

/* Container utility */
.container { max-width: 1400px; margin: 0 auto; padding: 0 20px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.09); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  color: #fff;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
}
.btn:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79, 110, 247, 0.3); }
.btn:active { transform: translateY(0); }

.btn.secondary,
.btn-secondary { background: linear-gradient(135deg, #6b7280, #4b5563); }
.btn.secondary:hover { box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3); }

.btn.outline,
.btn-outline {
  background: #fff;
  color: #374151;
  border: 1px solid var(--border);
  box-shadow: none;
}
.btn.outline:hover,
.btn-outline:hover { background: var(--brand-light); color: var(--brand2); border-color: var(--brand); box-shadow: none; transform: none; }

.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); }
.btn-danger:hover { box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }

.btn-success { background: linear-gradient(135deg, #10b981, #059669); }
.btn-warning { background: linear-gradient(135deg, #f59e0b, #d97706); }

.btn-sm, .btn.small { padding: 6px 11px; font-size: 13px; border-radius: 7px; }
.btn-icon { display: inline-flex; align-items: center; gap: 6px; }

.btn[disabled] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* Loading state */
.loading { display: inline-flex; align-items: center; gap: 6px; }
.loading::after {
  content: '';
  width: 12px; height: 12px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
label {
  display: block;
  font-size: 13px;
  color: #374151;
  font-weight: 500;
  margin-bottom: 6px;
}
input, textarea, select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, textarea:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.12);
}
textarea { min-height: 100px; resize: vertical; }
.input-auto { width: auto; }
.input-rich {
  min-height: 44px;
  line-height: 1.6;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--card);
  outline: none;
}

/* Grid rows */
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* ---------- Tables ---------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 600px;
}
thead th {
  background: var(--thead);
  color: #475569;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}
th, td { padding: 11px 12px; text-align: center; font-size: 14px; }
.table-striped tbody tr:nth-child(even) { background: #fafbfc; }
.table-hover tbody tr { transition: background var(--transition); }
.table-hover tbody tr:hover { background: #f0f4ff; }

/* ---------- Typography ---------- */
h1, h2, h3 { margin: 0 0 12px; line-height: 1.3; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
.hint { color: var(--muted); font-size: 13px; }
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}
.text-lg { font-size: 16px; }
.text-xl { font-size: 22px; }
.fw-bold { font-weight: 700; }
.text-center { text-align: center; }
.text-danger { color: var(--danger); }
.no-wrap { white-space: nowrap; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--muted); }

/* ---------- Badges & Pills ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.badge-primary { background: var(--brand-light); color: var(--brand2); }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-muted { background: var(--thead); color: var(--muted); }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  color: #374151;
}
.pill.muted { background: var(--thead); color: var(--muted); }

/* ---------- Alerts ---------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  border-left: 4px solid;
  font-size: 14px;
}
.alert-info { background: #eff6ff; border-color: var(--brand); color: #1e40af; }
.alert-error { background: #fef2f2; border-color: var(--danger); color: #991b1b; }
.alert-success { background: #f0fdf4; border-color: var(--success); color: #166534; }
.alert-warning { background: #fffbeb; border-color: var(--warning); color: #92400e; }
.error { color: var(--danger); font-size: 13px; margin: 6px 0; }

/* ---------- Login Page (Split Layout) ---------- */
.plain-body {
  margin: 0; padding: 0; height: 100%; background: var(--bg);
}

.login-page {
  display: flex;
  min-height: 100vh;
}

/* ---- Left Panel: Brand / Hero ---- */
.login-panel-left {
  flex: 0 0 42%;
  background: linear-gradient(145deg, #3b5bdb 0%, #4f6ef7 50%, #6c8afc 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 60px 48px 32px;
  position: relative;
  overflow: hidden;
}
.login-panel-left::before {
  content: '';
  position: absolute;
  width: 360px; height: 360px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  top: -80px; right: -80px;
}
.login-panel-left::after {
  content: '';
  position: absolute;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  bottom: 40px; left: -60px;
}

.login-hero { position: relative; z-index: 1; }
.login-hero-badge {
  width: 72px; height: 72px;
  border-radius: 20px;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 28px;
  border: 1px solid rgba(255,255,255,0.25);
}
.login-hero-title {
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 10px;
  letter-spacing: -0.5px;
}
.login-hero-sub {
  font-size: 15px;
  color: rgba(255,255,255,0.75);
  margin: 0 0 36px;
}
.login-feature-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 14px;
}
.login-feature-list li {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,0.9);
  font-size: 14px;
}
.login-feature-list .iconify { flex-shrink: 0; font-size: 18px; }
.login-panel-footer {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  position: relative; z-index: 1;
}

/* ---- Right Panel: Form ---- */
.login-panel-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  background: #fff;
}
.login-form-wrap {
  width: 100%;
  max-width: 400px;
}
.login-form-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}
.login-form-logo {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--brand-light);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.login-form-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.login-form-hint {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}

/* Error box */
.login-error-box {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 13px;
  margin-bottom: 20px;
}

/* Fields */
.login-field { margin-bottom: 20px; }
.login-field label {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.login-field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.login-field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79,110,247,0.12);
  background: #fff;
}

/* Password toggle */
.login-pass-wrap { position: relative; }
.login-pass-wrap input { padding-right: 44px; }
.login-eye {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none; padding: 4px;
  cursor: pointer; color: var(--muted);
  display: flex; align-items: center;
  font-size: 18px;
  transition: color var(--transition);
}
.login-eye:hover { color: var(--brand); }

/* Submit button */
.login-submit {
  width: 100%;
  height: 48px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  box-shadow: 0 4px 14px rgba(79,110,247,0.35);
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
}
.login-submit:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79,110,247,0.4);
}
.login-submit:active { transform: translateY(0); }

.login-bottom-hint {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 24px;
  margin-bottom: 0;
}

/* ---- Responsive: tablet & mobile ---- */
@media (max-width: 860px) {
  .login-panel-left { display: none; }
  .login-panel-right { padding: 40px 24px; background: var(--bg); }
  .login-form-wrap { max-width: 440px; background: #fff; padding: 32px 28px; border-radius: 18px; box-shadow: var(--shadow-md); }
}
@media (max-width: 480px) {
  .login-panel-right { padding: 20px 16px; }
  .login-form-wrap { padding: 24px 20px; }
}

/* ---------- Avatars ---------- */
.avatar-lg { width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--border); object-fit: cover; }
.avatar-sm { width: 26px; height: 26px; border-radius: 999px; vertical-align: middle; margin-right: 6px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 200;
  backdrop-filter: blur(2px);
}
.modal-content {
  width: min(760px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow-md);
  max-height: 90vh;
  overflow-y: auto;
}

/* ---------- File Upload ---------- */
.file-upload {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  background: var(--thead);
  transition: border-color var(--transition), background var(--transition);
}
.file-upload.dragover { border-color: var(--brand); background: var(--brand-light); }

/* ---------- Misc Utilities ---------- */
.flex { display: flex; }
.col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-start { justify-content: flex-start; }
.flex-wrap { flex-wrap: wrap; }
.gap-4 { gap: 8px; }
.gap-6 { gap: 10px; }
.gap-8 { gap: 12px; }
.gap-10 { gap: 14px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.no-margin { margin: 0; }
.pb-2 { padding-bottom: 10px; }
.pre-wrap { white-space: pre-wrap; margin: 8px 0 0; }
.pre-wrap-wide { white-space: pre-wrap; word-break: break-all; margin: 8px 0 0; }
.pre-scroll { white-space: pre; overflow: auto; margin: 0; }
.lh-17 { line-height: 1.7; }
.display-inline { display: inline; }
.input-rich { width: 100%; }
.mx-1 { margin: 0 6px; }
.mr-2 { margin-right: 6px; }
.ml-2 { margin-left: 8px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.p-3 { padding: 10px; }
.ellipsis { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ellipsis-wide { max-width: 480px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.max-w-320 { max-width: 320px; }
.max-w-520 { max-width: 520px; }

/* Width helpers */
.w-36 { width: 36px; }
.w-44 { width: 44px; }
.w-90 { width: 90px; }
.w-110 { width: 110px; }
.w-120 { width: 120px; }
.w-140 { width: 140px; }

/* ---------- Panel & Sidebar Grid ---------- */
.grid-sidebar {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: start;
}
.grid-2col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-2col-380 { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }

/* ---------- Group / Panel Items ---------- */
.group-item {
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #fff;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  transition: background var(--transition);
}
.group-item.active { background: var(--brand-light); border-color: var(--brand); }
.panel-card { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--thead); }
/* remark-token: rich-text inline token pill */
.remark-token { display:inline-flex; align-items:center; gap:6px; padding:2px 8px; border-radius:999px; background:var(--thead); border:1px solid var(--border); color:var(--brand); font-size:13px; white-space:nowrap; }
.remark-token[data-token="{nickname}"] { color:var(--brand); }
.remark-token[data-token="{add_time}"] { color:var(--brand2); }
.remark-token[data-token="{real_name}"] { color:var(--brand); }
.remark-token[data-token="{school}"] { color:var(--brand2); }
.panel-item { display: block; margin-top: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--card); }
.preview-box {
  margin-top: 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  min-height: 200px;
  background: var(--thead);
  display: grid;
  place-items: center;
}

/* ---------- Icon helpers ---------- */
.iconify { display: inline-flex; align-items: center; margin-right: 4px; font-size: 17px; line-height: 1; }
.icon-sm { font-size: 14px; }
.icon-lg { font-size: 20px; }

/* ---------- Horizontal rule ---------- */
.hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

/* ---------- Fade-in animation ---------- */
.fade-in { animation: fadeIn 0.25s ease-out; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Page header ---------- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.page-head h2 { margin: 0; }

/* ---------- Stats cards row ---------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat-card .stat-label { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.stat-card .stat-value { font-size: 24px; font-weight: 700; }

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* --- Tablet (≤ 1024px) --- */
@media (max-width: 1024px) {
  .grid-2col-380 { grid-template-columns: 1fr; }
  .row-3 { grid-template-columns: 1fr 1fr; }
  .stats-row { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* --- Compact (≤ 860px): sidebar becomes slide-in drawer --- */
@media (max-width: 860px) {
  :root { --topbar-h: 56px; }

  /* Sidebar becomes a hidden drawer */
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-md);
  }
  .sidebar-overlay.open { display: block; }
  .sidebar-toggle { display: inline-flex; }

  /* Main fills full width */
  .main { margin-left: 0; }

  /* Reduce content padding */
  .content { padding: 16px 14px 24px; }

  /* Sidebar grid collapses */
  .grid-sidebar { grid-template-columns: 1fr; }
  .grid-2col-380 { grid-template-columns: 1fr; }
  .grid-2col { grid-template-columns: 1fr; }
}

/* --- Mobile (≤ 600px) --- */
@media (max-width: 600px) {
  .content { padding: 12px 10px 20px; }
  .card { padding: 14px 14px; }
  .topbar-inner { padding: 0 12px; }
  .row { grid-template-columns: 1fr; }
  .row-3 { grid-template-columns: 1fr; }
  th, td { padding: 8px 8px; font-size: 12px; }
  .btn { padding: 8px 12px; font-size: 13px; }
  .btn-sm, .btn.small { padding: 6px 9px; font-size: 12px; }
  .topbar-hint { display: none; }
  h2 { font-size: 17px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}
