:root {
  --bg: #22201f;
  --panel: #1b2433;
  --panel-2: #171d28;
  --line: #2d3749;
  --text: #edf3ff;
  --muted: #95a6c5;
  --accent: #e3ad3f;
  --accent-text: #171b22;
  --ok: #55f1af;
  --warn: #f4c163;
  --bad: #ff8e8e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 "Segoe UI", Tahoma, sans-serif;
}

.page {
  width: min(1240px, calc(100vw - 32px));
  margin: 32px auto 48px;
}

.app-shell {
  display: grid;
  gap: 18px;
}

.panel {
  background: linear-gradient(180deg, #1c2432 0%, #171d28 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .18);
}

.hero-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.hero-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

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

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid #344157;
  border-radius: 999px;
  background: rgba(17, 23, 34, .92);
}

.lang-btn {
  min-width: 42px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease, transform .08s ease;
}

.lang-btn:hover {
  color: var(--text);
  background: rgba(95, 134, 199, .12);
}

.lang-btn:active {
  transform: translateY(1px) scale(.98);
}

.lang-btn.is-active {
  background: #2a3950;
  color: #ffffff;
  box-shadow: inset 0 0 0 1px #4a6286;
}

.app-title {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin: 0;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid #31425d;
  background: linear-gradient(180deg, #233047 0%, #1e293b 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.app-profile {
  display: inline-flex;
  align-items: center;
  max-width: min(100%, 420px);
  min-height: 38px;
  margin: 0;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid #31425d;
  background: #202838;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-subtitle {
  margin: 0;
  color: var(--muted);
  display: none;
}

.hero-badge {
  min-width: 70px;
  text-align: center;
  border: 1px solid #315a3c;
  background: #183224;
  color: #78f0a1;
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 700;
  text-transform: lowercase;
}

.hero-note,
.notice-box {
  margin-bottom: 18px;
  border: 1px solid #8d6d28;
  background: rgba(227, 173, 63, .1);
  color: #ffd888;
  border-radius: 14px;
  padding: 12px 14px;
}

.hero-note {
  margin-top: 18px;
  margin-bottom: 0;
}

.notice-box.is-hidden {
  display: none;
}

.form-grid {
  display: grid;
  gap: 14px;
}

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

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

.field input {
  width: 100%;
  height: 50px;
  border-radius: 14px;
  border: 1px solid #334056;
  background: #111722;
  color: var(--text);
  padding: 0 16px;
  font-size: 15px;
}

.field input:focus {
  outline: none;
  border-color: #5f86c7;
  box-shadow: 0 0 0 3px rgba(95, 134, 199, .18);
}

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

.btn {
  height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid #344157;
  background: #1b2433;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: transform .08s ease, filter .08s ease, box-shadow .08s ease;
}

.btn:active {
  transform: translateY(2px) scale(.98);
  filter: brightness(.92);
  box-shadow: inset 0 3px 10px rgba(0, 0, 0, .28);
}

.btn:disabled {
  cursor: progress;
  opacity: .72;
}

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.btn-small {
  height: 38px;
  padding: 0 14px;
}

.status-panel {
  display: grid;
  gap: 4px;
  min-height: 78px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid #334056;
  background: rgba(30, 39, 55, .9);
}

.status-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #6ea0ff;
  box-shadow: 0 0 0 6px rgba(110,160,255,.12);
  flex: none;
}

.status-title {
  min-width: 0;
  flex: 1 1 auto;
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  min-width: 62px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid #334056;
  background: #202838;
  color: #9eb0cc;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

.status-text {
  color: #9fb0cb;
  font-size: 13px;
  line-height: 1.25;
  min-height: 18px;
  padding-left: 16px;
}

.status-panel.is-error .status-dot {
  background: #ff7f93;
  box-shadow: 0 0 0 6px rgba(255,127,147,.12);
}

.status-panel.is-error .status-badge {
  background: #3a2530;
  border-color: #69404e;
  color: #ffc1cc;
}

.status-panel.is-error .status-text {
  color: #f0b7c1;
}

.status-panel.is-success .status-dot {
  background: #57d394;
  box-shadow: 0 0 0 6px rgba(87,211,148,.12);
}

.status-panel.is-success .status-badge {
  background: #233129;
  border-color: #355344;
  color: #bdeecf;
}

.status-panel.is-success .status-text {
  color: #b6d8c2;
}

.content-shell {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(18, 24, 35, .42);
  overflow: hidden;
}

.tabs-shell {
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(52, 65, 87, .5);
  background: rgba(20, 27, 38, .9);
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 0;
  flex-wrap: wrap;
}

.tab {
  height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid #344157;
  background: #111722;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.tab.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.tab-content {
  display: none;
}

.tab-content.is-active {
  display: block;
}

.summary-row {
  margin-bottom: 14px;
}

.summary-line {
  color: #8fb2ee;
  font-size: 14px;
}

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

.status-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.status-panel {
  grid-column: span 4;
}

.card-time-left {
  min-width: 0;
  grid-column: span 1;
}

.card {
  min-height: 78px;
  border-radius: 16px;
  border: 1px solid #334056;
  background: rgba(30, 39, 55, .9);
  padding: 14px 16px;
}

.card-label {
  color: #95a6c5;
  font-size: 13px;
  text-transform: uppercase;
}

.card-value {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-shell {
  overflow-x: auto;
  overflow-y: hidden;
}

.servers-table {
  width: 100%;
  min-width: 980px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--panel-2);
}

.servers-table col.col-primary {
  width: 84px;
}

.servers-table col.col-enabled {
  width: 72px;
}

.servers-table col.col-server {
  width: 50%;
}

.servers-table col.col-type {
  width: 24%;
}

.servers-table col.col-status {
  width: 150px;
}

.servers-table thead {
  background: #121823;
}

.servers-table th,
.servers-table td {
  padding: 14px 12px;
  vertical-align: top;
  overflow: hidden;
}

.servers-table th:nth-child(1),
.servers-table td:nth-child(1) {
  text-align: center;
}

.servers-table th:nth-child(2),
.servers-table td:nth-child(2) {
  text-align: center;
}

.servers-table th {
  color: #8ea0bf;
  font-weight: 600;
  text-align: left;
}

.servers-table tbody tr + tr td {
  border-top: 1px solid rgba(52, 65, 87, .35);
}

.primary-col,
.enabled-col {
  width: 90px;
  text-align: center;
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

.server-main {
  font-weight: 800;
  line-height: 1.35;
  word-break: normal;
  overflow-wrap: anywhere;
}

.server-sub {
  margin-top: 4px;
  color: #8fb2ee;
  font-size: 13px;
  word-break: break-word;
}

.cell-primary,
.cell-enabled {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
}

.cell-server,
.cell-type,
.cell-status {
  min-height: 56px;
}

.cell-server {
  display: block;
  width: 100%;
}

.cell-type {
  display: block;
  width: 100%;
  line-height: 1.45;
  word-break: break-word;
}

.cell-status {
  display: block;
  width: 100%;
}

.cell-server > div,
.cell-type > div,
.cell-status > div {
  min-width: 0;
  width: 100%;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #344157;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: normal;
  line-height: 1.2;
  text-align: center;
  max-width: 100%;
}

.status-pill.is-unsupported {
  border-color: #7f4b4b;
  color: #ffb0b0;
}

.status-pill.is-maybe {
  border-color: #8d6d28;
  color: #ffd888;
}

.toggle-wrap,
.radio-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
}

.server-toggle,
.server-radio {
  width: 18px;
  height: 18px;
  accent-color: #d6a33b;
}

.preview-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
  flex-wrap: wrap;
  padding: 16px 16px 0;
}

.preview-list {
  display: grid;
  gap: 12px;
  padding: 0 16px 16px;
}

.preview-item {
  border: 1px solid #334056;
  border-radius: 16px;
  background: rgba(18, 24, 35, .75);
  padding: 14px;
}

.preview-item-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  align-items: center;
}

.preview-item-name {
  font-weight: 800;
}

.preview-item-type {
  color: var(--muted);
  font-size: 12px;
}

.preview-link {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #c7d8ff;
  font-size: 13px;
}

.preview-empty {
  color: var(--muted);
  text-align: center;
  padding: 26px 12px;
  border: 1px dashed #334056;
  border-radius: 18px;
}

@media (max-width: 1080px) {
  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .status-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .status-panel {
    grid-column: span 2;
  }

}

@media (max-width: 720px) {
  .page {
    width: min(100vw - 20px, 1000px);
    margin: 18px auto 32px;
  }

  .panel {
    padding: 18px;
  }

  .app-title {
    min-height: 36px;
    padding: 0 12px;
    font-size: 18px;
  }

  .app-profile {
    max-width: 100%;
  }

  .hero-head {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions {
    justify-content: space-between;
  }

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

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

  .status-panel,
  .card-time-left {
    grid-column: span 1;
  }

  .actions {
    flex-direction: row;
  }

  .servers-table {
    min-width: 860px;
  }

  .servers-table col.col-server {
    width: 380px;
  }

  .servers-table col.col-type {
    width: 220px;
  }
}

@media (max-width: 520px) {
  .cards {
    grid-template-columns: 1fr;
  }

  .status-row {
    grid-template-columns: 1fr;
  }
}
