:root {
  color-scheme: light;
  --page: #f5f7fb;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #657386;
  --line: #d9e0ea;
  --accent: #126c5f;
  --accent-dark: #0d5148;
  --warn: #b42318;
  --warn-bg: #fff1ef;
  --ok-bg: #e9f7ef;
  --shadow: 0 18px 50px rgba(28, 43, 61, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  align-items: center;
  gap: 28px;
  padding: 32px 0;
}

.auth-panel,
.session-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.brand-row,
.session-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-row {
  justify-content: flex-start;
  margin-bottom: 24px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #17202a;
  color: #ffffff;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
}

h2 {
  font-size: 1.45rem;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fc;
  margin-bottom: 22px;
}

.tab-button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  min-height: 42px;
  cursor: pointer;
}

.tab-button.active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(20, 32, 44, 0.12);
  font-weight: 700;
}

.auth-form {
  display: none;
}

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

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  color: #2c3847;
  font-size: 0.9rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  background: #ffffff;
  color: var(--ink);
}

input:focus {
  outline: 3px solid rgba(18, 108, 95, 0.16);
  border-color: var(--accent);
}

.primary-action,
.secondary-action,
.danger-action {
  min-height: 46px;
  border: 0;
  border-radius: 7px;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
}

.primary-action {
  margin-top: 8px;
  background: var(--accent);
  color: #ffffff;
}

.primary-action:hover {
  background: var(--accent-dark);
}

.secondary-action {
  background: #e9eef5;
  color: #1d2b3a;
}

.danger-action {
  background: var(--warn-bg);
  color: var(--warn);
}

.message {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.message.error {
  color: var(--warn);
}

.message.success {
  color: var(--accent-dark);
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 7px 11px;
  background: #e9eef5;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.status-pill.active {
  background: var(--ok-bg);
  color: var(--accent-dark);
}

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

.profile-list div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-weight: 800;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

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

.api-box {
  margin-top: 22px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fc;
}

.api-box p {
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 800;
}

code {
  display: block;
  color: #243244;
  overflow-wrap: anywhere;
}

button:disabled {
  opacity: 0.62;
  cursor: wait;
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
    padding: 10px 0;
  }

  .auth-panel,
  .session-panel {
    padding: 18px;
  }

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

  .brand-row,
  .session-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
