/* =============================================================================
   Client File Portal — stylesheet
   -----------------------------------------------------------------------------
   Everything visual lives here or in a client's brand settings on /admin.

   The five variables below are set per client on the admin page, so you rarely
   need to edit this file to match a brand. Edit it when you want to change the
   LAYOUT or SHAPE of the portal for everyone.

     --primary   headings
     --accent    buttons, links, focus rings
     --ink       body text
     --surface   page background
     --radius    corner rounding
     --font      typeface stack

   Section map — search for these headings:
     1. Fonts
     2. Base
     3. Layout shells
     4. Header bar
     5. Type
     6. Forms and buttons
     7. Upload dropzone
     8. Tables
     9. Notices and states
    10. Admin-only
    11. Accessibility
   ========================================================================== */

/* 1. FONTS -----------------------------------------------------------------
   To use a client's own typeface, drop the .woff2 files into public/brand/
   and uncomment a block like this. Then set the client's "Font stack" field
   on /admin to: 'ClientSans', system-ui, sans-serif

@font-face {
  font-family: 'ClientSans';
  src: url('/brand/clientsans-regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'ClientSans';
  src: url('/brand/clientsans-bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
--------------------------------------------------------------------------- */

/* 2. BASE ----------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font, system-ui, -apple-system, "Segoe UI", sans-serif);
  color: var(--ink, #111827);
  background: var(--surface, #ffffff);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* 3. LAYOUT SHELLS -------------------------------------------------------- */

.centred {                      /* login screens */
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.card {                         /* the login box */
  width: 100%;
  max-width: 26rem;
  padding: 2.5rem;
  border: 1px solid rgba(0, 0, 0, .1);
  border-radius: var(--radius, 6px);
}

.wrap {                         /* file list and admin pages */
  max-width: 62rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* 4. HEADER BAR ----------------------------------------------------------- */

.bar {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(0, 0, 0, .1);
}
.bar form { margin-left: auto; }
.bar form button { margin: 0; }

.logo    { max-height: 52px; max-width: 220px; margin-bottom: 1.25rem; }
.logo-sm { max-height: 30px; max-width: 160px; }

/* 5. TYPE ----------------------------------------------------------------- */

h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 .5rem; color: var(--primary, #111827); }
h2 { font-size: 1.15rem; margin: 2.5rem 0 .75rem; color: var(--primary, #111827); }
h3 { font-size: .95rem; margin: 1.5rem 0 .25rem; text-transform: uppercase;
     letter-spacing: .06em; color: var(--primary, #111827); }

a { color: var(--accent, #2563eb); }

.muted   { color: rgba(0, 0, 0, .55); }
.small   { font-size: .82rem; }
.welcome { margin: 0 0 1rem; }
code     { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em;
           background: rgba(0, 0, 0, .05); padding: .1em .35em; border-radius: 3px; }

/* 6. FORMS AND BUTTONS ---------------------------------------------------- */

label { display: block; margin: 1.1rem 0 .3rem; font-size: .85rem; font-weight: 600; }

input:not([type="color"]), textarea, select {
  width: 100%;
  padding: .65rem .7rem;
  border: 1px solid rgba(0, 0, 0, .22);
  border-radius: var(--radius, 6px);
  font: inherit;
  color: inherit;
  background: #fff;
}
input[type="color"] {
  width: 3.5rem; height: 2.4rem; padding: 2px; border: 1px solid rgba(0, 0, 0, .22);
  border-radius: var(--radius, 6px); background: #fff;
}
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }

button {
  margin-top: 1.25rem;
  padding: .7rem 1.4rem;
  border: 0;
  border-radius: var(--radius, 6px);
  background: var(--accent, #2563eb);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:hover { filter: brightness(.92); }

button.link {
  background: none; color: inherit; font-weight: 400;
  text-decoration: underline; padding: 0; margin: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0 1.25rem;
  align-items: end;
}
.grid .wide   { grid-column: 1 / -1; }
.grid button  { grid-column: 1 / -1; justify-self: start; }
.boxed { border: 1px solid rgba(0, 0, 0, .1); border-radius: var(--radius, 6px); padding: 1.5rem; }

.inline { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.inline input, .inline button { margin: 0; }
.inline input { max-width: 20rem; }

/* 7. UPLOAD DROPZONE ------------------------------------------------------ */

.dropzone {
  border: 2px dashed rgba(0, 0, 0, .22);
  border-radius: var(--radius, 6px);
  padding: 2.5rem 1.5rem;
  text-align: center;
  transition: background .15s ease, border-color .15s ease;
}
.dropzone.over { border-color: var(--accent, #2563eb); background: rgba(0, 0, 0, .03); }
.dropzone input[type="file"] { display: none; }
.dz-label {
  display: inline-block; margin: 0; cursor: pointer;
  color: var(--accent, #2563eb); text-decoration: underline; font-weight: 600;
}
.dropzone .filename { margin: .5rem 0 0; }
.dropzone p:last-child { margin-bottom: 0; }

/* 8. TABLES --------------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; margin-top: 1.75rem; }
th, td {
  text-align: left; padding: .7rem .5rem;
  border-bottom: 1px solid rgba(0, 0, 0, .1); font-size: .9rem;
}
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: rgba(0,0,0,.55); }

/* 9. NOTICES AND STATES --------------------------------------------------- */

.error  { color: #b91c1c; font-weight: 600; }
.empty  { margin-top: 2rem; color: rgba(0, 0, 0, .55); }
.notice {
  padding: 1.25rem; margin-bottom: 2rem;
  border: 1px solid var(--accent, #2563eb); border-radius: var(--radius, 6px);
}
.notice p { margin: .5rem 0 0; }

.preview-flag {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  padding: .5rem 1rem; font-size: .8rem; text-align: center;
  background: #111827; color: #fff;
}
.preview-flag a { color: #fff; }

/* 10. ADMIN-ONLY ---------------------------------------------------------- */

.client {
  border: 1px solid rgba(0, 0, 0, .1);
  border-radius: var(--radius, 6px);
  margin-bottom: .75rem;
}
.client > summary {
  display: flex; gap: .75rem; align-items: center;
  padding: .9rem 1.1rem; cursor: pointer; list-style: none;
}
.client > summary::-webkit-details-marker { display: none; }
.client[open] > summary { border-bottom: 1px solid rgba(0, 0, 0, .1); }
.client-body { padding: 0 1.5rem 1.75rem; }
.swatch { width: 14px; height: 14px; border-radius: 3px; flex: 0 0 auto; }

/* 11. ACCESSIBILITY ------------------------------------------------------- */

:focus-visible { outline: 3px solid var(--accent, #2563eb); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media (max-width: 40rem) {
  .card { padding: 1.75rem; }
  .bar  { flex-wrap: wrap; }
  table { font-size: .85rem; }
}

/* =============================================================================
   12. PORTAL THEME  (shared by the admin and the client areas)
   -----------------------------------------------------------------------------
   Everything below is scoped to `body.ui`, so it only affects YOUR admin
   pages — never a client's area. Client areas are still driven entirely by
   their own brand settings.

   To rebrand the admin for a different client, change the four values in the
   :root block and swap the logo URL in views/admin.ejs and admin-login.ejs.
   ========================================================================== */

:root {
  --a-green: #005614;
  --a-lime:  #4F8C00;
  --a-ink:   #14201A;
  --a-bg:    #F4F6F3;
  --a-line:  rgba(0, 42, 10, .10);
}

body.ui {
  background: var(--a-bg);
  color: var(--a-ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* --- Header ------------------------------------------------------------ */

.adminbar {
  position: sticky;
  flex-wrap: wrap;
  max-width: 100%;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .9rem 2rem;
  background: #fff;
  border-bottom: 1px solid var(--a-line);
  box-shadow: 0 1px 3px rgba(0, 42, 10, .05);
}
.adminbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 3px;
  background: linear-gradient(90deg, var(--a-green), var(--a-lime));
}
.adminbar-brand {
  display: flex;
  align-items: center;
  gap: .85rem;
  text-decoration: none;
  color: inherit;
}
.adminbar-brand img {
  height: 32px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  flex: 0 0 auto;
}
.adminbar-brand span {
  padding-left: .85rem;
  border-left: 1px solid var(--a-line);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: rgba(20, 32, 26, .5);
}
.adminbar form { margin-left: 0; }
.adminbar-brand { min-width: 0; }
.adminbar-brand span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adminbar button.link { color: rgba(20, 32, 26, .6); margin: 0; font-size: .875rem; }
.adminbar button.link:hover { color: var(--a-green); }

/* --- Layout ------------------------------------------------------------ */

body.ui .wrap { max-width: 64rem; padding: 2.75rem 2rem 5rem; }
body.ui h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; color: var(--a-ink); }
body.ui h2 { font-size: 1.15rem; margin: 3rem 0 1rem; color: var(--a-ink); letter-spacing: -.01em; }
body.ui h3 {
  font-size: .72rem; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(20, 32, 26, .45); margin: 2rem 0 .25rem;
}
body.ui .empty { color: rgba(20, 32, 26, .5); }

/* --- Client rows -------------------------------------------------------- */

body.ui .client {
  background: #fff;
  border: 1px solid var(--a-line);
  border-radius: 10px;
  margin-bottom: .85rem;
  box-shadow: 0 1px 2px rgba(0, 42, 10, .04);
  transition: box-shadow .15s ease, transform .15s ease;
}
body.ui .client:hover { box-shadow: 0 4px 14px rgba(0, 42, 10, .07); }
body.ui .client > summary { padding: 1.1rem 1.35rem; gap: .9rem; }
body.ui .client > summary::before {
  content: "›";
  font-size: 1.2rem;
  color: rgba(20, 32, 26, .35);
  transition: transform .15s ease;
}
body.ui .client[open] > summary::before { transform: rotate(90deg); }
body.ui .client[open] > summary { border-bottom: 1px solid var(--a-line); }
body.ui .client-body { padding: .5rem 1.35rem 1.75rem; }
body.ui .swatch { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(0,0,0,.05); }
body.ui .client code {
  background: rgba(0, 86, 20, .06);
  color: var(--a-green);
  font-weight: 600;
}

/* --- Forms -------------------------------------------------------------- */

body.ui .boxed {
  background: #fff;
  border: 1px solid var(--a-line);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 1px 2px rgba(0, 42, 10, .04);
}
body.ui .grid { gap: .35rem 1.5rem; align-items: start; }
body.ui label {
  margin: 1.15rem 0 .35rem;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: rgba(20, 32, 26, .65);
}
body.ui input:not([type="color"]), body.ui textarea {
  border: 1px solid rgba(0, 42, 10, .16);
  border-radius: 8px;
  padding: .7rem .8rem;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
body.ui input:not([type="color"]):focus, body.ui textarea:focus {
  outline: none;
  border-color: var(--a-green);
  box-shadow: 0 0 0 3px rgba(0, 86, 20, .12);
}
/* Colour pickers: put the swatch under its label like every other field */
body.ui input[type="color"] {
  display: block;
  width: 100%;
  height: 2.7rem;
  border: 1px solid rgba(0, 42, 10, .16);
  border-radius: 8px;
  padding: 3px;
  cursor: pointer;
}
body.ui button {
  background: var(--a-green);
  border-radius: 8px;
  padding: .78rem 1.6rem;
  font-size: .875rem;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 42, 10, .15);
  transition: background .15s ease, transform .05s ease;
}
body.ui button:hover { background: #00450F; filter: none; }
body.ui button:active { transform: translateY(1px); }
body.ui .inline button { background: rgba(0, 86, 20, .08); color: var(--a-green); box-shadow: none; }
body.ui .inline button:hover { background: rgba(0, 86, 20, .14); }

/* --- Notice ------------------------------------------------------------- */

body.ui .notice {
  background: #fff;
  border: 1px solid var(--a-lime);
  border-left: 4px solid var(--a-lime);
  border-radius: 10px;
  padding: 1.35rem 1.5rem;
}
body.ui .notice code {
  display: inline-block;
  background: rgba(0, 86, 20, .07);
  color: var(--a-green);
  padding: .2em .5em;
  border-radius: 4px;
  font-weight: 600;
}

/* --- Admin login card ---------------------------------------------------- */

body.ui.centred .card {
  background: #fff;
  border: 1px solid var(--a-line);
  border-radius: 14px;
  border-top: 4px solid var(--a-green);
  box-shadow: 0 8px 32px rgba(0, 42, 10, .09);
  padding: 2.75rem;
}
body.ui.centred .logo { max-height: 46px; margin-bottom: 1.75rem; }

body.ui :focus-visible { outline: 3px solid var(--a-lime); outline-offset: 2px; }

@media (max-width: 40rem) {
  .adminbar { padding: .8rem 1.1rem; }
  .adminbar-brand span { display: none; }
  body.ui .wrap { padding: 1.75rem 1.1rem 4rem; }
  body.ui .boxed { padding: 1.35rem; }
}

/* =============================================================================
   13. SIGN OUT BUTTON  (both admin and client headers)
   ========================================================================== */

.signout {
  margin: 0;
  padding: .5rem 1.1rem;
  border: 0;
  border-radius: 6px;
  background: var(--a-green, #005614);
  color: #fff;
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
}
.signout:hover { background: #00450F; color: #fff; }

/* =============================================================================
   14. ADMIN: LOGO FIELD, ADDRESS PREVIEW, ROW AVATARS
   ========================================================================== */

body.ui .row-logo {
  max-height: 26px; max-width: 90px;
  object-fit: contain; flex: 0 0 auto;
}
body.ui .row-initial {
  display: grid; place-items: center;
  width: 26px; height: 26px; flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(0, 86, 20, .1);
  color: var(--a-green);
  font-size: .8rem; font-weight: 700;
}
body.ui .rowlinks { display: flex; gap: 1.25rem; margin: .35rem 0 0; font-size: .875rem; }

body.ui .logo-field input[type="file"] {
  width: 100%;
  padding: .6rem;
  border: 1px dashed rgba(0, 42, 10, .25);
  border-radius: 8px;
  background: rgba(0, 86, 20, .02);
  font-size: .85rem;
  cursor: pointer;
}
body.ui .logo-field input[type="file"]::file-selector-button {
  margin-right: .8rem;
  padding: .4rem .9rem;
  border: 0; border-radius: 6px;
  background: var(--a-green); color: #fff;
  font: inherit; font-size: .8rem; font-weight: 600;
  cursor: pointer;
}
body.ui .logo-current {
  display: flex; align-items: center; gap: 1.25rem;
  margin-top: 1.15rem; padding: .9rem 1.1rem;
  border: 1px solid var(--a-line); border-radius: 8px;
  background: #fff;
}
body.ui .logo-current img { max-height: 40px; max-width: 150px; object-fit: contain; }
body.ui .checkbox {
  display: flex; align-items: center; gap: .45rem;
  margin: 0; font-size: .8rem; font-weight: 500;
  color: rgba(20, 32, 26, .6);
}
body.ui .checkbox input { width: auto; margin: 0; }

body.ui .addr-preview {
  margin: .35rem 0 .3rem;
  padding: .7rem .8rem;
  border: 1px solid var(--a-line); border-radius: 8px;
  background: rgba(0, 86, 20, .04);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9rem;
}
body.ui .addr-host { color: rgba(20, 32, 26, .45); }
body.ui #slugout { color: var(--a-green); font-weight: 600; }

/* =============================================================================
   15. UPLOAD ANIMATION
   ========================================================================== */

.dropzone { position: relative; }
.dz-icon {
  width: 34px; height: 34px;
  margin-bottom: .75rem;
  color: var(--accent, #005614);
  opacity: .55;
  transition: transform .2s ease, opacity .2s ease;
}
.dropzone.over .dz-icon { transform: translateY(-4px); opacity: 1; }
.dz-or { display: block; margin-top: .3rem; font-size: .85rem; color: rgba(0,0,0,.5); }

/* [hidden] must win over any display rule below, or every upload state
   renders at once. Keep this first. */
[hidden] { display: none !important; }

.dz-busy, .dz-done {
  display: flex; flex-direction: column; align-items: center;
  gap: .9rem; padding: 1rem 0;
  animation: dz-in .25s ease both;
}
@keyframes dz-in { from { opacity: 0; transform: translateY(6px); } }

.dz-ring { position: relative; width: 74px; height: 74px; }
.dz-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: rgba(0, 0, 0, .09); stroke-width: 3.5; }
.ring-fill {
  fill: none;
  stroke: var(--accent, #005614);
  stroke-width: 3.5;
  stroke-linecap: round;
  transition: stroke-dashoffset .25s ease;
}
.dz-pct {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: .9rem; font-weight: 700;
  color: var(--accent, #005614);
  font-variant-numeric: tabular-nums;
}
.dz-status { margin: 0; font-size: .9rem; color: rgba(0, 0, 0, .6); }

.tick { width: 74px; height: 74px; }
.tick-ring {
  fill: none; stroke: var(--accent, #005614); stroke-width: 3.5;
  stroke-dasharray: 120; stroke-dashoffset: 120;
  animation: draw .45s ease forwards;
}
.tick-mark {
  fill: none; stroke: var(--accent, #005614);
  stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 34; stroke-dashoffset: 34;
  animation: draw .3s ease .35s forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.dropzone.uploading { border-style: solid; border-color: var(--accent, #005614); }

@media (prefers-reduced-motion: reduce) {
  .dz-busy, .dz-done, .tick-ring, .tick-mark { animation: none; }
  .tick-ring, .tick-mark { stroke-dashoffset: 0; }
  .ring-fill { transition: none; }
}

/* =============================================================================
   16. ADMIN: "OPEN CLIENT AREA" ACTIONS
   ========================================================================== */

/* Button on the collapsed row — sits far right, always visible */
body.ui .row-open {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .85rem;
  border: 1px solid rgba(0, 86, 20, .25);
  border-radius: 6px;
  background: rgba(0, 86, 20, .06);
  color: var(--a-green);
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
body.ui .row-open:hover {
  background: var(--a-green);
  border-color: var(--a-green);
  color: #fff;
  transform: translateY(-1px);
}
body.ui .row-open svg { width: 13px; height: 13px; }

/* Actions inside the expanded panel */
body.ui .rowlinks {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin: 1rem 0 .25rem;
}

body.ui .btn-primary {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1.3rem;
  border-radius: 8px;
  background: var(--a-green);
  color: #fff;
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 42, 10, .18);
  transition: background .15s ease, transform .05s ease;
}
body.ui .btn-primary:hover { background: #00450F; }
body.ui .btn-primary:active { transform: translateY(1px); }
body.ui .btn-primary svg { width: 15px; height: 15px; }

body.ui .btn-ghost {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: .7rem 1.1rem;
  border: 1px solid var(--a-line);
  border-radius: 8px;
  background: #fff;
  color: rgba(20, 32, 26, .7);
  font: inherit;
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: none;
  transition: border-color .15s ease, color .15s ease;
}
body.ui .btn-ghost:hover {
  background: #fff;
  border-color: var(--a-green);
  color: var(--a-green);
}
body.ui .btn-ghost.copied {
  border-color: var(--a-lime);
  color: var(--a-lime);
}

@media (max-width: 40rem) {
  body.ui .row-open { padding: .4rem .6rem; }
  body.ui .row-open svg { display: none; }
  body.ui .rowlinks > * { flex: 1 1 auto; justify-content: center; }
}

/* =============================================================================
   17. UPLOAD QUEUE
   ========================================================================== */

.dz-queue {
  list-style: none;
  margin: 1.25rem auto 0;
  padding: 0;
  max-width: 30rem;
  text-align: left;
  max-height: 15rem;
  overflow-y: auto;
  border: 1px solid rgba(0, 0, 0, .09);
  border-radius: var(--radius, 8px);
  background: #fff;
}
.dz-queue li {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem .75rem;
  border-bottom: 1px solid rgba(0, 0, 0, .06);
  font-size: .85rem;
  animation: q-in .18s ease both;
}
.dz-queue li:last-child { border-bottom: 0; }
@keyframes q-in { from { opacity: 0; transform: translateX(-6px); } }

.q-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.q-size {
  flex: 0 0 auto;
  color: rgba(0, 0, 0, .45);
  font-variant-numeric: tabular-nums;
  font-size: .8rem;
}
.q-remove {
  flex: 0 0 auto;
  margin: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .06);
  color: rgba(0, 0, 0, .55);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.q-remove:hover { background: #B91C1C; color: #fff; filter: none; }

.dz-total { margin: .8rem 0 0; }

.dz-actions {
  display: flex;
  justify-content: center;
  gap: .6rem;
  flex-wrap: wrap;
}
.dz-clear {
  background: transparent;
  color: rgba(0, 0, 0, .55);
  border: 1px solid rgba(0, 0, 0, .15);
  font-weight: 500;
}
.dz-clear:hover { background: transparent; border-color: rgba(0, 0, 0, .35); filter: none; }

button:disabled { opacity: .45; cursor: not-allowed; }
button:disabled:hover { filter: none; }

@media (prefers-reduced-motion: reduce) { .dz-queue li { animation: none; } }

/* =============================================================================
   18. ADMIN: DELETE A CLIENT AREA
   ========================================================================== */

body.ui .danger {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--a-line);
}
body.ui .danger > summary {
  display: inline-block;
  padding: .35rem 0;
  color: rgba(20, 32, 26, .45);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  list-style: none;
}
body.ui .danger > summary::-webkit-details-marker { display: none; }
body.ui .danger > summary::before { content: "⚠  "; }
body.ui .danger > summary:hover { color: #B91C1C; }
body.ui .danger[open] > summary { color: #B91C1C; margin-bottom: .5rem; }

body.ui .danger p {
  max-width: 40rem;
  margin: 0 0 1rem;
  color: rgba(20, 32, 26, .7);
}
body.ui .danger input {
  max-width: 22rem;
  border-color: rgba(185, 28, 28, .3);
}
body.ui .danger input:focus {
  border-color: #B91C1C;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, .12);
}
body.ui .btn-danger {
  background: #B91C1C;
  color: #fff;
  box-shadow: none;
}
body.ui .btn-danger:hover { background: #991B1B; }

/* =============================================================================
   19. CLIENT AREA  (uses the shared body.ui theme above)
   ========================================================================== */

body.ui .who {
  margin-left: auto;
  font-size: .82rem;
  color: rgba(20, 32, 26, .5);
}
body.ui .who + form { margin-left: 1rem; }

body.ui .filebar {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 2.75rem 0 .5rem;
}
body.ui .filebar h2 { margin: 0; display: flex; align-items: center; gap: .6rem; }
body.ui .count {
  padding: .12rem .55rem;
  border-radius: 20px;
  background: rgba(0, 86, 20, .09);
  color: var(--a-green);
  font-size: .78rem;
  font-weight: 700;
}
body.ui .sortby {
  margin: 0 0 0 auto;
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: .8rem;
  font-weight: 600;
  color: rgba(20, 32, 26, .55);
}
body.ui .sortby select {
  width: auto;
  padding: .5rem 2rem .5rem .7rem;
  border: 1px solid var(--a-line);
  border-radius: 8px;
  background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2314201A' stroke-opacity='.5' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right .7rem center;
  background-size: 10px;
  font: inherit;
  font-size: .85rem;
  font-weight: 500;
  color: var(--a-ink);
  appearance: none;
  cursor: pointer;
}
body.ui .sortby select:focus {
  outline: none;
  border-color: var(--a-green);
  box-shadow: 0 0 0 3px rgba(0, 86, 20, .12);
}

body.ui .filetable {
  margin-top: .75rem;
  background: #fff;
  border: 1px solid var(--a-line);
  border-radius: 12px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 42, 10, .04);
}
body.ui .filetable th {
  background: rgba(0, 86, 20, .035);
  color: rgba(20, 32, 26, .5);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--a-line);
}
body.ui .filetable td {
  padding: .9rem 1rem;
  border-bottom: 1px solid rgba(0, 42, 10, .06);
  font-size: .9rem;
}
body.ui .filetable tbody tr:last-child td { border-bottom: 0; }
body.ui .filetable tbody tr { transition: background .12s ease; }
body.ui .filetable tbody tr:hover { background: rgba(0, 86, 20, .025); }
body.ui .filetable .fname { font-weight: 600; word-break: break-word; }
body.ui .filetable .num { text-align: right; font-variant-numeric: tabular-nums; }
body.ui .filetable .muted { color: rgba(20, 32, 26, .45); }

body.ui .dl {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .8rem;
  border: 1px solid rgba(0, 86, 20, .22);
  border-radius: 6px;
  color: var(--a-green);
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
body.ui .dl:hover { background: var(--a-green); color: #fff; }
body.ui .dl svg { width: 13px; height: 13px; }

body.ui .dropzone {
  background: #fff;
  border-color: rgba(0, 42, 10, .18);
  border-radius: 12px;
  padding: 2.75rem 1.5rem;
}
body.ui .dropzone.over { background: rgba(0, 86, 20, .03); }

body.ui.centred .card .client-logo {
  max-height: 34px;
  margin: -.4rem 0 1.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--a-line);
}

.sr {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

@media (max-width: 46rem) {
  body.ui .filetable th:nth-child(4), body.ui .filetable td:nth-child(4) { display: none; }
  body.ui .sortby { margin-left: 0; }
}

/* =============================================================================
   20. HEADER UTILITIES  (website link, weather, clock)
   ========================================================================== */

.utils {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.util {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .7rem;
  border-radius: 7px;
  font-size: .8rem;
  font-weight: 600;
  color: rgba(20, 32, 26, .58);
  text-decoration: none;
  white-space: nowrap;
}
.util svg { width: 15px; height: 15px; flex: 0 0 auto; }

.util-site { transition: background .15s ease, color .15s ease; }
.util-site:hover { background: rgba(0, 86, 20, .08); color: var(--a-green); }

.util-weather { color: var(--a-lime); }
.util-clock {
  color: rgba(20, 32, 26, .5);
  font-variant-numeric: tabular-nums;
}
.util-clock #clock { min-width: 9.5rem; }

body.ui .who {
  margin-left: .5rem;
  padding-left: .9rem;
  border-left: 1px solid var(--a-line);
  font-size: .8rem;
  color: rgba(20, 32, 26, .5);
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.ui .who + form { margin-left: .6rem; }

@media (max-width: 60rem) {
  .util-site span { display: none; }
  .util-clock #clock { min-width: 0; }
  body.ui .who { display: none; }
}
@media (max-width: 44rem) {
  .util-clock { display: none; }
  .adminbar { gap: .5rem; padding: .7rem 1rem; }
}

/* =============================================================================
   21. DROPZONE — tighter resting state
   ========================================================================== */

body.ui .dropzone { padding: 2.25rem 1.5rem; }
body.ui .dropzone .dz-idle > p:last-child { margin-bottom: 0; }
body.ui .dz-actions:empty { display: none; }
body.ui .dz-idle .dz-actions { margin-top: .25rem; }

/* The "Choose files" link is the primary action while the box is empty */
body.ui .dz-label {
  display: inline-block;
  margin-top: .25rem;
  padding: .7rem 1.5rem;
  border-radius: 8px;
  background: var(--a-green);
  color: #fff;
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 42, 10, .18);
  transition: background .15s ease;
}
body.ui .dz-label:hover { background: #00450F; }
body.ui .dz-or { margin-top: .7rem; color: rgba(20, 32, 26, .45); }

/* =============================================================================
   22. GREETING ON THE LOGIN SCREENS
   ========================================================================== */

body.ui .greeting {
  margin: 0 0 .35rem;
  font-size: 1.9rem;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--a-green);
}
body.ui .greeting + h1 {
  font-size: 1.05rem;
  font-weight: 600;
  color: rgba(20, 32, 26, .55);
  letter-spacing: 0;
  margin-bottom: .75rem;
}
body.ui .greeting + h1::after { display: none; }

/* =============================================================================
   23. RETENTION WARNING BANNER
   ========================================================================== */

body.ui .warn {
  display: flex;
  gap: 1rem;
  margin: 0 0 2rem;
  padding: 1.25rem 1.4rem;
  border: 1px solid rgba(180, 83, 9, .3);
  border-left: 4px solid #B45309;
  border-radius: 10px;
  background: #FFFBF5;
}
body.ui .warn > svg { width: 22px; height: 22px; flex: 0 0 auto; color: #B45309; margin-top: .1rem; }
body.ui .warn strong { color: #92400E; }
body.ui .warn ul { margin: .6rem 0 .5rem; padding-left: 1.1rem; }
body.ui .warn li { margin-bottom: .3rem; font-size: .9rem; }
body.ui .warn a { color: #92400E; font-weight: 600; }
body.ui .warn p { margin: 0; color: rgba(20, 32, 26, .6); }

/* =============================================================================
   24. A–Z INDEX
   ========================================================================== */

body.ui .listwrap { display: flex; gap: 1.25rem; align-items: flex-start; }
body.ui .listmain { flex: 1 1 auto; min-width: 0; }
body.ui .nomatch { padding: 2rem 0; color: rgba(20, 32, 26, .5); }

body.ui .azindex {
  position: sticky;
  top: 5.5rem;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: .4rem .3rem;
  border: 1px solid var(--a-line);
  border-radius: 10px;
  background: #fff;
}
body.ui .azindex button {
  margin: 0;
  width: 1.65rem;
  height: 1.3rem;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: rgba(20, 32, 26, .6);
  font: inherit;
  font-size: .68rem;
  font-weight: 700;
  box-shadow: none;
  cursor: pointer;
}
body.ui .azindex button:hover:not(:disabled) { background: rgba(0, 86, 20, .09); color: var(--a-green); }
body.ui .azindex button:disabled { color: rgba(20, 32, 26, .18); cursor: default; opacity: 1; }
body.ui .azindex button.is-on { background: var(--a-green); color: #fff; }
body.ui .azindex .az-all { width: auto; padding: 0 .3rem; font-size: .6rem; letter-spacing: .04em; }

@media (max-width: 46rem) {
  body.ui .listwrap { flex-direction: column-reverse; }
  body.ui .azindex {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    justify-content: center;
  }
}
/* =============================================================================
   18. Dropzone idle state — stacked, centred
   ========================================================================== */

body.ui .dropzone {
  padding: 2.5rem 1.5rem;
  border-radius: 12px;
  border: 1.5px dashed #D4D8D4;
  background: #FFFFFF;
  transition: border-color .18s ease, background .18s ease;
}

body.ui .dropzone.dragover {
  border-color: var(--lime, #4F8C00);
  background: #FAFCF8;
}

body.ui .dz-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

body.ui .dz-icon {
  width: 34px;
  height: 34px;
  color: #A8B2A8;
  stroke-width: 1.5;
}

body.ui .dz-label {
  display: inline-flex;
  align-items: center;
  padding: .7rem 1.6rem;
  border-radius: 8px;
  background: var(--primary, #005614);
  color: #FFFFFF;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: background .18s ease;
}

body.ui .dz-label:hover { background: #00420F; }

body.ui .dz-or {
  font-size: .9rem;
  color: #6E766E;
}

body.ui .dz-idle > .muted.small {
  margin: .25rem 0 0;
  max-width: 46ch;
  text-align: center;
  line-height: 1.5;
}
/* =============================================================================
   19. Folders, breadcrumb, admin folder tools and the move bar
   ========================================================================== */

/* ---- breadcrumb ---------------------------------------------------------- */

body.ui .crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  margin: 0 0 .4rem;
  font-size: .9rem;
}

body.ui .crumbs a {
  color: #6E766E;
  text-decoration: none;
}

body.ui .crumbs a:hover { color: var(--primary, #005614); text-decoration: underline; }
body.ui .crumb-sep { color: #C3C9C3; }
body.ui .crumbs [aria-current] { color: var(--ink, #14201A); font-weight: 600; }

/* ---- admin flag ---------------------------------------------------------- */

body.ui .adminflag {
  margin: 0 0 1rem;
  padding: .5rem .8rem;
  border-radius: 6px;
  border: 1px solid #E2E6E2;
  background: #F6F8F6;
  color: #4A544A;
  font-size: .85rem;
}

/* ---- label tag ----------------------------------------------------------- */

body.ui .tag {
  display: inline-block;
  margin-left: .5rem;
  padding: .12rem .5rem;
  border-radius: 999px;
  background: #EDF2ED;
  color: #4A544A;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* ---- folder rows --------------------------------------------------------- */

body.ui .folders {
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
  display: grid;
  gap: .5rem;
}

body.ui .folder {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .85rem 1rem;
  border: 1px solid #E2E6E2;
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--ink, #14201A);
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease;
}

body.ui .folder:hover {
  border-color: var(--lime, #4F8C00);
  background: #FAFCF8;
}

body.ui .folder svg {
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--primary, #005614);
}

body.ui .folder-name { font-weight: 600; }
body.ui .folder-count { margin-left: auto; }

/* ---- admin folder tools -------------------------------------------------- */

body.ui .foldertools {
  margin: 0 0 2rem;
  border: 1px solid #E2E6E2;
  border-radius: 8px;
  background: #FBFCFB;
}

body.ui .foldertools > summary {
  padding: .8rem 1rem;
  cursor: pointer;
  font-weight: 600;
  font-size: .9rem;
  color: #4A544A;
}

body.ui .foldertools[open] > summary { border-bottom: 1px solid #E2E6E2; }

body.ui .folderform { padding: 1rem; border-bottom: 1px solid #EDEFED; }
body.ui .folderform:last-child { border-bottom: 0; }
body.ui .folderform h3 { margin: 0 0 .7rem; font-size: .95rem; }
body.ui .folderform p { margin: .6rem 0 0; }

body.ui .folderform-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: .7rem;
}

body.ui .folderform label {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  font-size: .8rem;
  font-weight: 600;
  color: #4A544A;
}

body.ui .folderform input[type="text"] {
  min-width: 12rem;
  padding: .55rem .7rem;
  border: 1px solid #D4D8D4;
  border-radius: 6px;
  font: inherit;
  font-weight: 400;
}

body.ui .folderform input[type="text"]:focus {
  outline: 2px solid var(--lime, #4F8C00);
  outline-offset: 1px;
  border-color: transparent;
}

body.ui .folderform button.danger {
  background: #FFFFFF;
  color: #8A2020;
  border: 1px solid #E3C4C4;
}

body.ui .folderform button.danger:hover { background: #FDF4F4; }

/* ---- move bar ------------------------------------------------------------ */

body.ui .movebar {
  position: sticky;
  bottom: 1rem;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .9rem;
  margin-top: 1rem;
  padding: .8rem 1rem;
  border: 1px solid #D9DED9;
  border-radius: 8px;
  background: #FFFFFF;
  box-shadow: 0 6px 20px rgba(20, 32, 26, .1);
}

body.ui .movebar-count { font-weight: 600; font-size: .9rem; }

body.ui .movebar label {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-left: auto;
  font-size: .85rem;
  color: #4A544A;
}

body.ui .movebar select {
  padding: .45rem .6rem;
  border: 1px solid #D4D8D4;
  border-radius: 6px;
  font: inherit;
  background: #FFFFFF;
}

body.ui .filetable th.pick,
body.ui .filetable td.pick { width: 2.4rem; text-align: center; }

body.ui .filetable input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary, #005614);
  cursor: pointer;
}

@media (max-width: 46rem) {
  body.ui .movebar label { margin-left: 0; width: 100%; }
  body.ui .folderform input[type="text"] { min-width: 0; width: 100%; }
  body.ui .folderform label { width: 100%; }
}

/* ---- delete controls (admin) --------------------------------------------- */

body.ui .movebar button.danger {
  background: #FFFFFF;
  color: #8A2020;
  border: 1px solid #E3C4C4;
}

body.ui .movebar button.danger:hover { background: #FDF4F4; }

body.ui .folderform .purge {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: .55rem;
  margin: 0 0 .9rem;
  padding: .6rem .8rem;
  border: 1px solid #E3C4C4;
  border-radius: 6px;
  background: #FDF7F7;
  font-size: .85rem;
  font-weight: 500;
  color: #6B2020;
}

body.ui .folderform .purge input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: none;
  accent-color: #8A2020;
  cursor: pointer;
}