:root {
  /* Blue-graphite surfaces */
  --bg: #0e1420;
  --bg-elevated: #131b29;
  --sidebar-top: #0c121d;
  --sidebar-bottom: #101827;
  --panel: #151d2c;
  --panel-2: #1a2434;
  --panel-header: #1b2536;
  --hover: #1f2b3d;
  --active-soft: rgba(24, 144, 255, 0.12);

  /* Lines */
  --line: #26334a;
  --line-soft: #1d283a;
  --line-strong: #33425c;

  /* Text */
  --text: #e9eff8;
  --text-strong: #f6f9ff;
  --text-secondary: #aebbd0;
  --muted: #7c8ba5;

  /* Brand */
  --blue: #1890ff;
  --blue-hover: #40a9ff;
  --blue-2: #0b6bcb;
  --blue-soft: rgba(24, 144, 255, 0.16);
  --blue-glow: rgba(24, 144, 255, 0.28);
  --grad-primary: linear-gradient(135deg, #2f9dff 0%, #1478e6 100%);
  --grad-accent: linear-gradient(135deg, #4dabf7 0%, #1890ff 55%, #0b6bcb 100%);

  /* Semantics */
  --green: #3ec06a;
  --green-soft: rgba(62, 192, 106, 0.14);
  --amber: #f5b544;
  --amber-soft: rgba(245, 181, 68, 0.14);
  --red: #f26d6d;
  --red-soft: rgba(242, 109, 109, 0.14);

  /* Geometry */
  --radius: 6px;
  --radius-lg: 10px;
  --radius-pill: 999px;
  --sidebar-width: 232px;
  --control-height: 34px;
  --row-height: 40px;

  /* Depth */
  --shadow-sm: 0 1px 2px rgba(4, 8, 15, 0.4);
  --shadow-md: 0 6px 18px rgba(4, 8, 15, 0.35);
  --shadow-lg: 0 22px 60px rgba(3, 6, 12, 0.55);
  --shadow-primary: 0 6px 18px rgba(20, 120, 230, 0.35);

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --fast: 120ms var(--ease);
  --normal: 200ms var(--ease);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, "SF Mono", monospace;
  --font-size: 13px;
  --font-size-sm: 12px;
  --font-size-xs: 11px;
  --font-size-title: 21px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--font-size);
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 78% -12%, rgba(24, 144, 255, 0.10), transparent 62%),
    radial-gradient(760px 420px at -6% 4%, rgba(77, 171, 247, 0.07), transparent 58%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: var(--font-size-sm); }
.tiny { font-size: var(--font-size-xs); color: var(--muted); word-break: break-all; }
.hidden { display: none !important; }
.center { text-align: center; }
.block { width: 100%; }
.error { color: var(--red); margin: 0; }

::selection { background: var(--blue-soft); color: var(--text-strong); }

/* ─── Shell ─── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--sidebar-top) 0%, var(--sidebar-bottom) 100%);
  border-right: 1px solid var(--line-soft);
  color: var(--text);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.02);
}

.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 2px 4px 4px;
  position: relative;
}
.sidebar-close {
  display: none;
  margin-left: auto;
  flex-shrink: 0;
}
.sidebar-backdrop {
  display: none;
}
.menu-toggle {
  display: none !important;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  flex-shrink: 0;
}
.menu-toggle-bars,
.menu-toggle-bars::before,
.menu-toggle-bars::after {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  position: relative;
}
.menu-toggle-bars::before,
.menu-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
}
.menu-toggle-bars::before { top: -6px; }
.menu-toggle-bars::after { top: 6px; }
.topbar-titles { min-width: 0; }
.brand strong {
  display: block;
  color: var(--text-strong);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.brand .muted { font-size: 11px; }
.logo {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: #1E4DFF;
  color: #fff;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(30, 77, 255, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.logo img,
.home-btn img,
.install-app-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.logo svg { display: block; }
.logo-home {
  cursor: pointer;
  transition: transform var(--fast), box-shadow var(--fast);
}
.logo-home:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(30, 77, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.home-btn {
  display: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
}
.home-btn img {
  width: 100%;
  height: 100%;
}

.sidebar-cta {
  display: flex !important;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 14px !important;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.nav { display: grid; gap: 3px; }
.nav-section {
  margin: 14px 10px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #64748f;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  position: relative;
  font-size: 13px;
  transition: background var(--fast), color var(--fast), transform var(--fast);
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-strong);
}
.nav-item:active { transform: translateY(1px); }
.nav-item.active {
  background: linear-gradient(90deg, var(--active-soft), rgba(24, 144, 255, 0.03));
  color: var(--text-strong);
  font-weight: 600;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--grad-accent);
  box-shadow: 0 0 10px var(--blue-glow);
}
.nav-item.active .ico { color: var(--blue-hover); opacity: 1; }
.ico {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  opacity: 0.75;
  transition: opacity var(--fast), color var(--fast);
}
.nav-item:hover .ico { opacity: 1; }
.ico svg { width: 16px; height: 16px; fill: currentColor; }
.ico-api svg circle {
  fill: rgba(24, 144, 255, 0.18);
  transition: fill var(--fast);
}
.nav-item.active .ico-api svg circle,
.nav-item:hover .ico-api svg circle {
  fill: rgba(24, 144, 255, 0.32);
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--line-soft);
}
.user-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
  flex-shrink: 0;
}
.user-name {
  font-size: 13px;
  color: var(--text);
  font-weight: 550;
}

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

/* ─── Topbar ─── */
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(19, 27, 41, 0.96), rgba(14, 20, 32, 0.9));
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 62px;
}
.topbar-left { min-width: 0; }
.topbar h1 {
  margin: 0;
  font-size: var(--font-size-title);
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--text-strong);
  line-height: 1.2;
}
.topbar-sub {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 12px;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6b7a94;
  flex-shrink: 0;
}
.dot.ok {
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}
.dot.bad {
  background: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}

.notify-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
  border-color: rgba(72, 169, 255, 0.45);
  color: #d7ebff;
}
.notify-toggle-btn.is-on {
  border-color: rgba(62, 192, 106, 0.55);
  background: linear-gradient(180deg, rgba(62, 192, 106, 0.22), rgba(36, 140, 70, 0.1));
  color: #d8f5e2;
}
.notify-toggle-ico {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  position: relative;
}
.notify-toggle-ico::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 2px;
  width: 2px;
  height: 6px;
  margin-left: -1px;
  border-radius: 1px;
  background: currentColor;
}

.push-settings-card {
  margin-top: 16px;
}
.push-settings-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.push-settings-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.push-settings-status .dot.ok {
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}
.push-settings-status .dot.bad {
  background: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft);
}

.lang-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 3px;
}
.lang-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  min-width: 36px;
  transition: color var(--fast), background var(--fast);
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: var(--shadow-primary);
}

.check-opt {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 11px;
  height: 30px;
  cursor: pointer;
  transition: border-color var(--fast), color var(--fast);
}
.check-opt:hover { border-color: var(--line-strong); color: var(--text); }
.check-opt input { accent-color: var(--blue); }

/* ─── Stat strip ─── */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  padding: 16px 20px 4px;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(26, 36, 52, 0.92), rgba(17, 24, 37, 0.92));
  box-shadow: var(--shadow-sm);
  transition: border-color var(--fast), transform var(--fast), box-shadow var(--fast);
}
.stat-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.stat-ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid transparent;
}
.stat-ico svg { width: 17px; height: 17px; fill: currentColor; }
.stat-ico.blue {
  color: var(--blue-hover);
  background: var(--blue-soft);
  border-color: rgba(24, 144, 255, 0.28);
}
.stat-ico.green {
  color: #6fdc95;
  background: var(--green-soft);
  border-color: rgba(62, 192, 106, 0.28);
}
.stat-ico.violet {
  color: #a99cf7;
  background: rgba(150, 134, 247, 0.14);
  border-color: rgba(150, 134, 247, 0.28);
}
.stat-ico.amber {
  color: #f7c56b;
  background: var(--amber-soft);
  border-color: rgba(245, 181, 68, 0.28);
}
.stat-body { display: grid; gap: 1px; min-width: 0; }
.stat-label {
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.stat-value {
  font-size: 20px;
  font-weight: 650;
  color: var(--text-strong);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

/* ─── Batch registration summaries (Logs tab) ─── */
.batch-summary-panel {
  padding: 16px 20px 0;
}
.batch-summary-panel.hidden { display: none; }
.batch-summary-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.batch-summary-head strong {
  font-size: 14px;
  color: var(--text-strong);
}
.batch-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.batch-summary-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(26, 36, 52, 0.92), rgba(17, 24, 37, 0.92));
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
  display: grid;
  gap: 12px;
}
.batch-summary-card.latest {
  border-color: rgba(24, 144, 255, 0.35);
  box-shadow: 0 0 0 1px rgba(24, 144, 255, 0.08), var(--shadow-sm);
}
.batch-summary-card-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.batch-id {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
}
.batch-meta {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}
.batch-badge {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.batch-badge.done {
  color: #6fdc95;
  background: var(--green-soft);
  border-color: rgba(62, 192, 106, 0.28);
}
.batch-badge.running {
  color: #f7c56b;
  background: var(--amber-soft);
  border-color: rgba(245, 181, 68, 0.28);
}
.batch-summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 8px;
}
.batch-stat {
  display: grid;
  gap: 2px;
  padding: 10px 8px;
  border-radius: 10px;
  text-align: center;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.02);
}
.batch-stat-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.batch-stat-label {
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.batch-stat.success .batch-stat-value { color: #6fdc95; }
.batch-stat.failed .batch-stat-value { color: #ff8a8a; }
.batch-stat.stopped .batch-stat-value { color: #f7c56b; }
.batch-stat.total .batch-stat-value { color: var(--text-strong); }

.batch-summary-extra {
  display: grid;
  gap: 10px;
  padding-top: 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.batch-summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.batch-extra-label {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.batch-extra-value {
  font-size: 12px;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.batch-summary-sms {
  display: grid;
  gap: 8px;
  padding: 10px 11px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.02);
}
.batch-sms-spend {
  display: grid;
  gap: 6px;
}
.batch-sms-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}
.batch-sms-label {
  color: var(--muted);
  font-weight: 600;
}
.batch-sms-value {
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.batch-summary-providers {
  display: grid;
  gap: 6px;
}
.batch-provider-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 5px;
}
.batch-provider-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px;
  align-items: baseline;
  font-size: 11px;
}
.batch-provider-rank {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.batch-provider-name {
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.batch-provider-meta {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.batch-summary-timing {
  display: grid;
  gap: 4px;
}

/* ─── PWA install banner ─── */
.install-app-banner {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 1200;
  display: grid;
  grid-template-columns: 40px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(30, 77, 255, 0.35);
  background: linear-gradient(145deg, rgba(24, 36, 58, 0.96), rgba(14, 20, 32, 0.96));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
}
.install-app-banner.hidden { display: none; }
.install-app-logo {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  box-shadow: 0 4px 12px rgba(30, 77, 255, 0.35);
}
.install-app-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.install-app-copy strong {
  font-size: 13px;
  color: var(--text-strong);
}
.install-app-copy small {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}
.install-app-close {
  width: 32px;
  height: 32px;
}

@media (display-mode: standalone) {
  body {
    padding-top: env(safe-area-inset-top);
  }
  .install-app-banner { display: none !important; }
}

/* ─── API settings ─── */
.api-settings-card {
  max-width: 720px;
  padding: 20px;
  display: grid;
  gap: 16px;
}
.api-settings-form {
  margin-top: 4px;
}
.api-settings-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
}

/* ─── Toolbars ─── */
.toolbar, .toolbar.inline {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(19, 27, 41, 0.5);
}
#profilesToolbar {
  display: grid;
  gap: 10px;
  justify-content: stretch;
}
.toolbar-filters,
.toolbar-actions,
.toolbar-left,
.toolbar-right,
.pager-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.toolbar.inline { justify-content: flex-start; }
.toolbar.inline > .btn.danger { margin-left: auto; }
.toolbar-filters { width: 100%; }
.toolbar-filters input[type="search"] {
  flex: 1;
  min-width: 240px;
  padding-left: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%237c8ba5' stroke-width='1.6'%3E%3Ccircle cx='7' cy='7' r='4.4'/%3E%3Cpath d='M10.4 10.4 14 14' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 11px center;
  background-size: 15px 15px;
}
.toolbar-actions { width: 100%; justify-content: space-between; }
.task-toolbar { padding: 12px 18px; }
.salvaged-mail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 6px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(24, 144, 255, 0.06);
}
.salvaged-mail-actions .btn {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 12px;
}
.tool-sep {
  width: 1px;
  height: 20px;
  background: var(--line);
  margin: 0 3px;
}
.selection-chip {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: color var(--fast), border-color var(--fast), background var(--fast);
}
.selection-chip.on {
  color: #8dc7ff;
  border-color: rgba(24, 144, 255, 0.4);
  background: var(--blue-soft);
}

input, select, textarea {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 11px;
  height: var(--control-height);
  outline: none;
  color: var(--text);
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}
input::placeholder, textarea::placeholder { color: #64748f; }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
textarea {
  height: auto;
  padding: 9px 11px;
  resize: vertical;
  line-height: 1.5;
}
select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%237c8ba5' stroke-width='1.7'%3E%3Cpath d='m4 6.5 4 4 4-4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 15px 15px;
}
.toolbar-right input,
.toolbar-right select,
.toolbar.inline input,
.toolbar-filters input,
.toolbar-filters select { min-width: 150px; }
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
  background: var(--panel-2);
}

/* ─── Buttons ─── */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-radius: var(--radius);
  height: var(--control-height);
  padding: 0 13px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition: transform var(--fast), border-color var(--fast), background var(--fast), box-shadow var(--fast), color var(--fast);
}
.btn:hover {
  border-color: var(--line-strong);
  background: linear-gradient(180deg, var(--hover), var(--panel-2));
  color: var(--text-strong);
}
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn.primary {
  background: var(--grad-primary);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow-primary);
}
.btn.primary:hover {
  background: linear-gradient(135deg, #48a9ff 0%, #1a84f0 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 22px rgba(20, 120, 230, 0.45);
}
.btn.success {
  background: linear-gradient(135deg, #47cd7a 0%, #2ea75c 100%);
  border-color: transparent;
  color: #06231a;
  font-weight: 650;
  box-shadow: 0 6px 18px rgba(46, 167, 92, 0.32);
}
.btn.success:hover {
  background: linear-gradient(135deg, #56d886 0%, #33b464 100%);
  color: #06231a;
}
.btn.success.outline {
  background: rgba(46, 167, 92, 0.12);
  border-color: rgba(46, 167, 92, 0.45);
  color: #7dffb0;
  box-shadow: none;
}
.btn.warn {
  background: linear-gradient(135deg, #f0b429 0%, #d97706 100%);
  border-color: transparent;
  color: #1a1205;
  font-weight: 650;
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.28);
}
.btn.warn:hover {
  background: linear-gradient(135deg, #f6c44a 0%, #e08a12 100%);
  color: #1a1205;
}
.btn.danger { color: var(--red); }
.btn.danger:not(.outline) {
  background: linear-gradient(135deg, #f06d6d 0%, #d64545 100%);
  border-color: transparent;
  color: #fff;
  font-weight: 650;
  box-shadow: 0 6px 18px rgba(214, 69, 69, 0.28);
}
.batch-run-controls {
  display: inline-grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
    rgba(10, 14, 22, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 8px 20px rgba(0, 0, 0, 0.18);
  min-width: min(420px, 100%);
}
.batch-run-controls.compact {
  min-width: min(360px, 100%);
  padding: 3px;
  border-radius: 12px;
}
.run-ctrl {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1;
  cursor: pointer;
  color: #f4f7fb;
  background: rgba(255, 255, 255, 0.04);
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    opacity 0.15s ease;
  white-space: nowrap;
}
.run-ctrl:hover:not(:disabled) {
  transform: translateY(-1px);
}
.run-ctrl:active:not(:disabled) {
  transform: translateY(0);
}
.run-ctrl:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: grayscale(0.25);
}
.run-ctrl-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}
.run-ctrl-ico svg {
  display: block;
  fill: currentColor;
}
.run-ctrl-label {
  display: inline-block;
}
.run-ctrl-pause {
  background: linear-gradient(180deg, rgba(240, 180, 41, 0.28), rgba(217, 119, 6, 0.16));
  border-color: rgba(240, 180, 41, 0.35);
  color: #ffd57a;
}
.run-ctrl-pause:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(240, 180, 41, 0.4), rgba(217, 119, 6, 0.24));
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.22);
}
.run-ctrl-resume {
  background: linear-gradient(180deg, rgba(71, 205, 122, 0.28), rgba(46, 167, 92, 0.14));
  border-color: rgba(71, 205, 122, 0.35);
  color: #8dffb8;
}
.run-ctrl-resume:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(71, 205, 122, 0.4), rgba(46, 167, 92, 0.22));
  box-shadow: 0 6px 16px rgba(46, 167, 92, 0.22);
}
.run-ctrl-stop {
  background: linear-gradient(180deg, rgba(242, 109, 109, 0.3), rgba(214, 69, 69, 0.16));
  border-color: rgba(242, 109, 109, 0.4);
  color: #ff9d9d;
}
.run-ctrl-stop:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(242, 109, 109, 0.42), rgba(214, 69, 69, 0.24));
  box-shadow: 0 6px 16px rgba(214, 69, 69, 0.22);
}
.run-ctrl-start {
  background: linear-gradient(180deg, rgba(72, 169, 255, 0.3), rgba(26, 132, 240, 0.16));
  border-color: rgba(72, 169, 255, 0.4);
  color: #9fd0ff;
}
.run-ctrl-start:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(72, 169, 255, 0.42), rgba(26, 132, 240, 0.24));
  box-shadow: 0 6px 16px rgba(26, 132, 240, 0.22);
}
.btn.danger.outline {
  border-color: rgba(242, 109, 109, 0.4);
  background: var(--red-soft);
  color: #ff9a9a;
}
.btn.danger.outline:hover {
  background: rgba(242, 109, 109, 0.2);
  border-color: rgba(242, 109, 109, 0.6);
  color: #ffb4b4;
}
.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text-secondary);
  box-shadow: none;
}
.btn.ghost:hover { background: rgba(255, 255, 255, 0.04); }
.btn.sm { height: 28px; padding: 0 11px; font-size: 12px; }
.btn.tiny { height: 25px; padding: 0 9px; font-size: 11.5px; }
.btn.icon-btn-tool { min-width: 76px; }

/* ─── Panels / tables ─── */
.panel {
  background: linear-gradient(180deg, rgba(21, 29, 44, 0.96), rgba(17, 24, 37, 0.96));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 240px;
  margin: 16px 20px 20px;
  animation: panelIn 220ms var(--ease);
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.table-wrap {
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
.data-table th,
.data-table td {
  padding: 0 12px;
  height: var(--row-height);
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, var(--panel-header), #18212f);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}
.data-table tbody tr { transition: background var(--fast); }
.data-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.035);
}
.data-table tbody tr.is-selected td {
  background: rgba(56, 132, 214, 0.16);
  border-bottom-color: rgba(90, 160, 230, 0.22);
}
.data-table tbody tr.is-selected:hover td {
  background: rgba(56, 132, 214, 0.22);
}
.data-table tbody tr.is-selected td:first-child {
  box-shadow: inset 3px 0 0 #5aa8ea;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table th:last-child,
.data-table td:last-child { max-width: none; overflow: visible; }
.data-table td.center { text-align: center; }
.data-table td.muted,
.data-table td.error {
  height: 92px;
  font-size: 13px;
}
.col-check {
  width: 44px;
  max-width: 44px;
  min-width: 44px;
  padding: 0 !important;
  text-align: center !important;
  vertical-align: middle;
}
.data-table input[type="checkbox"].row-check,
.data-table input[type="checkbox"].proxy-check,
.col-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1.5px solid #6b7b94;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  vertical-align: middle;
  transition: border-color var(--fast), background var(--fast);
}
.data-table input[type="checkbox"].row-check:hover,
.data-table input[type="checkbox"].proxy-check:hover,
.col-check input[type="checkbox"]:hover {
  border-color: #8aa0bd;
  background: rgba(255, 255, 255, 0.07);
}
.data-table input[type="checkbox"].row-check:checked,
.data-table input[type="checkbox"].proxy-check:checked,
.col-check input[type="checkbox"]:checked {
  background: #4f8fd6;
  border-color: #4f8fd6;
}
.data-table input[type="checkbox"].row-check:checked::after,
.data-table input[type="checkbox"].proxy-check:checked::after,
.col-check input[type="checkbox"]:checked::after {
  content: "";
  box-sizing: border-box;
  width: 4px;
  height: 8px;
  margin-top: -1px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.row-actions { display: flex; gap: 6px; align-items: center; }

.fp-os-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  border: 1px solid transparent;
  white-space: nowrap;
}
.fp-os-badge .fp-os-icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  flex: 0 0 14px;
}
.fp-os-badge.android {
  color: #b7f0c4;
  background: rgba(61, 220, 132, 0.12);
  border-color: rgba(61, 220, 132, 0.28);
}
.fp-os-badge.windows {
  color: #9ec8ff;
  background: rgba(79, 143, 214, 0.14);
  border-color: rgba(79, 143, 214, 0.3);
}
.fp-os-badge.unknown {
  color: #9aa8bc;
  background: rgba(154, 168, 188, 0.1);
  border-color: rgba(154, 168, 188, 0.22);
}
.fp-os-icon.fp-os-android {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%233ddc84'%3E%3Cpath d='M17.6 9.48l1.84-3.18a.5.5 0 10-.87-.5l-1.86 3.22A7.9 7.9 0 0012 8c-1.5 0-2.9.4-4.1 1.12L6.03 5.8a.5.5 0 10-.87.5L7 9.48C4.53 11.05 3 13.74 3 16.8v.7c0 .83.67 1.5 1.5 1.5h15c.83 0 1.5-.67 1.5-1.5v-.7c0-3.06-1.53-5.75-4-7.32zM8.5 14.5a1 1 0 110-2 1 1 0 010 2zm7 0a1 1 0 110-2 1 1 0 010 2z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}
.fp-os-icon.fp-os-windows {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2300a4ef'%3E%3Cpath d='M3 5.5l8.2-1.15V11H3V5.5zm9.2-1.3L21 3v8H12.2V4.2zM3 12.5h8.2V19.7L3 18.5v-6zm9.2 0H21V21l-8.8-1.25V12.5z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}
.fp-os-icon.fp-os-unknown {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%239aa8bc'%3E%3Ccircle cx='12' cy='12' r='9' fill='none' stroke='%239aa8bc' stroke-width='2'/%3E%3Cpath d='M12 17h.01M10.5 10a1.5 1.5 0 112.6 1c-.5.5-1.1.8-1.1 1.7V14' stroke='%239aa8bc' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.fingerprint-os-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.fingerprint-os-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, background .15s, transform .15s;
}
.fingerprint-os-card:hover {
  border-color: rgba(79, 143, 214, 0.55);
  background: rgba(79, 143, 214, 0.08);
  transform: translateY(-1px);
}
.fingerprint-os-card .fp-os-icon {
  width: 28px;
  height: 28px;
}
.fingerprint-os-card strong { font-size: 15px; }
.fingerprint-os-card small { color: #9aa8bc; }

code {
  color: #8dc7ff;
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(24, 144, 255, 0.09);
  border: 1px solid rgba(24, 144, 255, 0.16);
  border-radius: 4px;
  padding: 1px 6px;
}

.badge,
.task-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  letter-spacing: 0.02em;
  min-height: 21px;
}
.badge::before,
.task-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}
.badge.on,
.task-status.running,
.task-status.done {
  color: #6fdc95;
  border-color: rgba(62, 192, 106, 0.35);
  background: var(--green-soft);
}
.badge.off { color: var(--muted); }
.task-status.queued {
  color: #f7c56b;
  border-color: rgba(245, 181, 68, 0.35);
  background: var(--amber-soft);
}
.task-status.paused {
  color: #c3cee0;
  border-color: rgba(195, 206, 224, 0.25);
}
.task-status.stopped,
.task-status.failed {
  color: #ff9a9a;
  border-color: rgba(242, 109, 109, 0.35);
  background: var(--red-soft);
}
.task-status.running::before { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--line-soft);
  background: rgba(19, 27, 41, 0.7);
  min-height: 48px;
}
.pager-btns select { height: 30px; min-width: 104px; }
.pager .btn { height: 30px; }

/* ─── Logs ─── */
.logs {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  flex: 1 1 auto;
  min-height: 200px;
  overflow: auto;
  padding: 14px 16px;
  color: #c4d1e4;
  background:
    linear-gradient(180deg, rgba(11, 16, 26, 0.9), rgba(13, 19, 30, 0.9));
}
.logs > div { padding: 1px 0; }
.logs > div:hover { background: rgba(255, 255, 255, 0.03); }
.logs .ts { color: #6b7a94; }
.logs .ok { color: #6fdc95; }
.logs .err { color: #ff9a9a; }
.logs .log-header {
  position: sticky;
  top: -14px;
  margin: -14px -16px 12px;
  padding: 11px 16px;
  background: linear-gradient(180deg, var(--panel-header), #18212f);
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font);
  box-shadow: var(--shadow-sm);
}
.logs .log-header b { color: var(--blue-hover); }

/* ─── Modals ─── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(6, 10, 18, 0.66);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 24px;
  animation: fadeIn 160ms var(--ease);
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-card {
  width: min(540px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #1a2434, #141d2c);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: cardIn 200ms var(--ease);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.modal-card.wide { width: min(780px, 100%); }
.modal-card.xwide { width: min(960px, 100%); }
.profile-create-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100vh - 120px);
}
.profile-tabs {
  display: flex;
  gap: 6px;
  padding: 12px 16px 0;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  background: #18212f;
}
.profile-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
}
.profile-tab:hover { color: var(--text); background: var(--hover); }
.profile-tab.active {
  color: var(--text-strong);
  background: linear-gradient(180deg, #243247, #1a2434);
  border: 1px solid var(--line);
  border-bottom-color: transparent;
}
.profile-tab-panels {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.profile-tab-panel { padding: 16px 18px; }
.profile-tab-panel.hidden { display: none !important; }
.profile-form-actions {
  padding: 14px 18px;
  margin: 0;
  border-top: 1px solid var(--line);
  background: #152032;
  flex-shrink: 0;
}
.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 8px 0 2px;
}
.checkbox-row .check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.checkbox-row .check input { width: auto; }
.modal-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-header), #18212f);
  flex-shrink: 0;
}
.modal-card h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text-strong);
}
.icon-btn {
  border: 0;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  transition: color var(--fast), background var(--fast);
}
.icon-btn:hover { color: var(--text); background: var(--hover); }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 18px;
  overflow-y: auto;
}
.form-grid label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.form-grid label small { color: var(--muted); font-weight: 400; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid input,
.form-grid select,
.form-grid textarea { width: 100%; }
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--line-soft);
  margin-top: 2px;
  padding-top: 14px;
}
.form-section {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
  grid-column: 1 / -1;
}
.selected-profiles {
  margin-top: 8px;
  font-size: 13px;
  color: #8dc7ff;
  display: grid;
  gap: 2px;
}
.selected-profile-row { padding: 2px 0; }

/* ─── Auth ─── */
.auth-page {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  position: relative;
  width: min(420px, 100%);
  background: linear-gradient(180deg, #1a2434, #131c2b);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 30px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: cardIn 260ms var(--ease);
}
.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--grad-accent);
}
.auth-card .brand { margin-bottom: 10px; }
.stack { display: grid; gap: 16px; margin-top: 20px; }
.stack label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}
.stack .btn.primary { height: 38px; font-size: 14px; }
.auth-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.auth-top .lang-switch { width: 112px; }

/* ─── Feature blocks ─── */
.info-box {
  background: linear-gradient(135deg, rgba(24, 144, 255, 0.08), rgba(26, 36, 52, 0.6));
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius);
  padding: 13px 15px;
  font-size: 13px;
  line-height: 1.55;
}
.info-box strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text-strong);
  font-weight: 600;
}
.info-box ul { margin: 0; padding-left: 18px; }
.info-box li { margin: 4px 0; color: var(--muted); }

.mobile-reg-card {
  margin: 4px 0 10px;
  background: linear-gradient(135deg, rgba(24, 144, 255, 0.07), rgba(26, 36, 52, 0.55));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.fp-switch-timing-box {
  display: grid;
  gap: 10px;
  margin: 4px 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(28, 40, 60, 0.7), rgba(18, 26, 40, 0.85));
}
.fp-switch-timing-box.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}
.fp-switch-timing-head {
  display: grid;
  gap: 2px;
}
.fp-switch-timing-head strong {
  font-size: 13px;
}
.fp-switch-timing-head small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}
.fp-switch-timing-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.fp-timing-btn {
  appearance: none;
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.fp-timing-btn:hover {
  border-color: rgba(72, 169, 255, 0.35);
  color: var(--text);
}
.fp-timing-btn.is-active {
  border-color: rgba(72, 169, 255, 0.55);
  background: linear-gradient(180deg, rgba(72, 169, 255, 0.22), rgba(26, 132, 240, 0.1));
  color: #cfe6ff;
  box-shadow: 0 6px 16px rgba(26, 132, 240, 0.16);
}
.fp-timing-title {
  font-size: 13px;
  font-weight: 700;
}
.fp-timing-desc {
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
}
.fp-timing-btn.is-active .fp-timing-desc {
  color: rgba(207, 230, 255, 0.78);
}
@media (max-width: 720px) {
  .fp-switch-timing-toggle {
    grid-template-columns: 1fr;
  }
}
.scenario-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 13px;
}
.scenario-chip strong {
  color: var(--text);
  font-weight: 650;
}
.proxy-ip-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(28, 40, 60, 0.7), rgba(18, 26, 40, 0.85));
}
.proxy-ip-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.proxy-ip-toggle:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
}
.proxy-ip-toggle.is-on {
  border-color: rgba(24, 144, 255, 0.55);
  background: rgba(24, 144, 255, 0.12);
  box-shadow: 0 8px 20px rgba(24, 144, 255, 0.12);
}
.proxy-ip-switch {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #3a465c;
  transition: background 0.15s ease;
}
.proxy-ip-toggle.is-on .proxy-ip-switch {
  background: linear-gradient(135deg, #3aa0ff, #1877f2);
}
.proxy-ip-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}
.proxy-ip-toggle.is-on .proxy-ip-knob {
  transform: translateX(18px);
}
.proxy-ip-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.proxy-ip-copy strong {
  font-size: 13.5px;
  font-weight: 650;
}
.proxy-ip-copy small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.proxy-ip-state {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.proxy-ip-toggle.is-on .proxy-ip-state {
  color: #8ec8ff;
}
.proxy-ip-interval {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 0 4px 2px;
}
.proxy-ip-interval-label {
  color: var(--text-secondary);
  font-size: 13px;
}
.proxy-ip-interval input[type="number"] {
  width: 72px;
  height: 34px;
  text-align: center;
  font-weight: 650;
}
.proxy-ip-interval small {
  flex: 1 1 100%;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.greedy-balance-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-secondary);
}
.greedy-balance-row strong {
  color: var(--text-strong);
  font-size: 18px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.greedy-balance-row strong.ok { color: #6fdc95; }
.greedy-balance-row strong.warn { color: #f7c56b; }
.greedy-balance-row strong.err { color: #ff9a9a; }

.greedy-provider-box {
  display: grid;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(26, 36, 52, 0.55);
}
.greedy-provider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.greedy-provider-header .toolbar.inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
#btnGreedyCountryPoland.active,
#btnGreedyCountryUkraine.active {
  border-color: var(--blue);
  color: var(--text-strong);
  background: color-mix(in srgb, var(--blue) 22%, transparent);
}
.greedy-provider-header > div { display: grid; gap: 4px; }
.greedy-provider-header strong { color: var(--text-strong); font-weight: 600; }
.greedy-provider-header small { color: var(--muted); }
.greedy-provider-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  max-height: 290px;
  overflow-y: auto;
  padding-right: 2px;
}
.greedy-provider-item {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 11px;
  padding: 11px;
  color: var(--text);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  cursor: pointer;
  transition: border-color var(--fast), background var(--fast), transform var(--fast), box-shadow var(--fast);
}
.greedy-provider-item:hover {
  border-color: var(--blue);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.greedy-provider-item.selected {
  border-color: var(--blue);
  background: linear-gradient(135deg, rgba(24, 144, 255, 0.18), rgba(26, 36, 52, 0.8));
  box-shadow: 0 0 0 1px rgba(24, 144, 255, 0.25), var(--shadow-md);
}
.provider-priority {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--muted);
}
.greedy-provider-item.selected .provider-priority {
  color: #fff;
  background: var(--grad-primary);
  border-color: transparent;
  box-shadow: var(--shadow-primary);
}
.provider-main { display: grid; gap: 2px; min-width: 0; }
.provider-main strong { font-weight: 600; font-size: 13px; }
.provider-main small { color: var(--muted); font-size: 11px; }
.provider-price {
  font-weight: 700;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.hero-offers-box {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(15, 22, 34, 0.55);
}
.hero-offers-box.hidden { display: none; }
.hero-offers-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.hero-offers-head strong { color: var(--text-strong); font-weight: 600; }
.hero-offers-head small { color: var(--muted); }
.hero-offers-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}
.hero-offer-item {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  text-align: left;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  cursor: pointer;
  transition: border-color var(--fast), background var(--fast);
}
.hero-offer-item:hover { border-color: var(--blue); }
.hero-offer-item.selected {
  border-color: var(--blue);
  background: linear-gradient(135deg, rgba(24, 144, 255, 0.18), rgba(26, 36, 52, 0.8));
}
.hero-offer-item .provider-priority {
  width: 24px;
  height: 24px;
  font-size: 11px;
}
.hero-offer-item .offer-price {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-strong);
}
.hero-offer-item .offer-count {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.greedy-provider-item.focused {
  border-color: color-mix(in srgb, var(--blue) 70%, var(--line));
  box-shadow: 0 0 0 1px rgba(24, 144, 255, 0.2);
}

/* Scrollbars */
.table-wrap::-webkit-scrollbar,
.logs::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.form-grid::-webkit-scrollbar,
.greedy-provider-list::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
.table-wrap::-webkit-scrollbar-thumb,
.logs::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.form-grid::-webkit-scrollbar-thumb,
.greedy-provider-list::-webkit-scrollbar-thumb {
  background: #2c3a52;
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  background-clip: padding-box;
}
.table-wrap::-webkit-scrollbar-thumb:hover,
.logs::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover,
.greedy-provider-list::-webkit-scrollbar-thumb:hover {
  background: #3b4d6b;
  background-clip: padding-box;
}
.table-wrap::-webkit-scrollbar-track,
.logs::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track,
.greedy-provider-list::-webkit-scrollbar-track { background: transparent; }

.verification-section.hidden { display: none !important; }

/* ─── Register modal (compact) ─── */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.register-modal-card {
  width: min(720px, 100%);
}
.register-batch-form {
  gap: 12px;
  padding: 14px 16px 16px;
}
.reg-method-select-fallback {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
.reg-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.reg-stat-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(24, 144, 255, 0.12), rgba(26, 36, 52, 0.55));
}
.reg-stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: #8ec8ff;
  font-variant-numeric: tabular-nums;
  min-width: 1.4ch;
}
.reg-stat-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.reg-stat-meta strong {
  font-size: 13px;
  color: var(--text-strong);
  font-weight: 650;
}
.reg-stat-meta small {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.3;
}
.reg-scenario-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.reg-scenario-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6fdc95;
  box-shadow: 0 0 0 3px rgba(111, 220, 149, 0.18);
}
.reg-block {
  display: grid;
  gap: 10px;
}
.reg-block-head {
  display: grid;
  gap: 2px;
}
.reg-block-head strong {
  font-size: 13px;
  color: var(--text-strong);
  font-weight: 650;
}
.reg-block-head small {
  color: var(--muted);
  font-size: 12px;
}
.reg-method-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.reg-method-card {
  display: grid;
  gap: 4px;
  align-content: start;
  min-height: 0;
  margin: 0;
  padding: 10px 11px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(30, 42, 60, 0.85), rgba(18, 26, 40, 0.9));
  color: var(--text);
  cursor: pointer;
  transition: border-color 140ms var(--ease), background 140ms var(--ease), box-shadow 140ms var(--ease), transform 140ms var(--ease);
}
.reg-method-card:hover {
  border-color: rgba(24, 144, 255, 0.45);
  transform: translateY(-1px);
}
.reg-method-card.is-active {
  border-color: rgba(24, 144, 255, 0.7);
  background: linear-gradient(180deg, rgba(24, 144, 255, 0.18), rgba(24, 40, 64, 0.92));
  box-shadow: 0 8px 18px rgba(24, 144, 255, 0.12);
}
.reg-method-badge {
  display: inline-flex;
  width: fit-content;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9ecfff;
  background: rgba(24, 144, 255, 0.16);
}
.reg-method-badge.sms {
  color: #b8f0c8;
  background: rgba(111, 220, 149, 0.14);
}
.reg-method-card strong {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-strong);
}
.reg-method-card small {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
}
.reg-mail-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(24, 144, 255, 0.07), rgba(26, 36, 52, 0.55));
}
.reg-mail-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.reg-mail-panel-head strong {
  font-size: 13px;
  color: var(--text-strong);
  font-weight: 650;
}
.reg-format-hints {
  display: grid;
  gap: 2px;
}
.reg-format-hints small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}
.reg-format-hints small.hidden { display: none !important; }
.compact-field {
  display: grid;
  gap: 5px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.compact-field small {
  color: var(--muted);
  font-weight: 400;
  font-size: 11px;
}
.reg-mail-input-label textarea {
  min-height: 88px;
  max-height: 160px;
  resize: vertical;
  font-size: 12.5px;
  line-height: 1.4;
  padding: 10px 11px;
}
.reg-mail-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.reg-mail-stat {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
}
.reg-mail-stat.is-accent {
  border-color: rgba(24, 144, 255, 0.35);
  background: rgba(24, 144, 255, 0.1);
}
.reg-mail-stat.is-accent.is-ok {
  border-color: rgba(111, 220, 149, 0.4);
  background: rgba(111, 220, 149, 0.1);
}
.reg-mail-stat.is-accent.is-bad,
.reg-mail-stat.is-warn {
  border-color: rgba(247, 197, 107, 0.4);
  background: rgba(247, 197, 107, 0.1);
}
.reg-mail-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.reg-mail-stat-label {
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.25;
}
.reg-mail-summary {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
}
.reg-run-options {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  align-items: start;
}
.reg-run-options .proxy-ip-card {
  padding: 8px;
}
.reg-run-options .proxy-ip-toggle {
  padding: 8px 10px;
  gap: 10px;
}
.reg-run-options .proxy-ip-copy strong { font-size: 12.5px; }
.reg-run-options .proxy-ip-copy small { font-size: 11px; }
.reg-form-actions {
  position: sticky;
  bottom: 0;
  margin: 0 -16px -16px;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(20, 29, 44, 0.72), #152032 35%);
  border-top: 1px solid var(--line);
  z-index: 2;
}
.compact-provider-box {
  padding: 12px;
  gap: 10px;
}
.compact-provider-list {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  max-height: 200px;
  gap: 8px;
}
.compact-provider-list .greedy-provider-item {
  padding: 8px 9px;
  gap: 8px;
  grid-template-columns: 24px 1fr auto;
  font-size: 12px;
}

.remark-cell { max-width: 220px; }
.remark-open {
  display: block;
  width: 100%;
  max-width: 220px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color var(--fast), background var(--fast);
}
.remark-open:hover,
.remark-open:focus-visible {
  border-color: var(--line);
  background: var(--hover);
  outline: none;
}

@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; }
  .menu-toggle { display: inline-flex !important; }
  .sidebar-close { display: inline-flex; }
  .home-btn { display: inline-grid; place-items: center; }
  .topbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
  }
  .topbar-titles {
    min-width: 0;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(6, 10, 18, 0.62);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms var(--ease);
  }
  .sidebar-backdrop[hidden] {
    display: none !important;
  }
  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 90;
    width: min(300px, 86vw);
    height: 100vh;
    height: 100dvh;
    border-right: 1px solid var(--line-soft);
    border-bottom: 0;
    transform: translateX(-105%);
    transition: transform 220ms var(--ease);
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    box-shadow: var(--shadow-lg);
  }
  body.sidebar-open .sidebar {
    transform: translateX(0);
  }
  body.sidebar-open {
    overflow: hidden;
  }

  .table-wrap { max-height: none; }
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding-top: max(14px, env(safe-area-inset-top));
  }
  .topbar-left {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
  }
  .check-opt { display: none; }
  .panel { margin: 14px; }
}

@media (max-width: 720px) {
  :root {
    --control-height: 44px;
    --font-size: 14px;
    --radius: 10px;
    --radius-lg: 14px;
  }

  body {
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* Prevent iOS zoom on focus; keep readable touch targets */
  input, select, textarea, .btn {
    font-size: 16px !important;
  }
  textarea {
    min-height: 96px;
    line-height: 1.45;
  }
  .btn {
    min-height: 44px;
    height: auto;
    padding: 10px 14px;
    border-radius: 10px;
  }
  .btn.sm, .btn.tiny {
    min-height: 40px;
    height: auto;
    font-size: 14px !important;
  }
  .nav-item {
    min-height: 46px;
    padding: 12px 12px;
    border-radius: 12px;
    font-size: 15px;
  }
  .sidebar-cta {
    min-height: 48px;
    font-size: 15px !important;
  }

  .main {
    padding-bottom: 24px;
  }
  .panel {
    margin: 10px;
    border-radius: 14px;
    overflow: hidden;
  }
  .topbar {
    padding: 12px 12px 8px;
  }
  .topbar h1 {
    font-size: 18px;
    line-height: 1.25;
  }
  .topbar-sub {
    display: none;
  }
  .actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .actions .status-pill {
    grid-column: 1 / -1;
    justify-content: flex-start;
    width: 100%;
  }
  .actions .notify-toggle-btn {
    grid-column: 1 / -1;
    justify-content: center;
  }
  .actions .lang-switch {
    width: 100%;
  }
  .actions .btn {
    width: 100%;
  }

  .stat-strip {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 0 10px;
    margin-bottom: 10px;
  }
  .stat-card {
    padding: 12px;
    border-radius: 12px;
  }

  .toolbar,
  .toolbar.inline {
    padding: 10px;
    gap: 10px;
    margin: 0 10px 10px;
    border-radius: 14px;
  }
  .toolbar-filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
  }
  .toolbar-filters input[type="search"],
  .toolbar-filters select,
  .toolbar-filters input,
  .toolbar-right input,
  .toolbar-right select,
  .toolbar.inline input {
    min-width: 0;
    width: 100%;
  }
  .selection-chip {
    width: 100%;
    justify-content: center;
  }
  .toolbar-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .toolbar-left,
  .toolbar-right {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    margin: 0;
  }
  .toolbar-left .tool-sep { display: none; }
  .toolbar-left > .btn,
  .toolbar-right > .btn {
    width: 100%;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .toolbar-left > .batch-run-controls,
  .task-toolbar > .batch-run-controls {
    display: grid !important;
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    min-width: 0;
    margin: 2px 0;
    padding: 6px;
    border-radius: 14px;
  }
  .toolbar-left > .batch-run-controls .run-ctrl,
  .task-toolbar > .batch-run-controls .run-ctrl {
    width: 100%;
    min-height: 44px;
    padding: 0 10px;
    font-size: 13px;
    border-radius: 11px;
  }
  .toolbar-left > .batch-run-controls .run-ctrl-ico,
  .task-toolbar > .batch-run-controls .run-ctrl-ico {
    width: 18px;
    height: 18px;
  }
  .task-toolbar {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .task-toolbar > select,
  .task-toolbar > .btn,
  .task-toolbar > .batch-run-controls,
  .task-toolbar > .salvaged-mail-actions,
  .task-toolbar > #logAutoHint {
    width: 100%;
  }
  .toolbar-right {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }
  .profile-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    padding: 10px 10px 0;
  }
  .profile-tab {
    flex: 0 0 auto;
    padding: 10px 12px;
    font-size: 13px;
  }
  .profile-form-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }
  .profile-form-actions .btn {
    width: 100%;
  }
  .checkbox-row {
    gap: 10px 12px;
  }
  .checkbox-row .check {
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
  }

  .modal {
    padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
    align-items: stretch;
  }
  .modal-card,
  .modal-card.wide,
  .modal-card.xwide {
    width: 100%;
    max-height: calc(100dvh - 16px);
    border-radius: 16px;
  }
  .modal-card header {
    padding: 14px 14px;
  }
  .modal-card h3 {
    font-size: 16px;
  }
  .icon-btn {
    width: 40px;
    height: 40px;
    font-size: 22px;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0;
  }
  .data-table {
    min-width: 720px;
  }
  .data-table th,
  .data-table td {
    padding: 12px 10px;
    font-size: 13px;
  }
  .data-table .actions-cell,
  .data-table .row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .data-table .row-actions .btn {
    min-height: 36px;
    padding: 6px 10px;
  }

  .pager {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
  }
  .pager-btns {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
  }
  .pager .btn,
  .pager-btns select {
    width: 100%;
    min-height: 42px;
    height: auto;
  }

  .logs {
    font-size: 12.5px;
    padding: 12px;
    max-height: none;
    min-height: 220px;
  }

  .auth-page {
    padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
    align-items: stretch;
  }
  .auth-card {
    width: 100%;
    margin: auto 0;
    padding: 22px 18px;
    border-radius: 16px;
  }
  .stack {
    gap: 14px;
  }
  .stack label {
    font-size: 14px;
  }
  .stack .btn.primary {
    min-height: 48px;
    height: auto;
    font-size: 16px !important;
    border-radius: 12px;
  }
  .auth-top {
    flex-wrap: wrap;
  }
  .auth-top .lang-switch {
    width: 100%;
  }

  .greedy-provider-header {
    align-items: stretch;
    flex-direction: column;
  }

  .register-modal-card {
    width: 100%;
  }
  .register-batch-form {
    gap: 10px;
    padding: 12px;
  }
  .reg-summary-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .reg-stat-pill {
    padding: 10px 12px;
  }
  .reg-stat-value {
    font-size: 24px;
  }
  .reg-scenario-pill {
    justify-content: center;
  }
  .reg-method-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }
  .reg-method-card {
    padding: 8px 9px;
    min-height: 0;
    border-radius: 10px;
  }
  .reg-method-card strong {
    font-size: 12px;
  }
  .reg-method-card small {
    font-size: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .reg-mail-panel {
    padding: 8px;
    gap: 6px;
    border-radius: 12px;
  }
  .reg-mail-panel-head {
    gap: 6px;
  }
  .reg-mail-panel-head strong {
    font-size: 12px;
  }
  .reg-format-hints {
    display: grid;
    gap: 2px;
  }
  .reg-format-hints small {
    font-size: 10px;
    line-height: 1.3;
    word-break: break-word;
  }
  .reg-mail-input-label {
    gap: 4px;
  }
  .reg-mail-input-label span {
    font-size: 11px;
  }
  .reg-mail-input-label textarea {
    min-height: 56px;
    max-height: 96px;
    font-size: 11px !important;
    line-height: 1.35;
    padding: 8px 9px;
    border-radius: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  }
  .reg-mail-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .reg-mail-stat {
    padding: 6px 4px;
    border-radius: 8px;
    gap: 1px;
  }
  .reg-mail-stat-value {
    font-size: 13px;
  }
  .reg-mail-stat-label {
    font-size: 9px;
  }
  .reg-mail-summary {
    font-size: 11px;
  }
  .compact-field {
    gap: 4px;
  }
  .compact-field span,
  .compact-field small {
    font-size: 11px;
  }
  .compact-field input,
  .compact-field select {
    max-width: 100%;
    height: 38px;
    min-height: 38px;
    padding: 6px 10px;
    font-size: 14px !important;
  }
  .reg-run-options {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .reg-run-options .compact-field input {
    max-width: 100px;
  }
  .reg-method-badge {
    font-size: 9px;
    padding: 1px 5px;
  }
  .reg-summary-bar {
    gap: 6px;
  }
  .reg-stat-pill {
    padding: 6px 8px;
  }
  .reg-stat-value {
    font-size: 14px;
  }
  .reg-form-actions {
    margin: 0 -12px -12px;
    padding: 10px 12px;
    flex-direction: column-reverse;
  }
  .reg-form-actions .btn {
    width: 100%;
    min-height: 42px;
  }
  .salvaged-mail-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }
  .compact-provider-list {
    grid-template-columns: 1fr 1fr;
    max-height: 160px;
    gap: 6px;
  }
  .compact-provider-list .greedy-provider-item {
    min-height: 40px;
    padding: 6px 8px;
    font-size: 11px;
  }
  .modal .stack label,
  .modal .grid label {
    gap: 4px;
  }
  .modal input,
  .modal select,
  .modal textarea {
    max-width: 100%;
  }
  .modal .grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px;
  }
  .modal .grid .full {
    grid-column: 1 / -1;
  }
  .install-app-banner {
    grid-template-columns: 36px 1fr auto;
    grid-template-areas:
      "logo copy close"
      "logo actions close";
  }
  .install-app-logo { grid-area: logo; width: 36px; height: 36px; }
  .install-app-copy { grid-area: copy; }
  .install-app-banner .btn { grid-area: actions; justify-self: start; }
  .install-app-close { grid-area: close; }
}

@media (max-width: 420px) {
  .stat-strip {
    grid-template-columns: 1fr;
  }
  .toolbar-left {
    grid-template-columns: 1fr;
  }
  .actions {
    grid-template-columns: 1fr;
  }
  .reg-method-grid {
    grid-template-columns: 1fr 1fr;
  }
  .reg-method-card {
    min-height: 0;
  }
  .reg-mail-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .compact-provider-list {
    grid-template-columns: 1fr;
  }
  .modal .grid {
    grid-template-columns: 1fr !important;
  }
}

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