/* Workspace-only layouts: the mail list and reading pane, the compose window, the pipeline board. */

/* Mail list (Gmail-style rows) */
.mail-tabs { display: flex; border-bottom: 1px solid var(--md-outline-variant); flex: none; }
.mail-tabs .tab { flex: 0 0 240px; justify-content: flex-start; gap: 16px; height: 56px; padding: 0 16px; }
.mail-tabs .tab svg.i { width: 20px; height: 20px; }
.mail-list { flex: 1; overflow-y: auto; }
.mrow { display: grid; grid-template-columns: 36px 200px minmax(0, 1fr) auto; align-items: center; gap: 0 8px; height: 40px; padding: 0 16px 0 8px; border-bottom: 1px solid var(--md-outline-variant); cursor: pointer; background: var(--md-surface-container-low); position: relative; text-decoration: none; color: inherit; }
.mrow.unread { background: var(--md-surface); font-weight: 700; }
.mrow:hover { box-shadow: inset 1px 0 0 var(--md-outline-variant), inset -1px 0 0 var(--md-outline-variant), 0 1px 2px 0 rgb(0 0 0 / 0.2), 0 1px 3px 1px rgb(0 0 0 / 0.1); z-index: 1; }
.mrow[aria-selected="true"] { background: var(--md-info-container); }
.mrow.focus { box-shadow: inset 4px 0 0 var(--md-primary); }
.mrow input { width: 18px; height: 18px; margin: 0 auto; accent-color: var(--md-primary); }
.mrow .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 4px; }
.mrow .who small { font-weight: 400; color: var(--md-on-surface-variant); margin-left: 4px; }
.mrow .what { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.mrow .what > .ellip { flex: 0 1 auto; max-width: 65%; }
.mrow .what .snip { font-weight: 400; color: var(--md-on-surface-variant); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 0; min-width: 0; }
.mrow .what .badge { flex: none; }
.mrow .when { font-size: 12px; text-align: right; min-width: 72px; white-space: nowrap; }
.mrow.unread .when { color: var(--md-on-surface); }
.mrow .hover-acts { display: none; gap: 0; }
.mrow:hover .hover-acts { display: flex; }
.mrow:hover .when-text { display: none; }

/* Reading pane */
.thread { padding: 8px 0 48px; }
.thread-subject { display: flex; align-items: center; gap: 12px; padding: 12px 24px 16px 72px; flex-wrap: wrap; }
.thread-subject h1 { font-size: 22px; line-height: 28px; font-weight: 400; margin: 0; }
.tmsg { padding: 12px 24px 12px 16px; display: grid; grid-template-columns: 56px 1fr; }
.tmsg + .tmsg { border-top: 1px solid var(--md-outline-variant); }
.tmsg .avatar { width: 40px; height: 40px; font-size: 16px; }
.tmsg-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tmsg-head b { font-weight: 700; }
.tmsg-head .addr { color: var(--md-on-surface-variant); font-size: 12px; }
.tmsg-head .time { margin-left: auto; font-size: 12px; color: var(--md-on-surface-variant); }
.tmsg-to { font-size: 12px; color: var(--md-on-surface-variant); margin-top: 2px; }
.tmsg-body { margin-top: 12px; }
.tmsg-body .mail-text { white-space: pre-wrap; font-size: 14px; line-height: 21px; overflow-wrap: anywhere; }
.tmsg-body iframe { width: 100%; min-height: 220px; border: 0; background: #fff; border-radius: 8px; }
.tmsg.collapsed { cursor: pointer; }
.tmsg.collapsed .tmsg-body, .tmsg.collapsed .tmsg-to { display: none; }
.tmsg.collapsed .snip { display: block; color: var(--md-on-surface-variant); font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tmsg .snip { display: none; }
.attach { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.attach a { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--md-outline-variant); border-radius: 8px; padding: 8px 12px; text-decoration: none; font-size: 13px; }
.reply-zone { padding: 8px 24px 0 72px; }
.smart { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.smart .chip { border-radius: var(--md-shape-sm); height: 36px; }
.reply-box { border-radius: var(--md-shape-lg-inc); box-shadow: var(--md-elev-1); padding: 12px 16px; background: var(--md-surface); }
.reply-box textarea { width: 100%; border: 0; outline: none; resize: vertical; min-height: 140px; font-size: 14px; line-height: 21px; background: transparent; }
.reply-box .row-gap { margin-top: 8px; }
.summary-card { margin: 0 24px 12px 72px; border-radius: var(--md-shape-lg); background: var(--md-tertiary-container); padding: 12px 16px; }
.summary-card .label-m { color: var(--md-tertiary); display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.summary-card .label-m svg.i { width: 16px; height: 16px; }
.summary-card ul { margin: 4px 0 0; padding-left: 18px; }

/* Compose window, bottom right */
.compose { position: fixed; right: 24px; bottom: 0; width: 560px; max-width: calc(100vw - 48px); height: 520px; max-height: calc(100vh - 80px); background: var(--md-surface); border-radius: var(--md-shape-lg-inc) var(--md-shape-lg-inc) 0 0; box-shadow: var(--md-elev-3); z-index: 55; display: flex; flex-direction: column; overflow: hidden; }
.compose.min { height: 48px; }
.compose.max { width: min(1100px, calc(100vw - 80px)); height: calc(100vh - 80px); right: 40px; bottom: 40px; border-radius: var(--md-shape-xl); }
.compose-head { height: 48px; display: flex; align-items: center; gap: 4px; padding: 0 8px 0 16px; background: var(--md-surface-container-high); cursor: pointer; flex: none; }
.compose-head .title-s { flex: 1; }
.compose-line { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--md-outline-variant); margin: 0 16px; min-height: 40px; }
.compose-line > span { color: var(--md-on-surface-variant); font-size: 14px; flex: none; }
.compose-line input, .compose-line select { flex: 1; border: 0; outline: none; background: transparent; height: 40px; font-size: 14px; min-width: 0; }
.compose textarea { flex: 1; border: 0; outline: none; resize: none; padding: 12px 16px; font-size: 14px; line-height: 21px; background: transparent; }
.compose-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; flex: none; }
.compose.min .compose-line, .compose.min textarea, .compose.min .compose-foot { display: none; }

/* Pipeline board */
.board { display: flex; gap: 12px; overflow-x: auto; padding: 4px 32px 24px; align-items: flex-start; min-height: 420px; }
.col { flex: 0 0 272px; background: var(--md-surface-container-low); border-radius: var(--md-shape-lg-inc); display: flex; flex-direction: column; max-height: calc(100vh - 260px); }
.col.over { box-shadow: inset 0 0 0 2px var(--md-primary); }
.col-head { padding: 12px 14px 8px; display: flex; align-items: baseline; gap: 8px; }
.col-head h3 { margin: 0; font-size: 14px; font-weight: 500; flex: 1; }
.col-head small { color: var(--md-on-surface-variant); }
.col-body { padding: 4px 8px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.deal { background: var(--md-surface); border-radius: var(--md-shape-md); padding: 10px 12px; box-shadow: var(--md-elev-1); cursor: grab; text-decoration: none; display: block; }
.deal:hover { box-shadow: var(--md-elev-2); }
.deal.dragging { opacity: 0.5; }
.deal .t { font-weight: 500; }
.deal .s { font-size: 12.5px; color: var(--md-on-surface-variant); margin-top: 2px; }
.deal .amt { font-size: 13px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.col.won .col-head h3::before { content: "● "; color: var(--md-good); }
.col.lost .col-head h3::before { content: "● "; color: var(--md-outline); }

/* Next best actions */
.nba { display: flex; flex-direction: column; }
.nba .li { padding: 10px 16px; gap: 14px; border-radius: var(--md-shape-md); }
.nba .li + .li { border-top: 1px solid var(--md-outline-variant); }
.sapi-card { background: var(--md-tertiary-container); }
.sapi-card > header h2 { display: flex; align-items: center; gap: 8px; }
.sapi-card > header h2 svg.i { color: var(--md-tertiary); width: 20px; height: 20px; }
.sapi-card .li .lead-icon { background: var(--md-surface); color: var(--md-tertiary); }
.hello { padding: 8px 0 4px; }
.hello h1 { margin: 0; font-weight: 500; }
.brief-items .li { min-height: 44px; padding: 8px 0; }
.quote { border-left: 3px solid var(--md-outline-variant); padding: 2px 0 2px 12px; margin: 0; }
.dl { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; margin: 0; }
.dl dt { color: var(--md-on-surface-variant); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.inv-lines td:last-child, .inv-lines th:last-child { text-align: right; }
.inv-total td { font-weight: 700; }
.preview-frame { width: 100%; height: 560px; border: 1px solid var(--md-outline-variant); border-radius: var(--md-shape-md); background: #fff; }
.timeline .li { align-items: flex-start; }

@media (max-width: 720px) {
  .mrow { grid-template-columns: 30px minmax(0, 1fr) auto; grid-template-areas: "sel who when" "sel what what"; height: auto; padding: 8px 12px 8px 6px; row-gap: 2px; }
  .mrow > input { grid-area: sel; align-self: start; margin-top: 2px; }
  .mrow .who { grid-area: who; }
  .mrow .what { grid-area: what; }
  .mrow .when { grid-area: when; }
  .mrow:hover .hover-acts { display: none; }
  .mrow:hover .when-text { display: inline; }
  .mail-tabs .tab { flex: 1 1 0; gap: 8px; padding: 0 10px; }
  .thread-subject { padding: 12px 14px; }
  .tmsg { grid-template-columns: 44px 1fr; padding: 10px 12px; }
  .reply-zone, .summary-card { padding-left: 14px; padding-right: 14px; margin-left: 0; margin-right: 0; }
  .compose, .compose.max { right: 0; left: 0; bottom: 0; top: 0; width: 100vw; max-width: none; height: 100vh; max-height: none; border-radius: 0; }
  .compose.min { top: auto; height: 48px; }
  .board { padding: 4px 14px 16px; }
  .col { flex-basis: 240px; }
  .tabs[style*="margin:0 32px"] { margin: 0 14px !important; }
}

/* Roles & access, CRM & sections */
.role-areas { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; margin-top: 8px; }
.role-group { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.role-group h3 { margin: 8px 0 2px; color: var(--md-on-surface-variant); }
.role-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.role-row .segmented button { height: 32px; padding: 0 12px; font-size: 13px; }
.role-matrix td.lvl, .role-matrix th:not(:first-child) { text-align: center; }
.role-matrix td.lvl.edit { font-weight: 700; }
.role-matrix tr.grp th { background: var(--md-surface-container-low); font-weight: 700; color: var(--md-on-surface); height: 36px; position: static; }
.stages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.stage-row { display: flex; gap: 6px; align-items: center; }
.stage-row input, .stage-row select { height: 40px; border: 1px solid var(--md-outline); border-radius: var(--md-shape-sm); padding: 0 12px; background: transparent; font-size: 14px; }
.stage-row input { flex: 1; min-width: 0; }
.stage-row [data-up] svg.i { transform: rotate(90deg); }
@media (max-width: 720px) { .role-areas { grid-template-columns: 1fr; } }

/* Quotes */
.q-lines { display: flex; flex-direction: column; gap: 6px; }
.q-line { display: grid; grid-template-columns: minmax(140px, 1.3fr) minmax(140px, 1.6fr) 72px 96px 32px; gap: 6px; align-items: center; }
.q-line select, .q-line input { height: 40px; border: 1px solid var(--md-outline); border-radius: var(--md-shape-sm); padding: 0 10px; background: transparent; font-size: 14px; min-width: 0; }
@media (max-width: 720px) { .q-line { grid-template-columns: 1fr 1fr; } .q-line [data-desc] { grid-column: 1 / -1; } }

/* Brand guide */
.brand-color input[type="color"] { width: 48px; height: 48px; padding: 2px; border: 1px solid var(--md-outline); border-radius: var(--md-shape-sm); background: transparent; flex: none; cursor: pointer; }
.brand-color input[data-hex] { font-family: var(--md-mono); text-transform: lowercase; }
.brand-preview { background: var(--b-bg); color: var(--b-ink); font-family: var(--b-font); border-radius: var(--b-radius); border-top: 4px solid var(--b-primary); padding: 20px 22px; box-shadow: inset 0 0 0 1px var(--md-outline-variant); }
.brand-preview .bp-logo { max-height: 44px; max-width: 160px; display: block; margin-bottom: 8px; }
.brand-preview .bp-name { font-family: var(--b-hfont); font-weight: 700; font-size: 20px; color: var(--b-heading); }
.brand-preview .bp-tag { font-size: 13px; margin-top: 2px; }
.brand-preview .bp-h { font-family: var(--b-hfont); color: var(--b-heading); margin: 16px 0 6px; font-size: 18px; }
.brand-preview .bp-p { font-size: 16px; line-height: 1.5; margin: 0 0 14px; }
.brand-preview a { color: var(--b-link); }
/* The sample link in the preview: shown as a link, goes nowhere (no href, so nothing to click or tab to). */
.brand-preview .bp-link { text-decoration: underline; cursor: default; }
.brand-preview .bp-btn { display: inline-block; background: var(--b-button); color: var(--b-on); border-radius: var(--b-radius); padding: 10px 18px; font-weight: 600; }

/* Payroll cost by month */
.pay-bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 8px; }
.pay-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; min-width: 0; }
.pay-bar span { width: 100%; max-width: 36px; background: var(--md-chart-2); border-radius: var(--md-shape-xs) var(--md-shape-xs) 0 0; min-height: 2px; }
.pay-bar small { font-size: 11px; color: var(--md-on-surface-variant); white-space: nowrap; }

/* Traffic sources with their site's icon (served by Sapienic, src/favicons.ts) */
.src-name { display: inline-flex; align-items: center; gap: 10px; }
.src-name img, .src-name svg.i { width: 16px; height: 16px; flex: none; border-radius: 3px; }
.src-name svg.i { color: var(--md-on-surface-variant); }

/* Visitor map */
.map-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.map-filters .field { min-width: 160px; flex: 1 1 160px; max-width: 240px; }
.map-filters .field select { height: 40px; }
.map-wrap { position: relative; border-radius: var(--md-shape-lg-inc); background: var(--md-surface-container-low); overflow: hidden; }
.visitor-map { display: block; width: 100%; height: min(560px, 62vh); touch-action: none; }
.map-crumbs { position: absolute; top: 12px; left: 16px; z-index: 1; margin: 0; background: var(--md-surface); padding: 4px 10px; border-radius: var(--md-shape-full); box-shadow: var(--md-elev-1); }
.map-legend { position: absolute; bottom: 12px; right: 16px; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--md-on-surface-variant); background: var(--md-surface); padding: 4px 10px; border-radius: var(--md-shape-full); }
.map-legend .swatch { width: 40px; height: 10px; border-radius: 5px; background: linear-gradient(90deg, transparent, var(--md-chart-2)); }

/* Bank and card feeds */
.bank-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bank-bars li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: 14px; }
.bank-bars li i { grid-column: 1 / -1; display: block; height: 6px; border-radius: var(--md-shape-full); background: var(--md-primary); }
.bank-search { width: 100%; height: 40px; padding: 0 16px; border: 1px solid var(--md-outline); border-radius: var(--md-shape-full); background: var(--md-surface-container-lowest); color: var(--md-on-surface); font: inherit; }
.bank-cat { height: 36px; max-width: 220px; padding: 0 8px; border: 1px solid var(--md-outline-variant); border-radius: var(--md-shape-sm, 8px); background: var(--md-surface-container-lowest); color: var(--md-on-surface); font: inherit; font-size: 14px; }
.dt td.nowrap { white-space: nowrap; }
.dt td.pos { color: var(--md-good); }
.error-text { color: var(--md-error); }
.bank-table td { vertical-align: middle; }
.bank-table td.bank-desc { min-width: 180px; max-width: 320px; }
.bank-table td.bank-desc b, .bank-table td.bank-desc .s { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bank-table .bank-cat { max-width: 170px; }
.bank-table td:last-child { white-space: nowrap; }
.bank-acct { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--md-on-surface-variant); }
.bank-acct b { color: var(--md-on-surface); font-weight: 500; white-space: nowrap; }
.bank-conns { list-style: none; margin: 0; padding: 0 16px 8px; }
.bank-conn { display: grid; gap: 4px; padding: 12px 0; border-top: 1px solid var(--md-outline-variant); }
.bank-conn:first-child { border-top: 0; padding-top: 4px; }
.bank-conn-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; }
.bank-conn-head .t { font-weight: 500; }
.bank-conn .s { font-size: 12px; color: var(--md-on-surface-variant); }

/* Money setup steps */
.setup-steps { list-style: none; margin: 0; padding: 0; }
.setup-step { display: grid; grid-template-columns: 32px 1fr auto; gap: 16px; align-items: start; padding: 16px 0; border-top: 1px solid var(--md-outline-variant); }
.setup-step:first-child { border-top: 0; padding-top: 4px; }
.setup-step h3 { margin: 4px 0 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.setup-step p { margin: 0 0 4px; }
.setup-n { width: 32px; height: 32px; border-radius: var(--md-shape-full); display: grid; place-items: center; font-weight: 500; background: var(--md-surface-container-highest); color: var(--md-on-surface); }
.setup-step.done .setup-n { background: var(--md-good-container); color: var(--md-good); }
.setup-step.problem .setup-n { background: var(--md-error-container, #f9dedc); color: var(--md-on-error-container, #410e0b); }
.setup-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.setup-actions .btn { flex-shrink: 0; }
@media (max-width: 640px) { .setup-step { grid-template-columns: 32px minmax(0, 1fr); gap: 12px; } .setup-actions { grid-column: 2; flex-direction: row; align-items: center; } }

/* Registration details */
.reg-accts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.reg-acct { display: flex; gap: 12px; align-items: flex-start; }
.reg-acct .t { font-weight: 500; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.reg-acct .s { font-size: 13px; color: var(--md-on-surface-variant); }
.reg-tick { width: 24px; height: 24px; flex: none; border-radius: 50%; border: 2px solid var(--md-outline); display: grid; place-items: center; margin-top: 1px; }
.reg-acct.ok .reg-tick { background: var(--md-good-container); color: var(--md-good); border-color: transparent; }
.reg-addr { border: 0; padding: 0; margin: 0; min-width: 0; }
.reg-addr legend { padding: 0; margin: 0 0 8px; }

/* DNS hosting */
.ns-list { display: grid; gap: 8px; }
.ns { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 16px; border-radius: var(--md-shape-md); background: var(--md-surface-container); }
.ns code { font: 500 15px var(--md-mono); }

/* Getting started (Home) */
.setup-card { margin-bottom: 16px; background: var(--md-primary-container); color: var(--md-on-primary-container); }
.setup-card header h2 { display: flex; align-items: center; gap: 8px; }
.setup-card .setup-step.current .setup-n { background: var(--md-primary); color: var(--md-on-primary); }
@media (max-width: 640px) { .setup-card .setup-step > .grow { display: contents; } .setup-card .setup-step > .grow > h3 { align-self: center; margin: 0; } .setup-card .setup-step > .grow > .body-m { grid-column: 1 / -1; } }
.setup-card .setup-step { border-top-color: color-mix(in srgb, var(--md-on-primary-container) 15%, transparent); }
.setup-card .field input, .setup-card .field select { background: var(--md-surface-container-lowest); }
.setup-services { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px 0 10px; border-radius: var(--md-shape-sm); border: 1px solid var(--md-outline); background: var(--md-surface-container-lowest); color: var(--md-on-surface); cursor: pointer; font-weight: 500; font-size: 14px; }
.chip-check input { accent-color: var(--md-primary); width: 16px; height: 16px; margin: 0; }
.chip-check:has(input:checked) { background: var(--md-secondary-container); color: var(--md-on-secondary-container); border-color: transparent; }

/* Business lookup (autocomplete) */
.lookup-wrap { position: relative; }
.lookup { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px 0; list-style: none; background: var(--md-surface-container-lowest); color: var(--md-on-surface); border-radius: var(--md-shape-md); box-shadow: var(--md-elev-2); max-height: 320px; overflow: auto; }
.lookup li { display: grid; gap: 2px; padding: 8px 14px; cursor: pointer; font-size: 14px; }
.lookup li span { font-size: 12px; color: var(--md-on-surface-variant); }
.lookup li[aria-selected="true"], .lookup li:hover { background: var(--md-surface-container-high); }
.lookup .lookup-none { cursor: default; font-size: 12px; color: var(--md-on-surface-variant); }
.lookup .lookup-none:hover { background: none; }
