/* Abacus Secure Share — brand stylesheet.
   Self-hosted (served same-origin by src/assets.js) so pages make zero third-party requests
   AND so the Content-Security-Policy can forbid 'unsafe-inline' for styles. The palette, type
   (Playfair Display + Inter), and logo match the Abacus Tech Design brand. */

/* Self-hosted brand fonts (variable woff2, one file per family). */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('/assets/fonts/inter.woff2') format('woff2'); }
@font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 600 700; font-display: swap;
  src: url('/assets/fonts/playfair-display.woff2') format('woff2'); }

:root {
  --bg: #f7f4f0; --bg-2: #f3ece2;
  --surface: #ffffff; --surface-2: #faf7f3;
  --ink: #2d1f14; --ink-2: #5c4033; --muted: #8b6b52;
  --line: #e7dccd; --line-2: #dccbb6;
  --accent: #e07830; --accent-dark: #c45d1a; --accent-light: #f49352; --accent-ink: #ffffff;
  --ok: #16a34a; --warn: #d97706; --danger: #c0392b;
  --r: 12px; --r-sm: 9px; --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(45,31,20,.05), 0 1px 1px rgba(45,31,20,.04);
  --shadow: 0 18px 50px -12px rgba(45,31,20,.18), 0 4px 12px rgba(45,31,20,.06);
  --shadow-accent: 0 8px 24px -6px rgba(224,120,48,.5);
  --ring: 0 0 0 3px rgba(224,120,48,.28);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: linear-gradient(180deg, #faf8f5 0%, #f3ece2 100%) fixed;
  color: var(--ink);
  font: 400 16px/1.6 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
.wrap { max-width: 680px; margin: 0 auto; padding: 40px 20px 72px; }
/* Wider container for the dashboard table (75% wider than the default form width). */
.wrap.wide { max-width: 1190px; }

header.brand { display: flex; align-items: center; gap: 20px; margin-bottom: 40px; }
header.brand img.logo { height: 60px; width: auto; display: block; }
header.brand .divider { width: 1px; height: 42px; background: var(--line-2); }
header.brand .product { font-size: 17px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
        padding: 32px; box-shadow: var(--shadow); }
.card + .card { margin-top: 20px; }

h1 { font-family: 'Playfair Display', Georgia, 'Times New Roman', serif; font-weight: 700;
     font-size: 28px; line-height: 1.2; letter-spacing: -.01em; margin: 0 0 10px; color: var(--ink); }
h2 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em;
     color: var(--muted); margin: 0 0 16px; }
p.lead { color: var(--ink-2); font-size: 16px; margin: 0 0 22px; }
a { color: var(--accent-dark); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }

label.field { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin: 18px 0 7px; }
input[type=text], input[type=password], input[type=number], input[type=email], textarea {
  width: 100%; background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 12px 14px; font: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: #b3a18c; }
input:hover, textarea:hover { border-color: #cdb593; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: var(--ring); }
textarea { min-height: 170px; resize: vertical;
           font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; line-height: 1.6; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, var(--accent-light), var(--accent) 45%, var(--accent-dark));
  color: var(--accent-ink); border: 0; border-radius: var(--r-sm);
  padding: 12px 20px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow-accent); transition: transform .12s, box-shadow .12s, filter .12s;
}
button:hover, .btn:hover { transform: translateY(-1px); filter: brightness(1.04);
  box-shadow: 0 12px 30px -6px rgba(224,120,48,.6); text-decoration: none; }
button:active, .btn:active { transform: translateY(0); }
button:focus-visible, .btn:focus-visible { outline: none; box-shadow: var(--ring), var(--shadow-accent); }
button.ghost, .btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line-2);
  box-shadow: var(--shadow-sm); }
button.ghost:hover, .btn.ghost:hover { background: var(--surface-2); border-color: #cdb593; filter: none; }
button.danger { background: linear-gradient(135deg, #d6553f, #c0392b); box-shadow: 0 8px 24px -6px rgba(192,57,43,.5); }
button.danger:hover { box-shadow: 0 12px 30px -6px rgba(192,57,43,.6); }

.muted { color: var(--muted); }
.note { font-size: 13px; color: var(--muted); margin-top: 18px; line-height: 1.55; }
.err { background: rgba(192,57,43,.08); border: 1px solid rgba(192,57,43,.3); color: #a3271b;
       border-radius: var(--r-sm); padding: 11px 14px; margin: 0 0 18px; font-size: 14px; }
.row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 10px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }

.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.pending { background: rgba(139,107,82,.14); color: #6b4d38; }
.badge.submitted { background: rgba(224,120,48,.16); color: #b8500f; }
.badge.retrieved { background: rgba(22,163,74,.14); color: #15803d; }
.badge.purged { background: rgba(100,116,139,.16); color: #475569; }

/* Dashboard action cell: the per-row action + the permanent-delete button, side by side. */
.cell-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nowrap { white-space: nowrap; }

/* Email-the-link UI on a pending dashboard row (ticket #4). The request name (Request column) is the
   live /s link; this action cell stacks the Copy + Email buttons and the "emailed to…" note in one
   content-sized column, sitting beside Delete. No visible link box — Copy carries the URL in a data attr. */
.link-cell { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.link-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sent-note { display: flex; align-items: center; gap: 6px; }

/* Shared "email this link" modal (ticket #4): a native <dialog> opened by public/app.js via showModal().
   Behavior lives in app.js and styling here — no inline JS/style — so the strict CSP holds (INV-16).
   showModal() centers the dialog and supplies focus-trap, Esc-to-close, and the ::backdrop for free. */
.modal { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px;
  width: min(440px, calc(100vw - 32px)); background: var(--surface); color: var(--ink);
  box-shadow: 0 18px 50px rgba(45,31,20,.28); }
.modal::backdrop { background: rgba(45,31,20,.45); }
.modal h2 { margin: 0 0 4px; }
.modal .field { margin-top: 14px; }
.modal textarea { min-height: 72px; font: inherit; font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* File input on the submission form (native control; no input[type=file] in the styled set above). */
input[type=file] { width: 100%; background: var(--surface-2); color: var(--ink-2);
  border: 1px dashed var(--line-2); border-radius: var(--r-sm); padding: 12px 14px; font: inherit; font-size: 14px;
  transition: border-color .15s, background .15s; }
input[type=file]:hover { border-color: #cdb593; }
input[type=file]:focus-visible { outline: none; border-color: var(--accent); background: #fff; box-shadow: var(--ring); }

/* Submitted-file list on the request detail page. */
.files { list-style: none; margin: 0; padding: 0; }
.files li { display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 13px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.files li:last-child { border-bottom: 0; }
.file-info { min-width: 0; flex: 1; }
.file-name { font-weight: 500; color: var(--ink); word-break: break-word; }
.file-actions { display: flex; gap: 8px; align-items: center; }
.file-actions button { padding: 9px 16px; }

pre.secret { background: #2d1f14; color: #f3ece2; border: 1px solid #4a3425; border-radius: var(--r);
             padding: 18px; white-space: pre-wrap; word-break: break-word;
             font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; line-height: 1.6;
             margin: 0; box-shadow: inset 0 1px 0 rgba(255,255,255,.04); }

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 14px; }
.topbar h2 { margin: 0; }

.success-mark { width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center;
                justify-content: center; background: rgba(22,163,74,.12); color: var(--ok);
                font-size: 28px; margin-bottom: 18px; }

/* Utility classes — replace former inline style="…" attributes so the CSP can forbid
   'unsafe-inline'. (Inline style attributes cannot be allowed by CSP nonces or hashes.) */
.mt-18 { margin-top: 18px; }
.mt-16 { margin-top: 16px; }
.mt-8 { margin-top: 8px; }
.meta { font-size: 12px; margin-top: 3px; }
.col-grow { flex: 1; min-width: 220px; }
.col-150 { width: 150px; }

/* E2E (ticket #2): success box, the per-request toggle, badge, and decrypt key-loader. */
.ok { background: rgba(22,163,74,.10); border: 1px solid rgba(22,163,74,.35); color: #15803d;
      border-radius: var(--r-sm); padding: 11px 14px; margin: 0 0 18px; font-size: 14px; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500;
            color: var(--ink-2); cursor: pointer; }
.checkbox input { width: auto; margin: 0; accent-color: var(--accent); }
.e2e-toggle { align-items: center; justify-content: space-between; }
.badge.e2e { background: rgba(224,120,48,.16); color: #b8500f; letter-spacing: .04em; }
.e2e-keyload input[type=file] { max-width: 420px; }

@media (max-width: 560px) {
  .wrap { padding: 28px 16px 56px; }
  .card { padding: 24px 20px; }
  h1 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  button:hover, .btn:hover { transform: none; }
}
