/* Phase 4: CSS Custom Properties - 设计系统变量 */
:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  background: var(--color-bg-page);
  color: var(--color-text-primary);
  
  /* 颜色变量 */
  --color-primary: #2f6df6;
  --color-primary-hover: #2563eb;
  --color-primary-light: #eef2ff;
  --color-primary-dark: #1e40af;
  
  --color-success: #10b981;
  --color-success-light: #d1fae5;
  --color-success-dark: #059669;
  
  --color-danger: #ef4444;
  --color-danger-light: #fee2e2;
  --color-danger-dark: #dc2626;
  
  --color-warning: #f59e0b;
  --color-warning-light: #fef3c7;
  --color-warning-dark: #d97706;
  
  --color-text-primary: #1f2937;
  --color-text-secondary: #4b5563;
  --color-text-muted: #6b7280;
  --color-text-light: #9ca3af;
  
  --color-border: #e5e7eb;
  --color-border-light: #f3f4f6;
  --color-border-dark: #d1d5db;
  
  --color-bg-page: #f9fafb;
  --color-bg-white: #ffffff;
  --color-bg-gray: #f3f4f6;
  --color-bg-hover: #f9fafb;
  
  /* 间距变量 */
  --spacing-1: 4px;
  --spacing-2: 8px;
  --spacing-3: 12px;
  --spacing-4: 16px;
  --spacing-5: 20px;
  --spacing-6: 24px;
  --spacing-8: 32px;
  --spacing-10: 40px;
  --spacing-12: 48px;
  
  /* 圆角变量 */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;
  
  /* 字号变量 */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 30px;
  
  /* 字重变量 */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  
  /* 阴影变量 */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
  
  /* 过渡变量 */
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

body:not(.auth-authenticated) .layout,
body:not(.auth-authenticated) .hamburger-btn,
body:not(.auth-authenticated) .sidebar-overlay {
  display: none;
}

body.auth-authenticated .auth-view {
  display: none;
}

.auth-view {
  align-items: center;
  background: #f3f5f8;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-panel {
  background: var(--color-bg-white);
  border: 1px solid #d7dee8;
  border-radius: var(--radius-md);
  box-shadow: 0 14px 40px rgba(31, 41, 55, 0.12);
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

.auth-brand {
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 20px;
}

.auth-brand strong,
.auth-brand span {
  display: block;
}

.auth-brand strong {
  color: var(--color-text-primary);
  font-size: 18px;
}

.auth-brand span {
  color: var(--color-text-muted);
  font-size: 12px;
  margin-top: 3px;
}

.auth-checking {
  color: var(--color-text-secondary);
  font-size: 14px;
  padding: 18px 0 6px;
  text-align: center;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form[hidden],
.auth-checking[hidden] {
  display: none;
}

.auth-form h1 {
  font-size: 22px;
}

.auth-form p {
  color: var(--color-text-muted);
  font-size: 13px;
  margin-top: 6px;
}

.auth-form label,
.auth-modal-form label {
  display: grid;
  gap: 6px;
}

.auth-form label > span,
.auth-modal-form label > span {
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: var(--font-semibold);
}

.auth-form input,
.auth-modal-form input,
.auth-modal-form select {
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-sm);
  font: inherit;
  height: 38px;
  min-width: 0;
  padding: 0 10px;
}

.auth-form input:focus,
.auth-modal-form input:focus,
.auth-modal-form select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(47, 109, 246, 0.12);
  outline: none;
}

.auth-message {
  color: var(--color-danger-dark);
  font-size: 13px;
  min-height: 18px;
  padding-top: 14px;
}

.page-view[data-page="access-control"].active {
  display: grid;
  gap: 16px;
  margin: 0 auto;
  max-width: 1480px;
  width: 100%;
}

.auth-profile-body {
  align-items: center;
  display: flex;
  gap: 16px;
  min-height: 112px;
  padding: 24px;
}

.auth-profile-avatar,
.auth-user-avatar {
  align-items: center;
  background: #e7efff;
  border: 1px solid #c5d6fb;
  color: #2259c7;
  display: inline-flex;
  flex: 0 0 auto;
  font-weight: var(--font-bold);
  justify-content: center;
}

.auth-profile-avatar {
  border-radius: var(--radius-md);
  font-size: 20px;
  height: 54px;
  width: 54px;
}

.auth-profile-identity {
  min-width: 0;
}

.auth-profile-title {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.auth-profile-title h2 {
  font-size: 18px;
}

.auth-profile-identity > p {
  color: var(--color-text-secondary);
  font-size: 13px;
  margin-top: 5px;
}

.auth-profile-meta {
  color: var(--color-text-muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 20px;
  margin-top: 12px;
}

.auth-profile-meta strong {
  color: var(--color-text-secondary);
  font-weight: var(--font-medium);
  margin-left: 5px;
}

.auth-profile-action {
  margin-left: auto;
}

.network-access-list {
  display: grid;
}

.network-access-row {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: 40px minmax(0, 1fr) 46px;
  min-height: 74px;
  padding: 10px 18px;
}

.network-access-row + .network-access-row {
  border-top: 1px solid var(--color-border);
}

.network-access-icon {
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  display: inline-flex;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.network-access-icon.public {
  background: #eaf1ff;
  border-color: #c9dafa;
  color: #285db8;
}

.network-access-icon.lan {
  background: #eaf8ee;
  border-color: #bce2c6;
  color: #18743a;
}

.network-access-icon .lucide {
  height: 18px;
  width: 18px;
}

.network-access-copy {
  min-width: 0;
}

.network-access-copy strong,
.network-access-copy span {
  display: block;
}

.network-access-copy strong {
  color: var(--color-text-primary);
  font-size: 14px;
}

.network-access-status {
  font-size: 12px;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.network-access-status.is-on {
  color: #18743a;
}

.network-access-status.is-off {
  color: var(--color-text-muted);
}

.network-access-status.is-pending {
  color: #8a6100;
}

.network-access-status.is-error {
  color: var(--color-danger-dark);
}

.network-access-switch {
  cursor: pointer;
  display: block;
  height: 26px;
  position: relative;
  width: 44px;
}

.network-access-switch input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.network-access-switch > span {
  background: #cbd3dd;
  border: 1px solid #b8c2ce;
  border-radius: 13px;
  inset: 0;
  position: absolute;
  transition: background 160ms ease, border-color 160ms ease;
}

.network-access-switch > span::after {
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.22);
  content: "";
  height: 20px;
  left: 2px;
  position: absolute;
  top: 2px;
  transition: transform 160ms ease;
  width: 20px;
}

.network-access-switch input:checked + span {
  background: #218c55;
  border-color: #18743a;
}

.network-access-switch input:checked + span::after {
  transform: translateX(18px);
}

.network-access-switch input:focus-visible + span {
  outline: 2px solid #6aa9e9;
  outline-offset: 2px;
}

.network-access-switch input:disabled + span {
  cursor: not-allowed;
  opacity: 0.58;
}

.network-access-message {
  border-top: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: 12px;
  margin: 0;
  overflow-wrap: anywhere;
  padding: 11px 18px;
}

.network-access-message.is-success {
  color: #18743a;
}

.network-access-message.is-pending {
  color: #8a6100;
}

.network-access-message.is-error {
  color: var(--color-danger-dark);
}

.auth-badge,
.auth-event {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  display: inline-flex;
  font-size: 12px;
  font-weight: var(--font-semibold);
  line-height: 24px;
  padding: 0 8px;
  white-space: nowrap;
}

.auth-badge-admin,
.auth-event-info {
  background: #eaf1ff;
  border-color: #c9dafa;
  color: #285db8;
}

.auth-badge-operator {
  background: #fff7df;
  border-color: #efd68b;
  color: #8a6100;
}

.auth-badge-viewer,
.auth-event-muted {
  background: #f1f3f6;
  border-color: #d8dde5;
  color: #596579;
}

.auth-badge-active,
.auth-event-success {
  background: #eaf8ee;
  border-color: #bce2c6;
  color: #18743a;
}

.auth-badge-disabled,
.auth-badge-locked,
.auth-event-danger {
  background: #fff0f0;
  border-color: #f1c4c4;
  color: #b42323;
}

.auth-account-stats {
  background: #fafbfd;
  border-bottom: 1px solid var(--color-border);
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  padding: 0 18px;
}

.auth-account-stats > div {
  border-right: 1px solid var(--color-border);
  padding: 14px 18px;
}

.auth-account-stats > div:last-child {
  border-right: 0;
}

.auth-account-stats span,
.auth-account-stats strong {
  display: block;
}

.auth-account-stats span {
  color: var(--color-text-muted);
  font-size: 12px;
}

.auth-account-stats strong {
  color: var(--color-text-primary);
  font-size: 18px;
  margin-top: 4px;
}

.auth-users-table {
  min-width: 850px;
}

.auth-users-table th:nth-child(1) { width: 28%; }
.auth-users-table th:nth-child(2) { width: 13%; }
.auth-users-table th:nth-child(3) { width: 12%; }
.auth-users-table th:nth-child(4) { width: 18%; }
.auth-users-table th:nth-child(5) { width: 18%; }
.auth-users-table th:nth-child(6) { width: 90px; }

.auth-users-table td {
  height: 58px;
}

.auth-user-cell {
  align-items: center;
  display: flex;
  gap: 10px;
}

.auth-user-avatar {
  border-radius: var(--radius-sm);
  height: 32px;
  width: 32px;
}

.auth-user-cell strong,
.auth-user-cell small {
  display: block;
}

.auth-user-cell small {
  color: var(--color-text-muted);
  font-size: 11px;
  margin-top: 3px;
}

.auth-audit-scroll {
  max-height: 360px;
  overflow: auto;
}

.auth-audit-table {
  min-width: 760px;
}

.auth-audit-table th:nth-child(1) { width: 190px; }
.auth-audit-table th:nth-child(2) { width: 140px; }
.auth-audit-table th:nth-child(3) { width: 170px; }
.auth-audit-table th:nth-child(5) { width: 140px; }

.auth-audit-table code {
  background: #f1f3f6;
  border-radius: var(--radius-sm);
  color: #46546a;
  font-family: Consolas, monospace;
  padding: 3px 6px;
}

.auth-modal {
  max-width: 540px;
}

.auth-modal .modal-header {
  align-items: flex-start;
}

.auth-modal .modal-header p {
  color: var(--color-text-muted);
  font-size: 12px;
  margin-top: 5px;
}

.auth-modal-form {
  display: grid;
  gap: 16px;
}

.auth-modal-form small {
  color: var(--color-text-muted);
  font-size: 11px;
}

.auth-modal-error {
  background: #fff1f0;
  border: 1px solid #ffccc7;
  border-radius: var(--radius-sm);
  color: var(--color-danger-dark);
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  padding: 10px 12px;
}

.auth-modal-error[hidden] {
  display: none;
}

.auth-modal-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
}

.auth-switch-field {
  align-content: start;
}

.auth-switch-control {
  align-items: center;
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  display: flex;
  font-size: 13px;
  gap: 8px;
  height: 38px;
  padding: 0 10px;
}

.auth-switch-control input {
  height: 16px;
  margin: 0;
  width: 16px;
}

.page-view[data-page="my-settings"].active,
.page-view[data-page="my-telegram"].active,
.page-view[data-page="my-rules"].active,
.page-view[data-page="my-alerts"].active {
  display: grid;
  gap: 16px;
  margin: 0 auto;
  max-width: 1480px;
  width: 100%;
}

.personal-panel {
  overflow: hidden;
}

.personal-form {
  display: grid;
  gap: 18px;
  padding: 22px 18px;
}

.personal-form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.personal-form-grid-single {
  grid-template-columns: 1fr;
}

.personal-tg-proxy-mode {
  border: 0;
  margin: 0;
  min-width: 0;
  padding: 0;
}

.personal-tg-proxy-mode legend {
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: var(--font-semibold);
  margin-bottom: 6px;
}

.personal-tg-proxy-mode-control {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 520px;
}

.personal-form label,
.personal-section label,
.personal-rule-thresholds label {
  color: var(--color-text-secondary);
  display: grid;
  font-size: 12px;
  font-weight: var(--font-semibold);
  gap: 6px;
}

.personal-form input,
.personal-form select,
.personal-section input,
.personal-section select,
.personal-rule-thresholds input,
.personal-rule-thresholds select {
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font: inherit;
  height: 38px;
  min-width: 0;
  padding: 0 10px;
  width: 100%;
}

.personal-check-row {
  align-items: center;
  display: flex !important;
  flex-direction: row;
  font-size: 13px !important;
  gap: 9px !important;
  min-height: 38px;
}

.personal-check-row input {
  height: 16px !important;
  margin: 0;
  width: 16px !important;
}

.personal-status-line {
  background: #f8fafc;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: 13px;
  min-height: 46px;
  padding: 14px 18px;
}

.personal-split-grid {
  border-bottom: 1px solid var(--color-border);
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.personal-section {
  min-width: 0;
  padding: 20px 18px;
}

.personal-section + .personal-section {
  border-left: 1px solid var(--color-border);
}

.personal-section-full {
  border-left: 0 !important;
}

.personal-section-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.personal-section-head h3 {
  font-size: 15px;
}

.personal-section-head p {
  color: var(--color-text-muted);
  font-size: 12px;
  margin-top: 5px;
}

.personal-actions {
  margin: 14px 0 18px;
}

.personal-verification-grid {
  align-items: end;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}

.personal-verification-grid button {
  white-space: nowrap;
}

.tg-api-guide-modal {
  max-width: 760px;
}

.tg-api-guide-modal .modal-header {
  align-items: flex-start;
}

.tg-api-guide-modal .modal-header p {
  color: var(--color-text-muted);
  font-size: 12px;
  margin-top: 5px;
}

.tg-api-guide-body {
  display: grid;
  gap: 20px;
}

.tg-api-guide-official {
  align-items: center;
  background: #f6f9fd;
  border: 1px solid #cfdced;
  border-radius: var(--radius-md);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 16px;
}

.tg-api-guide-official strong,
.tg-api-guide-official span {
  display: block;
}

.tg-api-guide-official span {
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.6;
  margin-top: 5px;
}

.tg-api-guide-official a,
.tg-api-guide-open-link {
  align-items: center;
  background: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  color: #ffffff;
  display: inline-flex;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  height: 36px;
  justify-content: center;
  padding: 0 14px;
  text-decoration: none;
  white-space: nowrap;
}

.tg-api-guide-steps {
  counter-reset: tg-guide-step;
  display: grid;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tg-api-guide-steps li {
  align-items: start;
  border-bottom: 1px solid var(--color-border);
  counter-increment: tg-guide-step;
  display: grid;
  gap: 12px;
  grid-template-columns: 30px minmax(0, 1fr);
  padding: 13px 0;
}

.tg-api-guide-steps li:first-child {
  padding-top: 0;
}

.tg-api-guide-steps li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.tg-api-guide-steps li::before {
  align-items: center;
  background: #eaf2ff;
  border: 1px solid #c9dcfb;
  border-radius: 50%;
  color: var(--color-primary);
  content: counter(tg-guide-step);
  display: flex;
  font-size: 12px;
  font-weight: var(--font-bold);
  height: 28px;
  justify-content: center;
  width: 28px;
}

.tg-api-guide-steps strong {
  font-size: 14px;
}

.tg-api-guide-steps p {
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.7;
  margin-top: 4px;
}

.tg-api-guide-steps code {
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  color: #334155;
  font-family: Consolas, monospace;
  padding: 2px 5px;
}

.personal-rule-table {
  min-width: 1120px;
}

.personal-rule-table th:nth-child(1) { width: 82px; }
.personal-rule-table th:nth-child(2) { width: 180px; }
.personal-rule-table th:nth-child(3) { width: 90px; }
.personal-rule-table th:nth-child(4) { width: 220px; }
.personal-rule-table th:nth-child(5) { width: 310px; }
.personal-rule-table th:nth-child(6) { width: 110px; }
.personal-rule-table th:nth-child(7) { width: 100px; }
.personal-rule-table th:nth-child(8) { width: 78px; }

.personal-rule-scope {
  line-height: 1.55;
  white-space: normal !important;
}

.personal-rule-modal {
  max-width: 760px;
}

.personal-rule-thresholds {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.modal-danger-action {
  margin-right: auto;
}

.personal-summary-strip {
  background: #fafbfd;
  border-bottom: 1px solid var(--color-border);
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  padding: 0 18px;
}

.personal-summary-strip > div {
  border-right: 1px solid var(--color-border);
  padding: 14px 18px;
}

.personal-summary-strip > div:last-child {
  border-right: 0;
}

.personal-summary-strip span,
.personal-summary-strip strong {
  display: block;
}

.personal-summary-strip span {
  color: var(--color-text-muted);
  font-size: 12px;
}

.personal-summary-strip strong {
  font-size: 18px;
  margin-top: 4px;
}

.personal-alert-table {
  min-width: 1380px;
}

.personal-alert-table th:nth-child(1) { width: 90px; }
.personal-alert-table th:nth-child(2) { width: 180px; }
.personal-alert-table th:nth-child(3) { width: 80px; }
.personal-alert-table th:nth-child(4) { width: 310px; }
.personal-alert-table th:nth-child(5) { width: 260px; }
.personal-alert-table th:nth-child(6),
.personal-alert-table th:nth-child(7) { width: 170px; }
.personal-alert-table th:nth-child(8) { width: 100px; }
.personal-alert-table th:nth-child(9) { width: 145px; }

.table-scroll {
  overflow: auto;
  overscroll-behavior: contain;
}

.table-density-compact .data-table th,
.table-density-compact .data-table td {
  height: 32px !important;
  padding: 5px 9px !important;
}

@media (max-width: 900px) {
  .personal-split-grid,
  .personal-form-grid,
  .personal-rule-thresholds {
    grid-template-columns: 1fr;
  }

  .personal-section + .personal-section {
    border-left: 0;
    border-top: 1px solid var(--color-border);
  }

  .personal-verification-grid {
    grid-template-columns: 1fr 1fr;
  }

  .personal-verification-grid button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .personal-form,
  .personal-section {
    padding: 18px 14px;
  }

  .personal-verification-grid,
  .personal-summary-strip {
    grid-template-columns: 1fr;
  }

  .personal-summary-strip > div {
    border-bottom: 1px solid var(--color-border);
    border-right: 0;
    padding: 12px 14px;
  }

  .personal-summary-strip > div:last-child {
    border-bottom: 0;
  }

  .tg-api-guide-official {
    align-items: stretch;
    flex-direction: column;
  }

  .tg-api-guide-official a,
  .tg-api-guide-open-link {
    width: 100%;
  }

  .tg-api-guide-modal .modal-footer {
    align-items: stretch;
    flex-direction: column-reverse;
  }
}

.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--color-bg-white);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  position: sticky;
  top: 0;
}

.brand {
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: var(--spacing-3);
  height: 72px;
  padding: 0 var(--spacing-4);
}

.brand-icon {
  align-items: center;
  background: var(--color-primary);
  border-radius: var(--radius-md);
  color: var(--color-bg-white);
  display: flex;
  font-weight: var(--font-bold);
  height: 40px;
  justify-content: center;
  width: 40px;
}

.brand strong {
  display: block;
  font-size: var(--text-lg);
}

.brand span {
  color: #4a5568;
  display: block;
  font-size: 13px;
  margin-top: 3px;
}

.nav {
  padding: 14px 10px;
}

.nav-group {
  margin-top: 10px;
}

.nav-title {
  color: #5a6577;
  font-size: var(--text-xs);
  padding: 10px 14px 6px;
}

.nav-item {
  align-items: center;
  border-radius: var(--radius-md);
  color: #526174;
  display: flex;
  gap: 10px;
  height: 42px;
  padding: 0 14px;
  text-decoration: none;
}

.nav-item span {
  color: #4a5568;
  display: inline-flex;
  font-size: 11px;
  font-weight: var(--font-bold);
  justify-content: center;
  width: 36px;
}

.nav-item.active {
  background: #eaf1ff;
  color: var(--color-primary);
  font-weight: var(--font-bold);
}

.nav-item.muted {
  color: #6b7280;
}

.workspace {
  min-width: 0;
}

.topbar {
  align-items: center;
  background: var(--color-bg-white);
  border-bottom: 1px solid #dfe6ef;
  box-shadow: 0 1px 0 rgba(31, 41, 55, 0.04);
  display: flex;
  min-height: 72px;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.topbar h1 {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
}

.topbar p,
.panel-head p,
.alert-head p {
  color: #4a5568;
  font-size: 13px;
  margin-top: 5px;
}

.top-actions,
.filters,
.pagination {
  align-items: center;
  display: flex;
  gap: 10px;
}

.top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.page-tabs {
  background: var(--color-bg-gray);
  border: 1px solid #d8e0eb;
  border-radius: var(--radius-md);
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px;
}

button,
.ghost-button,
.user-pill {
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  height: 36px;
  padding: 0 13px;
}

@media (max-width: 900px) {
  .auth-account-stats {
    grid-template-columns: repeat(3, minmax(100px, 1fr));
  }

  .auth-account-stats > div:nth-child(3) {
    border-right: 0;
  }
}

@media (max-width: 560px) {
  .auth-view {
    align-items: flex-start;
    padding: 16px;
  }

  .auth-panel {
    margin-top: 7vh;
    padding: 22px 18px;
  }

  .auth-profile-body {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 18px;
  }

  .auth-profile-identity {
    flex: 1 1 calc(100% - 72px);
  }

  .auth-profile-action {
    margin-left: 70px;
  }

  .auth-profile-meta {
    flex-direction: column;
    gap: 5px;
  }

  .network-access-row {
    gap: 10px;
    grid-template-columns: 36px minmax(0, 1fr) 44px;
    padding: 10px 14px;
  }

  .auth-account-stats {
    grid-template-columns: repeat(2, minmax(100px, 1fr));
    padding: 0 12px;
  }

  .auth-account-stats > div,
  .auth-account-stats > div:nth-child(3) {
    border-right: 1px solid var(--color-border);
    padding: 12px;
  }

  .auth-account-stats > div:nth-child(even) {
    border-right: 0;
  }

  .auth-modal-grid {
    grid-template-columns: 1fr;
  }
}

.top-status-pill {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  height: 30px;
  padding: 0 10px;
  white-space: nowrap;
}

.top-status-pill.ok {
  background: #e8f9ec;
  border-color: #b8e6c2;
  color: #15803d;
}

.top-status-pill.warn {
  background: #fff7dc;
  border-color: #f4d47a;
  color: #9a6700;
}

.top-status-pill.danger {
  background: #fff1f1;
  border-color: #fecaca;
  color: #b91c1c;
}

.top-status-pill.muted {
  background: #f8fafc;
  border-color: #d8e0eb;
  color: #64748b;
}

@media (max-width: 1100px) {
  .top-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .top-actions .page-tabs {
    flex-basis: 100%;
    max-width: 100%;
  }
}

button {
  background: #2f86f6;
  border: 1px solid #2f86f6;
  color: #ffffff;
  cursor: pointer;
}

.ghost-mini {
  background: var(--color-bg-white);
  border-color: #cbd5e1;
  color: var(--color-primary);
}

.page-tab {
  background: transparent;
  border-color: transparent;
  color: #526174;
  height: 30px;
}

.page-tab.active {
  background: var(--color-bg-white);
  border-color: #d8e0eb;
  color: var(--color-primary);
  font-weight: var(--font-bold);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.ghost-button,
.user-pill {
  align-items: center;
  background: var(--color-bg-white);
  border: 1px solid #d8e0eb;
  color: #334155;
  display: inline-flex;
  text-decoration: none;
}

.docx-button {
  align-items: center;
  background: #16a34a;
  border: 1px solid #16a34a;
  border-radius: var(--radius-md);
  color: #ffffff;
  display: inline-flex;
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  height: 36px;
  justify-content: center;
  padding: 0 14px;
  white-space: nowrap;
}

.docx-button:hover {
  background: #15803d;
  border-color: #15803d;
}

.content {
  padding: 24px;
}

.page-view {
  display: none;
}

.page-view.active {
  display: block;
}

.is-hidden {
  display: none !important;
}

.panel {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 6px rgba(30, 41, 59, 0.04);
}

.summary-card {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 6px rgba(30, 41, 59, 0.04);
  align-items: center;
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  margin-bottom: 16px;
  padding: 10px 18px;
}

.summary-item {
  background: #f8fafd;
  border-radius: var(--radius-md);
  min-height: 54px;
  padding: 9px 16px;
}

.summary-item span {
  color: #4b5563;
  display: block;
  font-size: var(--text-xs);
}

.summary-item strong {
  display: block;
  font-size: var(--text-lg);
  margin-top: 5px;
}

.summary-item.time strong {
  color: #2f86f6;
}

.summary-item.success strong,
.success strong {
  color: var(--color-success);
}

.summary-item.danger strong,
.danger strong {
  color: var(--color-danger);
}

.panel {
  margin-top: 0;
  overflow: hidden;
}

.panel-head {
  align-items: center;
  border-bottom: 1px solid #e7edf5;
  display: flex;
  justify-content: space-between;
  padding: 22px 18px;
}

.panel-head h2 {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
}

.queue-operator-stats {
  border-bottom: 1px solid #e7edf5;
  padding: 16px 18px 18px;
}

.queue-operator-stats-head {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.queue-operator-stats-head h3 {
  font-size: var(--text-md);
  font-weight: var(--font-bold);
}

.queue-operator-stats-head span {
  color: #64748b;
  font-size: var(--text-xs);
}

.queue-operator-stats-table {
  margin: 0;
}

.live-badge {
  background: #e9f9df;
  border-radius: var(--radius-md);
  color: #4cb42c;
  font-size: 13px;
  font-weight: var(--font-bold);
  padding: 5px 9px;
}

.view-switch {
  background: var(--color-bg-gray);
  border: 1px solid #d8e0eb;
  border-radius: var(--radius-md);
  display: flex;
  gap: 3px;
  padding: 3px;
}

.view-switch-btn {
  background: transparent;
  border-color: transparent;
  color: #526174;
  height: 30px;
  padding: 0 10px;
}

.view-switch-btn.active {
  background: #e9f9df;
  border-color: #bfe8a9;
  color: #348a1d;
  font-weight: var(--font-bold);
}

.filters input,
.filters select,
.pagination select {
  border: 1px solid #d8e0eb;
  border-radius: var(--radius-md);
  color: #526174;
  font: inherit;
  height: 36px;
  padding: 0 12px;
}

.filters input {
  min-width: 230px;
}

.filters .time-filter {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filters .time-filter span {
  color: #526174;
  font-size: 12px;
  line-height: 1;
}

.raw-panel-controls {
  align-items: flex-end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  min-width: 0;
}

.monitor-source-fieldset {
  border: 0;
  flex: 0 0 auto;
  margin: 0;
  min-width: 0;
  padding: 0;
}

.monitor-source-fieldset legend {
  align-items: center;
  color: var(--color-text-muted);
  display: flex;
  font-size: 11px;
  gap: 6px;
  justify-content: space-between;
  line-height: 14px;
  margin: 0 0 3px;
  padding: 0;
  width: 100%;
}

.monitor-source-message {
  color: var(--color-text-muted);
  display: block;
  max-width: 132px;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.monitor-source-message.is-success {
  color: var(--color-success);
}

.monitor-source-message.is-error {
  color: var(--color-danger);
}

.monitor-source-control {
  background: var(--color-bg-gray);
  border: 1px solid #d8e0eb;
  border-radius: var(--radius-md);
  display: grid;
  gap: 3px;
  grid-template-columns: 118px 72px;
  height: 36px;
  padding: 3px;
}

.monitor-source-control label {
  cursor: pointer;
  display: block;
  min-width: 0;
  position: relative;
}

.monitor-source-control input {
  height: 1px;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  width: 1px;
}

.monitor-source-control span {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #526174;
  display: flex;
  font-size: 12px;
  font-weight: var(--font-semibold);
  height: 28px;
  justify-content: center;
  padding: 0 9px;
  white-space: nowrap;
}

.monitor-source-control input:checked + span {
  background: #ffffff;
  border-color: #c9dafa;
  color: var(--color-primary);
}

.monitor-source-control input:focus-visible + span {
  outline: 2px solid #2f6df6;
  outline-offset: 2px;
}

.monitor-source-control input:disabled + span {
  cursor: not-allowed;
  opacity: 0.62;
}

.table-wrap {
  max-height: clamp(360px, calc(100vh - 330px), 680px);
  overflow: auto;
  overscroll-behavior: contain;
}

.data-table {
  border-collapse: collapse;
  min-width: 1240px;
  width: 100%;
}

.raw-table {
  min-width: 1760px;
}

.raw-tree-table {
  min-width: 2160px;
  table-layout: fixed;
}

.raw-tree-table .raw-tree-col-expand {
  width: 66px;
}

.raw-tree-table .raw-tree-col-account {
  width: 140px;
}

.raw-tree-table .raw-tree-col-country {
  width: 110px;
}

.raw-tree-table .raw-tree-col-mnc {
  width: 80px;
}

.raw-tree-table .raw-tree-col-channel {
  width: 190px;
}

.raw-tree-table .raw-tree-col-metric,
.raw-tree-table .raw-tree-col-rate {
  width: 96px;
}

.raw-tree-table .raw-tree-col-code {
  width: 100px;
}

.raw-tree-table .raw-tree-col-reason {
  width: 210px;
}

.raw-tree-table .raw-tree-col-detail {
  width: 250px;
}

.raw-tree-table .raw-tree-col-hour {
  width: 150px;
}

.raw-tree-table .raw-tree-col-refresh {
  width: 170px;
}

.raw-tree-table .raw-tree-expand-col,
.raw-tree-table tbody tr.tree-account-row > td:first-child,
.raw-tree-table tbody tr.level-country > td:first-child,
.raw-tree-table tbody tr.level-route > td:first-child {
  padding-left: 7px;
  padding-right: 7px;
  text-align: center;
}

.raw-tree-table .expand-button {
  height: 30px;
  min-width: 50px;
  padding: 0 8px;
}

@media (hover: hover) and (pointer: fine) {
  .raw-tree-table tbody tr.tree-account-row:hover > td {
    background: #e2edff;
  }

  .raw-tree-table tbody tr.level-country:hover > td {
    background: #eaf3ff;
  }

  .raw-tree-table tbody tr.level-route:hover > td {
    background: #f4f8fd;
  }
}

.incident-table {
  min-width: 1880px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid #edf2f7;
  border-right: 1px solid #edf2f7;
  font-size: 13px;
  height: 40px;
  padding: 8px 14px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.data-table tr {
  position: relative;
}

.data-table th {
  background: var(--color-bg-gray);
  color: #394860;
  font-weight: var(--font-bold);
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table th:last-child,
.data-table td:last-child {
  border-right: none;
}

.expand-col {
  width: 74px;
}

.strong {
  font-weight: var(--font-bold);
}

.mcc {
  background: #e7f1ff;
  border: 1px solid #c9dfff;
  border-radius: var(--radius-md);
  color: #2f86f6;
  padding: 3px 8px;
}

.expand-button,
.copy-row button {
  background: var(--color-bg-white);
  border-color: #cbd5e1;
  color: var(--color-primary);
  height: 28px;
  padding: 0 9px;
}

.expand-button {
  font-weight: var(--font-bold);
  min-width: 48px;
}

.expand-button.is-open {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 2px 7px rgba(47, 109, 246, 0.22);
}

.tree-account-row.is-expanded td {
  background: #eaf2ff;
  border-bottom-color: #c5d9f5;
  border-top: 2px solid #2f6df6;
  font-weight: var(--font-bold);
}

.tree-account-row.is-expanded td:first-child {
  box-shadow: inset 5px 0 0 #2f6df6;
}

.row-danger td {
  background: #fff6f6;
}

.row-warning td {
  background: #fbfdff;
}

.row-manual td {
  background: #fff9ea;
}

.sub-row td {
  background: var(--color-bg-page);
  color: #526174;
}

.level-country td {
  background: #fbfdff;
  border-bottom-color: #d8e6f6;
}

.level-route td {
  background: var(--color-bg-white);
  color: #475569;
}

.level-country td:first-child {
  box-shadow: inset 4px 0 0 #75a7f8;
}

.level-country.is-expanded td {
  background: #f0f6ff;
  border-bottom-color: #bcd7fb;
}

.level-country.is-expanded td:first-child {
  box-shadow: inset 5px 0 0 #2f86f6;
}

.level-route td:first-child {
  box-shadow: inset 4px 0 0 #ccd8e8;
}

.level-route td:nth-child(2) {
  border-left: 18px solid #f3f7fb;
}

.level-country.row-danger td,
.level-route.row-danger td {
  background: #fff7f7;
}

.level-route.route-bad-row td {
  background: #fffafa;
}

.level-country.row-warning td {
  background: #f7fbff;
}

.level-country.row-manual td,
.level-route.row-manual td {
  background: #fff6df;
}

.level-country.row-manual td:first-child,
.level-route.row-manual td:first-child {
  box-shadow: inset 5px 0 0 #f5aa2f;
}

.level-country.row-danger td:first-child,
.level-route.row-danger td:first-child,
.level-route.route-bad-row td:first-child {
  box-shadow: inset 4px 0 0 #e44b4b;
}

.tree-indent {
  color: #6b7280;
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  margin-right: 10px;
  min-width: 32px;
}

.route-indent {
  margin-left: 18px;
  min-width: 40px;
}

.level-country .tree-indent::before {
  color: #2f86f6;
  content: "└";
  font-weight: var(--font-bold);
  margin-right: 8px;
}

.level-route .tree-indent::before {
  color: #6b7280;
  content: "└";
  font-weight: var(--font-bold);
  margin-right: 8px;
}

.tag {
  border-radius: var(--radius-full);
  display: inline-flex;
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  line-height: 1;
  padding: 5px 10px;
}

.tag-customer {
  background: #ffe1e1;
  color: #d83434;
}

.tag-route {
  background: #def4ff;
  color: #087da8;
}

.tag-manual {
  background: #fff1cf;
  color: var(--color-warning-dark);
}

.tag-observe {
  background: #e9f1ff;
  color: var(--color-primary);
}

.tag-idle {
  background: #edf2f7;
  color: #475569;
}

.tag-ok {
  background: #e8f9ec;
  color: var(--color-success-dark);
}

.tg-action {
  background: #e6f4ff;
  border-color: #9bd2ff;
  color: #075d91;
}

.tg-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 18px;
}

.tg-card {
  background: var(--color-bg-white);
  border: 1px solid #e0e9f5;
  border-radius: var(--radius-md);
  display: grid;
  gap: var(--spacing-3);
  padding: var(--spacing-4);
}

.tg-card h3 {
  margin: 0;
}

.tg-card label {
  color: #526174;
  display: grid;
  font-size: 13px;
  font-weight: var(--font-semibold);
  gap: 6px;
}

.tg-card input,
.tg-card select {
  border: 1px solid #cfdceb;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  min-height: 36px;
  padding: 8px 10px;
}

.tg-card-wide {
  grid-column: 1 / -1;
}


.tg-work-toolbar {
  align-items: end;
  border-bottom: 1px solid #e1e8f2;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(150px, 190px) repeat(6, minmax(112px, max-content)) 1fr;
  padding: 18px;
}

.tg-work-toolbar label {
  color: #526174;
  display: grid;
  font-size: var(--text-xs);
  gap: 6px;
}

.tg-work-toolbar input {
  border: 1px solid #cfdceb;
  border-radius: var(--radius-md);
  font: inherit;
  min-height: 36px;
  padding: 8px 10px;
}

.tg-work-stats {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.tg-work-stats span,
.tg-work-confidence {
  background: #edf2f7;
  border-radius: var(--radius-full);
  color: #475569;
  display: inline-flex;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  line-height: 1;
  padding: 6px 9px;
  white-space: nowrap;
}

.tg-work-dialog-picker {
  border-bottom: 1px solid #e1e8f2;
  display: grid;
  gap: 10px;
  padding: 14px 18px;
}

.tg-work-dialog-picker-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.tg-work-dialog-picker-head span {
  color: #64748b;
  font-size: var(--text-xs);
}

.tg-work-dialog-list {
  border: 1px solid #e0e9f5;
  border-radius: var(--radius-md);
  display: grid;
  gap: 0;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  max-height: 180px;
  overflow: auto;
}

.tg-work-dialog-option {
  align-items: center;
  border-bottom: 1px solid #edf2f7;
  border-right: 1px solid #edf2f7;
  display: flex;
  gap: 8px;
  min-width: 0;
  padding: 9px 10px;
}

.tg-work-dialog-option span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.tg-work-dialog-option strong,
.tg-work-dialog-option small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tg-work-dialog-option small {
  color: #64748b;
  font-size: var(--text-xs);
}

.tg-work-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  padding: 18px;
}

.tg-work-report-section {
  border-top: 1px solid #dbe4ef;
  display: grid;
  gap: 14px;
  padding: 18px;
}

.tg-work-report-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.tg-work-report-head h3 {
  color: #172033;
  font-size: var(--text-base);
  margin: 0 0 4px;
}

.tg-work-report-head span,
.tg-work-report-notes > span {
  color: #64748b;
  font-size: var(--text-xs);
}

.tg-work-report-controls {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(240px, 1.5fr) 132px 132px minmax(150px, auto) repeat(3, auto);
}

.tg-work-report-controls label,
.tg-work-report-notes {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.tg-work-report-controls label > span {
  color: #475569;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}

.tg-work-report-controls .work-report-toggle {
  align-items: center;
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.tg-work-report-controls input,
.tg-work-report-controls select {
  background: #ffffff;
  border: 1px solid #ced9e7;
  border-radius: var(--radius-md);
  color: #27364a;
  font: inherit;
  height: 36px;
  min-width: 0;
  padding: 0 10px;
  width: 100%;
}

.tg-work-report-layout {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(260px, 0.34fr) minmax(0, 1fr);
}

.tg-work-report-notes .work-report-input {
  min-height: 180px;
}

.tg-work-report-output {
  background: #f8fafc;
  border: 1px solid #d8e0eb;
  min-height: 220px;
  min-width: 0;
  overflow: hidden;
}

.tg-work-report-output.empty {
  align-items: center;
  display: flex;
  justify-content: center;
}

.tg-work-report-output .work-plan-sheet,
.tg-work-report-output .markdown-preview {
  border: 0;
  min-height: 218px;
}

@media (max-width: 1200px) {
  .tg-work-report-controls {
    grid-template-columns: minmax(220px, 1fr) repeat(2, 132px) repeat(3, auto);
  }

  .tg-work-report-layout {
    grid-template-columns: 1fr;
  }

  .tg-work-report-notes .work-report-input {
    min-height: 110px;
  }
}

@media (max-width: 960px) {
  .tg-work-report-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tg-work-report-controls label:first-child {
    grid-column: 1 / -1;
  }

  .tg-work-report-controls button {
    width: 100%;
  }
}

.tg-work-card {
  border: 1px solid #e0e9f5;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.tg-work-card-head {
  align-items: center;
  background: #f8fbff;
  border-bottom: 1px solid #e0e9f5;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 14px;
}

.tg-work-card-head h3 {
  font-size: var(--text-base);
  margin: 0;
}

.tg-work-card-head span {
  color: #64748b;
  font-size: var(--text-xs);
}

.tg-work-item-filters {
  align-items: center;
  background: #fbfdff;
  border-bottom: 1px solid #e0e9f5;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(180px, 1fr) minmax(112px, 150px) minmax(96px, 120px) auto;
  padding: 10px 12px;
}

.tg-work-item-filters input,
.tg-work-item-filters select {
  background: var(--color-bg-white);
  border: 1px solid #d7e1ee;
  border-radius: var(--radius-md);
  color: #334155;
  font: inherit;
  height: 32px;
  min-width: 0;
  padding: 0 9px;
}

.tg-work-table-wrap {
  border: 0;
  max-height: 560px;
  overflow: auto;
}

.tg-work-table {
  min-width: 780px;
  table-layout: fixed;
}

.tg-work-messages-table {
  min-width: 1120px;
}

.tg-work-items-table {
  min-width: 940px;
}

.tg-work-table th,
.tg-work-table td {
  font-size: var(--text-xs);
  height: auto;
  line-height: 1.45;
  min-height: 42px;
  padding: 8px 10px;
  vertical-align: top;
}

.tg-work-messages-table th:nth-child(1),
.tg-work-messages-table td:nth-child(1) {
  width: 64px;
}

.tg-work-messages-table th:nth-child(2),
.tg-work-messages-table td:nth-child(2) {
  width: 180px;
}

.tg-work-messages-table th:nth-child(3),
.tg-work-messages-table td:nth-child(3) {
  width: 430px;
}

.tg-work-messages-table th:nth-child(4),
.tg-work-messages-table td:nth-child(4) {
  width: 330px;
}

.tg-work-messages-table th:nth-child(5),
.tg-work-messages-table td:nth-child(5) {
  width: 90px;
}

.tg-work-items-table th:nth-child(1),
.tg-work-items-table td:nth-child(1) {
  width: 74px;
}

.tg-work-items-table th:nth-child(2),
.tg-work-items-table td:nth-child(2) {
  width: 460px;
}

.tg-work-items-table th:nth-child(3),
.tg-work-items-table td:nth-child(3) {
  width: 110px;
}

.tg-work-items-table th:nth-child(4),
.tg-work-items-table td:nth-child(4) {
  width: 160px;
}

.tg-work-items-table th:nth-child(5),
.tg-work-items-table td:nth-child(5) {
  background: var(--color-bg-white);
  box-shadow: -8px 0 14px rgba(148, 163, 184, 0.16);
  position: sticky;
  right: 0;
  width: 112px;
  z-index: 1;
}

.tg-work-items-table th:nth-child(5) {
  background: var(--color-bg-gray);
  z-index: 3;
}

.tg-work-items-table .row-actions {
  flex-wrap: nowrap;
  min-width: 92px;
}

.tg-work-message {
  max-width: none;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
  word-break: break-word;
}

.tg-work-table .wide-cell {
  max-width: none;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
  word-break: break-word;
}

.tg-work-table .wide-cell span {
  white-space: normal;
}

.tg-work-table tr.is-deleted td {
  color: #94a3b8;
  text-decoration: line-through;
}

.danger-button {
  border-color: #fecaca;
  color: var(--color-danger-dark);
}

@media (max-width: 1200px) {
  .tg-work-toolbar,
  .tg-work-grid {
    grid-template-columns: 1fr;
  }

  .tg-work-item-filters {
    grid-template-columns: minmax(0, 1fr) minmax(112px, 150px) minmax(96px, 120px) auto;
  }

  .tg-work-stats {
    justify-content: flex-start;
  }
}

.tg-list {
  border: 1px solid #edf2f7;
  border-radius: var(--radius-md);
  max-height: 260px;
  overflow: auto;
}

.tg-list-item {
  border-bottom: 1px solid #edf2f7;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
}

.tg-list-item:last-child {
  border-bottom: 0;
}

.tg-list-item span,
.tg-list-item small {
  color: #64748b;
  font-size: var(--text-xs);
}

.tg-success strong {
  color: var(--color-success-dark);
}

.tg-failed strong {
  color: var(--color-danger-dark);
}

.danger {
  color: var(--color-danger-dark);
  font-weight: var(--font-bold);
}

.ok {
  color: #35b94f;
  font-weight: var(--font-bold);
}

.empty {
  color: #4b5563;
  padding: 28px;
  text-align: center;
}

.tg-dialog-empty-state {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  grid-column: 1 / -1;
  justify-content: center;
  min-height: 112px;
}

.pagination {
  border-top: 1px solid #e7edf5;
  justify-content: flex-end;
  padding: 12px 18px;
}

.alert-list {
  padding: 0;
}

.alert-overview {
  border-bottom: 1px solid #e7edf5;
  display: grid;
  gap: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.alert-overview div {
  background: #f8fbff;
  border-right: 1px solid #e7edf5;
  min-height: 66px;
  padding: 12px 16px;
}

.alert-overview div:last-child {
  border-right: none;
}

.alert-overview span {
  color: #64748b;
  display: block;
  font-size: var(--text-xs);
  margin-bottom: 6px;
}

.alert-overview strong {
  color: #142033;
  display: block;
  font-size: var(--text-xl);
  line-height: 1;
}

.alert-table-wrap {
  border: none;
  max-height: clamp(320px, calc(100vh - 430px), 620px);
}

.alert-table {
  min-width: 1120px;
}

.alert-table th,
.alert-table td {
  height: 46px;
}

.alert-table tbody tr:hover td {
  background: #f4f8ff;
}

.tree-account-row td {
  background: #eef5ff;
  border-bottom-color: #cdddf0;
  color: #15243b;
  font-size: var(--text-sm);
}

.tree-account-row td:first-child {
  box-shadow: inset 4px 0 0 #2f6df6;
}

.tree-account-row .danger,
.level-country .danger,
.level-route .danger,
.tree-account-row .ok,
.level-country .ok,
.level-route .ok {
  font-size: var(--text-sm);
}

.level-country td {
  color: #24364f;
}

.level-route td {
  border-bottom-style: dashed;
  color: #42526a;
}

.level-route .strong {
  color: var(--color-text-primary);
}

.alert-table .wide-cell {
  max-width: 340px;
}

.alert-table .row-actions {
  flex-wrap: nowrap;
}

.alert-table .copy-action {
  background: var(--color-bg-white);
  border-color: #b9c8da;
  color: #1f67d8;
  font-weight: var(--font-semibold);
}

.alert-table .copy-action:hover,
.expand-button:hover {
  border-color: var(--color-primary);
}

.observation-view {
  display: none;
}

.observation-table {
  min-width: 1120px;
}

.observation-table th,
.observation-table td {
  height: 44px;
}

.object-cell,
.performance-cell {
  display: grid;
  gap: 4px;
  line-height: 1.25;
}

.object-cell span,
.performance-cell span,
.wide-cell span {
  color: #64748b;
  display: block;
  font-size: var(--text-xs);
  margin-top: 4px;
  white-space: nowrap;
}

.alert-route {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-action {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wide-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.copy-action {
  background: var(--color-bg-white);
  border-color: #cbd5e1;
  color: var(--color-primary);
  height: 28px;
  min-width: 58px;
  padding: 0 10px;
}

.incident-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.incident-actions {
  min-width: 330px;
}

.incident-actions .copy-action,
.row-actions .copy-action {
  min-width: 62px;
}

.alert-actions .copy-action {
  min-width: 74px;
}

.incident-table th,
.incident-table td {
  font-size: var(--text-xs);
  height: 42px;
  max-height: 42px;
  padding: 6px 10px;
}

.incident-table tbody tr {
  height: 42px;
}

.incident-table .tag {
  font-size: 11px;
  padding: 4px 8px;
}

.incident-table .wide-cell {
  max-width: 180px;
}

.incident-table td:nth-child(1) {
  width: 72px;
}

.incident-table td:nth-child(5) {
  max-width: 170px;
}

.incident-table td:nth-child(8) {
  max-width: 210px;
}

.incident-table td:nth-child(13) {
  min-width: 150px;
}

.incident-table td:nth-child(18) {
  min-width: 340px;
}

.incident-table .row-actions {
  align-items: center;
  flex-wrap: nowrap;
  gap: 5px;
  min-width: 330px;
  white-space: nowrap;
}

.incident-table .copy-action {
  font-size: var(--text-xs);
  height: 26px;
  min-width: 56px;
  padding: 0 8px;
}

.rule-editor {
  display: grid;
  gap: 0;
  padding: 0;
}

.rule-editor-section {
  border-bottom: 1px solid #e7edf5;
  display: grid;
  gap: var(--spacing-3);
  padding: var(--spacing-4) var(--spacing-5);
}

.rule-editor-title {
  align-items: baseline;
  display: flex;
  gap: 10px;
}

.rule-editor-title strong {
  color: var(--color-text-primary);
  font-size: 15px;
  font-weight: var(--font-bold);
}

.rule-editor-title span {
  color: #64748b;
  font-size: var(--text-xs);
}

.rule-editor-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.rule-editor-grid-basic {
  grid-template-columns: minmax(130px, 1fr) minmax(260px, 2fr) minmax(130px, 1fr) minmax(270px, 2fr) minmax(160px, 1fr);
}

.rule-metric-select {
  display: none;
}

.rule-metric-tabs {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.rule-metric-tab {
  align-items: flex-start;
  background: #f8fafc;
  border: 1px solid #d8e0eb;
  border-radius: var(--radius-md);
  color: #334155;
  cursor: pointer;
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 10px 12px;
  text-align: left;
}

.rule-metric-tab strong {
  color: #0f172a;
  font-size: 14px;
}

.rule-metric-tab span {
  color: #64748b;
  font-size: var(--text-xs);
  line-height: 1.4;
}

.rule-metric-tab.active {
  background: #eff6ff;
  border-color: #93c5fd;
  box-shadow: inset 0 0 0 1px #bfdbfe;
}

.rule-metric-tab.active strong {
  color: #1d4ed8;
}

.rule-editor-grid-notice {
  grid-template-columns: minmax(260px, 2fr) minmax(220px, 1.5fr) minmax(120px, 1fr) minmax(220px, 1.5fr) auto auto auto;
}

.rule-notice-template-label {
  grid-column: 1 / -1;
}

.rule-notice-template-label textarea {
  min-height: 74px;
  resize: vertical;
}

.template-token-bar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  grid-column: 1 / -1;
  margin-top: -4px;
}

.token-button {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #1f67d8;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  height: 26px;
  min-width: 48px;
  padding: 0 8px;
}

.token-button:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

.token-divider {
  font-size: var(--text-xs);
  color: #64748b;
  font-weight: var(--font-semibold);
  padding: 0 4px;
  display: flex;
  align-items: center;
}

.rule-editor label {
  color: #64748b;
  display: grid;
  font-size: var(--text-xs);
  gap: 5px;
}

.rule-editor input,
.rule-editor select {
  border: 1px solid #d8e0eb;
  border-radius: var(--radius-md);
  color: #334155;
  font: inherit;
  height: 36px;
  min-width: 0;
  padding: 0 10px;
}

.rule-editor button {
  align-self: end;
}

.rule-table {
  min-width: 1720px;
}

.rule-filtered-table {
  min-width: 1320px;
}

.rule-section {
  border-top: 1px solid #e7edf5;
}

.rule-section-head {
  align-items: center;
  background: var(--color-bg-page);
  display: flex;
  justify-content: space-between;
  padding: 14px 18px;
}

.rule-section-head h3 {
  color: var(--color-text-primary);
  font-size: 15px;
  font-weight: var(--font-bold);
}

.rule-section-head p {
  color: #64748b;
  font-size: var(--text-xs);
  margin-top: 4px;
}

.rule-section-custom .rule-section-head {
  background: #f6fbff;
}

.rule-count {
  background: var(--color-bg-white);
  border: 1px solid #d8e0eb;
  border-radius: var(--radius-md);
  color: #526174;
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  padding: 5px 9px;
}

/* Queue inspection rules: keep the editor readable at desktop widths and
   let the fields stack cleanly on narrow screens. */
[data-page="queue-rules"] .panel {
  border: 1px solid #dce5f0;
  border-radius: 8px;
  background: #fff;
}

[data-page="queue-rules"] .panel-head {
  padding: 20px 24px;
  background: #fbfdff;
}

[data-page="queue-rules"] .panel-head h2 {
  font-size: 18px;
  letter-spacing: 0;
}

[data-page="queue-rules"] .panel-head p {
  margin-top: 6px;
  color: #64748b;
  font-size: 12px;
}

[data-page="queue-rules"] .panel-head .filters {
  flex-direction: row;
  gap: 8px;
  width: auto;
}

[data-page="queue-rules"] .queue-rule-editor {
  display: grid;
  gap: 0;
  padding: 0 24px;
  background: #f8fafc;
  border-bottom: 1px solid #e7edf5;
}

[data-page="queue-rules"] .queue-rule-block {
  padding: 18px 0 20px;
}

[data-page="queue-rules"] .queue-rule-block + .queue-rule-block {
  border-top: 1px solid #e2e8f0;
}

[data-page="queue-rules"] .queue-rule-block-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

[data-page="queue-rules"] .queue-rule-block-head strong {
  color: #0f172a;
  font-size: 14px;
}

[data-page="queue-rules"] .queue-rule-block-head span {
  color: #64748b;
  font-size: 12px;
}

[data-page="queue-rules"] .queue-rule-grid {
  display: grid;
  gap: 12px 14px;
  align-items: end;
}

[data-page="queue-rules"] .queue-rule-grid-match {
  grid-template-columns: minmax(220px, 1.7fr) minmax(200px, 1.5fr) repeat(4, minmax(120px, 1fr));
}

[data-page="queue-rules"] .queue-rule-grid-target {
  grid-template-columns: minmax(240px, 1.35fr) minmax(270px, 1.5fr) auto minmax(220px, 1.15fr) minmax(220px, 1.2fr);
}

[data-page="queue-rules"] .queue-rule-chat-picker-field {
  grid-column: span 1;
}

[data-page="queue-rules"] .queue-rule-dialog-action {
  display: grid;
  align-content: end;
  gap: 6px;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

[data-page="queue-rules"] .queue-rule-dialog-action button {
  height: 36px;
  white-space: nowrap;
}

[data-page="queue-rules"] .queue-rule-grid label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
}

[data-page="queue-rules"] .queue-rule-grid input,
[data-page="queue-rules"] .queue-rule-grid select {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}

[data-page="queue-rules"] .queue-rule-grid input:focus,
[data-page="queue-rules"] .queue-rule-grid select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
  outline: none;
}

[data-page="queue-rules"] .table-wrap {
  padding: 0 24px 20px;
}

[data-page="queue-rules"] .rule-table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
}

[data-page="queue-rules"] .rule-table th,
[data-page="queue-rules"] .rule-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-page="queue-rules"] .rule-table th:nth-child(1) { width: 80px; }
[data-page="queue-rules"] .rule-table th:nth-child(2) { width: 22%; }
[data-page="queue-rules"] .rule-table th:nth-child(3) { width: 18%; }
[data-page="queue-rules"] .rule-table th:nth-child(4) { width: 14%; }
[data-page="queue-rules"] .rule-table th:nth-child(5) { width: 10%; }
[data-page="queue-rules"] .rule-table th:nth-child(6) { width: 24%; }
[data-page="queue-rules"] .rule-table th:nth-child(7) { width: 90px; }

[data-page="queue-rules"] #queueRulesMessage {
  margin: 0 24px 18px;
  min-height: 18px;
  color: #2563eb;
  font-size: 12px;
}

[data-page="queue-snapshot"] .panel-head .queue-send-target {
  display: inline-grid;
  grid-template-columns: auto minmax(170px, 240px);
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

[data-page="queue-snapshot"] .panel-head .queue-send-target select {
  height: 36px;
  min-width: 0;
  padding: 0 28px 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  font: inherit;
}

@media (max-width: 1100px) {
  [data-page="queue-snapshot"] .panel-head .queue-send-target {
    width: 100%;
    grid-template-columns: 1fr;
  }

  [data-page="queue-snapshot"] .panel-head .queue-send-target select {
    width: 100%;
  }
}

@media (max-width: 1200px) {
  [data-page="queue-rules"] .queue-rule-grid-match {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  [data-page="queue-rules"] .queue-rule-name-field,
  [data-page="queue-rules"] .queue-rule-consumer-field {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  [data-page="queue-rules"] .panel-head .filters {
    width: 100%;
  }

  [data-page="queue-rules"] .panel-head .filters button {
    flex: 1;
  }

  [data-page="queue-rules"] .queue-rule-editor,
  [data-page="queue-rules"] .table-wrap {
    padding-left: 16px;
    padding-right: 16px;
  }

  [data-page="queue-rules"] .queue-rule-grid-match,
  [data-page="queue-rules"] .queue-rule-grid-target {
    grid-template-columns: 1fr;
  }

  [data-page="queue-rules"] .queue-rule-name-field,
  [data-page="queue-rules"] .queue-rule-consumer-field {
    grid-column: auto;
  }

  [data-page="queue-rules"] #queueRulesMessage {
    margin-left: 16px;
    margin-right: 16px;
  }
}

.rule-scope-badge {
  background: #eef6ff;
  border: 1px solid #c9ddff;
  border-radius: var(--radius-md);
  color: #2563eb;
  display: inline-block;
  font-size: 11px;
  font-weight: var(--font-bold);
  margin-left: 8px;
  padding: 2px 6px;
  white-space: nowrap;
}

.inline-status {
  color: #64748b;
  font-size: 13px;
  min-height: 18px;
  padding: 0 18px 12px;
}

.placeholder-panel {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 28px;
}

.placeholder-panel h2 {
  font-size: var(--text-lg);
}

.placeholder-panel p {
  color: #64748b;
  font-size: 13px;
  margin-top: 8px;
}

.markdown-preview {
  background: #0f172a;
  color: #e2e8f0;
  font: 13px/1.7 Consolas, "Microsoft YaHei", monospace;
  margin: 0;
  max-height: 620px;
  overflow: auto;
  padding: 18px 20px;
  white-space: pre-wrap;
}

.work-report-box {
  border-bottom: 1px solid #e1e8f2;
  display: grid;
  gap: 12px;
  padding: 18px;
}

.work-report-controls {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.work-report-controls label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.work-report-controls span {
  color: #4a5568;
  font-size: var(--text-xs);
}

.work-report-text-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.work-report-text-grid label {
  color: #4a5568;
  display: grid;
  font-size: var(--text-xs);
  gap: 6px;
}

.work-report-controls input,
.work-report-controls select,
.work-report-input {
  border: 1px solid #d8e0eb;
  border-radius: var(--radius-md);
  color: #334155;
  font: inherit;
  min-height: 36px;
  padding: 8px 10px;
  width: 100%;
}

.work-report-toggle {
  align-items: center;
  flex-direction: row !important;
  min-height: 36px;
}

.work-report-toggle input {
  min-height: auto;
  width: auto;
}

.work-report-input {
  line-height: 1.6;
  min-height: 130px;
  resize: vertical;
}

@media (max-width: 900px) {
  .work-report-text-grid {
    grid-template-columns: 1fr;
  }
}

.work-report-output {
  border-bottom: 1px solid #e1e8f2;
  padding: 18px;
}

.work-report-loading,
.work-report-error {
  background: #f8fafc;
  border: 1px solid #d8e0eb;
  border-radius: var(--radius-md);
  color: #334155;
  font-size: var(--text-sm);
  padding: 14px 16px;
}

.work-report-error {
  background: #fff5f5;
  border-color: #fecaca;
  color: #b91c1c;
}

.work-report-preview {
  border-radius: var(--radius-md);
  max-height: 520px;
}

.work-plan-sheet {
  background: #ffffff;
  border: 1px solid #cfd8e3;
  color: #111827;
  display: grid;
  gap: 12px;
  padding: 18px;
}

.work-plan-actions {
  display: flex;
  justify-content: flex-end;
}

.work-plan-title {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  text-align: center;
}

.work-plan-meta {
  display: grid;
  gap: 10px;
  grid-template-columns: 2fr 1fr 1fr;
}

.work-plan-meta span {
  border-bottom: 1px solid #94a3b8;
  color: #111827;
  font-size: var(--text-sm);
  min-height: 30px;
  padding: 4px 2px;
}

@media (max-width: 600px) {
  .work-plan-meta {
    grid-template-columns: 1fr;
  }
}

.work-plan-section-title {
  background: #edf2f7;
  border: 1px solid #cfd8e3;
  color: #111827;
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  padding: 8px 10px;
}

.work-plan-tasks {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.work-plan-tasks li {
  align-items: start;
  border-bottom: 1px solid #e5e7eb;
  display: grid;
  font-size: var(--text-sm);
  gap: 8px;
  grid-template-columns: 24px minmax(0, 1fr);
  min-height: 30px;
  padding: 4px 2px 8px;
}

.work-plan-tasks li span {
  font-weight: var(--font-bold);
}

.work-plan-table-wrap {
  border: 1px solid #cfd8e3;
}

.work-plan-table {
  border-collapse: collapse;
  min-width: 860px;
  width: 100%;
}

.work-plan-table th,
.work-plan-table td {
  border-bottom: 1px solid #cfd8e3;
  border-right: 1px solid #cfd8e3;
  color: #111827;
  font-size: var(--text-sm);
  line-height: 1.45;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.work-plan-table th {
  background: #f1f5f9;
  font-weight: var(--font-bold);
  white-space: nowrap;
}

.work-plan-table th:last-child,
.work-plan-table td:last-child {
  border-right: 0;
}

.work-plan-table tr:last-child td {
  border-bottom: 0;
}

.work-plan-table td:nth-child(1),
.work-plan-table td:nth-child(2) {
  white-space: nowrap;
  width: 120px;
}

.work-plan-table td:nth-child(3) {
  min-width: 420px;
  white-space: pre-line;
}

.work-plan-table td:nth-child(4) {
  width: 230px;
}

.work-plan-summary {
  border: 1px solid #cfd8e3;
  color: #111827;
  font-size: var(--text-sm);
  line-height: 1.7;
  min-height: 72px;
  padding: 10px 12px;
}

.notice-editor {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 18px;
}

.notice-card {
  background: var(--color-bg-page);
  border: 1px solid #e1e8f2;
  border-radius: var(--radius-md);
  padding: var(--spacing-4);
}

.notice-card h3 {
  font-size: 15px;
  margin-bottom: 12px;
}

.notice-card textarea {
  border: 1px solid #d8e0eb;
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font: 14px/1.6 "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  min-height: 148px;
  padding: 10px 12px;
  resize: vertical;
  width: 100%;
}

.notice-help p {
  color: #526174;
  font-size: 13px;
  line-height: 1.7;
  margin-top: 12px;
}

.notice-token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.notice-token-list code {
  background: var(--color-bg-white);
  border: 1px solid #d8e0eb;
  border-radius: var(--radius-md);
  color: var(--color-primary);
  font-size: var(--text-xs);
  padding: 5px 8px;
}

.notice-preview {
  display: grid;
  gap: 10px;
}

.notice-preview pre {
  background: var(--color-bg-white);
  border: 1px solid #d8e0eb;
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font: 14px/1.6 "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  margin: 0;
  min-height: 54px;
  padding: 10px 12px;
  white-space: pre-wrap;
}

.ai-workbench {
  overflow: visible;
}

.ai-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  padding: var(--spacing-4) var(--spacing-5) 0;
}

.ai-chat-layout {
  grid-template-columns: 1fr;
}

.ai-layout:last-child {
  padding-bottom: 18px;
}

.ai-card {
  background: var(--color-bg-page);
  border: 1px solid #e3eaf4;
  border-radius: var(--radius-md);
  padding: var(--spacing-4);
}

.ai-card h3 {
  font-size: 15px;
  margin-bottom: 12px;
}

.ai-card-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ai-card-head h3 {
  margin-bottom: 0;
}

.ai-card-head span {
  color: #4a5568;
  font-size: var(--text-xs);
}

.ai-chat-card {
  background: var(--color-bg-white);
}

.ai-chat-messages {
  background: #f6f9fd;
  border: 1px solid #e1e8f2;
  border-radius: var(--radius-md);
  display: grid;
  gap: 10px;
  max-height: 360px;
  min-height: 180px;
  overflow: auto;
  padding: 12px;
}

.ai-message {
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  max-width: 82%;
  padding: 10px 12px;
}

.ai-message strong {
  color: #334155;
  display: block;
  font-size: var(--text-xs);
  margin-bottom: 5px;
}

.ai-message p {
  color: var(--color-text-primary);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.ai-message.assistant {
  background: var(--color-bg-white);
  justify-self: start;
}

.ai-message.user {
  background: #eaf2ff;
  border-color: #c9dcfb;
  justify-self: end;
}

.ai-chat-input {
  color: #4a5568;
  display: grid;
  font-size: var(--text-xs);
  gap: 6px;
  margin-top: 12px;
}

.ai-chat-input textarea {
  border: 1px solid #d8e0eb;
  border-radius: var(--radius-md);
  color: #334155;
  font: inherit;
  line-height: 1.55;
  padding: 10px 12px;
  resize: vertical;
  width: 100%;
}

.ai-form-grid {
  display: grid;
  gap: var(--spacing-3);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ai-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-form-grid span,
.hint-text {
  color: #4a5568;
  font-size: var(--text-xs);
}

.ai-form-grid input,
.ai-form-grid select,
.ai-form-grid textarea {
  border: 1px solid #d8e0eb;
  border-radius: var(--radius-md);
  color: #334155;
  font: inherit;
  min-height: 36px;
  padding: 8px 10px;
  width: 100%;
}

.ai-form-grid textarea {
  line-height: 1.55;
  resize: vertical;
}

.ai-wide {
  grid-column: 1 / -1;
}

.hint-text {
  margin-top: 10px;
}

.ai-list {
  display: grid;
  gap: 10px;
  max-height: 560px;
  overflow: auto;
}

.ai-item {
  background: var(--color-bg-white);
  border: 1px solid #e1e8f2;
  border-radius: var(--radius-md);
  padding: 12px;
}

.ai-item-head {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ai-item-title {
  font-weight: var(--font-bold);
}

.ai-item-meta {
  color: #4b5563;
  font-size: var(--text-xs);
}

.ai-summary,
.ai-draft-json {
  background: #f5f8fc;
  border-radius: var(--radius-md);
  color: #334155;
  font-family: Consolas, "Courier New", monospace;
  font-size: var(--text-xs);
  line-height: 1.55;
  margin-top: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 10px;
  white-space: pre-wrap;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .summary-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar,
  .panel-head,
  .alert-head {
    align-items: flex-start;
    flex-direction: column;
    gap: var(--spacing-3);
  }

  .filters {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .rule-editor {
    grid-template-columns: 1fr;
  }

  .notice-editor {
    grid-template-columns: 1fr;
  }

  .alert-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .alert-overview div:nth-child(2) {
    border-right: none;
  }

  .filters input,
  .filters select {
    min-width: 0;
    width: 100%;
  }
}

/* Phase 1: 焦点样式 - 键盘导航支持 */
:focus-visible {
  outline: 2px solid #2f6df6;
  outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid #2f6df6;
  outline-offset: 2px;
}

/* Phase 1: 汉堡菜单按钮 */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  width: 40px;
  height: 40px;
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 0;
}

.hamburger-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: white;
  border-radius: 1px;
}

/* Phase 1: 侧边栏遮罩层 */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
}

.sidebar-overlay.open {
  display: block;
}

/* Phase 1: 移动端适配 */
@media (max-width: 1100px) {
  .hamburger-btn {
    display: flex;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: flex;
    position: fixed;
    left: -260px;
    top: 0;
    height: 100vh;
    width: 260px;
    background: white;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    transition: left 0.3s ease;
    z-index: 999;
  }

  .sidebar.open {
    left: 0;
  }

  .workspace {
    padding-left: 0;
  }

  .topbar {
    padding-left: 60px;
  }

  .summary-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar,
  .panel-head,
  .alert-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .filters {
    flex-direction: column;
    width: 100%;
  }

  .rule-editor-grid {
    grid-template-columns: 1fr;
  }

  .notice-editor {
    grid-template-columns: 1fr;
  }

  .alert-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .alert-overview div:nth-child(2) {
    border-right: none;
  }

  .filters input,
  .filters select {
    min-width: 0;
    width: 100%;
  }
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* Modal Container */
.modal-container {
  background: var(--color-bg-white);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 900px;
}

/* Modal Header */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 6px;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  background: var(--color-bg-gray);
  color: var(--color-text-primary);
}

/* Modal Body */
.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* Modal Footer */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
}

/* Rule Editor Modal Specific */
.rule-editor-modal {
  max-width: 800px;
  width: 85vw;
  max-height: 85vh;
}

.rule-editor-modal .modal-body {
  padding: 12px 16px;
  overflow-x: hidden;
  overflow-y: auto;
}

.rule-editor-modal .rule-editor {
  border: none;
  padding: 0;
  margin: 0;
  display: block;
}

.rule-editor-modal .rule-editor-section {
  margin-bottom: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border-light);
}

.rule-editor-modal .rule-editor-section:last-child {
  margin-bottom: 0;
  border-bottom: none;
}

.rule-editor-modal .rule-editor-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
}

.rule-editor-modal .rule-editor-grid-basic {
  grid-template-columns: repeat(2, 1fr);
}

.rule-editor-modal .rule-editor-grid-notice {
  grid-template-columns: repeat(2, 1fr);
}

.rule-editor-modal .rule-notice-template-label {
  grid-column: 1 / -1;
}

.rule-editor-modal .rule-metric-tabs {
  grid-template-columns: repeat(3, 1fr);
}

.rule-editor-modal .template-token-bar {
  grid-column: 1 / -1;
  flex-wrap: wrap;
}

.rule-editor-modal .rule-editor label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #64748b;
}

.rule-editor-modal .rule-editor label select,
.rule-editor-modal .rule-editor label input {
  width: 100%;
  min-width: 0;
  height: 32px;
  border: 1px solid #d8e0eb;
  border-radius: 4px;
  padding: 0 8px;
  font-size: 13px;
}

.rule-editor-modal .rule-editor label textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #d8e0eb;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 13px;
  resize: vertical;
}

.rule-editor-modal .rule-editor-title strong {
  font-size: 14px;
}

.rule-editor-modal .rule-editor-title span {
  font-size: 11px;
}

.rule-editor-modal .rule-metric-tab {
  padding: 8px 10px;
  min-height: 48px;
}

.rule-editor-modal .rule-metric-tab strong {
  font-size: 13px;
}

.rule-editor-modal .rule-metric-tab span {
  font-size: 11px;
}

/* ETMS receive records */
.page-view[data-page="et-receive"].active {
  display: block;
  margin: 0 auto;
  max-width: 1480px;
  width: 100%;
}

.etms-panel-head p.danger-text,
.danger-text {
  color: var(--color-danger-dark);
}

.etms-summary-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.et-receive-source-control {
  grid-template-columns: repeat(2, 72px);
}

.etms-summary-strip strong {
  font-size: 16px;
  overflow-wrap: anywhere;
}

.etms-record-toolbar {
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 18px;
}

.etms-record-toolbar input,
.etms-record-toolbar select {
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font: inherit;
  height: 36px;
  padding: 0 10px;
}

.etms-record-toolbar input {
  flex: 1 1 320px;
  min-width: 220px;
}

.etms-record-table {
  min-width: 980px;
}

.etms-record-table th:nth-child(1) { width: 150px; }
.etms-record-table th:nth-child(2) { width: 150px; }
.etms-record-table th:nth-child(3) { min-width: 320px; }
.etms-record-table th:nth-child(4) { width: 180px; }
.etms-record-table th:nth-child(5) { width: 72px; }
.etms-record-table th:nth-child(6) { width: 76px; }

.etms-record-table tbody tr:hover td {
  background: #f7faff;
}

.etms-sms-id {
  color: var(--color-text-light);
  display: block;
  font-size: 11px;
  margin-top: 3px;
}

.etms-sender {
  color: #174ea6;
  font-weight: var(--font-semibold);
}

.etms-content-cell {
  max-width: 520px;
  white-space: normal !important;
}

.etms-message-preview {
  display: -webkit-box;
  line-height: 1.45;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.etms-port-badge {
  background: #e8f7ee;
  border: 1px solid #b9dfc7;
  border-radius: var(--radius-sm);
  color: #176b3a;
  display: inline-flex;
  font-weight: var(--font-bold);
  justify-content: center;
  min-width: 32px;
  padding: 3px 7px;
}

.etms-form-modal {
  max-width: 620px;
}

.etms-device-picker {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

#etmsFetchDeviceFields {
  display: grid;
  gap: 8px;
}

.etms-device-picker label {
  min-width: 0;
}

.etms-device-picker select {
  max-width: 100%;
  width: 100%;
}

.etms-device-picker button {
  height: 38px;
}

.etms-fetch-estimate {
  color: var(--color-text-muted);
  font-size: 12px;
  min-height: 18px;
}

.etms-detail-modal {
  background: transparent;
  box-shadow: none;
  max-width: 410px;
  overflow: visible;
  position: relative;
  width: auto;
}

body.etms-detail-open {
  overflow: hidden;
}

.etms-phone {
  background: #f5f5f7;
  border-radius: 6px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  display: grid;
  grid-template-rows: 34px 72px minmax(0, 1fr) 64px 42px;
  height: min(780px, 92vh);
  font-family: Roboto, "Segoe UI", Arial, sans-serif;
  overflow: hidden;
  position: relative;
  width: 390px;
}

.etms-phone-status {
  align-items: center;
  background: #ffffff;
  color: #111318;
  display: flex;
  font-size: 11px;
  font-weight: var(--font-bold);
  justify-content: space-between;
  letter-spacing: 0;
  padding: 7px 14px 4px;
}

.etms-phone-status-left {
  align-items: center;
  display: flex;
  gap: 8px;
}

#etmsPhoneClock {
  font-size: 12px;
  min-width: 31px;
}

.etms-phone-notifications {
  align-items: center;
  color: #55575b;
  display: flex;
  gap: 4px;
}

.etms-phone-notifications .lucide {
  fill: none;
  height: 11px;
  stroke-width: 2.2;
  width: 11px;
}

.etms-phone-status-icons {
  align-items: center;
  color: #292b2f;
  display: flex;
  font-size: 8px;
  gap: 3px;
}

.etms-phone-status-icons .lucide {
  height: 12px;
  stroke-width: 2.4;
  width: 12px;
}

.etms-status-nfc,
.etms-status-network,
.etms-status-percent {
  font-size: 9px;
  font-weight: 700;
}

.etms-status-volte,
.etms-status-speed {
  font-size: 6px;
  font-weight: 600;
  line-height: 0.9;
  text-align: center;
}

.etms-phone-status-icons .etms-status-silent {
  height: 11px;
  width: 11px;
}

.etms-status-cellular {
  align-items: flex-end;
  display: flex;
  gap: 1px;
  height: 10px;
  width: 13px;
}

.etms-status-cellular b {
  background: #292b2f;
  border-radius: 1px 1px 0 0;
  display: block;
  width: 2px;
}

.etms-status-cellular b:nth-child(1) { height: 3px; }
.etms-status-cellular b:nth-child(2) { height: 5px; }
.etms-status-cellular b:nth-child(3) { height: 7px; }
.etms-status-cellular b:nth-child(4) { height: 9px; }

.etms-phone-status-icons .etms-status-wifi {
  height: 13px;
  width: 13px;
}

.etms-phone-status-icons .etms-status-battery {
  height: 14px;
  margin-left: 1px;
  width: 14px;
}

.etms-phone-header {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #ececef;
  display: grid;
  gap: 10px;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  padding: 8px 14px 10px;
}

.etms-phone-back {
  background: transparent;
  border: 0;
  color: #25272b;
  cursor: pointer;
  height: 44px;
  align-items: center;
  display: flex;
  justify-content: center;
  padding: 0;
  width: 34px;
}

.etms-phone-back .lucide {
  height: 30px;
  stroke-width: 2.4;
  width: 30px;
}

.etms-phone-contact {
  min-width: 0;
}

.etms-phone-contact strong {
  display: block;
  font-size: 18px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.etms-phone-contact small {
  display: none;
}

.etms-phone-actions {
  align-items: center;
  color: #303236;
  display: flex;
  gap: 18px;
}

.etms-phone-actions .lucide {
  height: 23px;
  stroke-width: 2.4;
  width: 23px;
}

.etms-phone-actions .lucide-ellipsis-vertical {
  height: 25px;
  width: 25px;
}

.etms-phone-messages {
  overflow-x: hidden;
  overflow-y: auto;
  padding: 56px 20px 28px;
  scrollbar-width: none;
}

.etms-phone-messages::-webkit-scrollbar {
  display: none;
}

.etms-sim-icon-template {
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  width: 1px;
}

.etms-phone-webview {
  background: #ffffff;
  bottom: 42px;
  display: grid;
  grid-template-rows: 54px minmax(0, 1fr);
  left: 0;
  position: absolute;
  right: 0;
  top: 34px;
  z-index: 10;
}

.etms-phone-webview[hidden] {
  display: none;
}

.etms-webview-toolbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #e6e7e9;
  display: grid;
  gap: 8px;
  grid-template-columns: 34px minmax(0, 1fr) 34px 34px;
  padding: 7px 10px;
  position: relative;
}

.etms-phone-webview.is-loading .etms-webview-toolbar::after {
  animation: etms-webview-progress 1.1s ease-in-out infinite;
  background: #1478d4;
  bottom: -1px;
  content: "";
  height: 2px;
  left: 0;
  position: absolute;
  width: 42%;
}

@keyframes etms-webview-progress {
  0% { left: -42%; }
  100% { left: 100%; }
}

.etms-webview-toolbar button,
.etms-webview-toolbar > a {
  align-items: center;
  background: transparent;
  border: 0;
  color: #2f3135;
  display: flex;
  height: 34px;
  justify-content: center;
  padding: 0;
  width: 34px;
}

.etms-webview-toolbar button {
  cursor: pointer;
}

.etms-webview-toolbar .lucide {
  height: 20px;
  stroke-width: 2.2;
  width: 20px;
}

.etms-webview-address {
  align-items: center;
  background: #f2f3f5;
  border-radius: 18px;
  color: #55585d;
  display: flex;
  font-size: 12px;
  gap: 7px;
  min-width: 0;
  padding: 8px 12px;
}

.etms-webview-address .lucide {
  flex: 0 0 auto;
  height: 13px;
  width: 13px;
}

.etms-webview-address span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.etms-phone-webview iframe {
  background: #ffffff;
  border: 0;
  height: 100%;
  width: 100%;
}

.etms-phone-message-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 48px;
}

.etms-phone-message-group time {
  align-items: center;
  color: #87888d;
  display: flex;
  font-size: 11px;
  gap: 4px;
  justify-content: center;
  margin-bottom: 22px;
  text-align: center;
}

.etms-phone-message-group time .lucide {
  fill: #9a9ba0;
  height: 10px;
  stroke-width: 1.5;
  width: 10px;
}

.etms-phone-bubble {
  align-self: flex-start;
  background: #ffffff;
  border-radius: 20px;
  color: #17171b;
  font-size: 16px;
  line-height: 1.42;
  max-width: 94%;
  overflow-wrap: anywhere;
  padding: 17px 20px;
  white-space: pre-wrap;
}

.etms-phone-link {
  background: transparent;
  border: 0;
  color: #1683bd;
  cursor: pointer;
  display: inline;
  font: inherit;
  overflow-wrap: anywhere;
  padding: 0;
  text-align: left;
  text-decoration: underline;
}

.etms-phone-input {
  align-items: center;
  background: #ffffff;
  border-top: 1px solid #eeeeef;
  display: flex;
  gap: 12px;
  padding: 9px 16px;
}

.etms-phone-plus {
  align-items: center;
  color: #111317;
  display: flex;
}

.etms-phone-plus .lucide {
  height: 29px;
  stroke-width: 1.8;
  width: 29px;
}

.etms-phone-composer {
  align-items: center;
  background: #f3f3f5;
  border-radius: 6px;
  color: #b7b7bc;
  display: flex;
  flex: 1;
  font-size: 13px;
  justify-content: space-between;
  min-width: 0;
  padding: 11px 10px 11px 14px;
}

.etms-phone-composer b {
  align-items: center;
  background: #1478d4;
  border-radius: 3px;
  color: #ffffff;
  display: flex;
  font-size: 10px;
  height: 20px;
  justify-content: center;
  width: 16px;
}

.etms-phone-send {
  align-items: center;
  background: #e6e7e9;
  border-radius: 50%;
  color: #ffffff;
  display: flex;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.etms-phone-send .lucide {
  height: 18px;
  margin-left: 2px;
  stroke-width: 2.4;
  width: 18px;
}

.etms-phone-navigation {
  align-items: center;
  background: #ffffff;
  display: flex;
  justify-content: space-around;
  padding: 0 66px;
}

.etms-nav-square {
  border: 2px solid #777a7e;
  border-radius: 2px;
  height: 15px;
  width: 15px;
}

.etms-nav-circle {
  border: 2px solid #777a7e;
  border-radius: 50%;
  height: 17px;
  width: 17px;
}

.etms-nav-triangle {
  border-bottom: 8px solid transparent;
  border-right: 14px solid #777a7e;
  border-top: 8px solid transparent;
  height: 0;
  opacity: 0.9;
  width: 0;
}

@media (max-width: 720px) {
  #etmsDetailModal {
    align-items: stretch;
    padding: 0;
  }

  .etms-detail-modal {
    height: 100dvh;
    max-height: none;
    max-width: none;
    width: 100vw;
  }

  .etms-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .etms-panel-head,
  .etms-head-actions {
    align-items: stretch;
  }

  .etms-record-toolbar input,
  .etms-record-toolbar select,
  .etms-record-toolbar button {
    width: 100%;
  }

  .raw-panel-controls {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .monitor-source-fieldset,
  .monitor-source-control {
    width: 100%;
  }

  .monitor-source-control {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .etms-device-picker {
    grid-template-columns: 1fr;
  }

  .etms-phone {
    border-radius: 0;
    box-shadow: none;
    height: 100dvh;
    width: 100vw;
  }

  .etms-phone-actions {
    gap: 13px;
  }
}

/* Link test workspace */
.page-view[data-page="link-test"].active { width: 100%; max-width: 1680px; min-width: 0; margin: 0 auto; }
.link-test-layout { display: grid; width: 100%; min-width: 0; grid-template-columns: minmax(0, 390px) minmax(0, 1fr); gap: 16px; align-items: start; }
.link-test-compose, .link-test-results { padding: 18px; min-width: 0; }
.link-test-compose .panel-head, .link-test-results .panel-head { min-width: 0; margin-bottom: 14px; padding: 0 0 14px; }
.link-test-compose .panel-head > div, .link-test-results .panel-head > div { min-width: 0; }
.link-test-results .panel-head { gap: 12px; }
.link-test-results .panel-head button { flex: 0 0 auto; }
.link-test-proxy-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; background: #f1f5f9; font-size: 13px; overflow-wrap: anywhere; }
.link-test-proxy-bar > span { flex: 1; min-width: 0; line-height: 1.4; }
.link-test-proxy-bar > button { flex: 0 0 auto; white-space: nowrap; }
.link-test-proxy-form { display: flex; align-items: end; gap: 8px; margin-top: 12px; }
.link-test-proxy-form label, .link-test-form label { display: grid; gap: 6px; flex: 1; font-weight: 600; font-size: 13px; }
.link-test-proxy-form input, .link-test-form textarea, .link-test-form select, .link-test-form input[type="search"] { width: 100%; min-width: 0; border: 1px solid #ccd5e1; border-radius: 7px; padding: 9px 10px; font: inherit; background: #fff; }
.link-test-proxy-form button { white-space: nowrap; }
.link-test-hint { margin: 8px 0 14px; color: #64748b; font-size: 12px; line-height: 1.5; }
.link-test-form { display: grid; gap: 8px; margin-top: 16px; }
.link-test-form textarea { resize: vertical; line-height: 1.55; }
.link-test-form button { justify-self: start; }
.link-test-timezone-search-status { margin: -3px 0 0; color: #64748b; font-size: 12px; line-height: 1.4; }
.link-test-timezone-results { display: grid; gap: 3px; max-height: 220px; overflow-y: auto; padding: 5px; border: 1px solid #dbe3ef; border-radius: 7px; background: #fff; }
.link-test-timezone-results[hidden] { display: none; }
.link-test-timezone-results button { justify-self: stretch; width: 100%; height: auto; padding: 8px 9px; border: 0; border-radius: 5px; background: transparent; color: #1f2937; font-size: 13px; line-height: 1.35; text-align: left; white-space: normal; }
.link-test-timezone-results button:hover, .link-test-timezone-results button:focus-visible { background: #eff6ff; color: #1d4ed8; outline: none; }
.link-test-message { min-height: 24px; font-size: 13px; color: #166534; overflow-wrap: anywhere; }
.link-test-message.is-error { color: #b91c1c; }
.link-test-bulk-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 0 0 12px; }
.link-test-select-all { display: inline-flex; align-items: center; gap: 6px; color: #334155; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.link-test-select-all input, .link-test-job-select input { width: 17px; height: 17px; margin: 0; accent-color: #2563eb; cursor: pointer; }
.link-test-select-all input:disabled, .link-test-job-select input:disabled { cursor: not-allowed; }
.link-test-bulk-count { color: #64748b; font-size: 12px; }
.link-test-bulk-tools > #linkTestDeleteSelected { margin-left: auto; }
.link-test-bulk-message { margin: 0 0 10px; color: #166534; font-size: 12px; overflow-wrap: anywhere; }
.link-test-bulk-message[hidden] { display: none; }
.link-test-bulk-message.is-error { color: #b91c1c; }
.link-test-jobs { display: grid; gap: 10px; min-width: 0; padding-bottom: 14px; border-bottom: 1px solid #e5e7eb; }
.link-test-job-group { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; align-items: center; min-width: 0; }
.link-test-job-group-label { display: grid; gap: 5px; padding-left: 2px; }
.link-test-job-group-label strong { font-size: 13px; color: #334155; }
.link-test-job-group-label small { font-size: 12px; color: #64748b; }
.link-test-job-rail { display: flex; gap: 8px; min-width: 0; overflow-x: auto; padding: 2px 2px 7px; scrollbar-width: thin; overscroll-behavior-x: contain; }
.link-test-job-rail:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; border-radius: 6px; }
.link-test-job-empty { margin: 0; min-height: 72px; display: flex; align-items: center; color: #94a3b8; font-size: 12px; }
.link-test-job-wrap { position: relative; display: flex; flex: 0 0 238px; width: 238px; min-width: 0; }
.link-test-job { display: flex; flex: 1 1 auto; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; min-width: 0; height: 76px; text-align: left; background: #f8fafc; border: 1px solid #dbe3ef; border-radius: 8px; padding: 8px 10px; color: #1f2937; cursor: pointer; white-space: nowrap; }
.link-test-job-heading { display: flex; align-items: baseline; gap: 10px; padding-right: 20px; }
.link-test-job-heading strong { color: #1f2937; font-size: 14px; }
.link-test-job .link-test-job-failures { color: #b91c1c; }
.link-test-job-wrap.is-marked .link-test-job { border-color: #60a5fa; box-shadow: inset 0 0 0 1px #60a5fa; }
.link-test-job-select { position: absolute; z-index: 1; top: 10px; right: 10px; display: flex; align-items: center; justify-content: center; width: 21px; height: 21px; cursor: pointer; }
.link-test-job.is-selected { border-color: #2563eb; background: #eff6ff; }
.link-test-job span, .link-test-job small { font-size: 12px; color: #64748b; line-height: 1.35; }
.link-test-detail-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; min-width: 0; margin: 14px 0; }
.link-test-detail-head > div:first-child { min-width: 0; }
.link-test-detail-head h3 { margin: 0 0 4px; }
.link-test-detail-head p { margin: 0; color: #64748b; font-size: 13px; overflow-wrap: anywhere; }
.link-test-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; min-width: 0; }
.link-test-actions > * { flex: 0 0 auto; white-space: nowrap; }
.link-test-detail-head .link-test-actions { justify-content: flex-end; }
.link-test-item-list { display: grid; gap: 8px; max-height: 65vh; min-width: 0; overflow-y: auto; }
.link-test-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; min-width: 0; border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px; }
.link-test-item-main { display: flex; align-items: start; gap: 9px; min-width: 0; }
.link-test-item-main > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.link-test-item-main strong { font-size: 13px; }
.link-test-item-main small { display: block; color: #64748b; font-size: 12px; margin-top: 4px; }
.link-test-item .link-test-actions { justify-content: flex-end; }
.link-test-item-main .link-test-error { color: #b91c1c; }
.link-test-item-main .link-test-warning { color: #92400e; }
.link-test-item-main .link-test-reachable { color: #166534; }
.link-test-item-main .link-test-stage { color: #1d4ed8; }
.link-test-pill { flex: none; border-radius: 99px; background: #e2e8f0; color: #475569; font-size: 11px; padding: 3px 7px; }
.link-test-pill.success { background: #dcfce7; color: #166534; }
.link-test-pill.partial { background: #fef3c7; color: #92400e; }
.link-test-pill.failed { background: #fee2e2; color: #b91c1c; }
.link-test-preview-overlay { align-items: center; justify-content: center; padding: 20px; }
.link-test-preview-dialog { display: grid; gap: 10px; width: min(100%, 414px); min-width: 0; max-height: 95vh; max-width: 430px; background: #fff; border-radius: 9px; padding: 12px; overflow: auto; }
.link-test-preview-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-width: 0; }
.link-test-preview-head strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-test-preview-head button { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; height: 36px; padding: 0 12px; white-space: nowrap; }
.link-test-preview-dialog img { display: block; width: 100%; max-width: 390px; height: auto; margin: 0 auto; }
.link-test-preview-dialog img[hidden] { display: none; }
.link-test-preview-loading { margin: 0; min-height: 160px; display: grid; place-items: center; color: #64748b; font-size: 13px; text-align: center; }
.link-test-preview-loading[hidden] { display: none; }
.link-test-monitor-workspace { display: grid; grid-template-columns: minmax(0, 390px) minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 16px; }
.link-test-monitor-workspace.is-hidden { display: none; }
.link-test-monitor-config, .link-test-monitor-events-panel { min-width: 0; padding: 18px; }
.link-test-monitor-config .panel-head, .link-test-monitor-events-panel .panel-head { min-width: 0; margin-bottom: 14px; padding: 0 0 14px; }
.link-test-monitor-events-panel .panel-head { gap: 12px; }
.link-test-monitor-events-panel .panel-head button { flex: 0 0 auto; }
.link-test-monitor-notice { margin: 0 0 15px; padding: 10px 12px; border: 1px solid #f6d991; border-radius: 8px; background: #fffbeb; color: #78350f; font-size: 12px; line-height: 1.5; }
.link-test-monitor-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.link-test-monitor-form > label:not(.link-test-monitor-checkbox) { display: grid; grid-column: 1 / -1; gap: 6px; font-size: 13px; font-weight: 600; }
.link-test-monitor-form select, .link-test-monitor-form input:not([type="checkbox"]), .link-test-monitor-edit select, .link-test-monitor-edit input:not([type="checkbox"]) { width: 100%; min-width: 0; border: 1px solid #ccd5e1; border-radius: 7px; padding: 9px 10px; font: inherit; background: #fff; }
.link-test-monitor-form > button[type="submit"] { grid-column: 1 / -1; justify-self: start; }
.link-test-monitor-checkbox { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.link-test-monitor-checkbox input { width: 16px; height: 16px; margin: 0; accent-color: #2563eb; }
.link-test-monitor-list, .link-test-monitor-events { display: grid; gap: 10px; min-width: 0; }
.link-test-monitor-list { max-height: 66vh; overflow-y: auto; }
.link-test-monitor-events { max-height: 80vh; overflow-y: auto; }
.link-test-monitor-card, .link-test-monitor-event { min-width: 0; padding: 12px; border: 1px solid #dbe3ef; border-radius: 8px; background: #fff; }
.link-test-monitor-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; min-width: 0; }
.link-test-monitor-card-head > div { min-width: 0; overflow-wrap: anywhere; }
.link-test-monitor-record-title { flex: 1; }
.link-test-monitor-record-select { flex: 0 0 auto; display: flex; align-items: center; padding-top: 2px; }
.link-test-monitor-record-select input { width: 17px; height: 17px; margin: 0; accent-color: #2563eb; }
.link-test-monitor-record-select input:disabled { cursor: not-allowed; }
.link-test-monitor-record-tools { border-bottom: 1px solid #e5e7eb; margin-bottom: 4px; }
.link-test-monitor-record-tools > #linkTestMonitorDeleteSelected { margin-left: auto; }
.link-test-monitor-card-head strong { display: block; font-size: 14px; }
.link-test-monitor-card-head small, .link-test-monitor-meta { color: #64748b; font-size: 12px; line-height: 1.5; }
.link-test-monitor-state { flex: 0 0 auto; border-radius: 99px; padding: 3px 8px; background: #e2e8f0; color: #475569; font-size: 11px; font-weight: 600; white-space: nowrap; }
.link-test-monitor-state.is-active { background: #dcfce7; color: #166534; }
.link-test-monitor-state.is-error { background: #fee2e2; color: #b91c1c; }
.link-test-monitor-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: end; margin: 12px 0; }
.link-test-monitor-edit > label:not(.link-test-monitor-checkbox) { display: grid; gap: 5px; min-width: 0; color: #334155; font-size: 12px; font-weight: 600; }
.link-test-monitor-edit > .link-test-monitor-checkbox { grid-column: 1 / -1; }
.link-test-monitor-edit > button { justify-self: start; }
.link-test-monitor-meta { overflow-wrap: anywhere; }
.link-test-monitor-error { margin: 8px 0 0; color: #b91c1c; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.link-test-monitor-source, .link-test-monitor-urls { margin: 8px 0; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.link-test-monitor-source { color: #334155; }
.link-test-monitor-urls { color: #1d4ed8; }
.link-test-monitor-stages { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; margin: 12px 0; }
.link-test-monitor-stage { min-width: 0; padding: 7px; border-radius: 6px; background: #f1f5f9; color: #475569; overflow-wrap: anywhere; }
.link-test-monitor-stage.is-done { background: #eff6ff; color: #1d4ed8; }
.link-test-monitor-stage.is-error { background: #fef2f2; color: #b91c1c; }
.link-test-monitor-stage strong, .link-test-monitor-stage small { display: block; font-size: 11px; line-height: 1.4; }
.link-test-monitor-stage small { margin-top: 3px; }
.link-test-monitor-actions { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 1380px) {
  .link-test-layout { grid-template-columns: minmax(0, 1fr); }
  .link-test-compose, .link-test-results { width: 100%; }
  .link-test-monitor-workspace { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .link-test-detail-head, .link-test-item { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .link-test-detail-head .link-test-actions, .link-test-item .link-test-actions { justify-content: flex-start; }
  .link-test-results .panel-head { align-items: flex-start; }
  .link-test-monitor-stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .link-test-proxy-form { align-items: stretch; flex-direction: column; }
  .link-test-job-group { grid-template-columns: 72px minmax(0, 1fr); gap: 6px; }
  .link-test-job-group-label strong { font-size: 12px; }
  .link-test-job-wrap { flex-basis: 224px; width: 224px; }
  .link-test-bulk-tools > button { margin-left: 0; }
  .link-test-actions { gap: 6px; }
  .link-test-monitor-edit { grid-template-columns: minmax(0, 1fr); }
  .link-test-monitor-events-panel .panel-head { align-items: flex-start; }
}

.page-view[data-page="sms-test"].active {
  display: block;
  margin: 0 auto;
  max-width: 1680px;
  width: 100%;
}

.sms-test-workspace {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
}

.sms-test-compose-panel,
.sms-test-records-panel {
  min-width: 0;
}

.sms-test-panel-head {
  min-height: 72px;
}

.sms-test-compose-tabs {
  border-bottom: 1px solid var(--color-border-light);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0 18px;
}

.sms-test-compose-tabs button {
  align-items: center;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--color-text-light);
  display: inline-flex;
  font-size: 13px;
  font-weight: var(--font-semibold);
  gap: 7px;
  height: 44px;
  justify-content: center;
  margin-bottom: -1px;
  padding: 0 10px;
}

.sms-test-compose-tabs button:hover,
.sms-test-compose-tabs button.is-active {
  background: transparent;
  color: #176b3a;
}

.sms-test-compose-tabs button.is-active {
  border-bottom-color: #218c55;
}

.sms-test-compose-tabs button:focus-visible {
  outline: 2px solid #6aa9e9;
  outline-offset: -2px;
}

.sms-test-compose-tabs .lucide {
  height: 16px;
  width: 16px;
}

.icon-button {
  align-items: center;
  display: inline-flex;
  flex: 0 0 36px;
  height: 36px;
  justify-content: center;
  padding: 0;
  width: 36px;
}

.icon-button .lucide {
  height: 17px;
  width: 17px;
}

.sms-test-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 18px;
}

.sms-test-form fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.sms-test-form legend,
.sms-test-form label > span,
.sms-test-source-fields label > span {
  color: var(--color-text-secondary);
  display: flex;
  font-size: 12px;
  font-weight: var(--font-semibold);
  justify-content: space-between;
  margin-bottom: 6px;
}

.sms-test-form label small {
  color: var(--color-text-light);
  font-weight: var(--font-normal);
}

.sms-test-form label small.danger-text {
  color: var(--color-danger-dark);
}

.sms-test-form label small.warning-text {
  color: var(--color-warning-dark);
}

.sms-mode-control {
  background: #eef2f7;
  border: 1px solid #d7dee8;
  border-radius: var(--radius-sm);
  display: grid;
  gap: 3px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  padding: 3px;
  width: 100%;
}

.sms-mode-control label {
  cursor: pointer;
  margin: 0;
}

.sms-mode-control input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.sms-mode-control label > span {
  align-items: center;
  border-radius: 3px;
  color: #526173;
  display: flex;
  font-size: 13px;
  gap: 7px;
  justify-content: center;
  margin: 0;
  min-height: 36px;
  min-width: 0;
  padding: 0 8px;
  white-space: nowrap;
}

.sms-mode-control input:checked + span {
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(32, 48, 66, 0.14);
  color: #176b3a;
}

.sms-mode-control .lucide {
  height: 16px;
  width: 16px;
}

.sms-prefix-toggle {
  align-items: center;
  border-bottom: 1px solid var(--color-border-light);
  display: grid;
  grid-template-columns: 1fr auto auto;
  padding-bottom: 12px;
}

.sms-prefix-toggle > span,
.sms-prefix-toggle small {
  margin: 0 !important;
}

.sms-prefix-toggle input {
  accent-color: #218c55;
  height: 18px;
  margin: 0 8px 0 0;
  width: 34px;
}

.sms-test-batch-custom-prefix {
  display: grid;
  gap: 6px;
}

.sms-test-batch-custom-prefix input {
  min-height: 38px;
}

.sms-test-source-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sms-test-search-picker-field {
  min-width: 0;
}

.sms-test-picker-heading {
  align-items: center;
  color: var(--color-text-secondary);
  display: flex;
  font-size: 12px;
  font-weight: var(--font-semibold);
  justify-content: space-between;
  margin-bottom: 6px;
}

.sms-test-picker-heading label {
  cursor: text;
}

.sms-test-picker-heading small {
  color: var(--color-text-light);
  font-weight: var(--font-normal);
}

.sms-test-search-picker {
  background: #ffffff;
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sms-test-search-picker:focus-within {
  border-color: #218c55;
  box-shadow: 0 0 0 3px rgba(33, 140, 85, 0.12);
}

.sms-test-search-row {
  align-items: center;
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  min-height: 38px;
  padding: 0 10px;
}

.sms-test-search-row .lucide {
  color: var(--color-text-light);
  flex: 0 0 15px;
  height: 15px;
  margin-right: 8px;
  width: 15px;
}

.sms-test-form .sms-test-search-row input[type="search"] {
  border: 0;
  border-radius: 0;
  height: 37px;
  min-width: 0;
  outline: 0;
  padding: 0;
}

.sms-test-form .sms-test-search-picker select {
  border: 0;
  border-radius: 0;
  outline: 0;
}

.sms-test-form .sms-test-search-picker select:not([multiple]) {
  height: 42px;
}

.sms-test-form .sms-test-search-picker select[multiple] {
  min-height: 150px;
}

.sms-test-search-picker:has(select:disabled),
.sms-test-search-row:has(input:disabled) {
  background: #f3f5f7;
}

.sms-test-form input[type="text"],
.sms-test-form input[type="search"],
.sms-test-form select,
.sms-test-form textarea {
  background: #ffffff;
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-sm);
  box-sizing: border-box;
  color: var(--color-text-primary);
  font: inherit;
  width: 100%;
}

.sms-test-form input[type="text"],
.sms-test-form input[type="search"],
.sms-test-form select:not([multiple]) {
  height: 38px;
  padding: 0 10px;
}

.sms-test-form select[multiple] {
  min-height: 150px;
  padding: 5px;
}

.sms-test-form select[multiple] option {
  padding: 6px 7px;
}

.sms-test-form select.is-single {
  cursor: pointer;
}

.sms-test-form textarea {
  min-height: 72px;
  padding: 9px 10px;
  resize: vertical;
}

.sms-test-form textarea[aria-invalid="true"] {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.sms-test-form .sms-test-content-error {
  color: var(--color-warning-dark);
  display: block;
  font-weight: var(--font-semibold);
  margin-top: 6px;
}

.sms-test-form .sms-test-content-error[hidden] {
  display: none;
}

.sms-test-submit-message {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #b8c7d9;
  border-radius: 6px;
  background: #f4f7fa;
  color: #284158;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.sms-test-submit-message[hidden] {
  display: none;
}

.sms-test-submit-message.is-error {
  border-color: #e8a3a3;
  background: #fff3f3;
  color: #a11f2b;
}

.sms-test-submit-message.is-warning {
  border-color: #f2c768;
  background: var(--color-warning-light);
  color: #8a5700;
}

.sms-test-submit-message.is-success {
  border-color: #8ec9aa;
  background: #effaf4;
  color: #146c43;
}

.sms-test-workspace.is-multi-copy {
  grid-template-columns: minmax(0, 1fr);
}

.sms-test-workspace.is-multi-copy .sms-test-records-panel {
  display: none;
}

.sms-test-multi-form {
  padding: 0;
}

.sms-test-multi-grid {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  min-height: 720px;
}

.sms-test-multi-target-column,
.sms-test-multi-content-column {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-width: 0;
  padding: 20px;
}

.sms-test-multi-target-column {
  border-right: 1px solid var(--color-border-light);
}

.sms-test-multi-content-column {
  background: #f8fafc;
}

.sms-test-multi-section-head,
.sms-test-multi-queue-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  min-width: 0;
}

.sms-test-multi-section-head h3,
.sms-test-multi-queue-head strong {
  color: var(--color-text-primary);
  font-size: 14px;
  margin: 0;
}

.sms-test-multi-section-head small,
.sms-test-multi-queue-head span {
  color: var(--color-text-light);
  font-size: 12px;
}

.sms-test-multi-parse-mode {
  border: 0;
  box-sizing: border-box;
  display: grid;
  gap: 12px;
  grid-template-columns: 82px minmax(250px, 360px);
  margin: 0;
  min-width: 0;
  padding: 0;
  width: 100%;
}

.sms-test-multi-parse-mode legend {
  align-self: center;
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: var(--font-semibold);
}

.sms-test-multi-parse-mode .sms-mode-control {
  min-width: 250px;
}

.sms-test-multi-parse-mode .sms-mode-control label > span {
  min-height: 38px;
  padding: 0 14px;
}

.sms-test-multi-raw-content {
  font-family: "Cascadia Mono", Consolas, monospace !important;
  line-height: 1.7;
  min-height: 270px !important;
}

.sms-test-multi-content-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.sms-test-multi-content-actions button {
  align-items: center;
  display: inline-flex;
  gap: 7px;
  justify-content: center;
  min-height: 36px;
}

.sms-test-multi-content-actions .lucide {
  height: 16px;
  width: 16px;
}

.sms-test-multi-sequence-toggle {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d7dee8;
  border-radius: 6px;
  cursor: pointer;
  display: grid;
  gap: 10px;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  min-height: 44px;
  padding: 0 12px;
}

.sms-test-multi-sequence-toggle input {
  accent-color: #218c55;
  height: 17px;
  margin: 0;
  width: 17px;
}

.sms-test-multi-sequence-toggle > span {
  color: var(--color-text-secondary) !important;
  display: block !important;
  font-size: 13px !important;
  margin: 0 !important;
}

.sms-test-multi-sequence-toggle small {
  color: var(--color-text-light);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

.sms-test-multi-option-row {
  border: 0;
  display: block;
  margin: 0;
  min-width: 0;
  padding: 0;
}

.sms-test-multi-option-row legend {
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: var(--font-semibold);
}

.sms-test-multi-sequence-control {
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
}

.sms-test-multi-custom-sequence {
  align-items: center;
  display: grid !important;
  gap: 10px;
  grid-template-columns: 110px minmax(0, 1fr);
  margin: 10px 0 0;
}

.sms-test-multi-custom-sequence.is-hidden {
  display: none !important;
}

.sms-test-multi-custom-sequence > span {
  color: var(--color-text-secondary) !important;
  font-size: 12px !important;
  margin: 0 !important;
}

.sms-test-multi-custom-sequence input {
  min-width: 0;
}

.sms-test-multi-option-preview {
  color: var(--color-text-light);
  display: block;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  margin-top: 7px;
  white-space: nowrap;
}

.sms-test-multi-content-queue {
  background: #ffffff;
  border: 1px solid #d7dee8;
  border-radius: 6px;
  max-height: 390px;
  min-height: 180px;
  overflow-y: auto;
}

.sms-test-multi-content-queue > .sms-test-port-empty {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 178px;
}

.sms-test-multi-content-row {
  align-items: start;
  display: grid;
  gap: 10px;
  grid-template-columns: 38px minmax(0, 1fr) 86px 34px;
  min-height: 54px;
  padding: 9px 10px;
}

.sms-test-multi-content-row + .sms-test-multi-content-row {
  border-top: 1px solid var(--color-border-light);
}

.sms-test-multi-content-row.is-warning {
  background: var(--color-warning-light);
}

.sms-test-multi-content-index {
  align-items: center;
  background: #edf2f7;
  border-radius: 4px;
  color: #405268;
  display: inline-flex;
  font-size: 11px;
  font-weight: var(--font-semibold);
  height: 25px;
  justify-content: center;
}

.sms-test-multi-content-copy {
  color: var(--color-text-primary);
  font-size: 13px;
  line-height: 1.55;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.sms-test-multi-content-metric {
  color: var(--color-text-light);
  font-size: 11px;
  padding-top: 4px;
  text-align: right;
}

.sms-test-multi-content-row.is-warning .sms-test-multi-content-metric {
  color: var(--color-warning-dark);
  font-weight: var(--font-semibold);
}

.sms-test-multi-content-remove {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--color-text-light);
  display: inline-flex;
  height: 30px;
  justify-content: center;
  padding: 0;
  width: 30px;
}

.sms-test-multi-content-remove:hover {
  color: var(--color-danger-dark);
}

.sms-test-multi-content-remove .lucide {
  height: 15px;
  width: 15px;
}

.sms-test-multi-submit-summary {
  background: #ffffff;
  border: 1px solid #d7dee8;
  border-radius: 6px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sms-test-multi-submit-summary > span {
  min-width: 0;
  padding: 10px 12px;
}

.sms-test-multi-submit-summary > span + span {
  border-left: 1px solid var(--color-border-light);
}

.sms-test-multi-submit-summary small,
.sms-test-multi-submit-summary strong {
  display: block;
}

.sms-test-multi-submit-summary small {
  color: var(--color-text-light);
  font-size: 10px;
  margin-bottom: 3px;
}

.sms-test-multi-submit-summary strong {
  color: var(--color-text-primary);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.sms-test-multi-submit-summary strong.is-danger {
  color: var(--color-danger-dark);
}

.sms-test-picker-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.sms-test-port-field {
  min-width: 0;
}

.sms-test-port-heading {
  align-items: center;
  color: var(--color-text-secondary);
  display: flex;
  font-size: 12px;
  font-weight: var(--font-semibold);
  justify-content: space-between;
  margin-bottom: 6px;
}

.sms-test-port-heading small {
  color: var(--color-text-light);
  font-weight: var(--font-normal);
}

.sms-test-port-picker {
  background: #f3f5f7;
  border: 1px solid #d9e0e8;
  border-radius: var(--radius-md);
  padding: 12px;
}

.sms-test-port-actions {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sms-test-port-all {
  background: #ffffff;
  border: 1px solid #d3dbe5;
  border-radius: 6px;
  color: #354457;
  font-size: 13px;
  font-weight: var(--font-semibold);
  height: 38px;
  min-width: 64px;
  padding: 0 14px;
}

.sms-test-port-all:hover:not(:disabled),
.sms-test-port-all.is-active {
  border-color: #218c55;
  color: #176b3a;
}

.sms-test-port-grid {
  align-content: start;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, 36px);
  max-height: 304px;
  min-height: 84px;
  overflow-y: auto;
  padding: 2px;
}

.sms-test-port-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d7dee8;
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(35, 48, 65, 0.08);
  color: #354457;
  display: inline-flex;
  font-size: 12px;
  height: 38px;
  justify-content: center;
  padding: 0;
  width: 36px;
}

.sms-test-port-button:hover {
  border-color: #70b58e;
  color: #176b3a;
}

.sms-test-port-button.is-selected {
  background: #218c55;
  border-color: #218c55;
  box-shadow: none;
  color: #ffffff;
}

.sms-test-port-button:focus-visible,
.sms-test-port-all:focus-visible {
  outline: 2px solid #6aa9e9;
  outline-offset: 2px;
}

.sms-test-port-empty {
  align-self: center;
  color: var(--color-text-light);
  font-size: 12px;
  grid-column: 1 / -1;
  margin: 0;
  text-align: center;
}

.sms-test-batch-device-port-section {
  min-width: 0;
}

.sms-test-batch-device-port-toolbar {
  align-items: center;
  background: #f7f9fb;
  border: 1px solid #e0e7ef;
  border-radius: var(--radius-sm);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin: 0 0 9px;
  padding: 6px 8px;
}

.sms-test-batch-random-port-count {
  align-items: center;
  color: var(--color-text-light);
  display: inline-flex;
  flex: 1 1 auto;
  font-size: 12px;
  gap: 5px;
  margin: 0;
  min-width: 0;
  white-space: nowrap;
}

.sms-test-form .sms-test-batch-random-port-count > span {
  display: inline;
  font-size: 12px;
  font-weight: var(--font-normal);
  justify-content: initial;
  margin: 0;
  white-space: nowrap;
}

.sms-test-batch-random-port-count input {
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font: inherit;
  height: 32px;
  padding: 0 5px;
  text-align: center;
  width: 48px;
}

.sms-test-batch-device-port-toolbar .ghost-mini {
  align-items: center;
  display: inline-flex;
  gap: 5px;
  height: 32px;
  justify-content: center;
  min-width: 82px;
  padding: 0 8px;
}

.sms-test-batch-device-port-toolbar .ghost-mini .lucide {
  height: 14px;
  width: 14px;
}

.sms-test-batch-device-targets {
  border: 1px solid #d9e0e8;
  border-radius: var(--radius-sm);
  max-height: 430px;
  min-height: 58px;
  overflow-y: auto;
}

.sms-test-batch-device-targets > .sms-test-port-empty {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 56px;
}

.sms-test-batch-device-target + .sms-test-batch-device-target {
  border-top: 1px solid var(--color-border-light);
}

.sms-test-batch-device-target-toggle {
  align-items: center;
  background: #ffffff;
  border: 0;
  border-radius: 0;
  color: var(--color-text-primary);
  display: grid;
  gap: 8px;
  grid-template-columns: 16px minmax(0, 1fr);
  min-height: 48px;
  padding: 7px 10px;
  text-align: left;
  width: 100%;
}

.sms-test-batch-device-target-toggle:hover,
.sms-test-batch-device-target.is-expanded .sms-test-batch-device-target-toggle {
  background: #f5f8f6;
  color: #176b3a;
}

.sms-test-batch-device-target-toggle:focus-visible {
  outline: 2px solid #6aa9e9;
  outline-offset: -2px;
}

.sms-test-batch-device-target-toggle .lucide {
  height: 15px;
  width: 15px;
}

.sms-test-batch-device-target-toggle span,
.sms-test-batch-device-target-toggle strong,
.sms-test-batch-device-target-toggle small {
  display: block;
  min-width: 0;
}

.sms-test-batch-device-target-toggle strong {
  font-size: 12px;
  overflow-wrap: anywhere;
}

.sms-test-batch-device-target-toggle small {
  color: var(--color-text-light);
  font-size: 11px;
  margin-top: 2px;
}

.sms-test-batch-device-target-body {
  background: #f7f9fb;
  border-top: 1px solid var(--color-border-light);
  padding: 10px;
}

.sms-test-batch-device-target-body > .sms-test-port-empty {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 48px;
}

.sms-test-multi-device-assignment {
  min-width: 0;
}

.sms-test-multi-device-assignment .sms-test-batch-device-targets {
  max-height: 320px;
}

.sms-test-multi-device-assignment-head {
  padding: 7px 10px;
  background: #ffffff;
  border-bottom: 1px solid var(--color-border-light);
}

.sms-test-multi-device-assignment-head strong {
  display: block;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.sms-test-multi-device-assignment-field {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px 10px;
}

.sms-test-multi-device-assignment-field span {
  color: var(--color-text-light);
  font-size: 11px;
}

.sms-test-multi-device-assignment-field input {
  border: 1px solid #d8e0eb;
  border-radius: var(--radius-md);
  color: #526174;
  font: inherit;
  height: 34px;
  padding: 0 10px;
  width: 100%;
}

.sms-test-batch-device-port-actions {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.sms-test-batch-device-port-actions .sms-test-port-all {
  height: 34px;
  min-width: 112px;
  padding: 0 10px;
}

.sms-test-batch-device-target-body .sms-test-port-grid {
  max-height: 190px;
  min-height: 46px;
}

.sms-test-batch-device-port-error {
  color: var(--color-danger-dark);
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
  overflow-wrap: anywhere;
  padding: 8px 2px;
}

.sms-test-submit {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  min-height: 42px;
  width: 100%;
}

.sms-test-submit .lucide {
  height: 17px;
  width: 17px;
}

.sms-test-batch-results {
  border-top: 1px solid var(--color-border-light);
  min-width: 0;
  padding-top: 14px;
}

.sms-test-batch-results-head {
  align-items: start;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.sms-test-batch-results-head strong {
  color: var(--color-text-primary);
  font-size: 13px;
}

.sms-test-batch-results-head small {
  color: var(--color-text-light);
  font-size: 11px;
  text-align: right;
}

.sms-test-batch-results ul {
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  list-style: none;
  margin: 0;
  max-height: 260px;
  overflow-y: auto;
  padding: 0;
}

.sms-test-batch-results li {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: 18px minmax(0, 1fr);
  min-height: 42px;
  padding: 7px 10px;
}

.sms-test-batch-results li + li {
  border-top: 1px solid var(--color-border-light);
}

.sms-test-batch-results li .lucide {
  height: 16px;
  width: 16px;
}

.sms-test-batch-results li.is-success .lucide {
  color: #218c55;
}

.sms-test-batch-results li.is-error .lucide {
  color: var(--color-danger-dark);
}

.sms-test-batch-result-copy {
  min-width: 0;
}

.sms-test-batch-result-copy strong,
.sms-test-batch-result-copy small {
  display: block;
  overflow-wrap: anywhere;
}

.sms-test-batch-result-copy strong {
  color: var(--color-text-primary);
  font-size: 12px;
}

.sms-test-batch-result-copy small {
  color: var(--color-text-light);
  font-size: 11px;
  line-height: 1.4;
  margin-top: 2px;
}

.sms-test-batch-results li.is-error .sms-test-batch-result-copy small {
  color: var(--color-danger-dark);
}

.sms-test-record-filters {
  align-items: center;
}

.sms-test-record-table {
  min-width: 1120px;
}

.sms-test-record-table th:nth-child(1) { width: 74px; }
.sms-test-record-table th:nth-child(2) { width: 78px; }
.sms-test-record-table th:nth-child(3) { min-width: 180px; }
.sms-test-record-table th:nth-child(4) { width: 76px; }
.sms-test-record-table th:nth-child(5) { min-width: 150px; }
.sms-test-record-table th:nth-child(6) { width: 92px; }
.sms-test-record-table th:nth-child(7) { min-width: 190px; }
.sms-test-record-table th:nth-child(8) { width: 92px; }
.sms-test-record-table th:nth-child(9) { width: 158px; }
.sms-test-record-table th:nth-child(10) { width: 72px; }

.sms-test-result-badge {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  display: inline-flex;
  font-size: 12px;
  font-weight: var(--font-semibold);
  justify-content: center;
  min-width: 54px;
  padding: 3px 7px;
}

.sms-test-result-badge.success {
  background: #e8f7ee;
  border-color: #b9dfc7;
  color: #176b3a;
}

.sms-test-result-badge.danger {
  background: #fff0ef;
  border-color: #f3c1bd;
  color: #a92d25;
}

.sms-test-result-badge.pending {
  background: #eef4fb;
  border-color: #c8d8ec;
  color: #315d8a;
}

.sms-test-record-reason {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sms-platform-settings-form {
  display: grid;
  gap: 18px;
  padding: 22px 18px;
}

.sms-platform-settings-form label {
  color: var(--color-text-secondary);
  display: grid;
  font-size: 12px;
  font-weight: var(--font-semibold);
  gap: 6px;
  min-width: 0;
}

.sms-platform-settings-form input:not([type="radio"]) {
  background: #ffffff;
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-sm);
  box-sizing: border-box;
  color: var(--color-text-primary);
  font: inherit;
  height: 38px;
  min-width: 0;
  padding: 0 10px;
  width: 100%;
}

.sms-platform-panel-status {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.sms-platform-status,
.sms-platform-active {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #d8e0eb;
  border-radius: var(--radius-md);
  color: #64748b;
  display: inline-flex;
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  min-height: 30px;
  padding: 0 10px;
  white-space: nowrap;
}

.sms-platform-status.ok {
  background: #e8f9ec;
  border-color: #b8e6c2;
  color: #15803d;
}

.sms-platform-status.danger {
  background: #fff1f1;
  border-color: #fecaca;
  color: #b91c1c;
}

.sms-platform-active {
  background: #eef5ff;
  border-color: #bfd5f5;
  color: #235ea8;
}

.sms-test-provider-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.sms-test-provider-fieldset legend {
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: var(--font-semibold);
  margin-bottom: 6px;
}

.sms-test-provider-control {
  background: #edf1f5;
  border: 1px solid #d8e0e8;
  border-radius: var(--radius-sm);
  display: grid;
  gap: 2px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 3px;
}

.sms-test-provider-control label {
  cursor: pointer;
  margin: 0;
  min-width: 0;
}

.sms-test-provider-control input {
  opacity: 0;
  pointer-events: none;
  position: absolute;
}

.sms-test-provider-control span {
  align-items: center;
  color: var(--color-text-secondary);
  display: flex;
  font-size: 13px;
  font-weight: var(--font-semibold);
  height: 34px;
  justify-content: center;
  padding: 0 10px;
}

.sms-test-provider-control input:checked + span {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(27, 39, 51, 0.14);
  color: #176b3a;
}

.sms-test-provider-control input:focus-visible + span {
  outline: 2px solid #6aa9e9;
  outline-offset: 1px;
}

.sms-test-config-fields {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sms-test-config-fields.is-hidden {
  display: none;
}

.sms-test-cookie-note {
  color: var(--color-text-light);
  font-size: 12px;
  line-height: 1.5;
  grid-column: 1 / -1;
}

.sms-test-captcha-field {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) 132px;
  grid-column: span 2;
}

.sms-test-captcha-field label {
  margin: 0;
}

.sms-test-captcha-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #cfd8e2;
  display: grid;
  gap: 6px;
  grid-template-columns: 90px 18px;
  height: 40px;
  justify-content: center;
  padding: 3px 7px;
}

.sms-test-captcha-button:hover:not(:disabled) {
  border-color: #70a9dc;
}

.sms-test-captcha-button img {
  display: block;
  height: 32px;
  object-fit: contain;
  width: 90px;
}

.sms-test-captcha-button .lucide {
  height: 16px;
  width: 16px;
}

@media (max-width: 480px) {
  .sms-test-captcha-field {
    grid-template-columns: minmax(0, 1fr) 118px;
  }

  .sms-test-captcha-button {
    grid-template-columns: 82px 16px;
    width: 118px;
  }

  .sms-test-captcha-button img {
    width: 82px;
  }
}

.sms-test-config-message {
  border-radius: var(--radius-sm);
  display: none;
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
  overflow-wrap: anywhere;
  padding: 10px 12px;
}

.sms-test-config-message.is-pending {
  background: #eef4fb;
  border: 1px solid #c8d8ec;
  color: #315d8a;
  display: block;
}

.sms-test-config-message.is-error {
  background: #fff0ef;
  border: 1px solid #f3c1bd;
  color: #a92d25;
  display: block;
}

.sms-test-config-message.is-success {
  background: #edf9f0;
  border: 1px solid #b9dfc4;
  color: #176b3a;
  display: block;
}

.sms-platform-settings-actions {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.sms-platform-settings-actions .sms-test-config-message {
  flex: 1;
}

.sms-platform-settings-actions button {
  flex: 0 0 auto;
}

@media (max-width: 900px) {
  .sms-test-config-fields {
    grid-template-columns: 1fr;
  }

  .sms-test-captcha-field {
    grid-column: auto;
  }

  .sms-platform-panel-status {
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .sms-platform-settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .sms-platform-settings-actions button {
    width: 100%;
  }
}

.sms-test-detail-modal {
  max-width: 760px;
}

.sms-test-detail-body {
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 18px 24px;
}

.sms-test-detail-item {
  background: #f7f9fb;
  min-width: 0;
  padding: 12px;
}

.sms-test-detail-item.wide {
  grid-column: 1 / -1;
}

.sms-test-detail-item span {
  color: var(--color-text-light);
  display: block;
  font-size: 11px;
  margin-bottom: 5px;
}

.sms-test-detail-item strong,
.sms-test-detail-item pre {
  color: var(--color-text-primary);
  font: inherit;
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

@media (max-width: 1180px) {
  .sms-test-workspace {
    grid-template-columns: 1fr;
  }

  .sms-test-compose-panel {
    max-width: none;
  }

  .sms-test-multi-grid {
    grid-template-columns: 1fr;
  }

  .sms-test-multi-target-column {
    border-bottom: 1px solid var(--color-border-light);
    border-right: 0;
  }
}

@media (max-width: 720px) {
  .sms-test-compose-tabs {
    grid-template-columns: 1fr;
    padding: 0 12px;
  }

  .sms-test-compose-tabs button {
    border-bottom: 0;
    border-left: 2px solid transparent;
    justify-content: flex-start;
    margin: 0;
  }

  .sms-test-compose-tabs button.is-active {
    border-bottom-color: transparent;
    border-left-color: #218c55;
  }

  .sms-test-multi-target-column,
  .sms-test-multi-content-column {
    padding: 16px;
  }

  .sms-test-multi-parse-mode {
    grid-template-columns: 1fr;
  }

  .sms-test-multi-parse-mode .sms-mode-control {
    min-width: 0;
  }

  .sms-test-multi-sequence-control {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sms-test-multi-custom-sequence {
    grid-template-columns: 1fr;
  }

  .sms-test-multi-option-preview {
    white-space: normal;
  }

  .sms-test-multi-content-row {
    grid-template-columns: 34px minmax(0, 1fr) 30px;
  }

  .sms-test-multi-content-metric {
    grid-column: 2;
    text-align: left;
  }

  .sms-test-multi-content-remove {
    grid-column: 3;
    grid-row: 1;
  }

  .sms-test-multi-submit-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sms-test-multi-submit-summary > span:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--color-border-light);
  }

  .sms-test-multi-submit-summary > span:nth-child(4) {
    border-top: 1px solid var(--color-border-light);
  }

  .sms-test-record-filters,
  .sms-test-record-filters select,
  .sms-test-record-filters button {
    width: 100%;
  }

  .sms-test-detail-body {
    grid-template-columns: 1fr;
  }

  .sms-test-detail-item.wide {
    grid-column: auto;
  }
}

@media (max-width: 720px), (pointer: coarse) {
  .raw-tree-table .expand-button {
    height: 42px;
    min-width: 54px;
    padding: 0 9px;
    touch-action: manipulation;
  }

  .raw-tree-table .raw-tree-expand-col,
  .raw-tree-table tbody tr.tree-account-row > td:first-child,
  .raw-tree-table tbody tr.level-country > td:first-child,
  .raw-tree-table tbody tr.level-route > td:first-child {
    border-right: 1px solid #cbd8e8;
    left: 0;
    position: sticky;
  }

  .raw-tree-table .raw-tree-expand-col {
    background: var(--color-bg-gray);
    z-index: 4;
  }

  .raw-tree-table tbody tr.tree-account-row > td:first-child,
  .raw-tree-table tbody tr.level-country > td:first-child,
  .raw-tree-table tbody tr.level-route > td:first-child {
    z-index: 1;
  }
}

/* ?????????? */
.sms-test-multi-queue-head {
  align-items: center;
  background: #f1f5f9;
  border: 1px solid #d7dee8;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 9px 12px;
}

.sms-test-multi-queue-title {
  align-items: baseline;
  display: flex;
  gap: 8px;
  min-width: 0;
}

.sms-test-multi-queue-title strong {
  color: var(--color-text-primary);
  font-size: 13px;
  margin: 0;
  white-space: nowrap;
}

.sms-test-multi-queue-title span {
  color: var(--color-text-light);
  font-size: 12px;
}

.sms-test-multi-copy-btn {
  align-items: center;
  background: #ffffff;
  border: 1px solid #c7d3e3;
  border-radius: 6px;
  color: var(--color-primary);
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
  min-height: 30px;
  padding: 0 11px;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.sms-test-multi-copy-btn:hover:not(:disabled) {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(47, 109, 246, 0.12);
}

.sms-test-multi-copy-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.sms-test-multi-copy-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.sms-test-multi-copy-btn .lucide {
  height: 15px;
  width: 15px;
}

/* ??????? */
.sms-test-multi-content-queue {
  border-radius: 0 0 6px 6px;
  border-top: 0;
}

/* ????? */
.sms-test-multi-content-row {
  transition: background-color 0.15s ease;
}

.sms-test-multi-content-row:hover {
  background: #f8fafc;
}

.sms-test-multi-content-row.is-warning:hover {
  background: #fde68a;
}

.sms-test-multi-content-index {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.sms-test-multi-content-remove {
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.sms-test-multi-content-row:hover .sms-test-multi-content-remove,
.sms-test-multi-content-row:focus-within .sms-test-multi-content-remove {
  opacity: 1;
}

/* ????/???????? */
.alert-table {
  min-width: 1060px;
}

.alert-table .num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.alert-table .num.danger {
  color: #dc2626;
  font-weight: 600;
}

.alert-table .row-sub {
  color: #8a97a8;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.45;
  margin-top: 2px;
  white-space: normal;
}

.alert-table .row-hint {
  color: #9aa7b8;
  font-size: 12px;
  white-space: nowrap;
}

.alert-table tbody td:nth-child(2) {
  min-width: 190px;
}

.alert-table .row-actions {
  flex-wrap: wrap;
  gap: 4px;
}

.alert-table .row-actions .copy-action {
  font-size: 12px;
  height: 28px;
  padding: 0 8px;
}

.alert-table .row-actions .copy-action.disabled {
  opacity: 0.55;
}

/* Device retest workspace */
.page-view[data-page="device-retest"].active {
  display: block;
  margin: 0 auto;
  max-width: 1680px;
  width: 100%;
}

.retest-page {
  display: grid;
  gap: 16px;
}

.retest-toolbar .panel-head {
  align-items: center;
  gap: 16px;
}

.retest-toolbar-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.retest-toolbar-actions input,
.retest-toolbar-actions select {
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-sm);
  height: 36px;
  min-width: 140px;
  padding: 0 9px;
}

.retest-create-panel.is-hidden {
  display: none;
}

.retest-create-form {
  display: grid;
  gap: 16px;
  padding: 0 18px 20px;
}

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

.retest-create-form label,
.retest-create-form legend {
  color: var(--color-text-secondary);
  display: grid;
  font-size: 12px;
  font-weight: var(--font-semibold);
  gap: 6px;
}

.retest-create-form input,
.retest-create-form select,
.retest-create-form textarea {
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font: inherit;
  min-width: 0;
  padding: 8px 10px;
  width: 100%;
}

.retest-create-form input,
.retest-create-form select {
  height: 38px;
}

.retest-device-fieldset,
.retest-stage-fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
}

.retest-device-fieldset > select {
  min-height: 140px;
}

.retest-device-port-pickers {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.retest-device-port-picker {
  background: #f8fafc;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.retest-device-port-head,
.retest-stage-row-head,
.retest-note-head,
.retest-device-head,
.retest-progress-meta {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.retest-device-port-head small,
.retest-device-head small,
.retest-stage-history small,
.retest-task-card-head p,
.retest-task-note small {
  color: var(--color-text-muted);
  font-size: 11px;
}

.retest-port-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.retest-port-option {
  align-items: center;
  background: #fff;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  display: inline-flex !important;
  font-size: 12px !important;
  font-weight: var(--font-medium) !important;
  gap: 5px !important;
  padding: 6px 8px;
}

.retest-port-option input {
  height: 14px !important;
  width: 14px !important;
}

.retest-stage-rows {
  display: grid;
  gap: 10px;
}

.retest-stage-row {
  background: #f8fafc;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 12px;
}

.retest-stage-row-head {
  grid-column: 1 / -1;
}

.retest-stage-row label {
  font-size: 11px;
}

.retest-stage-wide {
  grid-column: span 2;
}

.retest-stage-check {
  align-items: center;
  display: flex !important;
  flex-direction: row;
  gap: 6px !important;
  grid-column: 1 / -1;
}

.retest-stage-check input {
  height: 15px !important;
  width: 15px !important;
}

.retest-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.retest-form-message {
  border-radius: var(--radius-sm);
  font-size: 13px;
  padding: 10px 12px;
}

.retest-form-message.is-error,
.retest-device-error,
.retest-port-error {
  background: #fff1f0;
  color: var(--color-danger-dark);
}

.retest-form-message.is-success {
  background: #edf9f0;
  color: #176b3a;
}

.retest-task-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(390px, 1fr));
}

.retest-port-help {
  margin: 0 0 10px;
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.55;
}

.retest-port-picker-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.retest-port-option > span {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
}

.retest-port-option small {
  color: var(--color-text-secondary);
  font-size: 10px;
}

.retest-card-identities {
  margin-top: 8px;
  color: var(--color-text-secondary);
  font-size: 11px;
}

.retest-card-identities > div {
  display: grid;
  gap: 4px;
  margin-top: 6px;
}

.retest-task-actions .ghost-mini.danger {
  color: var(--color-danger, #c62828);
}

.retest-task-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  min-width: 0;
  overflow: hidden;
  padding: 16px;
}

.retest-task-card-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.retest-task-card-head h3 {
  font-size: 16px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.retest-task-card-head p {
  margin-top: 4px;
}

.retest-task-detail { margin-top: 12px; }
.retest-task-detail > summary { color: var(--color-text-secondary); cursor: pointer; font-size: 12px; font-weight: var(--font-semibold); }
.retest-device-last-content { color: var(--color-text-muted); font-size: 11px; margin-top: 8px; overflow-wrap: anywhere; white-space: pre-wrap; }

.retest-status-badge,
.retest-device-status {
  background: #eef4fb;
  border-radius: 999px;
  color: #315b87;
  flex: 0 0 auto;
  font-size: 11px;
  padding: 4px 8px;
}

.retest-status-badge.is-active { background: #e8f7ee; color: #176b3a; }
.retest-status-badge.is-paused { background: #fff7e6; color: #8a5a00; }
.retest-status-badge.is-completed { background: #e8f7ee; color: #176b3a; }
.retest-status-badge.is-cancelled,
.retest-status-badge.is-error,
.retest-status-badge.is-counter_reset { background: #fff1f0; color: var(--color-danger-dark); }

.retest-task-progress,
.retest-task-note,
.retest-device-list {
  border-top: 1px solid var(--color-border-light);
  margin-top: 14px;
  padding-top: 12px;
}

.retest-progress-meta {
  color: var(--color-text-secondary);
  font-size: 12px;
}

.retest-progress-meta strong { color: var(--color-text-primary); }
.retest-progress-meta b { color: var(--color-primary); font-size: 13px; }

.retest-progress-track {
  background: #e8edf3;
  border-radius: 999px;
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
}

.retest-progress-track span {
  background: #2b7de9;
  border-radius: inherit;
  display: block;
  height: 100%;
  transition: width 0.25s ease;
}

.retest-task-note p {
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 5px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.retest-note-empty { color: var(--color-text-muted); }
.retest-note-editor { margin-top: 7px; min-height: 74px; resize: vertical; width: 100%; }
.retest-note-actions { display: flex; gap: 7px; justify-content: flex-end; margin-top: 7px; }

.retest-device-list {
  display: grid;
  gap: 10px;
}

.retest-device-card {
  background: #f8fafc;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  padding: 11px;
}

.retest-device-head strong,
.retest-device-head small {
  display: block;
}

.retest-device-head small { margin-top: 3px; }
.retest-device-progress { margin-top: 10px; }
.retest-device-metrics { color: var(--color-text-muted); display: flex; flex-wrap: wrap; font-size: 11px; gap: 12px; margin-top: 8px; }
.retest-device-metrics b { color: var(--color-text-primary); }
.retest-device-error { border-radius: var(--radius-sm); font-size: 12px; margin-top: 8px; padding: 7px 8px; }
.retest-device-card details { margin-top: 10px; }
.retest-device-card summary { color: var(--color-text-secondary); cursor: pointer; font-size: 12px; }
.retest-stage-history { display: grid; gap: 6px; margin-top: 8px; }
.retest-stage-history > div { background: #fff; border: 1px solid var(--color-border-light); border-radius: var(--radius-sm); display: grid; gap: 3px; padding: 7px 8px; }
.retest-stage-history b { font-size: 12px; }
.retest-stage-history small { overflow-wrap: anywhere; white-space: pre-wrap; }
.retest-task-actions,
.retest-device-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; margin-top: 12px; }
.retest-empty-state { color: var(--color-text-muted); padding: 28px; text-align: center; }
.retest-empty-state.is-error { color: var(--color-danger-dark); }

@media (max-width: 800px) {
  .retest-toolbar .panel-head { align-items: stretch; flex-direction: column; }
  .retest-toolbar-actions { justify-content: flex-start; }
  .retest-create-grid { grid-template-columns: 1fr; }
  .retest-stage-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .retest-stage-wide { grid-column: 1 / -1; }
  .retest-task-grid { grid-template-columns: 1fr; }
}
