:root {
  color-scheme: dark;
  --bg: #050805;
  --panel: #0b110c;
  --panel-2: #101810;
  --panel-3: #151f14;
  --line: #253423;
  --line-strong: #3c5634;
  --text: #f5f8ef;
  --muted: #aab5a3;
  --green: #b7ff00;
  --green-2: #45f478;
  --danger: #ff6070;
  --warning: #ffd166;
  --shadow: 0 20px 60px rgba(0, 0, 0, .35);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -20%, rgba(79, 255, 90, .18) 0%, rgba(79, 255, 90, .04) 34%, transparent 62%),
    linear-gradient(180deg, #070d07 0%, var(--bg) 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: var(--green);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 58px;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-lockup {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
}

.brand-mark {
  font-size: 30px;
  line-height: 1;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0;
}

.brand-code {
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 28px;
  line-height: 1;
}

.brand-name {
  margin-left: 2px;
  padding-left: 14px;
  border-left: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.topnav,
.admin-nav,
.action-panel,
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.topnav {
  justify-content: flex-end;
  padding: 6px;
  border: 1px solid rgba(37, 52, 35, .9);
  border-radius: 8px;
  background: rgba(5, 8, 5, .55);
}

.topnav a,
.admin-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.topnav a:hover,
.admin-nav a:hover {
  background: var(--panel-3);
  color: var(--text);
  text-decoration: none;
}

.auth-panel,
.dashboard {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 17, 12, .94);
  box-shadow: var(--shadow);
}

.auth-panel {
  max-width: 460px;
  margin: 78px auto;
  padding: 32px;
}

.dashboard {
  padding: 28px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 36px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 16px;
  font-size: 20px;
  line-height: 1.25;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.lead {
  margin-bottom: 22px;
  color: var(--muted);
}

.muted-link {
  margin: 18px 0 0;
  color: var(--muted);
}

.form-stack {
  display: grid;
  gap: 16px;
}

.narrow-form {
  max-width: 460px;
  margin: 24px 0;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: end;
  gap: 14px;
  margin-bottom: 24px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #070c07;
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 112px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(183, 255, 0, .12);
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--green);
  color: #050805;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button-link:hover {
  text-decoration: none;
  filter: brightness(1.03);
}

.button-link.secondary,
.ghost-button,
.secondary-button {
  border-color: var(--line-strong);
  background: rgba(18, 26, 18, .85);
  color: var(--text);
}

.ghost-button {
  min-height: 40px;
  padding: 0 14px;
}

.danger-button {
  background: var(--danger);
  color: #160305;
}

.button-link.disabled {
  border-color: var(--line);
  background: #172017;
  color: #778271;
  cursor: not-allowed;
}

.error {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 96, 112, .45);
  border-radius: 8px;
  background: rgba(255, 96, 112, .09);
  color: #ffc8cf;
}

.success {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(183, 255, 0, .45);
  border-radius: 8px;
  background: rgba(183, 255, 0, .08);
  color: var(--green);
  font-weight: 800;
}

.cabinet-grid,
.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.status-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
}

.primary-status {
  min-height: 238px;
}

.tariff-card {
  min-height: 238px;
}

.action-panel {
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 24, 16, .72);
}

.payment-form {
  display: grid;
  gap: 12px;
  max-width: 720px;
}

.terms-check {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  max-width: 680px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.terms-check input {
  width: 18px;
  min-height: 18px;
  margin: 3px 0 0;
}

.inline-date-form {
  display: grid;
  grid-template-columns: minmax(220px, 280px) auto;
  align-items: end;
  gap: 12px;
}

.telegram-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-top: 16px;
}

.telegram-actions {
  display: grid;
  gap: 14px;
  justify-items: stretch;
}

.link-code-box {
  display: inline-grid;
  gap: 4px;
  margin: 8px 0 10px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(183, 255, 0, .08);
}

.link-code-box span,
.help-text {
  color: var(--muted);
  font-size: 14px;
}

.link-code-box strong {
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 22px;
}

.notice {
  margin-bottom: 12px;
  color: var(--green);
  font-weight: 800;
}

.card-kicker {
  margin-bottom: 10px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

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

.fact-item {
  min-height: 104px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 8, 5, .45);
}

.fact-item span {
  display: block;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.fact-item strong {
  display: block;
  margin-top: 12px;
  font-size: 24px;
  line-height: 1.1;
}

.details-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.details-list div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(37, 52, 35, .8);
}

.details-list div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.details-list dt {
  color: var(--muted);
  font-weight: 700;
}

.details-list dd {
  margin: 0;
  color: var(--text);
  font-weight: 900;
  text-align: right;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric-grid > div {
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.metric-grid span {
  display: block;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.metric-grid strong {
  display: block;
  margin-top: 12px;
  font-size: 28px;
  line-height: 1;
}

.admin-nav {
  margin: 0 0 26px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 8, 5, .45);
}

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

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

.wide-cell {
  min-width: 280px;
  white-space: normal;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.data-table th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin-bottom: 16px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(183, 255, 0, .1);
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
}

.status-missing,
.status-expired,
.status-disabled,
.status-failed,
.status-canceled {
  background: rgba(255, 96, 112, .09);
  color: #ffc8cf;
}

.status-sync_pending,
.status-pending_approval,
.status-pending,
.status-created {
  background: rgba(255, 209, 102, .1);
  color: var(--warning);
}

@media (max-width: 900px) {
  .metric-grid,
  .cabinet-grid,
  .two-column,
  .fact-grid,
  .telegram-card {
    grid-template-columns: 1fr;
  }

  .page-head {
    display: grid;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .brand-mark {
    font-size: 24px;
  }

  .brand-code {
    font-size: 24px;
  }

  .brand-name {
    display: none;
  }

  .auth-panel,
  .dashboard {
    padding: 22px;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  .action-panel,
  .topnav {
    align-items: stretch;
    flex-direction: column;
  }

  .inline-date-form {
    grid-template-columns: 1fr;
  }

  .topnav a,
  .topnav form,
  .action-panel form,
  .action-panel .button-link,
  .admin-nav a {
    width: 100%;
  }

  .data-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}
