:root {
  --bg: #ffffff;
  --surface: #fafaf8;
  --text: #111111;
  --muted: #5a5a5a;
  --subtle: #8a8a8a;
  --rule: #d9d9d4;
  --input: #b4b4ae;
  --accent: #b8451f;
  --accent-hover: #8c3416;
  --danger: #a00b0b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 28px 0;
}

.serif {
  font-family: ui-serif, "Iowan Old Style", "Charter", Georgia, "Times New Roman", serif;
  font-weight: 600;
}

/* main container */
.wrap {
  max-width: 600px;
  margin: 36px auto 80px;
  padding: 0 20px;
}
.wrap.wide { max-width: 980px; }

.muted-inline { color: var(--muted); font-weight: 400; font-size: 13px; }
.adm {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 1px 6px;
  margin-left: 8px;
  vertical-align: 3px;
  text-transform: lowercase;
}
.badge {
  display: inline-block;
  font-size: 11px;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0 5px;
  margin-left: 6px;
  vertical-align: 1px;
}

.who a { color: var(--muted); margin-right: 8px; }
.who a:hover { color: var(--accent); }

/* admin: new user form */
.newuser {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.newuser input[type="text"] { flex: 1 1 180px; width: auto; }
.newuser .inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
}
.newuser button { flex: 0 0 auto; }
.newuser #nu_msg { font-size: 13px; flex: 1 1 100%; }
.msg-err { color: var(--danger); }
.msg-ok  { color: var(--text); }

/* header */
header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 24px;
}
header .title {
  font-family: ui-serif, "Iowan Old Style", "Charter", Georgia, "Times New Roman", serif;
  font-weight: 600;
  font-size: 22px;
  margin: 0;
}
header .who {
  color: var(--muted);
  font-size: 13px;
}
header .who form { display: inline; margin: 0; }
header .who button {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
header .who button:hover { color: var(--accent); }

/* section heads */
h2.section {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 14px 0;
  color: var(--text);
}

/* form bits */
label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 5px;
}
input[type="text"], input[type="password"], input[type="number"] {
  width: 100%;
  padding: 7px 9px;
  background: var(--bg);
  border: 1px solid var(--input);
  border-radius: 2px;
  color: var(--text);
  font: inherit;
}
input[type="text"]:focus, input[type="password"]:focus, input[type="number"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-color: var(--text);
}

input[type="checkbox"] {
  width: 14px; height: 14px;
  margin: 0;
  accent-color: var(--accent);
  vertical-align: middle;
}

button.primary {
  background: var(--text);
  color: #fff;
  border: 0;
  padding: 8px 14px;
  border-radius: 2px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
button.primary:hover { background: var(--accent); }
button.primary:disabled { background: var(--subtle); cursor: not-allowed; }
button.primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button.linklike {
  background: none; border: 0; padding: 0;
  font: inherit;
  color: var(--accent);
  text-decoration: underline; text-underline-offset: 2px;
  cursor: pointer;
}
button.linklike:hover { color: var(--accent-hover); }

/* dropzone */
.drop {
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 24px 16px;
  cursor: pointer;
  transition: border-color 0.1s;
  font-size: 13.5px;
}
.drop.over { border-color: var(--accent); }
.drop p { margin: 0; color: var(--muted); }
.drop p.picked { color: var(--text); margin-top: 6px; font-size: 13px; }

/* upload form row */
.row {
  display: flex;
  gap: 14px;
  margin-top: 14px;
  align-items: end;
  flex-wrap: wrap;
}
.row .f-exp { flex: 0 0 130px; }
.row .f-ot {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
}
.row .f-ot label {
  display: inline;
  margin: 0;
  color: var(--text);
  font-size: 13px;
}
.row .f-go { flex: 0 0 auto; padding-bottom: 0; }

/* progress */
.progress {
  height: 4px;
  background: var(--rule);
  margin: 12px 0 0;
  display: none;
}
.progress.on { display: block; }
.progress > div {
  height: 100%;
  background: var(--accent);
  transition: width 0.1s;
  width: 0;
}

.error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 10px;
}

/* upload result */
.result { margin-top: 18px; }
.result .field { margin-bottom: 12px; }
.result .field:last-child { margin-bottom: 0; }
.result .label-tiny {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.result pre {
  margin: 0;
  padding: 7px 9px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 2px;
  font: 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text);
  word-break: break-all;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* files table */
table.files {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.files th, table.files td {
  text-align: left;
  padding: 8px 8px 8px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}
table.files th {
  font-weight: 500;
  color: var(--muted);
  font-size: 12.5px;
  border-bottom-color: var(--text);
}
table.files td a { color: var(--text); text-decoration: none; }
table.files td a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
table.files td.size, table.files td.status { color: var(--muted); white-space: nowrap; }
table.files td.actions {
  text-align: right;
  white-space: nowrap;
  color: var(--subtle);
}
table.files td.actions a, table.files td.actions button {
  color: var(--muted);
  background: none;
  border: 0;
  padding: 4px 0;
  margin-left: 12px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
table.files td.actions a:hover { color: var(--accent); }
table.files td.actions button.del:hover { color: var(--danger); }

.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0 0;
}

footer {
  color: var(--subtle);
  font-size: 12.5px;
  margin-top: 36px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}

/* preview page */
.preview-wrap {
  max-width: 900px;
  margin: 36px auto 60px;
  padding: 0 20px;
}
.preview-wrap h1 {
  font-family: ui-serif, "Iowan Old Style", "Charter", Georgia, "Times New Roman", serif;
  font-weight: 600;
  font-size: 22px;
  margin: 0 0 4px 0;
  word-break: break-word;
}
.preview-meta {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 18px;
}
.preview-content {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
.preview-content video, .preview-content img {
  max-width: 100%;
  max-height: 78vh;
  display: block;
}
.preview-content iframe {
  width: 100%;
  height: 78vh;
  border: 1px solid var(--rule);
  display: block;
}
.preview-content .nope {
  padding: 32px 0;
  color: var(--muted);
  font-size: 13.5px;
}
.preview-actions {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}
.preview-actions a {
  color: var(--accent);
  margin-right: 14px;
}

/* login */
.login {
  max-width: 320px;
  margin: 90px auto 0;
  padding: 0 20px;
}
.login h1 {
  font-family: ui-serif, "Iowan Old Style", "Charter", Georgia, "Times New Roman", serif;
  font-weight: 600;
  font-size: 22px;
  margin: 0 0 4px 0;
}
.login .sub {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 22px 0;
}
.login form > div { margin-bottom: 12px; }
.login button { width: 100%; }
