/* Salesforce Lightning look-alike for the Prior Year Follow-Ups mockup.
   Hand-written; no SLDS dependency. Colours follow Lightning defaults. */
:root {
  --sf-blue: #0176d3;
  --sf-blue-dark: #014486;
  --sf-text: #181818;
  --sf-text-weak: #444444;
  --sf-text-muted: #706e6b;
  --sf-border: #dddbda;
  --sf-border-strong: #c9c9c9;
  --sf-bg: #f3f3f3;
  --sf-card: #ffffff;
  --sf-row-hover: #f3f3f3;
  --sf-header-bg: #fafaf9;
  --sf-green: #2e844a;
  --sf-green-bg: #ebf7e6;
  --sf-orange: #a96404;
  --sf-orange-bg: #fef1e6;
  --sf-red: #ba0517;
  --sf-red-bg: #feded8;
  --sf-gray-bg: #ecebea;
  --sf-tab-icon: #3ba755;
  --font: "Salesforce Sans", "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 13px; color: var(--sf-text); background: var(--sf-bg); }
a { color: var(--sf-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

/* ---------- global header ---------- */
.gh { background: #fff; height: 50px; display: flex; align-items: center; padding: 0 12px; border-bottom: 1px solid var(--sf-border); }
.gh-logo { width: 32px; height: 32px; }
.gh-search { flex: 1; display: flex; justify-content: center; }
.gh-search input { width: 420px; max-width: 60vw; height: 30px; border: 1px solid var(--sf-border-strong); border-radius: 4px; padding: 0 10px 0 28px; font: inherit;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23706e6b' stroke-width='2.5'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E") 8px center no-repeat; }
.gh-icons { display: flex; gap: 14px; color: var(--sf-text-muted); font-size: 15px; align-items: center; }
.gh-avatar { width: 28px; height: 28px; border-radius: 50%; background: #5867e8; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }

/* ---------- app nav ---------- */
.nav { background: #fff; height: 40px; display: flex; align-items: stretch; padding: 0 12px; border-bottom: 3px solid var(--sf-blue); }
.nav-launcher { display: grid; grid-template-columns: repeat(3, 4px); gap: 3px; align-content: center; margin-right: 14px; }
.nav-launcher i { width: 4px; height: 4px; background: var(--sf-text-muted); border-radius: 50%; }
.nav-app { font-size: 18px; display: flex; align-items: center; margin-right: 22px; }
.nav a.tab { display: flex; align-items: center; padding: 0 12px; color: var(--sf-text); font-size: 13px; border-bottom: 3px solid transparent; margin-bottom: -3px; }
.nav a.tab:hover { text-decoration: none; background: var(--sf-row-hover); }
.nav a.tab.active { border-bottom-color: var(--sf-blue); background: #eef4ff; font-weight: 600; }
.nav a.tab .caret { margin-left: 6px; font-size: 9px; color: var(--sf-text-muted); }
.nav a.tab.new::after { content: "NEW"; margin-left: 6px; font-size: 9px; font-weight: 700; color: #fff; background: var(--sf-green); border-radius: 8px; padding: 1px 5px; }

/* ---------- page ---------- */
.page { padding: 12px; }
.card { background: var(--sf-card); border: 1px solid var(--sf-border); border-radius: 4px; }
.lv-header { padding: 12px 14px 10px; display: flex; align-items: flex-start; gap: 10px; border-bottom: 1px solid var(--sf-border); }
.obj-icon { width: 32px; height: 32px; border-radius: 4px; background: var(--sf-tab-icon); display: grid; place-items: center; color: #fff; flex: none; }
.obj-icon svg { width: 20px; height: 20px; }
.lv-title .eyebrow { font-size: 12px; color: var(--sf-text-weak); }
.lv-title h1 { font-size: 18px; margin: 0; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.lv-title select { font: inherit; font-size: 18px; font-weight: 700; border: none; background: transparent; cursor: pointer; padding: 0; }
.lv-meta { font-size: 12px; color: var(--sf-text-weak); margin-top: 6px; }
.lv-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.btn { height: 32px; padding: 0 14px; border-radius: 4px; border: 1px solid var(--sf-border-strong); background: #fff; color: var(--sf-blue); font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: #f3f3f3; text-decoration: none; }
.btn.brand { background: var(--sf-blue); border-color: var(--sf-blue); color: #fff; }
.btn.brand:hover { background: var(--sf-blue-dark); }
.btn.destructive { background: var(--sf-red); border-color: var(--sf-red); color: #fff; }
.btn.small { height: 26px; padding: 0 10px; font-size: 12px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 4px 0 0 4px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 4px 4px 0; }
.btn-group .btn.on { background: #eef4ff; color: var(--sf-blue-dark); font-weight: 600; }
.lv-search { height: 32px; width: 220px; border: 1px solid var(--sf-border-strong); border-radius: 4px; padding: 0 10px; font: inherit; }

/* ---------- standard list view (matches the Quotes tab) ---------- */
.lv-title .pin { font-size: 12px; margin-left: 6px; border: 1px solid var(--sf-border-strong); border-radius: 4px; padding: 1px 4px; filter: grayscale(1); opacity: .7; }
.lv-right { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.lv-right .lv-actions { margin-left: 0; }
.lv-toolbar { display: flex; gap: 4px; align-items: center; }
.lv-toolbar .lv-search { height: 28px; width: 200px; font-size: 12px; }
.icon-btn { height: 28px; min-width: 32px; padding: 0 6px; border: 1px solid var(--sf-border-strong); border-radius: 4px; background: #fff; color: var(--sf-text-muted); font-size: 13px; display: inline-flex; align-items: center; justify-content: center; cursor: default; }
button.icon-btn { cursor: pointer; }
table.lv.std { font-size: 12px; }
table.lv.std th { background: #fafaf9; font-weight: 600; color: var(--sf-text-weak); padding: 0; border-right: 1px solid var(--sf-border); }
table.lv.std th.num, table.lv.std th.act { width: 32px; border-right: 0; }
table.lv.std th[data-k] { padding: 6px 8px; }
table.lv.std th .th-label { margin-right: 14px; }
table.lv.std th .th-menu { float: right; color: var(--sf-text-muted); font-size: 10px; }
table.lv.std th.sorted .sort-arrow { visibility: visible; color: var(--sf-text); margin-left: 4px; font-size: 11px; }
table.lv.std td { padding: 5px 8px; }
.row-menu { width: 20px; height: 20px; border: 1px solid var(--sf-border-strong); border-radius: 4px; background: #fff; cursor: pointer; color: var(--sf-text-muted); font-size: 10px; line-height: 1; padding: 0; }

/* ---------- list view table ---------- */
.table-wrap { overflow-x: auto; }
table.lv { width: 100%; border-collapse: collapse; }
table.lv th { text-align: left; font-size: 12px; font-weight: 600; color: var(--sf-text-weak); background: var(--sf-header-bg); border-bottom: 1px solid var(--sf-border); padding: 7px 8px; white-space: nowrap; }
table.lv th.sortable { cursor: pointer; user-select: none; }
table.lv th.sortable:hover { background: #eef1f6; color: var(--sf-text); }
table.lv th .sort-arrow { margin-left: 4px; font-size: 9px; visibility: hidden; color: var(--sf-text-muted); }
table.lv th.sortable:hover .sort-arrow { visibility: visible; }
table.lv th.sorted { color: var(--sf-text); }
table.lv th.sorted .sort-arrow { visibility: visible; color: var(--sf-blue); }
table.lv td { border-bottom: 1px solid var(--sf-border); padding: 7px 8px; white-space: nowrap; vertical-align: middle; }
table.lv tr:hover td { background: var(--sf-row-hover); }
table.lv td.num { color: var(--sf-text-muted); width: 28px; text-align: right; }
table.lv td.muted, .muted { color: var(--sf-text-muted); }
table.lv tr.group-row td { background: #f8f8f8; font-weight: 700; font-size: 12px; color: var(--sf-text-weak); }
.empty { padding: 40px; text-align: center; color: var(--sf-text-muted); }

/* ---------- badges ---------- */
.badge { display: inline-block; font-size: 11px; line-height: 18px; padding: 0 8px; border-radius: 10px; background: var(--sf-gray-bg); color: var(--sf-text); white-space: nowrap; }
.badge.high { background: var(--sf-green-bg); color: var(--sf-green); font-weight: 700; }
.badge.medium { background: var(--sf-orange-bg); color: var(--sf-orange); font-weight: 700; }
.badge.low { background: var(--sf-gray-bg); color: var(--sf-text-weak); }
.badge.type-ps { background: #e5f2ff; color: var(--sf-blue-dark); }
.badge.type-qo { background: #f3e8ff; color: #6b3fa0; }
.badge.st-open { background: #fff; border: 1px solid var(--sf-border-strong); }
.badge.st-completed { background: var(--sf-green-bg); color: var(--sf-green); }
.badge.st-dismissed { background: var(--sf-gray-bg); color: var(--sf-text-muted); }

/* ---------- row action menu ---------- */
.menu-btn { width: 24px; height: 24px; border: 1px solid var(--sf-border-strong); border-radius: 4px; background: #fff; cursor: pointer; color: var(--sf-text-muted); font-size: 10px; }
.menu { position: absolute; z-index: 30; background: #fff; border: 1px solid var(--sf-border); border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.16); min-width: 180px; padding: 4px 0; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 14px; font-size: 13px; cursor: pointer; color: var(--sf-text); }
.menu button:hover { background: var(--sf-row-hover); }
.menu hr { border: 0; border-top: 1px solid var(--sf-border); margin: 4px 0; }

/* ---------- record page ---------- */
.rec-header { padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; }
.rec-header h1 { margin: 2px 0 0; font-size: 20px; }
.rec-header .eyebrow { font-size: 12px; color: var(--sf-text-weak); }
.highlights { display: flex; gap: 28px; padding: 0 16px 14px 60px; flex-wrap: wrap; }
.highlights div span { display: block; font-size: 12px; color: var(--sf-text-weak); }
.highlights div b { font-weight: 400; font-size: 14px; }
.rec-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-top: 12px; }
@media (max-width: 1000px) { .rec-grid { grid-template-columns: 1fr; } }
.section { margin-bottom: 12px; }
.section-head { padding: 10px 14px; font-weight: 700; font-size: 14px; border-bottom: 1px solid var(--sf-border); display: flex; align-items: center; gap: 8px; }
.section-head .count { font-weight: 400; color: var(--sf-text-weak); }
.section-body { padding: 10px 14px 14px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
.field { border-bottom: 1px solid var(--sf-border); padding: 7px 0; }
.field label { display: block; font-size: 12px; color: var(--sf-text-weak); margin-bottom: 2px; }
.field .val { min-height: 18px; }
.field.wide { grid-column: 1 / -1; }
.callout { border-left: 3px solid var(--sf-blue); background: #f4f8fd; padding: 10px 12px; margin-bottom: 10px; color: var(--sf-text-weak); }
.callout.warn { border-left-color: var(--sf-orange); background: #fff8ef; }
.timeline-item { padding: 8px 0; border-bottom: 1px solid var(--sf-border); }
.timeline-item:last-child { border-bottom: 0; }
.timeline-item .when { font-size: 12px; color: var(--sf-text-muted); }

/* ---------- modal ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(8, 7, 7, .45); display: grid; place-items: center; z-index: 50; }
.modal { background: #fff; border-radius: 4px; width: 560px; max-width: calc(100vw - 32px); box-shadow: 0 4px 24px rgba(0,0,0,.3); }
.modal-head { padding: 16px; border-bottom: 1px solid var(--sf-border); text-align: center; font-size: 18px; font-weight: 600; }
.modal-body { padding: 16px 20px; }
.modal-body p { margin: 0 0 12px; }
.modal { position: relative; }
.modal.large { width: 1375px; max-height: calc(100vh - 96px); margin-top: 40px; display: flex; flex-direction: column; }
.modal-close { position: absolute; top: -38px; right: 0; width: 32px; height: 32px; border-radius: 4px; border: 0; background: transparent; color: #fff; font-size: 20px; cursor: pointer; }
.modal-close:hover { background: rgba(255,255,255,.15); }
.modal-head.left { display: flex; align-items: center; gap: 10px; text-align: left; font-size: 13px; font-weight: 400; }
.modal-head .modal-title { font-size: 18px; font-weight: 700; }
.modal-head .eyebrow { font-size: 12px; color: var(--sf-text-weak); }
.modal-head .open-full { margin-left: auto; font-size: 12px; }
.highlights.in-modal { padding: 12px 16px 12px 58px; border-bottom: 1px solid var(--sf-border); }
.modal-body.scroll { overflow: auto; background: var(--sf-bg); padding: 12px; flex: 1; }
.modal-body.scroll .rec-grid { margin-top: 0; }
.modal-foot { padding: 12px 16px; border-top: 1px solid var(--sf-border); background: var(--sf-header-bg); display: flex; justify-content: flex-end; gap: 8px; border-radius: 0 0 4px 4px; }
.form-row { margin-bottom: 14px; }
.form-row label.lbl { display: block; font-size: 12px; color: var(--sf-text-weak); margin-bottom: 4px; }
.form-row label.lbl abbr { color: var(--sf-red); text-decoration: none; margin-right: 2px; }
.form-row select, .form-row textarea { width: 100%; font: inherit; border: 1px solid var(--sf-border-strong); border-radius: 4px; padding: 6px 8px; }
.form-row textarea { min-height: 70px; resize: vertical; }
.checkbox { display: flex; gap: 8px; align-items: flex-start; }
.help { font-size: 12px; color: var(--sf-text-muted); margin-top: 4px; }

/* ---------- toast ---------- */
.toast { position: fixed; top: 100px; left: 50%; transform: translateX(-50%); background: var(--sf-green); color: #fff; padding: 12px 20px; border-radius: 4px; z-index: 60; box-shadow: 0 2px 8px rgba(0,0,0,.2); font-size: 14px; }

/* ---------- dashboard (home) ---------- */
.dash-head { background: var(--sf-header-bg); border: 1px solid var(--sf-border); border-radius: 4px 4px 0 0; padding: 10px 14px; display: flex; align-items: flex-start; gap: 10px; }
.dash-head .obj-icon { background: #5867e8; }
.dash-head h2 { margin: 0; font-size: 15px; }
.dash-head .eyebrow { font-size: 11px; color: var(--sf-text-weak); }
.dash-head .meta { font-size: 11px; color: var(--sf-text-weak); margin-top: 3px; }
.tiles { display: grid; gap: 8px; padding: 8px 0; }
.tiles.cols-3 { grid-template-columns: repeat(3, 1fr); }
.tiles.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .tiles.cols-3, .tiles.cols-4 { grid-template-columns: 1fr 1fr; } }
.tile { background: #fff; border: 1px solid var(--sf-border); border-radius: 4px; padding: 10px 12px; min-height: 110px; display: flex; flex-direction: column; }
.tile .t-title { font-size: 13px; }
.tile .t-num { font-size: 34px; color: #c23934; text-align: center; margin: 8px 0; flex: 1; display: grid; place-items: center; }
.tile .t-foot { display: flex; justify-content: space-between; font-size: 10px; color: var(--sf-text-weak); }
.tile.new { border: 2px solid var(--sf-green); position: relative; }
.tile.new .t-num { color: var(--sf-green); }
.tile.new::before { content: "NEW TILE"; position: absolute; top: -9px; right: 10px; background: var(--sf-green); color: #fff; font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 8px; }

/* ---------- mockup notes ---------- */
.notes-btn { position: fixed; right: 16px; bottom: 16px; z-index: 40; background: #141a36; color: #fff; border: 0; border-radius: 18px; padding: 9px 16px; cursor: pointer; font-size: 13px; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.notes-panel { position: fixed; right: 16px; bottom: 62px; z-index: 40; width: 420px; max-width: calc(100vw - 32px); max-height: 70vh; overflow: auto; background: #fff; border: 1px solid var(--sf-border); border-top: 4px solid #4ebc8b; border-radius: 4px; box-shadow: 0 4px 18px rgba(0,0,0,.25); padding: 14px 16px; font-size: 12.5px; }
.notes-panel h3 { margin: 0 0 6px; font-size: 14px; }
.notes-panel h4 { margin: 12px 0 4px; font-size: 12.5px; color: var(--sf-text-weak); text-transform: uppercase; letter-spacing: .03em; }
.notes-panel ul { margin: 0; padding-left: 18px; }
.notes-panel li { margin-bottom: 4px; }
.notes-panel .reset { margin-top: 12px; font-size: 12px; }

/* ---------- Review aid: "Highlight duplicated fields" (Mockup notes, or ?dupes=1) ---------- */
body.show-dupes [data-dup], body.show-dupes [data-rel] { position: relative; border-radius: 3px; }
body.show-dupes [data-dup] { background: #fff3a0; box-shadow: 0 0 0 2px #e0b400; }
body.show-dupes [data-rel] { background: #e3f0fd; outline: 2px dashed #3a87d6; outline-offset: 0; }
body.show-dupes [data-dup]::after, body.show-dupes [data-rel]::after {
  position: absolute; top: -8px; right: -8px; z-index: 2; min-width: 16px; padding: 0 4px;
  font: 700 10px/16px var(--sf-font, sans-serif); text-align: center; border-radius: 8px; color: #fff;
}
body.show-dupes [data-dup]::after { content: attr(data-dup); background: #b58900; }
body.show-dupes [data-rel]::after { content: attr(data-rel); background: #3a87d6; }
.dupes-toggle { display: flex; gap: 6px; align-items: center; font-weight: 600; margin: 4px 0; }
.dupes-legend { font-size: 12px; }
.dup-key, .rel-key { display: inline-block; padding: 0 5px; border-radius: 8px; color: #fff; font-weight: 700; font-size: 10px; }
.dup-key { background: #b58900; } .rel-key { background: #3a87d6; }
body.show-dupes th[data-rel]::after { position: static; display: inline-block; margin-left: 4px; vertical-align: middle; }   /* inline: the table clips anything above the header row */

/* ---------- resizable list columns ---------- */
table.lv.std th[data-k] { position: relative; }
.col-resize { position: absolute; top: 0; right: 0; width: 7px; height: 100%; cursor: col-resize; z-index: 3; }
.col-resize::before { content: ""; position: absolute; top: 4px; bottom: 4px; right: 2px; width: 2px; border-radius: 1px; background: transparent; }
.col-resize:hover::before, .col-resize:focus-visible::before, th.resizing .col-resize::before { background: var(--sf-blue); }
.col-resize:focus-visible { outline: none; }
body.col-resizing, body.col-resizing * { cursor: col-resize !important; user-select: none; }
table.lv.std.fixed { table-layout: fixed; }
table.lv.std.fixed th, table.lv.std.fixed td { box-sizing: border-box; overflow: hidden; text-overflow: ellipsis; }
/* header: menu arrow pinned right, label truncates instead of wrapping */
table.lv.std th[data-k] { padding-right: 22px; }
table.lv.std th .th-label { display: inline-block; max-width: 100%; margin-right: 0; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
body.show-dupes table.lv.std th[data-rel] .th-label { max-width: calc(100% - 24px); }
table.lv.std th .th-menu { float: none; position: absolute; right: 9px; top: 50%; transform: translateY(-50%); }
table.lv.std.fixed td.num { padding: 5px 4px; text-overflow: clip; }

/* ---------- compact layout (12/3): label and value on one line, tighter spacing. Used by the pop-up and the full record page (.page.compact). ---------- */
.modal.large .modal-head { padding: 10px 16px; }
.modal.large .highlights.in-modal { gap: 6px 28px; padding: 8px 16px 8px 58px; }
:is(.modal.large, .page.compact) .highlights div span { display: inline; margin-right: 6px; }
:is(.modal.large, .page.compact) .section { margin-bottom: 10px; }
:is(.modal.large, .page.compact) .section-head { padding: 7px 14px; }
:is(.modal.large, .page.compact) .section-body { padding: 4px 14px 6px; }
:is(.modal.large, .page.compact) .field { display: grid; grid-template-columns: minmax(110px, 44%) 1fr; column-gap: 10px; align-items: baseline; padding: 4px 0; }
:is(.modal.large, .page.compact) .field label { margin-bottom: 0; }
:is(.modal.large, .page.compact) .field .val { min-height: 0; overflow-wrap: anywhere; }
:is(.modal.large, .page.compact) .timeline-item { padding: 5px 0; }
:is(.modal.large, .page.compact) table.lv th, :is(.modal.large, .page.compact) table.lv td { padding: 4px 8px; }
.page.compact .rec-header { padding: 10px 16px; }
.page.compact .highlights { gap: 6px 28px; padding: 0 16px 10px 60px; }
.page.compact .rec-grid { margin-top: 10px; }

.timeline-item .note-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.timeline-item[hidden] { display: none; }
.tl-pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 8px; border-top: 1px solid var(--sf-border); }
.tl-pager .tl-count { font-size: 12px; color: var(--sf-text-muted); }
.tl-pager .btn:disabled { opacity: .5; cursor: default; }
.char-count { font-size: 12px; color: var(--sf-text-muted); text-align: right; margin-top: 2px; }
.char-count.at-max { color: #ba0517; }
