:root {
  --bg: #040b14;
  --bg-2: #091625;
  --panel: rgba(8, 20, 34, 0.88);
  --panel-strong: rgba(11, 30, 48, 0.96);
  --panel-soft: rgba(9, 24, 40, 0.72);
  --ink: #d9f3ff;
  --muted: #7ea7bc;
  --line: rgba(119, 211, 255, 0.16);
  --line-strong: rgba(119, 211, 255, 0.28);
  --accent: #45e4ff;
  --accent-2: #7cff8e;
  --accent-warm: #ffb15a;
  --danger: #ff6b7f;
  --success: #61f7b2;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Segoe UI Variable", "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(69, 228, 255, 0.2), transparent 22%),
    radial-gradient(circle at top right, rgba(124, 255, 142, 0.16), transparent 18%),
    linear-gradient(180deg, #07111e 0%, #040b14 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(69, 228, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(69, 228, 255, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.9), transparent 115%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 10%, transparent 90%, rgba(69, 228, 255, 0.06)),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.02) 2px, transparent 2px, transparent 4px);
  opacity: 0.26;
}

a {
  color: inherit;
}

.shell {
  width: min(1380px, calc(100vw - 28px));
  margin: 16px auto 40px;
  position: relative;
  z-index: 1;
}

.auth-shell {
  width: min(760px, calc(100vw - 28px));
}

.hud-noise {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(119, 211, 255, 0.08);
  border-radius: 26px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.02),
    inset 0 0 32px rgba(69, 228, 255, 0.04);
  pointer-events: none;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding: 24px;
  margin-bottom: 16px;
  background: linear-gradient(180deg, rgba(9, 24, 40, 0.92), rgba(6, 16, 28, 0.88));
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.topbar::after {
  content: "";
  position: absolute;
  inset: auto -10% 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(69, 228, 255, 0.55), transparent);
}

.brand-block {
  display: flex;
  gap: 16px;
  align-items: center;
  min-width: 0;
}

.brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 30% 30%, rgba(69, 228, 255, 0.22), transparent 42%),
    linear-gradient(135deg, rgba(69, 228, 255, 0.12), rgba(124, 255, 142, 0.08));
  border: 1px solid var(--line-strong);
  position: relative;
  box-shadow: inset 0 0 24px rgba(69, 228, 255, 0.08);
}

.brand-mark span {
  position: absolute;
  display: block;
  background: linear-gradient(90deg, rgba(69, 228, 255, 0.18), rgba(124, 255, 142, 0.85));
  border-radius: 999px;
}

.brand-mark span:nth-child(1) {
  left: 14px;
  right: 14px;
  top: 18px;
  height: 8px;
}

.brand-mark span:nth-child(2) {
  left: 14px;
  right: 14px;
  top: 30px;
  height: 8px;
}

.brand-mark span:nth-child(3) {
  left: 14px;
  right: 24px;
  top: 42px;
  height: 8px;
}

.topbar-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

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

.lang-switcher {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.lang-button {
  min-width: 58px;
}

.lang-button.active {
  border-color: rgba(69, 228, 255, 0.45);
  box-shadow:
    0 0 0 1px rgba(69, 228, 255, 0.18),
    0 12px 26px rgba(0, 0, 0, 0.32);
}

.topbar-toggle {
  display: none;
  width: 46px;
  min-width: 46px;
  padding: 10px;
}

.topbar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--ink);
}

.signal-panel {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.signal-chip,
.pill,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(69, 228, 255, 0.22);
  background: rgba(69, 228, 255, 0.08);
  backdrop-filter: blur(8px);
}

.signal-chip {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.82rem;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  font-size: 0.72rem;
  color: var(--accent);
}

.subhead,
.subtle {
  color: var(--muted);
}

.subhead {
  margin: 8px 0 0;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.94rem;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: Consolas, "Courier New", monospace;
  letter-spacing: 0.02em;
}

h1 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

h2 {
  font-size: clamp(1.3rem, 2.2vw, 1.9rem);
}

h3 {
  font-size: 1.08rem;
}

.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

.auth-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.nav a,
.button-link,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(12, 31, 50, 0.95), rgba(7, 19, 32, 0.95));
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.nav a.active,
.tab.active,
button:not(.ghost):hover,
.button-link:hover,
.nav a:hover {
  border-color: rgba(69, 228, 255, 0.45);
  box-shadow:
    0 0 0 1px rgba(69, 228, 255, 0.18),
    0 16px 36px rgba(0, 0, 0, 0.38);
  transform: translateY(-1px);
}

button,
.nav a,
.button-link {
  cursor: pointer;
}

button.ghost,
.button-link.ghost {
  background: rgba(69, 228, 255, 0.03);
  box-shadow: none;
}

button.danger {
  border-color: rgba(255, 107, 127, 0.35);
  color: #ffd0d6;
}

.frame-banner {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(7, 18, 30, 0.82);
  box-shadow: var(--shadow);
}

.banner-label {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent-warm);
  font-size: 0.72rem;
}

.banner-grid {
  display: grid;
  grid-template-columns: repeat(3, 14px);
  gap: 6px;
}

.banner-grid span {
  width: 14px;
  height: 14px;
  border-radius: 5px;
  border: 1px solid rgba(69, 228, 255, 0.18);
  background: linear-gradient(180deg, rgba(69, 228, 255, 0.2), rgba(124, 255, 142, 0.08));
}

.hero {
  background: linear-gradient(180deg, rgba(9, 25, 41, 0.94), rgba(7, 18, 31, 0.9));
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.hero.compact {
  align-items: flex-start;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip.warning {
  background: rgba(255, 177, 90, 0.12);
  border-color: rgba(255, 177, 90, 0.28);
  color: #ffd8a5;
}

.chip.error {
  background: rgba(255, 107, 127, 0.12);
  border-color: rgba(255, 107, 127, 0.28);
  color: #ffd3da;
}

.chip.ok {
  background: rgba(97, 247, 178, 0.12);
  border-color: rgba(97, 247, 178, 0.24);
  color: #b8ffd9;
}

.grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

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

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

.card {
  background: linear-gradient(180deg, rgba(8, 20, 34, 0.92), rgba(6, 16, 28, 0.9));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, rgba(69, 228, 255, 0.6), transparent 65%);
  opacity: 0.55;
}

.card-head,
.snippet-head,
.service-row,
.snippet-create,
.backup-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.service-row {
  padding: 14px 0;
  border-bottom: 1px solid rgba(119, 211, 255, 0.1);
}

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

.actions,
.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.checkbox input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  box-shadow: none;
}

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

.stats div,
.card-subsection,
.backup-item {
  background: var(--panel-soft);
  border: 1px solid rgba(119, 211, 255, 0.12);
  border-radius: 18px;
}

.stats div {
  padding: 14px;
}

dt {
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
}

dd {
  margin: 0;
  font-weight: 700;
  line-height: 1.45;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(119, 211, 255, 0.12);
  vertical-align: middle;
}

th {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(119, 211, 255, 0.16);
  border-radius: 14px;
  background: rgba(5, 14, 24, 0.92);
  color: var(--ink);
  font: inherit;
  padding: 12px 14px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(69, 228, 255, 0.42);
  box-shadow: 0 0 0 3px rgba(69, 228, 255, 0.1);
}

input::file-selector-button {
  margin-right: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(119, 211, 255, 0.22);
  background: rgba(69, 228, 255, 0.1);
  color: var(--ink);
  cursor: pointer;
}

.log,
textarea {
  font-family: Consolas, "Courier New", monospace;
}

.log {
  min-height: 300px;
  padding: 16px;
  overflow: auto;
  white-space: pre-wrap;
  border-radius: 18px;
  border: 1px solid rgba(119, 211, 255, 0.14);
  background:
    linear-gradient(180deg, rgba(3, 11, 20, 0.98), rgba(6, 16, 28, 0.96)),
    repeating-linear-gradient(180deg, rgba(69, 228, 255, 0.025), rgba(69, 228, 255, 0.025) 1px, transparent 1px, transparent 3px);
  color: #d4f4ff;
}

textarea {
  min-height: 320px;
  resize: vertical;
  margin-top: 14px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab-panel {
  display: none;
}

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

.notice {
  margin-bottom: 18px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.notice.success {
  background: rgba(97, 247, 178, 0.08);
}

.notice.error {
  background: rgba(255, 107, 127, 0.08);
}

.notice ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.validation {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.button-row {
  margin-top: 14px;
}

.card-subsection {
  margin-top: 18px;
  padding: 16px;
}

.card-subsection h4 {
  margin: 0 0 12px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.92rem;
}

.field span {
  color: var(--muted);
}

code {
  background: rgba(69, 228, 255, 0.08);
  border: 1px solid rgba(69, 228, 255, 0.18);
  border-radius: 8px;
  padding: 2px 6px;
  color: #c6f8ff;
}

.backup-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.backup-list.compact {
  margin-top: 12px;
}

.backup-item {
  padding: 12px 14px;
}

.backup-item p {
  margin: 4px 0 0;
  color: var(--muted);
}

.auth-card {
  max-width: 720px;
  margin: 0 auto;
}

.auth-form {
  gap: 18px;
}

.snippet-block {
  margin-top: 18px;
}

main {
  position: relative;
}

input:disabled,
select:disabled,
textarea:disabled,
button:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

@media (max-width: 1120px) {
  .grid.two,
  .stats,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .shell {
    width: min(100vw - 18px, 100%);
  }

  .topbar,
  .hero,
  .frame-banner {
    padding: 18px;
  }

  .topbar,
  .topbar-side,
  .brand-block,
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-side,
  .signal-panel {
    align-items: flex-start;
    justify-content: flex-start;
  }

  .topbar {
    position: relative;
  }

  .topbar-actions {
    position: absolute;
    top: 18px;
    right: 18px;
  }

  .topbar-toggle {
    display: inline-flex;
    flex-direction: column;
  }

  .topbar-side {
    display: none;
    width: 100%;
    padding-top: 8px;
  }

  .topbar-side.open {
    display: flex;
  }

  .nav,
  .inline-form {
    width: 100%;
  }

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

@media (max-width: 640px) {
  .nav,
  .actions,
  .button-row,
  .filters {
    width: 100%;
  }

  .nav a,
  .button-link,
  button {
    width: 100%;
  }

  th,
  td {
    padding: 10px 8px;
  }

  .brand-mark {
    width: 54px;
    height: 54px;
  }
}
