/* Staff pages at /admin/. Colors, the top bar and a site's header are in /css/shell.css. */
a { color: var(--bar); }
h1 { font-size: 1.4rem; margin: 0 0 4px; }
h2 { font-size: 1rem; margin: 0 0 12px; color: var(--ink-2); }
.muted { color: var(--muted); font-size: .88rem; margin: 4px 0 0; }


main { max-width: var(--page); margin: 0 auto; padding: 8px 16px 48px; display: grid; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.site-card h2 { color: var(--ink); font-size: 1.1rem; margin-bottom: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.flash { background: var(--bar-soft); border-radius: 8px; padding: 10px 12px; }
.errors { color: var(--danger); margin: 0; padding-left: 18px; }
.error { color: var(--danger); font-size: .88rem; margin: 2px 0 0; }

.stack { display: grid; gap: 12px; }
.stack > h2, .stack > h3 { margin-bottom: 0; }
label { display: grid; gap: 4px; font-size: .9rem; color: var(--ink-2); }
label.check { display: flex; gap: 8px; align-items: flex-start; color: var(--ink); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=url], input[type=date], input[type=datetime-local], textarea, select {
  font: inherit; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); width: 100%; min-width: 0;
}
.button, button.primary, button.secondary, button.danger {
  font: inherit; font-weight: 600; padding: 9px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); text-decoration: none; display: inline-block; text-align: center;
}
button.primary, .button.primary { background: var(--ink); color: var(--card); border-color: var(--ink); }
button.secondary, .button { background: var(--card); color: var(--ink); }
button.danger { background: none; color: var(--danger); border-color: transparent; padding: 6px 8px; }
button.linkish { background: none; border: 0; padding: 0; color: var(--bar); font: inherit; font-size: .85rem; cursor: pointer; }

.auth { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.auth .card { width: 100%; max-width: 380px; }


.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; }
td select { width: auto; padding: 5px 8px; }
td .who { font-weight: 600; }
tr.disabled td { opacity: .55; }
[data-status] { font-size: .8rem; color: var(--accent); margin-left: 6px; }
[data-status].bad { color: var(--danger); }
.row-actions { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.row-actions form { margin: 0; }

.grid-2 { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.log { list-style: none; margin: 0; padding: 0; font-size: .88rem; }
.log li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.log time { color: var(--muted); margin-right: 6px; }

/* Landing page editor (/admin/sites/...) */
textarea { resize: vertical; line-height: 1.4; }
input[type=file] { font: inherit; font-size: .88rem; }
input[type=color] { width: 64px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
h3 { font-size: .95rem; margin: 8px 0 0; }
code { font-size: .85em; background: var(--bg); padding: 1px 4px; border-radius: 4px; }
fieldset.choices { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
fieldset.choices legend { font-size: .9rem; color: var(--ink-2); margin-bottom: 6px; }
.prefixed { display: flex; align-items: center; gap: 4px; }
.prefixed .muted { margin: 0; white-space: nowrap; }
.field-row { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 0; display: grid; gap: 10px; background: var(--bg); }
.field-row input, .field-row textarea, .field-row select { background: var(--card); }
.field-main { display: grid; gap: 10px; grid-template-columns: 2fr 1fr; }
@media (max-width: 600px) { .field-main { grid-template-columns: 1fr; } }
.field-flags { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: flex-start; }
.field-flags > label:not(.check) { flex: 1 1 260px; }
.hero-thumb { display: grid; gap: 6px; }
.hero-thumb img { max-width: 220px; max-height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.save-bar { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%); }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-end; }
.problems { display: grid; gap: 4px; }
.problems p { margin: 0; }
.warnings { margin: 0; padding-left: 18px; }
.ok { color: var(--accent); margin: 0; }
#kit-prompt { font-size: .85rem; }

/* Sites list */
.site-card { display: grid; gap: 8px; align-content: start; }
.site-card .muted { margin: 0; }
.site-card-head { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.site-card-head h2 { margin: 0; }
.site-card-head .badge { white-space: nowrap; flex-shrink: 0; }
.site-card-head h2 a { color: inherit; text-decoration: none; }
.site-card-head h2 a:hover { text-decoration: underline; }
.site-card.draft { background: transparent; border-style: dashed; }
.site-numbers { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--ink-2); text-decoration: none; font-size: .92rem; }
.site-numbers strong { font-size: 1.35rem; color: var(--ink); margin-right: 2px; }
.site-numbers .attention { color: var(--danger); }
.site-numbers .attention strong { color: var(--danger); }
.card-links { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 4px; }
.card-links a:not(.button) { font-size: .9rem; font-weight: 600; text-decoration: none; }
.card-links a:not(.button):hover { text-decoration: underline; }

/* A site's pages: dashboard, edit, people */
.save-bar { display: flex; gap: 12px; align-items: center; }
.unsaved { color: var(--bar); font-size: .9rem; font-weight: 600; }

/* Lists that grow: sites, users, a user's sites. A search box and filter buttons over a table. */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 8px; }
.toolbar input[type=search] { font: inherit; padding: 8px 11px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); flex: 1 1 220px; max-width: 340px; min-width: 0; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.segmented button { font: inherit; font-size: .85rem; padding: 6px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2); }
.segmented button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--card); }
.segmented button.attention:not([aria-pressed="true"]) { color: var(--danger); }
table.list td { padding-top: 10px; padding-bottom: 10px; }
table.list a.who { color: var(--ink); text-decoration: none; }
table.list a.who:hover { text-decoration: underline; }
table.list tr.draft a.who { color: var(--ink-2); }
th.num, td.num { text-align: right; padding-right: 18px; white-space: nowrap; }
td.num strong { font-size: 1.05rem; }
.row-links { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: .88rem; }
.row-links a { text-decoration: none; font-weight: 600; white-space: nowrap; }
.row-links a:hover { text-decoration: underline; }
.badge.soft { background: var(--line); color: var(--ink-2); }
.badge.alert { background: var(--danger); color: #fff; text-decoration: none; margin-left: 4px; }
.clip { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { margin: 0 0 6px; font-size: .9rem; }
.back a { text-decoration: none; }
h1 .badge, h1 .muted { font-size: .75rem; font-weight: 600; vertical-align: 4px; margin-left: 4px; }
.spaced { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); gap: 8px; }
.footnote { margin: -4px 0 0; }
.show-narrow { display: none; margin-top: 4px; }
@media (max-width: 700px) {
  .hide-narrow { display: none; }
  .show-narrow { display: flex; }
}
.col-access { width: 1%; white-space: nowrap; }
.row-actions.nowrap { flex-wrap: nowrap; align-items: center; }
.card-title { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-title h2 { margin: 0; }
.person-status { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 4px; font-size: .85rem; }
.person-status form { margin: 0; }
.person-status .muted { margin: 0; font-size: .82rem; }
tr.admin-row .who { color: var(--ink-2); }

/* Picking an existing account (a site's Team page) */
.picker { position: relative; }
.picker-list { list-style: none; margin: 4px 0 0; padding: 4px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); position: absolute; left: 0; right: 0; z-index: 5; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.picker-list button { display: block; width: 100%; text-align: left; font: inherit; font-size: .9rem; padding: 7px 9px;
  border: 0; border-radius: 6px; background: none; color: var(--ink); cursor: pointer; }
.picker-list button:hover, .picker-list button:focus { background: var(--bar-soft); }
.picker-list .muted { margin: 0 0 0 6px; }
.pre-line { white-space: pre-line; }

/* New landing page (/admin/sites/new) */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.new-site { width: 100%; max-width: 720px; margin: 8px auto 0; display: grid; gap: 16px; }
.new-site-head .muted { font-size: .95rem; }
.new-site-form { display: grid; gap: 16px; }
.new-site-form .card { padding: 20px; }
.new-site-form h2 { color: var(--ink); font-size: 1.05rem; }
.hint { font-size: .82rem; color: var(--muted); }
.address { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); gap: 0; overflow: hidden; }
.address > span { padding: 9px 0 9px 11px; color: var(--muted); white-space: nowrap; }
.address input[type=text] { border: 0; padding-left: 1px; background: transparent; }
.address:focus-within { outline: 2px solid var(--bar); outline-offset: -1px; }
.address input:focus { outline: none; }
fieldset.tiles { border: 0; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tile { position: relative; display: block; cursor: pointer; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 14px 16px 14px 44px; background: var(--bg); color: var(--ink); transition: border-color .15s, background .15s; }
.tile:hover { border-color: var(--muted); }
.tile input { position: absolute; left: 16px; top: 17px; margin: 0; accent-color: var(--bar); }
.tile:has(input:checked) { border-color: var(--bar); background: var(--bar-soft); }
.tile:has(input:focus-visible) { outline: 2px solid var(--bar); outline-offset: 2px; }
.tile-body { display: grid; gap: 4px; }
.tile-body strong { font-size: 1rem; }
.tile-body span { font-size: .88rem; color: var(--ink-2); line-height: 1.4; }
.new-site-actions { display: flex; justify-content: flex-end; }
.new-site-actions .primary { padding: 11px 22px; font-size: 1rem; }

/* Modal dialogs: <dialog class="modal">, opened by [data-open-dialog="#id"]. */
dialog.modal { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: min(640px, calc(100% - 32px));
  max-height: calc(100% - 32px); background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog.modal::backdrop { background: rgba(23,18,14,.45); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-head h2 { margin: 0; color: var(--ink); font-size: 1.15rem; }
.modal-close { background: none; border: 0; font-size: 1.5rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.modal-close:hover { color: var(--ink); background: var(--bg); }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
button[disabled] { opacity: .6; cursor: progress; }

/* Rows that open a page when clicked anywhere. */
tr[data-href] { cursor: pointer; }
tr[data-href]:hover td { background: var(--bg); }
details.more summary { cursor: pointer; color: var(--bar); font-size: .88rem; padding: 8px 0; }
.invite-sites input[type=search] { font: inherit; padding: 8px 11px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); width: 100%; margin-bottom: 6px; }
.invite-site-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; }
.invite-site-list tr:last-child td { border-bottom: 0; }
.invite-site-list td.col-access { text-align: right; width: 1%; white-space: nowrap; }
tr.chosen .who { color: var(--bar); }
.log a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
.log a:hover { text-decoration-color: currentColor; }

/* A status line with its one action, e.g. "They haven't accepted the invite yet. [Resend]". */
.notice { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between;
  background: var(--bar-soft); border-radius: var(--radius); padding: 12px 16px; }
.notice p { margin: 0; }
.notice form { margin: 0; }

/* A site's edit page: jump links beside a column narrow enough to read. */
.edit-layout { display: grid; grid-template-columns: 170px minmax(0, 780px); gap: 24px; align-items: start; }
.edit-main { display: grid; gap: 16px; min-width: 0; }
.edit-main > form { gap: 16px; }
.edit-toc { position: sticky; top: 16px; display: grid; gap: 2px; font-size: .9rem; }
.edit-toc a { color: var(--ink-2); text-decoration: none; padding: 6px 10px; border-left: 2px solid var(--line); }
.edit-toc a:hover { color: var(--ink); }
.edit-toc a[aria-current] { color: var(--ink); border-left-color: var(--bar); font-weight: 600; }
.edit-main section[id], .edit-main [id=ai] { scroll-margin-top: 64px; }
@media (max-width: 900px) {
  .edit-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .edit-toc { display: flex; overflow-x: auto; scrollbar-width: none; z-index: 10; background: var(--bg); padding: 6px 0;
    top: 0; margin: 0 -16px; padding-inline: 16px; border-bottom: 1px solid var(--line); }
  .edit-toc a { border-left: 0; border-bottom: 2px solid transparent; white-space: nowrap; }
  .edit-toc a[aria-current] { border-bottom-color: var(--bar); }
}
.now-note { margin: 0; font-size: .82rem; }
input.short, select.short { max-width: 260px; }
.email-split { border: 0; padding: 0; margin: 0; min-width: 0; }
.email-split legend { padding: 0; margin-bottom: 4px; font-size: .9rem; color: var(--ink-2); }
.email-split-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.button.small, button.small { font-size: .85rem; padding: 6px 11px; }
.details-body { padding-top: 8px; }
details > summary { cursor: pointer; color: var(--bar); font-size: .9rem; }
.card.draft { border-color: var(--bar); background: var(--bar-soft); }
.card.draft .muted { color: var(--ink-2); }

/* Two ways to get a page's files: AI, or a .zip. */
.ways { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.way { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: var(--bg); align-content: start; }
.way h3 { margin: 0; }
.way .muted { margin: 0; }
.way textarea, .way input { background: var(--card); }
.dropzone { display: grid; gap: 4px; place-items: center; text-align: center; padding: 22px 12px; cursor: pointer;
  border: 1.5px dashed var(--muted); border-radius: 10px; background: var(--card); color: var(--ink); }
.dropzone:hover, .dropzone.over { border-color: var(--bar); background: var(--bar-soft); }
.dropzone.has-file { border-style: solid; border-color: var(--accent); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone:focus-within { outline: 2px solid var(--bar); outline-offset: 2px; }

/* Payments off: price boxes and the accounting name hide. */
.no-payments [data-paid] { display: none !important; }

/* The form builder: the three questions every form asks, then each question folded to one line. */
.field-fixed-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.field-fixed { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; justify-content: space-between; padding: 9px 12px;
  background: var(--bg); }
.field-fixed + .field-fixed { border-top: 1px solid var(--line); }
.field-fixed .muted { margin: 0; }
.field-name { font-weight: 600; }
.field-row { padding: 0; gap: 0; }
.field-summary { display: flex; align-items: center; gap: 6px; padding: 6px 8px; }
.field-toggle { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; text-align: left;
  font: inherit; background: none; border: 0; padding: 6px 4px; color: var(--ink); cursor: pointer; }
.field-toggle .muted { margin: 0; }
.field-toggle::after { content: "▾"; margin-left: auto; color: var(--muted); }
.field-row[data-open] .field-toggle::after { content: "▴"; }
.field-body { padding: 4px 12px 12px; border-top: 1px solid var(--line); }
.field-row:not([data-open]) .field-body { display: none; }
.drag-handle { cursor: grab; background: none; border: 0; color: var(--muted); font-size: 1rem; letter-spacing: -3px;
  padding: 6px 8px 6px 4px; border-radius: 6px; line-height: 1; }
.drag-handle:hover, .drag-handle:focus-visible { color: var(--ink); background: var(--card); }
.field-row.dragging { opacity: .5; border-style: dashed; }

/* Texts and emails */
.message-block + .message-block { border-top: 1px solid var(--line); padding-top: 16px; }
.message-block h3 { margin: 0; }
.message-tools { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; font-size: .85rem; }
.message-tools .muted { margin: 0; }
.message-tools .muted.warn { color: var(--bar); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font: inherit; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; padding: 2px 8px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink-2); cursor: pointer; }
.chip:hover { border-color: var(--bar); color: var(--ink); }
[data-test-status] { font-size: .82rem; }
[data-test-status].ok { color: var(--accent); }
[data-test-status].error { color: var(--danger); }
