:root {
  --bg: #f4f5fb;
  --bg2: #ffffff;
  --panel: #ffffff;
  --panel-soft: #fafaff;
  --line: #e6e8f1;
  --line-strong: #d9ddec;
  --text: #202438;
  --muted: #929bb0;
  --accent: #6b63f6;
  --accent-strong: #5c55e9;
  --accent-soft: #f0efff;
  --coruna: #6574e8;
  --ds: #28b96b;
  --ios18: #d99512;
  --warn: #d89012;
  --danger: #e76670;
  --ok: #28b96b;
  --shadow: 0 10px 28px rgba(73, 79, 126, .08);
}

/* Dashboard v2: scoped layout and chart primitives. */
.dashboard-page {
  font-size: 14px;
}
.dashboard-page,
.dashboard-page .dashboard-overview,
.dashboard-page .dashboard-trends { min-width: 0; }
.dashboard-page .dashboard-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.dashboard-page .dashboard-section-heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 720;
}
.dashboard-page .dashboard-section-heading p { margin: 6px 0 0; font-size: 14px; }
.dashboard-page .dashboard-updated {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}
.dashboard-page .dashboard-updated strong { color: var(--text); font-weight: 650; }
.dashboard-page .dashboard-updated-time { padding-left: 8px; border-left: 1px solid var(--line); }
.dashboard-page .dashboard-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.dashboard-page .dashboard-stat-card {
  position: relative;
  min-width: 0;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  padding: 16px 20px 14px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.dashboard-page .dashboard-stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--dashboard-color, var(--accent));
}
.dashboard-page .dashboard-stat-label { color: var(--muted); font-size: 12px; line-height: 1.35; letter-spacing: .1px; }
.dashboard-page .dashboard-stat-value {
  display: block;
  color: var(--dashboard-number, var(--text));
  font-size: 30px;
  line-height: 1;
  font-weight: 750;
  letter-spacing: 0;
}
.dashboard-page .dashboard-stat-value-split { display: flex; align-items: baseline; gap: 8px; letter-spacing: 0; }
.dashboard-page .dashboard-stat-value-split b { color: var(--dashboard-number, var(--text)); font-weight: 750; }
.dashboard-page .dashboard-stat-value-split i { color: #c3c7d5; font-size: 23px; font-style: normal; font-weight: 500; }
.dashboard-page .dashboard-stat-note { color: #a2a9b8; font-size: 11px; line-height: 1.3; letter-spacing: .05px; }
.dashboard-page .stat-online { --dashboard-color: #28b96b; --dashboard-number: #202438; }
.dashboard-page .stat-wallet { --dashboard-color: #a95bef; --dashboard-number: #8e49d9; }
.dashboard-page .stat-whatsapp { --dashboard-color: #20bd73; --dashboard-number: #15965b; }
.dashboard-page .stat-telegram { --dashboard-color: #35add8; --dashboard-number: #258daa; }
.dashboard-page .stat-new-device { --dashboard-color: #3d8bfd; --dashboard-number: #3d7fe0; }
.dashboard-page .stat-new-wallet { --dashboard-color: #a95bef; --dashboard-number: #8e49d9; }
.dashboard-page .stat-new-whatsapp { --dashboard-color: #20bd73; --dashboard-number: #15965b; }
.dashboard-page .stat-new-telegram { --dashboard-color: #35add8; --dashboard-number: #258daa; }
.dashboard-page .dashboard-trends { margin-top: 0; }
.dashboard-page .dashboard-trends-heading {
  min-height: 91px;
  align-items: center;
  margin-bottom: 16px;
  padding: 14px 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.dashboard-page .dashboard-trends-heading h2 { margin: 0; font-size: 20px; line-height: 1.25; font-weight: 720; }
.dashboard-page .dashboard-trend-title { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.dashboard-page .dashboard-trend-switch { display: inline-flex; gap: 4px; }
.dashboard-page .dashboard-trend-switch button {
  min-width: 39px;
  padding: 5px 11px;
  border: 0;
  color: var(--muted);
  background: #f4f3fb;
  border-radius: 7px;
  text-align: center;
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
  box-shadow: none;
  transition: color .15s ease, background-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.dashboard-page .dashboard-trend-switch button:hover { color: var(--accent); background: #fff; }
.dashboard-page .dashboard-trend-switch button:focus-visible { outline: 3px solid rgba(107,99,246,.2); outline-offset: 2px; }
.dashboard-page .dashboard-trend-switch button:active { transform: translateY(1px); }
.dashboard-page .dashboard-trend-switch button.on,
.dashboard-page .dashboard-trend-switch button[aria-pressed="true"] { color: var(--accent); background: #fff; box-shadow: 0 4px 12px rgba(73,79,126,.12); }
.dashboard-page .dashboard-trend-legend { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 16px; color: var(--muted); font-size: 13px; }
.dashboard-page .dashboard-trend-legend span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.dashboard-page .dashboard-trend-legend i { width: 10px; height: 10px; display: inline-block; border-radius: 50%; }
.dashboard-page .legend-device { background: #3d9fe8; }
.dashboard-page .legend-wallet { background: #a95bef; }
.dashboard-page .legend-whatsapp { background: #20bd73; }
.dashboard-page .legend-telegram { background: #35add8; }
.dashboard-page .dashboard-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 16px;
}
.dashboard-page .dashboard-chart-card {
  min-width: 0;
  min-height: 292px;
  overflow: hidden;
  padding: 18px 18px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.dashboard-page .dashboard-chart-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.dashboard-page .dashboard-chart-heading h3 { margin: 0 0 2px; font-size: 14px; line-height: 1.3; font-weight: 700; }
.dashboard-page .dashboard-chart-heading span:not(.dashboard-chart-key) { color: var(--muted); font-size: 11px; }
.dashboard-page .dashboard-chart-heading strong { color: var(--dashboard-number, var(--text)); font-size: 14px; font-weight: 720; }
.dashboard-page .dashboard-chart-range { color: var(--muted); font-size: 11px; white-space: nowrap; }
.dashboard-page .dashboard-chart-key {
  display: block;
  flex: 0 0 9px;
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--dashboard-color, var(--accent));
  filter: drop-shadow(0 0 3px rgba(107,99,246,.22));
}
.dashboard-page .dashboard-chart-wrap { min-width: 0; overflow: hidden; }
.dashboard-page .dashboard-chart {
  display: block;
  width: 100%;
  height: 160px;
  max-width: 100%;
  overflow: hidden;
  color: var(--dashboard-color, var(--accent));
}
.dashboard-page .dashboard-chart-gridlines line {
  stroke: #eceef5;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.dashboard-page .dashboard-chart-line {
  fill: none;
  stroke: var(--dashboard-color, currentColor);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.dashboard-page .dashboard-chart-labels {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 2px;
  min-height: 16px;
  margin: -1px 3px 0;
  color: #a2a9b8;
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
}
.dashboard-page .dashboard-chart-labels span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-page .chart-device { --dashboard-color: #3d9fe8; --dashboard-number: #3d8bfd; }
.dashboard-page .chart-wallet { --dashboard-color: #a95bef; --dashboard-number: #8e49d9; }
.dashboard-page .chart-whatsapp { --dashboard-color: #20bd73; --dashboard-number: #15965b; }
.dashboard-page .chart-telegram { --dashboard-color: #35add8; --dashboard-number: #258daa; }
@media (max-width: 1100px) {
  .dashboard-page .dashboard-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .dashboard-page .dashboard-section-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .dashboard-page .dashboard-updated { justify-content: flex-start; text-align: left; }
  .dashboard-page .dashboard-chart-grid { grid-template-columns: 1fr; gap: 14px; }
  .dashboard-page .dashboard-trends-heading { min-height: 0; padding: 16px 18px; }
  .dashboard-page .dashboard-trend-legend { justify-content: flex-start; gap: 12px; font-size: 13px; }
  .dashboard-page .dashboard-chart-card { min-height: 270px; }
  .dashboard-page .dashboard-chart { height: 150px; }
}
@media (max-width: 480px) {
  .dashboard-page .dashboard-stat-grid { grid-template-columns: 1fr; gap: 12px; }
  .dashboard-page .dashboard-stat-card { min-height: 120px; padding: 16px 16px 14px 20px; }
  .dashboard-page .dashboard-stat-value { font-size: 28px; }
  .dashboard-page .dashboard-chart-card { min-height: 240px; padding: 16px 14px 12px; }
  .dashboard-page .dashboard-chart { height: 140px; }
  .dashboard-page .dashboard-chart-labels { gap: 0; margin-left: 0; margin-right: 0; font-size: 9px; }
  .dashboard-page .dashboard-chart-heading h3 { font-size: 16px; }
}

/* User management and collection controls */
.collect-page { font-size: 14px; }
.collect-page .collect-intro-card { padding: 18px 20px; }
.collect-page .collect-intro-card p { margin-bottom: 0; font-size: 13px; line-height: 1.55; }
.collect-page .collect-intro-card .err,
.collect-page .collect-intro-card .ok { margin-top: 10px; margin-bottom: 0; }
.collect-setting-card { padding: 16px 20px; }
.collect-setting-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(250px, 2fr) auto;
  align-items: center;
  gap: 18px;
  min-width: 0;
}
.collect-account { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; min-width: 0; }
.collect-account strong { color: var(--text); font-size: 14px; }
.collect-account code { color: #6672c8; font-size: 12px; overflow-wrap: anywhere; }
.collect-switches { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 24px; }
.collect-switch { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; white-space: nowrap; cursor: pointer; }
.collect-switch input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.collect-actions { display: flex; justify-content: flex-end; }
.collect-actions button { min-width: 72px; }
.user-management-wrap { text-align: left; }
.user-management-table-wrap { overflow-x: auto; }
.user-management-table { width: 100%; min-width: 590px; border-collapse: collapse; }
.user-management-table th,
.user-management-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.user-management-table th { color: var(--muted); font-size: 13px; font-weight: 650; }
.user-management-table td { color: var(--text); font-size: 14px; }
.user-management-table td code { color: #6672c8; overflow-wrap: anywhere; }
.user-management-table td:last-child { text-align: right; }
.user-management-table .btn { padding: 7px 11px; font-size: 13px; }
.user-role-label { display: inline-flex; align-items: center; margin-left: 8px; padding: 2px 7px; border-radius: 5px; font-size: 11px; line-height: 1.2; font-weight: 600; }
.user-role-label.admin { color: #6b63f6; background: #f0efff; }
.user-role-label.channel { color: #657086; background: #f2f4f8; }
.user-management-empty { margin: 8px 0 0; text-align: center; }
.user-management-note { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.user-password-hint { margin: 0 0 10px; color: var(--muted); text-align: left; }
.side-manage,
.side-logout { width: 100%; box-sizing: border-box; }
@media (max-width: 700px) {
  .collect-setting-form { grid-template-columns: 1fr; gap: 12px; }
  .collect-actions { justify-content: flex-end; }
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }

.layout { display: flex; min-height: 100vh; }
.side {
  width: clamp(280px, 18vw, 362px);
  flex: 0 0 clamp(280px, 18vw, 362px);
  min-height: 100vh;
  background: var(--bg2);
  border-right: 1px solid var(--line);
  padding: 0 16px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 118px;
  padding: 30px 18px 26px;
  border-bottom: 1px solid var(--line);
  margin: 0;
}
.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: #f04f5b;
  color: #ffd45b;
  font-size: 26px;
  font-weight: 800;
  box-shadow: 0 8px 16px rgba(240, 79, 91, .18);
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.brand-copy strong { color: var(--text); font-size: 22px; font-weight: 750; }
.brand-copy small { color: var(--muted); font-size: 14px; letter-spacing: .08em; margin-top: 4px; }
.nav { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 24px 0; scrollbar-width: thin; }
.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #717b91;
  min-height: 48px;
  padding: 13px 14px;
  border-radius: 10px;
  margin-bottom: 5px;
  text-decoration: none;
  font-size: 16px;
  font-weight: 520;
  transition: background-color .15s ease, color .15s ease;
}
.nav a:hover, .nav a.on { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.nav a.on::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
}
.nav-icon { width: 20px; flex: 0 0 20px; color: currentColor; font-size: 19px; line-height: 1; text-align: center; opacity: .9; }
.nav-divider { height: 1px; background: var(--line); margin: 14px 12px 12px; }
.main { flex: 1; min-width: 0; padding: 0 36px 56px; }
.top { display: flex; justify-content: space-between; align-items: center; min-height: 102px; margin: 0 -36px 30px; padding: 0 36px; gap: 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.top h1 { font-size: 28px; line-height: 1.2; margin: 0; font-weight: 720; letter-spacing: 0; }
.top-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.btn-mnemonic-reveal { font-size: 13px; padding: 7px 12px; }
.muted { color: var(--muted); }
.user { color: var(--muted); font-size: 13px; }
.user a { margin-left: 12px; font-weight: 600; }

.nav-group { margin-bottom: 4px; border-radius: 10px; }
.nav-group-toggle {
  position: relative;
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #717b91;
  font-size: 16px;
  font-weight: 520;
  text-align: left;
  box-shadow: none;
  cursor: pointer;
}
.nav-group-toggle:hover,
.nav-group.is-current > .nav-group-toggle,
.nav-group.is-open > .nav-group-toggle {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: none;
}
.nav-group-toggle:focus-visible,
.nav-subitem:focus-visible {
  outline: 3px solid rgba(107, 99, 246, .2);
  outline-offset: 2px;
}
.nav-group-toggle .nav-chevron { margin-left: auto; font-size: 18px; line-height: 1; transition: transform .15s ease; }
.nav-group.is-open > .nav-group-toggle .nav-chevron { transform: rotate(180deg); }
.nav-group.is-current > .nav-group-toggle::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
}
.nav-submenu {
  margin: 2px 0 8px 26px;
  padding: 4px 0 4px 8px;
  border-left: 1px solid var(--line);
}
.nav-subitem {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 520;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.nav .nav-subitem:hover,
.nav .nav-subitem.on { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.nav a.nav-subitem.on::before { display: none; }
.nav-sub-action { font-family: inherit; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; max-width: 100%; box-shadow: var(--shadow); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
input[type=text], input[type=password], select, textarea { background: #fff; color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 11px; outline: none; box-shadow: 0 2px 6px rgba(73, 79, 126, .03); }
input::placeholder, textarea::placeholder { color: #aab1c2; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(107, 99, 246, .12); }
button, .btn { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 9px 15px; font-weight: 650; cursor: pointer; display: inline-block; transition: background-color .15s ease, transform .15s ease, box-shadow .15s ease; }
button:hover, .btn:hover { background: var(--accent-strong); text-decoration: none; box-shadow: 0 6px 14px rgba(107, 99, 246, .18); }
button:active, .btn:active { transform: translateY(1px); }
button.ghost, .btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--line-strong); box-shadow: none; }
button.ghost:hover, .btn.ghost:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
button.danger, .btn.danger { background: var(--danger); color: #fff; }
.table .btn.danger { padding: 5px 11px; font-size: 12px; }
.grow { flex: 1; }

.devices-page { min-width: 0; }
.devices-filter-card { padding: 22px 24px; }
.devices-filter input[name=q] { width: 250px; }
.devices-filter select { min-width: 150px; }
.devices-filter button { min-width: 78px; }
.devices-table-card { padding: 12px 16px 18px; }
.devices-table-wrap { width: 100%; overflow-x: auto; }
.devices-table { min-width: 1080px; table-layout: fixed; }
.devices-table th, .devices-table td { padding: 14px 10px; }
.devices-table td code { color: var(--accent); font-size: 13px; overflow-wrap: anywhere; }
.devices-table th:nth-child(1), .devices-table td:nth-child(1) { width: 92px; }
.devices-table th:nth-child(2), .devices-table td:nth-child(2) { width: 94px; }
.devices-table th:nth-child(3), .devices-table td:nth-child(3) { width: 86px; }
.devices-table th:nth-child(4), .devices-table td:nth-child(4) { width: 170px; }
.devices-table th:nth-child(5), .devices-table td:nth-child(5) { width: 150px; }
.devices-table th:nth-child(6), .devices-table td:nth-child(6) { width: 160px; }
.devices-table th:nth-child(7), .devices-table td:nth-child(7) { width: 82px; }
.devices-table th:nth-child(8), .devices-table td:nth-child(8) { width: 168px; }
.devices-table th:nth-child(9), .devices-table td:nth-child(9) { width: 62px; }
.devices-table th:nth-child(10), .devices-table td:nth-child(10) { width: 74px; }
.devices-table th:nth-child(11), .devices-table td:nth-child(11) { width: 62px; }
.devices-table th:last-child, .devices-table td:last-child { width: 74px; }
.devices-table td { overflow-wrap: anywhere; }
.devices-table th:last-child,
.devices-table td:last-child { width: 142px; white-space: nowrap; }
.devices-table .device-detail-link {
  min-height: 30px;
  margin-right: 5px;
  padding: 5px 10px;
  color: var(--accent);
  border-color: #cfd2f4;
  font-size: 12px;
}
.devices-table .device-detail-link:hover {
  color: var(--accent-strong);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.photo-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.photo-item { background: var(--panel-soft); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.photo-thumb { position: relative; display: block; }
.photo-scan-badge { position: absolute; top: 6px; right: 6px; z-index: 2; font-size: 11px; padding: 2px 7px; box-shadow: 0 1px 4px rgba(73, 79, 126, .16); pointer-events: none; }
.photo-item img { width: 100%; height: 160px; object-fit: cover; display: block; }
.photo-meta { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; }
.photo-meta code { font-size: 11px; word-break: break-all; }
.swal2-popup.adm-swal { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 50px rgba(39, 45, 82, .18); }
.swal2-popup.adm-swal .swal2-title { color: var(--text); font-size: 18px; }
.swal2-popup.adm-swal .swal2-html-container { color: var(--muted); }
.swal2-popup.adm-swal .swal2-actions { gap: 10px; }

.kc-wrap { width: 100%; max-width: 100%; overflow: auto; }
.kc-table { table-layout: fixed; width: 100%; max-width: 100%; }
.kc-table th, .kc-table td { overflow: hidden; }
.kc-table th:nth-child(1), .kc-table td:nth-child(1) { width: 14%; }
.kc-table th:nth-child(2), .kc-table td:nth-child(2) { width: 16%; }
.kc-table th:nth-child(3), .kc-table td:nth-child(3) { width: 28%; }
.kc-table th:nth-child(4), .kc-table td:nth-child(4) { width: 42%; }
.kc-cell, .kc-val { overflow-wrap: anywhere; word-break: break-all; white-space: normal; }
.kc-val-box { max-height: 72px; overflow: auto; overflow-wrap: anywhere; word-break: break-all; }
.kc-val-box code, .kc-cell code { display: block; font-size: 12px; white-space: pre-wrap; word-break: break-all; overflow-wrap: anywhere; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 650; font-size: 12px; white-space: nowrap; }
.table tr:hover td { background: #fafaff; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.badge.coruna { background: #eeefff; color: var(--coruna); }
.badge.darksword { background: #e5f8ed; color: var(--ds); }
.badge.sdk { background: #eaf3ff; color: #388ce7; }
.badge.ios18 { background: #fff5dd; color: var(--ios18); }
.badge.on { background: #e5f8ed; color: var(--ds); }
.badge.off { background: #f0f1f6; color: var(--muted); }
.badge.pending { background: #fff4df; color: var(--warn); }
.badge.sent { background: #eaf3ff; color: #388ce7; }
.badge.done { background: #e5f8ed; color: var(--ds); }
.badge.likely { background: #fff0f1; color: #df5964; }
.photo-scan-badge.likely { font-size: 10px; max-width: 92%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 8px 12px; border-radius: 8px; color: var(--muted); background: #fff; border: 1px solid var(--line); text-decoration: none; }
.tabs a.on { color: #fff; background: var(--accent); border-color: var(--accent); font-weight: 650; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; }
.kv b { color: var(--muted); font-weight: 550; }
.pager { margin-top: 14px; color: var(--muted); }
.pager a { margin-right: 8px; }
.promo-link-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.promo-iframe-wrap { margin-top: 10px; max-width: 520px; }
.promo-iframe-snippet { display: block; font-size: 11px; line-height: 1.45; word-break: break-all; white-space: pre-wrap; padding: 8px 10px; background: var(--panel-soft); border-radius: 8px; border: 1px solid var(--line); color: #68728b; }
button.btn-toggle-iframe.on, button.btn-toggle-js.on { border-color: var(--accent); color: var(--accent); }

body.login-page {
  min-height: 100dvh;
  background: var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.login-page .login-wrap {
  position: relative;
  isolation: isolate;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow: hidden;
  background: var(--bg) url("/static/login-bg.png?v=ui20261011-reference-scale-a") center / cover no-repeat;
}
.login-page .login-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: rgba(255, 255, 255, .18);
}
.login-page .login-box {
  position: relative;
  z-index: 1;
  width: min(100%, 400px);
  margin: 0;
  padding: clamp(28px, 5vw, 40px);
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(217, 221, 236, .9);
  border-radius: 16px;
  box-shadow: 0 22px 60px rgba(73, 79, 126, .16);
}
.login-page .login-title {
  margin: 0 0 28px;
  color: var(--text);
  text-align: center;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
  font-size: clamp(24px, 3vw, 28px);
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: 0;
}
.login-page .login-box label { display: block; margin: 14px 0 7px; color: var(--muted); font-weight: 550; }
.login-page .login-box input { width: 100%; min-height: 44px; }
.login-page .login-box button { width: 100%; min-height: 44px; margin-top: 22px; }
.login-page .login-box input:focus-visible,
.login-page .login-box button:focus-visible { outline: 3px solid rgba(107, 99, 246, .24); outline-offset: 2px; }
.err { color: var(--danger); margin: 0 0 10px; }
.ok { color: var(--ok); }
@media (max-width: 600px) {
  .login-page .login-wrap { padding: 16px; background-position: 58% center; }
  .login-page .login-box { padding: 28px 22px; border-radius: 14px; }
  .login-page .login-title { margin-bottom: 24px; font-size: 24px; }
}

/* Access statistics workspace: compact reference-panel proportions. */
.access-stats-page { min-width: 0; }
.access-stats-heading { align-items: center; margin-bottom: 16px; }
.access-stats-heading-copy { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.access-stats-kicker { color: var(--text); font-size: 18px; font-weight: 720; }
.access-stats-heading #stats-updated { font-size: 12px; white-space: nowrap; }
.stats-range { gap: 4px; padding: 4px; background: #f8f7fd; }
.stats-range button { min-height: 32px; padding: 6px 11px; border-radius: 7px; font-size: 12px; }
.stats-cards { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stats-card { min-height: 120px; padding: 16px 18px 14px 20px; border-radius: 12px; }
.stats-label { font-size: 12px; line-height: 1.35; }
.stats-card strong { font-size: 30px; line-height: 1; }
.stats-note { font-size: 11px; line-height: 1.35; }
.stats-grid-main { gap: 16px; margin-bottom: 20px; }
.stats-panel { padding: 20px; border-radius: 12px; }
.stats-panel h3 { margin-bottom: 6px; font-size: 15px; }
.stats-panel > p { margin: 4px 0 16px; font-size: 12px; }
.stats-panel-heading { align-items: flex-start; gap: 12px; }
.stats-panel-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.stats-country-controls { display: flex; align-items: center; gap: 14px; }
.stats-country-filter { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.stats-country-filter select { min-width: 150px; min-height: 34px; padding: 7px 10px; font-size: 12px; }
.stats-map-panel { min-height: 360px; }
.stats-world-map { position: relative; min-height: 250px; display: grid; place-items: center; overflow: hidden; margin-top: 6px; border: 1px solid #ebeaf5; border-radius: 10px; background: #fafaff; }
.stats-world-map svg { display: block; width: 100%; height: auto; max-height: 280px; }
.stats-world-map .country { fill: rgba(107,99,246,.22); stroke: #d9ddec; stroke-width: .55; vector-effect: non-scaling-stroke; transition: fill .15s ease, stroke .15s ease; }
.stats-world-map .country.has-data { fill: rgba(107,99,246,var(--map-alpha,.45)); stroke: #b8b2f5; }
.stats-world-map .country:hover { stroke: var(--accent-strong); stroke-width: 1.5; }
.stats-map-loading { color: var(--muted); font-size: 13px; }
.stats-map-legend { display: flex; align-items: center; gap: 14px; margin-top: 10px; color: var(--muted); font-size: 11px; }
.stats-map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.stats-map-legend i { width: 12px; height: 8px; display: inline-block; border-radius: 3px; }
.stats-map-legend-low { background: rgba(107,99,246,.24); }.stats-map-legend-mid { background: rgba(107,99,246,.52); }.stats-map-legend-high { background: rgba(107,99,246,.88); }
.stats-rank-panel { min-height: 360px; }
.stats-rank-line { padding: 11px 0; font-size: 13px; }
.stats-rank-line b { font-size: 14px; }
.stats-table-wrap { margin-top: 16px; }
.stats-table th, .stats-table td { padding: 10px 11px; font-size: 13px; }
.stats-country-panel, .stats-source-panel { margin-bottom: 20px; }
.stats-country-panel .stats-panel-heading p, .stats-source-panel .stats-panel-heading p { margin-bottom: 0; }
.stats-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; color: var(--muted); font-size: 12px; }
.stats-pagination button { min-width: 34px; min-height: 32px; padding: 4px 10px; font-size: 20px; line-height: 1; }
.stats-pagination button:disabled { opacity: .45; cursor: not-allowed; }
.stats-source-filter { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.stats-source-filter select { min-width: 190px; min-height: 34px; padding: 7px 10px; font-size: 12px; }
.stats-source-table td:last-child { max-width: 280px; color: var(--muted); white-space: normal; }
@media (max-width: 1200px) and (min-width: 901px) {
  .stats-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .access-stats-heading { align-items: flex-start; flex-direction: column; }
  .access-stats-heading-copy { width: 100%; justify-content: space-between; }
  .stats-range { width: 100%; overflow-x: auto; }
  .stats-range button { flex: 1 0 auto; }
  .stats-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats-grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .stats-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stats-card { min-height: 112px; padding: 14px 15px 13px 18px; }
  .stats-card strong { font-size: 27px; }
  .stats-map-panel, .stats-rank-panel { min-height: 0; }
  .stats-world-map { min-height: 190px; }
  .stats-panel-heading { flex-direction: column; }
  .stats-source-filter { width: 100%; justify-content: space-between; }
  .stats-source-filter select { min-width: 0; flex: 1; }
  .stats-country-controls { width: 100%; justify-content: space-between; }
  .stats-country-filter { flex: 1; }
  .stats-country-filter select { min-width: 0; flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .login-page *, .login-page *::before, .login-page *::after { transition: none !important; animation: none !important; }
}
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photos a { display: block; background: var(--panel-soft); border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.photos .photo-thumb { position: relative; }
.photos img { width: 100%; height: 140px; object-fit: cover; display: block; }
.note-list-tg { display: flex; flex-direction: column; gap: 2px; }
.note-row-tg { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: inherit; border: 1px solid var(--line); background: var(--panel-soft); margin-bottom: 6px; }
.note-row-tg:hover { background: var(--accent-soft); }
.note-row-device a { text-decoration: none; }
.note-row-device a:hover code { color: var(--accent); }
.note-row-meta .btn.ghost { padding: 4px 10px; font-size: 12px; white-space: nowrap; }
.note-detail-block p { margin: 0 0 10px; text-align: left; }
.note-detail-body { max-height: 420px; text-align: left; margin: 0; }
.note-row-device { flex: 0 0 auto; max-width: 28%; }
.note-row-device code { font-size: 11px; word-break: break-all; }
.note-row-main { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.note-row-meta { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.note-item { background: var(--panel-soft); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.note-item h3 { margin: 6px 0 8px; font-size: 15px; font-weight: 600; }
.pre { white-space: pre-wrap; word-break: break-all; background: var(--panel-soft); padding: 10px; border-radius: 8px; font-size: 12px; color: #68728b; max-height: 280px; overflow: auto; }
.secret { background: #fff6f7; border: 1px solid #f2d8dc; padding: 10px 12px; border-radius: 8px; margin-bottom: 8px; }
.secret code { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-all; }
.secret-cell { min-width: 280px; max-width: 560px; }
.wallet-group h3 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.wallet-pair { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 4px; margin-bottom: 14px; background: var(--panel-soft); }
.wallet-pair .secret { margin-bottom: 8px; }
.wallet-pair .wallet-fold { margin-top: 0; }
.wallet-fold { border: 1px solid var(--line); border-radius: 8px; margin: 10px 0; background: var(--panel-soft); }
.wallet-fold summary { cursor: pointer; padding: 10px 12px; color: var(--text); list-style: none; display: flex; gap: 8px; align-items: center; }
.wallet-fold summary::-webkit-details-marker { display: none; }
.wallet-fold summary::before { content: "▸"; color: var(--muted); }
.wallet-fold[open] summary::before { content: "▾"; }
.wallet-fold .table { margin: 0 10px 10px; width: calc(100% - 20px); }
.cmd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.apps-all { display: none; margin-top: 12px; }
.apps-all.show { display: block; }
.pagination { display: flex; gap: 6px; list-style: none; padding: 0; margin: 12px 0 0; }
.pagination li a, .pagination li span { display: inline-block; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); }
.pagination li.active span { background: var(--accent); color: #fff; border-color: var(--accent); }
.swal-json { max-height: 70vh; overflow: auto; text-align: left; white-space: pre-wrap; word-break: break-word; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--panel-soft); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin: 0; }
.swal-json .jk { color: #4d79d8; }
.swal-json .js { color: #2a9e5c; }
.swal-json .jn { color: #bd7d0d; }
.swal-json .jl { color: #cf568b; }
.placeholder-page { min-height: calc(100vh - 118px); }
.section-page { min-width: 0; }
.section-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 900px;
}
.section-action {
  min-height: 104px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease, color .15s ease;
}
.section-action:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 12px 30px rgba(73, 79, 126, .13);
  transform: translateY(-1px);
  text-decoration: none;
}
.section-action:focus-visible { outline: 3px solid rgba(107, 99, 246, .2); outline-offset: 2px; }
.section-action-label { font-size: 18px; font-weight: 700; }
.section-action-arrow { color: var(--accent); font-size: 22px; line-height: 1; }

@media (max-width: 1100px) {
  .side { width: 216px; flex-basis: 216px; }
  .main { padding-left: 24px; padding-right: 24px; }
  .top { margin-left: -24px; margin-right: -24px; padding-left: 24px; padding-right: 24px; }
}
@media (max-width: 900px) {
  .layout { display: block; }
  .side { width: 100%; min-height: auto; height: auto; position: relative; padding: 16px 14px 12px; }
  .brand { margin-bottom: 10px; padding-bottom: 14px; }
  .nav { display: block; max-height: 62vh; overflow-y: auto; overflow-x: hidden; padding: 8px 0 2px; }
  .nav a { margin-bottom: 4px; }
  .nav-group-toggle { min-height: 44px; font-size: 15px; }
  .nav-submenu { margin-left: 22px; }
  .nav-group.is-current > .nav-group-toggle::before { left: 10px; right: 10px; top: auto; bottom: 3px; width: auto; height: 3px; border-radius: 3px; }
  .nav a.on::before { left: 10px; right: 10px; top: auto; bottom: 3px; width: auto; height: 3px; border-radius: 3px; }
  .nav-divider { display: none; }
  .main { padding: 22px 16px 40px; }
  .top { min-height: 56px; margin: 0 0 24px; padding: 0; border-bottom: 0; background: transparent; }
  .cmd-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .top { align-items: flex-start; flex-direction: column; }
  .top-right { width: 100%; justify-content: flex-start; }
  .devices-filter input[name=q], .devices-filter select { width: 100%; min-width: 0; }
  .devices-filter button { width: 100%; }
  .kv { grid-template-columns: 1fr; gap: 4px; }
  .kv b { margin-top: 8px; }
  .note-row-tg { align-items: flex-start; flex-wrap: wrap; }
  .note-row-main { flex-basis: 100%; order: 2; }
  .section-actions { grid-template-columns: 1fr; }
  .nav-subitem { min-height: 36px; font-size: 13px; }
}

/* Reference shell and access-stats visual layer. */
body { background: linear-gradient(135deg, #f7f7fc 0%, #eef0fa 100%); }
.layout {
  margin: 18px;
  min-height: calc(100vh - 36px);
  height: calc(100vh - 36px);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 12px 40px rgba(73, 79, 126, .08);
}
.side { height: 100%; min-height: 0; padding: 0 16px; }
.brand { margin: 0 -16px; padding: 30px 32px 26px; }
.nav { padding: 24px 0; }
.nav > a { min-height: 48px; padding: 12px 14px; font-size: 16px; }
.nav .nav-group-toggle { min-height: 48px; padding: 12px 14px; font-size: 16px; }
.nav a.nav-subitem,
.nav .nav-submenu .nav-subitem { min-height: 38px; margin-bottom: 2px; padding: 8px 14px; gap: 0; font-size: 14px; }
.main { overflow: auto; background: var(--bg); }
.top { min-height: 106px; }
.side-footer {
  flex: 0 0 auto;
  margin: 0 -16px;
  padding: 14px 24px 16px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.side-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.side-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(40,185,107,.12); }
.side-user { margin: 8px 0 12px; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-manage { display: flex; align-items: center; justify-content: center; min-height: 36px; margin-bottom: 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: #657086; font-size: 14px; font-weight: 650; text-decoration: none; }
.side-manage:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.side-logout { display: flex; align-items: center; justify-content: center; min-height: 36px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: #657086; font-size: 14px; font-weight: 650; text-decoration: none; }
.side-logout:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.brand-mark { font-size: 0; }
.brand-mark::before { content: "◕"; font-size: 30px; color: #ffd45b; }
.card { padding: 24px 28px; border-radius: 14px; box-shadow: 0 8px 24px rgba(73,79,126,.07); }

.access-stats-page { min-width: 0; }
.access-stats-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.access-stats-heading h2 { margin: 0; font-size: 22px; line-height: 1.25; }
.access-stats-heading p { margin: 6px 0 0; font-size: 14px; }
.stats-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: -8px 0 18px; }
.stats-toolbar label { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.stats-toolbar select { min-width: 150px; }
.stats-range { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border-radius: 10px; background: rgba(255,255,255,.55); }
.stats-range button { min-height: 36px; padding: 7px 13px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; box-shadow: none; }
.stats-range button:hover, .stats-range button.active { background: #fff; color: var(--accent); box-shadow: 0 5px 14px rgba(73,79,126,.10); }
.stats-cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stats-card { position: relative; min-height: 142px; display: flex; flex-direction: column; justify-content: space-between; padding: 23px 24px 20px 28px; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.stats-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--stats-color, var(--accent)); }
.stats-label { color: var(--muted); font-size: 14px; }
.stats-card strong { color: var(--stats-number, var(--text)); font-size: 34px; line-height: 1; font-weight: 750; }
.stats-note { color: #a2a9b8; font-size: 13px; }
.stats-green { --stats-color: #28b96b; }.stats-purple { --stats-color: #b35bf2; --stats-number: #6b63f6; }.stats-orange { --stats-color: #f3a01a; --stats-number: #d99512; }.stats-blue { --stats-color: #3d8bfd; }.stats-cyan { --stats-color: #3d9bd8; }.stats-cyan-deep { --stats-color: #35add8; }
.stats-grid-main { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .65fr); gap: 20px; margin-bottom: 22px; }
.stats-panel { min-width: 0; padding: 28px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.stats-panel h3 { margin: 0; font-size: 21px; line-height: 1.3; }.stats-panel > p { margin: 7px 0 22px; font-size: 14px; }
.stats-map-placeholder { position: relative; min-height: 260px; display: grid; place-items: center; overflow: hidden; border: 1px solid #ebeaf5; border-radius: 10px; background-color: #fafaff; background-image: linear-gradient(#f0f1f7 1px, transparent 1px), linear-gradient(90deg, #f0f1f7 1px, transparent 1px); background-size: 25% 25%; }
.stats-map-placeholder::before { content: ""; position: absolute; width: 58%; height: 48%; border: 1px solid #e1e3f2; border-radius: 45% 55% 48% 52%; transform: rotate(-7deg); opacity: .85; }.stats-map-placeholder span { position: relative; z-index: 1; color: #a8afc1; font-size: 16px; }.stats-map-panel small { display: block; margin-top: 12px; font-size: 13px; }
.stats-rank-panel { min-height: 360px; }.stats-skeleton-row { display: flex; align-items: center; gap: 14px; margin-top: 26px; }.stats-skeleton-row i { width: 24px; height: 24px; border-radius: 50%; background: #f0efff; }.stats-skeleton-row b { flex: 1; height: 10px; border-radius: 5px; background: linear-gradient(90deg, #6b63f6, #55cbe8); opacity: .18; }
.stats-rank-line { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.stats-rank-line b { color: var(--text); font-size: 16px; }
.stats-panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }.stats-country-select { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }.stats-country-select select { min-width: 150px; }.stats-table-wrap { overflow-x: auto; margin-top: 22px; }.stats-table { width: 100%; min-width: 720px; border-collapse: collapse; }.stats-table th, .stats-table td { padding: 13px 10px; text-align: left; border-bottom: 1px solid var(--line); }.stats-table th { color: var(--muted); font-size: 13px; font-weight: 650; }.stats-table td { font-size: 14px; }.stats-empty { padding: 28px 10px !important; color: var(--muted); text-align: center !important; }
@media (max-width: 900px) {
  .layout { margin: 0; height: auto; min-height: 100vh; border-radius: 0; overflow: visible; }.side { height: auto; min-height: auto; padding: 0 14px 12px; }.brand { margin: 0 -14px; }.side-footer { margin: 0 -14px; }.main { overflow: visible; }.top { min-height: 64px; }.stats-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }.stats-grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .access-stats-heading { align-items: flex-start; flex-direction: column; }.stats-toolbar { align-items: flex-start; flex-direction: column; }.stats-range { width: 100%; }.stats-range button { flex: 1 0 auto; }.stats-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }.stats-card { min-height: 128px; padding: 18px 18px 16px 22px; }.stats-card strong { font-size: 28px; }.stats-panel { padding: 20px; }.stats-panel-heading { flex-direction: column; }
}

/* Final reference proportions, kept after responsive rules so mobile wins. */
.brand { min-height: 86px; padding: 18px 26px 16px; }
.brand-mark { width: 42px; height: 42px; }
.brand-mark::before { display: none; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-copy strong { font-size: 19px; }
.brand-copy small { font-size: 11px; }
.top { min-height: 72px; }
@media (max-width: 900px) {
  .layout { margin: 0; min-height: 100vh; height: auto; border: 0; border-radius: 0; overflow: visible; }
  .side { height: auto; min-height: auto; padding: 16px 14px 12px; }
  .brand { margin: 0 -14px; min-height: 86px; padding: 18px 26px 16px; }
  .nav { padding: 8px 0 2px; }
  .main { overflow: visible; }
  .top { min-height: 64px; }
}

/* Reference panel type scale: tighten the shell without changing page data. */
.side { width: clamp(252px, 18vw, 330px); flex-basis: clamp(252px, 18vw, 330px); }
.nav { padding-top: 14px; padding-bottom: 14px; }
.top h1 { font-size: 26px; }
.side-footer { padding: 12px 20px 14px; }
.side-status { font-size: 13px; }
.side-user { margin: 6px 0 8px; font-size: 12px; }
.side-manage, .side-logout { min-height: 34px; font-size: 13px; }
@media (max-width: 900px) {
  .side { width: 100%; flex-basis: auto; }
  .nav { padding-top: 8px; padding-bottom: 2px; }
}


/* Reference panel proportions: calibrated against the supplied Retina screenshots. */
@media (min-width: 1101px) {
  .layout {
    margin: 14px;
    min-height: calc(100vh - 28px);
    height: calc(100vh - 28px);
    border-radius: 12px;
  }
  .side {
    width: 252px;
    flex: 0 0 252px;
    min-width: 0;
    padding: 0 12px 10px;
  }
  .brand {
    min-height: 83px;
    margin: 0 -12px;
    padding: 16px 22px 15px;
    gap: 10px;
  }
  .brand-mark { width: 40px; height: 40px; }
  .brand-copy strong { font-size: 22px; line-height: 1.15; }
  .brand-copy small { font-size: 14px; margin-top: 3px; }
  .nav { padding: 18px 0; }
  .nav > a,
  .nav .nav-group-toggle {
    min-height: 42px;
    padding: 9px 12px;
    gap: 12px;
    font-size: 18px;
    line-height: 24px;
    border-radius: 8px;
  }
  .nav > a { margin-bottom: 4px; }
  .nav-group { margin-bottom: 2px; }
  .nav-submenu { margin: 2px 0 6px 24px; padding: 3px 0 3px 8px; }
  .nav .nav-subitem,
  .nav .nav-submenu .nav-subitem {
    min-height: 34px;
    margin-bottom: 2px;
    padding: 6px 12px;
    font-size: 14px;
    line-height: 21px;
  }
  .nav-icon { width: 18px; flex-basis: 18px; font-size: 17px; }
  .main { padding: 0 26px 44px; }
  .top {
    min-height: 72px;
    margin: 0 -26px 22px;
    padding: 0 28px;
  }
  .top h1 { font-size: 22px; line-height: 30px; }
  .side-footer {
    margin: 0 -12px;
    padding: 12px 20px 14px;
  }
  .side-status { font-size: 14px; }
  .side-user { margin: 6px 0 8px; font-size: 12px; }
  .side-manage, .side-logout { min-height: 33px; font-size: 13px; }
}

/* Keep common controls at the 38px reference height. */
input[type=text], input[type=password], select, textarea {
  min-height: 38px;
  padding: 8px 11px;
}
button, .btn { min-height: 38px; padding: 8px 15px; }
.btn, button, input[type=text], input[type=password], select, textarea { font-size: 16px; }
.table th { font-size: 14px; }
.card { border-radius: 12px; }

@media (max-width: 1100px) and (min-width: 901px) {
  .layout { margin: 14px; min-height: calc(100vh - 28px); height: calc(100vh - 28px); }
  .main { padding-left: 24px; padding-right: 24px; }
  .top { margin-left: -24px; margin-right: -24px; padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 900px) {
  .layout { margin: 0; min-height: 100vh; height: auto; border: 0; border-radius: 0; overflow: visible; }
  .side { width: 100%; flex-basis: auto; height: auto; min-height: auto; padding: 16px 14px 12px; }
  .brand { margin: 0 -14px; min-height: 83px; padding: 16px 22px 15px; }
  .nav { padding: 8px 0 2px; }
  .nav > a, .nav .nav-group-toggle { min-height: 42px; padding: 9px 12px; font-size: 16px; }
  .nav .nav-subitem { min-height: 34px; padding: 6px 12px; font-size: 14px; }
  .side-footer { margin: 0 -14px; }
  .main { padding: 22px 16px 40px; overflow: visible; }
  .top { min-height: 64px; margin: 0 0 24px; padding: 0; }
  .top h1 { font-size: 24px; line-height: 29px; }
}
@media (max-width: 600px) {
  .top h1 { font-size: 24px; line-height: 29px; }
  button, .btn { width: auto; }
}

/* Merchant API integration page. */
.api-integrations-page { min-width: 0; }
.api-page-intro,
.api-config-card,
.api-log-card { border-radius: 12px; }
.api-page-intro { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 22px; }
.api-page-intro h2,
.api-section-heading h2 { margin: 0; color: var(--text); font-size: 18px; line-height: 1.3; font-weight: 720; }
.api-page-intro p,
.api-section-heading p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.api-security-badge,
.api-status { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.api-security-badge { color: var(--accent); background: var(--accent-soft); }
.api-status.is-on { color: #168b52; background: #e9f8ef; }
.api-status.is-off { color: #7c8498; background: #f0f1f6; }
.api-alert { margin-bottom: 14px; padding: 12px 16px; font-size: 13px; }
.api-alert-error { border-color: #f0cbd0; background: #fff6f7; color: #c94e5c; }
.api-alert-ok { border-color: #c5ead6; background: #f1fbf5; color: #258454; }
.api-section-heading { display: flex; align-items: flex-end; justify-content: space-between; margin: 22px 0 12px; }
.api-config-card { padding: 20px 22px; }
.api-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.api-card-heading > div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.api-card-heading h3 { margin: 0; color: var(--text); font-size: 16px; font-weight: 720; }
.api-key-hint { color: var(--muted); font: 12px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.api-config-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; padding: 12px 14px; background: var(--panel-soft); border: 1px solid var(--line); border-radius: 9px; }
.api-config-summary span { min-width: 0; color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.api-config-summary b { display: block; margin-bottom: 3px; color: var(--text); font-size: 11px; font-weight: 650; }
.api-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.api-form-grid label { display: flex; flex-direction: column; gap: 6px; min-width: 0; color: var(--text); font-size: 13px; font-weight: 650; }
.api-form-grid input,
.api-form-grid select { width: 100%; min-width: 0; min-height: 38px; }
.api-form-grid small { min-height: 30px; color: var(--muted); font-size: 11px; line-height: 1.45; font-weight: 400; }
.api-form-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
.api-card-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.api-card-actions form { margin: 0; }
.api-card-actions button { min-height: 34px; padding: 7px 13px; font-size: 13px; }
.api-card-actions button.danger { background: #e76670; }
.api-new-card { margin-top: 16px; border-style: dashed; }
.api-empty { display: flex; flex-direction: column; gap: 5px; align-items: center; justify-content: center; min-height: 110px; color: var(--muted); text-align: center; }
.api-empty strong { color: var(--text); font-size: 15px; }
.api-empty-small { min-height: 90px; }
.api-log-heading { margin-top: 26px; }
.api-log-card { padding: 0; overflow: hidden; }
.api-log-scroll { width: 100%; overflow-x: auto; }
.api-log-table { min-width: 1050px; margin: 0; }
.api-log-table th,
.api-log-table td { padding: 11px 12px; vertical-align: top; white-space: nowrap; }
.api-log-table td:last-child { max-width: 280px; white-space: normal; overflow-wrap: anywhere; }
.api-log-table code { color: var(--accent); font-size: 11px; }
@media (max-width: 1100px) {
  .api-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .api-config-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .api-page-intro { align-items: flex-start; flex-direction: column; }
  .api-form-grid,
  .api-config-summary { grid-template-columns: 1fr; }
  .api-config-card { padding: 16px; }
  .api-card-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .api-card-actions { align-items: stretch; flex-direction: column; }
  .api-card-actions button { width: 100%; }
}

/* Chat-app data and downloadable records. */
.chat-apps-page { min-width: 0; }
.chat-apps-page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.chat-apps-page-header h2 { margin: 0; font-size: 22px; line-height: 1.25; font-weight: 720; }
.chat-apps-page-header p { margin: 6px 0 0; font-size: 13px; }
.chat-apps-view-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 10px; background: #f5f4fb; }
.chat-apps-view-tabs a { min-width: 86px; padding: 8px 14px; border-radius: 8px; color: var(--muted); font-size: 14px; font-weight: 650; text-align: center; text-decoration: none; }
.chat-apps-view-tabs a:hover, .chat-apps-view-tabs a.on { color: var(--accent); background: #fff; box-shadow: 0 5px 14px rgba(73,79,126,.10); text-decoration: none; }
.chat-apps-filter-bar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; padding: 16px 18px; }
.chat-apps-filter-bar label { display: flex; min-width: 150px; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12px; }
.chat-apps-filter-bar label span { padding-left: 2px; }
.chat-apps-filter-bar input, .chat-apps-filter-bar select { min-height: 38px; height: 38px; padding: 8px 10px; font-size: 13px; }
.chat-apps-filter-bar button { min-height: 38px; }
.chat-apps-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.chat-apps-stat-card { position: relative; min-height: 122px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; padding: 18px 20px 16px 24px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.chat-apps-stat-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--chat-app-color, var(--accent)); }
.chat-apps-stat-card span { color: var(--muted); font-size: 13px; }
.chat-apps-stat-card strong { color: var(--chat-app-number, var(--text)); font-size: 30px; line-height: 1; font-weight: 750; }
.chat-apps-stat-card small { color: #a2a9b8; font-size: 11px; line-height: 1.3; }
.chat-apps-stat-card.stat-purple { --chat-app-color: #a95bef; --chat-app-number: #8e49d9; }
.chat-apps-stat-card.stat-orange { --chat-app-color: #f3a01a; --chat-app-number: #d99512; }
.chat-apps-stat-card.stat-blue { --chat-app-color: #3d8bfd; --chat-app-number: #3d7fe0; }
.chat-apps-stat-card.stat-cyan { --chat-app-color: #35add8; --chat-app-number: #258daa; }
.chat-apps-table-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chat-apps-table-card { min-width: 0; padding: 20px 22px 14px; }
.chat-apps-table-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.chat-apps-table-heading h3 { margin: 0; font-size: 16px; line-height: 1.3; font-weight: 720; }
.chat-apps-table-heading span { font-size: 12px; }
.chat-apps-summary-table { width: 100%; min-width: 0; table-layout: fixed; }
.chat-apps-summary-table th:first-child, .chat-apps-summary-table td:first-child { width: 34%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.chat-apps-summary-table th:not(:first-child), .chat-apps-summary-table td:not(:first-child) { width: 16.5%; }
.chat-apps-summary-table th, .chat-apps-summary-table td { padding: 12px 10px; white-space: nowrap; }
.chat-apps-summary-table th:not(:first-child), .chat-apps-summary-table td:not(:first-child) { text-align: right; }
.chat-apps-empty-cell { padding: 48px 10px !important; color: #a2a9b8; text-align: center !important; }
.chat-apps-download-form { min-width: 0; }
.chat-apps-download-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 18px; }
.chat-apps-download-status { display: inline-flex; gap: 4px; padding: 4px; border-radius: 10px; background: #f5f4fb; }
.chat-apps-download-status a { min-width: 98px; padding: 8px 12px; border-radius: 8px; color: var(--muted); font-size: 13px; text-align: center; text-decoration: none; }
.chat-apps-download-status a:hover, .chat-apps-download-status a.on { color: var(--accent); background: #fff; box-shadow: 0 5px 14px rgba(73,79,126,.10); text-decoration: none; }
.chat-apps-download-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.chat-apps-download-actions .muted { margin-right: 4px; font-size: 12px; }
.chat-apps-download-actions b { color: var(--text); }
.chat-apps-record-card { padding: 18px 18px 16px; }
.chat-apps-record-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.chat-apps-record-heading h3 { margin: 0; font-size: 17px; }
.chat-apps-record-heading p { margin: 5px 0 0; font-size: 12px; }
.chat-apps-record-heading > span { padding-top: 3px; font-size: 12px; }
.chat-apps-record-table { min-width: 980px; }
.chat-apps-record-table th, .chat-apps-record-table td { padding: 12px 10px; vertical-align: middle; }
.chat-apps-record-table code { overflow-wrap: anywhere; }
.chat-check-cell { width: 42px !important; text-align: center !important; }
.chat-check-cell input { width: 16px; height: 16px; accent-color: var(--accent); }
.chat-apps-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; font-size: 12px; }
.chat-apps-pagination .btn { margin-left: 6px; }
.chat-apps-empty-state { display: grid; min-height: 220px; place-items: center; color: #a2a9b8; font-size: 13px; }
@media (max-width: 1100px) { .chat-apps-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .chat-apps-page-header { align-items: flex-start; flex-direction: column; }.chat-apps-filter-bar { align-items: stretch; }.chat-apps-filter-bar label, .chat-apps-filter-bar input, .chat-apps-filter-bar select, .chat-apps-filter-bar button { width: 100%; }.chat-apps-table-grid { grid-template-columns: 1fr; }.chat-apps-summary-table { min-width: 560px; table-layout: auto; }.chat-apps-download-toolbar { align-items: flex-start; flex-direction: column; }.chat-apps-download-actions { justify-content: flex-start; } }
@media (max-width: 480px) { .chat-apps-stat-grid { grid-template-columns: 1fr; gap: 12px; }.chat-apps-stat-card { min-height: 116px; padding: 16px 18px 14px 22px; }.chat-apps-view-tabs { width: 100%; }.chat-apps-view-tabs a { flex: 1; }.chat-apps-download-status { width: 100%; }.chat-apps-download-status a { flex: 1; min-width: 0; padding-left: 6px; padding-right: 6px; } }


/* Reference panel typography calibration: Inter scale, weights and control sizes. */
@media (min-width: 901px) {
  body {
    font: 16px/normal Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
    font-synthesis: none;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  .brand {
    min-height: 82px;
    padding: 24px 22px 20px;
  }
  .brand-mark { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 8px; }
  .brand-copy strong { font-size: 17px; line-height: normal; font-weight: 750; letter-spacing: 0; }
  .brand-copy small { font-size: 10px; line-height: normal; font-weight: 400; letter-spacing: .12em; margin-top: 2px; }

  .nav { padding: 16px 0; }
  .nav > a,
  .nav .nav-group-toggle {
    min-height: 42px;
    margin: 2px 0;
    padding: 10px 12px;
    gap: 10px;
    border-radius: 7px;
    font-size: 14px;
    line-height: normal;
    font-weight: 400;
  }
  .nav > a.on,
  .nav-group.is-current > .nav-group-toggle,
  .nav-group.is-open > .nav-group-toggle { font-weight: 600; }
  .nav-icon { width: 18px; flex-basis: 18px; font-size: 18px; }
  .nav-submenu { margin: 2px 0 6px 24px; padding: 3px 0 3px 8px; }
  .nav .nav-subitem,
  .nav .nav-submenu .nav-subitem {
    min-height: 34px;
    margin: 2px 0;
    padding: 7px 12px;
    font-size: 13px;
    line-height: normal;
    font-weight: 400;
  }
  .nav .nav-subitem.on { font-weight: 600; }

  .side-footer {
    padding: 16px 20px;
    background: #fcfcff;
    font-size: 11px;
  }
  .side-status { font-size: 11px; line-height: normal; }
  .side-user { margin: 6px 0 8px; font-size: 11px; line-height: normal; }
  .side-manage, .side-logout {
    min-height: 33px;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
  }

  .main { padding: 0 24px 30px; }
  .top {
    min-height: 72px;
    margin: 0 -24px 22px;
    padding: 0 28px;
  }
  .top h1 { font-size: 18px; line-height: normal; font-weight: 740; letter-spacing: 0; }

  .card { border-radius: 8px; padding: 20px; }
  input[type=text], input[type=password], select, textarea {
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 12px;
    line-height: normal;
  }
  button, .btn {
    min-height: 38px;
    padding: 9px 20px;
    border-radius: 6px;
    font-size: 13px;
    line-height: normal;
    font-weight: 500;
  }

  .table { font-size: 12px; }
  .table th { padding: 7px 6px; font-size: 11px; font-weight: 600; }
  .table td { padding: 6px; }
  .devices-table th, .devices-table td { padding: 6px; }
  .devices-table th { font-size: 11px; font-weight: 600; }
  .devices-table td { font-size: 12px; }
  .badge { padding: 2px 7px; border-radius: 5px; font-size: 10px; font-weight: 600; }

  .stats-card {
    min-height: 122px;
    padding: 18px;
    border-radius: 8px;
  }
  .stats-label { font-size: 11px; letter-spacing: .06em; }
  .stats-card strong { font-size: 28px; font-weight: 750; }
  .stats-note { font-size: 12px; line-height: 1.45; }
  .stats-panel { padding: 20px; border-radius: 8px; }
  .stats-panel h3 { font-size: 15px; font-weight: 730; }
  .stats-panel > p { font-size: 12px; }
  .stats-range { padding: 4px; border-radius: 7px; }
  .stats-range button { min-height: 27px; padding: 4px 12px; border-radius: 6px; font-size: 12px; }
  .section-action { min-height: 92px; padding: 18px; border-radius: 8px; }
  .section-action-label { font-size: 15px; font-weight: 650; }
}

/* Unified admin surface: visual-only normalization shared by every panel. */
:root {
  --ui-space-1: 6px;
  --ui-space-2: 10px;
  --ui-space-3: 14px;
  --ui-space-4: 18px;
  --ui-space-5: 24px;
  --ui-radius-sm: 7px;
  --ui-radius-md: 10px;
  --ui-radius-lg: 12px;
  --ui-control-h: 38px;
  --ui-focus: 0 0 0 3px rgba(107, 99, 246, .16);
}

html,
body {
  font: 14px/1.5 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { color: var(--text); }
a { color: var(--accent); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(107, 99, 246, .2);
  outline-offset: 2px;
}

.layout {
  border-color: rgba(217, 221, 236, .92);
  box-shadow: 0 12px 38px rgba(73, 79, 126, .09);
}
.side { background: #fff; }
.brand { border-bottom-color: var(--line); }
.brand-copy strong { color: var(--text); }
.nav { scrollbar-color: #d9ddec transparent; }
.nav > a,
.nav .nav-group-toggle {
  min-height: 42px;
  color: #69738b;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 500;
}
.nav > a:hover,
.nav > a.on,
.nav .nav-group-toggle:hover,
.nav-group.is-current > .nav-group-toggle,
.nav-group.is-open > .nav-group-toggle {
  color: var(--accent);
  background: var(--accent-soft);
}
.nav .nav-subitem,
.nav .nav-submenu .nav-subitem {
  min-height: 34px;
  color: #7b8498;
  font-size: 13px;
  line-height: 1.35;
}
.nav .nav-subitem:hover,
.nav .nav-subitem.on { color: var(--accent); background: #f5f3ff; }
.nav-icon { color: currentColor; }
.side-footer { background: #fcfcff; }
.side-manage,
.side-logout { transition: border-color .15s ease, color .15s ease, background-color .15s ease, box-shadow .15s ease; }
.side-manage:hover,
.side-logout:hover { box-shadow: 0 4px 12px rgba(73, 79, 126, .08); }

.main { min-width: 0; }
.top { border-bottom-color: var(--line); }
.top h1 { color: var(--text); font-size: 20px; font-weight: 720; }
.top-right { min-width: 0; }
.muted { color: var(--muted); }

.card,
.stats-panel,
.dashboard-stat-card,
.dashboard-chart-card,
.section-action {
  border-color: var(--line);
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--shadow);
}
.card { padding: 20px; margin-bottom: 16px; }
.card > h2,
.card > h3,
.stats-panel h3 {
  color: var(--text);
  line-height: 1.35;
  font-weight: 700;
}
.card > h2 { margin: 0 0 14px; font-size: 18px; }
.card > h3 { margin: 0 0 12px; font-size: 15px; }
.card > p { color: var(--muted); }
.card > p:first-child { margin-top: 0; }
.card code,
.table code { color: #6672c8; }

input[type=text],
input[type=password],
input[type=email],
input[type=number],
select,
textarea {
  min-height: var(--ui-control-h);
  padding: 8px 11px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--ui-radius-sm);
  font-size: 14px;
  line-height: 1.35;
  box-shadow: 0 2px 6px rgba(73, 79, 126, .03);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
textarea { min-height: 92px; }
input::placeholder,
textarea::placeholder { color: #aab1c2; }
input:hover,
select:hover,
textarea:hover { border-color: #c6cbe0; }
input:focus,
select:focus,
textarea:focus { border-color: var(--accent); box-shadow: var(--ui-focus); outline: 0; }
input[type=checkbox] { accent-color: var(--accent); }

button,
.btn {
  min-height: var(--ui-control-h);
  padding: 8px 15px;
  border-radius: var(--ui-radius-sm);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 650;
  box-shadow: none;
}
button:hover,
.btn:hover { box-shadow: 0 6px 14px rgba(107, 99, 246, .16); }
button:disabled,
.btn:disabled,
button[aria-disabled="true"],
.btn[aria-disabled="true"] {
  opacity: .55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
button.ghost,
.btn.ghost { color: #68728b; background: #fff; border-color: var(--line-strong); }
button.ghost:hover,
.btn.ghost:hover { color: var(--accent); background: var(--accent-soft); border-color: #c8c3ff; }
button.danger,
.btn.danger { background: var(--danger); }

.row { gap: 10px 12px; }
.devices-filter,
.stats-toolbar { align-items: center; }
.devices-filter-card { padding: 18px 20px; }
.devices-filter input[name=q] { width: min(280px, 100%); }
.devices-filter select { min-width: 140px; }
.devices-filter button { min-width: 74px; }

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eceef5;
  vertical-align: middle;
  line-height: 1.45;
}
.table th {
  color: #7d879a;
  background: #fafaff;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .01em;
}
.table th:first-child { border-radius: 8px 0 0 8px; }
.table th:last-child { border-radius: 0 8px 8px 0; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fafaff; }
.table td code { overflow-wrap: anywhere; word-break: break-word; }
.table .btn,
.table button { min-height: 30px; padding: 5px 10px; font-size: 12px; }
.badge { padding: 3px 8px; border-radius: 999px; font-size: 11px; line-height: 1.25; }
.pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 16px; }
.pager a { margin: 0; }
.pagination { gap: 5px; margin-top: 16px; }
.pagination li a,
.pagination li span { min-width: 30px; padding: 6px 9px; text-align: center; }

.tabs { gap: 8px; margin-bottom: 16px; }
.tabs a { padding: 9px 13px; border-radius: var(--ui-radius-sm); font-size: 13px; font-weight: 550; }
.tabs a.on { box-shadow: 0 6px 14px rgba(107, 99, 246, .16); }
.kv { grid-template-columns: 132px minmax(0, 1fr); gap: 10px 16px; font-size: 14px; }
.kv b { color: #8891a3; font-weight: 600; }
.secret,
.wallet-pair,
.wallet-fold,
.note-item,
.note-row-tg,
.photo-item { border-color: var(--line); border-radius: var(--ui-radius-md); }
.wallet-fold summary { min-height: 42px; padding: 10px 13px; font-size: 13px; }
.note-row-tg { padding: 11px 13px; }
.note-row-main { font-size: 13px; }
.note-row-meta .btn.ghost { min-height: 30px; }
.pre,
.swal-json,
.promo-iframe-snippet { border-color: var(--line); border-radius: var(--ui-radius-sm); }
.pre { font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.photo-list,
.photos { gap: 14px; }
.photo-item img { height: 154px; }
.photos img { height: 144px; }
.photo-meta { padding: 10px 12px 12px; }

.stats-cards { gap: 16px; margin-bottom: 20px; }
.stats-card {
  min-height: 120px;
  padding: 16px 18px 14px 20px;
  border-radius: var(--ui-radius-lg);
}
.stats-label { font-size: 12px; line-height: 1.35; }
.stats-card strong { font-size: 30px; line-height: 1; }
.stats-note { font-size: 11px; line-height: 1.35; }
.access-stats-heading { align-items: center; margin-bottom: 16px; }
.access-stats-heading p { margin: 0; font-size: 13px; }
.stats-toolbar { margin: 0 0 16px; }
.stats-toolbar label,
.stats-country-select { font-size: 13px; }
.stats-range { gap: 4px; padding: 4px; background: #f8f7fd; }
.stats-range button { min-height: 32px; padding: 6px 11px; border-radius: 7px; font-size: 12px; }
.stats-range button:hover,
.stats-range button.active { box-shadow: 0 5px 14px rgba(73, 79, 126, .1); }
.stats-grid-main { gap: 16px; margin-bottom: 20px; }
.stats-panel { padding: 20px; }
.stats-panel h3 { margin-bottom: 6px; font-size: 15px; }
.stats-panel > p { margin: 4px 0 16px; font-size: 12px; }
.stats-map-placeholder { min-height: 230px; border-radius: var(--ui-radius-md); }
.stats-map-placeholder span { font-size: 14px; }
.stats-rank-panel { min-height: 300px; }
.stats-rank-line { padding: 11px 0; font-size: 13px; }
.stats-rank-line b { font-size: 14px; }
.stats-panel-heading { gap: 12px; }
.stats-table-wrap { margin-top: 16px; }
.stats-table th,
.stats-table td { padding: 10px 11px; font-size: 13px; }

.section-actions { gap: 14px; max-width: 920px; }
.section-action { min-height: 92px; padding: 18px 20px; }
.section-action-label { font-size: 15px; }
.section-action-arrow { font-size: 20px; }

/* Keep long tables usable without changing their markup or data bindings. */
.card:has(> table.table),
.card:has(> form > table.table),
.card:has(> .table-wrap) { overflow-x: auto; }
.table-wrap { width: 100%; overflow-x: auto; }
.card:has(> table.table) > table.table,
.card:has(> form > table.table) > form > table.table { min-width: 680px; }

@media (min-width: 1201px) {
  .main { padding-left: 26px; padding-right: 26px; }
  .top { margin-left: -26px; margin-right: -26px; padding-left: 28px; padding-right: 28px; }
}
@media (max-width: 1200px) and (min-width: 901px) {
  .stats-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats-card { min-height: 116px; }
  .main { padding-left: 22px; padding-right: 22px; }
  .top { margin-left: -22px; margin-right: -22px; padding-left: 24px; padding-right: 24px; }
}
@media (max-width: 900px) {
  .layout { margin: 0; border-radius: 0; }
  .main { padding: 20px 16px 36px; }
  .top { min-height: 58px; margin: 0 0 18px; }
  .top h1 { font-size: 20px; }
  .card { padding: 18px; }
  .stats-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats-grid-main { grid-template-columns: 1fr; }
  .stats-panel { padding: 18px; }
  .access-stats-heading { align-items: flex-start; }
  .access-stats-heading > div:last-child { width: 100%; }
  .stats-range { width: 100%; overflow-x: auto; }
  .stats-range button { flex: 1 0 auto; }
  .table th,
  .table td { padding: 9px 10px; }
}
@media (max-width: 600px) {
  .top { align-items: flex-start; flex-direction: column; }
  .top-right { width: 100%; justify-content: flex-start; }
  .card { padding: 16px; border-radius: var(--ui-radius-md); }
  .row { align-items: stretch; }
  .row > input,
  .row > select,
  .row > textarea { width: 100%; }
  .devices-filter input[name=q],
  .devices-filter select,
  .devices-filter button { width: 100%; min-width: 0; }
  .stats-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stats-card { min-height: 112px; padding: 14px 15px 13px 18px; }
  .stats-card strong { font-size: 27px; }
  .stats-grid-main { gap: 12px; }
  .stats-panel-heading { flex-direction: column; }
  .stats-country-select { width: 100%; justify-content: space-between; }
  .stats-country-select select { min-width: 0; flex: 1; }
  .stats-map-placeholder { min-height: 190px; }
  .section-actions { grid-template-columns: 1fr; }
  .cmd-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 3px; }
  .kv b { margin-top: 8px; }
  .card:has(> table.table),
  .card:has(> form > table.table) { margin-left: 0; margin-right: 0; }
  .card:has(> table.table) > table.table,
  .card:has(> form > table.table) > form > table.table { min-width: 680px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Promotion and channel management: keep controls aligned with the dashboard shell. */
.promo-page,
.channels-page { min-width: 0; }
.promo-config-card,
.channel-create-card,
.promo-links-card,
.channel-links-card { overflow: hidden; }
.promo-feedback,
.channel-feedback { margin: 0 0 14px; padding: 10px 12px; border-radius: var(--ui-radius-sm); background: var(--panel-soft); }
.promo-delivery-summary {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 9px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.promo-delivery-summary code { color: #6672c8; overflow-wrap: anywhere; }
.promo-summary-label { color: var(--text); font-weight: 700; }
.promo-summary-separator { color: #c4c8d7; }
.promo-summary-error { margin: 0; font-size: 13px; }
.promo-domain-form,
.channel-create-form {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.promo-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.promo-field label { font-size: 13px; line-height: 1.35; }
.promo-field input { width: 100%; }
.promo-domain-field { flex: 1 1 420px; max-width: 620px; }
.promo-form-actions,
.channel-create-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
}
.promo-seed-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px 24px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.promo-seed-fields { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(260px, .9fr); gap: 24px; min-width: 0; }
.promo-seed-input { font-family: ui-monospace, Menlo, Consolas, monospace; }
.promo-host-list { min-width: 0; color: var(--text); font-size: 13px; line-height: 1.5; }
.promo-host-list p { margin: 0 0 7px; }
.promo-host-list code { overflow-wrap: anywhere; color: #6672c8; }
.promo-host-intro { margin-bottom: 9px !important; }
.promo-host-label { display: inline-block; min-width: 112px; color: var(--muted); }
.promo-seed-actions { align-self: end; flex-wrap: wrap; }
.promo-links-card,
.channel-links-card { margin-top: 16px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.section-heading h3 { margin: 0 0 5px; color: var(--text); font-size: 16px; line-height: 1.35; font-weight: 700; }
.section-heading p { margin: 0; font-size: 13px; }
.promo-table-wrap,
.channel-table-wrap { width: 100%; overflow-x: auto; }
.promo-table { min-width: 980px; }
.promo-table th,
.promo-table td { vertical-align: middle; }
.promo-table th:nth-child(1) { width: 150px; }
.promo-table th:nth-child(2) { width: 130px; }
.promo-table th:nth-child(3) { width: auto; }
.promo-table th:nth-child(4) { width: 340px; }
.promo-actions-header,
.channel-actions-header { text-align: right !important; }
.promo-url-list { display: grid; gap: 5px; min-width: 0; }
.promo-url { display: block; color: #6672c8; overflow-wrap: anywhere; word-break: break-word; }
.promo-actions-cell { text-align: right !important; }
.promo-link-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.promo-iframe-wrap { margin-top: 10px; max-width: 560px; }
.promo-iframe-wrap .btn-copy-iframe { margin-top: 8px; }
.channel-create-heading h3 { margin: 0 0 5px; color: var(--text); font-size: 16px; line-height: 1.35; }
.channel-create-heading p { margin: 0; font-size: 13px; }
.channel-create-fields { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 16px; flex: 1 1 auto; min-width: 0; }
.channel-links-card .section-heading { margin-bottom: 14px; }
.channel-table { min-width: 900px; }
.channel-table th,
.channel-table td { vertical-align: middle; }
.channel-table th:nth-child(1) { width: 105px; }
.channel-table th:nth-child(2) { width: 80px; }
.channel-table th:nth-child(3) { width: 200px; }
.channel-table th:nth-child(4) { width: 160px; }
.channel-table th:nth-child(5) { width: 170px; }
.channel-table th:nth-child(6) { width: 130px; }
.channel-link-cell { min-width: 190px; }
.channel-link-cell .btn-copy-link { margin-top: 7px; }
.channel-source-form { display: block; min-width: 190px; }
.channel-source-form input,
.channel-table td > input { width: 100%; min-width: 0; }
.channel-actions-cell { text-align: right !important; white-space: nowrap; }
.channel-actions-cell > button { margin-left: 4px; }
.channel-delete-note { display: block; margin-top: 7px; font-size: 11px; }
.channel-empty { margin: 14px 0 0; }
@media (max-width: 900px) {
  .promo-domain-form,
  .channel-create-form { align-items: stretch; flex-direction: column; }
  .promo-domain-field { max-width: none; }
  .promo-form-actions,
  .channel-create-actions { width: 100%; margin-left: 0; justify-content: flex-end; }
  .promo-seed-form { grid-template-columns: 1fr; }
  .promo-seed-actions { justify-content: flex-end; }
}
@media (max-width: 600px) {
  .promo-seed-fields,
  .channel-create-fields { grid-template-columns: 1fr; gap: 14px; }
  .promo-form-actions,
  .channel-create-actions,
  .promo-seed-actions { flex-wrap: wrap; }
  .promo-form-actions button,
  .channel-create-actions button { width: auto; }
}

/* Reference panel scale calibration: geometry only, no content or behavior changes. */
:root {
  --ref-page-bg: #f2f3fa;
  --ref-ink: #171a2b;
  --ref-muted: #969aaa;
  --ref-border: rgba(28, 31, 54, .07);
  --ref-sidebar: 252px;
  --ref-shell-gap: 18px;
  --ref-control-height: 38px;
}

html,
body {
  font: 16px/normal Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  padding: var(--ref-shell-gap);
  background: var(--ref-page-bg);
  color: var(--ref-ink);
}
body.login-page { padding: 0; }

.layout {
  margin: 0;
  min-height: calc(100vh - (var(--ref-shell-gap) * 2));
  height: calc(100vh - (var(--ref-shell-gap) * 2));
  border: 1px solid var(--ref-border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 12px 40px rgba(73, 79, 126, .08);
}

.side {
  width: var(--ref-sidebar);
  flex: 0 0 var(--ref-sidebar);
  min-height: 0;
  height: 100%;
  padding: 0;
  background: #fff;
}

.brand {
  min-height: 83px;
  margin: 0;
  padding: 24px 22px 20px;
  gap: 10px;
}
.brand-mark { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 8px; }
.brand-copy strong { font-size: 17px; line-height: normal; font-weight: 750; }
.brand-copy small { font-size: 10px; line-height: normal; margin-top: 2px; }

.nav {
  padding: 16px 12px;
  overflow-y: auto;
}
.nav > a,
.nav .nav-group-toggle {
  min-height: 42px;
  margin: 2px 0;
  padding: 10px 12px;
  gap: 10px;
  border-radius: 7px;
  font-size: 14px;
  line-height: normal;
  font-weight: 400;
}
.nav > a.on,
.nav-group.is-current > .nav-group-toggle,
.nav-group.is-open > .nav-group-toggle { font-weight: 600; }
.nav > a.on::before,
.nav-group.is-current > .nav-group-toggle::before {
  left: -12px;
  width: 2px;
  top: 10px;
  bottom: 10px;
}
.nav-icon { width: 18px; flex-basis: 18px; font-size: 18px; }
.nav-group { margin-bottom: 2px; }
.nav-submenu { margin: 2px 0 6px 24px; padding: 3px 0 3px 8px; }
.nav .nav-subitem,
.nav .nav-submenu .nav-subitem {
  min-height: 34px;
  margin: 2px 0;
  padding: 7px 12px;
  font-size: 13px;
  line-height: normal;
  font-weight: 400;
}
.nav .nav-subitem.on { font-weight: 600; }

.side-footer {
  margin: 0;
  padding: 16px 20px;
  background: #fcfcff;
  font-size: 11px;
}
.side-status { font-size: 11px; line-height: normal; }
.side-user { margin: 6px 0 8px; font-size: 11px; line-height: normal; }
.side-manage,
.side-logout {
  min-height: 33px;
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}

.main { padding: 0 24px 30px; }
.top {
  min-height: 72px;
  margin: 0 -24px 22px;
  padding: 0 28px;
}
.top h1 { font-size: 18px; line-height: normal; font-weight: 740; }

.card,
.stats-panel,
.dashboard-stat-card,
.dashboard-chart-card,
.section-action {
  border-color: var(--ref-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(73, 79, 126, .07);
}
.card { padding: 20px; margin-bottom: 16px; }
.card > h2 { margin: 0 0 14px; font-size: 16px; line-height: 1.35; }
.card > h3 { margin: 0 0 12px; font-size: 15px; line-height: 1.35; }

input[type=text],
input[type=password],
input[type=email],
input[type=number],
select,
textarea {
  min-height: var(--ref-control-height);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: normal;
}
textarea { min-height: 92px; }
button,
.btn {
  min-height: var(--ref-control-height);
  padding: 9px 20px;
  border-radius: 6px;
  font-size: 13px;
  line-height: normal;
  font-weight: 500;
}

.table { font-size: 12px; }
.table th { padding: 7px 6px; font-size: 11px; font-weight: 600; }
.table td { padding: 6px; }
.table .btn,
.table button { min-height: 30px; padding: 5px 10px; font-size: 12px; }
.badge { padding: 2px 7px; border-radius: 5px; font-size: 10px; font-weight: 600; }
.pager { gap: 5px; margin-top: 16px; }
.pagination li a,
.pagination li span { min-width: 30px; padding: 6px 9px; }
.tabs { gap: 8px; margin-bottom: 16px; }
.tabs a { padding: 8px 12px; border-radius: 6px; font-size: 12px; }
.kv { grid-template-columns: 132px minmax(0, 1fr); gap: 10px 16px; font-size: 13px; }
.pre,
.swal-json,
.promo-iframe-snippet { border-radius: 6px; }
.pre { font-size: 12px; line-height: 1.55; }

.devices-filter-card { padding: 20px; }
.devices-table-card { padding: 12px 16px 16px; }
.devices-table th,
.devices-table td { padding: 7px 8px; }
.photo-list,
.photos { gap: 12px; }
.photo-item img { height: 144px; }
.photos img { height: 136px; }
.photo-meta { padding: 9px 10px 10px; }
.swal2-popup.adm-swal { border-radius: 8px; }
.swal2-popup.adm-swal .swal2-title { font-size: 16px; }
.swal2-popup.adm-swal .swal2-html-container { font-size: 12px; }

/* Dashboard uses the reference panel's 4-column / 2-column geometry. */
.dashboard-page .dashboard-stat-grid { column-gap: 12px; row-gap: 16px; margin-bottom: 16px; }
.dashboard-page .dashboard-stat-card {
  min-height: 122px;
  padding: 18px;
  border-radius: 8px;
}
.dashboard-page .dashboard-stat-label { font-size: 11px; line-height: normal; }
.dashboard-page .dashboard-stat-value { font-size: 25px; line-height: 1; }
.dashboard-page .dashboard-stat-value-split { gap: 8px; }
.dashboard-page .dashboard-stat-value-split i { font-size: 21px; }
.dashboard-page .dashboard-stat-note { margin-top: 6px; font-size: 12px; line-height: 1.45; }
.dashboard-page .dashboard-trends-heading {
  min-height: 94px;
  margin-bottom: 16px;
  padding: 20px 20px 16px;
  border-radius: 8px;
}
.dashboard-page .dashboard-trends-heading h2 { font-size: 15px; font-weight: 730; }
.dashboard-page .dashboard-trend-title { gap: 10px; }
.dashboard-page .dashboard-trend-switch { gap: 4px; }
.dashboard-page .dashboard-trend-switch button {
  min-width: 38px;
  min-height: 27px;
  height: 27px;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.dashboard-page .dashboard-trend-legend { gap: 16px; font-size: 12px; }
.dashboard-page .dashboard-chart-grid { gap: 16px; }
.dashboard-page .dashboard-chart-card {
  min-height: 254.5px;
  padding: 18px;
  border-radius: 8px;
}
.dashboard-page .dashboard-chart-heading { margin-bottom: 8px; }
.dashboard-page .dashboard-chart-heading h3 { margin-bottom: 0; font-size: 13px; font-weight: 730; }
.dashboard-page .dashboard-chart-heading span:not(.dashboard-chart-key),
.dashboard-page .dashboard-chart-range { font-size: 11px; }
.dashboard-page .dashboard-chart-heading strong { font-size: 14px; }
.dashboard-page .dashboard-chart { height: 140px; }
.dashboard-page .dashboard-chart-labels {
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  min-height: 18px;
  margin: 0;
  padding: 4px 2px 0;
  font-size: 10px;
}

/* Access statistics keeps the latest filters and async content, only changing scale. */
.stats-cards { gap: 12px; margin-bottom: 16px; }
.stats-card { min-height: 122px; padding: 18px; border-radius: 8px; }
.stats-label { font-size: 11px; line-height: normal; margin-bottom: 8px; }
.stats-card strong { font-size: 25px; line-height: 1; }
.stats-note { margin-top: 6px; font-size: 12px; line-height: 1.45; }
.access-stats-heading { margin-bottom: 16px; }
.access-stats-heading h2 { font-size: 18px; }
.access-stats-heading p { font-size: 12px; }
.stats-toolbar { margin-bottom: 16px; }
.stats-toolbar label,
.stats-country-select { font-size: 12px; }
.stats-range { gap: 4px; padding: 0; background: transparent; }
.stats-range button { min-height: 27px; padding: 4px 12px; border-radius: 6px; font-size: 12px; }
.stats-grid-main { gap: 16px; margin-bottom: 16px; }
.stats-panel { padding: 20px; border-radius: 8px; }
.stats-panel h3 { margin-bottom: 6px; font-size: 15px; }
.stats-panel > p { margin: 4px 0 16px; font-size: 12px; }
.stats-table th,
.stats-table td { padding: 8px 10px; font-size: 12px; }

.section-actions { gap: 12px; }
.section-action { min-height: 92px; padding: 18px 20px; }
.section-action-label { font-size: 15px; }
.section-action-arrow { font-size: 18px; }
.promo-domain-form,
.channel-create-form { gap: 12px; margin-top: 16px; padding-top: 16px; }
.promo-field { gap: 6px; }
.promo-field label { font-size: 12px; }
.promo-form-actions,
.channel-create-actions { gap: 6px; }
.promo-seed-form { gap: 16px 20px; margin-top: 18px; padding-top: 18px; }
.promo-seed-fields { gap: 18px; }
.section-heading { gap: 16px; margin-bottom: 14px; }
.section-heading h3,
.channel-create-heading h3 { font-size: 15px; }
.section-heading p,
.channel-create-heading p { font-size: 12px; }
.promo-table,
.channel-table { font-size: 12px; }
.promo-table th,
.channel-table th { font-size: 11px; }

@media (min-width: 901px) {
  .layout { margin: 0; }
}

@media (max-width: 1200px) and (min-width: 901px) {
  body { padding: 14px; }
  .layout { min-height: calc(100vh - 28px); height: calc(100vh - 28px); }
  .main { padding-left: 22px; padding-right: 22px; }
  .top { margin-left: -22px; margin-right: -22px; padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 900px) {
  body { padding: 0; }
  .layout { display: flex; min-height: 100vh; height: auto; border: 0; border-radius: 0; overflow: visible; align-items: stretch; }
  .side {
    width: 58px;
    flex: 0 0 58px;
    height: 100vh;
    min-height: 100vh;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 20;
  }
  .brand {
    min-height: 64px;
    padding: 13px 9px;
    justify-content: center;
  }
  .brand-copy { display: none; }
  .brand-mark { width: 38px; height: 38px; }
  .nav { padding: 8px 8px; overflow: visible; }
  .nav > a,
  .nav .nav-group-toggle {
    width: 42px;
    min-height: 46px;
    margin: 2px 0;
    padding: 12px 8px;
    justify-content: center;
    border-radius: 7px;
  }
  .nav > a > span:not(.nav-icon),
  .nav .nav-group-toggle > span:not(.nav-icon) { display: none; }
  .nav-icon { width: 18px; flex-basis: 18px; font-size: 17px; }
  .nav > a.on::before,
  .nav-group.is-current > .nav-group-toggle::before { left: -8px; top: 12px; bottom: 12px; width: 2px; }
  .nav-group { position: relative; }
  .nav-group.is-open > .nav-submenu {
    position: absolute;
    left: 48px;
    top: 0;
    z-index: 30;
    width: 176px;
    margin: 0;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(73, 79, 126, .14);
  }
  .nav-group.is-open > .nav-submenu .nav-subitem { width: 100%; }
  .side-footer { padding: 16px 8px; }
  .side-status { justify-content: center; }
  .side-status > span:not(.side-status-dot),
  .side-user { display: none; }
  .side-manage,
  .side-logout {
    width: 42px;
    min-height: 42px;
    padding: 6px 3px;
    font-size: 10px;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
  }
  .main { flex: 1 1 auto; min-width: 0; margin-left: 1px; margin-right: 1px; padding: 0 12px 30px; border-left: 0; overflow: visible; }
  .top { min-height: 62px; margin: 1px -12px 12px; padding: 0 14px; }
  .top h1 { font-size: 16px; line-height: normal; }
  .card { padding: 18px; border-radius: 8px; }
  .dashboard-page .dashboard-trends-heading { min-height: 120px; padding: 20px 20px 14px; }
  .dashboard-page .dashboard-chart-grid { grid-template-columns: 1fr; gap: 16px; }
  .dashboard-page .dashboard-chart-card { min-height: 240px; }
  .stats-panel { padding: 18px; }
}

@media (max-width: 600px) {
  .dashboard-page .dashboard-stat-grid { grid-template-columns: 1fr; gap: 12px; margin-bottom: 20px; }
  .dashboard-page .dashboard-stat-card { min-height: 122px; padding: 18px; }
  .dashboard-page .dashboard-stat-value { font-size: 25px; }
  .stats-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stats-card { min-height: 122px; padding: 18px; }
  .promo-domain-form,
  .channel-create-form { gap: 12px; }
}

/* TG robot API configuration: saved records stay compact until edited. */
.api-config-heading { align-items: center; }
.api-config-heading .api-new-toggle,
.api-new-toggle { min-height: 38px; padding: 8px 16px; border-radius: 8px; font-size: 13px; }
.api-config-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 54px; }
.api-config-bar-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.api-config-bar-main h3 { margin: 0; color: var(--text); font-size: 16px; font-weight: 720; overflow-wrap: anywhere; }
.api-config-bar-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.api-config-bar-actions form { margin: 0; }
.api-config-bar-actions button,
.api-edit-toggle { min-height: 32px; padding: 6px 11px; font-size: 12px; }
.api-edit-toggle { color: var(--accent); background: var(--accent-soft); border: 1px solid transparent; cursor: pointer; }
.api-edit-toggle:hover { color: #fff; background: var(--accent); }
.api-bar-scope { max-width: 190px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.api-config-editor { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.api-config-editor[hidden],
.api-new-card[hidden],
[data-api-target-wrap][hidden] { display: none !important; }
.api-new-card { margin-top: 16px; }
.api-new-card .api-card-heading { margin-bottom: 16px; }
.api-form-actions { gap: 8px; }
.api-form-actions .ghost { color: var(--muted); background: #fff; border: 1px solid var(--line-strong); box-shadow: none; }
.api-form-actions .ghost:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.api-log-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.api-log-panel { min-width: 0; padding: 0; overflow: hidden; }
.api-log-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.api-log-panel-heading h3 { margin: 0; color: var(--text); font-size: 15px; font-weight: 720; }
.api-log-panel-heading span { color: var(--muted); font-size: 11px; }
.api-error-log-panel .api-log-panel-heading { background: #fff9fa; }
.api-error-log-panel .api-log-panel-heading h3 { color: #c94e5c; }
.api-log-panel .api-empty { margin: 0 18px; }
@media (max-width: 760px) {
  .api-config-bar { align-items: flex-start; flex-direction: column; }
  .api-config-bar-actions { width: 100%; justify-content: flex-start; }
  .api-bar-scope { max-width: none; flex: 1 1 100%; }
  .api-log-columns { grid-template-columns: 1fr; }
}

/* In-page review and manual report for suspected mnemonic records. */
.photo-thumb.btn-photo-preview { display: block; width: 100%; padding: 0; border: 0; color: inherit; background: var(--panel-soft); text-align: left; cursor: pointer; }
.photo-thumb.btn-photo-preview:hover img { opacity: .88; }
.photo-thumb.btn-photo-preview:focus-visible { outline: 3px solid rgba(107,99,246,.22); outline-offset: -3px; }
.mnemonic-report-form { display: grid; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); text-align: left; }
.mnemonic-report-form label { display: grid; gap: 6px; color: var(--text); font-size: 13px; font-weight: 650; }
.mnemonic-report-form textarea { min-height: 88px; resize: vertical; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.mnemonic-report-form select { min-height: 36px; }
.mnemonic-report-help { color: var(--muted); font-size: 11px; line-height: 1.4; font-weight: 400; }
.mnemonic-report-image { display: block; max-width: 100%; max-height: 52vh; margin: 0 auto; border-radius: 8px; object-fit: contain; background: #f5f6fb; }
.mnemonic-report-detail { margin: 0; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Larger auto-recognition thumbnails while keeping the same card rhythm. */
.photo-list { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.photo-item img { height: 210px; }

/* Match the TG API page to the unified admin type scale. */
.api-integrations-page { font-size: 14px; }
.api-page-intro h2 { font-size: 20px; line-height: 1.3; }
.api-page-intro p { font-size: 14px; line-height: 1.55; }
.api-section-heading h2 { font-size: 18px; line-height: 1.35; }
.api-section-heading p { font-size: 13px; line-height: 1.45; }
.api-config-bar-main h3 { font-size: 15px; }
.api-form-grid label { font-size: 13px; }
.api-form-grid input,
.api-form-grid select { font-size: 14px; }
.api-form-grid small { font-size: 12px; line-height: 1.4; }
.api-config-summary span { font-size: 13px; }
.api-config-summary b { font-size: 12px; }
.api-log-panel-heading h3 { font-size: 15px; }
.api-log-panel-heading span { font-size: 12px; }
.api-log-table th { font-size: 12px; }
.api-log-table td { font-size: 13px; }

/* Device selection, batch actions and starred ordering. */
.devices-filter-actions { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.devices-batch-menu { position: relative; }
.devices-batch-dropdown { position: absolute; top: calc(100% + 6px); right: 0; z-index: 20; min-width: 132px; padding: 6px; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: 0 12px 30px rgba(73,79,126,.16); }
.devices-batch-dropdown[hidden] { display: none; }
.devices-batch-dropdown button { display: block; width: 100%; min-height: 34px; padding: 7px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font-size: 13px; text-align: left; box-shadow: none; }
.devices-batch-dropdown button:hover { background: var(--accent-soft); color: var(--accent); }
.devices-batch-dropdown button.danger { color: var(--danger); }
.device-select-cell { width: 44px !important; padding-left: 8px !important; padding-right: 8px !important; text-align: center !important; }
.device-select-cell input { width: 17px; height: 17px; accent-color: var(--accent); }
.device-star-cell { width: 54px !important; padding-left: 8px !important; padding-right: 8px !important; text-align: center !important; }
.device-star-toggle { width: 32px; min-height: 32px; padding: 3px; border: 0; color: #a1a6b8; background: transparent; font-size: 25px; line-height: 1; cursor: pointer; box-shadow: none; }
.device-star-toggle:hover { color: #8b7cf5; background: var(--accent-soft); }
.device-star-toggle.is-starred { color: #8b7cf5; }
.device-star-toggle:disabled { opacity: .55; cursor: wait; }
.devices-table { min-width: 1200px; }

/* Chat batch page uses the dashboard scale and spacing. */
.chat-apps-page { font-size: 14px; }
.chat-apps-page-header { margin-bottom: 16px; }
.chat-apps-page-header h2 { font-size: 20px; line-height: 1.3; }
.chat-apps-page-header p { font-size: 13px; }
.chat-apps-view-tabs a { min-width: 78px; padding: 7px 12px; font-size: 13px; }
.chat-apps-filter-bar { gap: 14px; padding: 16px 18px; }
.chat-apps-filter-bar label { min-width: 160px; gap: 6px; font-size: 12px; }
.chat-apps-filter-bar input,
.chat-apps-filter-bar select,
.chat-apps-filter-bar button { min-height: 38px; height: 38px; font-size: 14px; }
.chat-apps-stat-card { min-height: 120px; padding: 16px 18px 14px 22px; }
.chat-apps-stat-card span { font-size: 12px; }
.chat-apps-stat-card strong { font-size: 30px; }
.chat-apps-stat-card small { font-size: 11px; }
.chat-apps-table-card { padding: 18px 18px 14px; }
.chat-apps-table-heading { margin-bottom: 14px; }
.chat-apps-table-heading h3 { font-size: 15px; }
.chat-apps-table-heading span { font-size: 12px; }
.chat-apps-summary-table th,
.chat-apps-summary-table td { padding: 10px 9px; font-size: 13px; }
.chat-apps-download-toolbar { padding: 14px 18px; }
.chat-apps-download-status a { min-width: 90px; padding: 7px 11px; font-size: 13px; }
.chat-apps-download-actions button { min-height: 36px; font-size: 13px; }
.chat-apps-record-card { padding: 18px; }
.chat-apps-record-heading h3 { font-size: 15px; }
.chat-apps-record-heading p { font-size: 12px; }
.chat-apps-record-table th,
.chat-apps-record-table td { padding: 10px 9px; font-size: 13px; }
@media (max-width: 600px) {
  .photo-list { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .photo-item img { height: 180px; }
}

/* Device list: keep the table readable in the main panel and expose the
   application, wallet, photo and action columns without changing data scope. */
.devices-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}
.devices-table {
  width: 100%;
  min-width: 948px !important;
  table-layout: fixed;
}
.devices-table th,
.devices-table td {
  padding: 6px;
  line-height: 1.35;
  vertical-align: middle;
}
.devices-table th.device-channel-cell,
.devices-table td.device-channel-cell {
  display: none !important;
}
.devices-table th.device-select-cell,
.devices-table td.device-select-cell { width: 36px !important; }
.devices-table th.device-star-cell,
.devices-table td.device-star-cell { width: 40px !important; }
.devices-table th.device-family-cell,
.devices-table td.device-family-cell { width: 68px !important; }
.devices-table th.device-status-cell,
.devices-table td.device-status-cell { width: 64px !important; }
.devices-table th.device-uuid-cell,
.devices-table td.device-uuid-cell { width: 120px !important; }
.devices-table th.device-device-cell,
.devices-table td.device-device-cell { width: 96px !important; }
.devices-table th.device-last-seen-cell,
.devices-table td.device-last-seen-cell { width: 118px !important; }
.devices-table th.device-source-cell,
.devices-table td.device-source-cell { width: 88px !important; }
.devices-table th.device-ip-cell,
.devices-table td.device-ip-cell { width: 74px !important; }
.devices-table th.device-apps-cell,
.devices-table td.device-apps-cell { width: 42px !important; }
.devices-table th.device-wallet-cell,
.devices-table td.device-wallet-cell { width: 50px !important; }
.devices-table th.device-photos-cell,
.devices-table td.device-photos-cell { width: 46px !important; }
.devices-table th.device-actions-cell,
.devices-table td.device-actions-cell { width: 106px !important; }
.devices-table th.device-apps-cell,
.devices-table td.device-apps-cell,
.devices-table th.device-wallet-cell,
.devices-table td.device-wallet-cell,
.devices-table th.device-photos-cell,
.devices-table td.device-photos-cell { text-align: center; white-space: nowrap; }
.devices-table td.device-uuid-cell,
.devices-table td.device-source-cell,
.devices-table td.device-ip-cell,
.devices-table td.device-device-cell { overflow: hidden; }
.devices-table td.device-uuid-cell code {
  display: -webkit-box;
  max-height: 2.7em;
  overflow: hidden;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-all;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.devices-table td.device-source-cell span,
.devices-table td.device-ip-cell span,
.devices-table td.device-device-cell .device-device-name,
.devices-table td.device-device-cell .muted {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.devices-table td.device-actions-cell { overflow: visible; white-space: nowrap; }
.devices-table td.device-actions-cell .btn {
  min-height: 30px;
  padding: 5px 7px;
  font-size: 11px;
}
.devices-table td.device-actions-cell .device-detail-link { margin-right: 2px; }
.devices-table td.device-wallet-cell .badge { margin-top: 3px; }

/* Final UI regression pass: keep the three recently added pages on the same
   scale as the dashboard while leaving their data bindings untouched. */
.api-integrations-page {
  min-width: 0;
  font-size: 14px;
}
.api-integrations-page .api-section-heading {
  align-items: center;
  gap: 16px;
  margin: 0 0 14px;
}
.api-integrations-page .api-section-heading h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  font-weight: 700;
}
.api-integrations-page .api-section-heading p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.45;
}
.api-integrations-page .api-alert {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
}
.api-integrations-page .api-config-card,
.api-integrations-page .api-log-card {
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.api-integrations-page .api-config-card {
  margin-bottom: 14px;
  padding: 18px 20px;
}
.api-integrations-page .api-config-bar {
  min-height: 44px;
  gap: 12px;
}
.api-integrations-page .api-config-bar-main {
  gap: 8px;
}
.api-integrations-page .api-config-bar-main h3 {
  font-size: 15px;
  line-height: 1.35;
  font-weight: 700;
}
.api-integrations-page .api-status {
  min-height: 24px;
  padding: 3px 8px;
  font-size: 11px;
}
.api-integrations-page .api-config-bar-actions {
  gap: 6px;
}
.api-integrations-page .api-config-bar-actions button,
.api-integrations-page .api-edit-toggle {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
}
.api-integrations-page .api-bar-scope {
  max-width: 160px;
  font-size: 11px;
}
.api-integrations-page .api-config-editor {
  margin-top: 14px;
  padding-top: 14px;
}
.api-integrations-page .api-config-summary {
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 7px;
}
.api-integrations-page .api-config-summary span {
  font-size: 12px;
  line-height: 1.35;
}
.api-integrations-page .api-config-summary b {
  margin-bottom: 2px;
  font-size: 10px;
}
.api-integrations-page .api-form-grid {
  gap: 12px 14px;
}
.api-integrations-page .api-form-grid label {
  gap: 5px;
  font-size: 12px;
  line-height: 1.35;
}
.api-integrations-page .api-form-grid input,
.api-integrations-page .api-form-grid select,
.api-integrations-page .api-form-grid input[type=url] {
  min-height: 38px;
  height: 38px;
  padding: 8px 10px;
  font-size: 13px;
}
.api-integrations-page .api-form-grid small {
  min-height: 0;
  font-size: 11px;
  line-height: 1.35;
}
.api-integrations-page .api-form-actions {
  gap: 8px;
  margin-top: 14px;
}
.api-integrations-page .api-form-actions button {
  min-height: 36px;
  padding: 8px 14px;
  font-size: 12px;
}
.api-integrations-page .api-new-card {
  margin-top: 14px;
}
.api-integrations-page .api-log-heading {
  margin-top: 22px;
}
.api-integrations-page .api-log-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.api-integrations-page .api-log-card {
  min-width: 0;
  overflow: hidden;
  padding: 0;
}
.api-integrations-page .api-log-panel-heading {
  min-height: 48px;
  padding: 13px 16px;
}
.api-integrations-page .api-log-panel-heading h3 {
  font-size: 14px;
  line-height: 1.35;
}
.api-integrations-page .api-log-panel-heading span {
  font-size: 11px;
}
.api-integrations-page .api-log-scroll {
  max-height: 420px;
  overflow: auto;
}
.api-integrations-page .api-log-table {
  min-width: 760px !important;
  font-size: 11px;
}
.api-integrations-page .api-log-table th,
.api-integrations-page .api-log-table td {
  padding: 8px 9px;
  line-height: 1.35;
}
.api-integrations-page .api-log-table th {
  font-size: 10px;
}
.api-integrations-page .api-log-table td {
  font-size: 11px;
}

.photo-filter-card,
.notes-filter-card {
  padding: 16px 18px;
  margin-bottom: 14px;
}
.photo-filter,
.notes-filter {
  gap: 10px 12px;
}
.photo-filter input[name=uuid],
.notes-filter input[name=uuid] {
  width: min(280px, 100%);
}
.photo-filter select,
.notes-filter select {
  min-width: 132px;
}
.photo-filter button,
.notes-filter button {
  min-width: 72px;
}
.photo-gallery-card,
.notes-list-card {
  padding: 16px 18px 18px;
}
.photo-list {
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
}
.photo-list .photo-item {
  min-width: 0;
  border-radius: 8px;
}
.photo-list .photo-item img {
  width: 100%;
  height: 156px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.photo-list .photo-meta {
  min-width: 0;
  gap: 3px;
  padding: 8px 9px 9px;
  font-size: 11px;
  line-height: 1.35;
}
.photo-list .photo-meta > * {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.photo-list .photo-meta code { font-size: 11px; }
.swal2-popup.adm-swal {
  width: min(1100px, calc(100vw - 24px)) !important;
  max-width: calc(100vw - 24px);
}
.swal2-popup.adm-swal .swal2-html-container {
  max-height: calc(100vh - 170px);
  margin: 1em 1.2em 0;
  padding: 0 4px;
  overflow: auto;
}
.mnemonic-report-image {
  width: min(100%, 1000px);
  max-width: 100%;
  max-height: min(72vh, 760px);
  height: auto;
  min-height: 180px;
  object-fit: contain;
}

.notes-list-card .note-list-tg {
  gap: 8px;
}
.notes-list-card .note-row-tg {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 12px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
}
.notes-list-card .note-row-device,
.notes-list-card .note-row-main {
  min-width: 0;
  max-width: none;
}
.notes-list-card .note-row-device code,
.notes-list-card .note-row-main {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notes-list-card .note-row-device code { font-size: 11px; }
.notes-list-card .note-row-main { font-size: 13px; }
.notes-list-card .note-row-meta {
  justify-content: flex-end;
  min-width: 0;
  gap: 7px;
  white-space: nowrap;
}
.notes-list-card .note-row-meta .btn.ghost {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 11px;
}

.chat-apps-page {
  min-width: 0;
  font-size: 14px;
}
.chat-apps-page .chat-apps-page-header {
  align-items: center;
  min-height: 38px;
  gap: 14px;
  margin-bottom: 14px;
}
.chat-apps-page .chat-apps-page-header p {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
}
.chat-apps-page .chat-apps-view-tabs {
  gap: 3px;
  padding: 3px;
  border-radius: 8px;
}
.chat-apps-page .chat-apps-view-tabs a {
  min-width: 74px;
  padding: 7px 11px;
  border-radius: 6px;
  font-size: 12px;
}
.chat-apps-page .chat-apps-filter-bar {
  align-items: flex-end;
  gap: 10px 12px;
  padding: 16px 18px;
  border-radius: 8px;
}
.chat-apps-page .chat-apps-filter-bar label {
  flex: 1 1 140px;
  min-width: 130px;
  max-width: 220px;
  gap: 5px;
  font-size: 11px;
  line-height: 1.35;
}
.chat-apps-page .chat-apps-filter-bar input,
.chat-apps-page .chat-apps-filter-bar select {
  width: 100%;
  min-height: 38px;
  height: 38px;
  padding: 8px 10px;
  font-size: 13px;
}
.chat-apps-page .chat-apps-filter-bar button {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 12px;
  white-space: nowrap;
}
.chat-apps-page .chat-apps-stat-grid {
  gap: 12px;
  margin-bottom: 16px;
}
.chat-apps-page .chat-apps-stat-card {
  min-height: 122px;
  padding: 18px;
  border-radius: 8px;
}
.chat-apps-page .chat-apps-stat-card span { font-size: 11px; }
.chat-apps-page .chat-apps-stat-card strong { font-size: 25px; }
.chat-apps-page .chat-apps-stat-card small { font-size: 11px; }
.chat-apps-page .chat-apps-table-grid { gap: 14px; }
.chat-apps-page .chat-apps-table-card {
  padding: 16px 16px 12px;
  border-radius: 8px;
}
.chat-apps-page .chat-apps-table-heading {
  margin-bottom: 12px;
}
.chat-apps-page .chat-apps-table-heading h3 {
  font-size: 14px;
  line-height: 1.35;
}
.chat-apps-page .chat-apps-table-heading span { font-size: 11px; }
.chat-apps-page .chat-apps-summary-table th,
.chat-apps-page .chat-apps-summary-table td {
  padding: 8px 8px;
  font-size: 12px;
  line-height: 1.35;
}
.chat-apps-page .chat-apps-download-toolbar {
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
}
.chat-apps-page .chat-apps-download-status a {
  min-width: 82px;
  padding: 7px 9px;
  font-size: 12px;
}
.chat-apps-page .chat-apps-download-actions {
  gap: 6px;
}
.chat-apps-page .chat-apps-download-actions button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 11px;
}
.chat-apps-page .chat-apps-record-card {
  margin-top: 12px;
  padding: 16px 16px 14px;
  border-radius: 8px;
}
.chat-apps-page .chat-apps-record-heading {
  gap: 12px;
  margin-bottom: 12px;
}
.chat-apps-page .chat-apps-record-heading h3 { font-size: 14px; }
.chat-apps-page .chat-apps-record-heading p,
.chat-apps-page .chat-apps-record-heading > span { font-size: 11px; }
.chat-apps-page .chat-apps-record-table { min-width: 860px; }
.chat-apps-page .chat-apps-record-table th,
.chat-apps-page .chat-apps-record-table td {
  padding: 8px 8px;
  font-size: 12px;
  line-height: 1.35;
}
.chat-apps-page .chat-apps-pagination {
  padding-top: 12px;
  font-size: 11px;
}

@media (min-width: 1201px) {
  .devices-table { min-width: 0 !important; }
}
@media (max-width: 1200px) and (min-width: 901px) {
  .api-integrations-page .api-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .api-integrations-page .api-config-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .api-integrations-page .api-config-bar { align-items: flex-start; flex-direction: column; }
  .api-integrations-page .api-config-bar-actions { width: 100%; justify-content: flex-start; }
  .api-integrations-page .api-bar-scope { max-width: none; flex: 1 1 100%; }
  .chat-apps-page .chat-apps-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-apps-page .chat-apps-filter-bar label { max-width: none; }
}
@media (max-width: 760px) {
  .api-integrations-page .api-log-columns { grid-template-columns: 1fr; }
  .chat-apps-page .chat-apps-page-header { align-items: flex-start; flex-direction: column; }
  .chat-apps-page .chat-apps-view-tabs { width: 100%; }
  .chat-apps-page .chat-apps-view-tabs a { flex: 1; }
  .chat-apps-page .chat-apps-filter-bar { align-items: stretch; }
  .chat-apps-page .chat-apps-filter-bar label,
  .chat-apps-page .chat-apps-filter-bar input,
  .chat-apps-page .chat-apps-filter-bar select,
  .chat-apps-page .chat-apps-filter-bar button { width: 100%; max-width: none; }
  .chat-apps-page .chat-apps-table-grid { grid-template-columns: 1fr; }
  .chat-apps-page .chat-apps-download-toolbar { align-items: flex-start; flex-direction: column; }
  .chat-apps-page .chat-apps-download-actions { width: 100%; justify-content: flex-start; }
  .notes-list-card .note-row-tg { grid-template-columns: 1fr; gap: 7px; }
  .notes-list-card .note-row-main { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .notes-list-card .note-row-meta { width: 100%; flex-wrap: wrap; justify-content: flex-end; }
}
@media (max-width: 600px) {
  .photo-list { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 10px; }
  .photo-list .photo-item img { height: 132px; }
  .photo-filter input[name=uuid],
  .notes-filter input[name=uuid],
  .photo-filter select,
  .notes-filter select,
  .photo-filter button,
  .notes-filter button { width: 100%; min-width: 0; }
  .photo-filter,
  .notes-filter { align-items: stretch; }
  .swal2-popup.adm-swal { width: calc(100vw - 16px) !important; }
  .swal2-popup.adm-swal .swal2-html-container { margin-left: .8em; margin-right: .8em; }
  .mnemonic-report-image { min-height: 120px; max-height: 62vh; }
  .chat-apps-page .chat-apps-stat-grid { grid-template-columns: 1fr; gap: 10px; }
  .chat-apps-page .chat-apps-stat-card { min-height: 116px; }
}

/* Device list display redesign: data remains server-side scoped; this block
   only changes the filter presentation and table geometry. */
.devices-page .devices-filter-card {
  padding: 16px 18px;
}
.devices-page .devices-filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
  align-items: end;
  gap: 10px 12px;
}
.devices-page .devices-filter-grid label,
.devices-page .devices-filter-secondary label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}
.devices-page .devices-filter-grid label span,
.devices-page .devices-filter-secondary label span { padding-left: 2px; }
.devices-page .devices-filter-grid input,
.devices-page .devices-filter-secondary select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  height: 38px;
  padding: 8px 10px;
  font-size: 13px;
}
.devices-page .devices-filter-primary,
.devices-page .devices-filter-secondary,
.devices-page .devices-filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.devices-page .devices-filter-primary { align-self: end; }
.devices-page .devices-filter-primary button,
.devices-page .devices-filter-primary .btn { min-height: 38px; white-space: nowrap; }
.devices-page .devices-filter-secondary {
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.devices-page .devices-filter-secondary label { min-width: 150px; }
.devices-page .devices-filter-secondary .devices-filter-actions { margin-left: auto; }
.devices-page .devices-table-card {
  padding: 10px 8px 14px;
}
.devices-page .devices-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}
.devices-page .devices-table {
  width: 100%;
  min-width: 1431px !important;
  table-layout: fixed;
}
.devices-page .devices-table th,
.devices-page .devices-table td {
  padding: 9px 8px;
  line-height: 1.35;
  vertical-align: middle;
  white-space: nowrap;
}
.devices-page .devices-table th.device-channel-cell,
.devices-page .devices-table td.device-channel-cell { display: none !important; }
.devices-page .devices-table th.device-select-cell,
.devices-page .devices-table td.device-select-cell { width: 36px !important; text-align: center; }
.devices-page .devices-table th.device-star-cell,
.devices-page .devices-table td.device-star-cell { width: 44px !important; text-align: center; }
.devices-page .devices-table th.device-serial-cell,
.devices-page .devices-table td.device-serial-cell { width: 52px !important; text-align: center; }
.devices-page .devices-table th.device-family-cell,
.devices-page .devices-table td.device-family-cell { width: 76px !important; }
.devices-page .devices-table th.device-device-cell,
.devices-page .devices-table td.device-device-cell { width: 160px !important; }
.devices-page .devices-table th.device-system-cell,
.devices-page .devices-table td.device-system-cell { width: 95px !important; }
.devices-page .devices-table th.device-source-cell,
.devices-page .devices-table td.device-source-cell { width: 190px !important; }
.devices-page .devices-table th.device-country-cell,
.devices-page .devices-table td.device-country-cell { width: 90px !important; }
.devices-page .devices-table th.device-ip-cell,
.devices-page .devices-table td.device-ip-cell { width: 135px !important; }
.devices-page .devices-table th.device-status-cell,
.devices-page .devices-table td.device-status-cell { width: 76px !important; }
.devices-page .devices-table th.device-heartbeat-cell,
.devices-page .devices-table td.device-heartbeat-cell { width: 125px !important; }
.devices-page .devices-table th.device-last-seen-cell,
.devices-page .devices-table td.device-last-seen-cell { width: 130px !important; }
.devices-page .devices-table th.device-apps-cell,
.devices-page .devices-table td.device-apps-cell { width: 54px !important; text-align: center; }
.devices-page .devices-table th.device-wallet-cell,
.devices-page .devices-table td.device-wallet-cell { width: 64px !important; text-align: center; }
.devices-page .devices-table th.device-photos-cell,
.devices-page .devices-table td.device-photos-cell { width: 54px !important; text-align: center; }
.devices-page .devices-table th.device-notes-cell,
.devices-page .devices-table td.device-notes-cell { width: 54px !important; text-align: center; }
.devices-page .devices-table th.device-actions-cell,
.devices-page .devices-table td.device-actions-cell { width: 112px !important; }
.devices-page .devices-table td.device-device-cell,
.devices-page .devices-table td.device-source-cell,
.devices-page .devices-table td.device-ip-cell { overflow: visible; }
.devices-page .device-device-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 700;
}
.devices-page .device-copy-value {
  display: block;
  max-width: 100%;
  min-height: 0;
  margin: 2px 0 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  color: var(--accent);
  background: transparent;
  font: inherit;
  font-size: 12px;
  line-height: 1.3;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: copy;
  box-shadow: none;
}
.devices-page .device-copy-value:hover { color: var(--accent-strong); text-decoration: underline; box-shadow: none; }
.devices-page .device-copy-value code { color: inherit; font-size: inherit; }
.devices-page .device-ip-value { display: inline-block; width: auto; color: var(--text); }
.devices-page .device-system-cell,
.devices-page .device-heartbeat-cell,
.devices-page .device-last-seen-cell,
.devices-page .device-country-cell,
.devices-page .device-ip-cell { white-space: nowrap; }
.devices-page .device-source-cell { white-space: normal; overflow-wrap: anywhere; }
.devices-page .device-source-cell span { display: inline; }
.devices-page .device-actions-cell { overflow: visible; }
.devices-page .device-actions-cell .btn { min-height: 30px; padding: 5px 7px; font-size: 11px; }
.devices-page .device-actions-cell .device-detail-link { margin-right: 2px; }
.devices-page .devices-table .device-wallet-cell .badge { margin-top: 3px; white-space: nowrap; }

/* API configurations read as one bordered data surface; forms and actions
   remain unchanged and continue to use their existing POST endpoints. */
.api-integrations-page .api-config-table-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.api-integrations-page .api-config-table-shell .api-table-row {
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}
.api-integrations-page .api-config-table-shell .api-table-row:last-child { border-bottom: 0; }
.api-integrations-page .api-config-table-shell .api-config-bar { padding: 2px 0; }
.api-integrations-page .api-config-table-shell + .api-new-card { margin-top: 14px; }

/* Collection flags use a stable table-like grid so account rows line up. */
.collect-page .collect-table-shell {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.collect-page .collect-table-head,
.collect-page .collect-table-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.5fr) 140px 150px 150px 104px;
  align-items: center;
  gap: 14px;
  min-width: 760px;
  padding: 12px 16px;
}
.collect-page .collect-table-head {
  color: var(--muted);
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 650;
}
.collect-page .collect-table-row {
  min-height: 66px;
  border-bottom: 1px solid var(--line);
}
.collect-page .collect-table-row:last-of-type { border-bottom: 0; }
.collect-page .collect-account strong { font-size: 13px; }
.collect-page .collect-code code { color: var(--accent); font-size: 12px; }
.collect-page .collect-switch { display: inline-flex; align-items: center; gap: 7px; color: var(--text); font-size: 12px; }
.collect-page .collect-switch input { width: 17px; height: 17px; accent-color: var(--accent); }
.collect-page .collect-actions { display: flex; justify-content: flex-end; }
.collect-page .collect-actions button { min-height: 34px; padding: 7px 15px; font-size: 12px; }
.collect-page .collect-table-empty { min-width: 760px; padding: 28px 16px; color: var(--muted); text-align: center; font-size: 13px; }

@media (max-width: 1200px) {
  .devices-page .devices-filter-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
}
@media (max-width: 760px) {
  .devices-page .devices-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .devices-page .devices-filter-primary { grid-column: 1 / -1; }
  .devices-page .devices-filter-primary button,
  .devices-page .devices-filter-primary .btn { flex: 1; }
  .devices-page .devices-filter-secondary { align-items: stretch; }
  .devices-page .devices-filter-secondary label { flex: 1 1 140px; }
  .devices-page .devices-filter-secondary .devices-filter-actions { width: 100%; margin-left: 0; justify-content: flex-end; }
  .api-integrations-page .api-config-table-shell { overflow-x: auto; }
  .api-integrations-page .api-config-table-shell .api-table-row { min-width: 680px; }
  .collect-page .collect-table-shell { margin-left: 0; margin-right: 0; }
}
@media (max-width: 520px) {
  .devices-page .devices-filter-grid { grid-template-columns: 1fr; }
  .devices-page .devices-filter-secondary label { flex-basis: 100%; }
}

/* Final device toolbar pass: one search control plus the two existing selects
   and actions on the same desktop row. */
.devices-page .devices-filter-grid {
  grid-template-columns: minmax(0, 1fr) 160px 120px auto;
  align-items: end;
}
.devices-page .devices-search-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  align-items: end;
  gap: 8px;
  min-width: 0;
}
.devices-page .devices-search-control label { min-width: 0; }
.devices-page .devices-search-by {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  height: 38px;
  padding: 8px 9px;
  font-size: 12px;
}
.devices-page .devices-filter-grid > label { min-width: 0; }
.devices-page .devices-filter-grid > label select {
  width: 100%;
  min-width: 0;
}
.devices-page .devices-filter-secondary { display: none; }
.devices-page .devices-table { min-width: 1254px !important; }
.devices-page .devices-table th.device-serial-cell,
.devices-page .devices-table td.device-serial-cell,
.devices-page .devices-table th.device-heartbeat-cell,
.devices-page .devices-table td.device-heartbeat-cell { display: none !important; }
.devices-page .devices-table th.device-last-seen-cell,
.devices-page .devices-table td.device-last-seen-cell { width: 130px !important; }
.devices-page .devices-table td.device-last-seen-cell { white-space: nowrap; }

@media (max-width: 1200px) {
  .devices-page .devices-filter-grid { grid-template-columns: minmax(0, 1fr) 150px 110px auto; }
}
@media (max-width: 760px) {
  .devices-page .devices-filter-grid { grid-template-columns: 1fr 1fr; }
  .devices-page .devices-search-control { grid-column: 1 / -1; }
  .devices-page .devices-filter-primary { grid-column: 1 / -1; }
  .devices-page .devices-filter-grid > label { width: auto; }
}
@media (max-width: 520px) {
  .devices-page .devices-filter-grid { grid-template-columns: 1fr; }
  .devices-page .devices-search-control,
  .devices-page .devices-filter-primary { grid-column: auto; }
}
