
:root {
  color-scheme: light dark; /* lets the browser's own controls (file picker, checkboxes, scrollbars) follow dark mode */
  --bg: #f7f7f8; --fg: #1d1d1f; --muted: #5f6368; --line: #d9dadd; --accent: #1a5fb4; --danger: #b3261e; --card: #fff;
  /* Admin (user management) colors: amber, so admin pages are never mistaken for file pages. */
  --admin: #8a4f00; --admin-soft: #fff1d6; --admin-line: #e9b65c; --admin-page: #fbf5e9;
  --go: #2e7d32;
  --subtle: #e8eaed; --subtle-hover: #dcdfe3;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181a; --fg: #e8e8ea; --muted: #a0a3a8; --line: #34363a; --accent: #8ab4f8; --danger: #f28b82; --card: #1f2023;
    --admin: #f5c46b; --admin-soft: #33281a; --admin-line: #7a5a24; --admin-page: #1e1a14;
    --go: #81c995;
    --subtle: #2e3034; --subtle-hover: #3a3d42;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--fg); }
body.admin { background: var(--admin-page); }
/* User management link: outlined on the file pages, filled in while on the admin pages, to show where you are. */
nav a.admin-link { padding: 2px 10px; border: 1px solid var(--admin-line); border-radius: 999px; background: transparent; color: var(--admin); font-weight: 600; text-decoration: none; }
nav a.admin-link:hover { border-color: var(--admin); }
nav a.admin-link[aria-current] { background: var(--admin-soft); border-color: var(--admin); }
.admin-banner { padding: 6px 24px; border-bottom: 1px solid var(--admin-line); background: var(--admin-soft); color: var(--admin); font-size: 0.9rem; }
body.admin table { border-color: var(--admin-line); }
table.activity { font-size: 0.85rem; }
table.activity td { padding: 4px 10px; }
td.nowrap { white-space: nowrap; }
/* Clickable rows: the row's one link is stretched over the whole row, so any click opens it while
   keyboard, screen reader, and "open in new tab" behavior stay those of a normal link. */
tr.row-link { position: relative; cursor: pointer; }
tr.row-link:hover td { background: var(--admin-soft); }
tr.row-link:focus-within td { background: var(--admin-soft); }
a.row-link-target { font-weight: 600; }
a.row-link-target::after { content: ""; position: absolute; inset: 0; }
a.row-link-target:focus-visible { outline: none; }
tr.row-link:focus-within { outline: 2px solid var(--accent); outline-offset: -2px; }
tr.problem td { color: var(--danger); }
dialog { max-width: 440px; border: 1px solid var(--admin-line); border-radius: 10px; background: var(--card); color: var(--fg); padding: 20px 24px; }
dialog.danger { border-color: var(--danger); }
.danger-zone { margin-top: 32px; padding: 4px 16px 16px; border: 1px solid var(--danger); border-radius: 8px; }
.danger-zone h2 { margin-top: 12px; color: var(--danger); }
dialog::backdrop { background: rgb(0 0 0 / 0.45); }
dialog h2 { margin-top: 0; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
label.confirm { padding: 10px 12px; border: 1px solid var(--admin-line); border-radius: 6px; background: var(--admin-soft); }
header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; border-bottom: 1px solid var(--line); background: var(--card); }
.brand { display: inline-flex; align-items: center; }
/* width/height on the <img> reserve the logo's space while it loads; keep them in step with logo.png. */
.brand img { max-width: 150px; max-height: 55px; display: block; }
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; flex: 1; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 0 0 16px; padding: 22px 16px;
  border: 2px dashed var(--line); border-radius: 10px; background: var(--card); color: var(--muted); text-align: center; cursor: pointer; }
.dropzone:hover, .dropzone.dragging { border-color: var(--accent); color: var(--fg); }
.dropzone.dragging { background: var(--bg); }
.dropzone.has-files { border-style: solid; border-color: var(--accent); }
.dropzone-selected { color: var(--fg); font-weight: 500; }
.dropzone-selected:empty { display: none; }
/* Right-aligned with the edge of the file table, closed or open. */
.new-folder { margin: 16px 0; text-align: right; }
.new-folder > summary { list-style: none; }
/* Buttons with an icon to the left of their text. */
button.with-icon, .button.with-icon { display: inline-flex; align-items: center; gap: 6px; }
.btn-icon { flex: none; }
/* A low-key gray button for actions people rarely need. */
.button.subtle { background: var(--subtle); border-color: var(--line); color: var(--fg); }
.button.subtle:hover { background: var(--subtle-hover); }
.new-folder > summary::-webkit-details-marker { display: none; }
.new-folder[open] > summary { display: none; }
.new-folder-form { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.icon { min-width: 2.25em; padding: 6px 10px; font-weight: 700; line-height: 1.2; text-align: center; }
button.icon.ok { background: var(--go); border-color: var(--go); }
.button.icon.cancel { background: var(--danger); border-color: var(--danger); }
.upload-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; margin: -4px 0 16px; }
button.upload-submit { background: var(--go); border-color: var(--go); }
/* Hidden until files are chosen: the file input is required, so it is :invalid while empty. */
#upload-files:invalid + .upload-submit { display: none; }
.account { margin-left: auto; display: flex; align-items: center; gap: 16px; margin-right: 10px; }
.who, .account-menu summary { color: var(--muted); }
.account-menu { position: relative; }
.account-menu summary { cursor: pointer; list-style: none; padding: 2px 6px; border-radius: 6px; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary::after { content: " ▾"; }
.account-menu summary:hover, .account-menu[open] summary { background: var(--bg); color: var(--fg); }
.account-menu .menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; min-width: 180px; padding: 6px 0;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); box-shadow: 0 4px 16px rgb(0 0 0 / 0.12); }
.account-menu .menu a { display: block; padding: 6px 14px; color: var(--fg); text-decoration: none; white-space: nowrap; }
.account-menu .menu a:hover, .account-menu .menu a:focus-visible { background: var(--bg); color: var(--accent); }
main { max-width: 1000px; margin: 0 auto; padding: 16px 24px 48px; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 8px 0 12px; }
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 0.85rem; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.actions { white-space: nowrap; text-align: right; }
td.actions a { margin-left: 12px; }
.dir { font-weight: 600; }
.crumbs { color: var(--muted); }
.actions-bar { display: flex; flex-wrap: wrap; gap: 12px 24px; margin: 12px 0 16px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; }
.stack label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.narrow { max-width: 420px; }
small { color: var(--muted); font-weight: 400; }
input, select, button { font: inherit; color: inherit; }
textarea.prose { font: inherit; word-break: normal; }
textarea { font: 0.85rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); word-break: break-all; }
.warn { color: var(--danger); }
h2 { font-size: 1.2rem; margin: 32px 0 8px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-weight: 500; }
.readonly { padding: 6px 8px; border: 1px dashed var(--line); border-radius: 6px; color: var(--muted); }
h3 { font-size: 1rem; margin: 20px 0 8px; }
input:not([type=checkbox]):not([type=file]), select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); }
button, .button { padding: 6px 14px; border: 1px solid var(--accent); border-radius: 6px; background: var(--accent); color: var(--card); cursor: pointer; text-decoration: none; display: inline-block; }
button.danger { background: var(--danger); border-color: var(--danger); }
.button.secondary, button.secondary { background: var(--card); color: var(--accent); }
button.link { background: none; border: none; color: var(--accent); padding: 0; text-decoration: underline; }
.buttons { display: flex; gap: 16px; align-items: center; }
form.inline { display: inline; }
.flash { padding: 8px 12px; border-radius: 6px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); }
.flash.error { border-left-color: var(--danger); }
.note { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
code { font-size: 0.9em; }
