:root {
  color-scheme: light;
  --bg: #f5eee3;
  --card: rgba(255, 251, 245, 0.94);
  --line: #ddceb9;
  --line-strong: #ccb294;
  --text: #2e2115;
  --muted: #766556;
  --accent: #b5621f;
  --accent-dark: #8e4810;
  --accent-soft: #f3e3cf;
  --success: #e8f5df;
  --warning: #fff0d9;
  --shadow: 0 18px 42px rgba(76, 52, 28, 0.08);
  --shadow-soft: 0 8px 20px rgba(76, 52, 28, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Helvetica Neue", "Segoe UI", sans-serif;
  line-height: 1.5;
  color: var(--text);
  overflow-x: clip;
  background:
    radial-gradient(circle at top right, rgba(181, 98, 31, 0.12), transparent 24%),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.65), transparent 28%),
    linear-gradient(180deg, #fcf8f2 0%, var(--bg) 100%);
}

a {
  color: var(--accent-dark);
  text-decoration: none;
  transition: color 0.14s ease;
  -webkit-tap-highlight-color: transparent;
}

a:hover {
  text-decoration: underline;
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 16px;
  background: var(--accent);
  color: white;
  min-height: 48px;
  padding: 0.85rem 1.15rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.14s ease,
    background-color 0.14s ease,
    box-shadow 0.14s ease,
    border-color 0.14s ease,
    color 0.14s ease;
}

.button-link {
  width: fit-content;
  max-width: 100%;
}

button:disabled,
.button-link:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

button:hover,
.button-link:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  text-decoration: none;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.75rem 0.9rem;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
  transition: border-color 0.14s ease, box-shadow 0.14s ease, background-color 0.14s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(181, 98, 31, 0.12);
  background: white;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 0.45rem;
}

label > span {
  font-weight: 600;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.checkbox input {
  width: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 2rem 1rem;
}

.topbar h1 {
  margin: 0.2rem 0 0;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
}

.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
}

.topbar-actions {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
}

.user-chip {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  padding: 0.7rem 0.9rem;
  border-radius: 999px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 0 2rem 1rem;
}

.nav a {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  padding: 0.6rem 0.8rem;
  border-radius: 999px;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem 3rem;
}

.card {
  background: var(--card);
  border: 1px solid rgba(216, 204, 184, 0.8);
  backdrop-filter: blur(8px);
  border-radius: 28px;
  padding: 1.5rem;
  min-width: 0;
  box-shadow: var(--shadow);
}

.form-card {
  margin-bottom: 1.25rem;
}

.auth-card {
  max-width: 420px;
  margin: clamp(1.5rem, 8vh, 4rem) auto;
}

.grid {
  display: grid;
  gap: 1rem;
}

.metrics {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 1.25rem;
}

.two-columns {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-bottom: 1.25rem;
}

.metric {
  min-height: 150px;
}

.metric-label {
  color: var(--muted);
  margin-bottom: 0.6rem;
  font-weight: 600;
}

.metric-value {
  font-size: 2.2rem;
  font-weight: 700;
}

.metric-hint,
.hint,
.meta-line {
  color: var(--muted);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head h2,
.card h2,
.card h3 {
  margin-top: 0;
  margin-bottom: 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(221, 206, 185, 0.85);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.64);
  max-width: 100%;
  min-width: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

thead th {
  background: rgba(243, 227, 207, 0.8);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

tbody tr:hover td {
  background: rgba(255, 255, 255, 0.45);
}

.table-wrap-compact {
  overflow-x: visible;
}

.table-compact {
  min-width: 0;
  table-layout: fixed;
}

.table-compact th,
.table-compact td {
  padding: 0.8rem 0.85rem;
  font-size: 0.93rem;
}

.table-compact th:last-child,
.table-compact td:last-child {
  width: 148px;
}

.ads-list-table td {
  overflow-wrap: anywhere;
}

.table-cell-stack {
  display: grid;
  gap: 0.16rem;
}

.table-cell-stack strong {
  font-size: 0.98rem;
}

.dashboard-table td {
  vertical-align: middle;
}

.dashboard-status-stack {
  align-items: flex-start;
}

.dashboard-status-stack .status-badge {
  width: fit-content;
  max-width: 100%;
}

.dashboard-message {
  overflow-wrap: anywhere;
}

.notice {
  border-radius: 18px;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
}

.notice.success {
  background: var(--success);
}

.notice.warning {
  background: var(--warning);
}

.verification-banner {
  background: linear-gradient(135deg, #fff3e0 0%, #ffcc80 100%);
  border: 3px solid #ff6f00;
  border-radius: 18px;
  padding: 1.2rem;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: #ff6f00; }
  50% { border-color: #ff8f00; box-shadow: 0 0 15px rgba(255, 111, 0, 0.4); }
}

.verification-icon {
  font-size: 2rem;
  line-height: 1;
}

.verification-content {
  flex: 1;
}

.verification-content strong {
  display: block;
  font-size: 1.1rem;
  color: #bf360c;
  margin-bottom: 0.8rem;
}

.verification-item {
  background: white;
  border-radius: 12px;
  padding: 1rem;
  margin-top: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.verification-item span {
  color: #5d4037;
  font-size: 0.95rem;
}

.verification-captcha-image {
  display: block;
  width: 140px;
  height: 60px;
  border: 2px solid #ffb74d;
  border-radius: 8px;
  background: #fff;
  image-rendering: pixelated;
}

.verify-code-form {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.verify-code-form input {
  padding: 0.5rem 0.8rem;
  border: 2px solid #ffb74d;
  border-radius: 8px;
  font-size: 1rem;
  width: 120px;
  text-align: center;
}

.verify-code-form input:focus {
  outline: none;
  border-color: #ff6f00;
}

.verify-code-form button {
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
}

.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-grid > button,
.form-grid > .button-link {
  width: auto;
  min-width: 170px;
  justify-self: start;
}

.advanced-panel {
  border: 1px solid rgba(221, 206, 185, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  padding: 0.9rem 1rem;
}

.advanced-panel[open] {
  box-shadow: inset 0 0 0 1px rgba(181, 98, 31, 0.06);
}

.advanced-summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent-dark);
  list-style: none;
}

.advanced-summary::-webkit-details-marker {
  display: none;
}

.advanced-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.proxy-picker {
  padding: 0.75rem 0.9rem;
}

.proxy-picker-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.proxy-picker-summary-title {
  font-weight: 700;
}

.proxy-picker-summary-meta {
  max-width: min(60%, 480px);
  color: rgba(82, 64, 47, 0.78);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.proxy-picker-panel {
  margin-top: 0.9rem;
  border-top: 1px solid rgba(221, 206, 185, 0.75);
  padding-top: 0.9rem;
}

.proxy-checkbox-list {
  max-height: 18rem;
  overflow: auto;
  padding-right: 0.35rem;
}

.proxy-checkbox-option {
  align-items: start;
  padding: 0.7rem 0.2rem;
  border-bottom: 1px solid rgba(221, 206, 185, 0.45);
}

.proxy-checkbox-option:last-child {
  border-bottom: none;
}

.proxy-checkbox-option span {
  line-height: 1.45;
}

.target-mode-field[hidden] {
  display: none !important;
}

.stack {
  display: grid;
  gap: 1rem;
}

.list {
  margin: 0;
  padding-left: 1rem;
}

.button-secondary {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  border: 1px solid var(--line);
}

.button-secondary:hover {
  background: white;
  color: var(--text);
}

.button-subtle {
  min-height: 40px;
  padding: 0.6rem 0.9rem;
  background: rgba(255, 255, 255, 0.82);
  color: var(--accent-dark);
  border: 1px solid var(--line);
  box-shadow: none;
}

.button-subtle:hover {
  background: white;
  color: var(--accent-dark);
}

.button-subtle.is-stop {
  color: #8e4810;
  border-color: #e3c5a2;
  background: #fff7ee;
}

.button-subtle.is-stop:hover {
  color: #8e4810;
  background: #fff1df;
}

.worker-create-card {
  padding: 1.65rem;
}

.worker-create-form {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) auto;
  gap: 1rem;
  align-items: end;
}

.worker-stack {
  display: grid;
  gap: 1.25rem;
}

.worker-card {
  padding: 1.4rem;
}

.worker-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.worker-card-eyebrow {
  margin-bottom: 0.35rem;
}

.worker-card-subtitle {
  margin-top: 0.35rem;
}

.worker-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
}

.worker-step-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.worker-step {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px dashed rgba(204, 178, 148, 0.9);
  background: rgba(255, 255, 255, 0.66);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.worker-step.is-done {
  border-style: solid;
  background: #efe4d2;
  color: var(--text);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge.is-live {
  background: #e8f5df;
  border-color: #c6ddae;
  color: #325126;
}

.status-badge.is-stopped {
  background: #f6e7d6;
  border-color: #e3c5a2;
  color: #8e4810;
}

.status-badge.is-neutral {
  background: rgba(243, 227, 207, 0.8);
  border-color: rgba(204, 178, 148, 0.8);
  color: var(--muted);
}

.worker-card-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.95fr);
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.worker-settings,
.worker-assignment-panel {
  border: 1px solid rgba(221, 206, 185, 0.9);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.58);
  padding: 1rem;
  min-width: 0;
}

.worker-panel-title {
  margin-bottom: 0.85rem;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.worker-settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.9rem 1rem;
  align-items: end;
}

.worker-toggle {
  height: 100%;
  min-height: 58px;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
}

.worker-state-card {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  white-space: normal;
}

.worker-state-label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.worker-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1rem;
}

.worker-state-action {
  min-width: 190px;
}

.worker-state-action.is-stop {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  border: 1px solid var(--line);
}

.worker-state-action.is-stop:hover {
  background: white;
  color: var(--text);
}

.worker-assignment-form {
  display: grid;
  gap: 0.9rem;
}

.worker-empty-state {
  display: grid;
  gap: 0.45rem;
  min-height: 100%;
  align-content: center;
}

.worker-table-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.worker-table-head h3 {
  font-size: 1.08rem;
}

.worker-inline-form {
  display: inline-flex;
}

.worker-cell-stack {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.worker-inline-error {
  color: #9d3f10;
  font-size: 0.92rem;
}

.worker-inline-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.worker-inline-actions form,
.worker-inline-actions a,
.worker-form-actions > *,
.topbar-actions form {
  max-width: 100%;
}

.worker-inline-actions .button-link,
.worker-inline-actions .button-subtle {
  position: relative;
  overflow: hidden;
  transform-origin: center;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease,
    background-color 0.16s ease,
    color 0.16s ease;
}

.worker-inline-actions .button-link::after,
.worker-inline-actions .button-subtle::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.34) 45%, transparent 100%);
  transform: translateX(-130%);
  transition: transform 0.3s ease;
}

.worker-inline-actions .button-link:hover,
.worker-inline-actions .button-subtle:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 22px rgba(76, 52, 28, 0.12);
}

.worker-inline-actions .button-link:hover::after,
.worker-inline-actions .button-subtle:hover::after {
  transform: translateX(130%);
}

.worker-inline-actions .button-link:active,
.worker-inline-actions .button-subtle:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 4px 10px rgba(76, 52, 28, 0.08);
}

.worker-secondary-card .section-head {
  margin-bottom: 1.2rem;
}

.server-monitor-card {
  padding: 1.6rem;
}

.server-monitor-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.server-monitor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
}

.server-live-badge,
.server-chart-chip {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.server-live-badge.is-live {
  background: #e8f5df;
  border-color: #c6ddae;
  color: #325126;
}

.server-live-badge.is-paused {
  background: #f6e7d6;
  border-color: #e3c5a2;
  color: #8e4810;
}

.server-live-badge.is-error {
  background: #ffe6df;
  border-color: #e2b2a1;
  color: #9d3f10;
}

.server-live-toggle {
  min-height: 38px;
  padding: 0.55rem 0.95rem;
}

.server-live-timestamp {
  color: var(--muted);
  font-size: 0.9rem;
}

.server-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.server-kpi-card {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
  padding: 1rem;
  border: 1px solid rgba(221, 206, 185, 0.9);
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(181, 98, 31, 0.08), transparent 32%),
    rgba(255, 255, 255, 0.72);
}

.server-kpi-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.server-kpi-value {
  font-size: clamp(1.3rem, 2vw, 2rem);
  line-height: 1.05;
}

.server-kpi-meta {
  color: var(--muted);
  font-size: 0.96rem;
}

.server-meter {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(221, 206, 185, 0.45);
}

.server-meter > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #d89b62 0%, #b5621f 100%);
  transition: width 0.25s ease;
}

.server-meter.dual {
  display: flex;
  gap: 0.25rem;
  background: transparent;
}

.server-meter.dual > span:first-child {
  background: linear-gradient(90deg, #d89b62 0%, #b5621f 100%);
}

.server-meter.dual > span:last-child {
  background: linear-gradient(90deg, #c2ddb0 0%, #5f8d45 100%);
}

.server-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.server-chart-card {
  display: grid;
  gap: 0.8rem;
  min-width: 0;
  padding: 1rem;
  border: 1px solid rgba(221, 206, 185, 0.9);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.74);
}

.server-chart-card .section-head {
  margin-bottom: 0;
}

.server-chart-card h3 {
  font-size: 1.02rem;
}

.server-sparkline {
  width: 100%;
  height: 92px;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.72);
}

.overflow-list li + li {
  margin-top: 0.45rem;
}

.worker-empty-card {
  padding: 1.2rem 1.4rem;
}

/* ── Bottom navigation (mobile only) ─────────────────── */
.bottom-nav {
  display: none; /* shown only in mobile media query */
}

.topbar-compact-title {
  display: none; /* shown only in mobile media query */
}

.topbar-user-avatar {
  display: none; /* shown only in mobile media query */
}

@media (max-width: 720px) {
  /* ── Safe-area padding on body (only when bottom-nav is present) ── */
  body:has(.bottom-nav) {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  /* ── Compact sticky header ──────────────────────────── */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0 max(1rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left));
    height: 56px;
    background: rgba(252, 248, 242, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 8px rgba(76, 52, 28, 0.07);
  }

  /* Hide desktop header group (eyebrow + h1) — must stay first child of .topbar */
  .topbar > div:first-child {
    display: none;
  }

  .topbar-actions {
    display: none;
  }

  /* Show compact title and avatar */
  .topbar-compact-title {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-dark);
    letter-spacing: 0.01em;
  }

  .topbar-user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-left: auto;
  }

  /* ── Desktop pill-nav → hidden ───────────────────────── */
  .nav {
    display: none;
  }

  /* ── Main container ──────────────────────────────────── */
  .container {
    padding: 1rem max(1rem, env(safe-area-inset-right)) 1.5rem max(1rem, env(safe-area-inset-left));
  }

  /* ── Bottom navigation ───────────────────────────────── */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: calc(60px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(252, 248, 242, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -2px 12px rgba(76, 52, 28, 0.07);
    align-items: stretch;
  }

  .bottom-nav-logout {
    display: contents;
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 0.2rem;
    padding: 0.4rem 0.25rem 0.35rem;
    color: var(--muted);
    font-size: 0.67rem;
    font-weight: 600;
    text-decoration: none;
    border: 0;
    background: transparent;
    cursor: pointer;
    min-height: 0;
    box-shadow: none;
    border-radius: 0;
    letter-spacing: 0.01em;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.12s ease;
  }

  .bottom-nav-item svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }

  .bottom-nav-item.is-active {
    color: var(--accent);
  }

  .bottom-nav-item:hover {
    color: var(--accent);
    text-decoration: none;
    transform: none;
    background: transparent;
  }

  /* ── Cards ───────────────────────────────────────────── */
  .card {
    border-radius: 20px;
    padding: 1rem;
  }

  /* ── Section headers ─────────────────────────────────── */
  .section-head,
  .worker-card-header,
  .worker-table-head,
  .server-monitor-header,
  .server-monitor-actions,
  .worker-badges {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  .worker-table-head h3,
  .section-head h2,
  .section-head h3 {
    margin-bottom: 0.2rem;
  }

  /* ── All multi-column grids → single column ──────────── */
  .form-grid,
  .advanced-grid,
  .worker-create-form,
  .worker-card-layout,
  .worker-settings-grid,
  .two-columns,
  .server-chart-grid {
    grid-template-columns: 1fr;
  }

  /* ── Metrics: 2-col grid (not hidden) ────────────────── */
  .metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .metric {
    min-height: 0;
  }

  .metric-value {
    font-size: clamp(1.2rem, 6vw, 1.8rem);
  }

  /* ── Server KPI grid ─────────────────────────────────── */
  .server-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .server-kpi-value {
    font-size: clamp(1.1rem, 5vw, 1.6rem);
  }

  /* ── Verification banner ─────────────────────────────── */
  .verification-banner {
    flex-direction: column;
    padding: 1rem;
  }

  .verification-item {
    align-items: stretch;
  }

  .verify-code-form {
    margin-left: 0;
    width: 100%;
    flex-direction: column;
  }

  .verify-code-form input,
  .verify-code-form button {
    width: 100%;
  }

  /* ── Buttons full width in forms ─────────────────────── */
  .form-grid > button,
  .form-grid > .button-link,
  .worker-create-form > button,
  .worker-assignment-form > button,
  .worker-form-actions > button,
  .worker-form-actions > .button-link,
  .section-head .button-link {
    width: 100%;
    justify-self: stretch;
  }

  .worker-toggle,
  .worker-state-action {
    width: 100%;
  }

  .worker-inline-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .worker-inline-actions form,
  .worker-inline-actions a,
  .worker-inline-actions button {
    width: 100%;
  }

  .worker-step {
    justify-content: flex-start;
  }

  /* ── Hide low-value verbose elements ─────────────────── */
  .usage-guide {
    display: none;
  }

  .hint.full {
    display: none;
  }

  /* ── URL input font size (prevent iOS zoom) ──────────── */
  input,
  select,
  textarea {
    font-size: 16px;
  }

  /* ── Tables → mobile cards ───────────────────────────── */
  .table-wrap {
    overflow: visible;
    border-radius: 0;
    background: transparent;
    border: 0;
  }

  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap th,
  .table-wrap td {
    display: block;
    width: 100%;
  }

  .table-wrap table,
  .table-compact {
    min-width: 0;
    table-layout: auto;
  }

  /* Hide column headers */
  .table-wrap thead {
    display: none;
  }

  /* Row = card */
  .table-wrap tbody {
    display: grid;
    gap: 0.75rem;
  }

  .table-wrap tbody tr {
    display: grid;
    gap: 0;
    padding: 0.25rem 1rem;
    border: 1px solid rgba(221, 206, 185, 0.9);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: var(--shadow-soft);
  }

  .table-wrap tbody tr:hover td {
    background: transparent;
  }

  /* First td = card title row (no label prefix) */
  .table-wrap tbody tr td:first-child {
    padding: 0.8rem 0 0.6rem;
    border-bottom: 1px solid rgba(221, 206, 185, 0.55);
    font-weight: 600;
  }

  .table-wrap tbody tr td:first-child::before {
    display: none;
  }

  /* Regular td: label on top, value below */
  .table-wrap td {
    padding: 0.55rem 0;
    border-bottom: 1px solid rgba(221, 206, 185, 0.4);
    overflow-wrap: anywhere;
  }

  .table-wrap td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.2rem;
    line-height: 1.3;
  }

  .table-wrap td:last-child {
    border-bottom: 0;
  }

  /* Action cell: no label, buttons full width */
  .table-wrap td[data-label="Действие"] {
    padding: 0.6rem 0 0.85rem;
  }

  .table-wrap td[data-label="Действие"]::before {
    display: none;
  }

  .table-wrap td[data-label="Действие"] .button-link,
  .table-wrap td[data-label="Действие"] button,
  .table-wrap td[data-label="Действие"] a {
    width: 100%;
    justify-content: center;
  }

  /* colspan cells: no label */
  .table-wrap td[colspan] {
    text-align: left;
  }

  .table-wrap td[colspan]::before {
    display: none;
  }

  /* Stacked cell content */
  .table-cell-stack,
  .worker-cell-stack {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
  }

  /* Dashboard tweaks */
  .dashboard-table .status-badge {
    white-space: normal;
    text-align: left;
  }

  .dashboard-events-table td[data-label="Сообщение"],
  .dashboard-users-table td[data-label="Пользователь"] {
    padding-top: 0.55rem;
  }

  .dashboard-events-table td[data-label="Сообщение"]::before,
  .dashboard-users-table td[data-label="Пользователь"]::before {
    display: none;
  }
}

@media (max-width: 920px) {
  .worker-create-form,
  .worker-card-layout,
  .worker-settings-grid {
    grid-template-columns: 1fr;
  }

  .worker-badges {
    justify-content: flex-start;
  }

  .worker-toggle {
    min-height: auto;
  }
}

/* Сброс hover-трансформаций на тач-устройствах (нет физической мыши).
   Hover на touch "застревает" после тапа — убираем визуальные сдвиги. */
@media (hover: none) {
  button:hover,
  .button-link:hover {
    transform: none;
  }

  a:hover {
    text-decoration: none;
  }

  .worker-inline-actions .button-link:hover,
  .worker-inline-actions .button-subtle:hover {
    transform: none;
    box-shadow: var(--shadow-soft);
  }

  .worker-inline-actions .button-link:hover::after,
  .worker-inline-actions .button-subtle:hover::after {
    transform: translateX(-130%);
  }

  /* Активное состояние вместо hover для тач */
  button:active,
  .button-link:active {
    transform: scale(0.97);
    opacity: 0.88;
  }

  .bottom-nav-item:hover {
    color: var(--muted);
  }

  .bottom-nav-item.is-active:hover {
    color: var(--accent);
  }
}
