:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --panel: #ffffff;
  --panel-soft: #fbfcfd;
  --text: #162433;
  --muted: #607080;
  --line: #d9e0e6;
  --line-strong: #c8d2db;
  --accent: #e83b3d;
  --accent-dark: #0e3b57;
  --accent-soft: #eef4f8;
  --ok: #1b8a4f;
  --shadow: 0 8px 20px rgba(10, 25, 40, 0.06);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Open Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(232, 59, 61, 0.05), transparent 35%),
    linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  z-index: 30;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.selectel-wordmark {
  display: flex;
  align-items: center;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.selectel-wordmark-main {
  color: #0a1f2d;
}

.selectel-wordmark-main::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 2px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-4px);
}

.topbar-pill,
.btn,
.copy-btn,
.tab,
.icon-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.topbar-pill {
  height: 38px;
  padding: 0 14px;
  background: var(--panel);
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  color: #172d40;
  font-size: 15px;
}

.topbar-nav a:hover,
.topbar-pill:hover,
.btn:hover,
.copy-btn:hover,
.tab:hover,
.icon-btn:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.layout {
  display: flex;
  min-height: 100vh;
  padding-top: 64px;
}

.sidebar {
  width: 278px;
  min-width: 278px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.sidebar-section {
  padding: 18px 12px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.sidebar-title {
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 700;
}

.sidebar-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.project-select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.sidebar-menu {
  padding: 10px 8px;
}

.sidebar-link {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: #172d40;
}

.sidebar-link.active,
.sidebar-link:hover {
  background: #edf1f4;
}

.content {
  flex: 1;
  max-width: 1248px;
  width: 100%;
  margin: 0 auto;
  padding: 22px 24px 36px;
}

.card,
.card-inset {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-inset {
  box-shadow: none;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid #82d0a7;
  border-radius: 6px;
  color: var(--ok);
  font-size: 12px;
  line-height: 1;
}

.status-badge.fail {
  border-color: #e39aa0;
  color: #b3262d;
  background: #fff5f5;
}

.tabs {
  overflow: hidden;
}

.tabs-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
}

.tab {
  height: 48px;
  padding: 0 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  font-weight: 600;
  color: #223748;
}

.tab.active {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

.tabs-body {
  padding: 22px 26px 26px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.info-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
}

.info-card {
  overflow: hidden;
}

.info-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(0, 1.3fr);
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.info-row.port-row {
  align-items: start;
}

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

.info-label {
  color: #172d40;
  font-size: 15px;
}

.info-value {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  font-size: 15px;
}

.info-value.port-stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  line-height: 1.15;
  text-align: left;
}

.mono {
  font-family: "Courier New", monospace;
}

.admin-card {
  padding: 16px;
}

.admin-panel {
  margin-top: 18px;
  padding: 18px 22px 22px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 18px;
}

.admin-result {
  margin-top: 16px;
}

.section-title {
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 700;
}

.settings-form,
.domain-form {
  display: grid;
  gap: 12px;
}

.settings-form label,
.domain-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.settings-form span,
.domain-form span {
  color: var(--muted);
}

.settings-form input,
.domain-form input,
.domain-form select {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.sender-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(140px, 220px);
  align-items: stretch;
  gap: 8px;
}

.sender-compose input,
.sender-compose select {
  height: 36px;
  min-width: 0;
}

.sender-at {
  color: var(--muted);
  font-weight: 700;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
}

.readonly-field {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 26px 0 14px;
}

.section-head h2 {
  margin: 0;
  font-size: 31px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.btn,
.copy-btn {
  height: 36px;
  padding: 0 12px;
}

.btn.primary {
  background: var(--accent-dark);
  color: #fff;
  border-color: var(--accent-dark);
}

.icon-btn.small {
  width: 28px;
  height: 28px;
  padding: 0;
}

.domain-add {
  margin-bottom: 16px;
  padding: 16px;
}

.test-send-card {
  padding: 16px;
}

.domain-modal-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 30, 40, 0.58);
  z-index: 60;
}

.domain-modal {
  width: min(100%, 646px);
  padding: 26px 30px 24px;
  border-radius: 12px;
}

.domain-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.domain-modal-title {
  font-size: 31px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.domain-modal .domain-form {
  gap: 18px;
}

.domain-modal .domain-form label {
  gap: 8px;
  font-size: 15px;
}

.domain-modal .domain-form span {
  color: #172d40;
}

.domain-modal .domain-form input {
  height: 40px;
}

.domain-message {
  padding: 16px 18px;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1.45;
  background: #eef6ff;
  color: #183a57;
  border: 1px solid #9fd0ff;
}

.domain-message.success {
  background: #edf9f1;
  color: var(--ok);
  border-color: #c9e7d4;
}

.domain-message.error {
  background: #fdecec;
  color: #b42318;
  border-color: #f7c9c6;
}

.domain-modal-actions {
  justify-content: flex-end;
}

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

.domain-list {
  display: grid;
  gap: 14px;
}

.domain-card {
  overflow: hidden;
}

.domain-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.domain-title {
  font-size: 18px;
  font-weight: 400;
}

.domain-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.domain-menu-wrap {
  position: relative;
}

.domain-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 248px;
  padding: 8px 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(10, 25, 40, 0.12);
  z-index: 20;
}

.domain-menu button {
  width: 100%;
  padding: 12px 16px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.domain-menu button:hover {
  background: #f5f7fa;
}

.domain-records {
  padding: 0;
}

.domain-row {
  display: grid;
  grid-template-columns: 120px minmax(220px, 1.1fr) 72px minmax(220px, 1.8fr) 84px;
  gap: 12px;
  align-items: center;
  padding: 13px 16px;
  border-top: 1px solid var(--line);
}

.domain-row:first-child {
  border-top: 0;
}

.domain-row-label {
  font-weight: 400;
}

.domain-row-name,
.domain-row-value {
  min-width: 0;
  word-break: break-word;
}

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

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

.domain-row-type {
  color: var(--muted);
}

.domain-empty {
  padding: 18px 2px;
  color: var(--muted);
}

.record-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.badge.success {
  border: 1px solid #82d0a7;
  color: var(--ok);
  background: #eef9f1;
}

.badge.muted {
  background: #f0f2f4;
  color: var(--muted);
}

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

.stat-card {
  padding: 18px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat-name {
  color: var(--muted);
}

.stat-value {
  margin-top: 8px;
  font-size: 30px;
  font-weight: 700;
}

.stat-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.stop-head {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.stop-head input {
  flex: 1;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.data-table th {
  color: var(--muted);
  background: #fafbfc;
  font-weight: 600;
}

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

.auth-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 15, 24, 0.48);
  backdrop-filter: blur(6px);
  z-index: 50;
}

.auth-overlay.is-open {
  display: flex;
}

.auth-card {
  width: min(440px, 100%);
  padding: 24px;
}

.auth-title {
  font-size: 20px;
  font-weight: 700;
}

.auth-copy {
  margin: 8px 0 20px;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 6px;
}

.auth-form span {
  font-size: 13px;
  color: var(--muted);
}

.auth-form input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.auth-error {
  padding: 10px 12px;
  border-radius: 6px;
  color: #b42318;
  background: #fdecec;
  border: 1px solid #f7c9c6;
}

@media (max-width: 1180px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-width: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .topbar {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 14px;
  }

  .layout {
    padding-top: 104px;
  }

  .content {
    padding: 18px 14px 28px;
  }

  .section-head h2 {
    font-size: 24px;
  }

  .tabs-nav {
    padding: 0 14px;
  }

  .tabs-body {
    padding: 18px 14px 20px;
  }

  .admin-panel {
    padding: 16px 14px 18px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .info-row,
  .domain-row {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}
