:root {
  --green: #108a00;
  --green-bright: #14a800;
  --green-dark: #0d6e00;
  --green-tint: #f2f7f2;
  --ink: #181818;
  --muted: #676767;
  --line: #d9d9d9;
  --line-soft: #e9e9e9;
  --chip: #efefef;
  --bg: #ffffff;
  --page: #f9f9f9;
  --warn: #9a5b00;
  --warn-bg: #fff6e5;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --hover-line: #b8b8b8;
  --on-green: #ffffff;
  --shadow: rgba(0, 0, 0, 0.15);
  --radius: 12px;
  color-scheme: light;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

:root[data-theme='dark'] {
  --green: #3fc02b;
  --green-bright: #5bd648;
  --green-dark: #8be07d;
  --green-tint: #17261a;
  --ink: #f2f2f2;
  --muted: #a3a3a3;
  --line: #3a3a3a;
  --line-soft: #2a2a2a;
  --chip: #2c2c2c;
  --bg: #181818;
  --page: #111111;
  --warn: #f0b860;
  --warn-bg: #33270f;
  --danger: #ff8a80;
  --danger-bg: #3a1917;
  --hover-line: #5a5a5a;
  --on-green: #0c1a0a;
  --shadow: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-bright); text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.01em; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* ---------- top bar ---------- */
.topbar { border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; background: var(--bg); z-index: 10; }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; gap: 32px; }
.brand { font-size: 24px; font-weight: 700; color: var(--green-bright); letter-spacing: -0.04em; }
.brand:hover { text-decoration: none; }
.brand span { color: var(--ink); font-weight: 500; }
.nav { display: flex; gap: 24px; flex: 1; }
.nav a { color: var(--ink); font-weight: 500; padding: 21px 0; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--green); text-decoration: none; }
.nav a.active { color: var(--green); border-bottom-color: var(--green); }
.sync { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); display: inline-block; margin-right: 6px; }
.dot.on { background: var(--green-bright); }
.dot.err { background: var(--danger); }

.page { max-width: 1280px; margin: 0 auto; padding: 32px 24px 80px; }

/* ---------- buttons & inputs ---------- */
.btn {
  font: inherit; font-weight: 500; border-radius: 10rem; padding: 8px 20px; cursor: pointer;
  border: 2px solid var(--green); background: var(--green); color: var(--on-green); line-height: 1.4; white-space: nowrap;
}
.btn:hover { background: var(--green-bright); border-color: var(--green-bright); text-decoration: none; color: var(--on-green); }
.btn.secondary { background: var(--bg); color: var(--green); border-color: var(--line); }
.btn.secondary:hover { background: var(--green-tint); color: var(--green); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--green); padding: 8px 12px; }
.btn.ghost:hover { background: var(--green-tint); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 4px 14px; font-size: 14px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--green-bright); outline-offset: 2px;
}
input[type='text'], input[type='number'], input[type='search'], input[type='password'], input[type='email'], input[type='tel'], input[type='time'], textarea, select {
  font: inherit; color: var(--ink); width: 100%; padding: 9px 12px; border: 2px solid var(--line);
  border-radius: 8px; background: var(--bg);
}
input:hover, textarea:hover, select:hover { border-color: var(--hover-line); }
input:focus, textarea:focus, select:focus { border-color: var(--ink); outline: none; }
label { font-weight: 500; display: block; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; margin: 0; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--green); }

/* ---------- jobs layout ---------- */
.jobs-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 32px; align-items: start; }
.filters { position: sticky; top: 96px; }
.filter-group { padding: 0 0 24px; margin-bottom: 24px; border-bottom: 1px solid var(--line-soft); }
.filter-group:last-child { border-bottom: 0; }
.filter-group h3 { margin-bottom: 12px; }
.kw-list { list-style: none; margin: 0 0 12px; padding: 0; }
.kw-list li { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.kw-list .checkbox { flex: 1; min-width: 0; }
.kw-list .term { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { border: 0; background: none; cursor: pointer; color: var(--muted); border-radius: 50%; width: 28px; height: 28px; font-size: 16px; line-height: 1; display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--chip); color: var(--ink); }
.kw-add { display: flex; gap: 8px; }
.range { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; margin-bottom: 12px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pill { border: 1px solid var(--line); background: var(--bg); border-radius: 10rem; padding: 3px 12px; font: inherit; font-size: 14px; cursor: pointer; color: var(--ink); }
.pill:hover { border-color: var(--green); color: var(--green); }
.pill.active { background: var(--green-tint); border-color: var(--green); color: var(--green); font-weight: 500; }

.feed-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.feed-head .search { flex: 1; }
.feed-head select { width: auto; }
.feed-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; color: var(--muted); font-size: 14px; }
.card-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.job { padding: 24px; border-bottom: 1px solid var(--line); cursor: pointer; display: block; }
.job:last-child { border-bottom: 0; }
.job:hover { background: var(--green-tint); }
.job:hover .job-title { color: var(--green); text-decoration: underline; }
.job-posted { font-size: 13px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.job-title { font-size: 18px; font-weight: 500; color: var(--ink); margin-bottom: 8px; }
.job-facts { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.job-facts strong { color: var(--ink); font-weight: 500; }
.job-desc { margin-bottom: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { background: var(--chip); color: var(--muted); border-radius: 10rem; padding: 3px 12px; font-size: 14px; font-weight: 500; }
.chip.kw { background: var(--green-tint); color: var(--green-dark); }
.client-row { display: flex; flex-wrap: wrap; gap: 20px; font-size: 14px; color: var(--muted); align-items: center; }
.client-row strong { color: var(--ink); font-weight: 500; }
.verified::before { content: '✓'; display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--green); color: var(--on-green); font-size: 10px; margin-right: 6px; }
.badge { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 10rem; text-transform: uppercase; letter-spacing: 0.03em; }
.badge.sample { background: var(--warn-bg); color: var(--warn); }
.badge.picked { background: var(--green-tint); color: var(--green-dark); }
.badge.new { background: var(--green); color: var(--on-green); }

.empty { border: 1px solid var(--line); border-radius: var(--radius); padding: 48px 32px; text-align: center; }
.empty h2 { margin-bottom: 8px; }
.empty p { color: var(--muted); max-width: 520px; margin: 0 auto 20px; }
.empty .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.banner { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 10px 16px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.banner.error { background: var(--danger-bg); color: var(--danger); }

/* ---------- drawer ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw); background: var(--bg); z-index: 21; overflow-y: auto; box-shadow: -8px 0 24px var(--shadow); animation: slide 0.18s ease-out; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }
.drawer-head { position: sticky; top: 0; background: var(--bg); padding: 16px 32px; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.drawer-body { padding: 32px; }
.drawer-body h2 { font-size: 24px; margin-bottom: 8px; }
.section { padding: 24px 0; border-top: 1px solid var(--line-soft); }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.facts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 20px; }
.fact strong { display: block; font-weight: 500; font-size: 16px; }
.fact span { font-size: 14px; color: var(--muted); }

/* ---------- stepper ---------- */
.stepper { display: flex; margin: 24px 0 32px; }
.step { flex: 1; background: none; border: 0; font: inherit; cursor: pointer; text-align: left; padding: 0 8px 0 0; color: var(--muted); }
.step .bar { height: 6px; border-radius: 3px; background: var(--line-soft); margin-bottom: 10px; }
.step.done .bar, .step.current .bar { background: var(--green); }
.step .name { font-weight: 500; display: flex; align-items: center; gap: 8px; }
.step.done .name, .step.current .name { color: var(--ink); }
.step .num { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: inline-grid; place-items: center; font-size: 13px; }
.step.done .num { background: var(--green); border-color: var(--green); color: var(--on-green); }
.step.current .num { border-color: var(--green); color: var(--green); }
.step .date { font-size: 13px; margin: 2px 0 0 30px; }
.step:hover .name { color: var(--green); }

/* ---------- project page ---------- */
.crumbs { font-size: 14px; margin-bottom: 12px; }
.project-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.project-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 24px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.panel + .panel { margin-top: 24px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.summary h4 { margin: 16px 0 4px; font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.summary ul { margin: 0; padding-left: 20px; }
.summary .risk li { color: var(--warn); }
.rte { border: 2px solid var(--line); border-radius: 8px; background: var(--bg); }
.rte:hover { border-color: var(--hover-line); }
.rte:focus-within { border-color: var(--ink); }
.rte-bar { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line-soft); }
.rte-btn { font: inherit; min-width: 32px; height: 32px; border: 0; border-radius: 6px; background: none; color: var(--ink); cursor: pointer; }
.rte-btn:hover:not(:disabled) { background: var(--chip); }
.rte-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.rte-body { padding: 12px 14px; min-height: 120px; max-height: 480px; overflow-y: auto; line-height: 1.6; outline: none; }
.rte.tall .rte-body { min-height: 420px; max-height: 70vh; font-size: 16px; }
.rte-body:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.rte-body[contenteditable='false'] { opacity: 0.6; }
.rte-body ul, .rte-body ol { margin: 4px 0; padding-left: 24px; }
.rte-body p { margin: 0 0 8px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.theme-toggle { font-size: 18px; width: 36px; height: 36px; flex: none; }
.editor-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; font-size: 14px; color: var(--muted); }
.editor-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; align-items: center; }
.revise { display: flex; gap: 8px; margin-top: 16px; }
.status-tag { font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 10rem; background: var(--chip); color: var(--muted); }
.status-tag.approved { background: var(--green); color: var(--on-green); }
.status-tag.draft { background: var(--warn-bg); color: var(--warn); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--green); border-radius: 50%; display: inline-block; animation: spin 0.8s linear infinite; vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- pipeline ---------- */
.board { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 16px; overflow-x: auto; padding-bottom: 8px; }
.column { background: var(--page); border-radius: var(--radius); padding: 12px; min-height: 320px; border: 2px solid transparent; }
.column.over { border-color: var(--green); background: var(--green-tint); }
.column-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px 12px; font-weight: 500; }
.count { background: var(--line-soft); border-radius: 10rem; padding: 0 9px; font-size: 13px; color: var(--muted); }
.pcard { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 10px; cursor: grab; }
.pcard:hover { border-color: var(--green); }
.pcard.dragging { opacity: 0.4; }
.pcard a { color: var(--ink); font-weight: 500; display: block; margin-bottom: 8px; }
.pcard a:hover { color: var(--green); }
.pcard-foot { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--muted); }
.pcard-move { display: flex; gap: 2px; }

/* ---------- settings ---------- */
.settings { max-width: 760px; }
.settings .panel h2 { margin-bottom: 4px; }
.settings .panel > p { margin-bottom: 20px; }
.conn { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line-soft); }
.conn:first-of-type { border-top: 0; }
code { background: var(--chip); padding: 1px 6px; border-radius: 4px; font-size: 14px; }
ol.steps { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }
ol.steps li { margin-bottom: 4px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 20px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 30; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.error { background: var(--danger); color: var(--bg); }

@media (max-width: 900px) {
  .jobs-layout, .project-grid { grid-template-columns: 1fr; }
  .filters { position: static; }
  .topbar-inner { gap: 16px; padding: 0 16px; }
  .nav { gap: 16px; }
  .sync .sync-text { display: none; }
  .page { padding: 24px 16px 64px; }
  .drawer-head, .drawer-body { padding-left: 20px; padding-right: 20px; }
  .step .date { display: none; }
  .project-head { flex-direction: column; }
}

/* ---------- settings extras, login ---------- */
.nav a.icon-btn { padding: 0; }
a.icon-btn { color: var(--muted); }
a.icon-btn:hover { text-decoration: none; }
a.icon-btn.active { color: var(--green); background: var(--green-tint); }
.cred { display: flex; gap: 8px; align-items: center; }
code.block { display: block; padding: 9px 12px; overflow-wrap: anywhere; user-select: all; }
.settings .panel h2 { display: flex; align-items: center; }
.settings .panel h2 .dot { width: 10px; height: 10px; margin-right: 10px; }
.tag-list { list-style: none; margin: 0 0 12px; padding: 0; max-width: 360px; }
.tag-list li { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.login { max-width: 400px; margin: 10vh auto 0; }
.login h1 { margin-bottom: 20px; }
body.locked .nav, body.locked .sync { visibility: hidden; }
[hidden] { display: none !important; }
.member-list { list-style: none; margin: 0; padding: 0; }
.member-list li { display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.member-list li:first-child { border-top: 0; }
.board-filters { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.board-filters select { width: auto; }

/* ---------- collapsible settings sections ---------- */
.fold { padding: 0; }
.fold > summary { list-style: none; cursor: pointer; padding: 20px 24px; display: flex; justify-content: space-between; align-items: center; gap: 16px; border-radius: var(--radius); }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: '›'; font-size: 22px; line-height: 1; color: var(--muted); transition: transform 0.15s; margin-left: 4px; }
.fold[open] > summary::after { transform: rotate(90deg); }
.fold > summary:hover { background: var(--green-tint); }
.fold > summary h2 { margin: 0; flex: 1; }
.fold > summary:focus-visible { outline: 2px solid var(--green-bright); outline-offset: 2px; }
.fold-body { padding: 4px 24px 24px; }
.fold-body > p.muted:first-child { margin-bottom: 20px; }
.settings .panel + .panel { margin-top: 12px; }
.cred input { flex: 1; min-width: 0; }
code.block { border: 2px solid var(--line-soft); border-radius: 8px; line-height: 1.5; font-size: inherit; }
input, select, textarea { min-height: 42px; }
input[type='checkbox'] { min-height: 0; }

/* ---------- tag colours, stage and owner on project cards ---------- */
.chip.tag { background: color-mix(in srgb, var(--tag) 16%, transparent); color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.chip.tag::before, .swatch { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--tag); flex: none; }
.swatch { display: inline-block; margin-right: 6px; vertical-align: 0; }
.pcard.tagged { border-left: 5px solid var(--tag); background: color-mix(in srgb, var(--tag) 5%, var(--bg)); }
.pcard-info { display: flex; flex-direction: column; gap: 8px; padding: 10px 0; margin-bottom: 8px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.stage-badge { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.stage-dots { display: inline-flex; gap: 3px; }
.stage-dots i { width: 14px; height: 5px; border-radius: 3px; background: var(--line); }
.stage-dots i.on { background: var(--green); }
.person { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; min-width: 0; }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--green); color: var(--on-green); font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; flex: none; }
.avatar.none { background: var(--chip); color: var(--muted); }
input[type='color'] { width: 42px; min-width: 42px; height: 42px; padding: 3px; border: 2px solid var(--line); border-radius: 8px; background: var(--bg); cursor: pointer; }

.pager { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.pager .pill { min-width: 36px; padding: 6px 12px; }
.pager .pill:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- checkboxes: same look in both themes, white tick ---------- */
.checkbox input[type='checkbox'] { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; min-height: 0; flex: none; margin: 0; border: 2px solid var(--hover-line); border-radius: 5px; background: var(--bg); display: inline-grid; place-content: center; cursor: pointer; }
.checkbox input[type='checkbox']:checked { background: #108a00; border-color: #108a00; }
.checkbox input[type='checkbox']:checked::after { content: ''; width: 10px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: translateY(-1px) rotate(-45deg); }
.checkbox.field { margin-bottom: 16px; }
.term .swatch { margin-right: 8px; }

/* ---------- attachments ---------- */
.file-list { list-style: none; margin: 0 0 12px; padding: 0; }
.file-list:empty { margin: 0; }
.file-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.file-list li:first-child { border-top: 0; }
.file-kind { flex: none; width: 40px; height: 40px; border-radius: 8px; background: var(--chip); color: var(--muted); font-size: 11px; font-weight: 600; display: grid; place-items: center; letter-spacing: 0.03em; }
.file-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-name { font: inherit; font-weight: 500; color: var(--green); background: none; border: 0; padding: 0; cursor: pointer; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.file-name:hover { text-decoration: underline; }
.file-main > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.warn-text { color: var(--warn); }
.summary .asked li { font-weight: 500; }

label.btn { display: inline-block; cursor: pointer; }

/* ---------- proposal header tools, attachments under the brief ---------- */
.panel-tools { display: inline-flex; align-items: center; gap: 6px; }
.panel-tools .icon-btn { width: 34px; height: 34px; color: var(--green); border: 1px solid var(--line); }
.panel-tools .icon-btn:hover:not(:disabled) { background: var(--green-tint); border-color: var(--green); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.attachments { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.project-grid > div > .panel + .panel { margin-top: 24px; }

/* ---------- working links ---------- */
.links-panel { margin-bottom: 24px; border-color: var(--green); }
.link-list { list-style: none; margin: 0 0 12px; padding: 0; }
.link-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.link-list li:first-child { border-top: 0; }
.link-list a { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-add { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; gap: 8px; }
.pcard-links { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.pcard .pcard-links a.chip { display: inline-block; margin: 0; font-size: 12px; font-weight: 500; color: var(--green); background: var(--green-tint); }
.pcard .pcard-links a.chip:hover { text-decoration: underline; }
@media (max-width: 700px) { .link-add { grid-template-columns: 1fr; } }

.field .rte .rte-body { min-height: 90px; }

/* ---------- icon + value metadata ---------- */
.ico { flex: none; vertical-align: -2px; }
.meta { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.meta.ok { color: var(--green); }
.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.client-row { gap: 6px 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon-btn.tool { width: 38px; height: 38px; border: 1px solid var(--line); color: var(--ink); }
.icon-btn.tool:hover { border-color: var(--green); color: var(--green); background: var(--green-tint); }
.icon-btn.tool.danger { color: var(--danger); }
.icon-btn.tool.danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }
.sync .icon-btn { color: var(--green); }
.pcard-foot .meta, .job-posted .meta { gap: 4px; }

/* ---------- link icons on projects ---------- */
a.icon-btn.tool { color: var(--green); }
.icon-btn.link-ico { width: 30px; height: 30px; color: var(--green); border: 1px solid var(--line); }
.icon-btn.link-ico:hover { border-color: var(--green); background: var(--green-tint); }
.pcard a.icon-btn { display: inline-grid; margin: 0; }
.drawer .link-add { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; }

/* ---------- stage deadlines ---------- */
input[type='date'] { font: inherit; color: var(--ink); width: 100%; padding: 8px 10px; border: 2px solid var(--line); border-radius: 8px; background: var(--bg); min-height: 42px; }
.deadline-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.deadline-cell { margin: 0; font-weight: 400; }
.deadline-cell span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.meta.deadline { font-size: 13px; font-weight: 500; }
.meta.deadline.soon { color: var(--warn); }
.meta.deadline.overdue { color: var(--danger); }
.step .date .meta.deadline { font-size: 12px; }
.pcard-stage { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* ---------- timeline view ---------- */
.tl-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-bottom: 16px; }
.tl-nav { display: flex; align-items: center; gap: 10px; }
.tl-nav strong { min-width: 150px; text-align: center; font-weight: 500; }
.tl-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-left: auto; color: var(--muted); }
.tl-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.tl { min-width: 720px; }
.tl.month { min-width: 1100px; }
.tl-row { display: grid; grid-template-columns: 230px minmax(0, 1fr); border-top: 1px solid var(--line-soft); }
.tl-row:first-child { border-top: 0; }
.tl-name { padding: 10px 14px; border-left: 4px solid var(--tag, transparent); display: flex; flex-direction: column; min-width: 0; color: var(--ink); background: var(--bg); position: sticky; left: 0; z-index: 2; border-right: 1px solid var(--line-soft); }
a.tl-name:hover { text-decoration: none; background: var(--green-tint); }
.tl-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-track { position: relative; min-height: 54px;
  background-image: repeating-linear-gradient(to right, var(--line-soft) 0 1px, transparent 1px calc(100% / var(--days))); }
.tl-head .tl-track { min-height: 34px; background-image: none; }
.tl-head .tl-name { border-left-color: transparent; }
.tl-day { position: absolute; top: 0; bottom: 0; display: grid; place-items: center; font-size: 12px; color: var(--muted); white-space: nowrap; }
.tl-day.weekend { color: var(--line); }
.tl.week .tl-day.weekend, .tl-day.weekend { color: var(--muted); opacity: 0.6; }
.tl-day.today { color: var(--on-green); background: var(--green); border-radius: 6px; font-weight: 600; opacity: 1; }
.tl-row:not(.tl-head) .tl-track::after { content: ''; position: absolute; top: 0; bottom: 0; width: calc(100% / var(--days)); left: calc(var(--today) * 100% / var(--days)); background: var(--green-tint); pointer-events: none; }
.tl[style*="--today:-1"] .tl-track::after { display: none; }
.tl-bar { position: absolute; top: 50%; height: 10px; transform: translateY(-50%); border-radius: 5px; background: color-mix(in srgb, var(--tag) 35%, transparent); z-index: 1; }
.tl-mark { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 24px; height: 24px; border-radius: 50%; background: var(--c); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; z-index: 1; cursor: default; }
.tl-mark.done { opacity: 0.45; }
.tl-mark.late { box-shadow: 0 0 0 3px var(--danger); }
.tl-mark.static { position: static; transform: none; width: 18px; height: 18px; font-size: 10px; display: inline-grid; }
.head-actions { align-items: center; }

.pcard-stage { flex-wrap: wrap; }
.board { grid-template-columns: repeat(5, minmax(230px, 1fr)); }

@media (max-width: 900px) { .step .date { display: block; margin-left: 0; } }

/* ---------- upload progress ---------- */
.upload-box { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 8px 0 12px; }
.upload-head { font-weight: 500; margin-bottom: 8px; }
.upload-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 6px 0; font-size: 14px; }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-state { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.upload-bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--line-soft); overflow: hidden; }
.upload-bar i { display: block; height: 100%; background: var(--green); transition: width 0.15s; }
.upload-row.done .upload-state { color: var(--green); font-weight: 600; }
.upload-row.failed .upload-state { color: var(--danger); white-space: normal; max-width: 260px; }
.upload-row.failed .upload-bar i { background: var(--danger); width: 100% !important; }
.upload-row.waiting .upload-bar i { width: 0; }

/* ---------- file viewer ---------- */
.viewer { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.82); display: flex; flex-direction: column; }
.viewer-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 20px; background: var(--bg); border-bottom: 1px solid var(--line); }
.viewer-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-body { flex: 1; min-height: 0; display: grid; place-items: center; padding: 16px; overflow: auto; }
.viewer-frame { width: min(1100px, 100%); height: 100%; border: 0; border-radius: 8px; background: #fff; }
.viewer-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; background: #fff; }
.viewer-text { width: min(900px, 100%); max-height: 100%; overflow: auto; margin: 0; padding: 20px; border-radius: 8px; background: var(--bg); color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; font: 14px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; align-self: start; }
.viewer-body .empty { background: var(--bg); }
.viewer-body > p { background: var(--bg); padding: 12px 18px; border-radius: 8px; }

/* ---------- analysis language switch, proposal checks ---------- */
.panel-tools .icon-btn.lang-btn { width: auto; min-width: 38px; padding: 0 8px; font: inherit; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; border-radius: 10rem; }
.checks ul { list-style: none; margin: 8px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); font-size: 13px; }
.checks li::before { content: '• '; }

/* ---------- platform label ---------- */
.plat { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; color: var(--ink); border: 1px solid color-mix(in srgb, var(--plat) 60%, transparent); background: color-mix(in srgb, var(--plat) 14%, transparent); }
.plat::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--plat); }
.swatch.sq { border-radius: 2px; }

/* ---------- full-width layout ---------- */
.topbar-inner, .page { max-width: none; padding-left: clamp(16px, 2.5vw, 40px); padding-right: clamp(16px, 2.5vw, 40px); }
.jobs-layout { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); }
.board { grid-template-columns: repeat(5, minmax(240px, 1fr)); }
.settings { max-width: none; }
.settings > .panel, .settings > details { break-inside: avoid; }
@media (min-width: 1200px) {
  .settings-grid { column-count: 2; column-gap: 16px; }
  .settings-grid > details { margin: 0 0 12px !important; }
}
@media (min-width: 1700px) {
  .project-grid { grid-template-columns: minmax(0, 4fr) minmax(0, 5fr); }
  .card-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-list .job { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
}
.board-filters { align-items: flex-start; }
.board-filters .presets { flex: 1 1 auto; }

/* ---------- tablets and phones ---------- */
@media (max-width: 1100px) {
  .project-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .topbar-inner { height: auto; min-height: 56px; flex-wrap: wrap; gap: 8px 16px; padding-top: 8px; padding-bottom: 8px; }
  .nav { order: 3; flex: 1 0 100%; gap: 20px; }
  .nav a { padding: 8px 0; }
  .brand { flex: 1; }
  .page-head { flex-wrap: wrap; }
  .head-actions { justify-content: flex-start; }
  .board { grid-template-columns: repeat(5, minmax(78vw, 1fr)); scroll-snap-type: x mandatory; }
  .board .column { scroll-snap-align: start; }
  .feed-head { flex-wrap: wrap; }
  .tl-legend { margin-left: 0; }
  .tl-row { grid-template-columns: 150px minmax(0, 1fr); }
  .drawer { width: 100vw; }
}
@media (max-width: 600px) {
  h1 { font-size: 22px; }
  .form-row, .drawer .link-add, .link-add { grid-template-columns: 1fr !important; }
  .panel, .fold-body { padding-left: 16px; padding-right: 16px; }
  .fold > summary { padding: 16px; }
  .panel { padding-top: 16px; padding-bottom: 16px; }
  .job { padding: 16px; }
  .editor-actions .btn { flex: 1 1 auto; }
  .stepper { overflow-x: auto; }
  .step { min-width: 92px; }
  .member-list li { grid-template-columns: 1fr auto; }
  .toast { left: 16px; right: 16px; transform: translateY(20px); max-width: none; }
  .toast.show { transform: none; }
  .viewer-head { padding: 8px 12px; }
  .viewer-body { padding: 8px; }
}

/* ---------- compact project cards: three per column, the rest scrolls ---------- */
.column { min-height: 0; display: flex; flex-direction: column; }
.column-body { --card-h: 148px; display: flex; flex-direction: column; gap: 10px; max-height: calc(3 * var(--card-h) + 2 * 10px); min-height: var(--card-h); overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; scrollbar-width: thin; }
.pcard { height: var(--card-h); flex: none; margin: 0; padding: 12px; display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.pc-top { display: flex; align-items: center; gap: 6px; min-height: 22px; overflow: hidden; white-space: nowrap; }
.pc-top .chip, .pc-top .plat { flex: none; font-size: 11px; padding: 1px 8px; }
.pcard a.pc-title { margin: 0; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.pc-row { display: flex; align-items: center; gap: 4px 10px; flex-wrap: nowrap; overflow: hidden; white-space: nowrap; font-size: 12px; }
.pc-row .meta { flex: none; }
.pc-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 6px; min-width: 0; }
.pc-foot .person { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-foot .avatar { width: 20px; height: 20px; font-size: 10px; }
.pc-foot .icon-btn { width: 24px; height: 24px; font-size: 14px; }
.pc-foot .icon-btn.link-ico { width: 24px; height: 24px; }
.pc-foot .icon-btn.link-ico svg { width: 14px; height: 14px; }
.pcard-move { flex: none; align-items: center; }

/* ---------- stage deadlines on one line ---------- */
.drawer { width: min(920px, 100vw); }
.deadline-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.deadline-cell span { font-size: 12px; margin-bottom: 2px; }
.deadline-cell input[type='date'] { font-size: 12px; padding: 4px 6px; min-height: 34px; border-width: 1px; }
.deadline-cell input[type='date']::-webkit-calendar-picker-indicator { width: 12px; height: 12px; padding: 0; margin-left: 2px; }
.deadline-cell input[type='date']::-webkit-datetime-edit { padding: 0; }

/* ---------- use the full width ---------- */
.topbar-inner, .page { padding-left: clamp(12px, 1.4vw, 24px); padding-right: clamp(12px, 1.4vw, 24px); }
.page { padding-top: 24px; }
.board { gap: 12px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .board { grid-template-columns: repeat(5, minmax(250px, 1fr)); } }
@media (max-width: 600px) {
  .board { grid-template-columns: repeat(5, minmax(84vw, 1fr)); }
  .deadline-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Upwork sub-tabs ---------- */
.subnav { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--line-soft); }
.subnav a { color: var(--muted); font-weight: 500; padding: 6px 14px 10px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--green); text-decoration: none; }
.subnav a.active { color: var(--ink); border-bottom-color: var(--green); }

/* ---------- clock in the top bar ---------- */
.clock { display: flex; align-items: center; gap: 6px; padding: 3px 4px 3px 14px; border: 1px solid var(--line); border-radius: 10rem; max-width: 320px; min-width: 0; font-size: 14px; }
.clock.running { border-color: var(--danger); background: var(--danger-bg); }
.clock-time { font: inherit; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; }
.clock-time:hover { color: var(--green); }
.clock.over .clock-time { color: var(--warn); }
.clock-btn { width: 30px; height: 30px; color: var(--danger); }
.clock.running .clock-btn { color: var(--ink); }

/* ---------- tasks ---------- */
.tboard { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tboard .column-body { --card-h: auto; max-height: 70vh; min-height: 80px; }
.tcard { background: var(--bg); border: 1px solid var(--line); border-left: 5px solid var(--tag, var(--line)); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; cursor: grab; flex: none; }
.tcard:hover { border-color: var(--green); border-left-color: var(--tag, var(--green)); }
.tcard.dragging { opacity: 0.4; }
.tcard.running { box-shadow: 0 0 0 2px var(--danger-bg); border-color: var(--danger); border-left-color: var(--tag, var(--danger)); }
.tc-title { font: inherit; font-weight: 500; font-size: 14px; line-height: 1.35; color: var(--ink); background: none; border: 0; padding: 0; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.tc-title:hover { color: var(--green); text-decoration: underline; }
.tcard .pc-top .chip { font-size: 11px; padding: 1px 8px; }
.tcard .pc-row { flex-wrap: wrap; white-space: normal; }
.tcard .pc-foot { gap: 8px; }
.ttime { font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; gap: 4px; }
.ttime.over { color: var(--warn); }
.icon-btn.rec { width: 28px; height: 28px; color: var(--danger); border: 1px solid var(--line); flex: none; }
.icon-btn.rec:hover { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.icon-btn.rec.on { color: var(--ink); border-color: var(--danger); background: var(--danger-bg); }
.tstage { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 10rem; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--ink); white-space: nowrap; }
.tstage::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.filter-selects { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-selects select { width: auto; max-width: 240px; }
.tgroup { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.tgroup-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; background: var(--page); border-bottom: 1px solid var(--line-soft); }
.tgroup-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.trow { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1.6fr) minmax(0, 1.6fr) 110px 70px 150px 36px; gap: 12px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line-soft); }
.trow:first-child { border-top: 0; }
.trow.running { background: var(--danger-bg); }
.trow .chip { font-size: 12px; }
.trow-project, .trow .person { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.trow-type { min-width: 0; overflow: hidden; }
.tstepper { margin: 20px 0 16px; }
.tstepper .step:disabled { cursor: default; }
.tstepper .date { margin-left: 30px; font-size: 12px; }
.tclock { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 24px; }
.tclock.running { border-color: var(--danger); background: var(--danger-bg); }
.tclock-time { font-size: 32px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tclock .btn { display: inline-flex; align-items: center; gap: 8px; }
.tclock .btn .ico { color: var(--danger); }
.tclock .btn.secondary .ico { color: var(--ink); }
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; }
.comments { list-style: none; margin: 0 0 12px; padding: 0; }
.comments li { padding: 10px 0; border-top: 1px solid var(--line-soft); }
.comments li:first-child { border-top: 0; }
.comment-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 4px; }
.comment-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.drawer.narrow { width: min(520px, 100vw); }

/* ---------- records ---------- */
.block-title { font-size: 16px; font-weight: 600; margin: 28px 0 12px; }
.page-head + .block-title { margin-top: 0; }
.table-scroll { overflow-x: auto; }
.panel.flush { padding: 0; }
.rtable { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.rtable th, .rtable td { padding: 10px 14px; text-align: right; border-top: 1px solid var(--line-soft); white-space: nowrap; }
.rtable thead th { border-top: 0; color: var(--muted); font-weight: 500; }
.rtable th[scope='row'], .rtable thead th:first-child { text-align: left; font-weight: 500; }
.rtable .current { background: var(--green-tint); }
.rtable tfoot th, .rtable tfoot td { font-weight: 600; border-top: 2px solid var(--line); }
.linkish { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.linkish:hover { color: var(--green); text-decoration: underline; }
.rtable thead .current .linkish { color: var(--green); font-weight: 600; }
.rtask { border-top: 1px solid var(--line-soft); }
.rtask:first-child { border-top: 0; }
.rtask > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; }
.rtask > summary::-webkit-details-marker { display: none; }
.rtask > summary::before { content: '›'; color: var(--muted); transition: transform 0.15s; }
.rtask[open] > summary::before { transform: rotate(90deg); }
.rtask-title { font-weight: 500; }
.rtask-time { margin-left: auto; font-variant-numeric: tabular-nums; }
.rtask .chip { font-size: 12px; }
.entries { list-style: none; margin: 0 0 8px 18px; padding: 0; }
.entries li { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 4px 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.entries li.edit { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 80px 28px; }
.entries li strong { text-align: right; font-weight: 500; }
input[type='datetime-local'] { font: inherit; font-size: 13px; color: var(--ink); width: 100%; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); min-height: 34px; }
.entry-add { display: grid; grid-template-columns: minmax(0, 1fr) 110px auto; gap: 8px; margin: 0 0 12px 18px; }
.entry-add input[type='number'] { min-height: 34px; padding: 4px 8px; border-width: 1px; font-size: 13px; }

/* ---------- dashboard ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 24px; }
.tile { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.tile-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.tile-value { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; margin-bottom: 24px; }
.dash-grid .panel + .panel { margin-top: 0; }
.vbars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; height: 220px; align-items: end; }
.vbar { display: grid; grid-template-rows: 18px minmax(0, 1fr) 20px; height: 100%; text-align: center; font-size: 11px; color: var(--muted); }
.vbar-val { font-variant-numeric: tabular-nums; }
.vbar-track { display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--line); }
.vbar-track i { display: block; width: min(70%, 36px); min-height: 0; background: var(--green); border-radius: 4px 4px 0 0; }
.vbar:hover .vbar-track i { background: var(--green-bright); }
.vbar-label { padding-top: 4px; }
.vbar.today .vbar-label { color: var(--green); font-weight: 600; }
.vbars.month .vbar-val { font-size: 9px; }
.hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hbars li { display: grid; grid-template-columns: minmax(80px, 1.2fr) minmax(0, 2fr) 64px; gap: 10px; align-items: center; font-size: 14px; }
.hb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { height: 10px; border-radius: 5px; background: var(--line-soft); overflow: hidden; }
.hb-track i { display: block; height: 100%; background: var(--green); border-radius: 0 4px 4px 0; }
.hb-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.dash-team td, .dash-team th { text-align: left; }
.dash-team td:nth-child(n + 3) { text-align: right; }
.dash-team thead th:nth-child(n + 3) { text-align: right; }
.now { display: inline-flex; align-items: center; gap: 8px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex: none; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
.progress-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.progress-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; font-size: 14px; }
.progress-track { display: block; height: 8px; border-radius: 4px; background: var(--line-soft); overflow: hidden; }
.progress-track i { display: block; height: 100%; background: var(--green); }
.panel + .panel { margin-top: 24px; }

/* ---------- settings: access & task types ---------- */
.settings-wide { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.settings-wide > details { margin: 0 !important; }
table.access, table.types { border-collapse: collapse; font-size: 14px; }
table.access th, table.access td { padding: 8px 14px; border-top: 1px solid var(--line-soft); text-align: center; }
table.access thead th { border-top: 0; color: var(--muted); font-weight: 500; }
table.access th[scope='row'], table.access thead th:first-child { text-align: left; font-weight: 500; white-space: nowrap; }
table.access .checkbox { justify-content: center; }
table.access input:disabled { opacity: 0.5; cursor: not-allowed; }
table.types { width: 100%; }
table.types th { text-align: left; color: var(--muted); font-weight: 500; padding: 4px 6px; }
table.types td { padding: 3px 6px 3px 0; }
table.types input[type='text'], table.types input[type='number'] { min-height: 36px; padding: 5px 8px; border-width: 1px; font-size: 14px; }
table.types input[type='number'] { width: 80px; }
table.types input[type='color'] { width: 36px; min-width: 36px; height: 36px; border-width: 1px; }
.type-add { display: grid; grid-template-columns: minmax(0, 2fr) 100px minmax(0, 1.4fr) auto; gap: 8px; margin-top: 12px; max-width: 720px; }

@media (max-width: 1100px) {
  .tboard { grid-template-columns: repeat(4, minmax(250px, 1fr)); }
  .trow { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) 110px 150px 36px; }
  .trow > span:nth-child(5) { display: none; }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .clock { order: 2; max-width: none; }
  .trow { grid-template-columns: minmax(0, 1fr) auto auto; }
  .trow .trow-type, .trow > .person, .trow-project, .trow > span:nth-child(4), .trow > span:nth-child(5) { display: none; }
}
@media (max-width: 600px) {
  .tboard { grid-template-columns: repeat(4, minmax(84vw, 1fr)); }
  .tclock { flex-direction: column; align-items: flex-start; }
  .entries li.edit { grid-template-columns: 1fr 1fr; }
  .entry-add, .type-add { grid-template-columns: 1fr 1fr; }
  .hbars li { grid-template-columns: minmax(70px, 1fr) minmax(0, 1.5fr) 56px; }
}
.page-head select { width: auto; max-width: 240px; }
.sync, .sync-text { white-space: nowrap; }
@media (max-width: 600px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile { padding: 12px 14px; }
  .tile-value { font-size: 22px; }
}

/* ---------- projects ---------- */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.proj { border: 1px solid var(--line); border-top: 5px solid var(--plat); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.proj-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.proj-name { font-size: 18px; font-weight: 600; color: var(--ink); }
.proj-name:hover { color: var(--green); }
.proj-title { display: flex; align-items: center; gap: 12px; }
.proj-title::before { content: ''; width: 14px; height: 14px; border-radius: 3px; background: var(--plat); }
.stage-bar { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; background: var(--line-soft); }
.stage-bar i { display: block; background: var(--c); min-width: 4px; }
.stage-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); margin-top: 8px; }
.proj .stage-legend { margin-top: 0; }
.proj-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: auto; }
.avatars { display: inline-flex; margin-left: auto; }
.avatars .avatar { width: 24px; height: 24px; font-size: 10px; border: 2px solid var(--bg); margin-left: -6px; }
.avatars .avatar:first-child { margin-left: 0; }
a.tgroup-name { color: var(--ink); }
a.tgroup-name:hover { color: var(--green); }
.job-list { list-style: none; margin: 0; padding: 0; }
.job-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.job-list li:first-child { border-top: 0; }
.job-list a { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcard .pc-row .plat { font-size: 11px; padding: 1px 8px 1px 6px; }
.clock { flex: none; }
@media (max-width: 1280px) {
  .topbar-inner { gap: 16px; }
  .nav { gap: 18px; }
  .sync .sync-text { display: none; }
}

/* ---------- records: daily worked rate, task detail ---------- */
.block-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 28px 0 12px; }
.block-head .block-title { margin: 0; }
.page-head + .block-head { margin-top: 0; }
.rates th, .rates td { text-align: center; padding: 8px 6px; }
.rates th[scope='row'], .rates thead th:first-child { text-align: left; padding-left: 14px; }
.rates td:nth-last-child(-n + 2), .rates th:nth-last-child(-n + 2) { text-align: right; padding-right: 14px; }
.rates thead th.today { color: var(--green); font-weight: 600; }
.rates thead th.weekend { opacity: 0.6; }
.rates.month th:not([scope='row']), .rates.month td { min-width: 44px; font-size: 12px; }
td.rate { min-width: 52px; font-size: 13px; background: color-mix(in srgb, var(--green-bright) calc(var(--r) * 45%), transparent); }
td.rate.full { font-weight: 600; }
.rtask-grid { display: grid; grid-template-columns: minmax(0, 3fr) 110px 110px 100px 150px; gap: 12px; align-items: center; }
.rtask-head { padding: 0 0 6px 18px; border-bottom: 1px solid var(--line-soft); }
.rtask > summary.rtask-grid { display: grid; padding: 10px 0; }
.rtask > summary.rtask-grid::before { position: absolute; }
.rtask > summary.rtask-grid { position: relative; padding-left: 18px; }
.rtask > summary.rtask-grid::before { left: 2px; top: 10px; }
.rtask-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.rtask-title > span:first-child { font-weight: 500; }
.rtask-title .chip, .rtask-title .plat { font-size: 11px; padding: 1px 8px; }
.rtask-grid > span:nth-child(n + 4) { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
  .rtask-grid { grid-template-columns: minmax(0, 1fr) 90px 100px; }
  .rtask-grid > span:nth-child(2), .rtask-grid > span:nth-child(3) { display: none; }
}
.rates th[scope='row'], .rates thead th:first-child { position: sticky; left: 0; z-index: 1; background: var(--bg); min-width: 130px; }
.rates td:last-child, .rates th:last-child { position: sticky; right: 0; z-index: 1; background: var(--bg); min-width: 84px; }
.rates td:nth-last-child(2), .rates th:nth-last-child(2) { position: sticky; right: 84px; z-index: 1; background: var(--bg); min-width: 84px; box-shadow: -1px 0 0 var(--line-soft); }

/* ---------- KPI ---------- */
.dash-grid.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dash-grid.even > .panel, .dash-grid.tiers > .panel { margin-top: 0; }
.score { display: inline-flex; align-items: center; gap: 8px; }
.score-track { width: 80px; height: 8px; border-radius: 4px; background: var(--line-soft); overflow: hidden; }
.score-track i { display: block; height: 100%; background: var(--green); border-radius: 0 4px 4px 0; }
.score strong { min-width: 40px; text-align: right; font-weight: 600; }
.kpi-table th, .kpi-table td { text-align: left; }
.kpi-table td:nth-child(n + 5) { text-align: right; }
.kpi-table thead th:nth-child(n + 5) { text-align: right; }
.kpi-member .panel-head h2 { font-size: 16px; }
.kpi-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.2fr) auto auto minmax(0, 2fr); gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.kpi-row:first-child { border-top: 0; }
.kpi-project { min-width: 0; overflow: hidden; }
.kpi-input { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; font-size: 14px; }
.kpi-input span { color: var(--muted); font-size: 12px; }
.kpi-input input { width: 72px; min-height: 36px; padding: 5px 8px; border-width: 1px; text-align: right; }
.kpi-note { min-height: 36px !important; padding: 5px 10px !important; border-width: 1px !important; font-size: 14px; }
.kpi-add { width: auto; margin-top: 10px; min-height: 36px; padding: 5px 10px; border-width: 1px; font-size: 14px; }
.tier-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tier-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tier-list input { width: 80px; min-height: 36px; padding: 5px 8px; border-width: 1px; text-align: right; }
@media (max-width: 1100px) {
  .dash-grid.even { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .kpi-row > .muted, .kpi-note { grid-column: 1 / -1; }
}
.dash-grid.tiers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .dash-grid.tiers { grid-template-columns: 1fr; } }
@media (max-width: 1100px) {
  .kpi-row > .kpi-project { grid-column: 1; grid-row: 1; }
  .kpi-row > .muted { grid-column: 1; grid-row: 2; }
  .kpi-row > .kpi-input { grid-row: 1 / span 2; }
  .kpi-row > .kpi-note { grid-column: 1 / -1; grid-row: 3; }
}

/* ---------- timeline: set and drag deadlines ---------- */
button.tl-name { font: inherit; text-align: left; border: 0; border-right: 1px solid var(--line-soft); border-left: 4px solid var(--tag, transparent); cursor: pointer; }
button.tl-name:hover { background: var(--green-tint); }
.tl-track.settable { cursor: copy; }
.tl-track.settable:hover { background-color: color-mix(in srgb, var(--green-tint) 60%, transparent); }
.tl-mark.draggable { cursor: grab; touch-action: none; }
.tl-mark.draggable:hover { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 35%, transparent); }
.tl-mark.dragging { cursor: grabbing; z-index: 3; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 45%, transparent); transition: none; }

/* ---------- projects: leader, list view ---------- */
.proj-title-wrap { display: flex; flex-direction: column; min-width: 0; }
.proj-table th, .proj-table td { text-align: left; }
.proj-table td:nth-child(n + 4):not(.row-actions) { text-align: right; }
.proj-table thead th:nth-child(n + 4) { text-align: right; }
.proj-cell { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); }
.proj-cell::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--plat); flex: none; }
.proj-cell:hover { color: var(--green); }
.proj-progress { min-width: 200px; }
.proj-progress-row { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: center; }
.row-actions { white-space: nowrap; text-align: right; }

/* ---------- members (Dashboard) ---------- */
.member-card { padding: 18px 20px; }
.member-head { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; }
.member-who { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.member-who .person { font-size: 15px; }
.member-now { flex: 1; min-width: 0; }
.member-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 14px 0 6px; }
.member-stats .tile { padding: 10px 14px; }
.member-stats .tile-value { font-size: 20px; }
.member-tasks > summary { cursor: pointer; color: var(--green); font-weight: 500; padding: 8px 0; }
.mrow { grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.4fr) 110px 150px 150px 60px; }
.entries.flat { margin-left: 0; }
.entry-add.flat { margin-left: 0; }

/* ======================================================================
   Phones and small tablets. Kept last so it wins over the wide-screen rules above.
   The main tabs move to a bottom bar for one-handed use.
   ====================================================================== */
@media (max-width: 900px) {
  .page { padding: 16px 14px calc(84px + env(safe-area-inset-bottom)); }
  .topbar-inner { flex-wrap: nowrap; height: 56px; min-height: 0; padding: 0 12px; gap: 8px; }
  .brand { flex: 1; font-size: 22px; }
  .sync { display: none; }
  #account { max-width: 110px; overflow: hidden; text-overflow: ellipsis; padding: 4px 8px; }
  .clock { order: 0; padding: 2px 2px 2px 10px; }
  .theme-toggle { width: 36px; height: 36px; }

  /* bottom tab bar */
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; order: 0; flex: none; gap: 0; margin: 0;
    display: flex; background: var(--bg); border-top: 1px solid var(--line); padding: 0 4px env(safe-area-inset-bottom); box-shadow: 0 -4px 16px var(--shadow); }
  .nav a { flex: 1; text-align: center; padding: 14px 4px; font-size: 14px; border-bottom: 0; border-top: 3px solid transparent; white-space: nowrap; min-height: 52px; }
  .nav a.active { border-top-color: var(--green); border-bottom: 0; }
  body.locked .nav { display: none; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }

  .subnav { overflow-x: auto; scrollbar-width: none; margin-bottom: 14px; }
  .subnav a { white-space: nowrap; padding: 10px 14px 12px; }

  .page-head { flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
  .page-head h1 { font-size: 24px; }
  .head-actions { width: 100%; justify-content: flex-start; gap: 8px; }
  .head-actions > .btn { margin-left: auto; }
  .head-actions .presets { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  .page-head select, .filter-selects select { flex: 1; max-width: none; min-width: 0; }
  .tl-nav { flex-wrap: wrap; }
  .tl-nav strong { min-width: 0; }

  /* Find work: one column, feed first */
  .jobs-layout { grid-template-columns: 1fr; gap: 20px; }
  .jobs-layout > section { order: -1; }
  .filters { position: static; }
  .card-list { display: block; }
  .feed-head { flex-wrap: wrap; }
  .feed-head .search { flex: 1 1 100%; }
  .feed-head select { flex: 1; }

  /* boards scroll sideways, one column per screen */
  .board { grid-template-columns: repeat(5, minmax(82vw, 1fr)); scroll-snap-type: x mandatory; gap: 10px; }
  .tboard { grid-template-columns: repeat(4, minmax(82vw, 1fr)); }
  .board .column { scroll-snap-align: start; }
  .board-filters { flex-direction: column; align-items: stretch; gap: 10px; }
  .board-filters .presets { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .board-filters .pill { white-space: nowrap; }
  .filter-selects { width: 100%; }

  /* task and member rows become small cards */
  .trow, .mrow { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 12px 14px; }
  .trow > .tc-title { grid-column: 1 / -1; font-size: 15px; }
  .trow > *:not(.tc-title):not(.trow-clock) { display: inline-flex !important; }
  .trow .trow-type, .trow > .person, .trow-project { grid-column: auto; }
  .trow-clock { grid-column: 2; grid-row: 1; justify-self: end; }
  .trow:has(.trow-clock button) > .tc-title { grid-column: 1; }
  .tgroup-head { flex-wrap: wrap; gap: 4px 12px; }

  /* records, KPI, projects */
  .rtask-grid { grid-template-columns: minmax(0, 1fr) 80px; }
  .rtask-grid > span:nth-child(2), .rtask-grid > span:nth-child(3), .rtask-grid > span:nth-child(5) { display: none; }
  .entries { margin-left: 0; }
  .entries li.edit { grid-template-columns: 1fr 1fr; }
  .entries li.edit strong { text-align: left; }
  .entry-add { grid-template-columns: 1fr 1fr; margin-left: 0; }
  .entry-add .btn { grid-column: 1 / -1; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .kpi-row > .kpi-project, .kpi-row > .muted, .kpi-row > .kpi-note { grid-column: 1 / -1; grid-row: auto; }
  .kpi-row > .kpi-input { grid-row: auto; }
  .proj-grid { grid-template-columns: 1fr; }
  .dash-grid, .dash-grid.even, .dash-grid.tiers { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .member-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .member-head .btn { margin-left: auto; }

  /* drawers fill the screen, actions stay in reach */
  .drawer, .drawer.narrow { width: 100vw; }
  .drawer-head { padding: 10px 14px; }
  .drawer-body { padding: 20px 16px 40px; }
  .form-row { grid-template-columns: 1fr; }
  .tclock-time { font-size: 28px; }
  .tstepper { overflow-x: auto; }
  .tstepper .step { min-width: 96px; }
  .comment-add { grid-template-columns: 1fr; }
  .project-head { flex-direction: column; }
  .head-actions .icon-btn.tool { flex: none; }

  /* timelines keep the name column narrow */
  .tl-row { grid-template-columns: 130px minmax(0, 1fr); }
  .tl-toolbar { gap: 10px; }
  .tl-legend { display: none; }
}

@media (max-width: 600px) {
  .tiles, .member-stats { grid-template-columns: 1fr 1fr; }
  .tile-value { font-size: 22px; }
  .board-filters select { width: 100%; }
  .settings-grid { column-count: 1; }
}

/* Bigger touch targets on touch screens. */
@media (pointer: coarse) {
  .icon-btn { width: 40px; height: 40px; }
  .icon-btn.rec, .pc-foot .icon-btn, .clock-btn { width: 38px; height: 38px; }
  .pill { padding: 7px 14px; }
  .btn.sm { padding: 7px 14px; }
}
html, body { overflow-x: clip; }
#account { display: inline-flex; align-items: center; gap: 8px; }
#account .avatar { width: 26px; height: 26px; font-size: 11px; }
@media (max-width: 900px) {
  #account { padding: 2px; max-width: none; }
  #account .account-name { display: none; }
  /* The page's main "+ New …" action floats above the tab bar, in reach of the thumb. */
  .page-head .head-actions > .btn:not(.secondary) { position: fixed; right: 14px; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 14;
    padding: 12px 20px; font-size: 15px; box-shadow: 0 6px 18px var(--shadow); margin: 0; }
}
.tl-name .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 900px) {
  .member-now { flex: 1 1 100%; order: 3; }
  .member-now .now { max-width: 100%; }
  .head-actions > select { flex: 1 1 100%; }
  .rates th[scope='row'], .rates thead th:first-child { min-width: 96px; }
  .rates td:last-child, .rates th:last-child, .rates td:nth-last-child(2), .rates th:nth-last-child(2) { position: static; box-shadow: none; min-width: 64px; }
}
@media (max-width: 700px) {
  .proj-table th:nth-child(2), .proj-table td:nth-child(2), .proj-table th:nth-child(n + 5), .proj-table td:nth-child(n + 5):not(.row-actions) { display: none; }
  .proj-table thead th:last-child { display: table-cell; }
  .proj-progress { min-width: 120px; }
}
@media (max-width: 900px) {
  .entries li.edit, .entry-add { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .entries li.edit input, .entry-add input { min-width: 0; width: 100%; font-size: 12px; padding: 4px 6px; }
  .entries li.edit button { justify-self: end; }
}

/* ---------- justified paragraphs ---------- */
.summary p, .summary li, .prose, .job-desc, .rte-body, .comments p, .viewer-text { text-align: justify; text-justify: inter-word; hyphens: auto; }

/* ---------- phones: nothing wider than the screen ---------- */
.project-grid > div, .dash-grid > *, .jobs-layout > *, .settings-grid > * { min-width: 0; }
.panel, .tile { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .project-head h1 { font-size: 22px; line-height: 1.3; overflow-wrap: anywhere; }
  .project-head .chips { gap: 6px; }
  .project-head .head-actions { justify-content: flex-start; }
  .stepper { overflow-x: auto; scrollbar-width: none; margin: 16px -14px 20px; padding: 0 14px; scroll-snap-type: x proximity; }
  .stepper .step { min-width: 104px; flex: none; scroll-snap-align: start; }
  .panel { padding: 16px; }
  .panel-head { flex-wrap: wrap; }
  .panel-head h2 { font-size: 18px; }
  .rte-bar { flex-wrap: wrap; }

  /* job cards size to their content */
  .column-body { max-height: 70vh; }
  .pcard { height: auto; }
  .pc-top { flex-wrap: wrap; white-space: normal; }
  .pc-row { flex-wrap: wrap; white-space: normal; }

  /* every row of filter choices scrolls on its own */
  .presets { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; max-width: 100%;
    -webkit-overflow-scrolling: touch; margin-right: -14px; padding-right: 14px; }
  .presets::-webkit-scrollbar, .subnav::-webkit-scrollbar, .stepper::-webkit-scrollbar { display: none; }
  .presets > * { flex: none; white-space: nowrap; }
  .board-filters, .head-actions { min-width: 0; max-width: 100%; }
  .filters .presets { flex-wrap: wrap; margin-right: 0; padding-right: 0; }
}

/* Touch screens keep no hover look after a tap: only the active choice is highlighted. */
@media (hover: none) {
  .pill:hover { border-color: var(--line); color: var(--ink); }
  .pill.active:hover { border-color: var(--green); color: var(--green); }
  .job:hover, .fold > summary:hover, a.tl-name:hover, button.tl-name:hover { background: none; }
  .pcard:hover, .tcard:hover { border-top-color: var(--line); border-right-color: var(--line); border-bottom-color: var(--line); }
}
@media (max-width: 900px) {
  .topbar-inner > * { flex-shrink: 0; }
  .brand { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; font-size: 20px; }
  .clock { gap: 2px; padding-left: 8px; }
  .clock-time { font-size: 14px; }
  .topbar .theme-toggle, .topbar .icon-btn.theme-toggle { width: 34px; height: 34px; }
}
@media (max-width: 900px) {
  /* task rows: title (and record button) on top, the rest flows underneath */
  .trow, .mrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
  .trow > * { order: 2; max-width: 100%; }
  .trow > .tc-title { order: 0; flex: 1 1 0; min-width: 60%; }
  .trow > .trow-clock { order: 1; margin-left: auto; }
  .trow .chip, .trow .plat { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .trow .trow-type, .trow-project { min-width: 0; max-width: 100%; }
}

/* ---------- proposals: job time, linked tasks ---------- */
.job-work { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 16px; margin-bottom: 24px; align-items: start; }
.job-work .tclock { margin: 0; }
.job-work .linked-tasks { margin: 0; }
.linked-tasks .trows { border: 1px solid var(--line-soft); border-radius: 8px; overflow: hidden; }
.linked-tasks .mrow { grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) 110px 150px 60px; }
.proj-jobs { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.jrow { grid-template-columns: minmax(0, 2.4fr) 140px minmax(0, 1.2fr) minmax(0, 1.4fr) 110px; }
.meta.rec-on { color: var(--danger); font-weight: 600; }
@media (max-width: 1100px) { .job-work { grid-template-columns: 1fr; } }

/* ---------- progress in the Project colour; job time & linked tasks under the proposal ---------- */
.progress-track i { background: var(--c, var(--green)); }
.proj .progress-track { margin: 2px 0; }
.form-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#job-work { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
#job-work .panel + .panel { margin-top: 0; }
.job-clock { display: flex; align-items: center; gap: 16px 24px; flex-wrap: wrap; }
.job-clock.running { border-color: var(--danger); background: var(--danger-bg); }
.job-clock-time { display: flex; flex-direction: column; min-width: 120px; }
.job-people { display: flex; gap: 20px; flex: 1; flex-wrap: wrap; }
.job-role { display: flex; flex-direction: column; gap: 4px; }
.job-clock .btn { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.job-clock .btn .ico { color: var(--danger); }
.job-clock .btn.secondary .ico { color: var(--ink); }
.linked-tasks .panel-tools strong { font-size: 14px; }
.linked-tasks .progress-track { margin-bottom: 12px; }
.linked-list { max-height: 264px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line-soft); border-radius: 8px; scrollbar-width: thin; }
.linked-list .mrow { grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr) 110px 140px; padding: 9px 12px; }
@media (max-width: 900px) {
  .form-row.three { grid-template-columns: 1fr; }
  .job-clock { gap: 12px; }
  .job-clock .btn { width: 100%; justify-content: center; margin-left: 0; }
  .linked-list { max-height: 50vh; }
}

/* ---------- email ---------- */
.page.page-flush { padding: 0; max-width: none; }
.mail { display: grid; grid-template-columns: var(--mail-side, 240px) 0 var(--mail-list, 360px) 0 minmax(0, 1fr); height: calc(100vh - 65px); overflow: hidden; }
.mail-side, .mail-list { border-right: 1px solid var(--line-soft); overflow-y: auto; overscroll-behavior: contain; }
.mail-side { padding: 14px 12px; display: flex; flex-direction: column; gap: 10px; background: var(--page); }
.mail-side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px; }
.mail-side-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.mail-compose { width: 100%; }
.mail-search input { min-height: 38px; padding: 6px 12px; border-width: 1px; font-size: 14px; }
.mail-folders { display: flex; flex-direction: column; gap: 2px; }
.mail-folder { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px 8px calc(10px + var(--depth, 0) * 14px); border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; margin: 0; }
.mail-folder span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-folder:hover { background: var(--chip); }
.mail-folder.active { background: var(--green-tint); color: var(--green); font-weight: 600; }
.mail-folder.static { color: var(--muted); cursor: default; }
.mail-folder .ico { flex: none; color: var(--muted); }
.mail-folder.active .ico { color: var(--green); }
.mail-count { font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.mail-group { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 12px 10px 4px; }
.mail-list { display: flex; flex-direction: column; }
.mail-list-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; background: var(--bg); z-index: 1; }
.mail-list-head h2 { flex: 1; font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line-soft); cursor: pointer; position: relative; }
.mail-item:hover { background: var(--page); }
.mail-item.active { background: var(--green-tint); }
.mail-item.unseen::before { content: ''; position: absolute; left: 6px; top: 18px; width: 7px; height: 7px; border-radius: 50%; background: var(--green-bright); }
.mi-top, .mi-bottom { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mi-from { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.mail-item.unseen .mi-from, .mail-item.unseen .mi-subject { font-weight: 600; }
.mi-top .ico { color: var(--muted); flex: none; }
.mi-date { font-size: 12px; color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }
.mi-subject { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-snippet { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-flag { width: 26px; height: 26px; flex: none; color: var(--line); }
.mail-item:hover .mi-flag { color: var(--muted); }
.mi-flag.on, .mail-tools .icon-btn.on { color: var(--danger) !important; }
.mi-flag.on .ico, .mail-tools .icon-btn.on .ico { fill: currentColor; }
.mail-more { margin: 12px auto; }
.mail-empty { color: var(--muted); padding: 32px 16px; text-align: center; }
.mail-read { overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; min-width: 0; }
.mail-pick { margin: auto; }
.mail-tools { display: flex; align-items: center; gap: 4px; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; background: var(--bg); z-index: 1; flex-wrap: wrap; }
.mail-tools .icon-btn { width: 36px; height: 36px; color: var(--ink); }
.mail-tools-gap { flex: 1; }
.mail-move { width: auto; min-height: 34px; padding: 4px 8px; border-width: 1px; font-size: 13px; max-width: 160px; }
.mail-body { padding: 20px 28px 32px; }
.mail-subject { font-size: 22px; font-weight: 500; line-height: 1.3; margin-bottom: 18px; overflow-wrap: anywhere; }
.mail-meta { display: flex; gap: 12px; align-items: flex-start; padding-bottom: 16px; border-bottom: 1px solid var(--line-soft); margin-bottom: 16px; }
.mail-avatar { width: 38px; height: 38px; font-size: 15px; background: var(--danger); color: #fff; }
.mail-meta-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mail-meta-date { flex: none; }
.mail-files { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.mail-files a { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font-size: 14px; max-width: 320px; }
.mail-files a span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-files a:hover { border-color: var(--green); text-decoration: none; }
.mail-frame { width: 100%; min-height: 240px; border: 0; border-radius: 10px; background: #fff; display: block; }
.mail-compose-body .rte { margin-top: 8px; }
.mail-field { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line-soft); padding: 2px 0; }
.mail-field label { width: 64px; margin: 0; color: var(--muted); font-weight: 400; flex: none; }
.mail-field input { border: 0; min-height: 42px; padding: 6px 0; background: none; }
.mail-field input:focus { border: 0; }
.mail-setup-page { max-width: 640px; margin: 40px auto; }
.mail-setup-page h1 { font-size: 24px; margin-bottom: 20px; }
.mail-server { display: grid; grid-template-columns: 52px minmax(0, 1fr) 90px 130px; gap: 8px; align-items: center; }
.mail-server label { margin: 0; }
.mail-test { list-style: none; padding: 0; margin: 12px 0 0; }
.mail-test .ok { color: var(--green); }
.mail-test .bad { color: var(--danger); }
.mail-only-phone { display: none; }
@media (max-width: 1100px) {
  .mail { grid-template-columns: var(--mail-side, 210px) 0 var(--mail-list, 300px) 0 minmax(0, 1fr); }
  .mail-body { padding: 16px 18px 28px; }
}
@media (max-width: 900px) {
  .mail { grid-template-columns: 1fr; height: calc(100vh - 56px - 53px - env(safe-area-inset-bottom)); }
  .mail > section, .mail > aside { display: none; border-right: 0; }
  .mail[data-pane='folders'] .mail-side, .mail[data-pane='list'] .mail-list, .mail[data-pane='read'] .mail-read { display: flex; }
  .mail-only-phone { display: inline-grid; }
  .mail-tools { gap: 2px; padding: 8px 10px; }
  .mail-move { max-width: 120px; }
  .mail-body { padding: 14px 14px 28px; }
  .mail-subject { font-size: 19px; }
  .mail-meta-date { display: none; }
  .mail-setup-page { margin: 0; border: 0; padding: 0; }
  .mail-server { grid-template-columns: 1fr 1fr; }
  .mail-server label { grid-column: 1 / -1; }
  .mail-server input[type='text'] { grid-column: 1 / -1; }
  .mail-folder { padding-top: 11px; padding-bottom: 11px; }
}
@media (max-width: 1280px) and (min-width: 901px) {
  .mail-tools .icon-btn { width: 32px; height: 32px; }
  .mail-move { max-width: 110px; }
}

/* ---------- boards fill the window; job page folds; dashboard spacing ---------- */
.board { height: var(--board-h, auto); align-items: stretch; padding-bottom: 4px; }
.board .column { height: 100%; min-height: 0; }
.board .column-body { flex: 1 1 auto; max-height: none; min-height: 0; overscroll-behavior: contain; position: relative; } /* keeps sr-only labels inside the scroller */
.panel + .dash-grid { margin-top: 24px; }
.fold-panel > summary, .sub-fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.fold-panel > summary::-webkit-details-marker, .sub-fold > summary::-webkit-details-marker { display: none; }
.fold-panel > summary::after, .sub-fold > summary::after { content: '›'; font-size: 20px; line-height: 1; color: var(--muted); transition: transform 0.15s; }
.fold-panel[open] > summary::after, .sub-fold[open] > summary::after { transform: rotate(90deg); }
.fold-panel > summary { justify-content: space-between; }
.fold-panel:not([open]) > summary { margin-bottom: 0; }
.sub-fold { margin: 16px 0 0; }
.sub-fold > summary label { margin: 0; cursor: pointer; }
.sub-fold[open] > summary { margin-bottom: 8px; }
@media (max-width: 900px) {
  .project-grid { display: flex; flex-direction: column; align-items: stretch; gap: 16px; }
  .project-grid > div { display: contents; }
  .project-grid .panel, .project-grid > div > .panel + .panel { margin: 0; }
  .pg-proposal { order: 1; }
  #job-work { order: 2; margin-top: 0; }
  .pg-analysis { order: 3; }
  .pg-brief { order: 4; }
  .panel + .dash-grid { margin-top: 16px; }
}

/* Bottom tab bar: icons on phones, words on desktop. Email setup keeps clear of the bar. */
.nav-ico { display: none; }
@media (max-width: 900px) {
  .nav a { display: flex; align-items: center; justify-content: center; padding: 10px 4px; min-height: 56px; color: var(--muted); }
  .nav a.active { color: var(--green); }
  .nav a > span:not(.nav-badge) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nav-ico { display: block; width: 26px; height: 26px; }
  .page.page-flush .mail-setup-page { padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); }
}

/* Notifications: the bell, its panel, @mention picker, editable feedback */
.notif-wrap { position: relative; flex: none; display: flex; }
#bell { position: relative; color: var(--ink); }
#bell[aria-expanded='true'] { background: var(--chip); }
.bell-count { position: absolute; top: 0; left: 55%; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; background: var(--danger);
  color: #fff; font-size: 10px; font-weight: 700; line-height: 15px; text-align: center; border: 2px solid var(--bg); box-sizing: content-box; }
.notif-pop { position: absolute; top: calc(100% + 10px); right: -8px; width: 380px; max-height: min(560px, calc(100vh - 90px)); display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px var(--shadow); z-index: 25; overflow: hidden; }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line-soft); min-height: 52px; }
.notif-head strong { font-size: 16px; }
.notif-list { overflow-y: auto; overscroll-behavior: contain; }
.notif-item { display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 12px 16px 12px 22px; border: 0; border-bottom: 1px solid var(--line-soft);
  background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; position: relative; }
.notif-item:hover { background: var(--page); }
.notif-item.unread { background: var(--green-tint); }
.notif-item.unread::before { content: ''; position: absolute; left: 8px; top: 22px; width: 7px; height: 7px; border-radius: 50%; background: var(--green-bright); }
.notif-item .avatar { width: 30px; height: 30px; font-size: 11px; }
.notif-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-title { font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.notif-item.unread .notif-title { font-weight: 600; }
.notif-body { font-size: 13px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.notif-time { font-size: 12px; color: var(--muted); }
.notif-empty { color: var(--muted); padding: 32px 16px; text-align: center; }

.mention-pop { position: fixed; z-index: 60; min-width: 220px; max-width: calc(100vw - 16px); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 10px 28px var(--shadow); padding: 4px; }
.mention-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: none;
  color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.mention-item .muted { margin-left: auto; }
.mention-item.active, .mention-item:hover { background: var(--green-tint); }

.rte.compact .rte-body { min-height: 72px; max-height: 260px; }
.rte.compact .rte-bar { padding: 4px; }
.rte.compact .rte-btn { min-width: 30px; height: 30px; }
.comment-head { align-items: center; }
.comment-tools { margin-left: auto; display: inline-flex; gap: 6px; }
.comment-tools .icon-btn.tool { width: 30px; height: 30px; }
.comment-body > :last-child { margin-bottom: 0; }
.comment-body ul, .comment-body ol { padding-left: 22px; margin: 4px 0; }
.comment-edit { display: grid; gap: 8px; }
.comment-edit-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 900px) {
  .notif-pop { position: fixed; top: 56px; left: 0; right: 0; width: auto; border-radius: 0; border-left: 0; border-right: 0;
    max-height: calc(100vh - 56px - 57px - env(safe-area-inset-bottom)); }
  .notif-item { padding: 14px 16px 14px 22px; }
  .comment-tools .icon-btn.tool { width: 36px; height: 36px; }
  .mention-item { padding: 11px 10px; }
}

/* Filters bar (Proposals, Tasks): folded to one line; active filters show as removable chips */
.filters { margin-bottom: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.filters-sum { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 12px 8px 8px; cursor: pointer; list-style: none; min-height: 48px; }
.filters-sum::-webkit-details-marker { display: none; }
.filters-btn { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 8px; font-weight: 500; color: var(--ink); }
.filters-sum:hover .filters-btn { color: var(--green); }
.filters-n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--green); color: var(--on-green); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.filters-caret { display: inline-block; transform: rotate(90deg); transition: transform 0.15s; color: var(--muted); font-size: 18px; line-height: 1; }
.filters[open] .filters-caret { transform: rotate(-90deg); }
.filters-count { margin-left: auto; white-space: nowrap; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; padding: 3px 6px 3px 10px; border: 1px solid var(--green); border-radius: 10rem;
  background: var(--green-tint); color: var(--green); font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filter-chip > span[aria-hidden] { font-size: 16px; line-height: 1; width: 18px; height: 18px; display: inline-grid; place-items: center; border-radius: 50%; }
.filter-chip:hover > span[aria-hidden] { background: var(--green); color: var(--on-green); }
.filters-body { display: grid; gap: 12px; padding: 12px 16px 16px; border-top: 1px solid var(--line-soft); }
.filter-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: start; }
.filter-label { font-size: 13px; font-weight: 600; color: var(--muted); padding-top: 5px; }
.filter-row .presets { margin: 0; }
.filter-field select { width: auto; min-width: 200px; max-width: 100%; }
@media (max-width: 900px) {
  .filters { margin-bottom: 12px; }
  .filters-sum { min-height: 46px; gap: 6px; }
  .filter-chip { max-width: 150px; padding-top: 5px; padding-bottom: 5px; }
  .filters-body { padding: 12px; }
  .filter-row { grid-template-columns: 1fr; gap: 6px; }
  .filter-label { padding-top: 0; }
  .filter-row .presets { flex-wrap: wrap; overflow: visible; }
  .filter-row .pill { padding: 6px 12px; }
  .filter-field select { width: 100%; min-width: 0; }
}
.mail-hint { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--page); font-size: 14px; line-height: 1.5; }
.mail-hint ol { margin: 8px 0; padding-left: 20px; }
.mail-hint p { margin: 0; font-size: 13px; }

/* Proposals / Tasks: no big page title, the view switch and the add button sit on one line */
.page-head.bare { margin-bottom: 14px; }
.page-head.bare .head-actions { width: 100%; justify-content: flex-start; }
.page-head.bare .head-actions > .btn { margin-left: auto; }
@media (max-width: 900px) { .page-head.bare { margin-bottom: 10px; } }

/* ---------- Email: resizable columns, selection, quick actions, swipe, menu, compose, settings ---------- */
.mail-resize { position: relative; z-index: 3; width: 9px; margin: 0 -4px; cursor: col-resize; touch-action: none; }
.mail-resize::after { content: ''; position: absolute; top: 0; bottom: 0; left: 4px; width: 1px; background: transparent; transition: background 0.15s; }
.mail-resize:hover::after, .mail-resize.dragging::after { background: var(--green); width: 2px; }
body.col-resizing { cursor: col-resize; user-select: none; }
body.col-resizing iframe { pointer-events: none; }

.mail-item { padding: 0; gap: 0; overflow: hidden; display: block; }
.mail-item.unseen::before { z-index: 2; }
.mi-row { position: relative; z-index: 1; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px 12px 18px; background: var(--bg); transition: transform 0.2s ease; touch-action: pan-y; }
.mail-item:hover .mi-row { background: var(--page); }
.mail-item.active .mi-row { background: var(--green-tint); }
.mail-item.selected .mi-row { background: color-mix(in srgb, var(--green) 16%, var(--bg)); }
.mi-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mi-check { flex: none; width: 20px; height: 20px; margin-top: 1px; border: 1.5px solid var(--line); border-radius: 6px; background: var(--bg); color: transparent;
  display: none; place-items: center; cursor: pointer; padding: 0; }
.mail-item:hover .mi-check, .mail-items.selecting .mi-check { display: grid; }
.mail-item.selected .mi-check { background: var(--green); border-color: var(--green); color: var(--on-green); }
.mi-quick { width: 26px; height: 26px; flex: none; color: transparent; }
.mi-del { color: transparent; }
.mail-item:hover .mi-quick { color: var(--muted); }
.mail-item:hover .mi-del:hover { color: var(--danger); }
.mail-items.selecting .mi-quick { visibility: hidden; }
.mi-swipe { position: absolute; inset: 0; display: flex; align-items: stretch; }
.mi-swipe button { border: 0; font: inherit; font-size: 12px; font-weight: 600; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 84px; cursor: pointer; }
.mi-swipe-gap { flex: 1; }
.mi-swipe-read { background: #2f6fe0; width: 120px !important; align-items: flex-start !important; padding-left: 22px; }
.mi-swipe-archive { background: #6b7280; }
.mi-swipe-delete { background: var(--danger); }
.mail-item:not(.swipe-right) .mi-swipe-read { visibility: hidden; }
.mail-item.swipe-right .mi-swipe-archive, .mail-item.swipe-right .mi-swipe-delete { visibility: hidden; }
.mail-item:not(.swipe-left):not(.swiped):not(.swipe-right) .mi-swipe { visibility: hidden; }

.mail-list-head { min-height: 56px; }
.mail-list-head h2 { min-width: 0; }
.mail-list-head .filter-chip { max-width: 40%; }
.mail-head-tools { display: inline-flex; align-items: center; gap: 2px; }
.mail-list-head .icon-btn, .mail-bulk .icon-btn { width: 34px; height: 34px; color: var(--ink); }
.mail-list-head .icon-btn:disabled, .mail-bulk .icon-btn:disabled { opacity: 0.35; cursor: default; }
.icon-btn.danger { color: var(--danger) !important; }
.mail-bulk-move { position: relative; cursor: pointer; }
.mail-bulk-move select { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; min-height: 0; padding: 0; }
.mail-bulk { display: none; }
.mail-search-phone { display: none; }
.mail-fab { display: none; }

.mail-file { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; font-size: 14px; max-width: 320px; cursor: pointer; }
.mail-file span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-file:hover { border-color: var(--green); }
.mail-file.busy { opacity: 0.55; cursor: progress; }

.mail-menu { position: fixed; z-index: 70; min-width: 220px; max-width: min(300px, calc(100vw - 16px)); max-height: calc(100vh - 16px); overflow-y: auto; padding: 6px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px var(--shadow); }
.mail-menu-title { font-size: 12px; color: var(--muted); padding: 6px 10px 8px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; }
.mail-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: none; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; list-style: none; }
.mail-menu-item::-webkit-details-marker { display: none; }
.mail-menu-item:hover { background: var(--chip); }
.mail-menu-item.danger { color: var(--danger); }
.mail-menu-item.sub { padding-left: 36px; font-size: 13.5px; }
.mail-menu-folders { max-height: 220px; overflow-y: auto; }

.mail-compose-body { display: flex; flex-direction: column; }
.mail-compose-body .rte-body { min-height: 180px; max-height: none; }
.rte-body img, .sig-preview img { max-width: 100%; height: auto; }
.mail-quote { margin-top: 10px; border: 1px solid var(--line-soft); border-radius: 10px; }
.mail-quote > summary { display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; list-style: none; color: var(--muted); font-size: 14px; }
.mail-quote > summary::-webkit-details-marker { display: none; }
.mail-quote > summary .small { margin-left: auto; }
.mail-quote[open] > summary .small { visibility: hidden; }
.mail-quote-body { padding: 4px 16px 14px; font-size: 14px; color: var(--muted); max-height: 50vh; overflow-y: auto; }
.mail-quote-body blockquote { margin: 6px 0 0; padding-left: 12px; border-left: 3px solid var(--line); }
.mail-compose-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.mail-compose-tools .btn { margin: 0; }
.mail-sig-pick { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 0 auto; font-weight: 400; }
.mail-sig-pick select { width: auto; min-height: 34px; padding: 4px 8px; border-width: 1px; font-size: 13px; }

.mail-settings-block { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line-soft); }
.mail-settings-block h3 { font-size: 17px; margin-bottom: 12px; }
.sig-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 10px; }
.sig-list li { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.sig-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.sig-head strong { flex: 1; }
.sig-head .icon-btn.tool { width: 32px; height: 32px; }
.sig-preview { font-size: 13.5px; color: var(--muted); max-height: 140px; overflow: hidden; }
.sig-defaults { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.sig-default { display: grid; gap: 4px; margin: 0; font-size: 13px; color: var(--muted); font-weight: 500; }
.sig-default select { min-height: 38px; font-size: 14px; }
.sig-edit { display: grid; gap: 10px; }
.sig-edit .editor-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sig-edit .editor-actions .btn { margin: 0; }
.storage-meter { margin-bottom: 12px; }
.storage-bar { height: 8px; border-radius: 4px; background: var(--chip); overflow: hidden; margin-bottom: 6px; }
.storage-bar span { display: block; height: 100%; background: var(--green); border-radius: 4px; }
.storage-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.storage-row > span:first-child { display: inline-flex; align-items: center; gap: 8px; flex: 1; }

/* unread badge on the Email tab */
.nav a { position: relative; }
.nav-badge { min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px;
  text-align: center; margin-left: 6px; display: inline-block; vertical-align: 1px; }
.nav-badge[hidden] { display: none; }

@media (max-width: 900px) {
  .mail { height: calc(100dvh - 56px - 57px - env(safe-area-inset-bottom)); overscroll-behavior-x: none; }
  .mail-resize { display: none; }
  .mail-item { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  .mi-row { padding: 13px 14px 13px 18px; }
  .mi-quick:not(.mi-flag.on) { display: none; } /* a flagged email keeps its red flag in the list */
  .mail-items.selecting .mi-check { width: 24px; height: 24px; border-radius: 7px; margin-top: 4px; }
  .mail-list { position: relative; }
  .mail-list-head { padding: 8px 8px 8px 6px; gap: 4px; }
  .mail-list-head .icon-btn { width: 40px; height: 40px; }
  .mail-list-head .mail-head-tools { display: none; }
  .mail-search-phone:not([hidden]) { display: flex; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); position: sticky; top: 56px; background: var(--bg); z-index: 1; }
  .mail-search-phone input { flex: 1; min-height: 42px; font-size: 16px; border-width: 1px; padding: 6px 12px; }
  .mail-bulk:not([hidden]) { display: flex; justify-content: space-around; align-items: center; position: fixed; left: 0; right: 0; bottom: calc(57px + env(safe-area-inset-bottom)); z-index: 16;
    background: var(--bg); border-top: 1px solid var(--line); padding: 6px 8px; box-shadow: 0 -4px 16px var(--shadow); }
  .mail-bulk .icon-btn { width: 48px; height: 44px; }
  .mail-fab { display: grid; place-items: center; position: absolute; right: 16px; bottom: 16px; z-index: 4; width: 54px; height: 54px; border-radius: 50%; border: 0;
    background: var(--green); color: var(--on-green); box-shadow: 0 6px 18px var(--shadow); cursor: pointer; }
  .mail-items.selecting ~ .mail-fab { display: none; }
  .mail-items { padding-bottom: 84px; }
  .mail-menu.sheet { left: 0; right: 0; bottom: 0; top: auto; max-width: none; width: 100%; border-radius: 16px 16px 0 0; padding: 8px 8px calc(12px + env(safe-area-inset-bottom)); max-height: 75vh; }
  .mail-menu.sheet .mail-menu-item { padding: 13px 12px; font-size: 15px; }
  .mail-compose-drawer .drawer-body { padding: 12px 14px 24px; }
  .mail-compose-body .rte-body { min-height: 160px; font-size: 16px; }
  .mail-field input { font-size: 16px; }
  .mail-sig-pick { margin-left: 0; width: 100%; }
  .mail-sig-pick select { flex: 1; }
  .sig-defaults { grid-template-columns: 1fr; }
  .mail-file { max-width: 100%; padding: 9px 12px; }
  /* the count sits on the Email icon */
  .nav-badge { position: absolute; top: 6px; left: calc(50% + 6px); margin: 0; border: 2px solid var(--bg); box-sizing: content-box; }
}

/* ---------- top bar on phones: the logo always fits ---------- */
@media (max-width: 900px) {
  .topbar-inner { gap: 6px; padding: 0 10px; }
  .brand { flex: 0 0 auto; font-size: 20px; letter-spacing: -0.02em; white-space: nowrap; margin-right: auto; }
  #account { padding: 0; }
  #account .avatar { width: 30px; height: 30px; font-size: 12px; }
  .clock { flex: 0 1 auto; min-width: 0; }
  .theme-toggle { width: 34px; height: 34px; }
  #bell { width: 34px; height: 34px; }
}
@media (max-width: 380px) {
  .brand { font-size: 18px; }
  .topbar-inner { gap: 4px; padding: 0 8px; }
  .theme-toggle, #bell { width: 32px; height: 32px; }
}

/* ---------- Settings cards on phones: compact, titles never break mid-word ---------- */
@media (max-width: 900px) {
  .fold > summary { padding: 14px 16px; gap: 10px; }
  .fold > summary h2 { font-size: 17px; white-space: nowrap; flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
  .fold > summary .muted { flex: 1; min-width: 0; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .fold-body { padding: 4px 16px 18px; }
}
.mail-list-head:has(.mail-head-tools) { flex-wrap: wrap; row-gap: 2px; }
.mail-head-tools { flex-basis: 100%; gap: 4px; }
.bulk-label { display: none; }
@media (max-width: 900px) {
  .mail-bulk .icon-btn { width: 64px; height: 50px; border-radius: 10px; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
  .mail-bulk .bulk-label { display: block; font-size: 11px; font-weight: 500; }
}
.drawer { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
@media (max-width: 900px) {
  .panel.fold { padding: 0; margin-bottom: 10px; }
  .fold > summary h2 { margin: 0; }
}

/* search suggestions */
.mail-search, .mail-search-phone { position: relative; }
.mail-suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 32px var(--shadow); padding: 4px; max-height: min(420px, 60vh); overflow-y: auto; min-width: 280px; }
.mail-suggest[hidden] { display: none; }
.mail-suggest-label { font-size: 12px; color: var(--muted); padding: 8px 10px 4px; margin: 0; }
.mail-suggest-row { display: flex; align-items: center; }
.mail-suggest-row .icon-btn { width: 30px; height: 30px; flex: none; }
.mail-suggest-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: none; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; min-width: 0; }
.mail-suggest-item:hover, .mail-suggest-item:focus-visible { background: var(--chip); }
.mail-suggest-item > span:not(.muted) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-suggest-item .ico { flex: none; color: var(--muted); }
.mail-suggest-item.all { font-weight: 600; }
.ms-main { display: flex; flex-direction: column; gap: 1px; }
.ms-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-from { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-side .mail-suggest { right: auto; width: max(100%, 340px); }
@media (max-width: 900px) {
  .mail-search-phone .mail-suggest { left: 8px; right: 8px; top: 100%; min-width: 0; max-height: 55vh; }
  .mail-suggest-item { padding: 11px 10px; }
}

/* touch screens: a tap leaves :hover stuck, so hover-only looks stay off */
@media (hover: none) {
  .mail-item:hover .mi-check { display: none; }
  .mail-items.selecting .mi-check { display: grid; }
  .mail-item:hover:not(.active):not(.selected) .mi-row { background: var(--bg); }
  .mail-item:hover .mi-quick { color: transparent; }
  .mail-folder:hover:not(.active) { background: none; }
}

/* "+ New job" / "+ New task": a word button on a computer, a round + on a phone (like Compose in Email) */
.head-add { display: inline-flex; align-items: center; gap: 6px; }
.head-add .ico { width: 17px; height: 17px; }
@media (max-width: 900px) {
  .page-head .head-actions > .btn.head-add { width: 56px; height: 56px; padding: 0; border-radius: 50%; justify-content: center; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); }
  .head-add .ico { width: 24px; height: 24px; }
  .head-add > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
/* the suggestions must sit above the rows (which stack for the swipe) */
.mail-search-phone:not([hidden]) { z-index: 6; }
.mail-search { z-index: 6; }
/* Compose stays in the corner while the list scrolls, where the + of Tasks / Proposals sits */
@media (max-width: 900px) {
  .mail-fab { position: fixed; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); width: 56px; height: 56px; z-index: 14; }
  .mail[data-pane="read"] .mail-fab, .mail[data-pane="folders"] .mail-fab { display: none; }
}
/* Spam / Trash: empty the folder from the top of its list */
.mail-empty-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px 8px 16px; border-bottom: 1px solid var(--line-soft);
  background: var(--page); font-size: 13px; color: var(--muted); }
.mail-empty-bar .btn { display: inline-flex; align-items: center; gap: 6px; margin: 0; white-space: nowrap; }
.mail-list-head .icon-btn.on, .mail-bulk .icon-btn.on { color: var(--danger); }
.mail-list-head .icon-btn.on .ico, .mail-bulk .icon-btn.on .ico { fill: currentColor; }

/* ======================================================================
   Docs: home, doc editor, sheet editor, file previews
   ====================================================================== */
.docs-icon { width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; flex: none; color: #fff; }
.docs-icon.doc { background: #2f6fe0; }
.docs-icon.sheet { background: #188038; }
.docs-home { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100vh - 65px); }
.docs-side { padding: 18px 14px; border-right: 1px solid var(--line-soft); background: var(--page); display: flex; flex-direction: column; gap: 16px; }
.docs-new { display: grid; gap: 8px; }
.docs-new .btn { display: inline-flex; align-items: center; justify-content: flex-start; gap: 8px; margin: 0; }
.docs-import { cursor: pointer; }
.docs-tabs { display: flex; flex-direction: column; gap: 2px; }
.docs-tab { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.docs-tab:hover { background: var(--chip); }
.docs-tab.active { background: var(--green-tint); color: var(--green); font-weight: 600; }
.docs-tab .ico { color: var(--muted); }
.docs-tab.active .ico { color: var(--green); }
.docs-main { padding: 22px clamp(16px, 3vw, 40px) 40px; min-width: 0; }
.docs-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.docs-head h1 { font-size: 24px; }
.docs-search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10rem; padding: 0 14px; min-width: 260px; background: var(--bg); color: var(--muted); }
.docs-search input { border: 0; background: none; min-height: 38px; padding: 0; font-size: 14px; }
.docs-search input:focus { border: 0; outline: none; }
.docs-list { border: 1px solid var(--line-soft); border-radius: 12px; overflow: hidden; }
.docs-row { display: grid; grid-template-columns: minmax(0, 1fr) 160px 200px 84px; align-items: center; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--line-soft); }
.docs-row:first-child { border-top: 0; }
.docs-row:not(.docs-row-head):hover { background: var(--page); }
.docs-row-head { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--page); }
.docs-name { display: flex; align-items: center; gap: 12px; color: var(--ink); min-width: 0; min-height: 40px; }
.docs-name:hover { text-decoration: none; color: var(--green); }
.docs-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.docs-badge { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 10rem; padding: 1px 8px; }
.docs-owner, .docs-when { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-actions { display: flex; justify-content: flex-end; gap: 2px; }
.docs-actions .icon-btn, .file-tools .icon-btn { width: 34px; height: 34px; color: var(--muted); }
.icon-btn.on .ico { fill: #f5b301; color: #f5b301; }
.docs-fab { display: none; }

.docs-menu { position: fixed; z-index: 70; min-width: 210px; padding: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px var(--shadow); }
.docs-menu hr { border: 0; border-top: 1px solid var(--line-soft); margin: 4px 0; }
.docs-menu-title { font-size: 12px; color: var(--muted); padding: 6px 10px 8px; margin: 0 0 4px; border-bottom: 1px solid var(--line-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: none; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; margin: 0; font-weight: 400; }
.docs-menu-item:hover { background: var(--chip); }
.docs-menu-item.danger { color: var(--danger); }
.docs-menu.sheet-menu { left: 0; right: 0; bottom: 0; top: auto; border-radius: 16px 16px 0 0; padding: 8px 8px calc(14px + env(safe-area-inset-bottom)); }
.docs-menu.sheet-menu .docs-menu-item { padding: 13px 12px; font-size: 15px; }
@media (min-width: 901px) { .docs-menu.sheet-menu:not([style]) { left: 50%; right: auto; bottom: auto; top: 30%; transform: translateX(-50%); border-radius: 12px; min-width: 300px; } }

.share-all { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-weight: 500; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: none; padding: 6px 10px; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { background: var(--chip); }
.share-list { list-style: none; padding: 0; margin: 0; }
.share-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.share-list .avatar { width: 30px; height: 30px; font-size: 11px; }
.share-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.share-list select { width: auto; min-height: 36px; font-size: 14px; }

/* the open file */
.file-page { display: flex; flex-direction: column; height: calc(100vh - 65px); min-height: 0; }
.file-bar { display: flex; align-items: center; gap: 10px; padding: 8px clamp(10px, 2vw, 24px); border-bottom: 1px solid var(--line-soft); background: var(--bg); flex: none; }
.file-bar > .icon-btn { width: 36px; height: 36px; color: var(--ink); }
.file-title { flex: 0 1 auto; width: auto; min-width: 80px; max-width: 46%; border: 1px solid transparent; background: none; font: inherit; font-size: 17px; font-weight: 600; padding: 4px 8px; min-height: 36px; border-radius: 6px; }
.file-title:hover:not([readonly]), .file-title:focus { border-color: var(--line); }
.file-status { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-tools { display: flex; align-items: center; gap: 4px; }
.file-mode { display: inline-flex; align-items: center; gap: 6px; margin: 0; }

.doc-toolbar, .sheet-toolbar { display: flex; align-items: center; gap: 2px; padding: 6px clamp(10px, 2vw, 24px); border-bottom: 1px solid var(--line-soft); background: var(--page); overflow-x: auto; scrollbar-width: none; flex: none; }
.dt-btn, .st-btn { flex: none; min-width: 34px; height: 34px; border: 0; border-radius: 7px; background: none; color: var(--ink); font: inherit; font-size: 15px; cursor: pointer; display: inline-grid; place-items: center; padding: 0 6px; position: relative; }
.dt-btn:hover, .st-btn:hover { background: var(--chip); }
.dt-sep { flex: none; width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.dt-style, .st-fmt { flex: none; width: auto; min-height: 32px; padding: 2px 8px; border-width: 1px; font-size: 13px; margin-right: 4px; }
.st-color input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; padding: 0; min-height: 0; }

.doc-page-wrap { overflow-y: auto; }
.doc-page { width: min(816px, 100%); margin: 28px auto 80px; padding: 56px clamp(20px, 6vw, 88px); background: var(--bg); border: 1px solid var(--line-soft); border-radius: 6px; box-shadow: 0 2px 10px var(--shadow);
  min-height: 70vh; outline: none; font-size: 16px; line-height: 1.7; overflow-wrap: anywhere; text-align: left; }
.doc-page-wrap { background: var(--page); }
.doc-page h1 { font-size: 30px; margin: 0 0 14px; }
.doc-page h2 { font-size: 22px; margin: 22px 0 10px; }
.doc-page h3 { font-size: 18px; margin: 18px 0 8px; }
.doc-page p { margin: 0 0 10px; }
.doc-page ul, .doc-page ol { padding-left: 26px; margin: 0 0 10px; }
.doc-page blockquote { margin: 10px 0; padding: 4px 16px; border-left: 3px solid var(--green); color: var(--muted); }
.doc-page pre { background: var(--chip); padding: 12px 14px; border-radius: 8px; overflow-x: auto; font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.doc-page table { border-collapse: collapse; width: 100%; margin: 10px 0; }
.doc-page th, .doc-page td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.doc-page th { background: var(--page); }
.doc-page img { max-width: 100%; height: auto; border-radius: 6px; }
.doc-page hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.doc-page a { color: var(--green); text-decoration: underline; }
.doc-page:empty::before { content: attr(data-placeholder); color: var(--muted); }
.doc-page ul.checklist { list-style: none; padding-left: 4px; }
.doc-page ul.checklist > li { position: relative; padding-left: 30px; }
.doc-page ul.checklist > li::before { content: ''; position: absolute; left: 0; top: 0.32em; width: 17px; height: 17px; border: 1.5px solid var(--line); border-radius: 5px; background: var(--bg); cursor: pointer; }
.doc-page ul.checklist > li.checked { color: var(--muted); text-decoration: line-through; }
.doc-page ul.checklist > li.checked::before { background: var(--green); border-color: var(--green); }
.doc-page ul.checklist > li.checked::after { content: ''; position: absolute; left: 6px; top: calc(0.32em + 3px); width: 4px; height: 8px; border: solid var(--on-green); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.viewing .doc-page { box-shadow: none; }

/* sheet */
.formula-bar { display: flex; align-items: center; gap: 8px; padding: 4px clamp(10px, 2vw, 24px); border-bottom: 1px solid var(--line-soft); background: var(--bg); flex: none; }
.cell-name { min-width: 64px; font: 600 13px ui-monospace, Menlo, monospace; color: var(--muted); padding: 4px 6px; border-right: 1px solid var(--line-soft); }
.fx { font-style: italic; color: var(--muted); font-weight: 600; }
#formula { border: 0; background: none; min-height: 32px; padding: 0 4px; font: 14px ui-monospace, SFMono-Regular, Menlo, monospace; }
#formula:focus { border: 0; outline: none; }
.grid-wrap { position: relative; flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; outline: none; background: var(--bg); -webkit-overflow-scrolling: touch; }
.grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 13.5px; user-select: none; -webkit-user-select: none; }
.grid th, .grid td { border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); padding: 0 6px; height: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid td { background: var(--bg); color: var(--ink); cursor: cell; }
.grid td.wrap { white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; vertical-align: top; padding-top: 4px; padding-bottom: 4px; line-height: 1.4; text-overflow: clip; }
.grid tr:has(td.wrap) td:not(.wrap) { vertical-align: top; padding-top: 4px; }
.grid td.err { color: var(--danger); }
.grid thead th { position: sticky; top: 0; z-index: 3; height: 26px; background: var(--page); color: var(--muted); font-weight: 500; font-size: 12px; text-align: center; }
.grid th.row-h { position: sticky; left: 0; z-index: 2; background: var(--page); color: var(--muted); font-weight: 500; font-size: 12px; text-align: center; padding: 0; }
.grid th.corner { left: 0; z-index: 4; }
.grid tr.frozen td, .grid tr.frozen th { position: sticky; top: 26px; z-index: 2; box-shadow: 0 2px 0 var(--line); }
.grid tr.frozen th.row-h { z-index: 3; }
.grid th.hl { background: var(--green-tint); color: var(--green); }
.grid td.sel { background: color-mix(in srgb, var(--green) 12%, var(--bg)); }
.grid td.active { outline: 2px solid var(--green); outline-offset: -2px; }
.col-h { position: relative; }
.col-resize { position: absolute; right: -3px; top: 0; bottom: 0; width: 7px; cursor: col-resize; z-index: 2; }
.col-resize:hover { background: var(--green); }
.grid th.row-h { position: sticky; }
.row-resize { position: absolute; left: 0; right: 0; bottom: -3px; height: 7px; cursor: row-resize; z-index: 2; }
.row-resize:hover { background: var(--green); }
.viewing .col-resize, .viewing .row-resize { display: none; }
.grid td.ovf { overflow: visible; text-overflow: clip; }
.grid td.clip { text-overflow: clip; }
/* toolbar popovers: text wrapping, borders */
.st-pop { display: flex; gap: 2px; padding: 6px; min-width: 0; }
.st-pop.grid4 { display: grid; grid-template-columns: repeat(4, 34px); }
.st-pick { display: grid; place-items: center; width: 34px; height: 32px; border: 0; border-radius: 6px; background: none; color: var(--ink); cursor: pointer; font: inherit; font-size: 12px; }
.st-pick.wide { width: auto; padding: 0 10px; }
.st-pick:hover { background: var(--chip); }
.st-pick.on { background: var(--green-tint); color: var(--green); }
.cell-editor { position: absolute; z-index: 6; padding: 3px 6px; border: 2px solid var(--green); border-radius: 0; background: var(--bg); color: var(--ink); font: 13.5px/1.4 inherit; resize: none; box-shadow: 0 4px 14px var(--shadow); min-height: 0; }
.sheet-tabs { display: flex; align-items: center; gap: 4px; padding: 4px clamp(8px, 2vw, 20px); border-top: 1px solid var(--line-soft); background: var(--page); overflow-x: auto; scrollbar-width: none; flex: none; min-height: 40px; }
.sheet-tab { flex: none; border: 0; background: none; padding: 6px 14px; border-radius: 6px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.sheet-tab.active { background: var(--bg); color: var(--green); font-weight: 600; box-shadow: 0 1px 4px var(--shadow); }
.sheet-sum { margin-left: auto; white-space: nowrap; padding-left: 12px; }
.sheet-mobile-bar { display: none; }

/* previews in the viewer */
.viewer-body .preview-doc { margin: 0 auto; align-self: start; color: var(--ink); }
.preview-sheet { width: 100%; height: 100%; display: flex; flex-direction: column; background: var(--bg); border-radius: 8px; overflow: hidden; align-self: stretch; }
.preview-sheet .grid-wrap { flex: 1; }
.slides { width: min(1000px, 100%); display: grid; gap: 18px; align-self: start; padding-bottom: 20px; }
.slide { position: relative; width: 100%; aspect-ratio: 1 / var(--ratio, 0.5625); background: #fff; color: #222; border-radius: 6px; overflow: hidden; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35); container-type: inline-size; }
.slide-pic { position: absolute; object-fit: contain; }
.slide-text { position: absolute; overflow: hidden; line-height: 1.2; }
.slide-text p { margin: 0 0 0.3em; }
.slide-n { position: absolute; right: 10px; bottom: 8px; font-size: 11px; color: #888; }
.viewer-pdf-hint { display: none; }
.viewer-close-phone { display: none; }
.viewer-head .btn { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.viewer-head .panel-tools { display: flex; align-items: center; gap: 6px; }
.viewer-body:has(.preview-sheet), .viewer-body:has(.viewer-frame) { place-items: stretch; }
.viewer-body:has(.viewer-frame) { justify-items: center; }

/* email attachments, now under the message */
.mail-attachments { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.mail-attachments h3 { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.mail-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin: 0; }
.mail-files li { display: flex; align-items: center; min-width: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.mail-files li:hover { border-color: var(--green); }
.mail-file { flex: 1; min-width: 0; max-width: none; border: 0; border-radius: 0; display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: none; text-align: left; }
.mail-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-file .muted { flex: none; }
.mail-file-dl { flex: none; width: 38px; height: 38px; color: var(--muted); border-radius: 0; }
.file-badge { flex: none; min-width: 38px; height: 26px; padding: 0 5px; border-radius: 5px; background: #6b7280; color: #fff; font-size: 10.5px; font-weight: 700; display: inline-grid; place-items: center; }
.file-badge[data-ext="pdf"] { background: #d93025; }
.file-badge[data-ext="docx"], .file-badge[data-ext="doc"] { background: #2f6fe0; }
.file-badge[data-ext="xlsx"], .file-badge[data-ext="xls"], .file-badge[data-ext="csv"] { background: #188038; }
.file-badge[data-ext="pptx"], .file-badge[data-ext="ppt"] { background: #d24726; }
.file-badge[data-ext="png"], .file-badge[data-ext="jpg"], .file-badge[data-ext="jpeg"], .file-badge[data-ext="gif"], .file-badge[data-ext="webp"] { background: #8e44ad; }
.mail-body, .mail-read { min-width: 0; overflow-x: hidden; }

@media print {
  .topbar, .nav, .file-bar, .doc-toolbar, .sheet-toolbar, .formula-bar, .sheet-tabs, .sheet-mobile-bar, .docs-fab, .toast { display: none !important; }
  .file-page, .doc-page-wrap { height: auto; overflow: visible; background: #fff; }
  .doc-page { box-shadow: none; border: 0; margin: 0; padding: 0; width: 100%; color: #000; }
  .grid-wrap { overflow: visible; }
}

@media (max-width: 900px) {
  .docs-home { grid-template-columns: 1fr; min-height: 0; }
  .docs-side { padding: 10px 12px 0; border-right: 0; background: none; gap: 8px; }
  .docs-new { display: none; }
  .docs-tabs { flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 6px; }
  .docs-tab { flex: none; border: 1px solid var(--line); border-radius: 10rem; padding: 7px 12px; }
  .docs-tab.active { border-color: var(--green); }
  .docs-main { padding: 10px 12px calc(96px + env(safe-area-inset-bottom)); }
  .docs-head { flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
  .docs-head h1 { font-size: 20px; }
  .docs-search { min-width: 0; flex: 1 1 100%; }
  .docs-search input { font-size: 16px; min-height: 42px; }
  .docs-list { border: 0; border-radius: 0; }
  .docs-row-head { display: none; }
  .docs-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'name actions' 'meta actions'; gap: 0 8px; padding: 10px 2px; }
  .docs-name { grid-area: name; min-height: 0; }
  .docs-owner { display: none; }
  .docs-when { grid-area: meta; padding-left: 42px; font-size: 12.5px; }
  .docs-actions { grid-area: actions; }
  .docs-actions .icon-btn { width: 42px; height: 42px; }
  .docs-fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 14; width: 56px; height: 56px; border-radius: 50%;
    border: 0; background: var(--green); color: var(--on-green); box-shadow: 0 6px 18px var(--shadow); cursor: pointer; }

  .file-page { height: calc(100dvh - 56px - 57px - env(safe-area-inset-bottom)); }
  .file-bar { gap: 4px; padding: 6px 6px; }
  .file-bar > .docs-icon { display: none; }
  .file-title { flex: 1; max-width: none; font-size: 16px; padding: 4px 6px; }
  .file-status { display: none; }
  .file-mode span { display: none; }
  .file-mode { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 50%; }
  .file-tools .icon-btn { width: 40px; height: 40px; }
  .doc-page { margin: 0; border: 0; border-radius: 0; box-shadow: none; padding: 18px 16px 120px; min-height: 100%; font-size: 17px; }
  .doc-page-wrap { background: var(--bg); }
  /* editing bars ride at the bottom, above the keyboard when it is open */
  .doc-toolbar, .sheet-mobile-bar { position: fixed; left: 0; right: 0; bottom: calc(57px + env(safe-area-inset-bottom)); z-index: 16; display: flex; align-items: center; gap: 2px; padding: 6px 8px;
    border-top: 1px solid var(--line); border-bottom: 0; background: var(--bg); box-shadow: 0 -4px 14px var(--shadow); overflow-x: auto; scrollbar-width: none; }
  .doc-toolbar.over-keyboard, .sheet-mobile-bar.over-keyboard { bottom: var(--kb, 0px); }
  .dt-btn, .st-btn { min-width: 42px; height: 42px; font-size: 16px; }
  .dt-style, .st-fmt { min-height: 40px; font-size: 15px; }
  .sheet-page .formula-bar { order: 3; border-top: 1px solid var(--line-soft); border-bottom: 0; padding: 4px 8px; }
  .sheet-page .grid-wrap { order: 2; }
  .sheet-page .sheet-tabs { order: 4; }
  .sheet-page.editing .sheet-tabs { margin-bottom: 55px; }
  #formula { font-size: 16px; min-height: 40px; }
  .grid { font-size: 14px; }
  .cell-editor { font-size: 16px; }
  .sheet-sum { display: none; }
  .viewer-head { padding: 8px 8px; gap: 6px; }
  .viewer-close-phone { display: inline-grid; flex: none; }
  .viewer-close-desk { display: none; }
  .viewer-title { flex: 1; min-width: 0; font-size: 14px; }
  .viewer-btn-label { display: none; }
  .viewer-body { padding: 8px; }
  .viewer-pdf-hint { display: block; margin: 8px 0 0; text-align: center; background: none !important; color: #ddd; }
  .viewer-pdf-hint a { color: #fff; text-decoration: underline; }
  .viewer-body .preview-doc { padding: 18px 14px; font-size: 16px; border-radius: 8px; }
  .slides { gap: 10px; }
  .mail-files { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .docs-home { grid-template-columns: minmax(0, 1fr); }
  .docs-side, .docs-main { min-width: 0; }
}

/* Docs folders, breadcrumbs, folder picker, swipe rows */
.docs-icon.folder { background: #f5b301; color: #4a3500; }
.docs-group { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 6px 10px 4px; }
.docs-folders { display: flex; flex-direction: column; gap: 2px; }
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.crumbs button { border: 0; background: none; color: var(--muted); font: inherit; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.crumbs button:hover { background: var(--chip); color: var(--ink); }
.crumbs button:last-child { color: var(--ink); font-weight: 600; }
.docs-head-tools { display: flex; align-items: center; gap: 8px; }
.docs-head-tools .btn { display: inline-flex; align-items: center; gap: 6px; margin: 0; white-space: nowrap; }
.folder-open { border: 0; background: none; font: inherit; text-align: left; cursor: pointer; padding: 0; width: 100%; }
/* rows: the visible part slides over its swipe buttons */
.docs-row { position: relative; overflow: hidden; display: block; padding: 0; }
.docs-row .row-main { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) 160px 220px 84px; align-items: center; gap: 12px; padding: 8px 12px; background: var(--bg); transition: transform 0.2s ease; touch-action: pan-y; }
.docs-row-head .row-main { background: var(--page); }
.docs-row:not(.docs-row-head):hover .row-main { background: var(--page); }
.row-swipe { position: absolute; inset: 0 0 0 auto; display: flex; visibility: hidden; }
.docs-row.swiping .row-swipe, .docs-row.swiped .row-swipe { visibility: visible; }
.row-swipe button { width: 84px; border: 0; color: #fff; font: inherit; font-size: 12px; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
.row-swipe-move { background: #2f6fe0; }
.row-swipe-delete { background: var(--danger); }
.docs-when .ico { vertical-align: -1px; }
.folder-picker-wrap .overlay { z-index: 80; }
.folder-picker { position: fixed; z-index: 81; left: 50%; top: 14vh; transform: translateX(-50%); width: min(420px, calc(100vw - 24px)); max-height: 70vh; display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px var(--shadow); overflow: hidden; }
.folder-picker-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line-soft); }
.folder-picker-list { overflow-y: auto; padding: 6px; }
.folder-pick { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 10px 10px calc(10px + var(--depth, 0) * 18px); border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; font-size: 15px; text-align: left; cursor: pointer; }
.folder-pick:hover { background: var(--chip); }
.folder-pick.on { background: var(--green-tint); color: var(--green); font-weight: 600; }
.folder-pick .ico { color: #d49b00; flex: none; }
.folder-picker-new { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line-soft); }
.folder-picker-new input { flex: 1; min-height: 38px; font-size: 15px; }
.folder-picker-new .btn { margin: 0; }
@media (max-width: 900px) {
  .docs-row { padding: 0; }
  .docs-row .row-main { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'name actions' 'meta actions'; gap: 0 8px; padding: 10px 2px 10px 4px; }
  .docs-row .docs-name { grid-area: name; }
  .docs-row .docs-when { grid-area: meta; }
  .docs-row .docs-actions { grid-area: actions; }
  .docs-row .docs-owner { display: none; }
  .docs-head-tools { flex: 1 1 100%; }
  .docs-head-tools .docs-search { flex: 1; }
  .folder-picker { top: auto; bottom: 0; transform: translateX(-50%); width: 100%; border-radius: 16px 16px 0 0; max-height: 80vh; padding-bottom: env(safe-area-inset-bottom); }
  .folder-pick { padding-top: 13px; padding-bottom: 13px; }
  .folder-picker-new input { font-size: 16px; min-height: 42px; }
}
@media (max-width: 900px) {
  .docs-row.docs-row-head { display: none; }
  .docs-folders { display: none; }
}
/* flagged: the red flag always shows in the list, on phones too (without the hover) */
.mail-item .mi-flag.on { color: var(--danger) !important; display: inline-grid; }
.mail-items.selecting .mi-flag.on { visibility: visible; }

/* Project brief & roadmap, attached docs */
.plan-brief { margin-bottom: 8px; font-size: 15px; line-height: 1.65; }
.plan-brief ul { padding-left: 22px; }
.plan-brief-edit { display: grid; gap: 8px; margin-bottom: 8px; }
.plan-brief-edit .editor-actions { display: flex; justify-content: flex-end; gap: 8px; }
.plan-ai { margin: 16px 0; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 10px; background: var(--page); display: grid; gap: 8px; }
.plan-ai label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; }
.plan-ai textarea { min-height: 70px; font-size: 14px; }
.plan-ai-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plan-ai-row select { width: auto; min-height: 34px; font-size: 13px; padding: 4px 8px; border-width: 1px; }
.plan-ai-row .btn { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.plan-phase { margin-top: 14px; }
.plan-phase h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 6px; }
.plan-phase ol { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line-soft); border-radius: 10px; overflow: hidden; }
.plan-step { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--line-soft); }
.plan-step:first-child { border-top: 0; }
.plan-step.done .plan-title { text-decoration: line-through; color: var(--muted); }
.plan-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.plan-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.plan-title { font-weight: 500; overflow-wrap: anywhere; }
.plan-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.plan-meta .ico { vertical-align: -2px; }
.plan-notes { flex-basis: 100%; }
.plan-side { flex: none; display: flex; align-items: center; gap: 6px; }
.plan-side .btn { margin: 0; white-space: nowrap; }
.plan-who { width: auto; max-width: 130px; min-height: 32px; font-size: 13px; padding: 2px 6px; border-width: 1px; }
.plan-task { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; cursor: pointer; padding: 2px; }
.plan-add { display: flex; gap: 8px; margin-top: 14px; }
.plan-add input { min-height: 38px; font-size: 14px; }
.plan-add input[name="phase"] { max-width: 160px; }
.plan-add .btn { margin: 0; }
.plan-tip { margin-top: 10px; }
.plan-panel > .btn.ghost { margin-top: 10px; display: inline-flex; align-items: center; gap: 6px; }
.linked-docs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.linked-docs li { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; max-width: 100%; }
.linked-docs li:hover { border-color: var(--green); }
.linked-docs a { display: flex; align-items: center; gap: 8px; padding: 6px 10px; color: var(--ink); min-width: 0; }
.linked-docs a:hover { text-decoration: none; }
.linked-docs .docs-icon { width: 24px; height: 24px; border-radius: 6px; }
.ld-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.linked-docs .icon-btn { width: 30px; height: 30px; }
@media (max-width: 900px) {
  .plan-step { flex-wrap: wrap; padding: 12px 10px; }
  .plan-side { flex-basis: 100%; justify-content: flex-end; padding-left: 22px; }
  .plan-side .btn { min-height: 38px; }
  .plan-who { min-height: 38px; flex: 1; max-width: none; }
  .plan-add { flex-wrap: wrap; }
  .plan-add input[name="title"] { flex: 1 1 100%; font-size: 16px; }
  .plan-add input[name="phase"] { flex: 1; max-width: none; font-size: 16px; }
  .ld-title { max-width: 60vw; }
}

/* roadmap as a table; the AI box on top */
.plan-panel .plan-ai { margin: 0 0 18px; }
.plan-head-tools { display: inline-flex; align-items: center; gap: 6px; }
.plan-head-tools .icon-btn.tool { width: 32px; height: 32px; }
.plan-table-wrap { overflow-x: auto; margin-top: 14px; border: 1px solid var(--line-soft); border-radius: 10px; }
.plan-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.plan-table th, .plan-table td { padding: 9px 12px; text-align: left; vertical-align: top; border-top: 1px solid var(--line-soft); }
.plan-table thead th { border-top: 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; background: var(--page); white-space: nowrap; }
.plan-table .pt-group th { background: var(--green-tint); color: var(--green); font-size: 13px; font-weight: 700; padding: 7px 12px; }
.plan-table .pt-task { min-width: 260px; }
.plan-table .pt-task .plan-title { display: block; font-weight: 500; }
.plan-table .plan-notes { display: block; margin-top: 2px; }
.plan-table .pt-num { text-align: right; white-space: nowrap; }
.plan-table .pt-status { min-width: 170px; }
.plan-table .pt-status .plan-task { margin-bottom: 4px; }
.plan-table .pt-take { display: flex; gap: 6px; align-items: center; }
.plan-table .pt-act { width: 40px; }
.plan-table tr.done .plan-title { text-decoration: line-through; color: var(--muted); }
.plan-table .chip { font-size: 12px; white-space: nowrap; }
.plan-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.plan-foot-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.plan-foot-tools .btn { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.btn.danger, .btn.ghost.danger { color: var(--danger); }
.linkish { color: var(--green); text-decoration: underline; }
/* progress + links under each task row */
.trow-extra { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: -4px; }
.tprogress { display: inline-flex; align-items: center; gap: 6px; }
.tprogress-bar { width: 110px; height: 5px; border-radius: 3px; background: var(--chip); overflow: hidden; display: inline-block; }
.tprogress-bar > span { display: block; height: 100%; border-radius: 3px; }
.tlink { display: inline-flex; align-items: center; gap: 4px; max-width: 200px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 10rem; background: none;
  color: var(--ink); font: inherit; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.tlink:hover { border-color: var(--green); color: var(--green); text-decoration: none; }
@media (max-width: 900px) {
  .plan-table-wrap { border: 0; overflow: visible; }
  .plan-table, .plan-table tbody, .plan-table tr, .plan-table td { display: block; width: 100%; }
  .plan-table thead { display: none; }
  .plan-table tr { border: 1px solid var(--line-soft); border-radius: 10px; margin-bottom: 8px; padding: 8px 10px; position: relative; }
  .plan-table .pt-group { border: 0; padding: 0; margin: 14px 0 6px; }
  .plan-table .pt-group th { display: block; background: none; padding: 0; text-transform: uppercase; letter-spacing: 0.04em; }
  .plan-table td { border: 0; padding: 3px 0; }
  .plan-table td:empty { display: none; }
  .plan-table td[data-label]:not(.pt-task):not(.pt-status)::before { content: attr(data-label) ': '; color: var(--muted); font-size: 12px; }
  .plan-table .pt-task { min-width: 0; padding-right: 36px; }
  .plan-table .pt-num { text-align: left; }
  .plan-table .pt-act { position: absolute; top: 6px; right: 4px; width: auto; }
  .plan-table .pt-take { margin-top: 6px; }
  .plan-table .pt-take .plan-who { flex: 1; }
  .plan-table .pt-take .btn { min-height: 38px; }
  .trow-extra { margin-top: 0; }
  .trow-extra { display: flex !important; }
  .tprogress-bar { width: 80px; }
}
@media (min-width: 901px) {
  .plan-table { min-width: 940px; }
  .plan-table td[data-label="When"] { white-space: nowrap; }
  .plan-table td[data-label="Pillar"], .plan-table td[data-label="Format"] { min-width: 120px; }
  .plan-table td[data-label="Channel"] { min-width: 110px; }
  .plan-table td[data-label="Channel"] .chip { margin: 0 2px 2px 0; display: inline-block; }
}
/* the whole card / row opens the task or job */
.tcard, .pcard, .trow, .jrow { cursor: pointer; }
.tcard:hover, .pcard:hover { border-color: var(--hover-line, var(--line)); }
/* roadmap groups: name, step count, add by hand */
.pt-group-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pt-count { margin-left: 8px; font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 10rem; padding: 1px 8px; text-transform: none; letter-spacing: 0; }
.pt-group-row .btn { margin: 0; font-weight: 500; text-transform: none; letter-spacing: 0; }
.pt-new td { background: var(--page); }
.step-form { display: grid; grid-template-columns: 2.4fr 1fr 1fr 1.2fr 1.2fr 1.1fr 0.8fr; gap: 8px; align-items: center; }
.step-form input, .step-form select { min-height: 36px; font-size: 14px; padding: 4px 10px; border-width: 1px; }
.step-form input[name="phase"] { grid-column: 1 / -1; }
.step-form .sf-notes { grid-column: 1 / 6; }
.step-form .sf-actions { grid-column: 6 / -1; display: flex; justify-content: flex-end; gap: 6px; }
.step-form .sf-actions .btn { margin: 0; }
.plan-empty-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.plan-empty-tools .btn { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.trow-extra .tdel { margin-left: auto; width: 28px; height: 28px; color: var(--muted); }
.trow-extra .tdel:hover { color: var(--danger); }
@media (max-width: 900px) {
  .step-form { grid-template-columns: 1fr 1fr; }
  .step-form .sf-title, .step-form .sf-notes, .step-form .sf-actions { grid-column: 1 / -1; }
  .step-form input, .step-form select { font-size: 16px; min-height: 42px; }
  .pt-new { padding: 10px !important; }
  .plan-table .pt-group th { display: block; }
  .pt-group-row .btn { padding: 4px 10px; }
}
.pt-group-row { justify-content: flex-start; }
.pt-group-row .btn { padding: 2px 10px; min-height: 0; height: 26px; font-size: 12.5px; }
.step-form > * { min-width: 0; }
.step-form input, .step-form select { width: 100%; box-sizing: border-box; }
@media (max-width: 900px) { .step-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .plan-table .pt-new { padding: 10px; } }
/* offline: the saved data is on screen */
.offline-pill { flex: none; font-size: 12px; font-weight: 600; color: #8a5a00; background: #fff4d6; border: 1px solid #f0c36b; border-radius: 10rem; padding: 3px 10px; white-space: nowrap; }
:root[data-theme='dark'] .offline-pill { color: #ffd27a; background: #3a2c0c; border-color: #6b5010; }
@media (max-width: 900px) { .offline-pill { font-size: 11px; padding: 2px 8px; } }

/* ---------- HR ---------- */
.hr .page-head.bare { display: block; }
.hr-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.hr-head .head-actions { width: auto !important; flex: none; }
.hr-head .head-actions > .btn { margin-left: 0 !important; }
.hr-positions { flex: 1 1 320px; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.hr-positions .pill.closed { opacity: 0.6; }
.hr-search { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 10rem; padding: 0 12px; color: var(--muted); background: var(--bg); }
.hr-search input { border: 0; background: none; min-height: 34px; padding: 4px 0; width: 180px; color: var(--ink); }
.hr-search input:focus { border: 0; outline: none; }
.hr-search:focus-within { border-color: var(--green); }
.hr-soon { display: flex; gap: 8px; align-items: center; overflow-x: auto; margin: 0 0 14px; padding-bottom: 2px; scrollbar-width: thin; }
.hr-soon > span { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.hr-soon-item { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; border: 1px solid var(--line); border-left: 4px solid #3b82f6; background: var(--bg); color: var(--ink); border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; max-width: 240px; text-align: left; }
.hr-soon-item:hover { border-color: var(--green); border-left-color: #3b82f6; }
.hr-soon-item span { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hcard { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; flex: none; min-width: 0; }
.hcard:hover, .hcard:focus-visible { border-color: var(--green); outline: none; }
.hcard.dragging { opacity: 0.4; }
.hcard-name { font-weight: 500; font-size: 14px; overflow-wrap: anywhere; }
.hcard-pos { font-size: 12px; color: var(--green-dark, var(--green)); font-weight: 500; }
.hr-contact { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hr-contact-value { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hr-contact-act { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin: -4px 0 -4px -6px;
  border-radius: 50%; color: var(--green); }
.hr-contact-act:hover { background: var(--green-tint); text-decoration: none; }
.hr-field-act { display: flex; gap: 6px; align-items: stretch; }
.hr-field-act input { flex: 1 1 auto; min-width: 0; }
.hr-quick { display: inline-flex; align-items: center; justify-content: center; margin: 0; padding: 0 12px; }
.hcard-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.hcard-foot .muted { display: inline-flex; align-items: center; gap: 3px; }
.hcard-gap { flex: 1 1 auto; }
.hr-when { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); background: var(--chip); border-radius: 10rem; padding: 1px 8px; }
.hr-when.past { color: var(--muted); text-decoration: line-through; }
.hr-board .column-body { --card-h: 96px; }
.hr-drawer h2 { margin-bottom: 12px; }
.hr-cand-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hr-cand-head h2 { margin: 0; }
.hr-stage { border-radius: 10rem; padding: 2px 12px; font-size: 13px; font-weight: 600; background: var(--chip); }
.hr-stage[data-stage="interview"] { background: color-mix(in srgb, #3b82f6 18%, transparent); }
.hr-stage[data-stage="confirm"] { background: color-mix(in srgb, #f59e0b 20%, transparent); }
.hr-stage[data-stage="onboarding"] { background: var(--green-tint); color: var(--green-dark, var(--green)); }
.hr-stage[data-stage="rejected"] { background: var(--danger-bg); color: var(--danger); }
.hr-steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.hr-steps .pill[disabled] { cursor: default; }
.hr-appt { background: var(--chip); color: var(--ink); justify-content: flex-start; }
.hr-appt > span { flex: 1 1 auto; }
.hr-edit { margin-top: 16px; }
.hr-edit-foot { display: flex; justify-content: flex-end; margin-top: -4px; }
.hr-files, .hr-log { margin-top: 20px; }
.hr-files h3, .hr-log h3 { font-size: 15px; display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.hr-file { font: inherit; background: none; border: 0; padding: 0; color: var(--ink); cursor: pointer; text-align: left; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hr-file:hover { color: var(--green); text-decoration: underline; }
.hr-log ul { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.hr-log li { padding: 5px 0; border-top: 1px solid var(--line-soft); }
.hr-log li:first-child { border-top: 0; }
.hr-add-pos { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; gap: 8px; margin-bottom: 16px; }
.hr-pos-list { list-style: none; margin: 0 0 12px; padding: 0; }
.hr-pos-list li { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.hr-pos-list li.closed input { opacity: 0.6; }
.hr-pos-list li.muted { display: block; }
.hr-move-when { display: grid; grid-template-columns: 160px 120px 100px minmax(0, 1fr); gap: 10px; align-items: end; }
.hr-move-when .field { margin-bottom: 12px; }
.hr-send-toggle { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; font-weight: 500; }
.hr-compose .rte { margin-top: 12px; }
.hr-compose-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0 6px; }
.hr-compose-tools .checkbox { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.hr-tpl-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 14px; }
.hr-tpl .rte { margin-top: 12px; }
/* interview: at the office or on Google Meet */
.hr-mode { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.hr-mode .pill { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.hr-mode .pill input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.hr-mode .pill:focus-within { outline: 2px solid var(--green); outline-offset: 2px; }
.hr-meet-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: -4px 0 14px; }
.hr-meet-tools[hidden] { display: none; }
.hr-meet-tools .btn { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.hr-meet-tools .checkbox { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.hr-meet-tools p { flex-basis: 100%; margin: 0; }
.hr-appt { flex-wrap: wrap; }
.hr-appt-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; flex: none; }
.hr-appt-actions .btn { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.hr-soon-wrap { flex: none; display: inline-flex; align-items: stretch; gap: 4px; }
.hr-soon-item .muted { display: inline-flex; align-items: center; gap: 4px; }
.hr-join { display: inline-flex; align-items: center; gap: 4px; margin: 0; align-self: center; }
/* portfolio / CV links: in the candidate, and in "Save to HR" */
.hr-links { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.hr-links .tlink { max-width: 260px; }
.mh-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mh-links li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mh-links .checkbox { display: inline-flex; align-items: center; gap: 6px; flex: none; font-weight: 500; }
.mh-links a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--muted); }
.mh-links a:hover { color: var(--green); }

/* HR on phones: one column at a time (swipe), tools wrap, drawers stack their fields */
@media (max-width: 760px) {
  .hr-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .hr-positions { flex: none; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .hr-positions .pill { white-space: nowrap; flex: none; }
  .hr-head .head-actions { display: flex; flex-wrap: wrap; gap: 8px; width: 100% !important; }
  .hr-search { flex: 1 1 100%; }
  .hr-search input { width: 100%; font-size: 16px; }
  .hr-head .head-actions > .btn { flex: 1 1 auto; justify-content: center; }
  .hr-contact-act { width: 36px; height: 36px; margin-left: -10px; }
  .hr-move-when { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .hr-move-when .hr-move-place { grid-column: 1 / -1; }
  .hr-move-when input { font-size: 16px; }
  .hr-add-pos { grid-template-columns: minmax(0, 1fr) auto; }
  .hr-add-pos input[name="department"] { grid-column: 1 / -1; grid-row: 2; }
  .hr-pos-list li { grid-template-columns: minmax(0, 1fr) auto auto; }
  .hr-pos-list li input[data-hr-pos-dept] { grid-column: 1 / -1; }
  .hr-appt { align-items: flex-start; }
  .hr-appt-actions { width: 100%; }
  .hr-steps { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .hr-steps .pill { flex: none; }
  .hr-compose-tools { gap: 8px; }
}
/* the bottom tab bar fits every tab on a phone */
@media (max-width: 900px) {
  .nav a { padding: 10px 2px; min-width: 0; }
  .nav-ico { width: 22px; height: 22px; }
}
@media (max-width: 400px) {
  .nav { padding-left: 0; padding-right: 0; }
  .nav a { min-height: 52px; }
  .nav-ico { width: 20px; height: 20px; }
}

/* PDF pages drawn for phones (pdf.js): full width, scroll through every page */
.viewer-body.pdf-pages { display: block; padding: 0; background: #525659; }
.viewer-pages { display: flex; flex-direction: column; gap: 8px; padding: 8px 0 calc(16px + env(safe-area-inset-bottom)); }
.viewer-page { display: block; width: 100%; height: auto; background: #fff; }
.viewer-more { background: var(--bg); padding: 12px 16px; margin: 0 8px; border-radius: 8px; }

/* HR drawers on phones: nothing wider than the screen */
.hr-drawer { overflow-x: hidden; }
.hr-drawer .drawer-body, .hr-drawer form, .hr-compose, .hr-move-when > .field { min-width: 0; max-width: 100%; }
.hr-drawer .mail-field input { flex: 1 1 auto; min-width: 0; width: 100%; }
.hr-move-when input { width: 100%; min-width: 0; box-sizing: border-box; }
.hr-new-btn { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 760px) {
  /* iOS gives date/time inputs a fixed intrinsic width: let them shrink and read left */
  .hr-move-when input[type="date"], .hr-move-when input[type="time"] { -webkit-appearance: none; appearance: none; display: block; text-align: left; min-height: 46px; }
  .hr-move-when input::-webkit-date-and-time-value { text-align: left; }
  .hr-move-when { gap: 8px 10px; }
  .hr-mode .pill { flex: 1 1 0; justify-content: center; min-height: 42px; }
  .hr-meet-tools .btn { flex: 1 1 auto; justify-content: center; }
  .hr-send-toggle { margin-top: 0; }
  .hr-compose .mail-field label { width: 56px; }
  .hr-compose-tools { flex-direction: column; align-items: stretch; }
  .hr-compose-tools .mail-sig-pick { display: flex; align-items: center; gap: 8px; }
  .hr-compose-tools .mail-sig-pick select { flex: 1 1 auto; min-width: 0; }
  .hr-compose-tools .hcard-gap { display: none; }
  .hr-compose-tools .btn { justify-content: center; }
  .hr-tpl-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .hr-tpl-tabs .pill { flex: none; }
  .hr-cand-head h2 { font-size: 22px; }
  /* "+ Candidate" becomes a round button with only the icon */
  .hr-head .head-actions > .hr-new-btn { flex: none; width: 56px; height: 56px; padding: 0; border-radius: 50%; justify-content: center; }
  .hr-new-btn .hr-new-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .hr-new-btn svg { width: 24px; height: 24px; }
}
/* an email is written left-aligned: justified text leaves gaps on a phone */
.hr-compose .rte-body, .hr-tpl .rte-body { text-align: left; hyphens: manual; }

/* ---------- long text on phones ---------- */
@media (max-width: 760px) {
  /* justified text leaves wide gaps in a narrow column */
  .summary p, .summary li, .prose, .job-desc, .rte-body, .comments p, .viewer-text, .plan-brief, .drawer-body p, .drawer-body li { text-align: left; hyphens: manual; }
  /* every step fits the screen: number + name, shortened when needed */
  .stepper { overflow-x: visible; margin-left: 0; margin-right: 0; padding: 0; scroll-snap-type: none; }
  .stepper .step, .tstepper .step { flex: 1 1 0; min-width: 0; padding-right: 4px; }
  .step .name { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .step .num { width: 18px; height: 18px; font-size: 11px; border-width: 1.5px; margin-right: 3px; vertical-align: middle; }
  .step .date { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* date and time pickers: iOS gives them a fixed width */
  input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"] { -webkit-appearance: none; appearance: none; display: block; width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; text-align: left; }
  input::-webkit-date-and-time-value { text-align: left; }
  .drawer { overflow-x: hidden; }
  .drawer-body .field, .drawer-body .form-row > * { min-width: 0; }
  /* long button labels wrap instead of running off the screen */
  .btn { max-width: 100%; }
  .plan-empty-tools .btn { white-space: normal; text-align: left; line-height: 1.3; min-height: 40px; height: auto; }
  /* room under the last card for the round + button */
  .page { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
}
@media (max-width: 760px) {
  /* the bars above already number the steps: the full names fit without the circles */
  .stepper .step .num { display: none; }
  .stepper .step .name { font-size: 13px; }
}
@media (max-width: 760px) { .stepper .step .date { margin-left: 0; } }

/* ---------- scheduled / automated tasks ---------- */
.auto-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.auto-box > label { display: flex; align-items: center; gap: 6px; }
.auto-box [hidden] { display: none !important; }
.auto-box .small { display: block; margin: 10px 0 4px; font-weight: 500; }
.auto-row { display: flex; gap: 8px; flex-wrap: wrap; }
.auto-row > * { flex: 1 1 160px; min-width: 0; }
.auto-days { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.auto-days .pill { cursor: pointer; }
.auto-days .pill input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.auto-days .pill:focus-within { outline: 2px solid var(--green); outline-offset: 2px; }
.auto-next { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.run-status { font-size: 12.5px; font-weight: 600; border-radius: 10rem; padding: 2px 10px; background: var(--chip); color: var(--ink); white-space: nowrap; }
.run-status.ok { background: var(--green-tint); color: var(--green-dark, var(--green)); }
.run-status.bad { background: var(--danger-bg); color: var(--danger); }
.run-status.wait { background: color-mix(in srgb, #f59e0b 22%, transparent); }
#task-run textarea { width: 100%; font-size: 14px; line-height: 1.5; }
.run-log ul { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; }
.run-log li { padding: 4px 0; border-top: 1px solid var(--line-soft); }
.sched-strip { display: flex; gap: 8px; align-items: center; overflow-x: auto; margin: 0 0 14px; padding-bottom: 2px; scrollbar-width: thin; }
.sched-strip > span { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.sched-item { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; max-width: 260px; border: 1px solid var(--line); border-left: 4px solid var(--green);
  background: var(--bg); color: var(--ink); border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.sched-item:hover { border-color: var(--green); }
.sched-item > * { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  .auto-row > * { flex: 1 1 100%; }
  .auto-box textarea, .auto-box input, .auto-box select { font-size: 16px; }
  .run-status { white-space: normal; }
}

/* ---------- AI assistant: round button + chat panel (Admin) ---------- */
.ai-fab { position: fixed; right: 24px; bottom: 24px; z-index: 30; width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--green); color: #fff; box-shadow: 0 6px 20px var(--shadow); }
.ai-fab:hover { filter: brightness(1.08); }
.ai-fab:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
body.ai-on .ai-fab { display: none; }
.ai-panel { position: fixed; right: 24px; bottom: 24px; z-index: 31; width: min(420px, calc(100vw - 32px)); height: min(640px, calc(100vh - 48px));
  display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 40px var(--shadow); overflow: hidden; }
.ai-panel[hidden] { display: none; }
.ai-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); }
.ai-gap { flex: 1 1 auto; }
.ai-msgs { flex: 1 1 auto; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.ai-msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.ai-msg p { margin: 0 0 6px; text-align: left; }
.ai-msg p:last-child { margin-bottom: 0; }
.ai-msg ul, .ai-msg ol { margin: 4px 0 6px; padding-left: 20px; }
.ai-msg code { font-size: 12.5px; background: var(--chip); padding: 1px 4px; border-radius: 4px; }
.ai-msg a { color: var(--green); }
.ai-msg.user { align-self: flex-end; background: var(--green-tint); color: var(--ink); border-bottom-right-radius: 4px; }
.ai-msg.assistant { align-self: flex-start; background: var(--chip); color: var(--ink); border-bottom-left-radius: 4px; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ai-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; font-size: 12px; padding: 3px 9px; border-radius: 10rem; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.ai-chip:hover { border-color: var(--green); color: var(--green); text-decoration: none; }
.ai-empty { padding: 8px 4px; }
.ai-starters { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 10px; }
.ai-starters .pill { white-space: normal; text-align: left; }
.ai-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line); }
.ai-form textarea { flex: 1 1 auto; min-width: 0; resize: none; min-height: 42px; max-height: 160px; font-size: 14px; line-height: 1.4; }
.ai-form .btn { flex: none; height: 42px; width: 46px; padding: 0; justify-content: center; }
@media (max-width: 760px) {
  /* above the page's round + button and the tab bar */
  .ai-fab { right: 16px; bottom: calc(140px + env(safe-area-inset-bottom)); width: 48px; height: 48px; }
  .ai-panel { inset: 0; width: 100%; height: 100%; border-radius: 0; border: 0; padding-bottom: env(safe-area-inset-bottom); }
  .ai-form textarea { font-size: 16px; }
  .ai-msg { max-width: 92%; }
}
body.locked .ai-fab, body.locked .ai-panel { display: none !important; } /* signed out */
/* chat box: one-line hint, no scrollbar until the message is tall */
.ai-form textarea { overflow-y: hidden; white-space: pre-wrap; }
.ai-form textarea.tall { overflow-y: auto; }
.ai-form textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* frames the runner captured from an automated result */
.run-frames { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin-top: 10px; }
.run-frames img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; background: var(--chip); }
.ai-review { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: var(--page); border: 1px solid var(--line-soft); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.ai-review p { margin: 0 0 6px; }

/* AI page (desktop): conversations on the left, a wide chat on the right */
.ai-page { display: grid; grid-template-columns: 280px minmax(0, 1fr); height: calc(100vh - 65px); min-height: 480px; overflow: hidden; }
.ai-side { display: flex; flex-direction: column; gap: 10px; padding: 16px 12px; border-right: 1px solid var(--line); min-height: 0; }
.ai-side > .btn { justify-content: center; }
.ai-sessions { list-style: none; margin: 0; padding: 0; flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.ai-sessions li { display: flex; align-items: center; gap: 2px; border-radius: 10px; padding-right: 4px; }
.ai-sessions li:hover, .ai-sessions li.active { background: var(--chip); }
.ai-sessions li .icon-btn { opacity: 0; flex: none; }
.ai-sessions li:hover .icon-btn, .ai-sessions li.active .icon-btn, .ai-sessions li .icon-btn:focus-visible { opacity: 1; }
.ai-sess { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 10px; border: 0; background: none; color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
.ai-sess strong { font-size: 14px; font-weight: 600; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-none { padding: 8px 10px; }
.ai-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ai-main-head { display: flex; align-items: center; gap: 10px; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.ai-main-head h1 { font-size: 18px; margin: 0; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-main .ai-msgs { padding: 20px max(24px, calc((100% - 820px) / 2)); }
.ai-main .ai-msg { max-width: 82%; font-size: 15px; }
.ai-main .ai-form { padding: 12px max(24px, calc((100% - 820px) / 2)) 18px; }
.ai-main .ai-form textarea { font-size: 15px; }
body.on-ai-page .ai-fab, body.on-ai-page .ai-panel { display: none !important; }
@media (max-width: 768px) { .nav a.desk-only { display: none !important; } }

/* conversation list inside the round button's panel (phones) */
.ai-panel-sessions { display: none; flex: 1 1 auto; min-height: 0; flex-direction: column; gap: 8px; padding: 10px; }
.ai-panel.listing .ai-panel-sessions { display: flex; }
.ai-panel.listing .ai-msgs, .ai-panel.listing .ai-form { display: none; }
.ai-panel .ai-sessions li .icon-btn { opacity: 1; }

.ai-form textarea { max-height: none; } /* growAiInput sets the height and its limit */

/* files attached in the AI chat */
.ai-form { align-items: flex-end; }
.ai-attach { flex: none; display: grid; place-items: center; width: 36px; height: 42px; color: var(--muted); cursor: pointer; border-radius: 10px; }
.ai-attach:hover { color: var(--ink); background: var(--chip); }
.ai-pending { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; }
.ai-pending[hidden], .ai-pending:empty { display: none; }
.ai-file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 8px; border-radius: 8px; background: var(--chip); color: var(--ink); font-size: 12.5px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-file-chip button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.ai-file-chip .spinner { width: 12px; height: 12px; margin: 0; }
.ai-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.ai-files img { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.ai-main .ai-pending { padding: 8px max(24px, calc((100% - 820px) / 2)) 0; }
/* reference files of an automated Canva task */
.refs-box { margin-top: 10px; }
.refs-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.refs-head .btn { margin: 0; }
.refs-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; margin-top: 6px; }
.refs-list p { grid-column: 1 / -1; margin: 0; }
.ref-item { position: relative; }
.ref-item img, .ref-pdf { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: grid; place-items: center; background: var(--chip); color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: none; }
.ref-del { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; line-height: 1; font-size: 14px; }
/* AI screening on HR candidates */
.ai-flag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.ai-flag.strong { background: var(--green-tint); color: var(--green-dark); }
.ai-flag.maybe { background: var(--warn-bg); color: var(--warn); }
.ai-flag.no { background: var(--danger-bg); color: var(--danger); }

/* quick Claude model switch under the chat box */
.ai-model { display: flex; gap: 4px; margin-left: 8px; }
.ai-model[hidden], .ai-model:empty { display: none; }
.ai-model-btn { border: 1px solid var(--line); background: none; color: var(--muted); border-radius: 999px; padding: 2px 10px; font: inherit; font-size: 12px; cursor: pointer; line-height: 1.6; }
.ai-model-btn:hover { color: var(--ink); }
.ai-model-btn.on { border-color: var(--green); color: var(--green); background: var(--green-tint); font-weight: 600; }
.ai-head .ai-model-btn { padding: 1px 9px; font-size: 11.5px; }

.st-pop.bd-pop { display: flex; gap: 8px; align-items: flex-start; }
.bd-grid { display: grid; grid-template-columns: repeat(5, 34px); gap: 2px; }
.bd-side { display: flex; flex-direction: column; gap: 6px; padding-left: 8px; border-left: 1px solid var(--line-soft); }
.bd-side .st-pick { position: relative; flex-direction: column; gap: 2px; height: 36px; }
.bd-side input[type=color] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.bd-swatch { display: block; width: 18px; height: 3px; border-radius: 1px; }
.bd-side .st-fmt { height: 30px; font-size: 12px; }

/* the assistant's options to pick, and its file links */
.ai-choices { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; margin-top: 2px; }
.ai-choices .pill { white-space: normal; text-align: left; line-height: 1.35; }
.ai-choices .pill:disabled { opacity: .55; cursor: default; }
.ai-choices .pill.active { opacity: 1; border-color: var(--green); color: var(--green); }
.ai-chip.ai-file { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-flex; }

/* API keys: masked while typed (not type=password, so password managers leave them alone) */
.cred input.secret { -webkit-text-security: disc; text-security: disc; }
.cred input.secret:placeholder-shown { -webkit-text-security: none; }
.cred input.invalid { border-color: var(--danger); }
.cred-error { color: var(--danger); margin: 4px 0 0; overflow-wrap: anywhere; }

/* Claude on/off and its model, as icons in the chat header */
.ai-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: none; color: var(--muted); cursor: pointer; padding: 0; }
.ai-ico:hover { color: var(--ink); }
.ai-ico.on { border-color: var(--green); color: var(--green); background: var(--green-tint); }
.ai-model { align-items: center; }

/* phones: pinch zooms the sheet / doc (handled in docs.js), not the whole page */
@media (max-width: 900px) {
  .grid-wrap, #doc-body { touch-action: pan-x pan-y; }
}

/* the assistant's working plan (goal → steps), at the top of the chat */
.ai-plan { position: sticky; top: -14px; z-index: 1; align-self: stretch; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-size: 13px; }
.ai-plan summary { display: flex; justify-content: space-between; gap: 8px; cursor: pointer; font-weight: 600; list-style: none; }
.ai-plan summary::-webkit-details-marker { display: none; }
.ai-plan summary span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-plan ol { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.ai-plan li { display: flex; gap: 8px; align-items: baseline; color: var(--ink); overflow-wrap: anywhere; }
.ai-plan-ico { flex: none; width: 14px; text-align: center; color: var(--muted); }
.ai-plan li.done { color: var(--muted); }
.ai-plan li.done .ai-plan-ico { color: var(--green); }
.ai-plan li.doing .ai-plan-ico { color: var(--warn); }
.ai-plan li.failed .ai-plan-ico { color: var(--danger); }

/* Phones: the round buttons (AI, and + new task / job / candidate / file / email) float over the page at the
   same size, and pages with a board run down to the tab bar instead of keeping empty room for the buttons. */
@media (max-width: 900px) {
  .page-head .head-actions > .btn.head-add, .mail-fab, .docs-fab { width: 46px; height: 46px; right: 16px; bottom: calc(68px + env(safe-area-inset-bottom)); box-shadow: 0 6px 18px var(--shadow); }
  .head-add .ico, .mail-fab svg, .docs-fab svg { width: 20px; height: 20px; }
  .page:has(.board) { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .board .column-body { padding-bottom: 116px; } /* the last card scrolls clear of the floating buttons */
}
@media (max-width: 768px) {
  .ai-fab { width: 46px; height: 46px; right: 16px; bottom: calc(124px + env(safe-area-inset-bottom)); }
  .ai-fab svg { width: 21px; height: 21px; }
}

/* an automated run under way: where, since when, how far */
.run-live { margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--page); border: 1px solid var(--line-soft); }
.run-live p { margin: 0 0 6px; overflow-wrap: anywhere; }
.run-live p:last-child { margin-bottom: 0; }
.run-bar { height: 6px; border-radius: 3px; background: var(--chip); overflow: hidden; margin: 4px 0 8px; }
.run-bar span { display: block; height: 100%; background: var(--green); transition: width .6s ease; }
.run-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); margin-right: 6px; vertical-align: 1px; }
.run-dot.on { background: var(--green); }

/* a file dragged over the chat */
.ai-panel.ai-drop, .ai-main.ai-drop { outline: 2px dashed var(--green); outline-offset: -6px; }

.run-files { margin-top: 10px; }
.run-files ul { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.run-files li { display: flex; align-items: center; gap: 6px; min-width: 0; }
.run-files code { font-size: 12px; overflow-wrap: anywhere; min-width: 0; }

.auto-deep { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; color: var(--muted); cursor: pointer; }
.auto-deep input { width: auto; min-height: 0; }
.run-review { margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-soft); background: var(--page); font-size: 13px; }
.run-review.pass { border-color: color-mix(in srgb, var(--green) 40%, var(--line-soft)); }
.run-review.changes { border-color: color-mix(in srgb, var(--warn) 50%, var(--line-soft)); }
.run-review p { margin: 0 0 4px; overflow-wrap: anywhere; }

/* Automation run inside the Feedback section: one compact line, details on demand */
.run-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.run-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.run-head .icon-btn { margin-left: auto; }
.run-verdict { font-size: 12px; font-weight: 600; border-radius: 10rem; padding: 2px 8px; background: var(--green-tint); color: var(--green-dark, var(--green)); white-space: nowrap; }
.run-verdict.changes { background: color-mix(in srgb, #f59e0b 22%, transparent); color: var(--ink); }
.run-card .run-live { margin-top: 8px; }
.run-more { margin-top: 8px; }
.run-more > summary { cursor: pointer; list-style: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-more > summary::-webkit-details-marker { display: none; }
.run-more > summary::before { content: '▸ '; }
.run-more[open] > summary::before { content: '▾ '; }
.run-more[open] > *:not(summary) { margin-top: 8px; }
.run-card .run-frames { display: flex; gap: 6px; overflow-x: auto; }

/* AI replies (feedback, notes): the summary line only, the rest opens on demand */
.ai-reply { border-radius: 10px; background: var(--chip); padding: 8px 10px; }
.ai-reply > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ai-reply > summary::-webkit-details-marker { display: none; }
.ai-reply .ai-tag { flex: none; font-size: 12px; font-weight: 600; color: var(--green-dark, var(--green)); display: inline-flex; align-items: center; gap: 4px; }
.ai-reply .ai-sum { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-reply[open] .ai-sum { white-space: normal; }
.ai-reply > summary .muted { flex: none; }
.ai-reply > .prose { margin-top: 6px; }
.comments li.ai { border: 0; padding: 4px 0; }
.ai-replies { display: grid; gap: 6px; margin-top: 8px; }
.mention-item .avatar.ai { background: var(--green-tint); color: var(--green-dark, var(--green)); }
@media (max-width: 600px) { .ai-reply > summary .muted { display: none; } }

/* Feedback and notes as a conversation: mine on the right, others and the AI on the left */
.comments.chat { display: grid; gap: 10px; }
.comments.chat li { border: 0; padding: 10px 12px; max-width: 85%; justify-self: start; background: var(--chip); border-radius: 14px 14px 14px 4px; }
.comments.chat li.mine { justify-self: end; background: var(--green-tint); border-radius: 14px 14px 4px 14px; }
.comments.chat li.ai { padding: 0; background: none; width: 85%; }
.comments.chat .comment-head { margin-bottom: 2px; }
.comments.chat .comment-body p { margin: 0; }
.ai-replies.chat { display: grid; gap: 8px; }
.ai-replies.chat > .mine { justify-self: end; max-width: 85%; }
.ai-replies.chat > .mine .bubble { background: var(--green-tint); border-radius: 14px 14px 4px 14px; padding: 8px 12px; white-space: pre-wrap; }
.ai-replies.chat > .ai { justify-self: start; width: 85%; }
.chat .ai-reply { border-radius: 14px 14px 14px 4px; }
/* the round AI / + buttons float over the drawer: room under its last field */
.drawer-body { padding-bottom: 96px; }
@media (max-width: 600px) {
  .comments.chat li, .comments.chat li.ai, .ai-replies.chat > .ai, .ai-replies.chat > .mine { max-width: 92%; width: auto; }
  .comments.chat li.ai, .ai-replies.chat > .ai { width: 92%; }
}
.comments.chat, .ai-replies.chat { grid-template-columns: minmax(0, 1fr); }
.comments.chat li, .ai-replies.chat > * { min-width: 0; overflow-wrap: anywhere; }
.comments.chat .comment-head { flex-wrap: wrap; }
.chat .ai-reply { max-width: 100%; overflow: hidden; }

/* Output sizes of a Canva / Affinity task */
.size-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; align-items: center; }
.size-chip { display: inline-flex; }
.size-chip input { position: absolute; opacity: 0; pointer-events: none; }
.size-chip span { font-size: 12.5px; padding: 4px 10px; border-radius: 10rem; border: 1px solid var(--line); cursor: pointer; }
.size-chip input:checked + span { background: var(--green-tint); border-color: var(--green); color: var(--green-dark, var(--green)); }
.size-chip input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }
.size-custom { width: 110px; padding: 4px 10px; font-size: 12.5px; }

/* A job's proposal on Upwork (prepared by Claude, sent on confirm) */
.upwork-box { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.upwork-box:empty { display: none; }
.upwork-box ul { margin: 6px 0; padding-left: 18px; }
.upwork-box.done { border-color: var(--green); }

/* Find Work's sidebar shares the .filters class with the folded filter bars: give it its own inner space */
aside.filters { padding: 16px; }
@media (max-width: 600px) { aside.filters { padding: 12px; } }

/* Saved jobs and a job's live Upwork facts */
.job-posted .job-star { margin-left: auto; font-size: 18px; line-height: 1; width: 32px; height: 32px; }
.job-star.on { color: #f5b21b; }
.upwork-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 10px; }
.upwork-facts .icon-btn { width: 26px; height: 26px; }

/* An automated run on the task card: a thin bar and what is happening; ▶ starts an automation that is not running */
.tc-run { display: grid; gap: 4px; margin: 6px 0 2px; min-width: 0; }
.tc-run .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.tc-run .run-bar { height: 4px; }
.run-bar.waiting span { animation: run-wait 1.6s ease-in-out infinite; }
@keyframes run-wait { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .run-bar.waiting span { animation: none; } }
.tc-play { width: 28px; height: 28px; font-size: 12px; color: var(--green); }

/* ---------- Settings › Connections ---------- */
.conn-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.conn-status .btn { margin-left: auto; }
.conn-chip { font-size: 12.5px; font-weight: 600; border-radius: 10rem; padding: 2px 10px; background: var(--chip); color: var(--ink); white-space: nowrap; }
.conn-chip.ok { background: var(--green-tint); color: var(--green-dark, var(--green)); }
.conn-chip.bad { background: var(--danger-bg); color: var(--danger); }
.conn-chip.wait { background: color-mix(in srgb, #f59e0b 22%, transparent); }
.conn-list { list-style: none; margin: 4px 0 12px; padding: 0; }
.conn-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.conn-row:first-child { border-top: 0; }
.conn-row.off .conn-main { opacity: 0.55; }
.conn-ico { color: var(--muted); padding-top: 2px; }
.conn-main { min-width: 0; }
.conn-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-err { color: var(--danger); margin-top: 2px; }
.conn-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.conn-actions { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.conn-add > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.conn-add > summary::-webkit-details-marker { display: none; }
.conn-form { margin-top: 12px; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; min-height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 22px; background: var(--line); transition: background 0.15s; pointer-events: none; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); transition: transform 0.15s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }
.run-engine { border: 1px solid var(--line); border-radius: 10rem; padding: 0 8px; }
.run-note { background: var(--page); border-radius: 8px; padding: 8px 12px; margin: 8px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .conn-row { grid-template-columns: 24px minmax(0, 1fr); }
  .conn-side { grid-column: 2; align-items: flex-start; }
  .conn-actions { justify-content: flex-start; }
  .conn-status .btn { margin-left: 0; }
}

/* pictures in notes and feedback (read by @GPT / @Claude) */
.rte-pic { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; margin-left: auto; }
.rte-pic input { display: none; }
.rte-body img, .comment-body img { max-width: min(100%, 480px); height: auto; border-radius: 6px; display: block; margin: 6px 0; }
.conn-browser { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; }
.conn-browser select { width: auto; min-height: 34px; padding: 4px 10px; }

/* ---------- Upwork › Inbox ---------- */
.ib { display: flex; flex-direction: column; height: calc(100dvh - 65px); min-height: 420px; overflow: hidden; }
.ib-top { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--line-soft); }
.ib-top .subnav { margin: 0; }
.ib-status { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.ib-panes { flex: 1 1 auto; display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); min-height: 0; }
.ib-list { border-right: 1px solid var(--line-soft); overflow-y: auto; }
.ib-room { position: relative; display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; font: inherit; color: var(--ink); background: none; border: 0; border-bottom: 1px solid var(--line-soft); padding: 12px 28px 12px 16px; cursor: pointer; }
.ib-room:hover { background: var(--page); }
.ib-room.active { background: var(--green-tint); }
.ib-room-top { display: flex; justify-content: space-between; gap: 8px; }
.ib-room-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-room.unread strong { color: var(--green-dark, var(--green)); }
.ib-room-job { color: var(--green-dark, var(--green)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-room-last { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-dot { position: absolute; right: 12px; top: 50%; width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.ib-thread { display: flex; flex-direction: column; min-height: 0; }
.ib-pick { margin: auto; }
.ib-head { display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-bottom: 1px solid var(--line-soft); }
.ib-head-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.ib-head-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-head select { width: auto; max-width: 240px; }
.ib-back { display: none; }
.ib-msgs { flex: 1 1 auto; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.ib-msg { display: flex; flex-direction: column; gap: 2px; max-width: min(78%, 620px); align-self: flex-start; }
.ib-msg.me { align-self: flex-end; align-items: flex-end; }
.ib-bubble { background: var(--chip); border-radius: 14px; padding: 9px 13px; line-height: 1.45; overflow-wrap: anywhere; white-space: normal; }
.ib-msg.me .ib-bubble { background: var(--green-tint); }
.ib-msg.pending .ib-bubble { opacity: 0.7; }
.ib-err { color: var(--danger); }
.ib-compose { border-top: 1px solid var(--line-soft); padding: 10px 20px 14px; }
.ib-compose textarea { resize: vertical; min-height: 64px; }
.ib-tools { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.ib-tools label.icon-btn { cursor: pointer; }
.ib-gap { flex: 1 1 auto; }
.ib-files { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ib-files:empty { display: none; }
.ib-files li { display: inline-flex; align-items: center; gap: 6px; background: var(--chip); border-radius: 8px; padding: 3px 4px 3px 6px; max-width: 100%; }
.ib-files li span:first-of-type { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-files img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; }
.ib-files li.uploading { opacity: 0.6; }
.nav-badge.inline { position: static; display: inline-block; margin-left: 4px; }
@media (max-width: 760px) {
  .ib { height: calc(100dvh - 56px - 57px - env(safe-area-inset-bottom)); min-height: 0; }
  .ib-top { padding: 8px 16px; }
  .ib-panes { grid-template-columns: 1fr; }
  .ib-list { border-right: 0; }
  .ib.reading .ib-list { display: none; }
  .ib:not(.reading) .ib-thread { display: none; }
  .ib-back { display: inline-flex; }
  .ib-head { padding: 8px 12px; flex-wrap: wrap; }
  .ib-msgs { padding: 12px; }
  .ib-msg { max-width: 88%; }
  .ib-compose { padding: 8px 12px 12px; }
}

/* ---------- voice notes and meetings (one hand on a phone: the big button sits under the thumb) ---------- */
.rte-mic { margin-left: auto; }
.rte-mic + .rte-pic { margin-left: 0; }
.voice-bar { position: fixed; z-index: 45; left: 50%; bottom: 24px; transform: translateX(-50%); width: min(460px, calc(100vw - 24px)); display: flex; align-items: center; gap: 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 10px 34px var(--shadow); padding: 12px 12px 12px 14px; }
.voice-row { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.voice-row > .voice-cancel { position: absolute; top: -14px; left: -6px; background: var(--bg); border: 1px solid var(--line); }
.voice-mid { display: flex; align-items: center; gap: 8px; min-width: 0; }
.voice-mid .voice-state { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-time { font-variant-numeric: tabular-nums; font-size: 18px; }
.voice-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); flex: none; transform: scale(calc(0.8 + var(--level, 0) * 0.9)); transition: transform 0.08s; box-shadow: 0 0 0 calc(var(--level, 0) * 8px) color-mix(in srgb, var(--danger) 25%, transparent); }
.voice-bar.busy .voice-dot { background: var(--muted); box-shadow: none; transform: none; }
.voice-langs { display: flex; gap: 6px; }
.voice-lang { font: inherit; font-size: 13px; font-weight: 600; min-width: 46px; min-height: 36px; border-radius: 10rem; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
.voice-lang.on { background: var(--green-tint); border-color: var(--green); color: var(--green-dark, var(--green)); }
.voice-go { flex: none; width: 68px; height: 68px; border-radius: 50%; border: 0; background: var(--danger); color: #fff; display: inline-grid; place-items: center; cursor: pointer; box-shadow: 0 4px 14px color-mix(in srgb, var(--danger) 40%, transparent); }
.voice-go:disabled { background: var(--muted); box-shadow: none; }
.ai-form .ai-mic { color: var(--ink); }
#drawer-root:has(.meet-drawer) .overlay { z-index: 40; }
.drawer.meet-drawer { z-index: 41; }
.meet-sources { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 8px; }
.meet-src { justify-content: center; min-height: 52px; font-size: 15px; }
.meet-h3 { font-size: 15px; margin: 20px 0 8px; }
.meet-list { list-style: none; margin: 0; padding: 0; }
.meet-item { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 2px; font: inherit; color: var(--ink); background: none; border: 0; border-top: 1px solid var(--line-soft); padding: 12px 0; cursor: pointer; }
.meet-tasks { list-style: none; margin: 0; padding: 0; }
.meet-tasks li { border-top: 1px solid var(--line-soft); padding: 10px 0; }
.meet-tasks li.made { opacity: 0.7; }
.meet-tasks .checkbox { align-items: center; }
.meet-task-title { flex: 1 1 auto; min-height: 40px; }
.meet-task-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0 28px; align-items: center; }
.meet-task-meta select, .meet-task-meta input[type='date'] { width: auto; min-height: 38px; padding: 4px 8px; font-size: 13px; }
.meet-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; }
.meet-actions .btn { width: 100%; justify-content: center; min-height: 48px; }
@media (max-width: 760px) {
  .voice-bar { left: 0; right: 0; bottom: 0; transform: none; width: 100%; border-radius: 22px 22px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); border-width: 1px 0 0; }
  .voice-go { width: 76px; height: 76px; }
  .voice-lang { min-height: 40px; min-width: 50px; }
  .meet-task-meta { margin-left: 0; }
}
/* the round AI button sits over the bottom-right corner: the Inbox Send button stays clear of it */
.ib-tools { padding-right: 76px; }
/* the chat's mic and meeting buttons look like the attach clip beside them */
button.ai-attach { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; }
button.ai-attach:hover { color: var(--green); }
.ai-form .ai-mic { color: var(--ink); }
/* voice bar: smaller controls (A / VI / EN / FR, the send-at-once switch, the stop button) */
.voice-lang { min-width: 34px; min-height: 30px; font-size: 12px; padding: 0 8px; }
.voice-direct { display: inline-grid; place-items: center; }
.voice-go { width: 54px; height: 54px; }
.voice-time { font-size: 16px; }
@media (max-width: 760px) {
  .voice-go { width: 60px; height: 60px; }
  .voice-lang { min-height: 34px; min-width: 38px; }
}
/* HR on a phone: "+ candidate" floats like the other round + buttons (same size, same place, under the AI button) */
@media (max-width: 900px) {
  .hr-head .head-actions > .hr-new-btn { position: fixed; z-index: 29; right: 16px; bottom: calc(68px + env(safe-area-inset-bottom)); width: 46px; height: 46px; box-shadow: 0 6px 18px var(--shadow); }
  .hr-new-btn svg { width: 20px; height: 20px; }
}

/* HR: select several, pin to the top, swipe on a phone (left deletes, right pins) */
.hcard { position: relative; transition: transform 0.15s ease, box-shadow 0.15s; touch-action: pan-y; }
.hcard.pinned { border-color: color-mix(in srgb, var(--green) 45%, var(--line)); }
.hcard-pin { position: absolute; top: 8px; right: 10px; color: var(--green); }
.hcard.selecting { padding-left: 38px; }
.hcard-check { position: absolute; left: 10px; top: 12px; width: 20px; height: 20px; border: 2px solid var(--hover-line); border-radius: 6px; display: grid; place-items: center; color: var(--green); }
.hcard.picked { border-color: var(--green); background: var(--green-tint); }
.hcard.picked .hcard-check { border-color: var(--green); }
.hcard.swipe-del { box-shadow: inset -6px 0 0 var(--danger); }
.hcard.swipe-pin { box-shadow: inset 6px 0 0 var(--green); }
.hr-selbar { position: fixed; z-index: 32; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 16px; padding: 8px 10px 8px 16px; box-shadow: 0 10px 30px var(--shadow); white-space: nowrap; }
.btn.danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; }
@media (max-width: 900px) {
  .hr-select-btn .hr-select-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .hr-selbar { left: 8px; right: 8px; transform: none; bottom: calc(64px + env(safe-area-inset-bottom)); justify-content: space-between; }
}
.avatar.notif-sys { background: var(--green-tint); color: var(--green-dark, var(--green)); display: inline-grid; place-items: center; }
/* Inbox list as in Upwork's Messages: title, search, Unread / Favorites */
.ib-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line-soft); }
.ib-side .ib-list { border-right: 0; flex: 1 1 auto; min-height: 0; }
.ib-side-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 6px; }
.ib-side-head strong { font-size: 18px; }
.ib-search { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 10rem; padding: 0 10px; color: var(--muted); min-width: 0; flex: 0 1 170px; }
.ib-search input { border: 0; background: none; min-height: 32px; padding: 2px 0; width: 100%; color: var(--ink); }
.ib-search input:focus { outline: none; border: 0; }
.ib-search:focus-within { border-color: var(--green); }
.ib-chips { display: flex; gap: 6px; padding: 6px 14px 10px; border-bottom: 1px solid var(--line-soft); }
.ib-none { text-align: center; margin: 48px 16px; }
.ib-star.on { color: #f5b400; }
.ib-star.on svg { fill: currentColor; }
.ib-star-mini { color: #f5b400; margin-right: 4px; display: inline-flex; vertical-align: -1px; }
.ib-star-mini svg { fill: currentColor; }
@media (max-width: 760px) {
  .ib.reading .ib-side { display: none; }
  .ib:not(.reading) .ib-side { display: flex; }
  .ib-side { border-right: 0; }
}
.hr-select-btn.on { background: var(--green-tint); border-color: var(--green); color: var(--green-dark, var(--green)); }
/* while candidates are being selected, the floating buttons step aside for the selection bar */
body:has(.hr-selbar) .ai-fab, .hr:has(.hr-selbar) .hr-new-btn { display: none !important; }
@media (max-width: 900px) {
  .hr-selbar { gap: 6px; padding: 8px 8px 8px 14px; }
  .hr-selbar .btn { padding-left: 10px; padding-right: 10px; }
}
@media (max-width: 900px) { .hr-head .head-actions > .hr-select-btn { flex: none; width: 52px; padding: 0; } }
.voice-mid .voice-cancel { margin-left: auto; width: 32px; height: 32px; flex: none; }
.voice-row > .voice-cancel { position: static; }

/* the finished file of an automated task, next to the comment count */
.tc-metas { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.tc-result { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--green-dark); text-decoration: none;
  padding: 1px 7px; border-radius: 999px; background: var(--green-tint); border: 1px solid color-mix(in srgb, var(--green) 35%, transparent); max-width: 120px; }
.tc-result span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-result:hover { border-color: var(--green); }
@media (max-width: 700px) { .tc-result { padding: 3px 9px; font-size: 12px; } }

/* ---------- Email Marketing ---------- */
.mk { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; align-items: start; }
.mk-side { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 2px; }
.mk-nav-group { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 14px 12px 4px; }
.mk-nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; color: var(--ink); font-weight: 500; font-size: 15px; }
.mk-nav-link:hover { background: var(--chip); text-decoration: none; color: var(--ink); }
.mk-nav-link.active { background: var(--green-tint); color: var(--green); }
.mk-main { min-width: 0; }
.mk-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.mk-head h1 { margin: 0; font-size: 26px; flex: 1 1 auto; }
.mk-head-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.mk-head-actions .btn, .mk-head-actions a.btn { display: inline-flex; align-items: center; gap: 6px; }
.mk-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; background: var(--bg); }
.mk-card h2 { font-size: 17px; margin: 0 0 12px; }
.mk-card h2:not(:first-child) { margin-top: 18px; }
.mk-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.mk-card-head h2 { margin: 0; }
.mk-empty { text-align: center; padding: 18px 8px; color: var(--muted); }
.mk-empty p { margin: 0 0 12px; }
.mk-label { font-weight: 500; display: block; margin-bottom: 6px; }
.mk-gap { flex: 1; }
.mk-bad { color: var(--danger); }
.mk-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.mk-tile { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mk-tile strong { font-size: 24px; line-height: 1.2; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-setup ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mk-setup li { display: flex; align-items: center; gap: 8px; color: var(--warn); }
.mk-setup li.done { color: var(--muted); }
.mk-setup li.done a { color: var(--muted); text-decoration: line-through; }
.mk-rows { list-style: none; margin: 0; padding: 0; }
.mk-rows > li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line-soft); }
.mk-rows > li:last-child { border-bottom: 0; }
.mk-rows > li[data-mk] { cursor: pointer; border-radius: 8px; }
.mk-rows > li[data-mk]:hover { background: var(--chip); }
.mk-rows > li.mk-child { padding-left: 28px; }
.mk-row-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.mk-row-main strong, .mk-row-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-row-main .ico { vertical-align: -2px; }
.mk-row-stats { font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mk-status { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--chip); color: var(--muted); white-space: nowrap; text-transform: capitalize; }
.mk-status[data-status='sending'], .mk-status[data-status='scheduled'] { background: var(--warn-bg); color: var(--warn); }
.mk-status[data-status='sent'] { background: var(--green-tint); color: var(--green); }
.mk-status[data-status='paused'] { background: var(--danger-bg); color: var(--danger); }
.mk-ai-box textarea { margin-bottom: 10px; }
.mk-row-fields { display: grid; grid-template-columns: 180px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.mk-row-fields .btn { display: inline-flex; align-items: center; gap: 6px; }
.mk-ideas { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.mk-idea { text-align: left; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.mk-idea:hover { border-color: var(--green); }
.mk-form .field:last-child { margin-bottom: 0; }
.mk-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.mk-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.mk-form-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.mk-form-foot .btn { display: inline-flex; align-items: center; gap: 6px; }
.mk-form-foot input[type='datetime-local'], .mk input[type='datetime-local'] { width: auto; }
.mk input[type='datetime-local'], .mk input[type='color'], .mk-drawer input[type='color'] { font: inherit; color: var(--ink); background: var(--bg); border: 2px solid var(--line); border-radius: 8px; }
.mk input[type='datetime-local'] { padding: 7px 10px; }
.mk input[type='color'] { width: 44px; height: 36px; padding: 2px; cursor: pointer; }
.mk-content-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mk-content-row select { width: auto; max-width: 260px; }
.mk-content-row .btn { display: inline-flex; align-items: center; gap: 6px; }
.mk-seg-ctl { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; gap: 2px; margin-bottom: 8px; flex-wrap: wrap; }
.mk-seg-ctl label, .mk-seg-ctl button { margin: 0; padding: 5px 14px; border-radius: 999px; font: inherit; font-size: 14px; cursor: pointer; border: 0; background: none; color: var(--ink); font-weight: 500; }
.mk-seg-ctl label.on, .mk-seg-ctl button.on { background: var(--green-tint); color: var(--green); }
.mk-seg-ctl input { position: absolute; opacity: 0; pointer-events: none; }
.mk-picks { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mk-pick { margin: 0; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 14px; font-weight: 400; cursor: pointer; }
.mk-pick.on { border-color: var(--green); background: var(--green-tint); color: var(--green); }
.mk-pick input { position: absolute; opacity: 0; pointer-events: none; }
.mk-newtag { width: 140px !important; padding: 5px 10px !important; border-radius: 999px !important; font-size: 14px; }
.mk-exclude { margin-top: 8px; }
.mk-exclude summary { cursor: pointer; color: var(--muted); margin-bottom: 6px; }
.mk-aud-count { margin: 8px 0 0; }
.mk-check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 8px 0; cursor: pointer; }
.mk-check input { width: 18px; height: 18px; accent-color: var(--green); flex: none; }
.mk-tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--chip); margin: 1px 4px 1px 0; white-space: nowrap; }
.mk-steps { list-style: none; margin: 8px 0 12px; padding: 0; display: grid; gap: 10px; }
.mk-step { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; position: relative; }
.mk-step + .mk-step::before { content: ''; position: absolute; left: 22px; top: -11px; height: 10px; border-left: 2px dashed var(--line); }
.mk-step-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
/* templates */
.mk-templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.mk-tpl { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; background: var(--bg); }
.mk-tpl-open { border: 0; padding: 0; background: none; cursor: pointer; display: block; width: 100%; }
.mk-thumb { padding: 14px 18px 0; height: 150px; overflow: hidden; }
.mk-thumb > div { border-radius: 6px 6px 0 0; height: 100%; padding: 10px; display: flex; flex-direction: column; gap: 8px; align-items: stretch; text-align: left; overflow: hidden; }
.mk-thumb img { width: 100%; height: 70px; object-fit: cover; border-radius: 4px; }
.mk-thumb span { font-size: 13px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mk-thumb i { display: block; width: 70px; height: 16px; border-radius: 4px; margin: 0 auto; }
.mk-tpl-foot { display: flex; align-items: center; gap: 2px; padding: 10px 8px 10px 12px; border-top: 1px solid var(--line-soft); }
/* design editor */
.mk-ed-top .mk-name { flex: 1 1 200px; width: auto; min-width: 0; font-weight: 600; font-size: 17px; }
.mk-ed-title { font-size: 17px; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mk-meta { margin-bottom: 12px; gap: 8px 12px; }
.mk-pane-switch { display: none; margin: 0; }
.mk-ed { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 16px; align-items: start; }
.mk-ed-left { min-width: 0; }
.mk-ed-right { position: sticky; top: 84px; min-width: 0; }
.mk-style { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.mk-style select { width: auto; }
.mk-color { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; margin: 0; font-weight: 400; }
.mk-color span { color: var(--muted); font-size: 11px; }
.mk-blocks { list-style: none; margin: 0 0 10px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.mk-blocks li { display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 12px; border-bottom: 1px solid var(--line-soft); cursor: pointer; min-height: 44px; }
.mk-blocks li:last-child { border-bottom: 0; }
.mk-blocks li.sel { background: var(--green-tint); box-shadow: inset 3px 0 0 var(--green); }
.mk-blocks li.mk-block-empty { cursor: default; justify-content: center; }
.mk-block-type { font-weight: 600; font-size: 14px; white-space: nowrap; }
.mk-block-sum { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-block-tools { display: inline-flex; flex: none; }
.mk-blocks li:not(.sel) .mk-block-tools { opacity: 0.55; }
.mk-add-blocks { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.mk-add { font: inherit; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border: 1px dashed var(--line); border-radius: 999px; background: none; color: var(--ink); cursor: pointer; }
.mk-add:hover { border-color: var(--green); color: var(--green); }
.mk-block-form { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.mk-block-form .field { margin-bottom: 10px; }
.mk-block-form label { font-size: 13px; }
.mk-img-pick { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.mk-img-pick img { width: 90px; height: 60px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.mk-img-pick .btn { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.mk-rte { border: 2px solid var(--line); border-radius: 8px; margin-bottom: 10px; }
.mk-rte-bar { display: flex; align-items: center; gap: 2px; padding: 4px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.mk-rte-bar button { border: 0; background: none; color: var(--ink); font: inherit; width: 32px; height: 30px; border-radius: 6px; cursor: pointer; display: inline-grid; place-items: center; }
.mk-rte-bar button:hover { background: var(--chip); }
.mk-rte-bar span { margin-left: auto; padding-right: 6px; }
.mk-rte-body { min-height: 100px; padding: 10px 12px; outline: none; }
.mk-rte-body p { margin: 0 0 8px; }
.mk-social { display: grid; gap: 6px; margin-bottom: 10px; }
.mk-social-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.mk-device { display: flex; justify-content: flex-end; gap: 4px; margin-bottom: 6px; }
.mk-device .icon-btn { width: 34px; height: 34px; }
.mk-device .icon-btn.on { background: var(--green-tint); color: var(--green); }
.mk-frame-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #f4f4f4; transition: max-width 0.2s; margin: 0 auto; }
.mk-frame-wrap.phone { max-width: 390px; }
.mk-frame { display: block; width: 100%; height: calc(100vh - 190px); min-height: 480px; border: 0; background: #f4f4f4; }
/* contacts */
.mk-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.mk-filters select { width: auto; max-width: 180px; }
.mk-search { flex: 1 1 220px; margin: 0; position: relative; display: flex; align-items: center; }
.mk-search .ico { position: absolute; left: 12px; color: var(--muted); }
.mk-search input { padding-left: 36px; }
.mk-selbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 10px; border-radius: var(--radius); background: var(--green-tint); }
.mk-selbar select { width: auto; }
.mk-selbar .btn { display: inline-flex; align-items: center; gap: 6px; }
.mk-table-card { padding: 6px 12px; }
.mk-contacts > li { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(0, 0.8fr) auto; gap: 10px; }
.mk-contacts .mk-check { margin: 0; }
.mk-contacts-head { cursor: default; }
.mk-col-tags { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mk-pager { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 10px 0 4px; }
.mk-import-src { display: grid; gap: 14px; margin-bottom: 18px; }
.mk-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px; border: 2px dashed var(--line); border-radius: var(--radius); cursor: pointer; text-align: center; margin: 0; }
.mk-drop:hover { border-color: var(--green); }
.mk-map { display: grid; gap: 6px; margin-bottom: 14px; }
.mk-map-row { display: grid; grid-template-columns: minmax(0, 1fr) 160px; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.mk-map-row > div { display: flex; flex-direction: column; min-width: 0; }
.mk-map-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-conds { display: grid; gap: 6px; margin-bottom: 8px; }
.mk-cond { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mk-cond select, .mk-cond input { width: auto; flex: 1 1 120px; min-width: 0; }
.mk-tag-add { display: flex; gap: 8px; align-items: center; }
.mk-tag-add .btn { display: inline-flex; align-items: center; gap: 6px; }
.mk-tag-name { flex: 1; min-width: 0; border-color: transparent !important; padding: 6px 8px !important; }
.mk-tag-name:hover, .mk-tag-name:focus { border-color: var(--line) !important; }
.mk-copy { display: flex; gap: 8px; align-items: center; }
.mk-copy code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; padding: 8px 10px; background: var(--chip); border-radius: 8px; font-size: 12px; }
.mk-drawer h3 { font-size: 16px; margin: 18px 0 8px; }

@media (max-width: 1100px) {
  .mk-ed { grid-template-columns: minmax(0, 1fr); }
  .mk-pane-switch { display: inline-flex; }
  .mk-ed.pane-blocks .mk-ed-right { display: none; }
  .mk-ed.pane-preview .mk-ed-left { display: none; }
  .mk-ed-right { position: static; }
  .mk-frame { height: calc(100vh - 230px); }
}
@media (max-width: 760px) {
  .mk { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .mk-side { position: sticky; top: 0; z-index: 3; flex-direction: row; overflow-x: auto; gap: 4px; margin: -8px -16px 0; padding: 8px 16px; background: var(--page); scrollbar-width: none; }
  .mk-side::-webkit-scrollbar { display: none; }
  .mk-nav-group { display: none; }
  .mk-nav-link { flex: none; padding: 7px 12px; font-size: 14px; border: 1px solid var(--line); border-radius: 999px; }
  .mk-nav-link.active { border-color: var(--green); }
  .mk.editing .mk-side { display: none; }
  .mk-head h1 { font-size: 22px; }
  .mk-head-actions { margin-left: 0; width: 100%; }
  .mk-ed-top .mk-head-actions { width: auto; margin-left: auto; }
  .mk-card { padding: 14px; }
  .mk-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mk-tile strong { font-size: 20px; }
  .mk-grid2, .mk-grid3, .mk-row-fields { grid-template-columns: minmax(0, 1fr); }
  .mk-rows > li { flex-wrap: wrap; gap: 4px 10px; }
  .mk-rows > li .mk-row-main { flex-basis: calc(100% - 110px); }
  .mk-row-stats { width: 100%; white-space: normal; }
  .mk-contacts > li { grid-template-columns: 28px minmax(0, 1fr) auto; }
  .mk-contacts .mk-col-tags { display: none; }
  .mk-contacts > li .mk-row-main { flex-basis: auto; }
  .mk-filters select { flex: 1 1 calc(50% - 4px); max-width: none; }
  .mk-form-foot input[type='datetime-local'] { flex: 1 1 100%; }
  .mk-form-foot .btn { flex: 1 1 auto; justify-content: center; }
  .mk-templates { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .mk-thumb { height: 120px; padding: 10px 12px 0; }
  .mk-map-row { grid-template-columns: minmax(0, 1fr) 130px; }
  .mk-frame { height: calc(100vh - 200px); min-height: 420px; }
  .mk-blocks li { min-height: 48px; }
  .mk-block-tools .icon-btn { width: 32px; height: 32px; }
  .mk-content-row select { max-width: none; flex: 1 1 100%; }
}
/* inputs written without a type (Email Marketing's editors) look like every other text box */
.mk input:not([type]), .mk-drawer input:not([type]) {
  font: inherit; color: var(--ink); width: 100%; padding: 9px 12px; border: 2px solid var(--line); border-radius: 8px; background: var(--bg);
}
.mk input:not([type]):focus, .mk-drawer input:not([type]):focus { border-color: var(--ink); outline: none; }
@media (max-width: 760px) { .mk-main { padding-bottom: 88px; } }

/* Email Marketing: the live canvas (edit the email where it stands, drag blocks to move them) */
.mk-ed { grid-template-columns: 300px minmax(0, 1fr); }
.mk-ed.readonly { grid-template-columns: minmax(0, 1fr); }
.mk-ed .mk-ed-right { display: none; }
.mk-ed.pane-preview .mk-ed-canvas { display: none; }
.mk-ed.pane-preview .mk-ed-right { display: block; grid-column: 1 / -1; position: static; }
.mk-ed.pane-preview .mk-ed-left { display: none; }
.mk-ed-left { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; padding-right: 4px; }
.mk-palette { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.mk-palette .mk-add { cursor: grab; touch-action: none; user-select: none; }
.mk-insp-title { display: block; margin-bottom: 10px; }
.mk-ed-canvas { min-width: 0; }
.mk-canvas { border-radius: var(--radius); padding: 24px 12px; border: 1px solid var(--line); min-height: 320px; }
.mk-canvas-card { margin: 0 auto; border-radius: 8px; padding: 12px 0; line-height: 1.6; font-size: 16px; }
.mk-canvas-card a { color: var(--mk-accent); }
.mk-cb { position: relative; padding: 6px 28px; border: 2px solid transparent; border-radius: 6px; margin: 0 4px; }
.mk-cb:hover { border-color: color-mix(in srgb, var(--mk-accent, #108a00) 35%, transparent); }
.mk-cb.sel { border-color: var(--mk-accent, #108a00); }
.mk-cb.dragging { opacity: 0.35; }
.mk-cb-tools { display: none; position: absolute; left: -2px; right: -2px; bottom: 100%; align-items: center; gap: 2px; padding: 2px 4px; background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px 8px 0 0; z-index: 2; font-family: Montserrat, system-ui, sans-serif; font-size: 13px; }
.mk-cb.sel .mk-cb-tools { display: flex; }
.mk-cb-tools .icon-btn { width: 28px; height: 28px; }
.mk-cb-handle { cursor: grab; touch-action: none; display: inline-grid; place-items: center; width: 28px; height: 28px; color: var(--muted); border-radius: 6px; }
.mk-cb-handle:hover { background: var(--chip); }
.mk-cb-label { font-weight: 600; padding: 0 4px; white-space: nowrap; }
.mk-cb-fmt { display: inline-flex; gap: 1px; border-left: 1px solid var(--line-soft); padding-left: 4px; margin-left: 2px; }
.mk-cb-fmt button { border: 0; background: none; color: var(--ink); font: inherit; min-width: 26px; height: 26px; border-radius: 6px; cursor: pointer; display: inline-grid; place-items: center; font-size: 13px; }
.mk-cb-fmt button:hover { background: var(--chip); }
.mk-ce { outline: none; min-height: 1.2em; }
.mk-ce:empty::before { content: attr(data-placeholder); opacity: 0.4; }
.mk-ce:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--mk-accent, #108a00) 25%, transparent); border-radius: 4px; }
.mk-cb h1.mk-ce { margin: 4px 0; font-weight: 700; line-height: 1.25; }
.mk-ce-rich p { margin: 0 0 12px; }
.mk-ce-rich p:last-child { margin-bottom: 0; }
.mk-cb-media { text-align: center; }
.mk-cb-media.full { margin: 0 -28px; }
.mk-cb-pick { display: block; margin: 0; cursor: pointer; font-weight: 400; }
.mk-cb-img { display: block; width: 100%; height: auto; margin: 0 auto; border-radius: 2px; }
.mk-cb-noimg { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 140px; border: 2px dashed currentColor; opacity: 0.45; border-radius: 6px; padding: 12px; text-align: center; }
.mk-cb-noimg.small { min-height: 110px; }
[data-drop-img].over .mk-cb-noimg, [data-drop-img].over .mk-cb-img { outline: 3px solid var(--mk-accent, #108a00); opacity: 1; }
.mk-cb-btn { display: inline-block; padding: 12px 28px; border-radius: 6px; font-weight: 600; margin: 6px 0; }
.mk-cb-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.mk-cb-cols.rev > :first-child { order: 2; }
.mk-cb-hr { border: 0; border-top: 1px solid; margin: 8px 0; }
.mk-cb-spacer { background: repeating-linear-gradient(45deg, transparent 0 6px, color-mix(in srgb, currentColor 8%, transparent) 6px 12px); border-radius: 4px; }
.mk-cb-social { display: inline-block; margin: 4px; padding: 5px 12px; border: 1px solid var(--mk-accent); color: var(--mk-accent); border-radius: 999px; font-size: 14px; text-transform: capitalize; }
.mk-cb-footer { font-size: 12px; opacity: 0.6; }
.mk-cb[data-type='raw'] { padding: 6px 0; }
.mk-raw { display: block; width: 100%; border: 0; min-height: 80px; background: #fff; }
.mk-cb-empty { text-align: center; padding: 60px 16px; opacity: 0.5; border: 2px dashed currentColor; border-radius: 8px; margin: 12px; }
.mk-dropline { height: 4px; border-radius: 2px; background: var(--mk-accent, #108a00); margin: 2px 28px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--mk-accent, #108a00) 25%, transparent); }
.mk-ghost { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; padding: 6px 12px; border-radius: 999px; background: var(--green); color: var(--on-green); font-size: 13px; font-weight: 600; box-shadow: 0 6px 18px var(--shadow); }
body.mk-dragging, body.mk-dragging * { cursor: grabbing !important; user-select: none !important; }
.mk-inspector .mk-block-form { border: 1px solid var(--line); }
@media (max-width: 1100px) { .mk-ed { grid-template-columns: 260px minmax(0, 1fr); } .mk-ed .mk-ed-right { display: none; } .mk-ed.pane-preview .mk-ed-right { display: block; } }
@media (max-width: 760px) {
  .mk-ed, .mk-ed.readonly { grid-template-columns: minmax(0, 1fr); }
  .mk-ed-left { position: sticky; top: 0; z-index: 4; max-height: none; overflow: visible; background: var(--page); padding: 6px 0; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .mk-palette { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-bottom: 6px; }
  .mk-palette::-webkit-scrollbar { display: none; }
  .mk-palette .mk-add { flex: none; padding: 7px 12px; }
  .mk-ed-left .mk-style { flex-wrap: nowrap; overflow-x: auto; margin-bottom: 0; }
  .mk-ed-left .mk-color span { display: none; }
  .mk-canvas { padding: 16px 0; margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; }
  .mk-cb { padding: 6px 14px; }
  .mk-cb-media.full { margin: 0 -14px; }
  .mk-cb-cols { grid-template-columns: 1fr; }
  .mk-canvas .mk-inspector { margin: 6px 4px 14px; font-family: Montserrat, system-ui, sans-serif; font-size: 15px; color: var(--ink); }
  .mk-canvas .mk-inspector .mk-block-form { background: var(--bg); }
  .mk-cb-tools { overflow-x: auto; scrollbar-width: none; }
  .mk-cb-tools .icon-btn, .mk-cb-handle { width: 34px; height: 34px; flex: none; }
  .mk-cb-fmt button { min-width: 32px; height: 32px; }
}
.mk-sample { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 14px; border-radius: var(--radius); background: var(--green-tint); }
.mk-sample .btn { display: inline-flex; align-items: center; gap: 6px; }
.mk-cb[data-type='raw'] { margin: 0; border-radius: 0; }
.mk-inspector .mk-grid3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 760px) { .mk-ed-left { top: 57px; } }

/* Settings: one group at a time, one column (nothing jumps between columns when a part opens) */
.settings { max-width: 1040px; }
.settings-grid { column-count: 1 !important; display: grid; gap: 12px; }
.settings-grid > details { margin: 0 !important; }
.settings-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; }
.settings-tabs .pill { padding: 6px 16px; font-size: 15px; }
.settings[data-group] details[data-g] { display: none; }
.settings[data-group='ai'] details[data-g='ai'], .settings[data-group='team'] details[data-g='team'],
.settings[data-group='upwork'] details[data-g='upwork'], .settings[data-group='marketing'] details[data-g='marketing'],
.settings[data-group='data'] details[data-g='data'] { display: block; }
.settings-wide { display: grid; gap: 12px; margin-top: 12px; }
.settings-wide > details { margin: 0 !important; }
@media (max-width: 760px) {
  .settings-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -16px; margin-right: -16px; padding: 0 16px; }
  .settings-tabs::-webkit-scrollbar { display: none; }
  .settings-tabs .pill { flex: none; }
}

/* proposal writer picker (GPT / Claude / GPT + Claude) */
.writer-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 12px; }
.writer-row #ai-status:empty { display: none; }
.writer-select { width: auto; max-width: 100%; min-width: 0; padding: 6px 30px 6px 10px; font-size: 13px; border-radius: 999px; background-color: var(--bg); color: var(--ink); border: 1px solid var(--line); }
@media (max-width: 480px) { .writer-select { flex: 1 1 100%; } }
