:root {
  --navy: #0a1a2e;
  --navy-2: #13294a;
  --red: #be1828;
  --blue: #1b5fa8;
  --blue-soft: #e8f0fa;
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #dde2ea;
  --ink: #111827;
  --muted: #4b5563;
  --ok: #146c43;
  --ok-soft: #e3f4ea;
  --warn: #8a5300;
  --warn-soft: #fdf1dc;
  --bad: #b3261e;
  --bad-soft: #fbe7e5;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(10, 26, 46, .06), 0 4px 14px rgba(10, 26, 46, .06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif; }
[hidden] { display: none !important; }
h1 { font-size: 22px; line-height: 1.25; margin: 0; letter-spacing: -.01em; }
a { color: var(--blue); }
small { color: var(--muted); font-weight: 400; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.fine { font-size: 13px; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-family: inherit; font-weight: 600; font-size: 14px; line-height: 1; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: #b8c1cf; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: #a3121f; }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn:focus-visible, .nav:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .drop:focus-visible, .row:focus-visible { outline: 3px solid #7fb0e8; outline-offset: 2px; }
.link { color: #fff; font-size: 14px; }

/* ---- sign in ---- */
.signin, body.center { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 20% -10%, #1d3a64 0%, var(--navy) 55%); }
.signin-card, .card.narrow { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 36px 32px; text-align: center; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.signin-card h1, .card.narrow h1 { font-size: 26px; margin: 14px 0 8px; }
.signin-card h1 span, .brand span { color: var(--red); }
.signin-card p { color: var(--muted); margin: 0 0 22px; }
.signin-card .stage-badge { display: inline-block; margin: 0 0 18px; }
.btn.ms { width: 100%; min-height: 46px; font-size: 15px; background: #fff; border-color: #8c8c8c; }
.btn.ms:hover { background: #f3f3f3; }
.signin-card .fine { margin: 18px 0 0; }
.card.narrow p { color: var(--muted); }
.card.narrow .btn { margin-top: 8px; }

/* ---- layout ---- */
.app { display: grid; grid-template-columns: 236px 1fr; grid-template-rows: 60px 1fr; height: 100vh; }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 20px; padding: 0 20px; background: var(--navy); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 17px; white-space: nowrap; }
.brand span { color: #ff6b77; }
.stage-badge { background: #f2b705; color: #1a1300; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border-radius: 6px; padding: 3px 8px; white-space: nowrap; }
.org { flex: 1; display: flex; align-items: center; gap: 10px; font-weight: 600; min-width: 0; }
.org span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org select { background: var(--navy-2); color: #fff; border: 1px solid #39537a; border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 14px; max-width: 260px; }
.user { display: flex; align-items: center; gap: 16px; font-size: 14px; color: #d6deea; white-space: nowrap; }
.user .avatar { width: 32px; height: 32px; margin-right: -6px; border-radius: 50%; overflow: hidden; flex: none; display: grid; place-items: center;
  background: #2f4a73; color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .02em; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.user .avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.side { padding: 18px 14px; border-right: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.send-btn { margin-bottom: 14px; min-height: 44px; }
.nav { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 500; }
.nav:hover { background: var(--bg); }
.nav.on { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.count { background: var(--red); color: #fff; border-radius: 999px; font-size: 12px; font-weight: 700; padding: 1px 8px; min-width: 22px; text-align: center; }
.numbers { margin-top: auto; padding: 14px 12px 4px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.numbers b { display: block; color: var(--ink); font-size: 14px; }

.main { overflow: hidden; min-width: 0; }

/* ---- folder ---- */
.folder { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; height: 100%; }
.list-pane { display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #fff; min-height: 0; }
.list-head { padding: 18px 18px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 12px; }
.list-head input { width: 100%; }
.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid #edf0f4; cursor: pointer; }
.row:hover { background: #f8fafc; }
.row.on { background: var(--blue-soft); }
.row .doc { width: 40px; height: 48px; border: 1px solid var(--line); border-radius: 4px; background: #fff linear-gradient(#e5e9ef, #e5e9ef) 7px 10px / 22px 2px no-repeat; position: relative; }
.row .doc::after { content: ""; position: absolute; left: 7px; right: 7px; top: 16px; height: 18px; background: repeating-linear-gradient(#e5e9ef 0 2px, transparent 2px 6px); }
.row .who { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.unread .who { font-weight: 700; }
.row.unread .doc { border-color: var(--red); box-shadow: inset 3px 0 0 var(--red); }
.row .meta { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row > * { min-width: 0; }
.row .who, .row .meta { display: block; }
.row .when { font-size: 13px; color: var(--muted); text-align: right; white-space: nowrap; }
.chip { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 1px 9px; margin-top: 4px; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.empty { padding: 28px 18px; color: var(--muted); text-align: center; }

.preview-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.preview-empty { margin: auto; text-align: center; color: var(--muted); opacity: .9; }
.preview-empty img { opacity: .35; }
.pv-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-start; justify-content: space-between; padding: 16px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.pv-head h2 { margin: 0 0 4px; font-size: 18px; }
.pv-facts { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; color: var(--muted); }
.pv-facts b { color: var(--ink); font-weight: 600; }
.pv-note { margin: 6px 0 0; }
.pv-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pv-back { display: none; }
.pv-alert { margin: 0; padding: 10px 20px; background: var(--bad-soft); color: var(--bad); border-bottom: 1px solid #f1c7c3; }
.pv-flag { margin: 0; padding: 10px 20px; background: var(--warn-soft); color: #5c3a00; border-bottom: 1px solid #efd9a8; font-size: 14px; }
.pv-flag span { display: block; margin-top: 2px; }
.pv-name { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.pv-name label { flex: 1 1 260px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters select { min-height: 36px; padding: 6px 10px; font-size: 14px; }
.tag-filter { border: 1px solid var(--blue); background: var(--blue-soft); color: var(--blue); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.tag { display: inline-block; margin: 4px 4px 0 0; border: 1px solid #c9d3e1; background: #f3f6fa; color: #24364f; border-radius: 999px; padding: 0 9px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; line-height: 20px; }
.tag:hover { border-color: var(--blue); color: var(--blue); }
.assignee { display: inline-block; margin: 4px 0 0 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.pv-work, .pv-fwd { display: grid; grid-template-columns: minmax(160px, 220px) 1fr; gap: 10px 14px; padding: 12px 20px; background: #fbfcfd; border-bottom: 1px solid var(--line); }
.pv-work label, .pv-fwd label { font-size: 13px; }
.pv-work .wide, .pv-fwd .wide, .pv-fwd fieldset, .pv-fwd .fwd-fax, .pv-fwd .fwd-email { grid-column: 1 / -1; }
.pv-work input, .pv-work select, .pv-work textarea, .pv-fwd input, .pv-fwd textarea { min-height: 36px; padding: 6px 10px; font-size: 14px; }
.pv-fwd { background: #f5f9ff; }
.pv-fwd fieldset { border: 0; margin: 0; padding: 0; display: flex; gap: 18px; align-items: center; }
.pv-fwd legend { font-weight: 700; font-size: 14px; margin-right: 12px; float: left; }
.pv-fwd .fwd-fax { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.work-actions { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; }
.pv-doc { flex: 1; border: 0; width: 100%; background: #525659; }
.pv-msg { margin: auto; padding: 24px; text-align: center; color: var(--muted); max-width: 420px; }

/* ---- forms ---- */
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #b8c1cf; border-radius: 8px; padding: 9px 12px; min-height: 42px; }
textarea { resize: vertical; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 600; }
label.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--red); }

.send, .activity { height: 100%; overflow-y: auto; padding: 28px 24px 48px; }
.send-layout { display: grid; grid-template-columns: minmax(0, 640px) minmax(280px, 420px); gap: 24px; justify-content: center; align-items: start; }
.send .card, .page .card { max-width: 720px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); display: grid; gap: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.drop { border: 2px dashed #b8c1cf; border-radius: 12px; padding: 26px 16px; text-align: center; color: var(--muted); cursor: pointer; background: #fafbfd; }
.drop p { margin: 6px 0 0; }
.drop b { color: var(--ink); }
.drop.over { border-color: var(--blue); background: var(--blue-soft); }
.files { list-style: none; margin: -6px 0 0; padding: 0; display: grid; gap: 8px; }
.files li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.files li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files li small { white-space: nowrap; }
.files button { border: 0; background: none; color: var(--bad); font-family: inherit; font-weight: 600; font-size: 13px; cursor: pointer; padding: 4px 6px; }
#coverFields { display: grid; gap: 16px; }
.error { margin: 0; padding: 10px 14px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); font-weight: 500; }
.actions { display: flex; gap: 10px; }

/* ---- nav groups ---- */
.nav-group { display: grid; gap: 2px; margin-bottom: 10px; }
.nav-head { margin: 6px 12px 4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* ---- phone pages ---- */
.page { height: 100%; overflow-y: auto; padding: 28px 24px 48px; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.page-head .sub { margin: 4px 0 0; }
.page-head input { width: 260px; max-width: 100%; }
.calls td { vertical-align: middle; }
.call-who { display: flex; align-items: center; gap: 10px; }
.call-who b { display: block; font-weight: 600; }
.call-who small { display: block; }
.dir { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--blue-soft); color: var(--blue); }
.dir.missed { background: var(--bad-soft); color: var(--bad); }
.dir.out { background: var(--ok-soft); color: var(--ok); }
.more { text-align: center; margin: 16px 0 0; }
.vm-list, .team { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.vm { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: grid; gap: 10px; }
.vm.new { border-left: 4px solid var(--red); }
.vm-top { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: space-between; }
.vm-top b { font-size: 16px; }
.vm-top .fine { margin: 0; }
.vm audio { width: 100%; max-width: 520px; height: 40px; }
.vm-text { margin: 0; color: var(--ink); background: var(--bg); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.team { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.member { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: grid; gap: 6px; }
.member-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.member b { font-size: 16px; }
.dot { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.dot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #9aa5b4; }
.dot.on { color: var(--ok); }
.dot.on::before { background: #1f9d55; }
.member .fine { margin: 0; }
.empty-card { background: #fff; border: 1px dashed #b8c1cf; border-radius: 12px; padding: 24px; color: var(--muted); text-align: center; }

/* ---- cover options ---- */
.flags { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.flags legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; padding: 0; }
.flags label { display: flex; align-items: center; gap: 7px; font-weight: 500; font-size: 14px; }
.flags input { width: 17px; height: 17px; min-height: 0; accent-color: var(--red); }
.cover-preview { position: sticky; top: 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; height: min(78vh, 640px); }
.cp-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.cp-head .fine { margin: 0; }
.cover-preview iframe { flex: 1; border: 0; width: 100%; background: #525659; }
.page .card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 24px; box-shadow: var(--shadow); display: grid; gap: 16px; }
.logo-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.logo-box { width: 220px; height: 80px; border: 1px dashed #b8c1cf; border-radius: 10px; display: grid; place-items: center; background: #fff; padding: 8px; }
.logo-box img { max-width: 100%; max-height: 100%; }
.logo-actions { flex: 1 1 240px; display: grid; gap: 8px; justify-items: start; }
.logo-actions .fine { margin: 0; }

/* ---- settings tabs, admin ---- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab { padding: 9px 14px; border-radius: 8px 8px 0 0; color: var(--ink); text-decoration: none; font-weight: 500; border: 1px solid transparent; margin-bottom: -1px; }
.tab.on { border-color: var(--line); border-bottom-color: var(--bg); background: var(--bg); color: var(--blue); font-weight: 600; }
.narrow-card { max-width: 720px; }
.card h2 { font-size: 16px; margin: 6px 0 -4px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.inline-form label { flex: 1 1 200px; }
.role-pick { min-height: 34px; padding: 4px 8px; font-size: 13px; }
.linkish { border: 0; background: none; color: var(--bad); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 0; }
.more-opts { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.more-opts summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.more-opts[open] { display: grid; gap: 14px; }
.usage-pick { display: flex; gap: 8px; align-items: center; }
.usage-pick input { min-height: 36px; padding: 5px 10px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; margin-top: 20px; align-items: start; }
.client-link { border: 0; background: none; color: var(--blue); font: inherit; font-weight: 600; cursor: pointer; padding: 0; text-align: left; }
.muted-row td { color: var(--muted); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.pv-banner { margin: 0; padding: 10px 20px; background: var(--blue-soft); color: #173b66; border-bottom: 1px solid #c9dbf2; font-size: 14px; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }

/* ---- recipients, address book ---- */
.to-wrap { position: relative; }
.suggest { position: absolute; top: 100%; left: 0; right: 0; z-index: 5; list-style: none; margin: 4px 0 0; padding: 4px; background: #fff; border: 1px solid #b8c1cf; border-radius: 8px; box-shadow: var(--shadow); max-height: 240px; overflow-y: auto; }
.suggest li { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-weight: 500; font-size: 14px; display: flex; justify-content: space-between; gap: 10px; }
.suggest li small { color: var(--muted); }
.suggest li.on, .suggest li:hover { background: var(--blue-soft); }
.list-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.contact-name { min-height: 34px; padding: 4px 8px; font-size: 14px; width: 100%; max-width: 320px; }
.row-actions { display: flex; gap: 8px; align-items: center; white-space: nowrap; }

/* ---- OneDrive / SharePoint picker ---- */
.cloud-box { width: min(640px, 100%); height: min(80vh, 680px); }
.cloud-tabs { display: flex; gap: 4px; padding: 10px 16px 0; border-bottom: 1px solid var(--line); }
.cloud-tabs .tab { border: 1px solid transparent; background: none; font: inherit; cursor: pointer; }
.cloud-search { padding: 10px 16px 0; }
.cloud-search input { width: 100%; }
.cloud-list { list-style: none; margin: 0; padding: 8px 16px; overflow-y: auto; flex: 1; }
.cloud-list li { border-bottom: 1px solid #edf0f4; }
.cloud-list button { width: 100%; text-align: left; border: 0; background: none; padding: 10px 6px; font: inherit; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; color: var(--ink); }
.cloud-list button:hover { background: var(--bg); }
.cloud-list small { color: var(--muted); }
.cloud-list .up button { color: var(--blue); font-weight: 600; }
.cloud-list .note { padding: 14px 6px; color: var(--muted); border: 0; }
.cloud-save { display: flex; gap: 10px; align-items: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); }
.cloud-save label { flex: 1; }
#cloudError { margin: 0 16px 12px; }
.files li.converting span::after { content: " (converting to PDF…)"; color: var(--muted); }

.header-sample { font-family: Helvetica, Arial, sans-serif; font-size: 12px; background: #fff; border: 1px solid var(--line); padding: 2px 6px; display: inline-block; margin-top: 4px; color: var(--ink); }
.attach-more { margin: -8px 0 0; }
.cloud-list .file-row button span::before { content: "📄 "; }

/* ---- sign and send back ---- */
.sign-box { width: min(1100px, 100%); height: 94vh; }
.sign-tools { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); align-items: center; }
.sign-tools .link-like { border-color: transparent; color: var(--blue); margin-left: auto; }
.sign-pages { flex: 1; overflow: auto; background: #525659; padding: 20px; display: grid; gap: 20px; justify-content: center; }
.sign-pages.placing .sign-page { cursor: crosshair; }
.sign-page { position: relative; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
.sign-page canvas { display: block; width: 100%; height: 100%; }
.sign-item { position: absolute; cursor: move; outline: 1px dashed #1b5fa8; outline-offset: 2px; touch-action: none; }
.sign-item img { width: 100%; height: 100%; display: block; pointer-events: none; }
.sign-text .txt { display: inline-block; min-width: 20px; padding: 0 2px; color: #000; font-family: Helvetica, Arial, sans-serif; line-height: 1.15; cursor: text; outline: none; white-space: pre; }
.sign-check, .sign-cross { width: 26px; height: 26px; font-size: 24px; line-height: 26px; text-align: center; color: #000; font-weight: 700; }
.sign-x { position: absolute; top: -12px; right: -12px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--bad); color: #fff; font-size: 14px; line-height: 22px; cursor: pointer; padding: 0; }
.sign-loading { color: #fff; }
.sigpad { z-index: 30; }
.sigpad-box { width: min(620px, 100%); height: auto; padding-bottom: 16px; }
.sigpad-box canvas { margin: 16px auto 0; display: block; width: min(560px, calc(100% - 32px)); border: 1px solid #b8c1cf; border-radius: 8px; touch-action: none; background: #fff; }
.sigpad-row { padding: 12px 20px 0; }

.hit { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }
.hit mark { background: #fff1b8; color: var(--ink); padding: 0 1px; border-radius: 2px; }
.index-note { margin: 0; }

.rule-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rule-list li { display: flex; gap: 12px; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.rule-list li.off { opacity: .6; }
.rule-list b { display: block; }
.rule-list small { color: var(--muted); }
#ruleForm { margin-top: 16px; }

.line-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.line-list li { display: grid; grid-template-columns: 150px 1fr 1.5fr auto; gap: 10px; align-items: end; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.line-list .num { font-weight: 600; padding-bottom: 10px; }
.line-list input { min-height: 36px; padding: 6px 10px; font-size: 14px; }
@media (max-width: 900px) { .line-list li { grid-template-columns: 1fr; } }

/* ---- activity ---- */
.activity h1 { margin-bottom: 4px; }
.sub { color: var(--muted); margin: 0 0 18px; }
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid #edf0f4; vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; background: #fafbfd; }
td.nowrap { white-space: nowrap; }

.link-btn { margin-left: auto; border-color: transparent; }
.modal { position: fixed; inset: 0; background: rgba(10, 26, 46, .6); display: grid; place-items: center; padding: 24px; z-index: 20; }
.modal-box { width: min(980px, 100%); height: min(92vh, 1100px); background: #fff; border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.modal-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-head .fine { margin: 2px 0 0; }
.modal-doc { flex: 1; border: 0; width: 100%; background: #525659; }
@media (max-width: 1180px) {
  .send-layout { grid-template-columns: 1fr; }
  .cover-preview { position: static; height: 560px; max-width: 640px; width: 100%; margin: 0 auto; }
}

@media (max-width: 900px) { .modal { padding: 0; } .modal-box { height: 100vh; border-radius: 0; } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); font-weight: 500; z-index: 10; max-width: calc(100% - 32px); }

/* ---- small screens ---- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; height: auto; min-height: 100vh; }
  .top { flex-wrap: wrap; gap: 6px 16px; padding: 10px 16px; }
  .org { order: 3; flex-basis: 100%; }
  .user { margin-left: auto; }
  .user #userName { display: none; }
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .send-btn { margin: 0 6px 0 0; min-height: 40px; }
  .numbers { display: none; }
  .main { overflow: visible; }
  .folder { display: block; height: auto; }
  .list-pane { border-right: 0; }
  .preview-pane { display: none; }
  .folder.viewing .list-pane { display: none; }
  .folder.viewing .preview-pane { display: flex; height: calc(100vh - 120px); }
  .pv-back { display: inline-flex; }
  .send, .activity, .page { padding: 20px 16px 40px; height: auto; }
  .nav-group { display: contents; }
  .nav-head { display: none; }
  .calls th:nth-child(2), .calls td:nth-child(2) { display: none; }
  .send .card { padding: 20px 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .send-layout { grid-template-columns: 1fr; }
  .cover-preview { position: static; height: 520px; }
  .pv-work, .pv-fwd, .pv-fwd .fwd-fax { grid-template-columns: 1fr; }
}

/* Per-fax history */
.pv-hist { border-bottom: 1px solid var(--line); padding: 10px 20px; background: #fbfcfd; }
.pv-hist[open] .hist-body { max-height: 320px; overflow: auto; }
.pv-hist summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.pv-hist summary small { font-weight: 400; color: var(--muted, #5b6676); margin-left: 6px; }
.hist { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.hist th { text-align: left; font-weight: 600; color: var(--muted, #5b6676); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.hist td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.hist td:first-child { white-space: nowrap; }
.hist .fine { display: block; margin-top: 2px; word-break: break-word; }
.hist-foot { margin: 10px 0 0; }
@media (max-width: 640px) { .hist td:first-child { white-space: normal; } }

/* Activity log filters */
.audit-filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; margin: 14px 0 12px; }
.audit-filters label { font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.audit-filters .grow { flex: 1 1 200px; }
.audit-filters select, .audit-filters input { min-height: 34px; }
.audit-more { margin: 12px 0 0; }

/* Usage & costs */
.usage-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 16px 0; }
.ucard { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.ucard span { font-size: 13px; color: var(--muted); }
.ucard b { font-size: 22px; }
.ucard small { font-size: 13px; color: var(--muted); }
.usage-table tfoot th, .usage-table tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
.rates { margin: 16px 0; }
.rates summary { cursor: pointer; font-weight: 600; }
.rates summary small { font-weight: 400; color: var(--muted); }
.rates-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 14px; margin-top: 12px; }
.rates-form label { font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.rates-form .actions, .rates-form .wide { grid-column: 1 / -1; }
fieldset.billing { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px 12px; }
fieldset.billing legend { font-size: 13px; font-weight: 600; padding: 0 4px; }

/* ---- Icons, navigation and toolbars ---- */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 18px; height: 18px; flex: none; }
.nav { justify-content: flex-start; gap: 12px; min-height: 40px; color: #334155; }
.nav .ic { color: #64748b; }
.nav:hover .ic { color: var(--ink); }
.nav.on .ic { color: var(--blue); }
.nav .count { margin-left: auto; }
.nav-group { margin-bottom: 14px; }
.nav-head { margin: 4px 12px 6px; }
.send-btn { margin-bottom: 20px; box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }

/* Fax view: title row, then one toolbar row of grouped buttons */
.pv-head { flex-direction: column; align-items: stretch; gap: 12px; }
.pv-actions { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding: 0 20px 14px; background: #fff; border-bottom: 1px solid var(--line); margin-top: -1px; }
.pv-head + .pv-actions { padding-top: 0; }
.tgroup { display: inline-flex; }
.tgroup > .btn { border-radius: 0; margin-left: -1px; }
.tgroup > .btn:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.tgroup > .btn:last-child { border-radius: 0 8px 8px 0; }
.tgroup > .btn:only-child { border-radius: 8px; }
.tgroup > .btn:hover { position: relative; z-index: 1; background: #f8fafc; }
.tgroup > .btn.primary:hover { background: #a3121f; }
.pv-actions .btn { gap: 6px; color: #1e293b; }
.pv-actions .btn.primary { color: #fff; }
.pv-actions .btn .ic { width: 16px; height: 16px; color: #475569; }
.pv-actions .btn.primary .ic { color: #fff; }

/* More menu */
.menu { position: relative; margin-left: auto; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { background: #f1f5f9; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 220px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 23, 42, .14); display: grid; }
.menu-list > button, .menu-list > a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 6px; background: none; color: var(--ink); font: inherit; font-size: 14px; text-align: left; text-decoration: none; cursor: pointer; }
.menu-list > button:hover, .menu-list > a:hover, .menu-list > button:focus-visible, .menu-list > a:focus-visible { background: #f1f5f9; }
.menu-list .ic { width: 16px; height: 16px; color: #475569; }

.print-frame { position: fixed; right: 0; bottom: 0; width: 1px; height: 1px; border: 0; opacity: 0; pointer-events: none; }

/* Narrow fax panes: the less-used buttons (marked .slim) show only their icon, then Print and Archive too. */
.preview-pane { container-type: inline-size; }
.pv-actions .btn { position: relative; }
@container (max-width: 860px) {
  .pv-actions .btn.slim, .pv-actions .menu > summary { padding: 6px 9px; }
  .pv-actions .btn.slim span, .pv-actions .menu > summary span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@container (max-width: 700px) {
  .pv-actions .btn[data-act="print"], .pv-actions .btn[data-act="archive"], .pv-actions .btn[data-act="unarchive"] { padding: 6px 9px; }
  .pv-actions .btn[data-act="print"] span, .pv-actions .btn[data-act="archive"] span, .pv-actions .btn[data-act="unarchive"] span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.usage-table td small { white-space: nowrap; }
.usage-table td:first-child small { white-space: normal; }
.usage-table .btn { white-space: nowrap; }
.card.rates { max-width: none; width: auto; margin: 16px 0; }

/* Phone columns on the usage page appear only on the VoIP site */
#admin .voice-col { display: none; }
#admin.with-phone th.voice-col, #admin.with-phone td.voice-col { display: table-cell; }
#admin.with-phone label.voice-col { display: flex; }
#admin.with-phone p.voice-col { display: block; }
.rates-sub { grid-column: 1 / -1; margin: 8px 0 0; font-weight: 700; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.usage-table th:first-child, .usage-table td:first-child { min-width: 180px; }

/* Help & support */
.help-hero { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: flex-end; justify-content: space-between; padding: 26px 28px; margin-bottom: 18px; border-radius: 16px;
  background: linear-gradient(135deg, #0a1a2e 0%, #17325a 60%, #23477a 100%); color: #fff; }
.help-hero h1 { margin: 0 0 4px; font-size: 28px; color: #fff; }
.help-hero .sub { margin: 0; color: #d6deea; max-width: 520px; }
.help-search { flex: 1 1 320px; max-width: 460px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border-radius: 10px; background: #fff; color: #64748b; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.help-search input { flex: 1; border: 0; outline: 0; min-height: 48px; font-size: 15px; background: transparent; }
.help-search:focus-within { outline: 3px solid #7fb0e8; }
.quick-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 26px; }
@media (max-width: 1100px) { .quick-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .quick-cards { grid-template-columns: 1fr; } }
.qcard { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; row-gap: 2px; align-items: center; text-align: left; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; font: inherit; color: var(--ink); box-shadow: 0 1px 2px rgba(15,23,42,.05); transition: border-color .15s, box-shadow .15s, transform .15s; }
.qcard:hover { border-color: #b8c7dc; box-shadow: 0 6px 18px rgba(15,23,42,.08); transform: translateY(-1px); }
.qcard .qicon { grid-row: 1 / 3; }
.qcard b { font-size: 14px; }
.qcard small { color: var(--muted); font-size: 13px; line-height: 1.35; }
.qicon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--blue-soft); color: var(--blue); flex: none; }
.qicon .ic { width: 20px; height: 20px; }
.help-layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 26px; align-items: start; }
.help-group { margin-bottom: 24px; }
.help-group h2 { display: flex; align-items: center; gap: 10px; font-size: 15px; margin: 0 0 10px; color: var(--ink); }
.gicon { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #f1f5f9; color: #475569; }
.gicon .ic { width: 16px; height: 16px; }
.guide { background: #fff; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; transition: box-shadow .15s; }
.guide[open] { box-shadow: 0 6px 18px rgba(15,23,42,.06); border-color: #c9d4e3; }
.guide > summary { cursor: pointer; padding: 13px 16px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.guide > summary::-webkit-details-marker { display: none; }
.guide > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid #94a3b8; border-bottom: 2px solid #94a3b8; transform: rotate(45deg); transition: transform .15s; flex: none; margin-right: 4px; }
.guide[open] > summary::after { transform: rotate(-135deg); }
.guide[open] > summary { border-bottom: 1px solid var(--line); }
.guide-body { padding: 6px 18px 14px; font-size: 14px; line-height: 1.65; color: #334155; }
.guide-body ul { padding-left: 20px; }
.guide-body li { margin: 5px 0; }
.guide-body ol { list-style: none; padding-left: 0; counter-reset: step; }
.guide-body ol > li { counter-increment: step; position: relative; padding-left: 38px; margin: 10px 0; }
.guide-body ol > li::before { content: counter(step); position: absolute; left: 0; top: -1px; width: 26px; height: 26px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.help-side { display: grid; gap: 14px; position: sticky; top: 16px; }
.help-side .card { padding: 18px; }
.help-side h2 { margin: 0; font-size: 16px; }
.side-head { display: flex; gap: 12px; align-items: flex-start; }
.side-head .fine { margin: 4px 0 0; }
.side-card { display: flex; gap: 12px; align-items: flex-start; }
.side-card p { margin: 4px 0 0; }
.side-link { text-decoration: none; color: var(--ink); transition: border-color .15s; }
.side-link:hover { border-color: #b8c7dc; }
.support-form { display: grid; gap: 12px; }
.support-form label { display: grid; gap: 4px; font-size: 13px; }
.support-form label.check { display: flex; align-items: flex-start; gap: 8px; }
.support-form textarea { width: 100%; }
.support-form .btn .ic { width: 16px; height: 16px; }
@media (max-width: 1000px) { .help-layout { grid-template-columns: 1fr; } .help-side { position: static; } }

/* Address book cards */
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.contact-form { margin: 0 0 18px; padding: 18px; display: grid; gap: 14px; }
.contact-form h2 { margin: 0; font-size: 17px; }
.cf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 14px; }
.cf-grid label { display: grid; gap: 4px; font-size: 13px; }
.cf-grid .wide { grid-column: 1 / -1; }
.cf-numbers { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: grid; gap: 8px; }
.cf-numbers legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.cf-num { display: grid; grid-template-columns: minmax(120px, 200px) minmax(150px, 220px) auto; gap: 8px; align-items: center; }
.num-chip { display: inline-block; margin: 0 8px 4px 0; white-space: nowrap; }
.num-chip small { color: var(--muted); }
.linkish.danger { color: var(--red); margin-left: auto; }
@media (max-width: 640px) { .cf-num { grid-template-columns: 1fr; } }
.page .card.contact-form { max-width: none; margin: 0 0 18px; }

/* Secure link page for recipients */
.share-page { text-align: center; max-width: 440px; }
.share-page form { display: grid; gap: 12px; justify-items: center; margin-top: 8px; }
.share-code label { display: grid; gap: 6px; font-size: 13px; text-align: left; }
.share-code input { font-size: 24px; letter-spacing: 8px; text-align: center; width: 220px; padding: 10px; }
.share-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.share-alt { margin-top: 4px; }
.share-foot { margin-top: 18px; }

/* Printable documents (security summary) */
body.doc-page { background: #f4f6f9; }
body.doc-page .doc { max-width: 820px; margin: 32px auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 40px 48px; color: #1e293b; line-height: 1.6; }
body.doc-page .doc-head { display: flex; gap: 18px; align-items: flex-start; border-bottom: 2px solid var(--red); padding-bottom: 18px; margin-bottom: 8px; }
body.doc-page .doc-kicker { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--red); }
body.doc-page .doc h1 { margin: 2px 0 6px; font-size: 30px; }
body.doc-page .doc-lede { margin: 0; color: #475569; }
body.doc-page .doc h2 { font-size: 18px; margin: 26px 0 8px; color: var(--navy, #0a1a2e); }
body.doc-page .doc ul { padding-left: 20px; margin: 0; }
body.doc-page .doc li { margin: 6px 0; }
body.doc-page .doc-table { border-collapse: collapse; width: 100%; font-size: 14px; }
body.doc-page .doc-table th { text-align: left; width: 130px; padding: 8px 12px 8px 0; vertical-align: top; }
body.doc-page .doc-table td { padding: 8px 0; border-bottom: 1px solid var(--line); }
body.doc-page .doc dt { font-weight: 700; margin-top: 12px; }
body.doc-page .doc dd { margin: 4px 0 0; color: #334155; }
body.doc-page .doc-foot { margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; }
@media (max-width: 640px) { body.doc-page .doc { margin: 0; border-radius: 0; padding: 24px 18px; } body.doc-page .doc-head { flex-direction: column; } }
@media print { body.doc-page { background: #fff; } body.doc-page .doc { border: 0; margin: 0; padding: 0; max-width: none; } body.doc-page .doc a { color: inherit; text-decoration: none; } }

/* Recipient chips */
.to-wrap { display: grid; gap: 4px; position: relative; font-size: 14px; }
.to-label { font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 44px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: text; }
.chips:focus-within { outline: 3px solid #7fb0e8; outline-offset: 1px; }
.chip-list { display: contents; }
.chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 4px 4px 10px; border-radius: 999px; background: var(--blue-soft); color: var(--ink); font-size: 13px; }
.chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { border: 0; background: none; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; font-size: 16px; line-height: 1; color: #475569; }
.chip button:hover { background: rgba(15, 23, 42, .1); }
.chips input { flex: 1 1 140px; min-width: 120px; border: 0; outline: 0; padding: 6px 2px; font: inherit; background: transparent; }
.to-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.chips { position: relative; }
/* Address-book picker */
.pick-box { width: min(620px, 100%); height: min(80vh, 760px); }
.pick-list { list-style: none; margin: 0; padding: 6px 10px; overflow-y: auto; flex: 1; }
.pick-list li label { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 10px 8px; border-bottom: 1px solid #eef1f5; cursor: pointer; font-size: 14px; }
.pick-list li label:hover { background: #f8fafc; }
.pick-mail { color: var(--muted); }
.pick-foot { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); }
.pick-foot .fine { margin-right: auto; }
.help-side .card { margin: 0; max-width: none; width: auto; }

/* Recipient rows on Send a fax */
.recips { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 14px; margin: 0; display: grid; gap: 8px; background: #fbfcfd; }
.recips legend { font-weight: 700; padding: 0 6px; font-size: 15px; }
.recip-head, .recip-row { display: grid; grid-template-columns: minmax(0, 1fr) 138px minmax(0, 1fr) 54px 46px 40px 28px; gap: 6px; align-items: center; }
.recip-head span:nth-child(n+4) { text-align: center; font-size: 11px; line-height: 1.2; }
.r-check { display: grid; justify-items: center; }
.r-check input { width: 18px; height: 18px; }
.r-check input:disabled { opacity: .35; }
.recip-key { margin: 0; }
.recip-row input:not([type=checkbox]) { padding-left: 9px; padding-right: 9px; font-size: 14px; }
.recip-head { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 2px; }

.recip-rows { display: grid; gap: 8px; }
.recip-row input:not([type=checkbox]) { width: 100%; min-height: 40px; }
.recip-row input.bad { border-color: var(--red); background: #fff5f5; }
.r-save { display: grid; justify-items: center; gap: 0; font-size: 11px; color: var(--muted); }
.r-save input { width: 18px; height: 18px; }
.r-rm { border: 0; background: none; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 18px; color: #64748b; }
.r-rm:hover { background: #eef2f6; color: var(--red); }
.recips .to-tools { margin-top: 2px; }
.recips .to-tools .btn .ic { width: 16px; height: 16px; }
.recip-tip { margin: 0; }
.recips .suggest { position: absolute; z-index: 30; }
@media (max-width: 760px) {
  .recip-head { display: none; }
  .recip-row { grid-template-columns: 1fr 1fr auto auto auto auto; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .recip-row .r-email { grid-column: 1 / 3; }
}

/* First-page thumbnails in the fax list */
.row .doc.has-thumb { background: #fff; overflow: hidden; }
.row .doc.has-thumb::after { display: none; }
.row .doc img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }

/* Dashboard */
.nav-home { margin-bottom: 8px; }
.dash-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.dash-head h1 { margin: 0 0 2px; font-size: 26px; }
.dash-head .sub { margin: 0; }
.dash-actions { display: flex; gap: 10px; }
.dash-actions .btn .ic { width: 16px; height: 16px; }
.dash-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 20px; }
.dcard { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.dcard:hover { border-color: #b8c7dc; box-shadow: 0 6px 18px rgba(15,23,42,.07); }
.dcard-body { display: grid; gap: 1px; min-width: 0; }
.dcard-body small { color: var(--muted); font-size: 13px; }
.dcard-body b { font-size: 26px; line-height: 1.15; }
.dcard-body span { color: var(--muted); font-size: 13px; }
.dcard.hot { border-color: #f1b3b8; background: #fff8f8; }
.dcard.hot .qicon { background: #fde2e4; color: var(--red); }
.dcard.warn .qicon { background: #fff1d6; color: #92590a; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.dpanel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.dpanel h2 { display: flex; align-items: center; gap: 10px; font-size: 15px; margin: 0 0 8px; }
.dmore { margin-left: auto; font-size: 13px; font-weight: 500; }
.dlist { list-style: none; margin: 0; padding: 0; }
.dlist li a { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-top: 1px solid #eef1f5; color: var(--ink); text-decoration: none; }
.dlist li:first-child a { border-top: 0; }
.dlist li a:hover { background: #f8fafc; }
.di-main { display: grid; min-width: 0; flex: 1; }
.di-main b, .di-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.di-main small { color: var(--muted); font-size: 13px; }
.di-when { color: var(--muted); font-size: 13px; white-space: nowrap; }
.dempty { color: var(--muted); font-size: 14px; margin: 6px 0; }
.dstat { margin: 6px 0; }
.bad-text { color: var(--red); }
/* Call quality */
.qdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.qdot.good, .qfill.good { background: #16a34a; }
.qdot.fair, .qfill.fair { background: #d97706; }
.qdot.poor, .qfill.poor { background: #dc2626; }
.qbadge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.qbadge small { color: var(--muted); font-weight: 500; }
.qsum { display: flex; gap: 18px; align-items: center; margin: 6px 0 4px; }
.qbig { display: grid; justify-items: center; padding: 10px 14px; border-radius: 12px; background: #f0fdf4; min-width: 96px; }
.qbig b { font-size: 30px; line-height: 1; }
.qbig small { color: var(--muted); font-size: 12px; text-align: center; }
.qbig.good b { color: #15803d; } .qbig.fair { background: #fffbeb; } .qbig.fair b { color: #b45309; } .qbig.poor { background: #fef2f2; } .qbig.poor b { color: #b91c1c; }
.qbars { flex: 1; display: grid; gap: 6px; }
.qbar { display: grid; grid-template-columns: 40px 1fr 28px; gap: 8px; align-items: center; font-size: 13px; }
.qtrack { height: 8px; border-radius: 999px; background: #eef1f5; overflow: hidden; }
.qfill { display: block; height: 100%; border-radius: 999px; }
.call-row { cursor: pointer; }
.call-row:hover, .call-row.open { background: #f8fafc; }
.call-detail td { background: #f8fafc; padding: 4px 16px 14px; }
.cdl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 4px 0 0; font-size: 13px; }
.cdl dt { color: var(--muted); }
.cdl dd { margin: 0; }

.drow { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-top: 1px solid #eef1f5; }
.dlist li:first-child .drow { border-top: 0; }
.drow .btn .ic { width: 15px; height: 15px; }

/* Freedom Tech overview */
.health { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-bottom: 16px; }
.hpill { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.hpill b { display: block; font-size: 14px; }
.hpill small { color: var(--muted); font-size: 12px; }
.hdot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: #94a3b8; box-shadow: 0 0 0 4px #f1f5f9; }
.hpill.ok .hdot { background: #16a34a; box-shadow: 0 0 0 4px #dcfce7; }
.hpill.bad { border-color: #fecaca; background: #fff8f8; }
.hpill.bad .hdot { background: #dc2626; box-shadow: 0 0 0 4px #fee2e2; }
.ft-table { margin-bottom: 18px; }
.ft-table td small { white-space: nowrap; }
.ft-table .btn .ic { width: 15px; height: 15px; }

/* Card rows sized to the number of cards, so none is left alone on a line */
.dash-cards[data-n] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-cards[data-n="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dash-cards[data-n="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1500px) { .dash-cards[data-n="6"] { grid-template-columns: repeat(6, minmax(0, 1fr)); } .dash-cards[data-n="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .dash-cards[data-n] { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .dash-cards[data-n] { grid-template-columns: 1fr; } }

.usage-cards[data-n="6"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.usage-cards[data-n="8"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1300px) { .usage-cards[data-n="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .usage-cards[data-n] { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Panel grids: 4 panels as 2 x 2, 2 side by side; 3, 6, 9 fill rows of three */
.dash-grid[data-n] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-grid[data-n="4"], .dash-grid[data-n="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dash-grid[data-n="1"] { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1100px) { .dash-grid[data-n] { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .dash-grid[data-n] { grid-template-columns: 1fr; } }

/* ---- Header ---- */
.top { gap: 18px; min-height: 64px; padding: 0 18px; background: linear-gradient(90deg, #0a1a2e 0%, #10274a 55%, #163463 100%); border-bottom: 1px solid #22406b; box-shadow: 0 1px 0 rgba(255,255,255,.04) inset; }
.brand { gap: 12px; font-size: 17px; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25); flex: none; }
.brand-mark img { width: 28px; height: auto; display: block; }
.brand-text { display: flex; align-items: center; gap: 8px; }
.brand-text b { font-size: 18px; font-weight: 700; letter-spacing: -.01em; color: #fff; }
.brand .app-word { color: #fff; background: var(--red); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; line-height: 1.2; }
.org { justify-content: flex-start; }
.org-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); color: #e6edf7; font-weight: 600; font-size: 14px; }
.org-chip .ic { width: 16px; height: 16px; color: #9fb4d3; flex: none; }
.org-label { font-size: 12px; font-weight: 600; color: #9fb4d3; text-transform: uppercase; letter-spacing: .06em; }
.org-chip select { background: transparent; border: 0; color: #fff; font-weight: 600; padding: 2px 4px; max-width: 240px; cursor: pointer; }
.org-chip select:focus-visible { outline: 2px solid #7fb0e8; border-radius: 6px; }
.org-chip select option { color: var(--ink); }
.user-menu { margin-left: auto; position: relative; }
.user-menu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 5px 10px 5px 5px; border-radius: 999px; color: #e6edf7; border: 1px solid transparent; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover, .user-menu[open] > summary { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); }
.user-menu .avatar { margin-right: 0; width: 34px; height: 34px; }
.user-text { display: grid; line-height: 1.15; text-align: left; }
.user-text #userName { font-weight: 600; font-size: 14px; color: #fff; }
.user-text small { font-size: 12px; color: #9fb4d3; }
.user-menu > summary > .ic { width: 16px; height: 16px; color: #9fb4d3; }
.user-menu .menu-list { top: calc(100% + 8px); min-width: 230px; }
.user-menu .menu-list .menu-sub { font-size: 13px; color: var(--muted); padding-left: 36px; }
@media (max-width: 900px) {
  .user-text, .org-label { display: none; }
  .brand-text b { font-size: 16px; }
}

/* Your phone panel */
.myphone { display: grid; gap: 12px; margin-top: 4px; }
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 42px; height: 24px; border-radius: 999px; background: #cbd5e1; position: relative; flex: none; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + .track { background: var(--red); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid #7fb0e8; outline-offset: 2px; }
.switch input:disabled + .track { opacity: .5; }
.switch b { display: block; font-size: 14px; }
.switch small { color: var(--muted); font-size: 13px; }
.fwd-row { display: flex; gap: 8px; padding-left: 54px; }
.fwd-row input { flex: 1; min-height: 36px; }
.myphone-note { margin: 0; }
.cd-actions { margin: 10px 0 0; }
.cd-actions .btn .ic, .drow .btn .ic { width: 15px; height: 15px; }

/* Voicemail actions and transcripts */
.vm-text { margin: 8px 0 0; padding: 10px 12px; border-radius: 8px; background: #f8fafc; border-left: 3px solid #cbd5e1; font-size: 14px; line-height: 1.5; }
.vm-text.pending { color: var(--muted); font-style: italic; }
.vm-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.vm-actions .btn .ic { width: 15px; height: 15px; }

/* A group of settings fields that shows or hides together, spaced like the form around it. */
.sub-grid { display: grid; gap: 16px; }

/* Office-hours bar on the dashboard */
.hours-bar { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: center; padding: 14px 16px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.hours-bar.closed, .hours-bar.other { border-color: #efd9a8; background: var(--warn-soft); }
.hours-bar.closed .qicon, .hours-bar.other .qicon { background: #f7e2bb; color: var(--warn); }
.hours-bar.open { border-color: #b7dfc4; background: #f1faf4; }
.hours-main { display: grid; gap: 1px; flex: 1 1 260px; min-width: 0; }
.hours-main small, .hours-main span { color: var(--muted); font-size: 13px; }
.hours-bar.closed .hours-main span { color: #5c3a00; }
.hours-main b { font-size: 16px; }
.hours-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hours-form { flex: 1 0 100%; display: grid; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); max-width: 520px; }
.hours-form fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.hours-form legend { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
/* Normal hours: one quiet line under the greeting; opens into a card only while someone is changing it */
.hours-bar.quiet:not(.editing) { padding: 0; margin: -10px 0 16px; border: 0; background: none; }
.hours-line { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: 13px; }
.hours-line .ic { width: 15px; height: 15px; }
.hours-line .linkish { color: var(--blue); }
.hours-bar.editing .hours-line .linkish { display: none; }
.cd-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cd-book { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 10px; max-width: 520px; }
.cd-book label { flex: 1 1 240px; display: grid; gap: 4px; font-size: 13px; }

/* Voicemail follow-up: assignee, notes, handled */
.vm-show select { min-height: 38px; }
.vm.done { opacity: .82; }
.vm.done .vm-text { border-left-color: #b7dfc4; }
.vm-notes { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
.vm-notes li { display: grid; gap: 2px; padding: 8px 12px; border-radius: 8px; background: #f4f7fb; font-size: 14px; }
.vm-notes li.vn-done { background: var(--ok-soft); }
.vn-by small { color: var(--muted); font-size: 13px; }
.vm-assign { display: inline-flex; align-items: center; gap: 6px; padding: 0 0 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.vm-assign .ic { width: 15px; height: 15px; color: var(--muted); }
.vm-assign select { border: 0; min-height: 32px; padding: 4px 8px 4px 0; background: transparent; font-size: 13px; }
.vm-more { display: inline-flex; gap: 4px; margin-left: auto; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: #f1f5f9; color: var(--ink); }
.vm-note-form { display: grid; gap: 8px; max-width: 640px; }
.vm-note-form textarea { width: 100%; }
.vm-note-form .actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 11px; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; }
.chip-btn:hover { border-color: #b8c7dc; background: var(--blue-soft); }

/* Contact history (address book) */
.ch-panel { margin-bottom: 16px; }
.ch-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.ch-head h2 { margin: 0 0 2px; font-size: 18px; }
.ch-list { list-style: none; margin: 0; padding: 0; display: grid; }
.ch-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.ch-list .qicon { width: 34px; height: 34px; }
.ch-list .qicon .ic { width: 17px; height: 17px; }
.ch-bad .qicon { background: #fde2e4; color: var(--red); }
.ch-body { display: grid; gap: 2px; flex: 1; min-width: 0; }
.ch-body a { color: var(--ink); text-decoration: none; }
.ch-body a:hover b { text-decoration: underline; }
.ch-body small { color: var(--muted); font-size: 13px; }
.ch-quote { margin: 4px 0 0; padding: 6px 10px; border-left: 3px solid #cbd5e1; background: #f8fafc; font-size: 14px; }
.ch-note { margin: 4px 0 0; font-size: 14px; }
.ch-when { color: var(--muted); font-size: 13px; white-space: nowrap; }
