:root {
  color-scheme: light dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  --bg: #f4f5f7;
  --surface: #fff;
  --text: #17202a;
  --muted: #65717e;
  --border: #d9dee5;
  --primary: #1769aa;
  --danger: #a52323;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
main.card { width: min(92%, 36rem); margin: 8vh auto; padding: 2rem; background: var(--surface); border: 1px solid var(--border); border-radius: .75rem; }
main.wide { width: min(96%, 76rem); margin: 2rem auto; }
header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
h1, h2 { margin-top: 0; }
button, .button, .file-picker {
  display: inline-block; border: 0; border-radius: .4rem; padding: .7rem 1rem;
  color: #fff; background: var(--primary); font: inherit; font-weight: 650; cursor: pointer; text-decoration: none;
}
button:disabled { opacity: .55; cursor: not-allowed; }
.secondary { color: var(--text); background: transparent; border: 1px solid var(--border); }
.danger { background: var(--danger); }
.file-picker input { display: none; }
.stack { display: grid; gap: .8rem; margin-top: 1.5rem; }
label { display: grid; gap: .35rem; }
input, select, textarea { width: 100%; padding: .65rem; border: 1px solid var(--border); border-radius: .4rem; font: inherit; background: var(--surface); color: var(--text); }
.notice { padding: .8rem 1rem; margin: 1rem 0; border: 1px solid var(--border); border-radius: .4rem; }
.pending { border-color: #a27516; }
.approved { border-color: #288447; }
.rejected, .error { border-color: var(--danger); }
.muted { color: var(--muted); font-size: .9rem; }
#upload-area { margin-top: 1.5rem; }
#queue, #admin-queue { display: grid; gap: .5rem; margin-top: 1rem; }
.upload-row { padding: .6rem; border: 1px solid var(--border); border-radius: .35rem; overflow-wrap: anywhere; }
.row { display: grid; gap: .8rem; margin-bottom: 1rem; }
.policy-row { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
.key-form { grid-template-columns: 1fr auto auto; align-items: end; }
.inline-form { display: flex; gap: .5rem; align-items: center; }
.inline-form input[type="number"] { max-width: 7rem; }
.checkbox-label { display: flex; align-items: center; gap: .5rem; padding: .65rem 0; }
.checkbox-label input { width: auto; }
.row-links { margin-top: .45rem; flex-wrap: wrap; }
.panel { margin-top: 1.25rem; padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: .6rem; }
.highlight { border-color: var(--primary); }
.code-box { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; margin: .75rem 0; }
.inline-details { position: relative; }
.inline-details summary { list-style: none; }
.edit-popover { display: grid; gap: .6rem; margin-top: .5rem; padding: .75rem; border: 1px solid var(--border); border-radius: .4rem; background: var(--bg); min-width: 16rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .65rem; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.actions form { margin: 0; }
@media (max-width: 680px) { .key-form { grid-template-columns: 1fr; } }
@media (prefers-color-scheme: dark) {
  :root { --bg: #11161c; --surface: #192129; --text: #edf2f7; --muted: #a9b4c0; --border: #36414c; --primary: #2787d2; }
}
