:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #252525;
  background: #f7f8fa;
  line-height: 1.5;
  letter-spacing: 0;
  font-size: 14px;
  --accent: #c63e38;
  --line: #dfe2e5;
  --muted: #626970;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #288b99;
  outline-offset: 3px;
}
.topbar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: 204px;
  position: fixed;
  inset: 0 auto 0 0;
  padding: 30px 16px;
  background: #fff;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  z-index: 2;
}
.brand { color: var(--accent); font-size: 26px; font-weight: 800; text-decoration: none; padding: 0 12px; }
.topbar nav { display: flex; flex-direction: column; gap: 4px; }
button {
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button:hover { filter: brightness(.93); }
button:disabled { opacity: .5; cursor: wait; }
.topbar button { text-align: left; background: transparent; color: #52585e; padding: 10px 12px; }
.topbar button:hover { background: #f3f4f5; filter: none; }
.topbar button.active { background: #faeae8; color: #a82f29; font-weight: 650; }
#logout { margin-top: 18px; border-top: 1px solid var(--line); border-radius: 0; }
.shell { margin-left: 204px; padding: 44px 36px; max-width: 1600px; }
.panel { min-width: 0; background: transparent; padding: 0; }
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 22px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
h1 { font-size: 24px; line-height: 1.3; margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.page-heading > span { color: var(--muted); font-size: 13px; }
.page-heading button, td button, .email-actions button { background: #fff; border-color: var(--line); color: #343a40; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: #fff; border-block: 1px solid var(--line); }
.metric { padding: 24px 20px; min-width: 0; border-right: 1px solid var(--line); }
.metric:last-child { border: 0; }
.metric span { display: block; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
.metric strong { font-size: 24px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; max-width: 800px; }
.form-grid.narrow { max-width: 620px; }
label { display: flex; flex-direction: column; gap: 8px; color: #4a5055; font-size: 13px; min-width: 0; }
input, select { width: 100%; min-width: 0; min-height: 42px; padding: 10px 12px; border: 1px solid #c9ced3; border-radius: 4px; background: #fff; color: #252525; }
.form-actions { grid-column: 1 / -1; padding-top: 6px; }
.inline-form { display: flex; gap: 12px; margin-bottom: 24px; max-width: 800px; }
.inline-form input { flex: 1; }
.inline-form button { flex-shrink: 0; }
.table-wrap { overflow-x: auto; background: #fff; border-block: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 14px 16px; border-bottom: 1px solid #eceef0; white-space: nowrap; }
th { font-size: 12px; font-weight: 600; color: var(--muted); background: #f1f3f5; }
tbody tr:hover { background: #fafbfc; }
tbody tr:last-child td { border-bottom: 0; }
td[colspan] { padding: 50px 20px; text-align: center; color: var(--muted); }
td button { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.email-actions { border-top: 1px solid var(--line); margin-top: 32px; padding-top: 16px; }
.auth-card { max-width: 420px; margin: 8vh auto; padding: 32px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.auth-card h1 { margin-bottom: 26px; }
.auth-card form { display: flex; flex-direction: column; gap: 18px; }
.auth-card form > button { margin-top: 6px; }
.link-button { background: transparent; color: var(--accent); padding-inline: 0; margin-top: 10px; }
.error { color: #b32822; min-height: 1.5em; overflow-wrap: anywhere; }
.hidden { display: none !important; }
.flash { padding: 12px 16px; margin-bottom: 24px; border-left: 3px solid #247968; background: #e9f4ef; color: #205e50; }
.flash.error { border-color: #b32822; background: #fcebe9; color: #b32822; }
.qr-card { max-width: 360px; text-align: center; }
.qr-card img { display: block; width: 320px; max-width: 100%; aspect-ratio: 1; margin: auto; }
.qr-card img:not([src]) { display: none; }
.qr-card p { color: var(--muted); }
.secondary { background: #fff; border-color: var(--line); color: #343a40; }
.editor-section { padding: 0 0 28px; margin: 0 0 28px; border-bottom: 1px solid var(--line); }
.editor-section h2 { font-size: 18px; margin: 0 0 22px; }
.form-actions { display: flex; gap: 12px; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 16px; padding-top: 20px; }
.pagination span { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 1000px) {
  .shell { padding: 30px 24px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { border-bottom: 1px solid var(--line); }
}
@media (max-width: 700px) {
  .topbar { position: static; width: auto; padding: 16px; gap: 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { font-size: 24px; padding: 0; }
  .topbar nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .topbar button { flex-shrink: 0; }
  #logout { margin: 0; border: 0; }
  .shell { margin-left: 0; padding: 26px 16px; }
  .form-grid { grid-template-columns: 1fr; gap: 18px; }
  .inline-form { flex-direction: column; }
  .auth-card { padding: 24px; margin: 4vh auto; }
  .metric { padding: 20px 14px; }
  .metric strong { font-size: 20px; }
  .page-heading { padding-bottom: 18px; }
}
.appearance-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 360px); gap: 24px; align-items: start; }
.appearance-preview { width: 100%; max-width: 360px; margin: auto; }
#don-preview { width: 100%; height: auto; }
.nameplate-preview { position: relative; width: 100%; }
.nameplate-preview img { width: 100%; display: block; }
.nameplate-preview #title-plate-preview { position: absolute; inset: 0; }
#title-preview, #name-preview { position: absolute; left: 10%; right: 10%; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#title-preview { top: 7%; color: #111; }
#name-preview { top: 47%; font-size: 22px; color: white; text-shadow: 1px 1px #111, -1px -1px #111; }
@media (max-width: 760px) { .appearance-layout { grid-template-columns: 1fr; } }
