:root {
  /* brand colours: the active brand overrides these in a <style> block (Brand::cssVars()) */
  --accent: #0e67a3;
  --accent-dark: #035794;
  --accent-soft: #e3eff8;
  --accent-mute: #8fb3cc;
  --accent-light: #8cc4ec;
  --on-accent-soft: #d6e6f3;
  --portal-bg: #1a1a1a;
  --ink: #333333;
  --ink-soft: #666666;
  --line: #dcdcdc;
  --paper: #ffffff;
  --wash: #f4f4f4;
  --bar: #262626;
  --ok: #2e7d32;
  --font: "Open Sans", Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--wash);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; font-weight: 700; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
p { margin: 0 0 1em; }
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.error { color: var(--accent); font-weight: 600; margin: .4em 0; }
.ok { color: var(--ok); font-weight: 600; }
.hidden { display: none !important; }

/* ---------- top bar & brand header ---------- */
.topbar { background: var(--bar); color: #ddd; font-size: 12px; }
.topbar a { color: #fff; text-decoration: none; }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 6px 20px; display: flex; gap: 22px; flex-wrap: wrap; }
.topbar-right { margin-left: auto; }

.brand { background: var(--paper); border-bottom: 1px solid var(--line); }
.brand-inner { max-width: 1240px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.logo img { height: 42px; width: auto; display: block; }
.brand nav a { color: var(--ink); text-decoration: none; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; margin-left: 26px; }
.brand nav a:hover, .brand nav a.active { color: var(--accent); }

/* ---------- hero (banner photo of the brand, or a flat accent gradient) ---------- */
.hero { position: relative; flex: 1; background-size: cover; background-position: center 35%; }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(20,10,10,.45) 0%, rgba(20,10,10,.15) 55%, rgba(20,10,10,.05) 100%); }
.hero-flat { background-image: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent) 60%, var(--accent-light) 100%); }
.hero-flat .hero-shade { background: none; }
.logo-text { font-weight: 700; font-size: 22px; color: var(--accent); letter-spacing: .2px; }
.logo-text-light { color: #fff; font-size: 30px; text-shadow: 0 2px 6px rgba(0,0,0,.5); }
.hero-inner { position: relative; max-width: 1240px; margin: 0 auto; padding: 48px 20px 64px; min-height: 620px; display: flex; align-items: flex-start; }

/* ---------- the card (form / download list) ---------- */
.card {
  background: var(--paper);
  width: 100%;
  max-width: 480px;
  padding: 28px 28px 24px;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
  border-top: 4px solid var(--accent);
}
.card-wide { max-width: 720px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-bottom: 14px; }
.eyebrow-plain { color: var(--ink-soft); margin: 0 0 4px; font-size: 14px; }

/* ---------- forms ---------- */
.form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.form input[type=text], .form input[type=email], .form input[type=password], .form textarea, .form select {
  display: block; width: 100%; margin-top: 4px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 2px; font: inherit; font-size: 14px; color: var(--ink); background: #fff;
}
.form input:focus, .form textarea:focus, .form select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.form textarea { min-height: 80px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.addr { display: flex; align-items: stretch; margin-top: 4px; }
.addr input { margin-top: 0 !important; border-right: 0 !important; border-radius: 2px 0 0 2px !important; flex: 1; min-width: 0; }
.form .hint { display: block; font-size: 12px; font-weight: 400; color: var(--ink-soft); margin-top: 4px; }
body.header-portal .card .form .hint { color: #aaa; }
.addr select { width: auto !important; margin-top: 0 !important; border-radius: 0 2px 2px 0 !important; background: var(--wash) !important; color: var(--ink-soft); padding: 9px 8px !important; }
.addr span { display: flex; align-items: center; padding: 0 11px; background: var(--wash); border: 1px solid var(--line); border-radius: 0 2px 2px 0; color: var(--ink-soft); font-size: 14px; white-space: nowrap; }

.btn {
  display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 2px;
  padding: 11px 22px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--accent-dark); }
.btn:disabled { background: var(--accent-mute); cursor: default; }
.btn-lg { padding: 14px 26px; font-size: 15px; }
.btn-line { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-line:hover { background: var(--accent-soft); }
.btn-plain { background: transparent; color: var(--ink-soft); padding: 6px 8px; font-weight: 400; }
.btn-plain:hover { background: var(--wash); color: var(--ink); }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }

/* recipients as chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 2px; min-height: 42px; cursor: text; }
.chips:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; }
.chip { background: var(--wash); border: 1px solid var(--line); border-radius: 2px; padding: 3px 6px 3px 9px; font-size: 13px; font-weight: 400; display: inline-flex; align-items: center; gap: 6px; }
.chip.bad { border-color: var(--accent); color: var(--accent); }
.chip button { border: 0; background: none; cursor: pointer; color: var(--ink-soft); font-size: 15px; line-height: 1; padding: 0 2px; }
.chips input { flex: 1; min-width: 160px; border: 0 !important; padding: 4px !important; margin: 0 !important; }
.chips input:focus { outline: none !important; }

/* file drop zone and list */
.drop {
  margin-top: 4px; border: 2px dashed #c9c9c9; border-radius: 2px; padding: 18px 14px; text-align: center; cursor: pointer;
  color: var(--ink-soft); font-weight: 400; font-size: 14px; background: #fafafa;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.drop strong { color: var(--accent); }
.filelist { list-style: none; margin: 8px 0 0; padding: 0; max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 2px; }
.filelist:empty { display: none; }
.filelist li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 6px 10px; border-bottom: 1px solid #eee; font-size: 13px; font-weight: 400; }
.filelist li:last-child { border-bottom: 0; }
.filelist .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filelist .s { color: var(--ink-soft); white-space: nowrap; }
.filelist .x { border: 0; background: none; cursor: pointer; color: var(--ink-soft); font-size: 16px; line-height: 1; }
.filelist .x:hover { color: var(--accent); }
.filelist li .bar { grid-column: 1 / -1; height: 3px; background: #eee; }
.filelist li .bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.filelist li.done .bar i { background: var(--ok); }
.filelist li.fail .bar i { background: #e57373; }
.summary { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-soft); margin-top: 6px; font-weight: 400; }
.summary.over { color: var(--accent); font-weight: 600; }

/* options row */
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.toggle { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.toggle input { width: 16px; height: 16px; }

/* progress panel */
.progress { margin: 14px 0; }
.progress .big { height: 8px; background: #eee; border-radius: 2px; overflow: hidden; }
.progress .big i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s; }
.progress .lbl { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-soft); margin-top: 6px; }

/* code entry */
.code { font-size: 28px; letter-spacing: 10px; text-align: center; font-weight: 700; }

/* link box on success */
.linkbox { display: flex; gap: 8px; margin: 10px 0 14px; }
.linkbox input { flex: 1; padding: 9px 11px; border: 1px solid var(--line); border-radius: 2px; font: inherit; font-size: 13px; background: var(--wash); }

/* message quote on download page */
.message { margin: 0 0 18px; padding: 12px 16px; background: var(--wash); border-left: 3px solid var(--accent); white-space: pre-wrap; }

/* file table on download page */
table.files { width: 100%; border-collapse: collapse; margin-bottom: 16px; font-size: 14px; }
table.files td { padding: 9px 8px; border-bottom: 1px solid #eee; vertical-align: middle; }
table.files .fname { word-break: break-all; }
table.files .fsize { color: var(--ink-soft); white-space: nowrap; text-align: right; }
table.files .fact { white-space: nowrap; text-align: right; }
table.files .fact a { font-weight: 600; text-decoration: none; }
table.files .fact a:hover { text-decoration: underline; }

/* ---------- plain (manager) pages ---------- */
.page { flex: 1; max-width: 1240px; width: 100%; margin: 0 auto; padding: 26px 20px 40px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.stats { display: flex; gap: 22px; font-size: 13px; color: var(--ink-soft); flex-wrap: wrap; }
.stats b { color: var(--ink); font-size: 16px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--accent); padding: 18px 20px; margin-bottom: 18px; }
.panel h2 { margin-bottom: 12px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.filters label { font-size: 12px; font-weight: 600; color: var(--ink-soft); display: block; }
.filters input, .filters select { display: block; padding: 7px 9px; border: 1px solid var(--line); border-radius: 2px; font: inherit; font-size: 13px; margin-top: 3px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; padding: 8px 8px; border-bottom: 2px solid var(--line); white-space: nowrap; color: var(--ink-soft); font-size: 12px; }
.tbl td { padding: 8px 8px; border-bottom: 1px solid #eee; vertical-align: top; }
.tbl tr:hover td { background: #fafafa; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl .nw { white-space: nowrap; }
.tbl .wrap { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl a { text-decoration: none; }
.tbl a:hover { text-decoration: underline; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 2px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.tag-ready { background: #e6f2e7; color: var(--ok); }
.tag-uploading { background: #fff3e0; color: #b26a00; }
.tag-expired { background: #eee; color: #666; }
.tag-deleted { background: var(--accent-soft); color: var(--accent); }
.danger { color: var(--accent); }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: 13px; }
.pager a { padding: 5px 10px; border: 1px solid var(--line); border-radius: 2px; text-decoration: none; color: var(--ink); }
.pager a.cur { background: var(--accent); color: #fff; border-color: var(--accent); }
dl.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; margin: 0 0 14px; font-size: 14px; }
dl.kv dt { color: var(--ink-soft); }
dl.kv dd { margin: 0; word-break: break-word; }
.inline-form { display: inline; }
.login-wrap { max-width: 420px; margin: 40px auto; }

/* ---------- footer ---------- */
.foot { background: var(--ink); color: #cfcfcf; font-size: 13px; }
.foot-inner { max-width: 1240px; margin: 0 auto; padding: 34px 20px 20px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.foot h4 { color: #fff; font-size: 15px; margin-bottom: 10px; }
.foot p { margin: 0; line-height: 1.6; }
.foot a { color: var(--accent-light); text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.foot-legal { border-top: 1px solid #444; text-align: center; padding: 12px 20px; font-size: 12px; color: #999; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .foot-inner { grid-template-columns: 1fr; }
  .hero-inner { padding: 24px 12px 40px; min-height: 0; }
  .card { max-width: none; padding: 20px 16px; }
  .brand nav a { margin-left: 14px; }
  .topbar-inner span:first-child { display: none; }
  .tbl .wrap { max-width: 180px; }
  dl.kv { grid-template-columns: 1fr; gap: 2px 0; }
  dl.kv dt { margin-top: 8px; }
}
@media (max-width: 520px) {
  .row2, .options { grid-template-columns: 1fr; }
  .card-head { flex-direction: column; }
  .logo img { height: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* admin */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.admin-grid .panel { margin-bottom: 0; }
.admin-grid .panel:last-child { grid-column: 1 / -1; }
.admin-form textarea { font-family: Consolas, monospace; font-size: 13px; }
@media (max-width: 860px) { .admin-grid { grid-template-columns: 1fr; } }

.disk-bar { height: 14px; background: #e6e6e6; border-radius: 2px; overflow: hidden; }
.disk-bar i { display: block; height: 100%; background: var(--ok); }
.disk-bar i.warn { background: #f0a020; }
.disk-bar i.crit { background: var(--accent); }
.disk-lbl { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-soft); margin-top: 6px; flex-wrap: wrap; gap: 8px; }

/* admin tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 2px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 9px 16px; text-decoration: none; color: var(--ink-soft); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .3px; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-pane .row2 > div > label:last-child { margin-bottom: 0; }
.img-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.img-box { border: 1px solid var(--line); padding: 12px; }
.img-preview { background: #eee; height: 110px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; overflow: hidden; }
.img-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.img-preview.banner img { object-fit: cover; width: 100%; height: 100%; }
.img-preview.favicon img { height: 48px; }
.img-preview.emaillogo, .img-preview.portallogo { background: var(--accent); }
.img-preview.emaillogo img { width: 70%; }
pre.log { background: #1f1f1f; color: #ddd; padding: 12px; font-size: 12px; line-height: 1.45; overflow: auto; max-height: 320px; margin: 0; white-space: pre-wrap; word-break: break-all; }
@media (max-width: 860px) { .img-grid { grid-template-columns: 1fr; } }

/* accent-coloured header variant (like the e-mails); header_style 'red' for historical reasons */
body.header-red .brand { background: var(--accent); border-bottom: 0; }
body.header-red .brand nav a { color: var(--on-accent-soft); }
body.header-red .brand nav a:hover, body.header-red .brand nav a.active { color: #fff; }
body.header-red .logo img { height: 38px; }
body.header-red .hero-shade { background: linear-gradient(90deg, rgba(20,10,10,.5) 0%, rgba(20,10,10,.2) 55%, rgba(20,10,10,.08) 100%); }
body.header-red .card { border-top-color: var(--ink); }

/* signed-in info in the header (top bar removed) */
.brand nav .who { margin-left: 26px; font-size: 12px; color: var(--ink-soft); font-weight: 400; text-transform: none; letter-spacing: 0; }
.brand nav .who a { margin-left: 0; text-transform: none; letter-spacing: 0; font-size: 12px; }
body.header-red .brand nav .who { color: var(--on-accent-soft); }

/* ---------- portal layout (logo above a dark centred card on the banner) ---------- */
body.header-portal.has-hero { background: var(--portal-bg); }
body.header-portal .hero { min-height: 100vh; display: flex; flex-direction: column; }
body.header-portal .hero-shade { background: rgba(10, 8, 8, .35); }
body.header-portal .hero-inner { flex-direction: column; align-items: center; justify-content: flex-start; padding: 40px 20px 60px; min-height: 0; flex: 1; }
.portal-logo { display: block; margin: 0 0 34px; }
.portal-logo img { height: 74px; width: auto; display: block; filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); }
body.header-portal .card { background: rgba(38, 38, 38, .94); color: #eee; border-top: 0; border-radius: 4px; box-shadow: 0 20px 60px rgba(0,0,0,.55); padding: 30px 34px 28px; }
body.header-portal .card h1 { color: var(--accent); font-size: 22px; }
body.header-portal .card .muted, body.header-portal .card .eyebrow-plain { color: #cfcfcf; }
body.header-portal .card .form label { color: #ddd; }
body.header-portal .card .form input[type=text], body.header-portal .card .form input[type=email], body.header-portal .card .form input[type=password],
body.header-portal .card .form textarea, body.header-portal .card .form select, body.header-portal .card .chips, body.header-portal .card .linkbox input, body.header-portal .card .addr select {
  background: #2f2f2f; border-color: #555; color: #eee; }
body.header-portal .card .addr span { background: #3a3a3a; border-color: #555; color: #ccc; }
body.header-portal .card .addr select { background: #3a3a3a !important; border-color: #555 !important; color: #ddd !important; }
body.header-portal .card .form input::placeholder, body.header-portal .card .form textarea::placeholder { color: #8f8f8f; }
body.header-portal .card .drop { background: #2f2f2f; border-color: #666; color: #ccc; }
body.header-portal .card .drop strong { color: var(--accent-light); }
body.header-portal .card .drop.over { background: #3a3a3a; }
body.header-portal .card .filelist { border-color: #555; }
body.header-portal .card .filelist li { border-color: #444; color: #eee; }
body.header-portal .card .filelist .s, body.header-portal .card .summary, body.header-portal .card .filelist .x { color: #bbb; }
body.header-portal .card .filelist li .bar { background: #444; }
body.header-portal .card .chip { background: #3a3a3a; border-color: #555; color: #eee; }
body.header-portal .card .chip button { color: #bbb; }
body.header-portal .card .btn { text-transform: uppercase; letter-spacing: .4px; }
body.header-portal .card .btn-plain { color: #bbb; }
body.header-portal .card .btn-plain:hover { background: #3a3a3a; color: #fff; }
body.header-portal .card .btn-line { color: var(--accent-light); border-color: var(--accent-light); }
body.header-portal .card .progress .big { background: #444; }
body.header-portal .card .message { background: #2f2f2f; color: #eee; }
body.header-portal .card table.files td { border-color: #444; color: #eee; }
body.header-portal .card table.files .fsize { color: #bbb; }
body.header-portal .card table.files .fact a { color: var(--accent-light); }
body.header-portal .card a { color: var(--accent-light); }
body.header-portal .card .error { color: var(--accent-light); }
body.header-portal .card .ok { color: #7ed37e; }
body.header-portal .card .code { background: #2f2f2f; }
.foot-portal { background: var(--portal-bg); color: #999; font-size: 12px; text-align: right; padding: 10px 20px; }
.foot-portal a { color: #bbb; text-decoration: none; }
@media (max-width: 860px) { .portal-logo img { height: 56px; } body.header-portal .card { padding: 22px 18px; } }
