/* Legalhelp.guru: modern look. Same class and id names as before; only presentation changes. */
:root {
  --bg: #f4f5fa; --surface: #ffffff; --surface-2: #f8f9fc; --text: #0f172a; --muted: #5b667a; --line: #e3e6ef;
  --accent: #4338ca; --accent-2: #6366f1; --accent-soft: #eef0ff; --accent-text: #ffffff;
  --ok: #0f7b4f; --ok-soft: #e6f6ee; --warn: #a15c07; --warn-soft: #fff4e0; --err: #b42318; --err-soft: #fdecea;
  --mark: #fff0a8;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 14px rgba(15, 23, 42, .05);
  --shadow-up: 0 2px 4px rgba(15, 23, 42, .08), 0 10px 26px rgba(15, 23, 42, .10);
  --radius: 14px; --sidebar: 232px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1017; --surface: #161b26; --surface-2: #1b2130; --text: #e8ebf3; --muted: #97a1b5; --line: #272f40;
    --accent: #8b93ff; --accent-2: #a5abff; --accent-soft: #212749; --accent-text: #0b0e14;
    --ok: #4cc38a; --ok-soft: #12291f; --warn: #f5a524; --warn-soft: #302410; --err: #ff7a6e; --err-soft: #331816;
    --mark: #5a4b00;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .25);
    --shadow-up: 0 2px 4px rgba(0, 0, 0, .5), 0 10px 26px rgba(0, 0, 0, .35);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* .card etc. set display; hidden must still win */
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-2); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent-2) 55%, transparent); outline-offset: 2px; }

/* Top bar */
.top {
  position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top h1 { font-size: 18px; font-weight: 750; letter-spacing: -.01em; margin: 0; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.top h1::before {
  content: ""; width: 26px; height: 26px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25);
}
.who { margin-left: auto; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
main { padding: 20px 16px; max-width: 800px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; animation: rise .18s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view.active { animation: none; } }
.muted { color: var(--muted); font-size: 14px; }
h2 { font-size: 22px; letter-spacing: -.015em; margin: 4px 0 8px; }

/* Buttons */
.capture-buttons { display: grid; gap: 12px; margin-bottom: 8px; }
.big-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  min-height: 54px; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; font-weight: 650; cursor: pointer;
  box-shadow: var(--shadow); transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
}
.big-btn:hover { box-shadow: var(--shadow-up); }
.big-btn:active { transform: translateY(1px); }
.big-btn.primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-text); border-color: transparent;
}
.big-btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.big-btn .icon { font-size: 22px; }
.link-btn {
  background: none; border: 0; color: var(--accent); font: inherit; font-weight: 600; padding: 10px 0; cursor: pointer;
  text-decoration: none; display: inline-block;
}
.link-btn:hover { text-decoration: underline; }

/* Page thumbnails while capturing */
.thumbs { list-style: none; padding: 0; margin: 8px 0 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.thumbs li { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; aspect-ratio: 3/4; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.thumbs .num { position: absolute; left: 6px; top: 6px; background: rgba(15, 23, 42, .75); color: #fff; font-size: 12px; font-weight: 650; padding: 1px 8px; border-radius: 999px; }
.thumbs .rm { position: absolute; right: 6px; top: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(15, 23, 42, .75); color: #fff; font-size: 16px; cursor: pointer; }
.thumbs .pdf { font-size: 13px; padding: 8px; text-align: center; word-break: break-word; }

/* Cards and forms */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 14px; box-shadow: var(--shadow); }
label { display: grid; gap: 6px; font-weight: 650; font-size: 14px; }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 13px; width: 100%; min-height: 46px;
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent-2) 40%, var(--line)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-2) 22%, transparent); }
input::placeholder { color: var(--muted); }
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .2s; border-radius: 999px; }
.msg { margin: 0; min-height: 1.2em; font-size: 14px; }
.msg.ok { color: var(--ok); } .msg.err { color: var(--err); }

/* Library */
.search { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; margin-bottom: 10px; }
.search input[type="search"] { background-image: none; padding-left: 14px; box-shadow: var(--shadow); }
.search select { width: auto; box-shadow: var(--shadow); }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.list li { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; cursor: pointer; box-shadow: var(--shadow); transition: transform .08s ease, box-shadow .15s ease, border-color .15s; }
.list li:hover { box-shadow: var(--shadow-up); border-color: color-mix(in srgb, var(--accent-2) 45%, var(--line)); }
.list li.muted { cursor: default; box-shadow: none; background: transparent; border-style: dashed; text-align: center; padding: 28px 16px; }
.list li.muted:hover { box-shadow: none; border-color: var(--line); }
.list .title { font-weight: 700; font-size: 16px; letter-spacing: -.005em; }
.list .meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.list .snip { font-size: 14px; margin-top: 8px; color: color-mix(in srgb, var(--text) 85%, var(--muted)); }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 2px; }
.badge { display: inline-block; font-size: 11.5px; font-weight: 650; letter-spacing: .02em; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); margin-left: 8px; vertical-align: 2px; text-transform: capitalize; }
.badge.done { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.badge.processing, .badge.queued { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.badge.error { color: var(--err); background: var(--err-soft); border-color: transparent; }

/* Document view */
.doc h2 { margin: 4px 0; font-size: 22px; }
.doc section { margin-top: 18px; }
.doc h3 { font-size: 12px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.page { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow); }
.page img { width: 100%; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.page pre { white-space: pre-wrap; word-wrap: break-word; font: 14px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace; max-height: 50vh; overflow: auto; background: var(--surface-2); padding: 12px; border-radius: 10px; border: 1px solid var(--line); }
.page .hash { font: 11px ui-monospace, monospace; color: var(--muted); word-break: break-all; }
details summary { cursor: pointer; padding: 6px 0; color: var(--accent); font-weight: 600; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 12px 0 0; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li { position: relative; padding: 4px 0 18px 20px; cursor: pointer; }
.timeline li::before { content: ""; position: absolute; left: -8px; top: 9px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent-2); border: 3px solid var(--bg); }
.timeline .date { font-weight: 750; }
.timeline .why { font-size: 14px; color: var(--muted); }

/* Chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 8px 15px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow); }
.chip:hover { border-color: var(--accent-2); }
.chip.active { background: var(--accent); color: var(--accent-text); border-color: transparent; }

/* Navigation: bottom bar on phones, left sidebar on wide screens */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: grid; grid-template-columns: repeat(6, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs button { background: none; border: 0; color: var(--muted); font: inherit; font-size: 11.5px; font-weight: 600; padding: 9px 0 10px; display: grid; justify-items: center; gap: 3px; cursor: pointer; }
.tabs button span { display: grid; place-items: center; font-size: 20px; height: 24px; }
.tabs button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.active { color: var(--accent); }
.tabs button.active span { position: relative; }
@media (min-width: 960px) {
  body { padding-bottom: 24px; padding-left: var(--sidebar); }
  .top { margin-left: calc(-1 * var(--sidebar)); padding-left: calc(var(--sidebar) + 24px); padding-right: 24px; }
  main { padding: 28px 28px 40px; max-width: 920px; }
  .tabs {
    top: 61px; right: auto; width: var(--sidebar); grid-template-columns: 1fr; align-content: start; gap: 4px;
    padding: 16px 12px; border-top: 0; border-right: 1px solid var(--line); background: var(--surface);
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .tabs button { grid-auto-flow: column; justify-content: start; justify-items: start; align-items: center; gap: 12px; font-size: 15px; padding: 11px 14px; border-radius: 12px; }
  .tabs button:hover { background: var(--surface-2); color: var(--text); }
  .tabs button.active { background: var(--accent-soft); color: var(--accent); }
}
@media (max-width: 520px) { .search { grid-template-columns: 1fr 1fr; } .search input { grid-column: 1 / -1; } .who { display: none; } }

#view-more .card { margin-bottom: 18px; }
#view-more h3 { margin: 0; font-size: 17px; }
.row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: end; }
@media (max-width: 520px) { .row { grid-template-columns: 1fr 1fr; } .row > :first-child { grid-column: 1 / -1; } }
.bates { font: 12px ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--accent); margin-top: 2px; }
.inline-edit { display: grid; gap: 8px; margin-top: 8px; }

/* Legal review */
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; grid-column: 1 / -1; }
.check input { width: auto; min-height: 0; accent-color: var(--accent); }
.badge.marked { color: var(--err); background: var(--err-soft); border-color: transparent; margin-left: 0; }
.marked-banner { background: var(--err-soft); border: 1px solid color-mix(in srgb, var(--err) 35%, transparent); color: var(--err); border-radius: 12px; padding: 11px 14px; font-weight: 650; }
.points { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.points .badge { margin-left: 0; }
blockquote { margin: 8px 0 0; padding: 8px 12px; border-left: 3px solid var(--accent-2); background: var(--surface-2); border-radius: 0 8px 8px 0; font-style: italic; }
.timeline li.deadline::before { background: var(--warn); }
.timeline li.deadline .date { color: var(--warn); }

/* Cases */
.case-select { width: auto; min-height: 36px; padding: 5px 30px 5px 12px; font-size: 14px; font-weight: 650; max-width: 46%; margin: 0 4px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.case-checks { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.case-checks .check { grid-column: auto; }

/* Upload page */
body.wide { padding-left: 0; }
body.wide main { max-width: 1100px; }
body.wide .top { margin-left: 0; padding-left: 24px; }
.top .home { color: inherit; text-decoration: none; }
.settings-row { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: end; margin-bottom: 18px; }
.dropzone { border: 2px dashed color-mix(in srgb, var(--accent-2) 45%, var(--line)); border-radius: 20px; background: var(--surface); padding: 56px 16px; text-align: center; display: grid; gap: 10px; justify-items: center; transition: border-color .15s, background .15s, transform .15s; box-shadow: var(--shadow); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.005); }
.drop-icon { font-size: 44px; }
.drop-title { font-size: 24px; font-weight: 750; letter-spacing: -.01em; }
.drop-buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.drop-buttons .big-btn { width: auto; padding: 12px 22px; }
.summary { margin: 18px 0 8px; font-weight: 650; }
.queue { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: 14px; box-shadow: var(--shadow); }
.queue th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); }
.queue th, .queue td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.queue tr:last-child td { border-bottom: 0; }
.queue td:first-child { word-break: break-all; }
.queue td:nth-child(2) { white-space: nowrap; color: var(--muted); }
.queue tr.q-done .st { color: var(--ok); font-weight: 650; }
.queue tr.q-failed .st, .queue .err { color: var(--err); font-weight: 650; }
.queue tr.q-duplicate .st, .queue tr.q-skipped .st { color: var(--warn); font-weight: 650; }
@media (max-width: 520px) { .queue td:nth-child(2), .queue th:nth-child(2) { display: none; } }

/* Duplicates */
.dup-banner { display: block; width: 100%; text-align: left; background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); color: var(--warn); border-radius: 12px; padding: 11px 14px; font: inherit; font-weight: 650; margin-bottom: 10px; cursor: pointer; }
.dup-banner:hover { filter: brightness(.98); }
.dups li { cursor: default; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.pair .side { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--surface-2); min-width: 0; }
.pair img { width: 100%; max-height: 260px; object-fit: contain; background: #fff; border-radius: 8px; }
.pair .excerpt { font-size: 12px; color: var(--muted); max-height: 6.5em; overflow: hidden; white-space: pre-wrap; word-break: break-word; }
.pair-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pair-actions .big-btn { width: auto; min-height: 40px; padding: 8px 15px; font-size: 15px; }

/* Deployed version, very small, under the content */
.ver { font-size: 9px; line-height: 1.2; color: var(--muted); text-align: center; padding: 6px 16px 10px; opacity: .75; }

/* Ask: the case analyst */
#ask-body { display: grid; gap: 14px; }
.ask-banner { font-size: 13px; }
.thread { display: grid; gap: 12px; }
.msg { border-radius: var(--radius); padding: 12px 14px; border: 1px solid var(--line); background: var(--surface); }
.msg p { margin: 0 0 8px; line-height: 1.5; }
.msg-u { background: var(--accent-soft); justify-self: end; max-width: 92%; font-weight: 600; }
.msg-a { display: grid; gap: 4px; }
.finding { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); margin-top: 8px; display: grid; gap: 6px; }
.finding-head .badge { margin-left: 0; margin-right: 6px; }
.finding-claim { font-weight: 650; }
.finding-alt { font-size: 13.5px; color: var(--muted); }
.cite { display: grid; gap: 4px; font-size: 13.5px; }
.cite blockquote { margin: 0; padding: 6px 10px; border-left: 3px solid var(--line); color: var(--muted); font-style: italic; }
.bates-link { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--accent); cursor: pointer; text-decoration: underline; }
.warnbox { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.stale { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.tokens { font-size: 11px; color: var(--muted); }
.follow-ups { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ask-form { display: grid; gap: 8px; }
.ask-form textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.ask-form .row { display: flex; gap: 8px; }

/* Processing costs */
.cost-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.cost-table th, .cost-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.cost-table th { color: var(--muted); font-weight: 650; }
.cost-table tr:last-child td { font-weight: 700; }
#cost-table { overflow-x: auto; }

/* Local scan */
#scan { margin: 14px 0; }
.scan-group { margin: 8px 0; }
.scan-group summary { cursor: pointer; font-weight: 650; }
.scan-group .list li { padding: 4px 0; }

/* Import cost approval (upload page) */
.estimate { border-color: var(--accent, #4f46e5); }
.estimate-text { font-weight: 650; margin: 0; }
.estimate-auto input { width: 7em; margin-left: 6px; }

/* Feedback beside a form, and labelled fields in the costs card */
.form-msg { font-size: 14px; min-height: 1.2em; color: var(--muted, inherit); }
.form-msg.ok { color: var(--ok); font-weight: 650; } .form-msg.err { color: var(--err); font-weight: 650; }
.inline-edit label { display: grid; gap: 2px; font-size: 13px; color: var(--muted, inherit); }
.inline-edit { align-items: end; }

/* More tab as a menu: one section at a time (a scrolling row of buttons on a phone) */
.more-menu { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; }
.more-menu button { flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line, #8886); background: transparent; color: inherit; font: inherit; cursor: pointer; }
.more-menu button.on { background: var(--accent, #2563eb); border-color: var(--accent, #2563eb); color: #fff; font-weight: 650; }
.more-menu button[hidden] { display: none; }
#view-more [data-sec].sec-off { display: none !important; }

.reset-key { font-size: 1.6em; font-weight: 700; letter-spacing: .08em; user-select: all; }

.cost-scroll { overflow-x: auto; }

/* Sign-in and invitation pages: the main action looks like the main action on every screen size */
.login .card button.primary, .login .card button[type="submit"] {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 54px; margin-top: 8px; padding: 12px 16px;
  border-radius: 14px; border: 1px solid transparent; font: inherit; font-size: 17px; font-weight: 700; cursor: pointer;
  background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-text); box-shadow: var(--shadow);
}
.login .card button.primary:active { transform: translateY(1px); }
.login .card button.primary:disabled { opacity: .45; cursor: default; box-shadow: none; }
.login .card h1 { margin-bottom: 4px; }
.login .card label { display: grid; gap: 6px; margin-bottom: 14px; font-weight: 650; }
.login .card .link-btn { min-height: 44px; }
