:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #657289;
  --line: #dfe5ef;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #067647;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.25;
}

h2 {
  font-size: 18px;
}

.topbar p,
.item p {
  color: var(--muted);
  margin-top: 6px;
}

.token-form {
  display: flex;
  gap: 8px;
  min-width: min(420px, 100%);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  padding: 24px 32px 40px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.panel-head,
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.stack {
  display: grid;
  gap: 12px;
}

.secondary {
  display: none;
}

.secondary.visible {
  display: grid;
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 12px;
}

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

.grid-3 {
  grid-template-columns: 1fr 100px 1fr;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

label {
  color: var(--muted);
  font-size: 13px;
}

label input {
  margin-top: 6px;
}

button {
  border: 0;
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
}

button:hover {
  background: var(--primary-dark);
}

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

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

legend {
  color: var(--muted);
  font-size: 13px;
  padding: 0 6px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.check input {
  width: auto;
  margin: 0;
}

.inline {
  align-self: end;
  height: 42px;
}

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

.picker.empty {
  color: var(--muted);
  font-size: 14px;
}

.badge,
.pill {
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  background: #edf2f7;
  color: var(--muted);
  white-space: nowrap;
}

.pill.active {
  background: #dcfae6;
  color: var(--ok);
}

.pill.expired,
.pill.disabled {
  background: #fef0c7;
  color: var(--warn);
}

.list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #fcfdff;
}

.item-main {
  min-width: 0;
}

code {
  display: block;
  overflow: hidden;
  margin-top: 8px;
  color: #344054;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  justify-content: end;
  gap: 8px;
  max-width: 340px;
}

.actions button {
  padding: 8px 10px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #172033;
  color: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
}

@media (max-width: 980px) {
  .topbar,
  .layout {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar,
  .layout,
  .item {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .actions {
    max-width: none;
    justify-content: start;
  }
}

@media (max-width: 640px) {
  .grid-2,
  .grid-3,
  .token-form {
    grid-template-columns: 1fr;
    display: grid;
  }
}
