/* Deal Desk — iOS-style interface.
   Phone: bottom tab bar, large titles, inset grouped lists and forms, page
   sheets. Wider than 760px: an iPadOS-style sidebar with the same controls.
   Colours follow Apple's system palette in light and dark. */

:root {
  color-scheme: light;
  --bg: #f2f2f7;
  --card: #ffffff;
  --card2: #f2f2f7;
  --seg-on: #ffffff;
  --label: #000000;
  --label2: rgba(60, 60, 67, .6);
  --label3: rgba(60, 60, 67, .3);
  --sep: rgba(60, 60, 67, .29);
  --fill: rgba(120, 120, 128, .2);
  --fill2: rgba(120, 120, 128, .16);
  --fill3: rgba(120, 120, 128, .12);
  --blue: #007aff;
  --red: #ff3b30;
  --red-ink: #d70015;
  --orange: #ff9500;
  --orange-ink: #b25e00;
  --green: #34c759;
  --green-ink: #1f8f43;
  --gray: #8e8e93;
  --blue-tint: rgba(0, 122, 255, .13);
  --red-tint: rgba(255, 59, 48, .13);
  --orange-tint: rgba(255, 149, 0, .16);
  --green-tint: rgba(52, 199, 89, .16);
  --bar: rgba(249, 249, 249, .84);
  --bar-line: rgba(0, 0, 0, .14);
  --sheet: rgba(249, 249, 249, .94);
  --toast: rgba(28, 28, 30, .94);
  --claude: #d97757;
  --claude-fill: #b8532f;
  --claude-edge: #9c4526;
  --claude-on-fill: #ffffff;
  --shadow: 0 12px 44px rgba(0, 0, 0, .22);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --r: 10px;
  --r-lg: 14px;
  --tabbar: 50px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000; --card: #1c1c1e; --card2: #2c2c2e; --seg-on: #636366;
    --label: #ffffff; --label2: rgba(235, 235, 245, .6); --label3: rgba(235, 235, 245, .3);
    --sep: rgba(84, 84, 88, .6); --fill: rgba(120, 120, 128, .36); --fill2: rgba(120, 120, 128, .32); --fill3: rgba(120, 120, 128, .24);
    --blue: #0a84ff; --red: #ff453a; --red-ink: #ff453a; --orange: #ff9f0a; --orange-ink: #ff9f0a;
    --green: #30d158; --green-ink: #30d158; --gray: #8e8e93;
    --blue-tint: rgba(10, 132, 255, .2); --red-tint: rgba(255, 69, 58, .2); --orange-tint: rgba(255, 159, 10, .2); --green-tint: rgba(48, 209, 88, .2);
    --bar: rgba(29, 29, 31, .86); --bar-line: rgba(255, 255, 255, .15); --sheet: rgba(37, 37, 39, .94); --toast: rgba(58, 58, 60, .96);
    --claude: #e08b6b; --claude-fill: #e08b6b; --claude-edge: #f0ad92; --claude-on-fill: #241812;
    --shadow: 0 12px 44px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000; --card: #1c1c1e; --card2: #2c2c2e; --seg-on: #636366;
  --label: #ffffff; --label2: rgba(235, 235, 245, .6); --label3: rgba(235, 235, 245, .3);
  --sep: rgba(84, 84, 88, .6); --fill: rgba(120, 120, 128, .36); --fill2: rgba(120, 120, 128, .32); --fill3: rgba(120, 120, 128, .24);
  --blue: #0a84ff; --red: #ff453a; --red-ink: #ff453a; --orange: #ff9f0a; --orange-ink: #ff9f0a;
  --green: #30d158; --green-ink: #30d158; --gray: #8e8e93;
  --blue-tint: rgba(10, 132, 255, .2); --red-tint: rgba(255, 69, 58, .2); --orange-tint: rgba(255, 159, 10, .2); --green-tint: rgba(48, 209, 88, .2);
  --bar: rgba(29, 29, 31, .86); --bar-line: rgba(255, 255, 255, .15); --sheet: rgba(37, 37, 39, .94); --toast: rgba(58, 58, 60, .96);
  --claude: #e08b6b; --claude-fill: #e08b6b; --claude-edge: #f0ad92; --claude-on-fill: #241812;
  --shadow: 0 12px 44px rgba(0, 0, 0, .6);
}

/* ------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font: 16px/1.35 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted, .hint { color: var(--label2); }
.hint { font-size: 13px; }
.strike { text-decoration: line-through; }
.warn-text { color: var(--orange-ink); }
.pad { padding: 12px 0 0; }
.pad-top { margin: 8px 0 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ------------------------------------------------------------ frame */
.app { display: flex; min-height: 100%; }
.content { flex: 1; min-width: 0; padding: 0 16px calc(var(--tabbar) + 28px + env(safe-area-inset-bottom, 0px)); }

.navbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; margin: 0 -16px; padding: env(safe-area-inset-top, 0px) 16px 0;
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--bar-line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 16px; height: 19px; background: var(--blue); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 74%, 0 100%); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-co { font: 600 10px/1.2 var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--label2); }
.brand-name { font: 600 17px/1.1 var(--font); letter-spacing: -.01em; }
.brand-compact .brand-name { font-size: 17px; }
.account { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--blue); color: #fff; font: 600 13px var(--font); display: grid; place-items: center;
}
.avatar:active { opacity: .7; }
.pill { font: 600 12px/1 var(--font); padding: 5px 9px; border-radius: 999px; background: var(--orange-tint); color: var(--orange-ink); }

/* sidebar / tab bar */
.side .brand { display: none; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px)); padding: 0 4px env(safe-area-inset-bottom, 0px);
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--bar-line);
}
.tab {
  position: relative; flex: 1 1 0; border: 0; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 4px 2px 3px; color: var(--gray); min-width: 0;
}
.tab:active { opacity: .6; }
.tab-icon { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tab-label { font: 500 10px/1 var(--font); letter-spacing: .01em; white-space: nowrap; }
.tab[aria-current="page"] { color: var(--blue); }
.tab .count {
  position: absolute; top: 3px; left: calc(50% + 6px);
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px;
  background: var(--red); color: #fff; font: 600 11px/17px var(--font); text-align: center;
  border: 1.5px solid var(--bar);
}

/* notice */
.notice {
  margin: 14px 0 0; padding: 11px 14px; border-radius: var(--r-lg);
  background: var(--orange-tint); color: var(--label); font-size: 15px;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.notice.error { background: var(--red-tint); }
.notice.inline { margin: 0; }

/* ------------------------------------------------------------ buttons */
.btn {
  border: 0; background: var(--fill2); color: var(--blue);
  padding: 7px 14px; min-height: 36px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
  transition: opacity .12s ease, transform .12s ease; text-decoration: none;
}
.btn:active { opacity: .7; transform: scale(.98); }
.btn.primary { background: var(--blue); color: #fff; }
.btn.ghost { background: transparent; padding-inline: 8px; }
.btn.danger { color: var(--red); }
.btn.danger.armed, .btn.ghost.armed { background: var(--red); color: #fff; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.claude { background: var(--claude-fill); color: var(--claude-on-fill); }
.btn.claude:focus-visible { outline-color: var(--claude); }
.linklike { border: 0; background: none; padding: 0; color: var(--blue); cursor: pointer; font: inherit; text-align: left; }
.linklike:active { opacity: .6; }
a { color: var(--blue); }

/* ------------------------------------------------------------ inputs */
.input {
  width: 100%; border: 0; background: var(--fill2); border-radius: 10px;
  padding: 8px 12px; min-height: 36px; color: var(--label); font-size: 15px;
}
.input::placeholder { color: var(--label3); }
.input:focus { outline: none; box-shadow: 0 0 0 3px var(--blue-tint); }
textarea.input { resize: vertical; min-height: 80px; line-height: 1.4; }
select.input {
  -webkit-appearance: none; appearance: none; padding-right: 26px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='16' viewBox='0 0 12 16'%3E%3Cpath d='M2 6l4-4 4 4M2 10l4 4 4-4' fill='none' stroke='%238e8e93' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 11px 15px;
}
.input.search {
  background-color: var(--fill2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='6.8' cy='6.8' r='4.6' fill='none' stroke='%238e8e93' stroke-width='1.7'/%3E%3Cpath d='M10.3 10.3L14 14' stroke='%238e8e93' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 10px center; background-size: 16px; padding-left: 32px;
}
.input.slim { width: auto; min-height: 30px; padding: 3px 8px; font-size: 13px; max-width: 190px; }
select.input.slim { padding-right: 22px; background-position: right 6px center; }
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }

/* grouped form rows: label left, value right, hairline between rows */
.field { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 5px 16px; min-width: 0; }
.field > span { flex: 0 1 auto; max-width: 48%; font-size: 15px; color: var(--label); line-height: 1.25; }
.field .input {
  flex: 1 1 auto; min-width: 0; width: auto; text-align: right; background-color: transparent; border-radius: 0;
  padding: 4px 0; min-height: 32px;
}
.field .input:focus { box-shadow: none; }
.field select.input { text-align: right; text-align-last: right; padding-right: 20px; background-position: right center; }
.field:has(textarea) { flex-direction: column; align-items: stretch; padding: 10px 16px; }
.field:has(textarea) > span { max-width: none; font-size: 13px; color: var(--label2); }
.field textarea.input { text-align: left; min-height: 76px; }
.field::after { content: ""; position: absolute; left: 16px; right: 0; bottom: 0; height: .5px; background: var(--sep); }
.field:last-child::after, .wide:last-child > .field::after { display: none; }

.form-grid, .grid-7, .log-form, .inline-form, .dates {
  display: grid; grid-template-columns: 1fr; gap: 0;
  background: var(--card); border-radius: var(--r); overflow: hidden;
}
.form-grid .wide, .log-form .wide { grid-column: 1 / -1; }
.log-form .wide > .field:last-child::after { display: block; }
.log-form .wide:last-of-type > .field::after, .log-form > .field:last-of-type::after { display: none; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-actions .spacer { flex: 1; }
.log-form .form-actions, .inline-form > .btn, .grid-7 + .form-grid { margin: 0; }
.log-form .form-actions { padding: 10px 16px 12px; }
.inline-form > .btn { margin: 8px 16px 12px; justify-self: start; }
.pad > .field { background: var(--card); border-radius: var(--r); }
.pad > .field::after { display: none; }

/* rating selects (feasibility) */
select.rating { font-weight: 600; }
select.r-pass { color: var(--green-ink); }
select.r-concern { color: var(--orange-ink); }
select.r-fail { color: var(--red-ink); }

/* checks: a round check in lists, a switch on a form row */
.check {
  -webkit-appearance: none; appearance: none; flex: none; cursor: pointer; margin: 0;
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--label3); position: relative; background: transparent;
}
.check:checked { background: var(--blue); border-color: var(--blue); }
.check:checked::after { content: ""; position: absolute; left: 7px; top: 3px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.checkline > span { order: -1; flex: 1; max-width: none; text-align: left; }
.checkline:not(.tight) .check { width: 51px; height: 31px; border-radius: 31px; border: 0; background: var(--fill); transition: background .2s ease; margin-left: auto; }
.checkline:not(.tight) .check::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 50%; border: 0; transform: none;
  background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 1px 1px rgba(0, 0, 0, .16); transition: transform .2s ease;
}
.checkline:not(.tight) .check:checked { background: var(--green); }
.checkline:not(.tight) .check:checked::after { transform: translateX(20px); }
.checkline.tight { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--label2); }
.checkline.tight > span { order: 1; flex: none; }
.checkline.tight .check { width: 18px; height: 18px; }
.checkline.tight .check:checked::after { left: 5px; top: 2px; width: 4px; height: 8px; }

/* ------------------------------------------------------------ titles + toolbar */
.main { margin-top: 6px; }
.toolbar { display: flex; gap: 10px 12px; align-items: center; flex-wrap: wrap; margin: 12px 0 12px; }
.toolbar h2 { flex: 1 1 100%; margin: 0; font: 700 34px/1.15 var(--font); letter-spacing: -.02em; }
.toolbar .muted { display: none; }
.toolbar .input { width: auto; }
.toolbar .search { flex: 1 1 200px; }
.loading, .empty { color: var(--label2); padding: 24px 0; }

.section-title, .panel-head, .group-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  margin: 0; padding: 0 16px 7px; font: 500 13px/1.2 var(--font); letter-spacing: .01em; text-transform: uppercase; color: var(--label2);
}
.panel-head h3 { margin: 0; font: inherit; }
.panel-head .hint, .section-title .hint { text-transform: none; letter-spacing: 0; }
.panel { background: transparent; border: 0; }
.panel + .panel, .panel + .sub-panel { margin-top: 26px; }
.split > div > .panel + .panel { margin-top: 26px; }

/* segmented control */
.seg { display: inline-flex; background: var(--fill2); border-radius: 9px; padding: 2px; gap: 2px; }
.seg-btn { border: 0; background: transparent; color: var(--label); font: 500 13px var(--font); padding: 5px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.seg-btn[aria-current="true"] { background: var(--seg-on); box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04); font-weight: 600; }
.seg.wide-seg { display: flex; }
.seg.wide-seg .seg-btn { flex: 1; }

/* ------------------------------------------------------------ summary widgets */
.summary {
  display: flex; gap: 10px; margin: 4px -16px 6px; padding: 2px 16px 10px; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.summary::-webkit-scrollbar { display: none; }
.stat {
  flex: 0 0 156px; scroll-snap-align: start; background: var(--card); border-radius: var(--r-lg); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px; border: 0; text-align: left; color: inherit; min-height: 96px;
}
button.stat { cursor: pointer; }
button.stat:active { opacity: .7; }
.stat-label { font: 600 12px/1.2 var(--font); text-transform: uppercase; letter-spacing: .02em; color: var(--label2); }
.stat-value { font: 700 28px/1.15 var(--font); letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.stat-sub { font-size: 12px; color: var(--label2); line-height: 1.25; margin-top: auto; }
.stat.alert .stat-value { color: var(--red-ink); }

/* ------------------------------------------------------------ inset grouped lists */
.list, .rows { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: var(--r); overflow: hidden; }
.list > li, .rows > li { position: relative; }
.list > li { padding: 11px 16px; display: flex; gap: 12px; align-items: flex-start; }
.list > li + li::before, .rows > li + li::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--sep); }
.list .empty { padding: 14px 16px; }
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item-main > strong { font-weight: 600; }
.item-body { overflow-wrap: anywhere; white-space: pre-wrap; font-size: 15px; }
.item-meta { font-size: 13px; color: var(--label2); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.item.done .item-body { text-decoration: line-through; color: var(--label2); }
.kind { font: 600 11px var(--font); letter-spacing: .04em; text-transform: uppercase; color: var(--label2); }
.list .btn.ghost { align-self: center; color: var(--label3); font-size: 20px; line-height: 1; min-height: 32px; }
.list .btn.ghost.armed { font-size: 13px; }
.datecell { flex: none; width: 52px; text-align: center; border-radius: 10px; background: var(--fill3); padding: 5px 0; }
.datecell b { display: block; font: 600 20px/1.1 var(--font); font-variant-numeric: tabular-nums; }
.datecell span { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--label2); }
.datecell.urgent { background: var(--red-tint); }
.datecell.urgent b { color: var(--red-ink); }
.datecell.soon { background: var(--orange-tint); }
.total-row { background: var(--fill3); }
.split-pct { flex: none; width: 60px; text-align: right; }
.split-pct b { font: 600 17px var(--font); font-variant-numeric: tabular-nums; }
.split-pct b.ok { color: var(--green-ink); }
.split-pct b.warn { color: var(--red-ink); }
.dissent { border-left: 3px solid var(--red); padding-left: 8px; }
.box { border: 0; }

/* tappable rows (phone pipeline + contacts) */
.group { margin-top: 20px; }
.row {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 54px;
  border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer;
}
.row:active { background: var(--fill3); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-size: 16px; font-weight: 500; line-height: 1.25; }
.row-sub { font-size: 13px; color: var(--label2); line-height: 1.3; }
.row-trail { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 13px; color: var(--label2); }
.chev { flex: none; width: 8px; height: 8px; border-right: 2px solid var(--label3); border-bottom: 2px solid var(--label3); transform: rotate(-45deg); margin-left: 2px; }

/* chips + due */
.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--fill2); color: var(--label2); white-space: nowrap; }
.chip.blue { background: var(--blue-tint); color: var(--blue); }
.chip.warn { background: var(--orange-tint); color: var(--orange-ink); }
.chip.ok { background: var(--green-tint); color: var(--green-ink); }
.chip.bad { background: var(--red-tint); color: var(--red-ink); }
.due { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--fill2); color: var(--label2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.due.soon { background: var(--orange-tint); color: var(--orange-ink); }
.due.urgent { background: var(--red-tint); color: var(--red-ink); }
.due.past { background: var(--red); color: #fff; }

/* ------------------------------------------------------------ pipeline board (wide screens) */
/* every stage stays on the page: columns wrap into as many rows as the width needs */
.board-wrap { padding-bottom: 8px; }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 10px; align-items: start; }
.col { background: var(--fill3); border-radius: var(--r-lg); padding: 10px; display: flex; flex-direction: column; gap: 8px; border: 1.5px dashed transparent; min-height: 108px; }
.col.drop { border-color: var(--blue); background: var(--blue-tint); }
.col.muted-col { opacity: .8; }
.col-head { display: flex; flex-direction: column; gap: 6px; padding: 2px 4px 6px; }
.col-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.col-name { font: 600 13px var(--font); }
.col-count { font-size: 12px; color: var(--label2); }
.col-total { font-size: 13px; color: var(--label2); font-variant-numeric: tabular-nums; }
.ladder { display: flex; gap: 2px; }
.ladder i { flex: 1; height: 3px; border-radius: 2px; background: var(--fill); }
.ladder i.on { background: var(--blue); }
.ladder.dead i.on { background: var(--gray); }
.card {
  background: var(--card); border: 0; border-radius: 12px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px; cursor: pointer; text-align: left; width: 100%; color: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06); transition: transform .12s ease;
}
.card:active { transform: scale(.98); }
.card.dragging { opacity: .45; }
.card-name { font-weight: 600; line-height: 1.25; font-size: 15px; }
.card-addr { font-size: 13px; color: var(--label2); line-height: 1.3; }
.card-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-price { font: 600 15px var(--font); font-variant-numeric: tabular-nums; }

/* tables (wide screens) */
.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--r); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th { text-align: left; font: 500 13px var(--font); color: var(--label2); padding: 10px 16px; border-bottom: .5px solid var(--sep); white-space: nowrap; }
td { padding: 11px 16px; border-bottom: .5px solid var(--sep); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; }
tbody tr:active td { background: var(--fill3); }
.sub { display: block; font-size: 13px; color: var(--label2); }

.split { display: grid; grid-template-columns: 1fr; gap: 26px; align-items: start; }
.grid-7 { margin-bottom: 12px; }
.sections { display: grid; grid-template-columns: 1fr; gap: 26px; align-items: start; }
.sections > div { min-width: 0; }

/* documents */
.dropzone {
  margin-top: 10px; border: 1.5px dashed var(--label3); border-radius: 12px; padding: 18px 14px;
  display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center;
  cursor: pointer; background: var(--fill3); color: var(--label2);
}
.dropzone:active, .dropzone.over { border-color: var(--blue); background: var(--blue-tint); color: var(--label); }
.dropzone.busy { opacity: .6; pointer-events: none; }
.dropzone strong { font: 600 15px var(--font); color: var(--blue); }
.pad > .dropzone + .visually-hidden + .log-form, .pad > .log-form { margin-top: 12px; }

/* proposal inbox */
.payload { margin-top: 6px; display: grid; gap: 2px; }
.kv { display: flex; gap: 8px; font-size: 13px; }
.kv-k { color: var(--label2); min-width: 100px; flex: none; }
.list .form-actions { align-self: center; flex-direction: column; align-items: stretch; }
.list .form-actions .btn { min-width: 84px; }

/* connect-claude steps */
.steps { list-style: none; margin: 18px 0; padding: 0; display: grid; gap: 18px; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step-n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; font: 600 13px var(--font); display: grid; place-items: center; }
.cmd { margin: 8px 0; padding: 10px 12px; background: var(--fill3); border-radius: 10px; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ------------------------------------------------------------ sheet (deal / contact view) */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 20; }
.drawer {
  position: fixed; z-index: 21; left: 0; right: 0; bottom: 0; top: max(20px, env(safe-area-inset-top, 0px));
  background: var(--bg); border-radius: 12px 12px 0 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom, 0px); box-shadow: var(--shadow);
}
.drawer-head {
  position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  min-height: 52px; padding: 0 8px; background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--bar-line); border-radius: 12px 12px 0 0;
}
.drawer-head .btn { grid-column: 1; justify-self: start; font-weight: 500; font-size: 17px; }
.drawer-head h2 { grid-column: 2; margin: 0; font: 600 17px/1.2 var(--font); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 62vw; }
.drawer-body { padding: 16px 16px 40px; display: flex; flex-direction: column; gap: 24px; }
.drawer-body > .form-actions .btn.primary { flex: 1 1 100%; min-height: 50px; font-size: 17px; border-radius: 12px; }
.drawer-body > p.muted { margin: 0; padding: 0 4px; font-size: 15px; }
.drawer-body > div > .box { margin-bottom: 0; }
.drawer-body > .field:has(textarea) { background: var(--card); border-radius: var(--r); }
.drawer-body > .field::after { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .drawer:not([hidden]) { animation: sheet-up .38s cubic-bezier(.32, .72, 0, 1); }
  @keyframes sheet-up { from { transform: translateY(100%); } }
  .scrim:not([hidden]) { animation: fade .25s ease-out; }
  @keyframes fade { from { opacity: 0; } }
}

/* action sheet */
.action-sheet { position: fixed; z-index: 25; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; }
.sheet-group { background: var(--sheet); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-radius: 14px; overflow: hidden; }
.sheet-title { padding: 13px 16px; text-align: center; font-size: 13px; font-weight: 600; color: var(--label2); border-bottom: .5px solid var(--sep); overflow-wrap: anywhere; }
.sheet-btn { display: block; width: 100%; border: 0; background: transparent; padding: 0 16px; min-height: 57px; font-size: 20px; color: var(--blue); cursor: pointer; }
.sheet-btn + .sheet-btn { border-top: .5px solid var(--sep); }
.sheet-btn:active { background: var(--fill3); }
.sheet-btn.cancel { font-weight: 600; background: var(--card); }
.sheet-btn.danger { color: var(--red); }
.sheet-btn.claude { color: var(--claude-fill); font-weight: 600; }
@media (prefers-reduced-motion: no-preference) {
  .action-sheet:not([hidden]) { animation: sheet-up .3s cubic-bezier(.32, .72, 0, 1); }
}

/* sign-in */
.gate { max-width: 420px; margin: 6vh auto 0; display: flex; flex-direction: column; gap: 14px; }
.gate h1 { margin: 0; font: 700 34px/1.15 var(--font); letter-spacing: -.02em; }
.gate p { margin: 0; color: var(--label2); }
.gate .or { text-align: center; font-size: 13px; color: var(--label2); }
.gate .form-actions .btn.primary { flex: 1; min-height: 50px; font-size: 17px; border-radius: 12px; }
.gate > .btn { min-height: 50px; font-size: 17px; border-radius: 12px; }
.gate form { display: flex; flex-direction: column; gap: 14px; }

/* toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 30;
  bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom, 0px));
  background: var(--toast); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 15px;
  max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0, 0, 0, .2);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
}
.toast.error { background: var(--red); }

/* ------------------------------------------------------------ wide screens: sidebar layout */
@media (min-width: 760px) {
  .content { padding: 0 28px 48px; }
  .navbar { margin: 0 -28px; padding-inline: 28px; }
  .navbar .brand-compact { display: none; }
  .side {
    flex: none; width: 232px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
    padding: 18px 12px; border-right: .5px solid var(--sep); background: var(--bg);
  }
  .side .brand { display: flex; padding: 4px 10px 18px; }
  .brand-mark { width: 20px; height: 24px; }
  .tabs {
    position: static; display: flex; flex-direction: column; gap: 2px; height: auto; padding: 0;
    background: transparent; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .tab { flex: none; flex-direction: row; justify-content: flex-start; gap: 10px; padding: 7px 10px; border-radius: 9px; color: var(--label); }
  .tab:hover { background: var(--fill3); }
  .tab-icon { width: 22px; height: 22px; color: var(--blue); }
  .tab-label { font-size: 15px; font-weight: 500; }
  .tab[aria-current="page"] { background: var(--blue); color: #fff; }
  .tab[aria-current="page"] .tab-icon { color: #fff; }
  .tab .count { position: static; margin-left: auto; border: 0; }
  .tab[aria-current="page"] .count { background: #fff; color: var(--blue); }

  .toolbar { margin: 18px 0 14px; }
  .toolbar h2 { flex: 1 1 auto; font-size: 28px; }
  .toolbar .muted { display: inline; font-size: 13px; }
  .summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: visible; margin: 8px 0 8px; padding: 0; }
  .stat { flex: auto; min-height: 0; }
  .split { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .sections { grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 26px 28px; }
  .list .form-actions { flex-direction: row; }
  .row { min-height: 50px; }
  .row:hover { background: var(--fill3); }
  tbody tr:hover td { background: var(--fill3); }
  .card:hover { box-shadow: 0 0 0 1.5px var(--blue); }
  .btn:hover { filter: brightness(.96); }

  /* two-column grouped forms with a hairline down the middle */
  .form-grid, .grid-7, .log-form, .dates {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    background: linear-gradient(var(--sep), var(--sep)) 50% 0 / 1px 100% no-repeat var(--card);
  }
  .form-grid .wide, .log-form .wide, .grid-7 .wide { background: var(--card); }
  .form-grid > .field:nth-last-child(2):not(.wide):has(+ .field:not(.wide))::after { display: none; }
  .drawer-body > .form-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--card); }
  .drawer-body > .form-grid .wide { grid-column: span 2; }
  .drawer-body > .form-grid > .field { box-shadow: inset -1px 0 0 var(--sep); }
  .drawer-body > .form-grid > .field:nth-child(4n+1), .drawer-body > .form-grid > .field.wide:nth-child(4n+3) { box-shadow: none; }
  .inline-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: center; }
  .inline-form > .field:nth-child(2)::after, .inline-form > .field:first-child::after { display: none; }
  .inline-form > .field + .field { box-shadow: inset 1px 0 0 var(--sep); }

  .drawer {
    top: 28px; bottom: 28px; left: 50%; right: auto; transform: translateX(-50%);
    width: min(1180px, calc(100% - 48px)); border-radius: 14px;
  }
  .drawer-head { border-radius: 14px 14px 0 0; padding: 0 12px; }
  .drawer-head h2 { max-width: 60ch; }
  .drawer-body { padding: 20px 24px 40px; }
  .drawer-body > .form-actions .btn.primary { flex: none; min-height: 40px; font-size: 15px; border-radius: 10px; }
  @media (prefers-reduced-motion: no-preference) {
    .drawer:not([hidden]) { animation: sheet-in .25s ease-out; }
    @keyframes sheet-in { from { opacity: 0; transform: translateX(-50%) translateY(16px); } }
  }
  .action-sheet { left: auto; right: 28px; bottom: auto; top: 56px; width: 300px; }
  .action-sheet .sheet-group { box-shadow: var(--shadow); }
  .sheet-btn { min-height: 46px; font-size: 16px; text-align: left; }
  .sheet-btn.cancel { display: none; }
  .toast { bottom: 24px; }
  .content { padding-bottom: 48px; }
}

@media (min-width: 1100px) {
  .content { padding-inline: 36px; }
  .navbar { margin: 0 -36px; padding-inline: 36px; }
}

/* pipeline switch sits above the list / board */
.main .seg { margin-bottom: 4px; }
.group-head .hint { text-transform: none; }
@media (min-width: 760px) {
  .seg.wide-seg { display: inline-flex; }
  .seg.wide-seg .seg-btn { flex: none; }
  .main .seg { margin-bottom: 12px; }
}

/* title row: primary action sits at the right of the large title */
.toolbar { justify-content: space-between; }
.toolbar h2 { flex: 1 1 auto; }
.toolbar .btn.primary { margin-left: auto; }
.navbar .btn { min-height: 32px; padding: 5px 12px; font-size: 14px; }

/* a field on its own (not inside a grouped container) gets its own card */
form > .field, .box.pad > form > .field { background: var(--card); border-radius: var(--r); margin-top: 10px; }
form > .field::after { display: none; }
.form-actions { margin-top: 6px; }
.log-form .form-actions, .inline-form > .btn { margin-top: 0; }
.section-title .hint, .panel-head .hint { text-align: right; flex: 0 1 auto; }

/* inside a half-width section the request-approval / add-party form stacks */
@media (min-width: 760px) {
  .sections .inline-form { grid-template-columns: 1fr; }
  .sections .inline-form > .field + .field { box-shadow: none; }
  .sections .inline-form > .field:first-child::after { display: block; }
  .sections .inline-form > .field:nth-child(2)::after { display: none; }
}

/* a one-line explanation under a form-row label (feasibility criteria) */
.field-hint { display: block; font-size: 12px; line-height: 1.25; color: var(--label2); margin-top: 1px; }
.grid-7 .field > span { max-width: 58%; }

/* criteria grid: one column unless the section is wide enough for two */
.sections > div, .box.pad { container-type: inline-size; }
.grid-7 { grid-template-columns: 1fr; background: var(--card); }
.grid-7 .field > span { flex: 1 1 auto; max-width: none; }
.grid-7 .field .input { flex: 0 0 auto; min-width: 108px; }
@container (min-width: 620px) {
  .grid-7 { grid-template-columns: repeat(2, minmax(0, 1fr)); background: linear-gradient(var(--sep), var(--sep)) 50% 0 / 1px 100% no-repeat var(--card); }
}

/* section shortcuts under the sheet title */
#dw-jump { position: sticky; top: 52px; z-index: 1; background: var(--bg); }
.jumpbar { display: flex; gap: 6px; padding: 8px 16px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.jumpbar::-webkit-scrollbar { display: none; }
.jump {
  flex: none; border: 0; background: var(--fill2); color: var(--label); border-radius: 999px; padding: 5px 11px;
  font: 500 13px var(--font); display: inline-flex; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap;
}
.jump.has { background: var(--blue-tint); color: var(--blue); }
.jump:active { opacity: .7; }
.jump-n { font-weight: 600; font-variant-numeric: tabular-nums; }
.sections > div, .drawer-body > div { scroll-margin-top: 100px; }
@media (min-width: 760px) { .jumpbar { padding-inline: 24px; } }
