/* KeepSealed design system.
 *
 * Every value here is lifted from design/*.dc.html - the mockups the brief says the app must
 * match. The first UI was built without opening them and shared nothing with this file.
 *
 * Classes only, no inline styles anywhere in the app. That is not a taste: it lets the page be
 * served with `style-src 'self'`, and the page that handles keys should not be one where injected
 * markup can restyle itself into a convincing dialog.
 */

/* Self-hosted. A client opening an invitation from their solicitor should not have that fact
   reported to a font CDN before they have typed anything. Until the files are in /app/fonts/ the
   stacks below fall back to Georgia and the system sans, which is what the mockups name too. */
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Public Sans";
  src: url("../fonts/public-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #F6F4EF;
  --surface: #FFFFFF;
  --nav: #EFECE5;
  --line: #E2DED5;
  --hair: #EFECE5;
  --dash: #CFC9BD;
  --dot: #B9B3A6;

  --ink: #1B1A17;
  --ink-2: #5E5A52;
  --ink-3: #6B665D;

  --accent: #1F5F57;
  --accent-ink: #15443E;
  --accent-tint: #E3EEEC;

  --seal: #8A2E2A;
  --seal-tint: #F4E4E2;

  --folder-fill: #E8D9B5;
  --folder-line: #9C7A2E;

  --serif: "Newsreader", Georgia, serif;
  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --r-sm: 8px;
  --r: 10px;
  --r-lg: 12px;
  --r-xl: 18px;

  --shadow-card: 0 8px 24px rgba(27, 26, 23, 0.06);
  --shadow-pop: 0 12px 32px rgba(27, 26, 23, 0.14);
}

*, *::before, *::after { box-sizing: border-box; }
/* An author rule such as `.topbar { display: flex }` outranks the browser's own [hidden] rule, so
   hiding with the attribute would silently do nothing. */
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
a:hover { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------------------------------------ */
/* Shell                                                                                      */
/* ------------------------------------------------------------------------------------------ */

.app { display: flex; flex-direction: column; height: 100dvh; min-height: 0; }

.topbar {
  height: 64px; flex-shrink: 0; display: flex; align-items: center; gap: 24px;
  padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; width: 216px; flex-shrink: 0; text-decoration: none; color: inherit; }
.brand-name { font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: -0.2px; }
.firm-pill {
  display: flex; align-items: center; height: 36px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--surface); font-weight: 500; white-space: nowrap;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis;
}
.search {
  flex-grow: 1; max-width: 460px; display: flex; align-items: center; gap: 10px; height: 40px;
  padding: 0 14px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r);
  color: var(--ink-3);
}
.search input { flex-grow: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--ink); }
.search:focus-within { border-color: var(--accent); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.menu-toggle { display: none; }

.body { flex-grow: 1; display: flex; min-height: 0; }

.nav {
  width: 264px; flex-shrink: 0; display: flex; flex-direction: column; gap: 4px;
  padding: 20px 12px; background: var(--nav); border-right: 1px solid var(--line); overflow-y: auto;
}
.nav-label {
  padding: 4px 12px 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--ink-3);
}
.nav-label + .nav-item ~ .nav-label { padding-top: 20px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 12px; border: 0;
  border-radius: var(--r-sm); background: transparent; color: var(--ink); font-size: 14px;
  text-align: left; text-decoration: none; cursor: pointer; width: 100%;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.55); color: var(--ink); }
.nav-item.on { background: var(--surface); box-shadow: 0 1px 2px rgba(27, 26, 23, 0.08); font-weight: 600; }
.nav-item .grow { flex-grow: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .count { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.dot { width: 8px; height: 8px; border-radius: 4px; background: var(--dot); flex-shrink: 0; }
.nav-item.on .dot { background: var(--accent); }
.badge {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--seal);
  color: #fff; font-size: 12px; font-weight: 600; line-height: 22px; text-align: center;
}
.e2ee-card {
  margin-top: auto; display: flex; gap: 10px; padding: 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
}
.e2ee-card svg { flex-shrink: 0; margin-top: 1px; color: var(--accent); }
.e2ee-card strong { display: block; font-size: 13px; font-weight: 600; }
.e2ee-card span { display: block; margin-top: 4px; font-size: 12px; line-height: 1.45; color: var(--ink-2); }

.main {
  flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 20px;
  padding: 28px 32px; overflow-y: auto;
}

.aside {
  width: 352px; flex-shrink: 0; display: flex; flex-direction: column; gap: 22px;
  padding: 28px 24px; background: var(--surface); border-left: 1px solid var(--line); overflow-y: auto;
}
.aside-close { display: none; }

/* ------------------------------------------------------------------------------------------ */
/* Buttons                                                                                    */
/* ------------------------------------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px;
  padding: 0 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  color: var(--ink); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
  text-decoration: none;
}
.btn:hover:not(:disabled) { background: var(--bg); color: var(--ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { border-color: var(--accent); background: var(--accent); color: #fff; font-weight: 600; padding: 0 18px; }
.btn-primary:hover:not(:disabled) { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn-accent { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.btn-accent:hover:not(:disabled) { background: var(--accent-tint); color: var(--accent-ink); }
.btn-danger { color: var(--seal); border-color: #E6CFCD; }
.btn-danger:hover:not(:disabled) { background: var(--seal-tint); color: var(--seal); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-quiet:hover:not(:disabled) { background: var(--hair); }
.btn-block { width: 100%; }
.btn-lg { height: 52px; border-radius: var(--r-lg); font-size: 16px; font-weight: 600; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }

.icon-btn {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--hair); color: var(--ink); }

.avatar {
  width: 40px; height: 40px; border-radius: 20px; border: 0; background: var(--accent-tint);
  color: var(--accent-ink); font-size: 13px; font-weight: 600; cursor: pointer; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.avatar-sm { width: 32px; height: 32px; border-radius: 16px; font-size: 12px; cursor: default; }
.avatar.neutral { background: var(--nav); color: var(--ink-2); }
.avatar.client { background: var(--seal-tint); color: var(--seal); }

/* The brief asks for 44px touch targets; the desktop mockup draws 32 to 40. Both are honoured:
   the drawn sizes for a pointer, the larger ones wherever a finger is doing the pointing. */
@media (pointer: coarse) {
  .btn, .nav-item, .tab { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
}

/* ------------------------------------------------------------------------------------------ */
/* Case view                                                                                  */
/* ------------------------------------------------------------------------------------------ */

.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.crumbs a { text-decoration: none; }
.crumbs button { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-size: 13px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.page-head > div:first-child { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.page-title { font-family: var(--serif); font-size: 34px; font-weight: 500; letter-spacing: -0.3px; line-height: 1.15; overflow-wrap: anywhere; }
.page-sub { font-size: 14px; color: var(--ink-2); }
.page-actions { display: flex; gap: 10px; flex-shrink: 0; flex-wrap: wrap; }

.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  display: flex; align-items: center; gap: 6px; height: 40px; padding: 0; border: 0;
  border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent;
  color: var(--ink-2); font-size: 14px; cursor: pointer; white-space: nowrap;
}
.tab.on { border-bottom-color: var(--accent); color: var(--ink); font-weight: 600; }
.tab .pill { font-size: 12px; padding: 1px 7px; border-radius: 10px; background: var(--nav); color: var(--ink-2); font-weight: 400; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card.clip { overflow: hidden; }
.card.scroll { overflow-x: auto; }
.card-pad { padding: 20px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  padding: 12px; text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-2);
  letter-spacing: 0.3px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid var(--hair); color: var(--ink-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table td.strong { color: var(--ink); }
.table .w-by { width: 150px; } .table .w-size { width: 80px; } .table .w-when { width: 110px; } .table .w-act { width: 36px; }

.row-pick { cursor: pointer; }
.row-pick:hover td { background: #FBFAF7; }
.row-pick.sel td { background: var(--accent-tint); }
.cell-name { display: flex; align-items: center; gap: 12px; color: var(--ink); min-width: 0; }
.cell-name .name { font-weight: 500; overflow-wrap: anywhere; }
.row-pick.sel .cell-name .name { font-weight: 600; }
.cell-name svg { flex-shrink: 0; }
.muted-note { font-size: 12px; color: var(--ink-2); }
.new-pill { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--seal-tint); color: var(--seal); font-weight: 500; white-space: nowrap; }

.dropzone {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 64px;
  padding: 12px; border: 1.5px dashed var(--dash); border-radius: var(--r-lg); color: var(--ink-2);
  font-size: 14px; text-align: center;
}
.dropzone.over { border-color: var(--accent); background: var(--accent-tint); color: var(--accent-ink); }
.progress { height: 4px; border-radius: 2px; background: var(--hair); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width 0.2s; }

/* Details panel */
.aside-title { font-family: var(--serif); font-size: 22px; font-weight: 500; line-height: 1.2; overflow-wrap: anywhere; }
.aside-meta { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.preview {
  min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg);
  color: var(--ink-2); font-size: 13px; overflow: hidden; text-align: center; padding: 12px;
}
.preview.filled { padding: 0; align-items: stretch; justify-content: flex-start; }
.preview img { display: block; width: 100%; height: auto; max-height: 360px; object-fit: contain; background: #fff; }
.preview iframe { display: block; width: 100%; height: 360px; border: 0; background: #fff; }
.preview pre {
  margin: 0; padding: 12px; width: 100%; max-height: 360px; overflow: auto; text-align: left;
  font-family: var(--mono); font-size: 12px; line-height: 1.5; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere;
}
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex-grow: 1; }
.sealed-note { display: flex; gap: 12px; padding: 14px; background: var(--accent-tint); border-radius: var(--r-lg); color: var(--accent-ink); }
.sealed-note svg { flex-shrink: 0; margin-top: 1px; }
.sealed-note strong { display: block; font-size: 13px; font-weight: 600; }
.section-label { font-size: 12px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase; color: var(--ink-2); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person > div { display: flex; flex-direction: column; min-width: 0; }
.person .who { font-size: 14px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.person .role { font-size: 12px; color: var(--ink-2); }
.person .tag { align-self: flex-start; margin-top: 3px; }
.activity-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.activity-row time { color: var(--ink-2); white-space: nowrap; }

/* ------------------------------------------------------------------------------------------ */
/* Forms, notices, tags                                                                       */
/* ------------------------------------------------------------------------------------------ */

.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 14px; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-pair > .field + .field { margin-top: 0; }
.field-pair + .field, .field + .field-pair { margin-top: 14px; }
@media (max-width: 480px) { .field-pair { grid-template-columns: 1fr; gap: 14px; } }
.field label .optional { font-weight: 400; color: var(--ink-2); }
.field label, .label { font-size: 13px; font-weight: 600; }
.input, .select {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--dash); border-radius: var(--r);
  background: var(--surface); font-size: 14px;
}
.input:focus, .select:focus { outline: 2px solid var(--accent-tint); border-color: var(--accent); }
.input-lg { height: 48px; font-size: 16px; }
.input.mono { font-family: var(--mono); font-size: 13px; }
.phone-row { display: flex; align-items: center; gap: 8px; }
.phone-row .phone-cc { width: auto; flex: none; padding: 0 8px; font-family: var(--mono); font-size: 13px; }
.phone-row .input { flex: 1; min-width: 0; }
.phone-flag { flex: none; display: inline-flex; width: 24px; height: 16px; border-radius: 2px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.phone-flag svg { display: block; }
.phone-readout:empty { display: none; }
.hint.phone-readout { color: var(--ink); }
.hint { font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; }
.check input { width: 20px; height: 20px; margin: 0; flex-shrink: 0; accent-color: var(--accent); }
/* Breathing room above a checkbox that sits right under a field (e.g. the shared-computer option). */
.field + .check { margin-top: 18px; }

.notice { padding: 12px 14px; border-radius: var(--r); font-size: 13.5px; line-height: 1.5; border: 1px solid transparent; }
.notice.ok { background: var(--accent-tint); color: var(--accent-ink); border-color: #CFE1DE; }
.notice.err { background: var(--seal-tint); color: var(--seal); border-color: #E6CFCD; }
.notice.info { background: var(--surface); color: var(--ink-2); border-color: var(--line); }
.notice strong { font-weight: 600; }

/* The one-time "turn on notifications" banner (push.js), between the top bar and the page. */
.banner-slot:empty { display: none; }
.banner-slot { padding: 12px 24px 0; flex-shrink: 0; }
.push-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.push-banner-actions { display: flex; align-items: center; gap: 16px; }
@media (max-width: 640px) { .banner-slot { padding: 12px 16px 0; } }
@media print { .banner-slot { display: none; } }
.dlg-steps { margin: 12px 0 0; padding-left: 20px; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.dlg-steps li + li { margin-top: 8px; }
.dlg-steps strong { color: var(--ink); }

.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.tag.ok { background: var(--accent-tint); color: var(--accent-ink); }
.tag.wait { background: #F3EAD3; color: #6B5417; }
.tag.off { background: var(--seal-tint); color: var(--seal); }
.tag.plain { background: var(--nav); color: var(--ink-2); }

.empty { padding: 36px 20px; text-align: center; color: var(--ink-2); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.dim { opacity: 0.6; }
.spacer { flex-grow: 1; }
.right { display: flex; justify-content: flex-end; gap: 8px; }
.copy-line { display: flex; gap: 8px; margin-top: 8px; }
.copy-line .input { flex-grow: 1; min-width: 0; }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar .select { width: auto; min-width: 220px; }

.words { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.words.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.words span {
  padding: 10px 6px; text-align: center; font-weight: 600; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r-sm); overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------------------------------ */
/* Dialogs and menus                                                                          */
/* ------------------------------------------------------------------------------------------ */

dialog.dlg {
  width: calc(100% - 32px); max-width: 480px; padding: 0; border: 1px solid var(--line);
  border-radius: var(--r-xl); box-shadow: var(--shadow-pop); color: var(--ink); background: var(--surface);
}
dialog.dlg.wide { max-width: 620px; }
dialog.dlg::backdrop { background: rgba(27, 26, 23, 0.42); }
.dlg-head { padding: 22px 24px 0; }
.dlg-head h3 { font-family: var(--serif); font-size: 22px; font-weight: 500; line-height: 1.2; }
.dlg-body { padding: 12px 24px 22px; display: flex; flex-direction: column; gap: 14px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--bg); border-radius: 0 0 var(--r-xl) var(--r-xl); }

.menu {
  position: fixed; z-index: 40; min-width: 190px; padding: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column; gap: 2px;
}
.menu button {
  display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border: 0;
  border-radius: var(--r-sm); background: transparent; text-align: left; font-size: 14px; cursor: pointer;
}
.menu button:hover { background: var(--bg); }
.menu button.danger { color: var(--seal); }
.menu button.menu-hint { background: var(--accent-tint); color: var(--accent-ink); font-weight: 600; box-shadow: inset 0 0 0 2px var(--accent); }
.menu hr { width: 100%; border: 0; border-top: 1px solid var(--hair); margin: 4px 0; }
.menu .menu-note { padding: 6px 10px; font-size: 12px; color: var(--ink-2); }

.toasts { position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(520px, calc(100% - 32px)); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: var(--r-lg); background: var(--ink); color: #fff; font-size: 14px; box-shadow: var(--shadow-pop); pointer-events: auto; }
.toast.err { background: var(--seal); }

/* ------------------------------------------------------------------------------------------ */
/* Standalone screens: sign-in, signup, recovery kit, restore, and the client's phone screens  */
/* ------------------------------------------------------------------------------------------ */

.solo { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 28px 20px 32px; }
.solo-brand { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 0 28px; }
.solo-brand .brand-name { font-size: 18px; }
.solo-card {
  width: 100%; max-width: 430px; display: flex; flex-direction: column; gap: 20px; padding: 28px 24px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-card);
}
.solo-card.wide { max-width: 640px; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase; color: var(--ink-2); }
.solo-title { font-family: var(--serif); font-size: 30px; font-weight: 500; line-height: 1.15; }
.solo-text { font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.solo-text strong { color: var(--ink); }
.sms-consent, .legal-note { font-size: 12px; line-height: 1.45; color: var(--ink-3); margin-top: 10px; }
.sms-consent a, .legal-note a { color: inherit; }
.solo-card > .sms-consent { margin: 0 0 -10px; }   /* 10px above its button */
form .sms-consent, form .legal-note { margin-top: 14px; }
.sms-consent + .form-actions, .legal-note + .form-actions { margin-top: 10px; }   /* the same 10px in a form */
.solo-foot { margin-top: 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); text-align: center; max-width: 430px; }
.assurance { display: flex; gap: 12px; margin-top: 24px; padding: 0 8px; max-width: 430px; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.assurance svg { flex-shrink: 0; margin-top: 2px; color: var(--accent); }

.code-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.code-grid input {
  width: 100%; height: 56px; border: 1.5px solid var(--dash); border-radius: var(--r); background: var(--surface);
  text-align: center; font-size: 22px; font-weight: 600;
}
.code-grid input.filled, .code-grid input:focus { border-color: var(--accent); outline: none; }

/* Client case view */
.c-wrap { width: 100%; max-width: 430px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; gap: 20px; padding: 20px 20px 28px; }
.c-top { display: flex; align-items: center; justify-content: space-between; }
.c-firm { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.c-title { font-family: var(--serif); font-size: 28px; font-weight: 500; line-height: 1.15; overflow-wrap: anywhere; }
.c-card { display: flex; flex-direction: column; gap: 4px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.c-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 8px; }
.c-card-head h2 { font-size: 16px; font-weight: 600; }
.c-row { display: flex; align-items: center; gap: 12px; min-height: 56px; border-top: 1px solid var(--hair); }
.c-row > .grow { display: flex; flex-direction: column; flex-grow: 1; min-width: 0; }
.c-row .t { font-size: 15px; overflow-wrap: anywhere; }
.c-row .s { font-size: 12px; color: var(--ink-2); }
.c-row .s.due { color: var(--seal); }
.tick { width: 26px; height: 26px; border-radius: 13px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--dash); }
.tick.done { background: var(--accent); border-color: var(--accent); color: #fff; }
.c-btn { height: 44px; padding: 0 16px; border: 0; border-radius: var(--r); background: var(--accent); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.c-icon-btn { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ------------------------------------------------------------------------------------------ */
/* Narrower screens. The mockup is a fixed 1440px artboard; a real one is not.                */
/* ------------------------------------------------------------------------------------------ */

@media (max-width: 1279px) {
  .nav { width: 232px; }
  .aside { width: 320px; }
  .brand { width: 184px; }
}
@media (max-width: 1099px) {
  /* The details panel slides over the page instead of taking a column from it. */
  .aside {
    position: fixed; z-index: 30; top: 64px; right: 0; bottom: 0; width: min(380px, 100%);
    box-shadow: var(--shadow-pop); transform: translateX(105%); transition: transform 0.18s ease;
  }
  .aside.open { transform: none; }
  .aside-close { display: inline-flex; align-self: flex-end; margin: -12px -8px -10px 0; }
}
@media (max-width: 859px) {
  .menu-toggle { display: inline-flex; }
  .topbar { gap: 12px; padding: 0 12px; }
  .brand { width: auto; }
  .firm-pill { display: none; }
  .btn .lbl { display: none; }
  .btn.has-lbl { padding: 0 12px; }
  .nav {
    position: fixed; z-index: 35; top: 64px; left: 0; bottom: 0; width: min(300px, 88%);
    box-shadow: var(--shadow-pop); transform: translateX(-105%); transition: transform 0.18s ease;
  }
  .nav.open { transform: none; }
  .main { padding: 20px 16px; }
  .page-title { font-size: 28px; }
  .table .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .aside, .nav, .progress > i { transition: none; }
}
@media print {
  .topbar, .nav, .aside, .toasts { display: none !important; }
  .main { overflow: visible; padding: 0; }
  body { background: #fff; }
}

/* ------------------------------------------------------------------------------------------ */
/* Additions made while wiring the screens                                                    */
/* ------------------------------------------------------------------------------------------ */

.tab-body { display: flex; flex-direction: column; gap: 20px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 8px; }
.section-title { font-family: var(--serif); font-size: 20px; font-weight: 500; }
.cell-sub { font-size: 12px; color: var(--ink-2); font-weight: 400; }
.locked-name { color: var(--ink-2); font-style: italic; font-weight: 400; }
.nav-empty { padding: 8px 12px; font-size: 13px; color: var(--ink-2); }
.wait-dot { width: 8px; height: 8px; border-radius: 4px; background: var(--seal); flex-shrink: 0; }
.waiting-chip {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 16px;
  background: var(--seal-tint); color: var(--seal); font-size: 13px; font-weight: 500; white-space: nowrap;
}
.ctx-actions { display: flex; align-items: center; gap: 10px; }
.dlg-text { font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.dlg-text strong { color: var(--ink); }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.two-col .field + .field { margin-top: 0; }
button.link { border: 0; padding: 0; background: none; color: var(--accent); cursor: pointer; text-decoration: underline; font-size: inherit; }
.solo-card form { display: flex; flex-direction: column; }
.solo-card form.stack { gap: 14px; }
.btn svg { flex-shrink: 0; }

/* Printing the recovery kit: the sheet and nothing else. */
.print-sheet { display: none; }
@media print {
  body.printing > *:not(.print-sheet) { display: none !important; }
  body.printing .print-sheet {
    display: block; margin: 0; padding: 24px; font-family: var(--mono); font-size: 12px;
    line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; color: #000;
  }
}
@media (max-width: 859px) {
  .waiting-chip { display: none; }
  /* Read-only says something nothing else on a phone shows, so it stays, shortened. (Storage use
     is on the Staff and keys page.) The search box gives way so the account button - Sign out -
     stays on screen. */
  #ro-chip {
    display: block; min-width: 0; max-width: 34vw; flex-shrink: 1; line-height: 32px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  #ro-chip .ro-until { display: none; }
  .search { min-width: 0; overflow: hidden; }
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .words.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .topbar .brand-name { display: none; }
}

/* Client screens */
.center { align-items: center; text-align: center; }
a.c-row.c-link { text-decoration: none; color: inherit; }
a.c-row.c-link:first-child, .c-card > .c-row:first-child { border-top: 0; }
.c-back { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; text-decoration: none; }
.c-back svg { transform: rotate(180deg); }
.c-card > .c-btn { margin-top: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-card > .progress { margin-top: 12px; }
.c-btn:disabled { opacity: 0.6; cursor: progress; }
.c-icon-btn:disabled { opacity: 0.5; }
.c-wrap .assurance { margin-top: auto; padding: 8px 4px 0; }
.solo-foot a { color: var(--accent); }
.req-row { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--hair); flex-wrap: wrap; }
.req-row:first-child { border-top: 0; }
.req-row .grow { flex-grow: 1; min-width: 180px; }
dialog .req-row { padding: 12px 0; }

.c-btn.quiet { background: var(--surface); color: var(--accent); border: 1px solid var(--line); }
.c-row > .c-btn { flex-shrink: 0; }
#c-lists { display: flex; flex-direction: column; gap: 20px; }

/* A secret typed into a field that is deliberately NOT type=password: browsers offer to save and
   sync password fields whatever autocomplete says, and a firm signing key must not end up in a
   password manager by accident. */
.secret { -webkit-text-security: disc; text-security: disc; }
/* The toast host is shown as a popover so it can sit above a modal dialog; undo the browser's
   popover styling. */
.toasts[popover] { border: 0; padding: 0; margin: 0; background: transparent; overflow: visible; inset: auto auto 24px 50%; }

/* Password meter - GSN's (SetEncryptionPasswordScreen.kt): a 6px bar and a label in its colour. */
.pw-meter { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.pw-track { height: 6px; border-radius: 3px; background: var(--hair); overflow: hidden; }
.pw-track > i { display: block; height: 100%; width: 0; border-radius: 3px; background: currentColor; transition: width 0.3s, color 0.3s; }
.pw-label { font-size: 12.5px; font-weight: 500; }
.pw-meter.weak { color: #E53935; }
.pw-meter.fair { color: #FF9800; }
.pw-meter.strong { color: #43A047; }
.pw-meter.very-strong { color: #00C853; }
@media (prefers-reduced-motion: reduce) { .pw-track > i { transition: none; } }

/* Plan choice on the payment step. Native radios, so the keyboard and screen readers
   behave as they would on any form. */
.plan-pick { display: grid; gap: 10px; border: 0; padding: 0; margin: 0 0 18px; }
.plan-pick legend { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; padding: 0; }
.plan-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--surface); cursor: pointer; }
.plan-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }
.plan-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.plan-opt input { margin-top: 3px; accent-color: var(--accent); }
.plan-opt .plan-name { font-weight: 600; color: var(--ink); }
.plan-opt .plan-meta { font-size: 13px; color: var(--ink-2); }
.plan-opt .plan-price { margin-left: auto; font-weight: 600; white-space: nowrap; color: var(--ink); }
.plan-interval { display: flex; gap: 16px; font-size: 14px; color: var(--ink-2); }
.plan-interval label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.plan-interval input { accent-color: var(--accent); }

/* A firm in its read-only days: buttons that would only be refused are not offered. */
body.read-only [data-write] { display: none !important; }
/* A colleague whose access is still being set up (api auth._require_signed): the same. */
body.unsigned [data-write] { display: none !important; }

/* Help: topics down the side, the chosen one beside them; stacked on a phone. */
.help { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; margin-top: 24px; align-items: start; }
.help-toc { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 16px; }
.help-group { display: flex; flex-direction: column; gap: 2px; }
.help-group + .help-group { margin-top: 16px; }
.help-group-title { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3, #8a8a8a); margin: 0 0 4px; padding: 0 10px; }
.help-link { padding: 7px 10px; border-radius: var(--r-sm, 8px); color: var(--ink-2); text-decoration: none; font-size: 14px; }
.help-link:hover { color: var(--ink); background: var(--surface); }
.help-link.on { color: var(--ink); background: var(--surface); font-weight: 600; }
.help-body { max-width: 720px; line-height: 1.6; font-size: 15px; }
.help-body h2 { font-family: var(--serif); font-size: 24px; font-weight: 500; margin: 0 0 12px; }
.help-body p, .help-body ul, .help-body ol { margin: 0 0 12px; }
.help-body ul, .help-body ol { padding-left: 22px; }
.help-body li { margin-bottom: 6px; }
/* Storage used against the plan, as a bar (the Staff page). */
.usage { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.usage[hidden] { display: none; }
.usage-label { font-size: 13px; color: var(--ink-2); }
.usage-bar { cursor: help; width: 240px; max-width: 60vw; height: 8px; border-radius: 999px;
  background: var(--line); overflow: hidden; }
.usage-bar > span { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--accent); }
.usage-bar.warn > span { background: var(--seal); }

/* A table row being edited in place (the Clients page). */
.table tr.editing td { vertical-align: middle; }
.table .input-cell { height: 34px; font-size: 14px; padding: 0 10px; width: 100%; min-width: 140px; }
.table .cell-stack { display: flex; flex-direction: column; gap: 6px; }
.table .phone-row .phone-cc { width: auto; min-width: 0; height: 34px; padding: 0 6px; }
.table .phone-row .input-cell { min-width: 120px; }
.table .phone-readout { margin-top: 4px; }
.table .row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.table tr.row-note td { padding-top: 0; border-top: 0; }
.table tr.row-note[hidden] { display: none; }
.help-body h3 { font-size: 17px; font-weight: 600; margin: 24px 0 6px; }
/* Instructions: each step labelled "Step 1", "Step 2"... so they read as steps to follow. */
.help-body ol.help-steps { list-style: none; padding-left: 0; counter-reset: step; }
.help-body ol.help-steps > li { counter-increment: step; padding-left: 64px; position: relative; }
.help-body ol.help-steps > li::before { content: "Step " counter(step); position: absolute; left: 0;
  font-weight: 600; color: var(--accent-ink, var(--ink)); }
.help-table { width: 100%; border-collapse: collapse; margin: 0 0 12px; font-size: 14px; }
.help-table th, .help-table td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.help-table th { font-weight: 600; color: var(--ink-2); }
/* Help laid out like GSN Help (2026-10-21): a search box, the quick-start guide, then each subject's
   questions as cards; an article has the subjects down the side and related questions after it. */
.help-search { position: relative; width: 320px; max-width: 100%; }
.help-search input { width: 100%; height: 40px; padding: 0 14px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; }
.help-search input:focus { outline: none; border-color: var(--accent); }
.help-results { position: absolute; top: 46px; left: 0; right: 0; z-index: 20; max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 12px 32px rgba(0,0,0,.12); }
.help-results[hidden] { display: none; }
.help-results a { display: block; padding: 10px 14px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.help-results a:last-child { border-bottom: 0; }
.help-results a:hover, .help-results a.sel { background: var(--accent-tint); }
.help-results b { display: block; font-weight: 600; font-size: 14px; }
.help-results small { display: block; color: var(--ink-2); font-size: 12px; margin-top: 2px; }
.help-none { padding: 12px 14px; color: var(--ink-2); font-size: 14px; }
.help-quick { max-width: none; margin-top: 24px; }
.help-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; align-items: start; }
.help-cat .help-group-title { padding: 0; margin-bottom: 8px; }
.help-cat-list { list-style: none; padding: 0; margin: 0; }
.help-cat-list li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.help-cat-list li:last-child { border-bottom: 0; }
.help-cat-list a { text-decoration: none; }
details.help-group > summary { list-style: none; cursor: pointer; padding: 4px 10px; }
details.help-group > summary::-webkit-details-marker { display: none; }
details.help-group > summary::before { content: "▸"; display: inline-block; width: 12px; transition: transform .15s; }
details.help-group[open] > summary::before { transform: rotate(90deg); }
details.help-group .help-link { display: block; }
.help-crumbs { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.help-crumbs a { text-decoration: none; }
.help-related { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }
.help-related h3 { margin-top: 0; }
.help-related div { padding: 3px 0; }
@media (max-width: 720px) {
  .help { grid-template-columns: 1fr; }
  .help-toc { display: none; }
  .help-search { width: 100%; }
  .help-cats { grid-template-columns: 1fr; }
}

/* v2 client self-recovery: the invitation-code input and the keep-your-email note. */
.ks-code{font-family:var(--mono,ui-monospace,SFMono-Regular,Menlo,monospace);letter-spacing:1px;text-transform:uppercase}
.ks-code::placeholder{letter-spacing:normal;text-transform:none}
.ks-keepmail{display:flex;gap:10px;align-items:center;background:var(--accent-tint);border-color:#CFE1DE}
.ks-keepmail .solo-text{color:var(--accent-ink);margin:0}

/* The Cases page filtered to one client: the note above the list. */
.filter-note { margin-bottom: 12px; }
.nowrap { white-space: nowrap; }

/* Clio (view-clio.js). */
.clio-card { max-width: 720px; margin-top: 16px; line-height: 1.6; }
.clio-card p { margin: 0 0 12px; }
.clio-summary { margin: 0 0 16px; padding-left: 20px; }
.clio-summary li { margin-bottom: 6px; }
