/* ============================================================================
   LAW Archive — visual system
   Brand: Legal Action Worldwide · navy #0a1460 · red #E31140
   ========================================================================== */
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/static/fonts/Inter.woff2') format('woff2');
}
@font-face {
  font-family: 'Newsreader'; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url('/static/fonts/Newsreader.woff2') format('woff2');
}

:root {
  --navy: #0a1460; --navy-600: #20308f; --navy-050: #eef0fb;
  --red: #e31140; --red-700: #b50d31; --red-050: #fdecf0;
  --bg: #f3f5f9; --surface: #ffffff; --surface-2: #fafbfd;
  --ink: #0e1230; --muted: #5d6478; --faint: #8b91a4; --line: #e3e7f0;
  --ok: #11774a; --ok-bg: #e6f6ee; --ok-line: #b9e6cd;
  --warn: #8a5a00; --warn-bg: #fdf2d8;
  --shadow-sm: 0 1px 2px rgba(10,20,96,.05);
  --shadow: 0 1px 3px rgba(10,20,96,.06), 0 10px 30px rgba(10,20,96,.07);
  --radius: 14px; --radius-sm: 9px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px; line-height: 1.55; letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: 'Newsreader', Georgia, serif; font-weight: 500; letter-spacing: -0.01em; color: var(--ink); }
a { color: var(--navy-600); text-decoration: none; }
a:hover { color: var(--red); }
code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 0.86em; }
::selection { background: var(--red-050); }

/* ---- Buttons ---- */
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: var(--radius-sm);
  padding: 11px 18px; background: var(--navy); color: #fff; transition: background .15s, transform .05s;
  display: inline-flex; align-items: center; gap: 8px; line-height: 1;
}
button:hover, .btn:hover { background: var(--navy-600); text-decoration: none; }
button:active, .btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--navy-600); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--navy-050); color: var(--navy); }
button.link { background: none; color: var(--muted); padding: 0; font-weight: 500; }
button.link:hover { background: none; color: var(--red); }
button.danger { background: #fff; color: var(--red-700); border: 1px solid #f0c2cd; }
button.danger:hover { background: var(--red-050); }

/* ---- Forms ---- */
label { display: block; font-weight: 600; font-size: 13.5px; margin: 16px 0 6px; color: var(--ink); }
input, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus {
  outline: 0; border-color: var(--navy-600); box-shadow: 0 0 0 3px var(--navy-050);
}
input[type=file] { padding: 9px; background: var(--surface-2); }
textarea { resize: vertical; }
.hint { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.msg { background: var(--navy-050); border: 1px solid #cfd6f5; color: #2a356f; padding: 11px 14px; border-radius: var(--radius-sm); }
.msg.err { background: var(--red-050); border-color: #f3c4cf; color: var(--red-700); }

/* ============================================================================
   Login — split hero
   ========================================================================== */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-hero {
  background: radial-gradient(120% 120% at 30% 20%, #14207a 0%, var(--navy) 55%, #070d3e 100%);
  display: flex; align-items: center; justify-content: center; padding: 48px;
}
.login-hero .logo { height: 42px; opacity: .96; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--surface); }
.login-card { width: 100%; max-width: 360px; }
.login-card .brand-logo { height: 28px; margin-bottom: 28px; }
.login-card h2 { font-size: 25px; margin: 0 0 6px; }
.login-card .sub { color: var(--muted); margin: 0 0 22px; }
.login-card button { width: 100%; justify-content: center; margin-top: 18px; padding: 12px; }
@media (max-width: 820px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { padding: 40px 28px; }
  .login-hero h1 { font-size: 30px; }
  .login-hero ul.features { display: none; }
}

/* ============================================================================
   App chrome
   ========================================================================== */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 0 28px; height: 60px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.topbar .brand { display: flex; align-items: center; gap: 0; }
.topbar .brand img { height: 22px; }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: 13.5px; }
.topbar .back { font-weight: 600; font-size: 14px; }
.wrap { max-width: 1000px; margin: 32px auto 60px; padding: 0 28px; }
.backlink { display: inline-block; margin-bottom: 14px; font-weight: 600; font-size: 14px; }

.page-head { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 0 18px; }
.page-head h1 { font-size: 26px; margin: 0; }
.section-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 30px 0 12px; }

/* ---- Action cards ---- */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .actions { grid-template-columns: 1fr; } }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 22px;
}
.card .card-head { display: flex; align-items: center; gap: 11px; margin-bottom: 6px; }
.card .card-head .ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.card .card-head .ic.page { background: var(--navy-050); color: var(--navy); }
.card .card-head .ic.video { background: #efeafc; color: #5b3ca8; }
.card .card-head .ic.deposit { background: #fdeede; color: #9a5b13; }
.card .card-head h3 { font-family: 'Inter', sans-serif; font-size: 16px; font-weight: 650; margin: 0; }
.card .card-sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.card textarea { margin-bottom: 12px; }
.card button { width: 100%; justify-content: center; }

.deposit-cta {
  margin: 18px 0 6px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); display: flex; align-items: center; gap: 14px;
}
.deposit-cta .ic { width: 38px; height: 38px; border-radius: 10px; background: #fdeede; color: #9a5b13; display: grid; place-items: center; flex: none; }
.deposit-cta .txt { flex: 1; }
.deposit-cta .txt b { display: block; }
.deposit-cta .txt span { color: var(--muted); font-size: 13px; }

/* ---- Search + filter bar ---- */
.searchbar { display: flex; gap: 10px; margin-bottom: 14px; }
.searchbar input[type=search] { flex: 1; }
.searchbar select { width: auto; min-width: 150px; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); font: inherit; background: #fff; color: var(--ink); cursor: pointer; }
.searchbar button { flex: none; }

/* ---- Case ---- */
.caseform { display: flex; align-items: center; gap: 8px; margin: 6px 0 4px; color: var(--muted); }
.caseform input { max-width: 280px; padding: 7px 11px; }
.caseform button { padding: 7px 12px; }
.casechip { display: inline-block; padding: 2px 9px; border-radius: 6px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--navy-600); font-size: 12px; font-weight: 600; }
.casechip:hover { background: var(--navy-050); text-decoration: none; }
.faint { color: var(--faint); }

/* ---- Table ---- */
table.captures {
  width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.captures th, .captures td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.captures th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 700; background: var(--surface-2); }
.captures tbody tr { transition: background .12s; }
.captures tbody tr:hover { background: var(--surface-2); }
.captures tr:last-child td { border-bottom: 0; }
.nowrap { white-space: nowrap; }
.url { word-break: break-all; color: var(--ink); }
.captures td a { font-weight: 600; }
.empty { color: var(--muted); text-align: center; padding: 40px 20px; }

/* ---- Badges ---- */
.pill, .type { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; margin-right: 7px; background: currentColor; }
.pill.queued { background: #eef1f6; color: #6a7282; }
.pill.capturing { background: var(--warn-bg); color: var(--warn); }
.pill.complete { background: var(--ok-bg); color: var(--ok); }
.pill.failed { background: var(--red-050); color: var(--red-700); }
.type { text-transform: uppercase; letter-spacing: .04em; border-radius: 6px; }
.type.page { background: var(--navy-050); color: var(--navy-600); }
.type.video { background: #efeafc; color: #5b3ca8; }
.type.deposit { background: #fdeede; color: #9a5b13; }

/* ============================================================================
   Detail
   ========================================================================== */
.detail h1.url { font-size: 22px; word-break: break-all; margin: 6px 0 4px; }
.meta-row { color: var(--muted); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px 22px; margin: 16px 0; }
.panel h3 { font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }

/* Evidentiary seal */
.seal { display: flex; gap: 16px; align-items: flex-start; }
.seal .badge { width: 46px; height: 46px; border-radius: 12px; background: var(--ok-bg); color: var(--ok); display: grid; place-items: center; flex: none; }
.seal .badge.pending { background: var(--warn-bg); color: var(--warn); }
.hash { font-family: ui-monospace, monospace; font-size: 12.5px; color: var(--muted); word-break: break-all; background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; display: block; margin-top: 6px; }

.artifacts { list-style: none; padding: 0; margin: 0; }
.artifacts li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.artifacts li:last-child { border-bottom: 0; }
.artifacts .akind { width: 30px; height: 30px; border-radius: 8px; background: var(--navy-050); color: var(--navy); display: grid; place-items: center; flex: none; }
.artifacts .aname { font-weight: 600; }
.artifacts .asize { color: var(--faint); font-size: 13px; }
.artifacts .ahash { margin-left: auto; color: var(--faint); font-family: ui-monospace, monospace; font-size: 12px; }

.timestamps { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.timestamps li { display: flex; align-items: center; gap: 10px; }

table.kv { border-collapse: collapse; width: 100%; }
table.kv th { text-align: left; vertical-align: top; color: var(--muted); font-weight: 600; padding: 7px 18px 7px 0; white-space: nowrap; font-size: 13.5px; }
table.kv td { padding: 7px 0; word-break: break-word; }
.note-inline { color: var(--faint); font-size: 12.5px; font-weight: 400; text-transform: none; letter-spacing: 0; }
.note { color: var(--muted); font-size: 13.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 28px 0 16px; }

.verify { margin-top: 12px; padding: 14px 16px; border-radius: var(--radius-sm); }
.verify.ok { background: var(--ok-bg); border: 1px solid var(--ok-line); }
.verify.fail { background: var(--red-050); border: 1px solid #f3bcbc; }
.verify ul { margin: 8px 0 0; padding-left: 18px; }

/* ============================================================================
   LAW Profiles — editor
   ========================================================================== */
.topbar .brand-name { font-family:'Newsreader',Georgia,serif; font-size:18px; margin-left:10px; color:var(--ink); }
.page-head .count { margin-left:10px; font-size:13px; color:var(--faint); background:var(--surface-2); border:1px solid var(--line); border-radius:999px; padding:1px 10px; align-self:center; }
.btn.small, button.small { padding:6px 11px; font-size:12.5px; border-radius:7px; }
.visually-hidden { position:absolute !important; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; }

.editor-head { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; margin:2px 0 14px; }
.editor-head h1 { font-size:25px; margin:0; }
.editor-head .cyr { font-size:16px; color:var(--muted); font-weight:400; }
.editor-actions { flex:none; }

.edit-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,520px); gap:22px; align-items:start; }
@media (max-width:1100px){ .edit-grid { grid-template-columns:1fr; } .preview-col{ display:none; } }
.edit-col { min-width:0; }
.edit-col .panel { margin:0 0 16px; }

.preview-col { position:sticky; top:78px; }
.preview-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--faint); }
#preview { width:100%; height:calc(100vh - 130px); border:1px solid var(--line); border-radius:var(--radius); background:#fff; }

.field-grid { display:grid; grid-template-columns:1fr 1fr; gap:0 16px; }
@media (max-width:560px){ .field-grid { grid-template-columns:1fr; } }

.kv-row { display:grid; grid-template-columns:200px 1fr auto; gap:10px; align-items:start; margin-bottom:9px; }
.kv-row.obs { grid-template-columns:150px 1fr auto; }
@media (max-width:560px){ .kv-row, .kv-row.obs { grid-template-columns:1fr; } }

.savebar { display:flex; align-items:center; gap:14px; flex-wrap:wrap; margin-top:6px; padding:14px 0 2px; }
.savebar .check { display:flex; align-items:center; gap:8px; font-weight:600; margin:0; }
.savebar .check input { width:auto; }
.savebar input[name=summary] { flex:1; min-width:180px; }
.savebar .btn { flex:none; }

.photo-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:14px; margin-bottom:14px; }
.photo-card { border:1px solid var(--line); border-radius:var(--radius-sm); padding:10px; background:var(--surface-2); }
.photo-thumb { position:relative; }
.photo-thumb img { width:100%; height:140px; object-fit:cover; border-radius:6px; border:1px solid var(--line); background:#fff; display:block; }
.badge-portrait { position:absolute; top:7px; left:7px; background:var(--navy); color:#fff; font-size:10.5px; font-weight:700; padding:2px 8px; border-radius:999px; }
.photo-meta { display:grid; gap:6px; margin:9px 0 7px; }
.photo-meta input { padding:7px 9px; font-size:12.5px; }
.photo-actions { display:flex; gap:6px; }
.photo-actions form { display:inline; }
.photo-upload { display:flex; gap:10px; flex-wrap:wrap; align-items:center; border-top:1px solid var(--line); padding-top:14px; }
.photo-upload input { width:auto; flex:1; min-width:140px; }

.source-list { display:grid; gap:10px; margin-bottom:14px; }
.source-row { border:1px solid var(--line); border-radius:var(--radius-sm); padding:10px 12px; background:var(--surface-2); }
.src-fields { display:grid; grid-template-columns:1.4fr 1fr 120px 1.6fr auto; gap:8px; align-items:center; }
.src-fields input { padding:7px 9px; font-size:12.5px; }
@media (max-width:760px){ .src-fields { grid-template-columns:1fr 1fr; } }
.src-archive { display:flex; align-items:center; gap:10px; margin-top:8px; font-size:12.5px; }
.src-archive .src-del { margin-left:auto; }
.hash-mini { font-family:ui-monospace,monospace; font-size:11.5px; color:var(--faint); }
.source-add { display:grid; grid-template-columns:1.4fr 1fr 120px 1.6fr auto; gap:8px; align-items:center; border-top:1px solid var(--line); padding-top:14px; }
.source-add input { padding:8px 10px; }
@media (max-width:760px){ .source-add { grid-template-columns:1fr 1fr; } }
.msg.err.small { padding:4px 8px; font-size:12px; }

.changelog { list-style:none; padding:0; margin:0; display:grid; gap:7px; font-size:13px; color:var(--muted); }
.changelog li { padding-bottom:7px; border-bottom:1px solid var(--line); }
.changelog li:last-child { border-bottom:0; }

/* ---- Shared top nav (Profiles <-> Archive) ---- */
.topbar .brand img { height: 22px; }
.topnav { display:flex; gap:2px; margin-left:16px; }
.topnav a { padding:7px 13px; border-radius:8px; font-weight:600; font-size:14px; color:var(--muted); }
.topnav a:hover { background:var(--navy-050); color:var(--navy); text-decoration:none; }
.topnav a.active { background:var(--navy-050); color:var(--navy); }

/* ---- Editor: full width, roomier fields (preview pane removed) ---- */
.wrap.editor { max-width: 1060px; }
.kv-row { grid-template-columns: 240px 1fr auto; gap: 12px; align-items: start; }
.kv-row.obs { grid-template-columns: 170px 1fr auto; }
.kv-row textarea { min-height: 66px; }
.mainform textarea, .panel textarea { font-size: 14px; line-height: 1.5; }
.mainform input, .field-grid input { font-size: 14px; }
.field-grid { gap: 4px 22px; }
.edit-col .panel, .editor .panel { margin: 0 0 18px; padding: 22px 24px; }

/* ---- Inline citations: cite button, chips, dialog ---- */
.cite-field { display:flex; flex-direction:column; gap:7px; min-width:0; }
.cite-bar { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.cite-btn { font:inherit; font-size:11.5px; font-weight:600; cursor:pointer; display:inline-flex; align-items:center; gap:5px;
  padding:3px 10px; border-radius:999px; border:1px solid var(--line); background:#fff; color:var(--navy-600); line-height:1; }
.cite-btn:hover { background:var(--navy-050); border-color:#cdd6f3; }
.chip { display:inline-flex; align-items:center; gap:4px; background:var(--navy-050); color:var(--navy);
  border:1px solid #cdd6f3; border-radius:999px; padding:2px 4px 2px 11px; font-size:11.5px; max-width:100%; }
.chip b { font-weight:600; max-width:260px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chip-x { background:none; border:none; color:var(--navy-600); cursor:pointer; font-size:15px; line-height:1; padding:0 5px; }
.chip-x:hover { color:var(--red); }
.used-in { color:var(--faint); font-size:11.5px; font-style:italic; margin:6px 0 0; }
.add-source-wrap { margin-top:14px; }
.add-source-wrap summary { cursor:pointer; color:var(--navy-600); font-weight:600; font-size:13px; }
.add-source-wrap .source-add { margin-top:12px; border-top:0; padding-top:0; }

dialog#cite-dialog { border:none; border-radius:var(--radius); box-shadow:var(--shadow); padding:0; max-width:460px; width:92%; }
dialog#cite-dialog::backdrop { background:rgba(10,20,96,.28); }
.cite-form { padding:22px 24px; display:flex; flex-direction:column; }
.cite-form h3 { font-family:'Inter',sans-serif; font-size:16px; font-weight:650; margin:0 0 4px; }
.cite-form label { margin:14px 0 0; }
.cite-form .check { display:flex; flex-direction:row; align-items:center; gap:8px; margin-top:16px; }
.cite-form .check input { width:auto; }
.dialog-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:20px; }
