:root {
  color-scheme: light;
  --ink: #071a36;
  --muted: #61708a;
  --line: #dce5f1;
  --panel: #ffffff;
  --page: #f4f8fd;
  --navy: #061b3a;
  --navy-soft: #0b376f;
  --green: #0b9368;
  --blue: #0866ff;
  --blue-dark: #004cc7;
  --orange: #ff7200;
  --red: #bf3434;
  --gold: #d96a00;
  --shadow: 0 12px 34px rgba(7, 40, 85, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% -10%, rgba(8, 102, 255, 0.10), transparent 28rem),
    var(--page);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--blue);
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: white;
  border-radius: 9px;
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 750;
  box-shadow: 0 5px 14px rgba(8, 102, 255, 0.18);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

button:hover {
  background: linear-gradient(135deg, #1472ff, #0045b6);
  box-shadow: 0 8px 20px rgba(8, 102, 255, 0.25);
  transform: translateY(-1px);
}

.download-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #1558b8;
  border-radius: 6px;
  color: #1558b8;
  background: #eef5ff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.download-link:hover {
  background: #dcecff;
}

.danger-button {
  min-height: 32px;
  padding: 0 10px;
  border-color: #a82d2d;
  background: #bf3434;
  font-size: 13px;
}

.danger-button:hover {
  background: #a82d2d;
}

.muted {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #04162f 0%, #082c5d 60%, #061b3a 100%);
  color: #eaf1f7;
  padding: 26px 18px;
  box-shadow: 12px 0 36px rgba(5, 27, 58, 0.10);
}

.rail::after {
  content: "";
  position: absolute;
  right: -90px;
  bottom: -70px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(38, 124, 255, 0.22);
  border-radius: 50%;
}

.brand {
  display: grid;
  gap: 8px;
  margin: 0 4px 30px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.11);
}

.brand img {
  display: block;
  width: 100%;
  max-width: 210px;
  height: auto;
}

.topbar p,
.panel p,
.metrics span {
  color: var(--muted);
}

.brand span {
  display: block;
  color: #a9c6ea;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

nav {
  display: grid;
  gap: 6px;
}

nav a {
  position: relative;
  color: #c9daed;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 9px;
  font-weight: 650;
}

nav a.active,
nav a:hover {
  background: rgba(8, 102, 255, 0.22);
  color: #ffffff;
}

nav a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 3px;
  background: var(--orange);
}

main {
  padding: 34px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: var(--navy);
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.035em;
}

h2 {
  color: var(--navy);
  font-size: 18px;
  line-height: 1.25;
}

.eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.topbar p,
.panel p {
  margin-top: 7px;
}

.status-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  white-space: nowrap;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(7, 40, 85, 0.07);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--gold);
}

.status-strip.ok .dot {
  background: var(--green);
}

.status-strip.bad .dot {
  background: var(--red);
}

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

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

.metrics div {
  position: relative;
  overflow: hidden;
  padding: 16px;
}

.metrics div::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), #52a0ff);
}

.metrics div:last-child::before {
  background: var(--orange);
}

.metrics span {
  display: block;
  font-size: 13px;
  font-weight: 700;
}

.metrics strong {
  display: block;
  margin-top: 6px;
  color: var(--navy);
  font-size: 27px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.panel {
  padding: 20px;
}

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

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

label,
fieldset {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: #34445d;
  font-size: 13px;
  font-weight: 800;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 14px 0 0;
  padding: 12px;
}

legend {
  padding: 0 6px;
}

input,
select {
  width: 100%;
  border: 1px solid #cbd5df;
  border-radius: 8px;
  min-height: 40px;
  padding: 0 10px;
  color: var(--ink);
  background: white;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(8, 102, 255, 0.12);
  outline: none;
}

.inline {
  display: grid;
  grid-template-columns: 1fr 72px 110px;
  gap: 8px;
}

.tracking-panel {
  margin-bottom: 16px;
}

.auth-workspace {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.account-summary,
.admin-summary {
  margin-top: 14px;
}

.account-card {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.account-card div,
.mini-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.account-card span,
.account-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.account-card strong {
  display: block;
  margin-top: 5px;
  font-size: 17px;
}

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

.mini-list {
  margin-top: 10px;
}

.mini-list h3,
#audit h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.mini-list p {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.mini-list p:first-of-type {
  border-top: 0;
}

.audit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.error-text {
  color: var(--red);
  font-weight: 800;
}

.tracking-form {
  max-width: 420px;
}

.tracking-result {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

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

.tracking-summary strong {
  font-size: 18px;
}

.tracking-events {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.tracking-events li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

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

pre {
  overflow: auto;
  border-radius: 8px;
  background: linear-gradient(145deg, #04162f, #082a57);
  color: #e8f3fb;
  padding: 14px;
  line-height: 1.5;
}

.response {
  min-height: 120px;
  margin: 14px 0 0;
}

.api-panel pre {
  margin-bottom: 0;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  border-top: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #526171;
  font-size: 12px;
  text-transform: uppercase;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: #edf3f9;
  color: #314050;
  font-size: 12px;
  font-weight: 850;
}

.pill.created {
  background: #e7f5ee;
  color: #146a48;
}

.pill.failed {
  background: #fae9e9;
  color: #9c2626;
}

.pill.canceled {
  background: #f0f1f3;
  color: #5c6470;
}

.pill.processing {
  background: #fff5d7;
  color: #775100;
}

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

  .rail {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 14px;
  }

  .brand,
  nav {
    display: flex;
    align-items: center;
    overflow-x: auto;
  }

  .brand {
    flex: 0 0 190px;
    margin: 0 16px 0 0;
    padding: 0 16px 0 0;
    border-right: 1px solid rgba(255, 255, 255, 0.11);
    border-bottom: 0;
  }

  .brand img {
    width: 130px;
  }

  .brand span {
    display: none;
  }

  .workspace,
  .metrics,
  .addresses,
  .audit-grid,
  .account-card,
  .admin-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  main {
    padding: 18px 12px;
  }

  .topbar,
  .panel-head,
  .form-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  h1 {
    font-size: 24px;
  }
}
