:root {
  --bg: #101114;
  --panel: #191d22;
  --panel-2: #20262d;
  --text: #f5f1e8;
  --muted: #b8b0a2;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #e2452f;
  --accent-2: #f5b84b;
  --ok: #3fc46f;
  --wait: #4da3ff;
}

* {
  box-sizing: border-box;
}

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

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px 12px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 3px;
  font-size: 30px;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
}

.current-user,
.field {
  display: grid;
  gap: 8px;
}

.current-user {
  display: flex;
  align-items: center;
}

.current-user span {
  color: var(--accent-2);
  font-weight: 700;
}

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

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d0f12;
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

textarea {
  min-height: 260px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  padding: 7px 10px;
  cursor: pointer;
}

button:hover {
  border-color: rgba(255, 255, 255, 0.28);
}

.primary {
  border-color: transparent;
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.danger {
  border-color: rgba(226, 69, 47, 0.55);
  color: #ffd8d3;
}

.danger:hover {
  border-color: var(--accent);
  background: rgba(226, 69, 47, 0.16);
}

.layout {
  padding: 10px 24px 24px;
}

.table-layout {
  display: block;
}

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

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.toolbar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 8px;
}

.page-size {
  display: grid;
  gap: 4px;
}

.page-size span {
  color: var(--muted);
  font-size: 12px;
}

.page-size select {
  min-width: 94px;
  padding: 6px 8px;
}

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.panel-head p,
.hint {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

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

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

th,
td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.sort-btn {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.sort-btn.active {
  color: var(--accent-2);
}

.sort-btn.active::after {
  content: " ↓";
}

.sort-btn.active[data-dir="asc"]::after {
  content: " ↑";
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.035);
}

.empty-row td {
  padding: 18px 8px;
  color: var(--muted);
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 12px;
  color: #111;
  background: var(--muted);
  font-weight: 700;
}

.badge.ready {
  background: var(--ok);
}

.badge.waiting {
  background: var(--wait);
}

.badge.claimed {
  background: var(--accent-2);
}

.badge.expired {
  background: #8a8f98;
}

.actions {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.claimed-by {
  min-width: 130px;
}

.claimed-by strong,
.claimed-by small {
  display: block;
}

.claimed-by small,
.muted {
  color: var(--muted);
  font-size: 12px;
}

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

.form-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

dialog {
  width: min(820px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 18px;
}

.wide-dialog {
  width: min(1120px, calc(100% - 28px));
}

.name-dialog {
  width: min(420px, calc(100% - 28px));
}

.copy-dialog {
  width: min(820px, calc(100% - 28px));
}

.copy-dialog textarea {
  min-height: 180px;
  width: 100%;
  margin-bottom: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.45;
}

.name-dialog form {
  display: grid;
  gap: 14px;
}

.name-dialog::backdrop {
  background: rgba(0, 0, 0, 0.78);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.66);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

pre {
  max-height: 58vh;
  overflow: auto;
  padding: 14px;
  border-radius: 8px;
  background: #0d0f12;
  white-space: pre-wrap;
}

.structured-view {
  display: grid;
  gap: 14px;
  max-height: 68vh;
  overflow: auto;
}

.structured-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.structured-card h3 {
  margin: 0;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 15px;
}

.kv-table {
  min-width: 680px;
}

.kv-table td:first-child {
  width: 240px;
  color: var(--accent-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.cookie-table td,
.cookie-table th {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.cookie-table td:first-child {
  width: 280px;
}

.copy-cell {
  max-width: 820px;
  color: var(--text);
  cursor: copy;
  overflow-wrap: anywhere;
  white-space: normal;
}

.copy-cell:hover,
.copy-cell:focus {
  background: rgba(74, 222, 128, 0.08);
  outline: 1px solid rgba(74, 222, 128, 0.35);
  color: var(--accent-2);
}

.empty-structured {
  color: var(--muted);
  padding: 20px 0;
  text-align: center;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #f5f1e8;
  color: #111;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

code {
  color: var(--accent-2);
}

@media (max-width: 640px) {
  .topbar {
    display: grid;
    padding: 22px 18px;
  }

  .layout {
    padding: 14px 18px 22px;
  }

  h1 {
    font-size: 34px;
  }
}
