/* Sign-in, access code, account and admin pages. Colors come from tokens.css. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-font-smoothing: antialiased; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); border-top: 4px solid var(--brand); min-height: 100vh; }
a { color: var(--brand); }
button, input, select { font: inherit; color: var(--ink); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.muted { color: var(--muted); }

/* centered card (sign-in, access code) */
.center { min-height: calc(100vh - 4px); display: grid; place-items: center; padding: 24px; }
.auth { width: min(400px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 30px 30px 26px; }
.auth .logo { height: 58px; display: block; margin: 0 auto 14px; }
:root[data-theme="dark"] .logo { background: #eef2f2; border-radius: 10px; padding: 4px 8px; }
.auth h1 { font-size: 19px; text-align: center; margin: 0 0 4px; letter-spacing: -.01em; }
.auth .lead { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select { font-size: 15px; font-weight: 400; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--input); color: var(--ink); }
.field input:focus, .field select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
       border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; transition: border-color .15s, background .15s; }
.btn:hover { border-color: var(--hover); background: var(--th); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.07); background: var(--brand); }
.btn.danger { color: var(--late); }
.btn.small { padding: 4px 11px; font-size: 12.5px; }
.btn.block { width: 100%; padding: 11px 16px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: default; }
.or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.alert { border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13.5px; margin-bottom: 14px; }
.alert.err { background: var(--late-bg); border: 1px solid var(--late-line); color: var(--late); }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.foot { text-align: center; color: var(--faint); font-size: 12px; margin-top: 18px; }

/* admin / account layout */
.topbar { display: flex; align-items: center; gap: 16px; padding: 12px 28px; background: var(--card); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
.topbar img { height: 44px; }
:root[data-theme="dark"] .topbar img { background: #eef2f2; border-radius: 10px; padding: 3px 7px; }
.topbar h1 { font-size: 20px; margin: 0; color: var(--brand); letter-spacing: -.01em; }
.topbar .spacer { flex: 1; }
.topbar a.link { color: var(--muted); text-decoration: none; font-size: 13.5px; font-weight: 500; }
.topbar a.link:hover { color: var(--brand); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 22px 28px 40px; display: grid; gap: 18px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.panel-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; }
.panel h2 { font-size: 13px; margin: 0; font-weight: 700; color: var(--slate); text-transform: uppercase; letter-spacing: .06em; }
.panel p.help { color: var(--muted); font-size: 13px; margin: 4px 0 12px; max-width: 820px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 10px 14px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.grid th, .grid td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tr:last-child td { border-bottom: 0; }
.grid th { background: var(--th); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.grid td.actions { text-align: right; white-space: nowrap; }
.grid td.actions .btn { margin-left: 4px; }
.grid tr.off td { color: var(--faint); }
.grid input, .grid select { padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--input); font-size: 13.5px; width: 100%; }
.role-pill { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--track); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.role-pill.role-admin { background: var(--brand); color: var(--on-accent); }
.role-pill.role-editor { background: var(--brand-soft); color: var(--brand); }
.state { font-size: 12px; font-weight: 600; } .state.on { color: var(--ok); } .state.off { color: var(--late); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 12px; align-items: end; }
.form-row .field { margin: 0; }
.codebox { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.code { font: 700 22px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; padding: 6px 14px; border-radius: var(--radius-sm); background: var(--th); border: 1px dashed var(--hover); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--card); padding: 10px 18px; border-radius: 999px;
         font-size: 14px; box-shadow: var(--shadow-lg); z-index: 99; }
.toast.err { background: var(--late); color: #fff; }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--track); color: var(--muted); }
dialog { border: 1px solid var(--line); border-radius: 16px; padding: 0; background: var(--card); color: var(--ink); width: min(460px, 94vw); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(8, 16, 20, .5); backdrop-filter: blur(3px); }
dialog form { padding: 20px 22px; }
dialog h3 { margin: 0 0 14px; font-size: 17px; }
dialog .row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.grid select { width: auto; min-width: 112px; }
.grid td { white-space: nowrap; }
.grid td:first-child, .grid td:nth-child(2) { white-space: normal; }
.code.small { font-size: 14px; padding: 3px 9px; letter-spacing: .1em; cursor: copy; }
.grid tr.off .code { text-decoration: line-through; opacity: .6; }
.grid td a { color: var(--brand); text-decoration: none; font-weight: 500; }
.grid td a:hover { text-decoration: underline; }
.flag-pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--slate); color: #fff; }
.flag-pill.credit { background: var(--late); }
.grid input[type=checkbox] { width: auto; margin: 0; accent-color: var(--brand); }

/* page shown inside the dashboard's window: that window has its own title bar and Close button */
body.embed .wrap { padding-top: 16px; }
.topbar .btn.primary { text-decoration: none; }

/* access requests */
.state.wait { background: var(--risk-bg, #fff4e0); color: var(--risk, #b26a00); }
.req-panel { border-color: var(--risk, #e8a33d); }
.req-count { color: var(--risk, #b26a00); }
.tabs [data-tab][data-badge]:not([data-badge=""])::after { content: attr(data-badge); display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px;
  border-radius: 999px; background: var(--late, #c92a2a); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
