:root {
  --bg: #0b1016;
  --bg-soft: #101720;
  --card: #141c26;
  --text: #e9eef4;
  --muted: #8b9aab;
  --line: #243040;
  --accent: #4d9fff;
  --accent-dim: #1a3a5c;
  --danger: #e35d6a;
  --ok: #3dbe8c;
  --warn: #e0b04a;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background:
    radial-gradient(1200px 500px at 50% -120px, rgba(77, 159, 255, .16), transparent 60%),
    radial-gradient(800px 400px at 100% 0, rgba(61, 190, 140, .08), transparent 50%),
    var(--bg);
}
a { color: var(--accent); }
a:hover { color: #7cb6ff; }
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 16, 22, .78);
  backdrop-filter: blur(16px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -.02em;
}
.brand .mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background:
    linear-gradient(160deg, #7cb6ff 0%, var(--accent) 45%, #3dbe8c 120%);
  box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 6px 16px rgba(77, 159, 255, .35);
}
nav { display: flex; flex-wrap: wrap; gap: 4px; }
nav a {
  color: var(--muted);
  text-decoration: none;
  margin: 0;
  padding: 7px 11px;
  border-radius: 9px;
  font-size: .92rem;
}
nav a:hover { color: var(--text); background: rgba(255,255,255,.05); }
nav a.on { color: var(--text); background: var(--accent-dim); }
main { max-width: 1100px; margin: 36px auto 64px; padding: 0 16px; }
body.auth main {
  min-height: calc(100vh - 80px);
  display: grid;
  align-content: center;
}
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent 28%), var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 28px 32px;
  box-shadow: var(--shadow);
  max-width: 520px;
  margin: 0 auto;
}
.card.narrow { max-width: 400px; }
.card.wide { max-width: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 8px; }
.crumb {
  display: inline-block;
  margin: 0 0 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: .92rem;
}
.crumb:hover { color: var(--text); }
h1 { margin: 0 0 10px; font-size: 1.55rem; letter-spacing: -.03em; line-height: 1.2; }
h2 { margin: 32px 0 12px; font-size: 1.05rem; letter-spacing: -.01em; }
h3 { margin: 0 0 6px; font-size: 1rem; }
.lead { color: var(--muted); margin: 0 0 18px; }
.muted { color: var(--muted); }
.howto {
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}
.howto li {
  color: var(--muted);
  padding: 10px 12px 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
}
.howto strong { color: var(--text); font-weight: 650; }
.howto code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em;
  color: #c9d6e3;
}
.field-hint {
  margin: -8px 0 16px;
  font-size: .86rem;
  color: var(--muted);
}
.ticket {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 16px 0;
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-size: 1rem;
  color: var(--muted);
}
.ticket strong {
  font-size: 1.6rem;
  color: var(--text);
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.toolbar {
  display: flex;
  gap: 8px;
  margin: 16px 0 14px;
  align-items: center;
}
.toolbar input { width: auto; flex: 1; min-width: 0; }
.toolbar button { margin: 0; }
label {
  display: block;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: .86rem;
}
label input, label select, label textarea { margin-top: 6px; }
input, select, textarea, button {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0d131a;
  color: var(--text);
  font: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #4d9fff99;
  box-shadow: 0 0 0 3px rgba(77, 159, 255, .18);
}
button {
  width: auto;
  margin-top: 4px;
  background: var(--accent);
  border: 0;
  color: #fff;
  cursor: pointer;
  padding: 11px 16px;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(77, 159, 255, .22);
}
button:hover { filter: brightness(1.06); }
button.danger {
  background: var(--danger);
  box-shadow: 0 8px 20px rgba(227, 93, 106, .22);
}
button:disabled { opacity: .5; cursor: not-allowed; filter: none; box-shadow: none; }
.card:not(.wide) form > button[type="submit"] { width: 100%; margin-top: 8px; }
.flash {
  margin: 0 0 16px;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid;
}
.flash.error, .error {
  color: #ff8b96;
}
.flash.error { background: rgba(227, 93, 106, .12); border-color: rgba(227, 93, 106, .35); }
.ok { color: var(--ok); }
.flash.ok { background: rgba(61, 190, 140, .12); border-color: rgba(61, 190, 140, .35); color: var(--ok); }
.warn { color: var(--warn); }
.flash.warn { background: rgba(224, 176, 74, .12); border-color: rgba(224, 176, 74, .35); color: var(--warn); }
th.check, td.check { width: 36px; }
input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--accent); }
.hp { display: none; }
.captcha {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 12px;
}
.captcha img {
  display: block;
  width: 220px;
  height: 64px;
  border-radius: 10px;
  border: 1px solid var(--line);
  cursor: pointer;
  background: #0d131a;
}
.captcha button {
  margin: 0;
  width: auto;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  box-shadow: none;
  font-weight: 500;
}
.table-wrap { overflow-x: auto; margin: 4px -6px 0; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover { background: rgba(255,255,255,.025); }
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 16px;
}
.filters a {
  margin: 0;
  padding: 6px 11px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  font-size: .9rem;
}
.filters a:hover { color: var(--text); border-color: #3a4b5e; }
.filters a.on {
  color: var(--text);
  font-weight: 650;
  border-color: transparent;
  background: var(--accent-dim);
}
.st {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.st-pending { background: #3d3410; color: #f0d36c; }
.st-approved { background: #143528; color: var(--ok); }
.st-rejected { background: #3a151a; color: var(--danger); }
.st-revoked { background: #2a2434; color: #c5b4d8; }
.meta {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px 16px;
  margin: 18px 0 0;
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.meta dt { color: var(--muted); font-size: .86rem; }
.meta dd { margin: 0; }
.notice {
  margin: 20px 0 0;
  padding: 14px 16px;
  border: 1px solid rgba(224, 176, 74, .4);
  border-radius: 12px;
  background: #241e10;
}
.notice p { margin: 0 0 8px; }
.notice p:last-child { margin-bottom: 0; }
.notice ul { margin: 0 0 10px; padding-left: 1.2em; }
.notice ul:last-child { margin-bottom: 0; }
.actions { margin-top: 24px; display: grid; gap: 14px; }
form.inline {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
  display: grid;
  gap: 12px;
}
@media (min-width: 720px) {
  form.inline {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    align-items: end;
  }
  form.inline > button { justify-self: start; margin-top: 0; }
  form.inline > p { grid-column: 1 / -1; margin: 0; }
}
.inline label { margin: 0; }
.key {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
}
.key.dim { opacity: .55; }
.key textarea { margin: 10px 0; min-height: 84px; }
details { margin: 8px 0; }
summary { cursor: pointer; color: var(--muted); }
textarea, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
}
.empty {
  margin: 24px 0 8px;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 12px;
}
.link-btn {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 8px;
  text-decoration: none;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: .88rem;
}
.link-btn:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 640px) {
  .top { padding: 10px 12px; }
  .card { padding: 22px 16px 26px; }
  .meta { grid-template-columns: 1fr; gap: 4px; }
  .meta dt { margin-top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
