/* Card Admin — print-inspired: paper workspace, white card surfaces,
   ink topbar, Petra red reserved for primary actions + the "card spine". */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #171b21;
  --ink-2: #232933;
  --text: #2a2f36;
  --muted: #6b7280;
  --line: #e6e8ec;
  --brand: #dd3333;
  --brand-dark: #bc2727;
  --brand-soft: #fdeeee;
  --ok: #167a3d;
  --ok-soft: #e6f6ec;
  --off: #b91c1c;
  --off-soft: #fdecec;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .08);
  --font: -apple-system, "Segoe UI", system-ui, Roboto, Arial, sans-serif;
  --mono: ui-monospace, Consolas, "Cascadia Mono", Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: inherit; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: no-preference) {
  a, button, .btn, .btn-ghost, .copy, input, textarea, tr { transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease; }
}

/* ---- Topbar ---- */
.topbar { display: flex; gap: 22px; align-items: center; background: var(--ink); color: #e7eaee; padding: 0 22px; height: 54px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 600; letter-spacing: .01em; }
.brand-mark { width: 12px; height: 18px; background: var(--brand); border-radius: 2px; display: inline-block; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 0 62%, 55% 62%, 55% 38%, 0 38%); }
.nav-links { display: flex; gap: 4px; margin-left: 10px; height: 100%; }
.nav-links a { display: flex; align-items: center; color: #aab2bd; text-decoration: none; padding: 0 12px; border-bottom: 2px solid transparent; border-top: 2px solid transparent; font-weight: 500; }
.nav-links a:hover { color: #fff; }
.nav-links a.active { color: #fff; border-bottom-color: var(--brand); }
.topbar .spacer { flex: 1; }
.topbar .who { color: #8b93a0; font-size: .85rem; }
.topbar .quiet { color: #aab2bd; text-decoration: none; font-size: .85rem; }
.topbar .quiet:hover, .topbar .quiet.active { color: #fff; }

.container { max-width: 1060px; margin: 30px auto 60px; padding: 0 20px; }

/* ---- Page head: eyebrow + title with card-spine bar ---- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.eyebrow { font-size: .68rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
h1 { font-size: 1.45rem; font-weight: 650; letter-spacing: -.01em; color: var(--ink-2); }
h1.spined::after { content: ""; display: block; width: 38px; height: 4px; background: var(--brand); border-radius: 2px; margin-top: 8px; }
h2 { font-size: 1.05rem; font-weight: 600; color: var(--ink-2); }

/* ---- Flash messages ---- */
.flash { padding: 11px 14px 11px 16px; border-radius: 8px; margin-bottom: 18px; border-left: 4px solid; background: var(--surface); box-shadow: var(--shadow); }
.flash-error { border-left-color: var(--off); color: var(--off); }
.flash-success { border-left-color: var(--ok); color: var(--ok); }

/* ---- Surfaces ---- */
.surface { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 11px 16px; font-size: .68rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, table tr:hover td { background: #fafbfc; }
.t-actions { text-align: right; white-space: nowrap; }
.person strong { display: block; font-weight: 600; color: var(--ink-2); }
.person .sub { color: var(--muted); font-size: .82rem; }
.empty-cell { color: var(--muted); text-align: center; padding: 34px 16px; }

/* ---- Status pills ---- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-on { background: var(--ok-soft); color: var(--ok); }
.pill-off { background: var(--off-soft); color: var(--off); }

/* ---- Public link chip ---- */
.linkchip { display: inline-flex; align-items: center; gap: 8px; }
.linkchip code { font-family: var(--mono); font-size: .8rem; background: #f2f4f6; border: 1px solid var(--line); padding: 3px 8px; border-radius: 6px; color: var(--ink-2); }
.linkchip a { color: var(--muted); }
.copy { font: inherit; font-size: .76rem; font-weight: 600; color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 6px; padding: 3px 9px; cursor: pointer; }
.copy:hover { color: var(--ink-2); border-color: #c9cdd3; background: #fafbfc; }

/* ---- Buttons ---- */
.btn { display: inline-block; background: var(--brand); color: #fff; border: 1px solid var(--brand); padding: 9px 16px; border-radius: 8px; font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-secondary { background: var(--surface); color: var(--ink-2); border-color: #cfd3d9; }
.btn-secondary:hover { background: #f5f6f8; border-color: #b9bec6; }
.btn-danger { background: var(--surface); color: var(--off); border-color: #f1c6c6; }
.btn-danger:hover { background: var(--off-soft); border-color: var(--off); }
.btn-ghost { display: inline-block; background: none; border: 0; color: var(--muted); font: inherit; font-size: .85rem; font-weight: 600; padding: 5px 8px; border-radius: 6px; cursor: pointer; text-decoration: none; }
.btn-ghost:hover { color: var(--ink-2); background: #eef0f3; }
.btn-ghost.danger { color: var(--off); }
.btn-ghost.danger:hover { background: var(--off-soft); }

/* ---- Forms ---- */
.card-form { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); padding: 26px 28px; border-radius: var(--radius); box-shadow: var(--shadow); max-width: 680px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid label { display: flex; flex-direction: column; align-items: stretch; gap: 5px; }
.form-grid label input, .form-grid label textarea { margin-top: auto; }
.form-grid label .hint { margin-bottom: 2px; }
.form-grid .full { grid-column: 1 / -1; }
.group-label { grid-column: 1 / -1; font-size: .68rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 6px; margin: 18px 0 14px; }
.group-label:first-child { margin-top: 0; }
label { display: block; margin-bottom: 14px; font-size: .82rem; font-weight: 500; color: #4b5563; }
input[type=text], input[type=email], input[type=password], input[type=url], textarea {
  width: 100%; padding: 9px 11px; margin-top: 5px; border: 1px solid #d5d9de; border-radius: 8px; font: inherit; font-size: .92rem; color: var(--text); background: #fff; }
input[type=color] { display: block; width: 64px; height: 38px; margin-top: 5px; border: 1px solid #d5d9de; border-radius: 8px; padding: 3px; background: #fff; cursor: pointer; }
input[type=file] { display: block; margin-top: 6px; font-size: .85rem; color: var(--muted); }
input:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(221, 51, 51, .12); }
textarea { min-height: 84px; resize: vertical; }
.form-actions { margin-top: 8px; display: flex; gap: 10px; align-items: center; }
.hint { font-size: .78rem; color: var(--muted); font-weight: 400; }

/* ---- Photo / image previews ---- */
.media-row { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-top: 16px; padding: 16px 20px; display: flex; align-items: center; gap: 16px; max-width: 680px; }
.media-row img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.media-row .grow { flex: 1; color: var(--muted); font-size: .85rem; }
.thumb { border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: #fff; }

/* ---- Login ---- */
.login-box { max-width: 380px; margin: 9vh auto 0; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--brand); padding: 32px 30px; border-radius: 12px; box-shadow: 0 4px 16px rgba(16, 24, 40, .08); }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-brand .brand-mark { width: 14px; height: 22px; background: var(--brand); border-radius: 2px; display: inline-block; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 0 62%, 55% 62%, 55% 38%, 0 38%); }
.login-box h1 { font-size: 1.2rem; }
.login-box .sub { color: var(--muted); font-size: .85rem; margin: 4px 0 20px; }
.login-box .btn { width: 100%; padding: 11px; margin-top: 4px; }

/* ---- QR detail ---- */
.qr-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); text-align: center; max-width: 440px; padding: 30px 28px; }
.qr-box img { width: 250px; height: 250px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #fff; }
.qr-box .url { font-family: var(--mono); font-size: .8rem; margin: 16px 0 20px; word-break: break-all; }
.qr-box .url a { color: var(--ink-2); }
.qr-box .actions-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---- Responsive ---- */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px 16px; }
  .nav-links { order: 3; width: 100%; margin-left: 0; }
  .nav-links a { padding: 8px 12px 6px; }
  .form-grid { grid-template-columns: 1fr; }
  .container { margin-top: 20px; }
}
