:root {
  --bg: #f0f4f8;
  --sidebar: #0f2744;
  --sidebar-hover: #1a3558;
  --sidebar-text: #b8c7d9;
  --card: #ffffff;
  --border: #e5eaf0;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 1px 3px rgba(15, 39, 68, 0.08), 0 4px 16px rgba(15, 39, 68, 0.04);
  --radius: 14px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }

.layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #0f2744 0%, #122f52 100%);
  color: var(--sidebar-text);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 10px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 14px;
}
.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
}
.brand h2 {
  margin: 0;
  font-size: 15px;
  color: #fff;
  line-height: 1.2;
}
.brand p {
  margin: 2px 0 0;
  font-size: 11px;
  color: #8fa8c3;
}

.nav-section {
  margin: 12px 0 6px;
  padding: 0 10px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6d8aa8;
  font-weight: 700;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 4px;
  color: var(--sidebar-text);
  transition: 0.15s ease;
}
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.active {
  background: linear-gradient(90deg, rgba(59,130,246,0.25), rgba(59,130,246,0.08));
  color: #fff;
  border-left: 3px solid #60a5fa;
}
.nav-link .icon { width: 18px; text-align: center; }

.bot-status {
  margin-top: auto;
  padding: 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
}
.bot-status .online {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #86efac;
  font-weight: 600;
  font-size: 13px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34,197,94,0.2);
}
.bot-status .handle { font-size: 12px; margin-top: 6px; color: #cbd5e1; }
.bot-status .uptime { font-size: 11px; color: #94a3b8; margin-top: 4px; }

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

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}
.topbar .subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.date-pill {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--muted);
}
.admin-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px 6px 6px;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
}
.admin-pill .name { font-weight: 600; font-size: 13px; }
.admin-pill .role { font-size: 11px; color: var(--muted); }

.content { padding: 20px 24px 28px; flex: 1; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.kpi-grid.kpi-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 640px;
}
.users-top-grid {
  display: grid;
  grid-template-columns: minmax(130px, 0.5fr) minmax(200px, 0.85fr) minmax(0, 2.4fr);
  gap: 16px;
  margin-bottom: 18px;
  align-items: stretch;
}
.shops-top-grid {
  grid-template-columns: minmax(130px, 0.5fr) minmax(200px, 0.85fr) minmax(0, 2.4fr);
  min-height: 380px;
}
.shops-top-grid .users-kpi-stack,
.shops-top-grid .chart-card {
  min-height: 380px;
  height: 100%;
}
.shops-top-grid .chart-card {
  display: flex;
  flex-direction: column;
}
.shops-top-grid .donut-layout {
  flex: 1;
  min-height: 0;
  align-content: center;
}
.shops-top-grid .chart-wrap.donut {
  height: 100%;
  min-height: 180px;
  max-height: 240px;
}
.shops-top-grid .chart-legend {
  max-height: 260px;
  overflow-y: auto;
}
.shops-city-card {
  min-height: 360px;
}
.users-kpi-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.users-kpi-stack .kpi-card {
  flex: 1;
}
.shops-top-grid .users-kpi-stack .kpi-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  padding: 14px 16px;
}
.shops-top-grid .users-kpi-stack .kpi-card .value {
  font-size: 26px;
  margin: 4px 0 0;
}
.users-city-card {
  min-height: 360px;
}
.chart-wrap.users-city-chart {
  height: 320px;
}
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.kpi-card .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.kpi-card .value {
  font-size: 30px;
  font-weight: 800;
  margin: 8px 0 6px;
  letter-spacing: -0.02em;
}
.kpi-card .delta {
  font-size: 12px;
  font-weight: 600;
}
.kpi-card .delta.up { color: var(--success); }
.kpi-card .delta.down { color: var(--danger); }
.kpi-card .delta.neutral { color: var(--muted); }

.charts-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}
.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 12px;
  box-shadow: var(--shadow);
}
.chart-card h3 {
  margin: 0 0 12px;
  font-size: 15px;
}
.chart-card h3.status-chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.status-chart-total {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
  line-height: 1;
}
.chart-wrap { position: relative; height: 220px; }
.chart-wrap.donut { height: 200px; }
.donut-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 10px 14px;
  align-items: center;
}
.chart-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}
.legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}
.legend-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-label {
  color: #334155;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.legend-stats {
  color: #64748b;
  font-weight: 600;
  white-space: nowrap;
}

.tables-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel-head h3 { margin: 0; font-size: 15px; }
.panel-body { padding: 0; }

table.data {
  width: 100%;
  border-collapse: collapse;
}
table.data th,
table.data td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
}
table.data th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
table.data tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.badge.active, .badge.approved { background: #ecfdf5; color: #047857; }
.badge.pending { background: #fff7ed; color: #c2410c; }
.badge.rejected { background: #fef2f2; color: #b91c1c; }
.badge.paid { background: #eff6ff; color: #1d4ed8; }
.badge.plan { background: #f5f3ff; color: #6d28d9; }

.kpi-grid.kpi-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.mini-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}
.mini-stats.mini-stats-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.mini-stats.mini-stats-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.mini-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.mini-stat .label { color: var(--muted); font-size: 11px; font-weight: 600; }
.mini-stat .value { font-size: 22px; font-weight: 800; margin-top: 6px; }
.mini-stat .hint { font-size: 11px; color: var(--success); margin-top: 4px; }
a.mini-stat-link {
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
a.mini-stat-link:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.08);
}
.dash-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.dash-quick-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.dash-quick-link:hover {
  border-color: #93c5fd;
  color: #1d4ed8;
  background: #eff6ff;
}
table.data tr.dash-row { cursor: pointer; }
table.data tr.dash-row:hover td { background: #f8fafc; }
.dash-attention .kpi-card .value { font-size: 28px; }

.footer {
  padding: 14px 24px 18px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  background: var(--card);
}

/* Inner pages */
.toolbar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

input, select, textarea, button {
  font: inherit;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px 12px;
  background: #fff;
}
textarea { width: 100%; min-height: 70px; resize: vertical; }
button, .btn {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  cursor: pointer;
  font-weight: 600;
}
button:hover, .btn:hover { background: var(--primary-dark); }
button.danger, .btn.danger { background: var(--danger); border-color: var(--danger); }
button.ghost, .btn.ghost {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}
.muted { color: var(--muted); font-size: 12px; }

/* Management pages (mockup style) */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}
.page-header-left { display: flex; gap: 12px; align-items: flex-start; }
.page-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  color: #0f2744;
  letter-spacing: -0.02em;
}
.breadcrumb {
  margin-top: 4px;
  color: #94a3b8;
  font-size: 13px;
}
.menu-toggle, .bell, .bell-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 16px;
}
.bell-wrap { position: relative; display: inline-flex; align-items: center; }
.bell-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.bell-badge, .nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(239, 68, 68, 0.35);
}
.bell-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  pointer-events: none;
}
.nav-link { position: relative; }
.nav-link .nav-badge { margin-left: auto; border: none; box-shadow: none; }
.notif-dropdown {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  max-height: 360px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(15, 39, 68, 0.15);
  z-index: 200;
}
.bell-wrap:hover .notif-dropdown,
.bell-wrap.open .notif-dropdown,
.bell-wrap:focus-within .notif-dropdown {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.notif-head {
  padding: 12px 14px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.notif-item {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f1f5f9;
}
.notif-item:hover { background: #f8fafc; }
.notif-icon { font-size: 22px; line-height: 1; }
.notif-title { font-weight: 600; font-size: 13px; color: #0f2744; }
.notif-body { font-size: 12px; color: #64748b; margin-top: 2px; }
.notif-time { font-size: 11px; color: #94a3b8; margin-top: 4px; }
.notif-empty { padding: 20px 14px; color: #94a3b8; font-size: 13px; text-align: center; }
.notif-foot {
  display: block;
  padding: 10px 14px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  background: #f8fafc;
}
.notify-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.notify-pill.sent { background: #dcfce7; color: #166534; }
.notify-pill.failed { background: #fee2e2; color: #991b1b; }
.muted.tiny { font-size: 11px; margin-top: 2px; }
.notif-banner {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 14px;
}
.notif-banner a { color: #c2410c; font-weight: 700; margin-left: 8px; }
.page-header-right { display: flex; align-items: center; gap: 10px; }

.page-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.page-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  flex-wrap: wrap;
}
.toolbar-search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 280px;
}
.toolbar-search input[type="search"],
.toolbar-search input[type="text"] {
  flex: 1;
  min-width: 220px;
  padding: 10px 12px 10px 36px;
  border-radius: 10px;
  border: 1px solid #dbe3ee;
}
.search-wrap { position: relative; flex: 1; min-width: 220px; }
.search-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 14px;
}
.search-wrap input { width: 100%; padding-left: 36px; }
.toolbar-select {
  min-width: 130px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #dbe3ee;
  background: #fff;
}
.status-checks {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  background: #fff;
  white-space: nowrap;
}
.status-checks-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-right: 2px;
}
.status-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  user-select: none;
}
.status-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
}
.btn-export {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fff;
  color: var(--text);
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  padding: 0 16px;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
  box-sizing: border-box;
  height: 40px;
  min-height: 40px;
}
.btn-export:hover {
  background: #f8fafc;
  color: var(--text);
  border-color: #cbd5e1;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 0 16px;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
  box-sizing: border-box;
  height: 40px;
  min-height: 40px;
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; border-color: var(--primary-dark); }
.toolbar-action-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.toolbar-action-btns > a {
  height: 40px;
  min-height: 40px;
  min-width: 148px;
  padding: 0 16px;
  box-sizing: border-box;
}
.btn-export.btn-trash-active {
  border-color: #b91c1c;
  color: #b91c1c;
}
.btn-search {
  background: #f8fafc;
  color: var(--text);
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  padding: 10px 14px;
}

table.mgmt {
  width: 100%;
  border-collapse: collapse;
}
table.mgmt th,
table.mgmt td {
  padding: 14px 16px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}
table.mgmt.users-table th,
table.mgmt.users-table td {
  text-align: center !important;
}
table.mgmt.users-table th:nth-child(2),
table.mgmt.users-table td.user-name-cell {
  text-align: left !important;
}
table.mgmt th {
  background: #fafbfd;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}
table.mgmt tr:hover td { background: #fbfdff; }
table.mgmt tr:last-child td { border-bottom: none; }
table.mgmt tr.user-row { cursor: pointer; }
table.mgmt tr.shop-row { cursor: pointer; }
table.mgmt tr.plan-row { cursor: pointer; }
table.mgmt tr.plan-row:hover td { background: #fbfdff; }
table.mgmt tr.cat-row-selected td { background: #eff6ff !important; }
table.mgmt tr.cat-row-inactive td {
  background: #f8fafc;
  color: #64748b;
  opacity: 0.85;
}
table.mgmt tr.cat-row-inactive td b,
table.mgmt tr.cat-row-inactive code {
  color: #64748b;
}
table.mgmt tr.txn-row { cursor: pointer; }
table.mgmt tr.txn-row-pending td {
  background: #fffbeb;
}
table.mgmt tr.txn-row-pending:hover td {
  background: #fef3c7;
}
table.mgmt tr.report-row { cursor: pointer; }
table.mgmt tr.report-row-pending td {
  background: #fff7ed;
}
table.mgmt tr.report-row-pending:hover td {
  background: #ffedd5;
}
table.mgmt tr.sus-row td {
  background: #fef2f2;
}
table.mgmt tr.photo-ad-row { cursor: pointer; }
table.mgmt tr.photo-ad-pending td {
  background: #fff7ed;
}
table.mgmt tr.photo-ad-live td {
  background: #f0fdf4;
}
table.mgmt tr.photo-ad-expired td {
  background: #f8fafc;
  color: #64748b;
}
table.mgmt tr.banner-row { cursor: pointer; }
table.mgmt tr.banner-row-live td {
  background: #f0fdf4;
}
table.mgmt tr.banner-row-expired td {
  background: #f8fafc;
  color: #64748b;
}
.photo-ad-thumb {
  width: 96px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}
.kpi-card.kpi-warn {
  border-color: #fdba74;
  background: linear-gradient(180deg, #fff7ed 0%, #fff 100%);
}
.report-shop-card {
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}
.txn-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.8fr);
  gap: 24px;
  align-items: start;
}
.txn-screenshot {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}
.txn-screenshot-empty {
  padding: 28px 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  color: #64748b;
  background: #f8fafc;
}
@media (max-width: 900px) {
  .txn-detail-grid { grid-template-columns: 1fr; }
}
table.mgmt td.cat-actions-cell {
  width: 72px;
  text-align: center;
  white-space: nowrap;
}
table.mgmt .cat-delete-form {
  display: inline-flex;
  margin: 0;
}
table.mgmt .cat-delete-form[hidden] {
  display: none !important;
}
table.mgmt .cat-drag-handle {
  cursor: grab;
  color: #94a3b8;
  font-size: 14px;
  letter-spacing: -2px;
  user-select: none;
  padding: 4px 6px;
}
table.mgmt .cat-drag-handle:active { cursor: grabbing; }
table.mgmt .status-toggle-btn {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}
table.mgmt tr.user-row td.user-name-cell,
table.mgmt.shops-table td.biz-name-cell {
  padding-left: 16px;
  padding-right: 16px;
}
table.mgmt.users-table .user-cell,
table.mgmt.shops-table .user-cell {
  justify-content: flex-start;
}
table.mgmt.shops-table th,
table.mgmt.shops-table td {
  text-align: center !important;
}
table.mgmt.shops-table th:nth-child(2),
table.mgmt.shops-table td.biz-name-cell {
  text-align: left !important;
}

.status-pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.status-pill.active, .status-pill.paid { background: #dcfce7; color: #15803d; }
.status-pill.pending { background: #ffedd5; color: #c2410c; }
.status-pill.inactive, .status-pill.failed { background: #fee2e2; color: #b91c1c; }
.status-pill.neutral { background: #f1f5f9; color: #475569; }
.status-pill.role-pill { background: #dbeafe; color: #1d4ed8; }

.account-info-wrap {
  max-width: 560px;
  margin: 0 auto;
}
.account-info-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.account-info-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}
.account-info-actions form {
  margin: 0;
  display: inline-flex;
}
.account-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 120px;
  height: 42px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
}
.account-action-btn.ghost {
  background: #fff;
  color: #0f172a;
  border-color: #dbe3ee;
}
.account-action-btn.ghost:hover {
  background: #f8fafc;
}
.account-action-btn.danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.account-action-btn.danger:hover {
  filter: brightness(0.95);
}
.account-info-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.account-info-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}
.account-info-head-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #dbeafe;
  font-size: 14px;
}
.account-info-list {
  padding: 4px 0;
}
.account-info-row {
  display: grid;
  grid-template-columns: 36px minmax(110px, 140px) 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid #eef2f7;
}
.account-info-row:last-child {
  border-bottom: none;
}
.ai-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.ai-icon.purple { background: #f3e8ff; }
.ai-icon.yellow { background: #fef9c3; }
.ai-icon.blue { background: #dbeafe; }
.ai-icon.green { background: #dcfce7; }
.ai-icon.red { background: #fee2e2; }
.ai-icon.pink { background: #fce7f3; }
.ai-icon.orange { background: #ffedd5; }
.ai-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.ai-value {
  justify-self: end;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}
.account-shops {
  border-top: 1px solid var(--border);
  padding: 12px 0 6px;
}
.account-shops-head {
  padding: 0 18px 8px;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}
.account-shop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  text-decoration: none;
  color: inherit;
  border-top: 1px solid #eef2f7;
}
.account-shop-row:hover {
  background: #f8fafc;
}
.account-shop-name {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}
.account-shop-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.user-cell { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.user-avatar, .biz-thumb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dbeafe, #ede9fe);
  color: #1d4ed8;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}
.biz-thumb { border-radius: 10px; }

.action-icons { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #0f172a;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.icon-btn:hover { background: #f1f5f9; border-color: #cbd5e1; }
.icon-btn.danger {
  border-color: #fecaca;
  background: #fff;
}
.icon-btn.danger:hover { background: #fef2f2; }
.icon-btn.toggle-btn,
td.actions .icon-btn {
  width: auto;
  min-width: 52px;
  height: 28px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.icon-btn.toggle-off {
  background: #fff7ed;
  border-color: #fdba74;
  color: #9a3412;
}
.icon-btn.toggle-off:hover { background: #ffedd5; }
.icon-btn.toggle-on {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
}
.icon-btn.toggle-on:hover { background: #d1fae5; }

.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: #fff;
  flex-wrap: wrap;
  gap: 10px;
}
.pager { display: flex; gap: 6px; align-items: center; }
.pager a, .pager span {
  min-width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-size: 13px;
}
.pager a.current {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 700;
}
.showing { color: #64748b; font-size: 13px; }

.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.settings-nav {
  border-right: 1px solid var(--border);
  padding: 14px 12px;
  background: #fafbfd;
}
.settings-nav-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 4px 12px 8px;
}
.settings-nav a {
  display: block;
  padding: 9px 12px;
  border-radius: 10px;
  color: #475569;
  margin-bottom: 2px;
  font-weight: 600;
  font-size: 13px;
}
.settings-nav a.active, .settings-nav a:hover {
  background: #eff6ff;
  color: #1d4ed8;
}
.settings-body { padding: 22px 26px 28px; max-width: 820px; }
.settings-body h3 { margin: 0 0 6px; font-size: 17px; }
.settings-block { margin-bottom: 8px; scroll-margin-top: 24px; }
.settings-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  margin: 14px 0 8px;
}
.settings-fields label { margin-bottom: 0; }
.settings-readonly-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}
.settings-ro-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: #f8fafc;
}
.settings-ro-item .label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  margin-bottom: 6px;
}
.settings-ro-item .value {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  word-break: break-all;
}
.settings-ro-item .tiny { margin-top: 6px; }
.settings-db { font-size: 12px; }
.settings-ro-warn {
  border-color: #fcd34d;
  background: #fffbeb;
}
@media (max-width: 900px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { border-right: none; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 4px; }
  .settings-nav-label { width: 100%; }
  .settings-fields,
  .settings-readonly-grid { grid-template-columns: 1fr; }
}
.form-grid label {
  display: block;
  margin-bottom: 14px;
  font-weight: 600;
  color: #334155;
}
.form-grid label span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}
.form-grid input {
  width: 100%;
  max-width: 520px;
  padding: 11px 12px;
}

/* Centered edit form: label + control on one row */
.edit-page-card {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 28px 28px;
}
/* Wider edit forms (Admin invite + Paid Photo Ad detail) */
.edit-page-card.wide-edit-card,
.edit-page-card.invite-edit-card {
  max-width: 1180px;
  width: 100%;
  margin: 0;
}
.wide-detail-grid,
.invite-detail-grid {
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.9fr);
  gap: 28px;
}
.wide-edit-card .form-rows > label > span:first-child,
.invite-edit-card .form-rows > label > span:first-child {
  flex: 0 0 180px;
  width: 180px;
}
.wide-edit-card .form-rows label input,
.wide-edit-card .form-rows label textarea,
.invite-edit-card .form-rows label textarea {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.invite-edit-card .form-rows label textarea {
  min-height: 110px;
}
.wide-edit-card .txn-screenshot,
.invite-edit-card .txn-screenshot {
  max-height: 560px;
}
@media (max-width: 1000px) {
  .wide-detail-grid,
  .invite-detail-grid { grid-template-columns: 1fr; }
}
.form-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.form-rows label {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 0;
  font-weight: 600;
  color: #334155;
}
.form-rows > label > span:first-child {
  flex: 0 0 150px;
  width: 150px;
  margin: 0;
  padding-top: 12px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  line-height: 1.3;
}
.form-rows label input,
.form-rows label textarea,
.form-rows label select {
  flex: 1;
  width: auto;
  max-width: none;
  min-width: 0;
}
.form-rows .field-stack {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.form-rows .field-stack input[type="file"] {
  width: 100%;
}
.cover-preview {
  width: 100%;
  max-width: 320px;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f1f5f9;
  display: block;
}
.detail-cover-preview {
  width: 100%;
  max-width: 480px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #f1f5f9;
  display: block;
}
.owner-tg-id {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  margin-top: 2px;
}
.shops-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}
.kpi-card.kpi-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.kpi-card.kpi-link:hover {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.kpi-card.kpi-active {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.form-step-divider {
  margin: 10px 0 2px;
  padding: 8px 0 0;
  border-top: 1px dashed #dbe3ee;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #64748b;
}
.form-rows .form-note {
  margin: 0 0 0 166px;
}
.form-rows .form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 4px 0 0 166px;
}
.edit-page-meta {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.form-rows-compact .inline-controls {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.form-rows-compact .inline-controls select,
.form-rows-compact .inline-controls input {
  flex: 1 1 120px;
  width: auto;
  max-width: none;
  min-width: 90px;
}
.form-rows-compact .inline-controls button {
  flex: 0 0 auto;
}
@media (max-width: 640px) {
  .edit-page-card {
    padding: 16px;
  }
  .form-rows label {
    flex-direction: column;
    gap: 6px;
  }
  .form-rows > label > span:first-child {
    flex: none;
    width: auto;
    padding-top: 0;
  }
  .form-rows .form-note,
  .form-rows .form-actions {
    margin-left: 0;
  }
}

.banner-thumb {
  width: 56px;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  display: grid;
  place-items: center;
  font-size: 18px;
}

.role-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  background: #f8fafc;
  color: #334155;
}
.log-module-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.log-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}
.log-chip:hover, .log-chip.active {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}
.log-module {
  font-weight: 600;
  color: #334155;
}
.log-action {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}
.log-action.ok { background: #dcfce7; color: #166534; }
.log-action.warn { background: #fef3c7; color: #92400e; }
.log-action.bad { background: #fee2e2; color: #991b1b; }
.log-action.neutral { background: #f1f5f9; color: #475569; }
.flash-banner {
  background: #ecfdf5;
  border: 1px solid #86efac;
  color: #166534;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-weight: 600;
}

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid.kpi-grid-2 { max-width: none; }
  .users-top-grid { grid-template-columns: 1fr 1fr; }
  .shops-top-grid { grid-template-columns: 1fr; }
  .shops-top-grid .users-kpi-stack,
  .shops-top-grid .chart-card { min-height: 0; height: auto; }
  .users-kpi-stack { grid-column: 1 / -1; flex-direction: row; }
  .shops-top-grid .users-kpi-stack { flex-direction: row; flex-wrap: wrap; }
  .shops-top-grid .users-kpi-stack .kpi-card { flex: 1 1 calc(50% - 8px); min-width: 140px; }
  .charts-grid { grid-template-columns: 1fr; }
  .tables-grid { grid-template-columns: 1fr; }
  .mini-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .users-top-grid { grid-template-columns: 1fr; }
  .shops-top-grid { grid-template-columns: 1fr; }
  .users-kpi-stack { flex-direction: column; }
  .mini-stats { grid-template-columns: repeat(2, 1fr); }
}
