/* =====================================================================
   Design tokens
   ===================================================================== */
:root {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-alt: #f8f9fd;
  --surface-2: #f0f1f9;
  --border: #e6e8f3;
  --border-strong: #d8dbec;
  --text: #14162b;
  --text-muted: #676c85;
  --text-faint: #9599ac;

  --primary: #5b5bf5;
  --primary-dark: #4747d1;
  --primary-light: #8b7bff;
  --primary-tint: #eeeeff;
  --grad-primary: linear-gradient(135deg, #6a5bf6 0%, #8b6bff 100%);

  --success: #17a673;
  --success-bg: #e6f8f1;
  --grad-success: linear-gradient(135deg, #14b17c 0%, #34d399 100%);

  --danger: #e6435a;
  --danger-bg: #fdecef;
  --grad-danger: linear-gradient(135deg, #ef4460 0%, #fb7185 100%);

  --warning: #d9891f;
  --warning-bg: #fdf3e3;
  --grad-warning: linear-gradient(135deg, #f39a1f 0%, #fbbf24 100%);

  --info: #2b7cd3;
  --info-bg: #e8f2fc;
  --grad-info: linear-gradient(135deg, #2f8ae0 0%, #60a5fa 100%);

  --grad-neutral: linear-gradient(135deg, #4b5165 0%, #6b7189 100%);

  --sidebar-bg: #100f26;
  --sidebar-bg-2: #1a1a3d;
  --sidebar-text: #a6aac6;
  --sidebar-border: rgba(255, 255, 255, 0.08);

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Lexend', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 22px;

  --shadow-xs: 0 1px 2px rgba(20, 22, 45, 0.05);
  --shadow-sm: 0 1px 3px rgba(20, 22, 45, 0.06), 0 1px 2px rgba(20, 22, 45, 0.05);
  --shadow: 0 4px 14px rgba(20, 22, 45, 0.08), 0 1px 3px rgba(20, 22, 45, 0.06);
  --shadow-lg: 0 16px 40px rgba(20, 22, 45, 0.16), 0 4px 12px rgba(20, 22, 45, 0.08);

  --header-h: 68px;
  --sidebar-w: 258px;
  --sidebar-w-rail: 84px;
}

/* =====================================================================
   Reset / base
   ===================================================================== */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.015em; margin: 0; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 100px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* =====================================================================
   App shell
   ===================================================================== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---------------- Sidebar ---------------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar-bg-2) 0%, var(--sidebar-bg) 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 22px 0 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 45;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 22px 22px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--sidebar-border);
}

.brand-mark {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  box-shadow: 0 4px 12px rgba(107, 91, 246, 0.45);
}

.sidebar-brand-text {
  font-family: var(--font-display);
  font-size: 1.06rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.sidebar-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: rgba(166, 170, 198, 0.6);
  padding: 0 22px;
  margin-bottom: 8px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; padding: 0 12px; }

.sidebar-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--sidebar-text);
  padding: 10px 12px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.nav-icon {
  flex-shrink: 0;
  width: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}

.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-nav a:hover { background: rgba(255,255,255,0.07); color: #fff; }

.sidebar-nav a.active {
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(91, 91, 245, 0.38);
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  border-radius: 100px;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  margin-left: auto;
}

.sidebar-footer {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--sidebar-border);
  padding-left: 12px;
  padding-right: 12px;
}

.sidebar-account { display: flex; align-items: center; gap: 11px; padding: 6px 10px 14px; }

.sidebar-avatar {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--grad-info);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.88rem;
}

.sidebar-account-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.sidebar-account-name { font-size: 0.85rem; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-account-role { font-size: 0.72rem; color: var(--sidebar-text); }

.sidebar-logout button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--sidebar-text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar-logout button:hover { background: rgba(255,255,255,0.08); color: #fff; border-color: rgba(255,255,255,0.24); }

/* ---------------- Topbar ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--header-h);
  padding: 0 30px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.topbar-brand { display: none; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 800; font-size: 1rem; color: var(--text); }

.topbar-title { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; color: var(--text); }

.topbar-spacer { flex: 1; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.topbar-icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--surface-2);
  font-size: 1.05rem;
  color: var(--text);
  transition: background 0.15s ease, transform 0.15s ease;
}

.topbar-icon-btn:hover { background: var(--primary-tint); transform: translateY(-1px); }

.topbar-dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 8px;
  height: 8px;
  border-radius: 100%;
  background: var(--danger);
  border: 2px solid var(--surface);
}

.nav-toggle-checkbox { display: none; }
.nav-overlay { display: none; }

/* =====================================================================
   Content area
   ===================================================================== */
.main-content { flex: 1; padding: 30px 34px 44px; max-width: 1280px; width: 100%; min-width: 0; margin: 0 auto; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
  gap: 12px;
  flex-wrap: wrap;
}

.page-header h1 { font-size: 1.55rem; }
.page-header p { color: var(--text-muted); margin: 5px 0 0; font-size: 0.92rem; }

/* ---------------- Stat grid ---------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(216px, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.stat-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: flex-start;
  gap: 15px;
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--grad-primary);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--border-strong); }
.stat-card:hover::before { opacity: 1; }

.stat-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: var(--grad-primary);
  box-shadow: 0 6px 14px rgba(107, 91, 246, 0.28);
}

.stat-icon.icon-warning { background: var(--grad-warning); box-shadow: 0 6px 14px rgba(243, 154, 31, 0.28); }
.stat-icon.icon-info { background: var(--grad-info); box-shadow: 0 6px 14px rgba(47, 138, 224, 0.28); }
.stat-icon.icon-danger { background: var(--grad-danger); box-shadow: 0 6px 14px rgba(239, 68, 96, 0.28); }
.stat-icon.icon-success { background: var(--grad-success); box-shadow: 0 6px 14px rgba(20, 177, 124, 0.28); }
.stat-icon.icon-neutral { background: var(--grad-neutral); box-shadow: 0 6px 14px rgba(75, 81, 101, 0.22); }

.stat-body { min-width: 0; }
.stat-card .label { color: var(--text-muted); font-size: 0.76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .value { font-family: var(--font-display); font-size: 1.65rem; font-weight: 700; margin-top: 4px; letter-spacing: -0.02em; line-height: 1.1; }
.stat-card .hint { font-size: 0.76rem; color: var(--text-faint); margin-top: 3px; font-weight: 500; }

.stat-card-highlight { border-color: rgba(91, 91, 245, 0.28); background: linear-gradient(180deg, var(--primary-tint) 0%, var(--surface) 55%); }

/* ---------------- Dashboard two-column layout ---------------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 22px;
  align-items: start;
}

/* ---------------- Cards ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-xs);
  margin-bottom: 24px;
}

.card h2 { font-size: 1.05rem; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.card-head h2 { margin: 0; }

.card-action { font-size: 0.83rem; font-weight: 700; white-space: nowrap; }
.card-action:hover { color: var(--primary-dark); }

/* ---------------- Needs-attention list ---------------- */
.attention-list { display: flex; flex-direction: column; gap: 6px; }

.attention-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px;
  border-radius: var(--radius);
  color: var(--text);
  transition: background 0.15s ease, transform 0.15s ease;
}

.attention-row:hover { background: var(--surface-alt); color: var(--text); transform: translateX(2px); }

.attention-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.02rem;
  background: var(--grad-primary);
}

.attention-icon.icon-warning { background: var(--grad-warning); }
.attention-icon.icon-info { background: var(--grad-info); }
.attention-icon.icon-danger { background: var(--grad-danger); }
.attention-icon.icon-success { background: var(--grad-success); }

.attention-text { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.attention-title { font-size: 0.87rem; font-weight: 700; }
.attention-sub { font-size: 0.76rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.attention-count {
  flex-shrink: 0;
  min-width: 26px;
  text-align: center;
  padding: 3px 8px;
  border-radius: 100px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
}

.attention-chevron { flex-shrink: 0; color: var(--text-faint); font-size: 1.1rem; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  min-height: 40px;
}

.btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-tint); }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--grad-primary); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(91,91,245,0.32); }
.btn-primary:hover { filter: brightness(1.05); color: #fff; box-shadow: 0 6px 16px rgba(91,91,245,0.4); }

.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(0.93); color: #fff; background: var(--success); }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.93); color: #fff; background: var(--danger); }

.btn-sm { padding: 7px 13px; font-size: 0.8rem; min-height: 34px; }

/* ---------------- Tables ---------------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 12px; font-size: 0.87rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--text-muted); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: var(--surface-alt); }
.table-wrap { overflow-x: auto; margin: -4px; padding: 4px; }
td.cell-actions { display: flex; gap: 8px; align-items: center; }

.cell-package { display: flex; align-items: center; gap: 10px; }
.cell-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--primary-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
}
.cell-title { font-weight: 700; }
.cell-sub { font-size: 0.76rem; color: var(--text-muted); margin-top: 1px; }

.cell-user { display: flex; align-items: center; gap: 9px; }
.user-avatar {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 100%;
  background: var(--grad-info);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cell-amount { font-weight: 800; font-variant-numeric: tabular-nums; }
.cell-date { color: var(--text-muted); white-space: nowrap; }

/* ---------------- Badges ---------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.badge-dot { width: 6px; height: 6px; border-radius: 100%; background: currentColor; flex-shrink: 0; }

.badge-awaiting_payment { background: var(--warning-bg); color: var(--warning); }
.badge-awaiting_verification { background: var(--warning-bg); color: var(--warning); }
.badge-verified { background: var(--info-bg); color: var(--info); }
.badge-uid_received { background: var(--info-bg); color: var(--info); }
.badge-completed { background: var(--success-bg); color: var(--success); }
.badge-rejected { background: var(--danger-bg); color: var(--danger); }

/* ---------------- Forms ---------------- */
.form-group { margin-bottom: 17px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 700; margin-bottom: 6px; }
.form-group small { display: block; color: var(--text-muted); margin-top: 5px; font-size: 0.78rem; }

.form-control {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 160px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* ---------------- Filters/tabs ---------------- */
.tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabs a {
  padding: 8px 15px;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  white-space: nowrap;
  transition: all 0.15s ease;
}
.tabs a:hover { border-color: var(--primary); color: var(--primary); }
.tabs a.active { background: var(--grad-primary); border-color: transparent; color: #fff; box-shadow: 0 4px 10px rgba(91,91,245,0.32); }

/* ---------------- Alerts ---------------- */
.alert { padding: 13px 16px; border-radius: var(--radius-sm); font-size: 0.88rem; margin-bottom: 18px; font-weight: 600; }
.alert-info { background: var(--info-bg); color: var(--info); }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); }

/* ---------------- Login page ---------------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 18% 18%, #8b7bff 0%, transparent 45%), radial-gradient(circle at 85% 85%, #4747d1 0%, transparent 40%), linear-gradient(135deg, #5b5bf5 0%, #100f26 100%);
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 42px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-card h1 { font-size: 1.4rem; text-align: center; }
.login-card p.subtitle { text-align: center; color: var(--text-muted); font-size: 0.88rem; margin: 6px 0 28px; }
.login-card .btn-primary { width: 100%; justify-content: center; margin-top: 8px; padding: 12px; font-size: 0.92rem; }

/* ---------------- Order detail / misc ---------------- */
.detail-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; align-items: start; }

.detail-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 0.89rem; }
.detail-row:last-child { border-bottom: none; }
.detail-row .k { color: var(--text-muted); }
.detail-row .v { font-weight: 700; text-align: right; }

.screenshot-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-alt);
}
.screenshot-frame img { width: 100%; display: block; }

.qr-preview { max-width: 220px; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; background: #fff; }
.qr-preview img { width: 100%; display: block; }

.empty-state { text-align: center; padding: 56px 20px; color: var(--text-faint); font-weight: 600; }

/* ---------------- Ticket conversation ---------------- */
.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 480px;
  overflow-y: auto;
  padding: 6px 2px;
}

.chat-bubble-row { display: flex; }
.chat-bubble-row.from-admin { justify-content: flex-end; }

.chat-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-bubble-row.from-user .chat-bubble {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.chat-bubble-row.from-admin .chat-bubble {
  background: var(--grad-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble .meta {
  display: block;
  font-size: 0.7rem;
  opacity: 0.7;
  margin-top: 5px;
}

.reply-box { display: flex; gap: 10px; margin-top: 18px; }
.reply-box textarea { flex: 1; }

/* =====================================================================
   Responsive: tablet — sidebar collapses to an icon rail
   ===================================================================== */
@media (max-width: 980px) {
  .detail-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .main-content { padding: 26px; }
}

@media (max-width: 980px) and (min-width: 761px) {
  .sidebar { width: var(--sidebar-w-rail); padding-left: 0; padding-right: 0; }
  .sidebar-brand { justify-content: center; padding: 0 0 20px; }
  .sidebar-brand-text,
  .nav-label,
  .sidebar-section-label,
  .sidebar-account-text { display: none; }
  .sidebar-nav { padding: 0 10px; }
  .sidebar-nav a { justify-content: center; padding: 12px; }
  .nav-badge { position: absolute; top: 6px; right: 6px; margin-left: 0; }
  .sidebar-footer { padding-left: 10px; padding-right: 10px; }
  .sidebar-account { justify-content: center; padding: 6px 0 14px; }
  .sidebar-logout button { justify-content: center; padding: 10px; }
}

/* =====================================================================
   Responsive: mobile — off-canvas drawer nav + stacked "card" tables
   ===================================================================== */
@media (max-width: 760px) {
  .hamburger-btn { display: flex; }
  .topbar-brand { display: flex; }
  .topbar-title { display: none; }
  .topbar { padding: 0 16px; gap: 10px; }

  .app-shell { flex-direction: column; }

  .sidebar {
    position: fixed;
    inset: 0 0 0 auto;
    left: auto;
    width: min(80vw, 288px);
    height: 100vh;
    z-index: 50;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg);
    padding-left: 0;
    padding-right: 0;
  }

  .sidebar-brand { justify-content: flex-start; }
  .sidebar-brand-text,
  .nav-label,
  .sidebar-section-label,
  .sidebar-account-text { display: revert; }
  .sidebar-nav a { justify-content: flex-start; }
  .nav-badge { position: static; margin-left: auto; }
  .sidebar-account { justify-content: flex-start; }
  .sidebar-logout button { justify-content: flex-start; }

  .nav-toggle-checkbox:checked ~ .app-shell .sidebar {
    transform: translateX(0);
  }

  .nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(10, 11, 26, 0.5);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .nav-toggle-checkbox:checked ~ .app-shell .nav-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .main-content { padding: 18px 16px 40px; max-width: 100%; }

  .page-header h1 { font-size: 1.3rem; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-card { padding: 15px; gap: 11px; }
  .stat-card .value { font-size: 1.32rem; }
  .stat-card .hint { display: none; }
  .stat-icon { width: 36px; height: 36px; font-size: 1.02rem; border-radius: 11px; }

  .card { padding: 18px; border-radius: var(--radius); }

  .form-row { flex-direction: column; gap: 0; }

  /* Stacked "card" tables instead of cramped horizontal scroll */
  .table-wrap table thead { display: none; }
  .table-wrap table, .table-wrap table tbody, .table-wrap table tr, .table-wrap table td {
    display: block;
    width: 100%;
  }
  .table-wrap table { border: none; }
  .table-wrap table tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    padding: 4px 14px;
    box-shadow: var(--shadow-xs);
  }
  .table-wrap table tr:hover { background: var(--surface); }
  .table-wrap table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    text-align: right;
    font-size: 0.86rem;
    white-space: normal !important;
    max-width: none !important;
    overflow: visible !important;
    text-overflow: unset !important;
  }
  .table-wrap table td:last-child { border-bottom: none; }
  .table-wrap table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    text-align: left;
    flex-shrink: 0;
    margin-right: 12px;
  }
  .table-wrap table td[data-label=""]::before,
  .table-wrap table td:not([data-label])::before { content: none; }
  .table-wrap table td.cell-actions { justify-content: flex-end; gap: 8px; }
  .table-wrap table td.cell-actions::before { display: none; }
  .table-wrap table td.cell-empty { justify-content: center; }
  .table-wrap table td.cell-empty::before { display: none; }

  .reply-box { flex-direction: column; }
  .reply-box button { align-self: stretch !important; }

  .chat-bubble { max-width: 90%; }

  .login-card { padding: 32px 24px; }
}
