:root {
  color-scheme: dark;
  --bg: #12110f;
  --rail: #0d0c0b;
  --surface: #1a1916;
  --surface-2: #22201c;
  --surface-3: #2b2823;
  --line: #2f2c27;
  --line-2: #403b34;
  --text: #f4f0e8;
  --text-2: #bbb3a5;
  --text-3: #91897b;
  --accent: #f2a93b;
  --accent-hover: #f7b955;
  --accent-ink: #1d1406;
  --accent-soft: rgb(242 169 59 / 0.13);
  --ok: #52c48c;
  --ok-soft: rgb(82 196 140 / 0.13);
  --danger: #f2585d;
  --danger-soft: rgb(242 88 93 / 0.13);
  --font: 'Segoe UI Variable Text', 'Segoe UI', system-ui, sans-serif;
  --mono: 'Cascadia Mono', Consolas, ui-monospace, monospace;
}
[hidden] {
  display: none !important;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.45 var(--font);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
::selection {
  background: var(--accent);
  color: var(--accent-ink);
}
input,
button {
  font: inherit;
  color: inherit;
  caret-color: var(--accent);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
h2,
h3 {
  margin: 0 0 4px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
h2 {
  font-size: 17px;
}
h3 {
  font-size: 15px;
}
p {
  margin: 0;
}
code,
.mono {
  font-family: var(--mono);
}
code {
  background: var(--surface-3);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12.5px;
}
.muted {
  color: var(--text-2);
  font-size: 13.5px;
}
.small {
  font-size: 12.5px;
  color: var(--text-3);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: var(--rail);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand img {
  width: 32px;
  height: 32px;
}
.brand b {
  display: block;
  font-size: 16px;
  letter-spacing: -0.02em;
}
.brand span {
  font-size: 12px;
  color: var(--text-3);
}
.key-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border-radius: 16px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
}
.key-chip::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}
.key-chip.ok::before {
  background: var(--ok);
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 14px 28px 0;
  border-bottom: 1px solid var(--line);
}
.tabs button {
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-2);
  font-weight: 550;
  cursor: pointer;
  margin-bottom: -1px;
}
.tabs button[aria-selected='true'] {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.tabs i {
  font-style: normal;
  font-size: 11.5px;
  color: var(--text-3);
  margin-left: 4px;
}

main {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}
main > section {
  max-width: 1040px;
  margin: 0 auto;
}
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
@media (max-width: 900px) {
  .split {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.form {
  padding: 22px;
  display: grid;
  gap: 16px;
}
.field {
  display: grid;
  gap: 6px;
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.field > span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}
.field em {
  font-style: normal;
  color: var(--text-3);
  font-weight: 400;
}
.field small {
  font-size: 12px;
  color: var(--text-3);
}
.field input,
#histSearch {
  height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--bg);
  outline: none;
  width: 100%;
}
.field input:focus,
#histSearch:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input::placeholder,
#histSearch::placeholder {
  color: var(--text-3);
}
.field input.code {
  font-size: 17px;
  letter-spacing: 0.06em;
  height: 48px;
}
.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.seg {
  display: flex;
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line-2);
}
.seg button {
  flex: 1;
  height: 34px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text-2);
  font-weight: 550;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.seg button[aria-pressed='true'] {
  background: var(--surface-3);
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover {
  background: var(--surface-3);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn.primary:hover {
  background: var(--accent-hover);
}
.btn.lg {
  height: 50px;
  font-size: 15px;
}
.btn.sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
}
.err {
  color: var(--danger);
  font-size: 13px;
}
.err:empty {
  display: none;
}

.result {
  padding: 22px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.placeholder {
  margin: auto;
  text-align: center;
  color: var(--text-3);
  max-width: 34ch;
  padding: 24px;
}
.placeholder h3 {
  color: var(--text-2);
}
.summary {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--ok-soft);
  font-size: 13.5px;
}
.summary b {
  color: var(--ok);
  font-size: 14px;
}
.summary div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-2);
}
.summary div span:last-child {
  color: var(--text);
  text-align: right;
}
.keybox {
  font: 12.5px/1.55 var(--mono);
  padding: 14px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px dashed var(--line-2);
  word-break: break-all;
  user-select: all;
  max-height: 180px;
  overflow-y: auto;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.actions .btn {
  flex: 1;
}

.empty {
  padding: 32px;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 12px;
  max-width: 560px !important;
  margin: 40px auto 0 !important;
}
.empty p {
  color: var(--text-2);
  max-width: 48ch;
}

.hist-head {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  font-weight: 500;
  color: var(--text-3);
  font-size: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}
tr:last-child td {
  border-bottom: 0;
}
.r {
  text-align: right;
}
td .tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-2);
}
td .tag.lic {
  background: var(--accent-soft);
  color: var(--accent);
}

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  padding: 11px 16px;
  border-radius: 10px;
  background: #f4f0e8;
  color: #1c1a16;
  font-weight: 600;
  font-size: 13.5px;
  box-shadow: 0 20px 50px rgb(0 0 0 / 0.5);
}
