:root {
  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-muted: #eef2f6;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --primary: #16a34a;
  --primary-dark: #12813c;
  --primary-soft: #dcfce7;
  --whatsapp: #25d366;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --teal: #0d9488;
  --teal-soft: #ccfbf1;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --sidebar: #0b1220;
  --sidebar-soft: #111c2f;
  --sidebar-border: rgba(148, 163, 184, 0.14);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 12px 32px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 28px 70px rgba(15, 23, 42, 0.16);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --sidebar-width: 258px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 90% 0%, rgba(37, 211, 102, 0.07), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--primary-dark);
}

code,
pre {
  font-family: "Cascadia Code", Consolas, "SFMono-Regular", Menlo, Monaco, monospace;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--text);
  line-height: 1.2;
}

h1 {
  font-size: 1.65rem;
  letter-spacing: -0.035em;
}

h2 {
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1rem;
}

[hidden],
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

::selection {
  background: rgba(37, 211, 102, 0.22);
}

:focus-visible {
  outline: 3px solid rgba(37, 211, 102, 0.4);
  outline-offset: 2px;
}

.eyebrow {
  margin-bottom: 0.55rem;
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Login */

.login-screen {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  padding: 36px 20px;
  background:
    linear-gradient(145deg, #07101e 0%, #0b1728 45%, #08131f 100%);
}

.login-screen::before {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  content: "";
  mask-image: radial-gradient(circle at center, black, transparent 78%);
}

.login-glow {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.24;
  pointer-events: none;
}

.login-glow-one {
  top: -200px;
  right: -100px;
  background: #25d366;
}

.login-glow-two {
  bottom: -280px;
  left: -120px;
  background: #0ea5e9;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(100%, 460px);
  padding: 34px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.4);
  animation: card-enter 0.45s ease-out;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-large {
  padding-bottom: 22px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(145deg, #25d366, #16a34a);
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.28);
  color: #fff;
}

.brand-mark svg {
  width: 24px;
  height: 24px;
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.brand-copy strong {
  color: var(--text);
  font-size: 0.98rem;
  letter-spacing: -0.015em;
}

.brand-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-heading h1 {
  margin-bottom: 10px;
  font-size: 1.8rem;
  letter-spacing: -0.045em;
}

.login-heading > p:last-child {
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 0.92rem;
}

.login-heading code {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 0.85em;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.55;
  text-align: center;
}

.login-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 20px;
  margin-top: 22px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.74rem;
}

.mini-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft);
}

/* Forms and buttons */

.field {
  display: grid;
  gap: 7px;
}

.field > label,
.label {
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input,
select {
  min-height: 44px;
  padding: 0 13px;
}

textarea {
  min-height: 142px;
  padding: 12px 13px;
  line-height: 1.6;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-light);
}

input:hover,
textarea:hover,
select:hover {
  border-color: #b6c2d2;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.11);
  outline: none;
}

.input-action {
  position: relative;
}

.input-action input {
  padding-right: 70px;
}

.input-action .text-button {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
}

.input-with-prefix {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.input-with-prefix:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.11);
}

.input-with-prefix > span {
  display: grid;
  width: 46px;
  flex: 0 0 auto;
  place-items: center;
  border-right: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 600;
}

.input-with-prefix input {
  border: 0;
  box-shadow: none;
}

.input-with-prefix input:focus {
  box-shadow: none;
}

.help-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

.character-count {
  color: var(--muted-light);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--primary-dark);
  font-size: 0.75rem;
  font-weight: 700;
}

.text-button:hover {
  text-decoration: underline;
}

.text-button-danger {
  color: var(--red);
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.005em;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.button svg {
  width: 17px;
  height: 17px;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button-primary {
  background: linear-gradient(145deg, #1db954, #16a34a);
  box-shadow: 0 7px 18px rgba(22, 163, 74, 0.2);
  color: #fff;
}

.button-primary:hover:not(:disabled) {
  background: linear-gradient(145deg, #18ae4d, #12813c);
  box-shadow: 0 10px 24px rgba(22, 163, 74, 0.27);
}

.button-secondary {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text-soft);
}

.button-secondary:hover:not(:disabled) {
  border-color: #aebccd;
  background: var(--surface-soft);
}

.button-ghost {
  border-color: transparent;
  background: var(--surface-muted);
  color: var(--text-soft);
}

.button-ghost:hover:not(:disabled) {
  background: #e2e8f0;
}

.button-danger {
  background: var(--red);
  color: #fff;
}

.button-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.button-danger-ghost {
  border-color: #fecaca;
  background: #fff;
  color: var(--red);
}

.button-danger-ghost:hover:not(:disabled) {
  background: #fef2f2;
}

.button-wide {
  width: 100%;
}

.button-small {
  min-height: 35px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 0.75rem;
}

.button.is-loading {
  cursor: wait;
  opacity: 0.7;
}

.form-error {
  padding: 11px 13px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: #fff7f7;
  color: #b91c1c;
  font-size: 0.8rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 6px;
}

.form-footnote {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.55;
}

/* App shell */

.app {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 40;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 24px 17px 18px;
  border-right: 1px solid rgba(148, 163, 184, 0.12);
  background:
    radial-gradient(circle at 20% 0%, rgba(37, 211, 102, 0.1), transparent 18rem),
    linear-gradient(180deg, var(--sidebar), #08101c);
  color: #e2e8f0;
}

.sidebar .brand {
  padding: 0 7px 22px;
}

.sidebar .brand-copy strong {
  color: #f8fafc;
}

.sidebar .brand-copy small {
  color: #8190a5;
}

.nav {
  display: grid;
  gap: 4px;
  padding-top: 6px;
}

.nav-item {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #9caabd;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  transition: background 0.17s ease, color 0.17s ease;
}

.nav-item svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.nav-item:hover {
  background: rgba(148, 163, 184, 0.08);
  color: #f1f5f9;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(37, 211, 102, 0.17), rgba(37, 211, 102, 0.06));
  color: #f0fdf4;
}

.nav-item.active::before {
  position: absolute;
  top: 11px;
  bottom: 11px;
  left: -17px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--whatsapp);
  content: "";
}

.sidebar-bottom {
  display: grid;
  gap: 12px;
  padding-top: 18px;
  margin-top: auto;
  border-top: 1px solid var(--sidebar-border);
}

.side-connection {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--sidebar-border);
  border-radius: 11px;
  background: rgba(148, 163, 184, 0.05);
}

.side-connection div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.side-connection strong {
  overflow: hidden;
  color: #e2e8f0;
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-connection small {
  color: #6f7f94;
  font-size: 0.64rem;
}

.sidebar-lock {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #7d8ca1;
  font-size: 0.72rem;
  font-weight: 600;
}

.sidebar-lock:hover {
  background: rgba(148, 163, 184, 0.08);
  color: #dbe4ef;
}

.sidebar-lock svg {
  width: 15px;
  height: 15px;
}

.sidebar-overlay {
  position: fixed;
  z-index: 35;
  inset: 0;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(2px);
}

.main {
  min-width: 0;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  z-index: 25;
  top: 0;
  display: flex;
  min-height: 82px;
  align-items: center;
  gap: 18px;
  padding: 18px 34px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.82);
  background: rgba(244, 247, 249, 0.88);
  backdrop-filter: blur(14px);
}

.page-heading {
  min-width: 0;
}

.page-heading h1 {
  margin-bottom: 2px;
  font-size: 1.42rem;
}

.page-heading p {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.icon-button {
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  transition: color 0.17s ease, border-color 0.17s ease, background 0.17s ease;
}

.icon-button:hover {
  border-color: var(--border-strong);
  background: var(--surface-soft);
  color: var(--text);
}

.icon-button svg {
  width: 19px;
  height: 19px;
}

.icon-button.is-spinning svg {
  animation: spin 0.8s linear infinite;
}

.menu-button {
  display: none;
}

.content {
  width: 100%;
  max-width: 1480px;
  padding: 28px 34px 48px;
}

.view {
  display: none;
  animation: view-enter 0.25s ease-out;
}

.view.active {
  display: block;
}

/* Status */

.status-pill {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted-light);
}

.status-connected {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.status-connected .status-dot {
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
  animation: soft-pulse 2.2s infinite;
}

.status-qr,
.status-connecting {
  border-color: #fde68a;
  background: #fffbeb;
  color: var(--amber);
}

.status-qr .status-dot,
.status-connecting .status-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
  animation: soft-pulse 1.6s infinite;
}

.status-disconnected,
.status-error,
.status-logged_out {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.status-disconnected .status-dot,
.status-error .status-dot,
.status-logged_out .status-dot {
  background: var(--red);
}

.status-dot-neutral {
  background: var(--muted-light);
}

.status-dot-connected {
  background: var(--primary);
}

.status-dot-qr,
.status-dot-connecting {
  background: #f59e0b;
}

.status-dot-disconnected,
.status-dot-error,
.status-dot-logged_out {
  background: var(--red);
}

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 7px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.status-tag-success {
  background: var(--primary-soft);
  color: #15803d;
}

.status-tag-muted {
  background: var(--surface-muted);
  color: var(--muted);
}

/* Cards and layout */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 15px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stat-card > div:last-child {
  min-width: 0;
}

.stat-card p {
  margin-bottom: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-card h2 {
  margin: 0;
  font-size: 1.65rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.045em;
}

.stat-icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
}

.stat-icon svg {
  width: 22px;
  height: 22px;
}

.stat-icon-blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.stat-icon-green {
  background: var(--primary-soft);
  color: var(--primary);
}

.stat-icon-teal {
  background: var(--teal-soft);
  color: var(--teal);
}

.stat-icon-red {
  background: var(--red-soft);
  color: var(--red);
}

.card {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.card-header h2 {
  margin-bottom: 4px;
}

.card-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr);
  gap: 20px;
  margin-bottom: 20px;
}

.connection-card {
  display: flex;
  flex-direction: column;
}

.card-footer-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding-top: 15px;
  margin-top: auto;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.69rem;
  line-height: 1.55;
}

.card-footer-note svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--amber);
}

.qr-panel {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: center;
  gap: 26px;
  padding: 4px 0 22px;
}

.qr-frame {
  display: grid;
  padding: 10px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.qr-frame img {
  display: block;
  width: 100%;
  max-width: 240px;
  height: auto;
  border-radius: 10px;
  image-rendering: pixelated;
}

.qr-instructions h3 {
  margin-bottom: 12px;
  font-size: 1.05rem;
}

.qr-instructions ol {
  padding-left: 18px;
  margin: 0 0 14px;
  color: var(--text-soft);
  font-size: 0.8rem;
  line-height: 1.75;
}

.inline-note {
  padding: 10px 12px;
  margin: 0;
  border: 1px solid #fde68a;
  border-radius: 9px;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.71rem;
  line-height: 1.55;
}

.account-panel {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 18px;
  margin-bottom: 22px;
  border: 1px solid #bbf7d0;
  border-radius: 14px;
  background: linear-gradient(145deg, #f0fdf4, #f8fffb);
}

.account-avatar {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(145deg, #25d366, #12813c);
  box-shadow: 0 8px 18px rgba(22, 163, 74, 0.2);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 800;
  text-transform: uppercase;
}

.account-copy {
  min-width: 0;
  flex: 1;
}

.account-copy h3 {
  margin-bottom: 2px;
  overflow: hidden;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy p {
  margin-bottom: 7px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.disconnected-panel {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
  margin-bottom: 22px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  background: var(--surface-soft);
}

.disconnected-panel > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.disconnected-panel h3 {
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.disconnected-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.empty-icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  background: var(--surface-muted);
  color: var(--muted);
}

.empty-icon svg {
  width: 22px;
  height: 22px;
}

.chart-card {
  display: flex;
  flex-direction: column;
}

.chart-total {
  display: inline-grid;
  min-width: 38px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--text-soft);
  font-size: 0.76rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.chart-wrap {
  min-height: 170px;
  margin: -4px 0 8px;
}

.chart-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-grid-line {
  stroke: #e8edf3;
  stroke-width: 1;
}

.chart-bar {
  fill: url(#barGradient);
}

.chart-bar-value {
  fill: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-anchor: middle;
}

.chart-label {
  fill: var(--muted-light);
  font-size: 9px;
  font-weight: 600;
  text-anchor: middle;
}

.status-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-top: 13px;
  margin-top: auto;
  border-top: 1px solid var(--border);
}

.breakdown-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 600;
}

.breakdown-item strong {
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.breakdown-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-light);
}

.breakdown-dot.accepted,
.breakdown-dot.sent {
  background: var(--blue);
}

.breakdown-dot.delivered,
.breakdown-dot.read,
.breakdown-dot.played {
  background: var(--primary);
}

.breakdown-dot.failed {
  background: var(--red);
}

.breakdown-dot.queued,
.breakdown-dot.sending {
  background: #f59e0b;
}

/* Tables */

.table-wrap {
  overflow-x: auto;
  margin: 0 -22px -22px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.77rem;
}

.data-table th {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table th:first-child,
.data-table td:first-child {
  padding-left: 22px;
}

.data-table th:last-child,
.data-table td:last-child {
  padding-right: 22px;
}

.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #edf1f5;
  color: var(--text-soft);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: #fbfcfd;
}

.table-placeholder {
  padding: 38px 20px !important;
  color: var(--muted) !important;
  font-size: 0.8rem;
  text-align: center;
}

.table-placeholder-error {
  color: var(--red) !important;
}

.cell-main {
  display: block;
  max-width: 330px;
  overflow: hidden;
  color: var(--text-soft);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-sub {
  display: block;
  overflow: hidden;
  color: var(--muted-light);
  font-size: 0.67rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nowrap {
  white-space: nowrap;
}

.type-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: capitalize;
}

.type-cell svg {
  width: 15px;
  height: 15px;
  color: var(--muted-light);
}

.message-status {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.015em;
  text-transform: capitalize;
  white-space: nowrap;
}

.message-status::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status-queued,
.status-sending {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-accepted {
  background: var(--blue-soft);
  color: var(--blue);
}

.status-sent {
  background: #e0f2fe;
  color: #0369a1;
}

.status-delivered,
.status-read,
.status-played {
  background: var(--primary-soft);
  color: #15803d;
}

.status-failed {
  background: var(--red-soft);
  color: #b91c1c;
}

.row-action {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary-dark);
  font-size: 0.7rem;
  font-weight: 700;
}

.row-action:hover {
  text-decoration: underline;
}

/* Send page */

.send-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.7fr);
  align-items: start;
  gap: 20px;
}

.form-card form {
  display: grid;
  gap: 20px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
}

.segment {
  position: relative;
  display: block;
}

.segment input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.segment span {
  display: flex;
  min-height: 39px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.segment span svg {
  width: 16px;
  height: 16px;
}

.segment input:checked + span {
  border-color: var(--border);
  background: var(--surface);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.07);
  color: var(--primary-dark);
}

.segment input:focus-visible + span {
  outline: 3px solid rgba(37, 211, 102, 0.35);
  outline-offset: 1px;
}

.media-panel {
  display: grid;
  gap: 16px;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-soft);
}

.divider {
  position: relative;
  height: 1px;
  margin: 2px 0;
  background: var(--border);
  text-align: center;
}

.divider span {
  position: relative;
  top: -9px;
  padding: 0 10px;
  background: var(--surface-soft);
  color: var(--muted-light);
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
}

.file-drop {
  display: flex;
  min-height: 112px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 18px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
  transition: border-color 0.17s ease, background 0.17s ease;
}

.file-drop:hover {
  border-color: var(--primary);
  background: #f7fef9;
}

.file-drop svg {
  width: 25px;
  height: 25px;
  margin-bottom: 2px;
  color: var(--primary);
}

.file-drop strong {
  color: var(--text-soft);
  font-size: 0.78rem;
}

.file-drop span {
  font-size: 0.68rem;
}

.selected-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.selected-file-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
}

.selected-file-icon svg {
  width: 17px;
  height: 17px;
}

.selected-file-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.selected-file-copy strong {
  overflow: hidden;
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-file-copy span {
  color: var(--muted);
  font-size: 0.66rem;
}

.send-sidebar {
  display: grid;
  gap: 20px;
}

.result-card {
  min-height: 280px;
}

.result-empty {
  display: flex;
  min-height: 190px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
}

.result-empty .empty-icon {
  margin-bottom: 12px;
}

.result-empty h3 {
  margin-bottom: 5px;
  font-size: 0.9rem;
}

.result-empty p {
  max-width: 240px;
  margin: 0;
  color: var(--muted);
  font-size: 0.73rem;
}

.result-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
}

.result-banner svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.result-banner div {
  display: flex;
  flex-direction: column;
}

.result-banner strong {
  font-size: 0.79rem;
}

.result-banner span {
  color: var(--muted);
  font-size: 0.68rem;
}

.result-banner-success {
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.result-banner-success span {
  color: #3f7f58;
}

.result-banner-error {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.result-banner-error span {
  color: #a05a5a;
}

.mini-details {
  display: grid;
  gap: 0;
  margin: 15px 0;
}

.mini-details div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid #edf1f5;
  font-size: 0.72rem;
}

.mini-details div:last-child {
  border-bottom: 0;
}

.mini-details dt {
  color: var(--muted);
}

.mini-details dd {
  overflow: hidden;
  margin: 0;
  color: var(--text-soft);
  font-weight: 600;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-error > p {
  margin: 14px 0;
  color: #991b1b;
  font-size: 0.76rem;
  line-height: 1.6;
}

.error-details {
  padding-left: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.6;
}

.tip-card {
  background: linear-gradient(145deg, #0b1220, #132238);
  color: #cbd5e1;
}

.tip-card h2 {
  margin-bottom: 9px;
  color: #f8fafc;
  font-size: 0.95rem;
}

.tip-card p {
  margin-bottom: 9px;
  color: #9aabbf;
  font-size: 0.73rem;
  line-height: 1.65;
}

.tip-card p:last-child {
  margin-bottom: 0;
}

.tip-card strong {
  color: #86efac;
}

/* Messages page */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
}

.search-field {
  position: relative;
  min-width: 220px;
  flex: 1;
}

.search-field svg {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 17px;
  height: 17px;
  color: var(--muted-light);
  transform: translateY(-50%);
}

.search-field input {
  min-height: 39px;
  padding-left: 37px;
  background: var(--surface);
  font-size: 0.77rem;
}

.toolbar select {
  width: auto;
  min-width: 138px;
  min-height: 39px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.75rem;
}

.toolbar .button {
  min-height: 39px;
}

.messages-table td {
  padding-top: 15px;
  padding-bottom: 15px;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
}

#table-summary {
  color: var(--muted);
  font-size: 0.73rem;
}

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

#page-indicator {
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Settings */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.runtime-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.runtime-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 0;
  border-bottom: 1px solid #edf1f5;
}

.runtime-list div:last-child {
  border-bottom: 0;
}

.runtime-list dt {
  color: var(--muted);
  font-size: 0.74rem;
}

.runtime-list dd {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.74rem;
  font-weight: 650;
  text-align: right;
}

.settings-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-soft);
}

.settings-account {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-copy {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.65;
}

.settings-copy code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--surface-muted);
  color: var(--text-soft);
  font-size: 0.9em;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.settings-key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px;
  margin-bottom: 14px;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  background: #f0fdf4;
}

.settings-key-row code {
  color: #15803d;
  font-size: 0.74rem;
  font-weight: 700;
}

/* API docs */

.api-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 28px;
  margin-bottom: 20px;
  background:
    radial-gradient(circle at 100% 0%, rgba(37, 211, 102, 0.15), transparent 22rem),
    linear-gradient(145deg, #0b1220, #122033);
  color: #cbd5e1;
}

.api-hero h2 {
  margin-bottom: 8px;
  color: #fff;
  font-size: 1.55rem;
  letter-spacing: -0.035em;
}

.api-hero p:last-child {
  max-width: 590px;
  margin: 0;
  color: #9aabbf;
  font-size: 0.8rem;
  line-height: 1.65;
}

.api-hero .eyebrow {
  color: #86efac;
}

.base-url-box {
  display: flex;
  min-width: 280px;
  flex-direction: column;
  gap: 4px;
  padding: 13px 15px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 11px;
  background: rgba(2, 6, 23, 0.45);
}

.base-url-box span {
  color: #7f90a6;
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.base-url-box code {
  overflow: hidden;
  color: #e2e8f0;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.base-url-box .text-button {
  align-self: flex-start;
  padding: 0;
  color: #86efac;
}

.endpoint-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.endpoint-card {
  padding: 17px;
}

.method {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  padding: 0 6px;
  margin-bottom: 9px;
  border-radius: 5px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.method-post {
  background: var(--primary-soft);
  color: #15803d;
}

.method-get {
  background: var(--blue-soft);
  color: var(--blue);
}

.endpoint-card code {
  display: block;
  margin-bottom: 7px;
  overflow: hidden;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.endpoint-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

.docs-card {
  margin-bottom: 20px;
}

.docs-card h2 {
  margin-bottom: 8px;
}

.docs-card > p {
  color: var(--muted);
  font-size: 0.77rem;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border: 1px solid #1e293b;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: #0f1a2b;
  color: #7f90a6;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.code-block {
  overflow-x: auto;
  padding: 17px;
  margin: 0 0 12px;
  border: 1px solid #1e293b;
  border-radius: 10px;
  background: #0b1220;
  color: #d5e2f0;
  font-size: 0.72rem;
  line-height: 1.7;
  tab-size: 2;
}

.code-header + .code-block {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.code-small {
  font-size: 0.68rem;
}

.docs-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.71rem;
  line-height: 1.6;
}

.docs-note code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--surface-muted);
  color: var(--text-soft);
  font-size: 0.9em;
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.warning-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border-color: #fde68a;
  background: #fffbeb;
}

.warning-icon {
  display: grid;
  width: 43px;
  height: 43px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  background: #fef3c7;
  color: #b45309;
}

.warning-icon svg {
  width: 21px;
  height: 21px;
}

.warning-card h2 {
  margin-bottom: 5px;
  font-size: 0.95rem;
}

.warning-card p {
  margin: 0;
  color: #92400e;
  font-size: 0.75rem;
  line-height: 1.65;
}

/* Modals */

.modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(4px);
  animation: fade-in 0.18s ease-out;
}

.modal-card {
  position: relative;
  width: min(100%, 680px);
  max-height: min(88vh, 820px);
  overflow: auto;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: modal-enter 0.22s ease-out;
}

.modal-wide {
  width: min(100%, 760px);
}

.modal-small {
  width: min(100%, 440px);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.modal-header .eyebrow {
  margin-bottom: 4px;
}

.modal-body {
  padding: 20px 24px 24px;
}

.modal-body > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.65;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 16px 24px 22px;
  border-top: 1px solid var(--border);
}

.details-grid {
  display: grid;
  gap: 12px;
}

.detail-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #edf1f5;
}

.detail-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.detail-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.detail-value {
  overflow-wrap: anywhere;
  color: var(--text-soft);
  font-size: 0.76rem;
  line-height: 1.55;
}

.detail-value.mono {
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.69rem;
}

.detail-message {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-soft);
  white-space: pre-wrap;
}

.detail-error {
  color: #b91c1c;
}

.copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.copy-row code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Toasts */

.toast-container {
  position: fixed;
  z-index: 200;
  right: 22px;
  bottom: 22px;
  display: grid;
  width: min(100% - 44px, 360px);
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--text-soft);
  font-size: 0.76rem;
  line-height: 1.5;
  pointer-events: auto;
  animation: toast-enter 0.25s ease-out;
}

.toast::before {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--primary);
  content: "";
}

.toast-error::before {
  background: var(--red);
}

.toast-warning::before {
  background: #f59e0b;
}

.toast.toast-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Animations */

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes toast-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes soft-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive */

@media (max-width: 1220px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-grid,
  .send-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .endpoint-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.23s ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: 25px 0 70px rgba(2, 6, 23, 0.35);
  }

  .main {
    margin-left: 0;
  }

  .menu-button {
    display: grid;
  }

  .topbar {
    padding: 16px 22px;
  }

  .content {
    padding: 22px 22px 42px;
  }

  .qr-panel {
    grid-template-columns: 210px minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  body {
    font-size: 14px;
  }

  .topbar {
    min-height: 72px;
    padding: 13px 16px;
  }

  .page-heading h1 {
    font-size: 1.18rem;
  }

  .page-heading p {
    display: none;
  }

  .topbar-actions .status-pill {
    display: none;
  }

  .content {
    padding: 17px 16px 38px;
  }

  .card {
    padding: 18px;
  }

  .table-wrap {
    margin: 0 -18px -18px;
  }

  .data-table th:first-child,
  .data-table td:first-child {
    padding-left: 18px;
  }

  .data-table th:last-child,
  .data-table td:last-child {
    padding-right: 18px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stat-card {
    gap: 10px;
    padding: 15px;
  }

  .stat-icon {
    width: 39px;
    height: 39px;
    border-radius: 11px;
  }

  .stat-icon svg {
    width: 19px;
    height: 19px;
  }

  .stat-card h2 {
    font-size: 1.3rem;
  }

  .card-header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .qr-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .qr-frame {
    width: min(100%, 260px);
    margin: 0 auto;
  }

  .account-panel,
  .disconnected-panel {
    flex-wrap: wrap;
  }

  .account-panel .button-danger-ghost,
  .disconnected-panel .button {
    width: 100%;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .search-field {
    grid-column: 1 / -1;
  }

  .toolbar select {
    width: 100%;
    min-width: 0;
  }

  .toolbar .button {
    grid-column: 1 / -1;
  }

  .table-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .pagination {
    width: 100%;
    justify-content: space-between;
  }

  .api-hero {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
    padding: 22px;
  }

  .base-url-box {
    min-width: 0;
  }

  .endpoint-grid,
  .docs-grid,
  .settings-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .modal-header,
  .modal-body,
  .modal-actions {
    padding-right: 18px;
    padding-left: 18px;
  }
}

@media (max-width: 500px) {
  .login-card {
    padding: 24px 20px;
    border-radius: 20px;
  }

  .login-heading h1 {
    font-size: 1.5rem;
  }

  .segment span {
    font-size: 0.68rem;
  }

  .segment span svg {
    display: none;
  }

  .stats-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat-card {
    padding: 14px 16px;
  }

  .form-actions .button {
    width: 100%;
  }

  .account-panel {
    align-items: flex-start;
  }

  .account-avatar {
    width: 44px;
    height: 44px;
  }

  .toast-container {
    right: 12px;
    bottom: 12px;
    width: calc(100% - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
