/* LogiLab admin panel: black and gold like the program, plain system fonts (nothing is loaded from another site). */

:root {
  --bg: #0a0907;
  --panel: #131009;
  --panel-2: #1b160d;
  --line: #3a2a12;
  --line-soft: #2a2010;
  --text: #f4eddc;
  --muted: #bcae8c;
  --soft: #8f8266;
  --gold: #e0ac42;
  --gold-light: #f8db72;
  --on-gold: #1a1206;
  --ok: #7be7a8;
  --warn: #ffb347;
  --bad: #ff8379;
  --info: #8ec5ff;
  --radius: 14px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 90% -10%, rgb(224 172 66 / 0.13), transparent 70%),
    radial-gradient(700px 500px at -10% 110%, rgb(224 172 66 / 0.08), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.45;
}

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

:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.btn:hover {
  border-color: var(--gold);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--gold {
  border-color: transparent;
  background: linear-gradient(135deg, #f7dc8a, #e0ac42 55%, #b8862a);
  color: var(--on-gold);
}

.btn--gold:hover {
  filter: brightness(1.06);
}

.btn--block {
  width: 100%;
}

.btn--small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.875rem;
}

.btn--danger {
  border-color: rgb(255 131 121 / 0.5);
  color: var(--bad);
}

/* ---------- login ---------- */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login__card {
  width: min(420px, 100%);
  padding: 32px 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, #17120a, #0f0c07);
  box-shadow: 0 30px 80px rgb(0 0 0 / 0.5);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand img {
  height: 40px;
  width: auto;
  filter: drop-shadow(0 0 10px rgb(224 172 66 / 0.35));
}

.brand em {
  font-style: normal;
  color: var(--gold);
}

.login h1 {
  margin: 22px 0 6px;
  font-size: 1.25rem;
}

.login p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.95rem;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0d0b07;
}

.field textarea {
  min-height: 74px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--gold);
}

.field--bad input,
.field--bad select {
  border-color: var(--bad);
}

.field__error {
  margin-top: 5px;
  color: var(--bad);
  font-size: 0.85rem;
}

.form-error {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid rgb(255 131 121 / 0.5);
  border-radius: 10px;
  background: rgb(255 131 121 / 0.08);
  color: var(--bad);
  font-size: 0.9rem;
}

/* ---------- the page ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(14px, 3vw, 32px);
  border-bottom: 1px solid var(--line-soft);
  background: rgb(10 9 7 / 0.92);
  backdrop-filter: blur(10px);
}

.top__right {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.demo-banner {
  padding: 8px 16px;
  background: #3d2a05;
  color: #ffe2a3;
  font-size: 0.9rem;
  text-align: center;
}

.page {
  padding: 22px clamp(14px, 3vw, 32px) 60px;
  max-width: 1500px;
  margin: 0 auto;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat {
  padding: 14px 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel);
  text-align: left;
  cursor: pointer;
}

.stat:hover,
.stat[aria-pressed='true'] {
  border-color: var(--gold);
}

.stat strong {
  display: block;
  font-size: 1.7rem;
  line-height: 1.1;
}

.stat span {
  color: var(--muted);
  font-size: 0.85rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.toolbar input[type='search'] {
  flex: 1 1 260px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0d0b07;
}

.toolbar input[type='search']:focus {
  border-color: var(--gold);
}

.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel);
}

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

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
}

th {
  position: sticky;
  top: 0;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: rgb(224 172 66 / 0.045);
}

.name {
  font-weight: 700;
}

.sub {
  display: block;
  margin-top: 2px;
  color: var(--soft);
  font-size: 0.82rem;
}

.key {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: Consolas, 'Cascadia Mono', 'Courier New', monospace;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.copy {
  min-width: 32px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.copy:hover {
  border-color: var(--gold);
}

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

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

.pill--waiting {
  color: var(--info);
}

.pill--expired {
  color: var(--warn);
}

.pill--revoked {
  color: var(--bad);
}

.empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
}

/* the menu of one row */
.menu {
  position: relative;
}

.menu summary {
  list-style: none;
  cursor: pointer;
  white-space: nowrap;
}

.menu summary::-webkit-details-marker {
  display: none;
}

.menu__list {
  position: absolute;
  right: 0;
  z-index: 10;
  min-width: 220px;
  margin-top: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #17120a;
  box-shadow: 0 18px 40px rgb(0 0 0 / 0.55);
}

.menu__list button {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.menu__list button:hover {
  background: rgb(224 172 66 / 0.12);
}

/* ---------- dialogs ---------- */

dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, #17120a, #0f0c07);
  color: var(--text);
  box-shadow: 0 40px 100px rgb(0 0 0 / 0.65);
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.65);
}

.dialog__body {
  padding: 24px 24px 20px;
}

.dialog__body h2 {
  margin: 0 0 14px;
  font-size: 1.2rem;
}

.dialog__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}

.keybox {
  margin: 4px 0 14px;
  padding: 16px;
  border: 1px solid var(--gold);
  border-radius: 14px;
  background: rgb(224 172 66 / 0.08);
  text-align: center;
  font-family: Consolas, 'Cascadia Mono', 'Courier New', monospace;
  font-size: 1.5rem;
  letter-spacing: 0.05em;
  word-break: break-all;
}

.message {
  width: 100%;
  min-height: 170px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0d0b07;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 100;
  max-width: calc(100vw - 32px);
  padding: 11px 18px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: #17120a;
  color: var(--text);
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s, transform 0.2s;
}

#toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

#toast.is-error {
  border-color: var(--bad);
  color: var(--bad);
}

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

  .top {
    flex-wrap: wrap;
  }

  .keybox {
    font-size: 1.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
