:root {
  --bg: #ffffff; --bg-grad: none;
  --card: #ffffff; --surface: #f7f7f8; --border: #e5e5e7;
  --text: #333333; --muted: #6e6e73; --primary: #1d1d1f;
  --accent: #990F11; --accent-h: #7a0c0e;
  --ok: #15803d; --ok-bg: #dcfce7; --bad: #dc2626; --bad-bg: #fee2e2; --warn: #b7791f; --warn-bg: #fef3c7;
  --shadow: 0 10px 30px rgba(15, 27, 51, .08);
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
body { background: var(--bg) var(--bg-grad) no-repeat; color: var(--text); min-height: 100vh; display: flex; justify-content: center; padding: 24px 16px; }
.wrapper { width: 100%; max-width: 460px; display: flex; flex-direction: column; align-items: center; margin: auto 0; transition: max-width .2s; }
.wrapper.wide { max-width: 760px; }
.logo { height: 46px; margin-bottom: 22px; object-fit: contain; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 26px; width: 100%; box-shadow: var(--shadow); }

h2 { font-size: 1.15rem; color: var(--primary); font-weight: 650; text-align: center; margin-bottom: 4px; }
.subtitle { font-size: .86rem; color: var(--muted); text-align: center; margin-bottom: 20px; }
.hint { font-size: .8rem; color: var(--muted); margin-bottom: 12px; line-height: 1.45; }

.tabs, .subtabs { display: flex; background: var(--surface); padding: 4px; border-radius: 12px; gap: 2px; margin-bottom: 22px; }
.tab-btn, .sub-btn { flex: 1; padding: 9px 6px; border: 0; background: transparent; color: var(--muted); font-size: .86rem; font-weight: 600; border-radius: 9px; cursor: pointer; transition: .15s; }
.tab-btn.active, .sub-btn.active { background: var(--card); color: var(--primary); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.subtabs { margin-bottom: 16px; }
.tab-content, .sub-content { display: none; }
.tab-content.active, .sub-content.active { display: block; }

.field { margin-bottom: 12px; }
label { display: block; font-size: .78rem; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local], select {
  width: 100%; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  font-size: .95rem; color: var(--primary); outline: none; transition: .15s;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.code-input { text-align: center; font-weight: 700; letter-spacing: 4px; font-size: 1.3rem; text-transform: uppercase; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; padding: 16px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }

.btn { width: 100%; padding: 13px; background: var(--accent); color: #fff; border: 0; border-radius: 12px; font-size: .95rem; font-weight: 650; cursor: pointer; transition: .15s; margin-top: 4px; }
.btn:hover { background: var(--accent-h); }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn-dark { background: var(--accent); color: #fff; }
.btn-dark:hover { background: var(--accent-h); }
.btn-success { background: var(--ok); color: #fff; }
.btn-success:hover { background: var(--ok); filter: brightness(1.08); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface); filter: brightness(.97); }
.btn-row { display: flex; gap: 10px; margin-top: 8px; }
.btn-row .btn { margin-top: 0; }
.door-btn { padding: 18px; font-size: 1rem; }

.admin-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.status-dot { font-size: .84rem; font-weight: 600; color: var(--ok); }
.status-dot::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 7px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.link-btn { background: none; border: 0; color: var(--accent); font-size: .8rem; cursor: pointer; font-weight: 600; padding: 2px 4px; }
.link-btn.danger { color: var(--bad); }
.link-btn:hover { text-decoration: underline; }

.section-title { display: flex; justify-content: space-between; align-items: center; font-size: .74rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 22px 0 10px; }
.section-title:first-child { margin-top: 0; }
.count { background: var(--surface); border-radius: 20px; padding: 1px 8px; font-size: .72rem; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } .card { padding: 20px; } }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 4px 0 12px; }
.check { display: flex; align-items: center; gap: 7px; font-size: .88rem; color: var(--text); cursor: pointer; margin: 4px 0; font-weight: 500; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

.list { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; }
.empty { font-size: .85rem; color: var(--muted); text-align: center; padding: 14px; }
.item { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .88rem; }
.item.dim { opacity: .55; }
.item-main { min-width: 0; flex: 1; }
.item-title { font-weight: 650; color: var(--primary); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.item-sub { font-size: .75rem; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.item-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px; }
.code-pill { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: 1.5px; background: var(--card); border: 1px solid var(--border); padding: 1px 7px; border-radius: 7px; font-size: .92rem; }
.badge { padding: 2px 8px; border-radius: 20px; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.badge.pending, .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.approved, .badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.denied, .badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.expired, .badge.muted { background: var(--card); color: var(--muted); border: 1px solid var(--border); }
.mini { padding: 6px 11px; border: 0; border-radius: 8px; font-weight: 700; font-size: .8rem; cursor: pointer; color: #fff; }
.mini.ok { background: var(--ok); color: #fff; } .mini.bad { background: var(--bad); }

.reveal { background: var(--ok-bg); border: 1px solid var(--ok); color: var(--text); border-radius: 12px; padding: 12px; margin: 12px 0; font-size: .84rem; }
.reveal code { display: block; margin-top: 6px; word-break: break-all; font-weight: 700; font-size: .9rem; user-select: all; }
.snippet { background: var(--surface); color: var(--primary); border: 1px solid var(--border); border-radius: 12px; padding: 14px; font-size: .74rem; line-height: 1.55; overflow-x: auto; white-space: pre; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.log { font-size: .78rem; }
.log .t { color: var(--muted); font-variant-numeric: tabular-nums; }

dialog { margin: auto; border: 1px solid var(--border); border-radius: 18px; padding: 24px; background: var(--card); color: var(--text); width: min(440px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(5, 10, 20, .55); backdrop-filter: blur(3px); }
dialog h2 { margin-bottom: 16px; }

#toasts { position: fixed; bottom: 20px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 50; padding: 0 16px; }
.toast { background: var(--primary); color: var(--card); padding: 11px 18px; border-radius: 12px; font-size: .88rem; font-weight: 550; box-shadow: var(--shadow); animation: pop .2s ease; max-width: 420px; }
.toast.ok { background: var(--ok); color: #fff; } .toast.err { background: var(--bad); color: #fff; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
