/* SecureDocs redesign (Oct 2026): the staff inbox and the recipient pages.
   Tokens from the developer spec, section 7.2. site.css keeps the Bootstrap-based pages (Users, Billing, legal). */

:root {
  --ink: #0F1B2A;
  --ink-2: #24364A;
  --ink-3: #4A5868;
  --ink-4: #5B6676;
  --ink-5: #8A96A6;
  --accent: #0A6CB0;
  --accent-hover: #08507F;
  --accent-ink: #0A4F80;
  --line: #E3E8EF;
  --line-soft: #EEF1F5;
  --control: #C9D2DD;
  --input: #8A96A6;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --page: #F5F7FA;
  --red-bg: #FDECEA; --red-ink: #B42318; --red-line: #F2B8B5;
  --amber-bg: #FFF4E0; --amber-ink: #8A5100; --amber-line: #F3D9A4;
  --green-bg: #E6F4EA; --green-ink: #1C6B3A; --green-line: #BFE3CB;
  --gray-bg: #EEF1F5; --gray-ink: #4A5868; --gray-line: #D5DCE5;
  --blue-bg: #E5F1FA; --blue-ink: #0A4F80; --blue-line: #9CC3E6;
  --highlight: #FFE58F;
  --radius-control: 10px;
  --radius-card: 12px;
  --font: "Public Sans", "Pretendard Variable", Pretendard, system-ui, -apple-system, "Segoe UI", sans-serif;
}

html { font-size: 15px; }

body.shell-body-el,
body.recipient-body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
}

/* Text links. Buttons that are links (Bootstrap .btn, the redesign's .sd-btn) keep their own text colour. */
body.shell-body-el a:not(.btn):not(.sd-btn) { color: var(--accent); }
body.shell-body-el a:not(.btn):not(.sd-btn):hover { color: var(--accent-hover); }
body.shell-body-el button, body.shell-body-el input, body.shell-body-el textarea, body.shell-body-el select { font: inherit; }
body.shell-body-el :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.recipient-body :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::placeholder { color: var(--ink-4); }
.nowrap { white-space: nowrap; }
.flip { transform: rotate(180deg); }
.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; }
.push-right { margin-left: auto; }

/* ---------------------------------------------------------------- shell */

.shell { min-height: 100vh; display: flex; flex-direction: column; }
.shell-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-link { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
/* The company logo image (wwwroot/images/logo.png), as on the pre-redesign header; the mark alone on small screens. */
.brand-logo { height: 32px; width: auto; display: block; }
.brand-logo-mark { display: none; height: 28px; width: auto; }
.brand-sep { width: 1px; height: 22px; background: var(--gray-line); }
.brand-app { font-size: 18px; font-weight: 700; white-space: nowrap; color: var(--ink) !important; text-decoration: none; }

.search {
  flex: 1 1 280px; max-width: 560px; display: flex; align-items: center; gap: 10px; min-height: 44px;
  padding: 0 4px 0 14px; border: 1px solid var(--control); border-radius: var(--radius-control);
  background: var(--surface-2); color: var(--ink-3); box-sizing: border-box; margin: 0;
}
.search.search-active { border: 2px solid var(--accent); background: var(--surface); padding-left: 13px; }
.search input { flex: 1 1 auto; min-width: 0; min-height: 40px; border: 0; background: transparent; color: var(--ink); font-size: 15px; }
.search input:focus { outline: none; }
.search.search-active input { font-weight: 600; }
.search input::-webkit-search-cancel-button { display: none; }
.header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.avatar-btn {
  width: 44px; height: 44px; border: 0; border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.shell-body { flex: 1 1 auto; display: flex; align-items: stretch; min-height: 0; }

.folder-nav {
  flex: 0 0 240px; width: 240px; box-sizing: border-box; padding: 16px 12px; background: var(--surface);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px;
}
.folder {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: var(--radius-control);
  color: var(--ink); font-size: 15px; font-weight: 500; text-decoration: none;
}
.folder:hover { background: var(--surface-2); color: var(--ink); }
.folder.active { background: var(--blue-bg); color: var(--accent-ink); font-weight: 700; }
.folder-label { flex: 1 1 auto; white-space: nowrap; }
.badge-count {
  min-width: 22px; padding: 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 700; text-align: center; box-sizing: border-box;
}
.badge-blue { background: var(--accent); color: #fff; }
.badge-amber { background: var(--amber-bg); color: var(--amber-ink); }
/* Storage used: a bar (green, amber from 75%, red from 90%) over the "x of y used" line, pinned to the bottom of the menu. */
.storage { margin: auto 12px 0; padding-top: 24px; }
.storage-bar { height: 6px; border-radius: 999px; background: var(--gray-line); overflow: hidden; }
.storage-fill { height: 100%; min-width: 8px; border-radius: 999px; background: #22C55E; }
.storage-fill-high { background: #F59E0B; }
.storage-fill-full { background: var(--red-ink); }
.storage-note { margin: 8px 0 0; font-size: 12px; color: var(--ink-4); }

.shell-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; background: var(--surface); }
.shell-main:not(.shell-main-inbox) { background: var(--page); }
.page { width: 100%; max-width: 1040px; margin: 0 auto; padding: 24px; box-sizing: border-box; }
.page-wide { max-width: 1440px; } /* list pages (Users): wide tables, no sideways scrolling on a normal screen */
.users-table th { white-space: nowrap; }
.users-table .users-name { white-space: nowrap; }
.users-table .users-name .badge { display: block; width: max-content; margin: 4px 0 0 36px; } /* role under the name, aligned with it */
.users-table .users-email { white-space: nowrap; } /* an address is never split; a very long one scrolls the table instead */
.users-table .users-company { min-width: 110px; }
.users-table .users-plan { min-width: 110px; }
.users-table .users-plan .badge { display: inline-block; margin-top: 2px; }
.page-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px 32px; }
.page-title { margin: 0 0 20px; font-size: 24px; font-weight: 700; }
.section-title { margin: 20px 0 10px; font-size: 13px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--ink-4); }

/* ---------------------------------------------------------------- buttons, pills, chips */

.sd-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--radius-control); font-size: 15px; font-weight: 600; cursor: pointer;
  text-decoration: none; box-sizing: border-box; white-space: nowrap; line-height: 1.2;
}
.sd-btn:disabled, .sd-btn[aria-disabled="true"] { cursor: not-allowed; }
.sd-btn-primary { background: var(--accent); color: #fff !important; font-weight: 700; padding: 0 18px; }
.sd-btn-primary:hover { background: var(--accent-hover); color: #fff; }
.sd-btn-primary:disabled { background: var(--line); color: var(--ink-3) !important; }
.sd-btn-secondary { background: var(--surface); color: var(--ink) !important; border-color: var(--control); }
.sd-btn-secondary:hover { background: var(--surface-2); }
.sd-btn-danger-outline { background: var(--surface); color: var(--red-ink) !important; border-color: #E7B4AE; }
.sd-btn-danger-outline:hover { background: var(--red-bg); }
.sd-btn-danger { background: var(--red-ink); color: #fff !important; }
.sd-btn-danger-text { background: transparent; color: var(--red-ink) !important; padding: 0 8px; font-size: 14px; }
.sd-btn-danger-text:hover { background: var(--red-bg); }
.sd-btn-text { background: transparent; color: var(--accent) !important; padding: 0 8px; }
.sd-btn-text:hover { background: var(--blue-bg); }
.sd-btn-link { background: transparent; color: var(--ink-2) !important; padding: 0 8px; font-size: 14px; text-decoration: underline; }
.sd-btn-link:disabled { color: var(--ink-5) !important; }
.sd-btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.sd-btn-block { width: 100%; min-height: 50px; font-size: 17px; font-weight: 700; margin-bottom: 12px; }
.sd-btn-photo { background: var(--blue-bg); color: var(--accent-ink) !important; border-color: var(--accent); font-weight: 700; }
.icon-btn {
  width: 44px; height: 44px; border: 0; border-radius: var(--radius-control); background: transparent; color: var(--ink-3);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: 0 0 auto;
}
.icon-btn:hover { background: var(--gray-bg); color: var(--ink); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 7px; border: 1px solid transparent; border-radius: 999px;
  font-size: 13px; font-weight: 600; white-space: nowrap; flex: 0 0 auto;
}
.pill-red { background: var(--red-bg); color: var(--red-ink); border-color: var(--red-line); }
.pill-amber { background: var(--amber-bg); color: var(--amber-ink); border-color: var(--amber-line); }
.pill-green { background: var(--green-bg); color: var(--green-ink); border-color: var(--green-line); }
.pill-gray { background: var(--gray-bg); color: var(--gray-ink); border-color: var(--gray-line); }
.pill-blue { background: var(--blue-bg); color: var(--blue-ink); border-color: var(--blue-line); }

.tone-red { color: var(--red-ink); }
.tone-amber { color: var(--amber-ink); }
.tone-green { color: var(--green-ink); }
.tone-gray { color: var(--ink-3); }
.tone-blue { color: var(--accent-ink); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 1px solid var(--control); border-radius: 999px;
  background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.chip:hover { background: var(--surface-2); color: var(--ink); }
.chip.chip-on { border-color: var(--accent); background: var(--blue-bg); color: var(--accent-ink); }
.chip b { font-weight: 700; }
.chip-add-btn { border-style: dashed; border-color: var(--input); color: var(--ink-3); }
.chip-static { padding: 3px 10px; border: 1px solid #DDE3EA; border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 600; }

.notice {
  display: flex; align-items: flex-start; gap: 10px; margin: 12px 20px 0; padding: 10px 14px; border: 1px solid; border-radius: var(--radius-card); font-size: 14px;
}
.notice-blue { background: var(--blue-bg); color: var(--blue-ink); border-color: var(--blue-line); }
.notice-green { background: var(--green-bg); color: var(--green-ink); border-color: var(--green-line); margin: 0 0 14px; }
.notice-red { background: var(--red-bg); color: var(--red-ink); border-color: var(--red-line); }
.form-error { display: flex; align-items: flex-start; gap: 6px; margin: 0 0 12px; font-size: 14px; font-weight: 600; color: var(--red-ink); }
.form-error svg { flex: 0 0 auto; margin-top: 2px; }

/* ---------------------------------------------------------------- inbox: list */

.inbox { flex: 1 1 auto; display: flex; min-height: 0; }
.list-pane {
  flex: 0 0 auto; width: var(--list-w, 50%); min-width: 350px; max-width: calc(100% - 357px); box-sizing: border-box;
  display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface);
}
/* The splitter between the panes: a 7px grab area over the list's right border (inbox.js sets --list-w on #inbox). */
.pane-splitter { flex: 0 0 7px; margin: 0 -3px 0 -4px; position: relative; z-index: 1; cursor: col-resize; touch-action: none; }
.pane-splitter::before {
  content: ""; position: absolute; left: 2px; top: 50%; width: 3px; height: 36px; margin-top: -18px; border-radius: 999px; background: var(--control);
}
.pane-splitter::after { content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 1px; background: transparent; }
.pane-splitter:hover::before, .pane-splitter.active::before, .pane-splitter:focus-visible::before { background: var(--accent); }
.pane-splitter:hover::after, .pane-splitter.active::after, .pane-splitter:focus-visible::after { left: 2px; width: 3px; background: var(--accent); }
.pane-splitter:focus-visible { outline: none; }
body.is-resizing { cursor: col-resize; user-select: none; }
body.is-resizing .list-pane, body.is-resizing .detail-pane { pointer-events: none; }
.list-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line-soft); }
.list-head-plain { padding: 0 0 12px; border: 0; }
.list-title { margin: 0; font-size: 20px; font-weight: 700; }
.list-note { font-size: 13px; color: var(--ink-4); }
.rows { list-style: none; margin: 0; padding: 0; overflow: auto; }
/* Inbox list rows. Not named "row": Bootstrap's .row grid (negative gutters, 100% children) is loaded on these pages too. */
.inbox-row {
  display: flex; flex-direction: column; gap: 3px; padding: 14px 20px; border-bottom: 1px solid var(--line-soft);
  color: var(--ink) !important; text-decoration: none; background: var(--surface); box-shadow: none;
}
.inbox-row:hover { background: var(--surface-2); }
.inbox-row.selected { background: var(--blue-bg); box-shadow: inset 3px 0 0 var(--accent); }
.row-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.row-subject { min-width: 0; font-size: 16px; font-weight: 600; line-height: 1.35; }
.row-subject.unread { font-weight: 700; }
/* A subject segment ("Claim# 26-AU-041872", a file name) stays on one line when it fits; a segment wider than the
   column (long file names on a phone) wraps inside itself instead of running over the date. */
.subject-seg { display: inline-block; max-width: 100%; white-space: normal; overflow-wrap: anywhere; margin-right: 0.3em; vertical-align: top; }
.subject-hit { padding: 0 3px; border-radius: 4px; background: var(--highlight); color: inherit; }
.row-date { flex: 0 0 auto; padding-top: 2px; font-size: 13px; color: var(--ink-4); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-email { font-size: 15px; font-weight: 500; color: var(--ink-2); overflow-wrap: anywhere; }
.row-email.hit, .row-summary.hit span { background: var(--highlight); border-radius: 4px; padding: 0 3px; }
.row-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-top: 2px; }
.row-summary { flex: 1 1 120px; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-4); }
.row-summary svg { flex: 0 0 auto; }
.row-summary span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-timeleft { font-size: 13px; font-weight: 600; }
.rows-search .inbox-row { padding: 14px 24px; gap: 4px; }
.type-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 7px; border-radius: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.2px;
}
.type-sent { background: var(--gray-bg); color: var(--ink-2); }
.type-received { background: var(--blue-bg); color: var(--accent-ink); }
.type-request { background: var(--amber-bg); color: var(--amber-ink); }

.search-page { flex: 1 1 auto; display: flex; flex-direction: column; background: var(--surface); }
.search-head { display: flex; flex-direction: column; gap: 12px; padding: 18px 24px 14px; border-bottom: 1px solid var(--line-soft); }
.chips-filter { gap: 6px; }

.empty { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 64px 24px; text-align: center; }
.empty-icon { width: 56px; height: 56px; border-radius: 999px; background: var(--gray-bg); color: var(--ink-3); display: flex; align-items: center; justify-content: center; }
.empty h1, .empty h2 { margin: 0; font-size: 20px; font-weight: 700; }
.empty p { margin: 0; max-width: 440px; font-size: 15px; color: var(--ink-3); }
.empty .sd-btn { margin-top: 8px; }

/* ---------------------------------------------------------------- inbox: detail */

.detail-pane { flex: 1 1 0; min-width: 350px; box-sizing: border-box; padding: 24px; background: var(--surface-2); overflow: auto; }
.detail { display: flex; flex-direction: column; gap: 16px; }
.detail-back { display: none; align-self: flex-start; margin: -8px 0 -4px -8px; }
.detail-head { display: flex; flex-direction: column; gap: 6px; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.detail-subject-wrap { display: flex; align-items: flex-start; gap: 4px; }
.detail-subject { margin: 0; font-size: 22px; font-weight: 700; line-height: 1.3; flex: 1 1 auto; min-width: 0; }
.detail-subject .subject-seg:last-child { margin-right: 0; }
.detail-email { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 16px; font-weight: 500; color: var(--ink-2); overflow-wrap: anywhere; }
.detail-email-label { font-weight: 400; color: var(--ink-4); }
.subject-edit { display: flex; flex-direction: column; gap: 8px; }
.subject-edit-actions { display: flex; gap: 8px; }
.subject-input {
  width: 100%; min-height: 72px; padding: 11px 14px; border: 1px solid var(--input); border-radius: var(--radius-control); background: var(--surface);
  color: var(--ink); font-size: 15px; font-weight: 600; line-height: 1.5; resize: none; box-sizing: border-box;
}

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid; border-radius: var(--radius-card); }
.banner-icon { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 999px; color: #fff; display: flex; align-items: center; justify-content: center; }
.banner-text { min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.banner-text strong { font-size: 15px; font-weight: 700; }
.banner-green { background: var(--green-bg); border-color: var(--green-line); color: #14532D; } .banner-green .banner-icon { background: var(--green-ink); }
.banner-red { background: var(--red-bg); border-color: var(--red-line); color: #7A1A12; } .banner-red .banner-icon { background: var(--red-ink); }
.banner-amber { background: var(--amber-bg); border-color: var(--amber-line); color: #6B3E00; } .banner-amber .banner-icon { background: var(--amber-ink); }
.banner-blue { background: var(--blue-bg); border-color: var(--blue-line); color: var(--accent-ink); } .banner-blue .banner-icon { background: var(--accent); }
.banner-gray { background: var(--gray-bg); border-color: var(--gray-line); color: var(--ink-2); } .banner-gray .banner-icon { background: var(--ink-3); }

.card { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 12px; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.card-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.card-note { font-size: 13px; color: var(--ink-4); }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.card-actions form { margin: 0; }
.deletion-line { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.thumb { margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.thumb-box { height: 76px; border-radius: var(--radius-control); background: #E3EAF2; color: var(--ink-4); display: flex; align-items: center; justify-content: center; text-decoration: none; }
.thumb:nth-child(4n+2) .thumb-box { background: #E9E4F0; } .thumb:nth-child(4n+3) .thumb-box { background: #E2EEE7; } .thumb:nth-child(4n) .thumb-box { background: #F2EADF; }
.thumb figcaption { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file, .recipient-files li { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); }
.file-kind { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 8px; background: var(--red-bg); color: var(--red-ink); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; letter-spacing: -0.2px; }
.file-deleted .file-kind { background: var(--gray-bg); color: var(--ink-5); }
.file-deleted .file-name { color: var(--ink-3); }
.file-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.file-name { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.file-size { font-size: 13px; color: var(--ink-4); }
.file-status { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; text-decoration: none; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actions form { margin: 0; }
.action-note { margin: -8px 0 0; font-size: 13px; color: var(--ink-4); }

.progress-steps { list-style: none; margin: 0; padding: 14px 12px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); display: flex; align-items: flex-start; }
.progress-step { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.progress-line { flex: 0 0 32px; height: 2px; margin-top: 13px; background: var(--control); }
.progress-dot { width: 28px; height: 28px; box-sizing: border-box; border: 2px dashed var(--input); border-radius: 999px; background: var(--surface); display: flex; align-items: center; justify-content: center; color: #fff; }
.progress-step.done .progress-dot { border: 0; background: var(--green-ink); }
.progress-label { font-size: 13px; font-weight: 600; color: var(--ink-3); }
.progress-step.done .progress-label { color: var(--ink); }
.progress-when { font-size: 12px; color: var(--ink-4); }

.asked-for { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.asked-for-label { font-size: 13px; font-weight: 600; color: var(--ink-4); }

.timeline, .related { display: flex; flex-direction: column; gap: 6px; }
.timeline-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.timeline-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.timeline-head span { font-size: 12px; color: var(--ink-4); }
.timeline-head a { font-size: 14px; font-weight: 600; }
.timeline ol { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; align-items: center; gap: 10px; min-height: 36px; border-top: 1px solid var(--line); font-size: 14px; }
.timeline li.pending { color: var(--ink-4); }
.timeline-icon { flex: 0 0 auto; width: 24px; height: 24px; box-sizing: border-box; border-radius: 999px; display: flex; align-items: center; justify-content: center; }
.timeline-icon.tone-gray { background: var(--gray-bg); color: var(--ink-3); }
.timeline-icon.tone-green { background: var(--green-bg); color: var(--green-ink); }
.timeline-icon.tone-amber { background: var(--amber-bg); color: var(--amber-ink); }
.timeline-icon.tone-red { background: var(--red-bg); color: var(--red-ink); }
.timeline-icon.tone-blue { background: var(--blue-bg); color: var(--accent-ink); }
.timeline-icon.dashed { background: var(--surface); border: 1.5px dashed var(--input); color: var(--input); }
.timeline-text { flex: 1 1 auto; min-width: 0; }
.timeline-when { flex: 0 0 auto; font-size: 13px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.related ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.related-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); color: var(--ink) !important; text-decoration: none; }
.related-row:hover { border-color: var(--control); }
.related-icon { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.related-icon.type-sent { background: var(--gray-bg); color: var(--ink-3); }
.related-icon.type-received { background: var(--blue-bg); color: var(--accent-ink); }
.related-icon.type-request { background: var(--amber-bg); color: var(--amber-ink); }
.related-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.related-title { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.related-email { font-size: 13px; color: var(--ink-3); overflow-wrap: anywhere; }
.related .pill { padding: 2px 9px 2px 7px; font-size: 12px; border-color: transparent; }

/* ---------------------------------------------------------------- first run */

.first-run { width: 100%; max-width: 840px; margin: 0 auto; padding: 48px 24px 56px; box-sizing: border-box; display: flex; flex-direction: column; gap: 32px; }
.first-run-hero { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.first-run-icon { width: 56px; height: 56px; border-radius: 999px; background: var(--blue-bg); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; }
.first-run-hero h1 { margin: 0; font-size: 26px; font-weight: 700; }
.first-run-hero p { margin: 0; max-width: 560px; font-size: 16px; color: var(--ink-3); }
.first-run-cards { display: flex; flex-wrap: wrap; gap: 16px; }
.start-card { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 24px; border: 1px solid var(--control); border-radius: 16px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.start-card:hover { border-color: var(--accent); }
.start-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.start-icon.blue { background: var(--blue-bg); color: var(--accent-ink); }
.start-icon.amber { background: var(--amber-bg); color: var(--amber-ink); }
.start-title { font-size: 19px; font-weight: 700; }
.start-text { font-size: 15px; color: var(--ink-3); }
.start-card .sd-btn { margin-top: 6px; }
.how { display: flex; flex-direction: column; gap: 14px; padding-top: 24px; border-top: 1px solid var(--line-soft); }
.how h2 { margin: 0; font-size: 16px; font-weight: 700; }
.how ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 20px; }
.how li { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.how-num { width: 28px; height: 28px; border-radius: 999px; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.how-title { font-size: 15px; font-weight: 700; }
.how-text { font-size: 14px; color: var(--ink-3); }
.how-example { margin-top: 4px; padding: 8px 10px; border: 1px dashed var(--control); border-radius: 8px; background: var(--surface-2); font-size: 13px; font-weight: 600; color: var(--ink-2); }
.how-example span { display: block; font-size: 12px; color: var(--ink-4); }
.first-run-foot { margin: 0; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; color: var(--ink-4); text-align: center; }

/* ---------------------------------------------------------------- drawers */

.drawer-backdrop { position: fixed; inset: 0; background: rgba(15, 27, 42, 0.42); z-index: 1040; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 100%; max-width: 500px; box-sizing: border-box; background: var(--surface);
  box-shadow: -16px 0 40px rgba(15, 27, 42, 0.22); display: flex; flex-direction: column; z-index: 1050;
}
.drawer[hidden], .drawer-backdrop[hidden] { display: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 14px 24px; border-bottom: 1px solid var(--line-soft); }
.drawer-title { margin: 0; font-size: 20px; font-weight: 700; }
.drawer-form { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; margin: 0; }
.drawer-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 16px 24px; display: flex; flex-direction: column; gap: 14px; }
.drawer-foot { display: flex; flex-direction: column; gap: 10px; padding: 12px 24px 14px; border-top: 1px solid var(--line-soft); }
.drawer-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; position: relative; }
.field label, .field-label, .field legend { font-size: 14px; font-weight: 600; padding: 0; margin: 0; }
.field .optional { font-weight: 400; color: var(--ink-4); }
.field input[type="email"], .field input[type="text"], .field textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--input); border-radius: var(--radius-control); background: var(--surface);
  color: var(--ink); font-size: 16px; font-weight: 500; box-sizing: border-box;
}
.field textarea { font-size: 15px; line-height: 1.5; resize: vertical; min-height: 60px; }
.field textarea.subject-input { font-weight: 600; resize: none; }
.hint { margin: 0; display: flex; align-items: flex-start; gap: 6px; font-size: 13px; color: var(--ink-4); }
.hint strong { font-weight: 600; color: var(--ink-2); }
.hint.hint-amber { color: var(--amber-ink); font-weight: 600; }
.hint.hint-known { color: var(--ink-3); }
.suggestions { position: absolute; top: 100%; left: 0; right: 0; z-index: 5; margin-top: -24px; background: var(--surface); border: 1px solid var(--control); border-radius: var(--radius-control); box-shadow: 0 10px 30px rgba(15, 27, 42, 0.16); overflow: hidden; }
.suggestions[hidden] { display: none; }
.suggestion { display: block; width: 100%; padding: 10px 14px; border: 0; background: transparent; text-align: left; font-size: 14px; font-weight: 600; cursor: pointer; }
.suggestion:hover, .suggestion.active { background: var(--blue-bg); }
.suggestion small { display: block; font-weight: 400; color: var(--ink-4); }
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file-list:empty { display: none; }
.staged { display: flex; align-items: center; gap: 12px; padding: 8px 6px 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-control); }
.staged.error { border-color: var(--red-line); background: #FEF6F5; }
.staged .file-kind { width: 36px; height: 36px; font-size: 11px; }
.staged.error .file-kind { background: var(--gray-bg); color: var(--ink-3); }
.staged-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.staged-name { font-weight: 600; overflow-wrap: anywhere; }
.staged-meta { font-size: 13px; color: var(--ink-3); }
.staged.ready .staged-meta { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--green-ink); }
.staged.error .staged-meta { font-weight: 600; color: var(--red-ink); }
.staged-bar { display: block; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.staged-bar span { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--accent); transition: width 0.2s; }
.staged .icon-btn { border-radius: 8px; }
.staged.error .icon-btn { color: var(--red-ink); }
.add-files {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; width: 100%; border: 1.5px dashed var(--input); border-radius: var(--radius-control);
  background: var(--surface-2); color: var(--accent); font-size: 15px; font-weight: 600; cursor: pointer;
}
.add-files.dragover { border-color: var(--accent); background: var(--blue-bg); }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
.check input { flex: 0 0 auto; width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.preview { display: flex; flex-direction: column; gap: 8px; padding: 8px 14px 10px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface-2); }
.preview-title { font-size: 13px; font-weight: 700; color: var(--ink-3); }
.preview dl { margin: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.preview dl div { display: flex; align-items: flex-start; gap: 12px; }
.preview dt { flex: 0 0 56px; color: var(--ink-4); }
.preview dd { flex: 1 1 auto; margin: 0; min-width: 0; }
.preview-subject { font-weight: 600; }
.preview-body { margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 13px; color: var(--ink-2); }
.preview-empty { margin: 0; display: flex; align-items: flex-start; gap: 6px; padding: 10px 12px; border: 1px solid var(--amber-line); border-radius: 8px; background: var(--amber-bg); font-size: 13px; font-weight: 600; color: var(--amber-ink); }
.preview-note { margin: 0; display: flex; align-items: flex-start; gap: 6px; font-size: 13px; color: var(--ink-3); }
.preview-note svg, .preview-empty svg { flex: 0 0 auto; margin-top: 2px; }
.chip-add { margin-top: 8px; }
.chip-add input { width: 100%; min-height: 44px; padding: 0 14px; border: 1px solid var(--input); border-radius: var(--radius-control); font-size: 15px; box-sizing: border-box; }

.confirm {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 1060; width: min(440px, calc(100vw - 32px)); box-sizing: border-box;
  padding: 24px; border-radius: 16px; background: var(--surface); box-shadow: 0 24px 60px rgba(15, 27, 42, 0.3);
}
.confirm[hidden] { display: none; }
.confirm-title { margin: 0 0 8px; font-size: 18px; font-weight: 700; }
.confirm-text { margin: 0 0 20px; font-size: 15px; color: var(--ink-2); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }

.toast-host { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 1070; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 4px 6px 4px 16px; border-radius: var(--radius-card); background: var(--ink); color: #fff;
  box-shadow: 0 10px 30px rgba(15, 27, 42, 0.28); font-size: 14px; white-space: nowrap; max-width: calc(100vw - 32px);
}
.toast strong { font-weight: 700; }
.toast .sd-btn { min-height: 44px; padding: 0 12px; color: #8CC8F5 !important; font-weight: 700; background: transparent; }
.toast .sd-btn:hover { background: rgba(255,255,255,0.08); }
.toast svg { color: #5FD08A; flex: 0 0 auto; }
.toast-plain { padding: 10px 16px; }

/* ---------------------------------------------------------------- recipient pages */

.recipient { min-height: 100vh; box-sizing: border-box; padding: 24px 16px 40px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.recipient-card {
  width: 100%; max-width: 440px; box-sizing: border-box; padding: 22px 22px 20px; border: 1px solid var(--gray-line); border-radius: 24px; background: var(--surface);
  box-shadow: 0 12px 32px rgba(15, 27, 42, 0.10); display: flex; flex-direction: column; gap: 16px;
}
.recipient-brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.recipient-firm { font-size: 15px; font-weight: 800; }
.recipient-secure { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-4); }
.recipient-hero { align-self: center; width: 64px; height: 64px; margin-top: 10px; border-radius: 999px; display: flex; align-items: center; justify-content: center; }
.recipient-hero.blue { background: var(--blue-bg); color: var(--accent-ink); }
.recipient-hero.gray { background: var(--gray-bg); color: var(--ink-3); }
.recipient-hero.amber { background: var(--amber-bg); color: var(--amber-ink); }
.recipient-hero.green { width: 72px; height: 72px; background: var(--green-ink); color: #fff; }
.recipient-title { display: flex; flex-direction: column; gap: 4px; text-align: center; }
.recipient-title.left { text-align: left; margin-top: 8px; }
.recipient-title h1, .recipient-h1 { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.3; }
.recipient-h1 { margin-top: 8px; }
.recipient-title p { margin: 0; font-size: 15px; color: var(--ink-3); }
.recipient-title p.dark { color: var(--ink-2); }
.recipient-subject { padding: 10px 12px; border-radius: var(--radius-control); background: #F3F5F8; font-size: 13px; font-weight: 600; text-align: center; }
.recipient-subject.left { text-align: left; }
.recipient-text { margin: 0; font-size: 15px; }
.recipient-text.center { text-align: center; color: var(--ink-3); font-size: 14px; }
.recipient-small { margin: 0; font-size: 13px; color: var(--ink-3); }
.recipient-small.center { text-align: center; font-size: 12px; }
.recipient-until { margin: 0; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; color: var(--ink-3); }
.recipient-foot { margin: auto 0 0; padding-top: 14px; border-top: 1px solid var(--line-soft); font-size: 13px; color: var(--ink-3); text-align: center; }
.recipient-foot a { font-weight: 600; white-space: nowrap; color: var(--accent); }
.recipient-powered { margin: 0; font-size: 12px; color: var(--ink-3); text-align: center; }
.recipient-legal { margin: 0; font-size: 12px; color: var(--ink-4); text-align: center; }
.recipient-powered a, .recipient-legal a { color: var(--ink-3); text-decoration: underline; }
.recipient-powered a:hover, .recipient-legal a:hover { color: var(--accent); }
.inbox-banner-host:empty { display: none; }
.inbox-banner-host { padding: 12px 20px 0; }
.inbox-banner-host .alert { margin: 0; }
.recipient-message { padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-control); background: var(--surface-2); }
.recipient-message span { font-size: 12px; font-weight: 600; color: var(--ink-4); }
.recipient-message p { margin: 2px 0 0; font-size: 14px; white-space: pre-line; }
.recipient-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.recipient-files li { gap: 10px; min-height: 60px; }
.recipient-files .file-kind { width: 32px; height: 32px; }
.code-form { display: flex; flex-direction: column; gap: 14px; position: relative; }
.code-boxes { display: flex; gap: 8px; }
.code-box { flex: 1 1 0; height: 56px; box-sizing: border-box; border: 1.5px solid var(--input); border-radius: var(--radius-control); display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; }
.code-box.filled { border-color: var(--ink-2); }
.code-box.current { border: 2px solid var(--accent); }
.code-error .code-box { border: 2px solid var(--red-ink); }
.code-input { position: absolute; top: 0; left: 0; width: 100%; height: 56px; opacity: 0.01; font-size: 24px; letter-spacing: 1em; }
.code-form.no-js .code-input { position: static; opacity: 1; height: 56px; padding: 0 14px; border: 1.5px solid var(--input); border-radius: var(--radius-control); font-size: 24px; font-weight: 700; letter-spacing: 0.5em; text-align: center; box-sizing: border-box; }
.code-form.no-js .code-boxes { display: none; }
.code-form .sd-btn-block { margin: 0; }
.checklist { list-style: none; margin: 0; padding: 2px 14px; border: 1px solid #DDE3EA; border-radius: var(--radius-card); }
.checklist li { display: flex; align-items: center; gap: 12px; min-height: 50px; border-bottom: 1px solid var(--line-soft); font-size: 16px; font-weight: 600; }
.checklist li:last-child { border-bottom: 0; }
.checklist li svg { flex: 0 0 auto; color: var(--ink-4); }
.checklist li.done svg { color: var(--green-ink); }
.checklist li > span { display: flex; flex-direction: column; }
.checklist-name { font-size: 15px; font-weight: 600; }
.checklist-files { font-size: 12px; font-weight: 400; color: var(--ink-4); }
.tip { padding: 12px 14px; border: 1px solid var(--amber-line); border-radius: var(--radius-card); background: #FFF8EB; font-size: 14px; color: #4A3200; }
.timer-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--amber-bg); color: var(--amber-ink); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer-pill.ended { background: var(--red-bg); color: var(--red-ink); }
.slots { display: flex; flex-direction: column; gap: 10px; }
.slot { padding: 12px 14px; border: 1px solid #DDE3EA; border-radius: var(--radius-card); display: flex; flex-direction: column; gap: 10px; }
.slot.slot-done { border-color: var(--green-line); background: #F2FAF4; }
.slot.slot-collapsed { display: none; }
.slot-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.slot-name { font-size: 16px; font-weight: 700; }
.slot-state { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; color: var(--green-ink); }
.slot-state[hidden] { display: none; }
.slot-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.slot-files:empty { display: none; }
.slot-file { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 8px 4px 8px 10px; border: 1px solid transparent; border-radius: var(--radius-control); }
.slot-file .file-kind { width: 32px; height: 32px; font-size: 10px; background: var(--blue-bg); color: var(--accent-ink); }
.slot-file-name { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.slot-file-meta { font-size: 13px; color: var(--ink-3); }
.slot-file.uploading .staged-bar { margin-top: 4px; }
.slot-file.error { border-color: var(--red-line); background: #FEF6F5; }
.slot-file.error .slot-file-meta { font-weight: 600; color: var(--red-ink); }
.slot-file.error .file-kind { background: var(--gray-bg); color: var(--ink-3); }
.slot-file.stopped { border-color: var(--amber-line); background: #FFF8EB; }
.slot-file.stopped .slot-file-meta { font-weight: 600; color: var(--amber-ink); }
.slot-actions { display: flex; gap: 8px; }
.slot-actions .sd-btn { flex: 1 1 0; min-height: 48px; }
.add-other { align-self: flex-start; padding: 0 4px; margin-top: 4px; }
.help-box { margin: 0; padding: 12px 14px; border-radius: var(--radius-card); background: #F3F5F8; font-size: 14px; color: var(--ink-2); }
.done-form { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.done-form .sd-btn-block { margin: 0; }
.plain-card { text-align: center; padding: 16px 0 8px; }
.plain-eyebrow { margin: 0 0 4px; font-size: 13px; color: var(--ink-4); }
.plain-card h1 { margin: 0 0 8px; font-size: 22px; font-weight: 700; }
.plain-card p { margin: 0; color: var(--ink-3); }

/* ---------------------------------------------------------------- responsive (spec 7.1) */

@media (max-width: 1199px) {
  .folder-nav { flex-basis: 64px; width: 64px; padding: 16px 8px; align-items: stretch; }
  .folder { justify-content: center; padding: 0; gap: 0; position: relative; }
  .folder-label { display: none; }
  .folder .badge-count { position: absolute; top: 4px; right: 4px; min-width: 18px; padding: 0 5px; font-size: 11px; }
  .search { max-width: none; }
}

@media (max-width: 899px) {
  .shell-header { padding: 10px 16px; }
  .brand-logo, .brand-sep { display: none; }
  .brand-logo-mark { display: block; }
  .header-actions .sd-btn { padding: 0 12px; }
  .header-actions .sd-btn svg + * { display: none; }
  .search { order: 3; flex-basis: 100%; }
  .inbox .detail-pane { display: none; }
  .inbox.show-detail .list-pane { display: none; }
  .inbox.show-detail .detail-pane { display: block; }
  .detail-back { display: inline-flex; }
  .list-pane, .detail-pane { min-width: 0; border-right: 0; }
  .list-pane { flex: 1 1 auto; width: auto; max-width: none; }
  .pane-splitter { display: none; }
  .drawer { max-width: none; }
  .page { padding: 16px; }
  .page-card { padding: 20px 16px; }
  .thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .recipient { padding: 12px 8px 32px; }
  .recipient-card { border-radius: 18px; padding: 18px 16px 16px; }
  .how ol { flex-direction: column; }
}

@media print {
  .shell-header, .folder-nav, .drawer, .drawer-backdrop, .toast-host, .actions, .detail-back, .pane-splitter { display: none !important; }
  .detail-pane { padding: 0; background: #fff; }
}

/* "Test environment" strip (also on the recipient pages, which do not load site.css) */
.env-banner { background: #fff3cd; color: #664d03; border-bottom: 1px solid #ffe69c; padding: 4px 16px; font-size: 13px; font-weight: 600; text-align: center; }
