/* Served as a file rather than an inline <style> so the CSP can stay at
   style-src 'self' with no unsafe-inline (§16). */

/* --------------------------------------------------------------------------
   Tokens. Both themes are defined: `color-scheme` alone only changes the
   browser's own widgets, and the previous palette was a single set of light
   values, so dark mode was half-done.
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light dark;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-sunken: #f2f3f6;
  --text: #14161b;
  --muted: #5c6472;
  --border: #e3e6eb;
  --border-strong: #c9ced8;

  --accent: #3a3ac4;
  --accent-on: #ffffff;
  --accent-soft: #ececfb;
  --danger: #a52018;
  --danger-soft: #fdecea;
  --good: #0e6b3d;
  --good-soft: #e6f4ec;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 18, 29, .05), 0 2px 6px rgba(16, 18, 29, .04);

  /* Two widths on purpose: lists want room, forms want a readable measure.
     A full-width text input on a 1024px page reads badly. */
  --shell: 62rem;
  --measure: 33rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1014;
    --surface: #161a21;
    --surface-sunken: #1b202a;
    --text: #e6e9ef;
    --muted: #99a1b0;
    --border: #262c37;
    --border-strong: #3a4250;

    --accent: #9a9bf5;
    --accent-on: #10121a;
    --accent-soft: #1e2131;
    --danger: #f08a82;
    --danger-soft: #2a1917;
    --good: #6ed49d;
    --good-soft: #15251c;

    --shadow: 0 1px 2px rgba(0, 0, 0, .45);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main { max-width: var(--shell); margin: 0 auto; padding: 2rem 1.25rem 3rem; }

.version {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 1.25rem 1.25rem;
  color: var(--muted);
  font-size: .75rem;
  text-align: right;
}

/* Persistent chrome: which identity you are operating as, and the way out.
   Sticky so signing out never requires scrolling back up. */
.chrome {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.chrome-inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: .65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand { font-weight: 650; letter-spacing: -.01em; }
.identity { color: var(--muted); font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 34rem) { .identity { display: none; } }

h1 { font-size: 1.75rem; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .35rem; }
h2 { font-size: 1.15rem; letter-spacing: -.01em; margin: 2.25rem 0 .6rem; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 1.5rem 0 .35rem; }
p { margin: .5rem 0; }
a { color: var(--accent); }

section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.35rem;
  margin: 1rem 0;
}
/* Forms stay at a readable measure even though the page is wide. */
section.form { max-width: var(--measure); }

label { display: block; margin: .9rem 0 .3rem; font-weight: 600; font-size: .875rem; }
label:first-child { margin-top: 0; }

input[type=text], input[type=email], input[type=password] {
  width: 100%;
  padding: .55rem .65rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--surface);
  color: inherit;
}
input::placeholder { color: var(--muted); }

/* A checkbox and its text are one control; wrapping them in a label is what
   makes the text clickable and gives assistive tech the association. */
label.choice {
  display: flex;
  gap: .55rem;
  align-items: flex-start;
  font-weight: 400;
  font-size: .9rem;
  color: var(--muted);
  cursor: pointer;
}
label.choice input { margin-top: .2rem; flex: none; accent-color: var(--accent); }

button {
  padding: .5rem .85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .12s, border-color .12s, color .12s;
}
button:hover:not(:disabled) { background: var(--surface-sunken); border-color: var(--border-strong); }
button:disabled { opacity: 1; color: var(--muted); background: var(--surface-sunken); border-color: var(--border); cursor: default; }

/* Primary, secondary and destructive were previously indistinguishable, which
   put "Delete" and "Decrypt and save" side by side looking identical. */
button.primary { background: var(--accent); border-color: transparent; color: var(--accent-on); }
button.primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
button.primary:disabled { background: var(--surface-sunken); color: var(--muted); }
a.primary.download {
  padding: .5rem .85rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-on);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
a.primary.download:hover { filter: brightness(1.08); }
button.danger { color: var(--danger); }
button.danger:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger); }
/* Low emphasis, but still visibly a control: a button with no border reads as
   text, which is how Sign out disappeared. */
button.quiet { border-color: var(--border); background: transparent; color: var(--muted); }
button.quiet:hover:not(:disabled) { background: var(--surface-sunken); border-color: var(--border-strong); color: var(--text); }

/* Keyboard focus was previously whatever the browser did by default, which is
   close to invisible against the dashed borders. */
:where(a, button, input, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   Rows. Grid rather than flex: with `justify-content: space-between` the
   action buttons landed wherever the name happened to end, so nothing lined
   up down the page.
   -------------------------------------------------------------------------- */
ul { list-style: none; padding: 0; margin: 0; }

.rows > li {
  display: grid;
  gap: .5rem 1.15rem;
  align-items: center;
  padding: .7rem 0;
  border-top: 1px solid var(--border);
}
.rows > li:first-child { border-top: 0; }

.rows.files > li { grid-template-columns: minmax(0, 1fr) max-content max-content; }
.rows.links > li { grid-template-columns: minmax(0, 1fr) max-content; }
.rows.batch > li { grid-template-columns: minmax(0, 1fr) max-content max-content max-content; }

.name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.meta { color: var(--muted); font-size: .8125rem; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.actions { display: flex; gap: .4rem; align-items: center; }

/* Narrow screens: stack, and let the actions sit under the name. */
@media (max-width: 34rem) {
  .rows.files > li, .rows.links > li, .rows.batch > li { grid-template-columns: minmax(0, 1fr); }
  .num { text-align: left; }
}

.badge {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.neutral { background: var(--surface-sunken); color: var(--muted); border-color: var(--border); }
.badge.busy { background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: var(--good-soft); color: var(--good); }
.badge.error { background: var(--danger-soft); color: var(--danger); }

.empty { color: var(--muted); padding: 1.5rem 0; text-align: center; }
.empty strong { display: block; color: var(--text); margin-bottom: .2rem; }

.muted { color: var(--muted); font-size: .875rem; }
.error { color: var(--danger); }
.ok { color: var(--good); }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 1rem; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .8125rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.recovery {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.15rem;
  letter-spacing: .06em;
  padding: .9rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  text-align: center;
}

/* --------------------------------------------------------------------------
   Staging a batch
   -------------------------------------------------------------------------- */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-sunken);
  padding: 1.75rem 1rem;
  text-align: center;
  transition: border-color .12s, background-color .12s;
}
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone p { margin: .2rem 0; }
.summary { margin-top: .7rem; font-size: .8125rem; }
.hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* Coarse phases only — encrypting, then uploading — so an indeterminate bar is
   the honest shape. A percentage here would be invented. */
.progress { height: 3px; border-radius: 999px; background: var(--border); overflow: hidden; margin-top: .8rem; }
.progress::after {
  content: "";
  display: block;
  height: 100%;
  width: 35%;
  border-radius: 999px;
  background: var(--accent);
  animation: sweep 1.15s ease-in-out infinite;
}
@keyframes sweep {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(400%); }
}
@media (prefers-reduced-motion: reduce) {
  .progress::after { animation: none; width: 100%; opacity: .5; }
  button, .dropzone { transition: none; }
}
