/* Shop admin. One file, no framework, no build step.
 *
 * Dark by default: this is a registry of credentials opened next to a terminal and
 * a browser, and the existing dashboard is dark, so the operator's eyes do not have
 * to re-adjust between the two.
 */

:root {
  --bg: #0f1419;
  --bg-soft: #161d25;
  --bg-raised: #1c2530;
  --line: #2a3543;
  --line-soft: #222c38;
  --text: #e6edf3;
  --muted: #8b98a8;
  --accent: #4c9aff;
  --ok: #2ea043;
  --warn: #d29922;
  --bad: #f85149;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, sans-serif;
}

h2, h3 { margin: 0 0 8px; font-weight: 600; }
h2 { font-size: 18px; }
h3 { font-size: 14px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.num { text-align: right; white-space: nowrap; }
.error { color: var(--bad); }
.grow { flex: 1 1 200px; }

/* ---------------------------------------------------------------- login --- */

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 20px 60px rgb(0 0 0 / 45%);
}

.login-card label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12px; }

.brand { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; }
.brand span { color: var(--accent); }

/* --------------------------------------------------------------- shell ---- */

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}

.tabs { display: flex; gap: 4px; }

.tab {
  background: none;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 9px;
  cursor: pointer;
  font: inherit;
}
.tab:hover { color: var(--text); background: var(--bg-raised); }
.tab.active { color: var(--text); background: var(--bg-raised); border-color: var(--line); }

.stats { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }

.chip {
  border: 1px solid var(--line);
  background: var(--bg-raised);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--muted);
}
.chip b { color: var(--text); }
.chip.problem b { color: var(--bad); }

main { padding: 18px 20px 60px; max-width: 1400px; margin: 0 auto; }

.panel {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}
.panel p { max-width: 76ch; }

/* ------------------------------------------------------------- controls --- */

input, select, textarea, button { font: inherit; }

input, select, textarea {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(76 154 255 / 18%);
}
textarea { font-family: var(--mono); font-size: 12px; resize: vertical; }

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 14px;
}

.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 130px; }

.btn {
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #06121f; font-weight: 600; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.tiny { padding: 2px 7px; font-size: 11px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0; }

/* ------------------------------------------------------------- registry --- */

.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 10px; }

table { width: 100%; border-collapse: collapse; }

th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-raised);
  position: sticky;
  top: 0;
}

td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }

.row-click { cursor: pointer; }
.row-click:hover td { background: var(--bg-raised); }

.icons { display: flex; gap: 5px; align-items: center; }

.acct-icon {
  display: inline-flex;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  align-items: center;
  justify-content: center;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--muted);
}
.acct-icon svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  white-space: nowrap;
}
.badge.pending { color: var(--warn); border-color: rgb(210 153 34 / 45%); }
.badge.sold { color: var(--ok); border-color: rgb(46 160 67 / 45%); }
.badge.problem { color: var(--bad); border-color: rgb(248 81 73 / 45%); }

.comment-dot { margin-left: 6px; cursor: help; }

.empty { padding: 26px; text-align: center; color: var(--muted); }

.pager { display: flex; gap: 12px; align-items: center; justify-content: flex-end; margin-top: 12px; }

/* --------------------------------------------------------------- modal ---- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 62%);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}

.modal {
  width: min(900px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 26px 80px rgb(0 0 0 / 55%);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; }
.modal-head p { margin: 2px 0 0; }

.modal-body { padding: 16px 18px; overflow: auto; }

.cred-block { margin-bottom: 20px; }
.cred-block h3 { margin-bottom: 8px; }

table.creds { border: 1px solid var(--line-soft); border-radius: 9px; overflow: hidden; }
table.creds th { position: static; }
table.creds td { font-size: 13px; }

.modal-foot {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--bg-raised);
}

/* --------------------------------------------------------------- toast ---- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 18px;
  box-shadow: 0 12px 40px rgb(0 0 0 / 50%);
  z-index: 60;
}

@media (max-width: 720px) {
  .topbar { gap: 10px; }
  .stats { width: 100%; margin-left: 0; }
  main { padding: 12px; }
  .panel { padding: 12px; }
}

/* A 2FA secret row: quiet, but selectable like the password above it. */
.totp-row td {
  background: rgba(76, 154, 255, 0.06);
  border-bottom: 1px solid var(--line-soft);
}
.totp-row code {
  letter-spacing: 0.04em;
}

