:root {
  --bg: #f4f5f7; --panel: #fff; --text: #1b1f27; --muted: #6b7280; --line: #e3e6ea;
  --accent: #3b82f6; --accent-ink: #fff; --danger: #dc2626; --ok: #16a34a; --shadow: 0 1px 3px rgba(0,0,0,.08);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1217; --panel: #181c23; --text: #e8eaee; --muted: #8b93a1; --line: #272c36; --shadow: none; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.top { background: var(--panel); border-bottom: 1px solid var(--line); }
.top .in { max-width: 1100px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.brand { font-weight: 700; font-size: 17px; color: var(--text); margin-inline-end: auto; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }

.btn { border: 1px solid var(--line); background: var(--panel); padding: 7px 14px; border-radius: 8px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.sm { padding: 3px 10px; font-size: 13px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); }
.grid-projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.project { display: block; color: var(--text); }
.project:hover { border-color: var(--accent); }
.project .name { font-weight: 700; font-size: 16px; }
.project .slug { direction: ltr; text-align: left; color: var(--muted); font-size: 12px; }
.project .stats { display: flex; gap: 14px; margin-top: 10px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.empty { text-align: center; padding: 50px 10px; color: var(--muted); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab { background: none; border: 0; padding: 9px 16px; border-bottom: 2px solid transparent; color: var(--muted); }
.tab.on { color: var(--accent); border-color: var(--accent); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.shot { position: relative; aspect-ratio: 16/10; border-radius: 10px; overflow: hidden; background: #000; border: 1px solid var(--line); padding: 0; }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot .cap { position: absolute; inset: auto 0 0 0; padding: 14px 8px 5px; background: linear-gradient(transparent, rgba(0,0,0,.7)); color: #fff; font-size: 12px; text-align: start; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 9px 8px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
.ltr { direction: ltr; unicode-bidi: plaintext; text-align: left; font-family: Consolas, monospace; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); font-size: 12px; margin-inline-end: 4px; }
.tag.revoked { color: var(--danger); }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password] { padding: 8px 10px; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; min-width: 200px; }
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.check { display: inline-flex; gap: 5px; align-items: center; margin-inline-end: 10px; color: var(--text); font-size: 14px; }

.login { max-width: 360px; margin: 12vh auto 0; }
.login .card > * + * { margin-top: 12px; }
.login input { width: 100%; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; }

dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); padding: 20px; max-width: min(560px, 94vw); width: 100%; }
dialog::backdrop { background: rgba(0,0,0,.55); }
dialog .actions { display: flex; gap: 8px; justify-content: flex-start; margin-top: 16px; }
.tokenbox { direction: ltr; background: var(--bg); border: 1px dashed var(--accent); border-radius: 8px; padding: 10px; word-break: break-all; font-family: Consolas, monospace; font-size: 13px; user-select: all; }
.warn { color: var(--danger); font-size: 13px; margin: 8px 0; }

.viewer { max-width: 96vw; width: auto; padding: 12px; background: #000; border-color: #000; }
.viewer img { max-width: 92vw; max-height: 78vh; display: block; margin: 0 auto; border-radius: 6px; }
.viewer .bar { display: flex; gap: 8px; align-items: center; margin-top: 10px; color: #ddd; font-size: 13px; flex-wrap: wrap; }
.viewer .bar .grow { margin-inline-end: auto; }
.viewer .btn { background: #222; color: #fff; border-color: #444; }

#toast { position: fixed; bottom: 20px; inset-inline-start: 50%; transform: translateX(-50%); background: #111; color: #fff; padding: 9px 18px; border-radius: 99px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 99; }
#toast.show { opacity: .95; }
