/* Workspace UI. Loads after style.css, which carries the brand tokens and the landing page.
   Everything here is scoped to the workspace, the connect dialog, and the small
   server-rendered pages (invite, OAuth consent, setup errors). */
:root {
  --ink: #14252b;
  --muted: #4d626a;
  --accent: #176f84;
  --brand: #50adc3;
  --deep: #12313a;
  --line: #dfe8e9;
  --line-strong: #c9d8da;
  --paper: #f5f8f8;
  --tint: #eef4f5;
  --ok: #1f7a5c;
  --danger: #8e3330;
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --r-card: 14px;
  --r-control: 10px;
  --ring: 0 0 0 3px rgb(23 111 132 / .16);
}
[hidden] { display: none !important; }
body { background: var(--paper); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Header */
.top { background: #fff; }
.nav { min-height: 64px; }
.brand img { width: 116px; }
.shell { max-width: 720px; padding-block: 28px 72px; }
body.is-dash .shell, body.is-dash .nav { max-width: 1080px; }
#workspace { display: grid; gap: 14px; }
#loading { color: var(--muted); }

/* Buttons: one filled, one outlined, one quiet. Row actions use the quiet one. */
.button { min-height: 44px; gap: 8px; padding: 0 18px; border-radius: var(--r-control); font-weight: 600; transition: background .15s, border-color .15s, color .15s; }
.button-primary { color: #0d2a33; }
.button-primary:hover { background: #6bbccf; }
.button-outline { border-color: var(--line-strong); }
.button-outline:hover { background: var(--tint); border-color: #a9c6ca; }
.button-quiet { background: transparent; color: var(--muted); }
.button-quiet:hover { background: var(--tint); color: var(--ink); }
.button-small { min-height: 34px; padding-inline: 12px; border-radius: 8px; font-size: 13px; }
.button-big { width: 100%; min-height: 52px; font-size: 16px; }
.button-big + .button-big { margin-top: 10px; }
.linkish { display: block; margin-top: 16px; padding: 6px 0; border: 0; background: none; color: var(--accent); font-size: 14px; font-weight: 600; }
.linkish:hover { text-decoration: underline; }

/* Fields */
.search-box input, .invite-form input, .invite-form select, .copy-line input, dialog input, dialog select, #setup-message {
  min-width: 0; width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-control);
  background: #fff; color: var(--ink); font-size: 15px; transition: border-color .15s, box-shadow .15s;
}
.search-box input:focus, .invite-form input:focus, .invite-form select:focus, .copy-line input:focus, dialog input:focus, dialog select:focus, #setup-message:focus {
  border-color: var(--accent); box-shadow: var(--ring); outline: none;
}
::placeholder { color: #71878e; }

/* Step screens: sign in, plan, pick a tool, pick an AI */
.wizard { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: clamp(22px, 5vw, 40px); }
main.wizard { max-width: 560px; margin: 40px auto; font-family: var(--sans); color: var(--ink); }
.wizard h1 { font: 400 clamp(2rem, 6vw, 2.75rem)/1.05 var(--serif); letter-spacing: -.02em; margin: 0 0 12px; }
.wizard h1:focus { outline: none; }
.wizard h1 + .button { margin-top: 8px; }
.wizard h2 { font: 600 14px/1.3 var(--sans); letter-spacing: 0; color: var(--muted); margin: 24px 0 10px; }
.wizard .kicker { margin-bottom: 14px; letter-spacing: .08em; }
.wizard .lead { max-width: 56ch; margin-bottom: 20px; color: var(--muted); font-size: 17px; line-height: 1.5; }
.wizard .lead strong { color: var(--ink); font-weight: 600; }
.step-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.step-count { color: var(--muted); font-size: 13px; font-weight: 600; }
.progress { display: flex; gap: 4px; }
.progress span { width: 28px; height: 4px; border-radius: 99px; background: var(--line); }
.progress .on { background: var(--accent); }
.foot { margin-top: 16px; color: var(--muted); font-size: 14px; }
.foot a, .wizard details a, .panel a { color: var(--accent); font-weight: 600; }
.account { margin-top: 10px; text-align: center; font-size: 13px; }

/* Finished workspace */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 14px; }
.dash-main, .dash-side { display: grid; gap: 14px; min-width: 0; }
/* In the narrow column a row keeps its one action beside the text; two actions drop below. */
.dash-side .panel li { flex-wrap: nowrap; }
.dash-side .panel li:has(.row-actions > :nth-child(2)) { flex-wrap: wrap; }
.dash-side .row-actions { flex: none; }

/* The question to ask is the one loud thing on the page. */
.wizard.ask { background: var(--deep); border-color: var(--deep); color: #fff; padding: clamp(22px, 4vw, 34px); }
.wizard.ask h1 { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; color: #8fd3e0; font: 600 14px/1.3 var(--sans); letter-spacing: 0; }
.wizard.ask h1::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #58c9a4; }
.wizard.ask .lead { margin-bottom: 10px; color: #b7d0d5; font-size: 15px; }
.wizard.ask .lead strong { color: #fff; }
.wizard.ask .prompt { margin: 0 0 24px; padding: 0; border: 0; background: none; }
.wizard.ask .prompt p { max-width: 26ch; color: #fff; font: 400 clamp(1.75rem, 3.6vw, 2.5rem)/1.12 var(--serif); letter-spacing: -.015em; }
.wizard.ask :focus-visible { outline-color: #9fdbe6; }

/* Trial and team status strip */
.trial { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 12px 10px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.trial > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.trial strong { font-size: 14px; font-weight: 600; }
.trial span { color: var(--muted); font-size: 13px; }

/* Dismissible tip */
.nudge { padding: 16px 18px; border: 1px solid #d3e4e7; border-radius: var(--r-card); background: #edf5f6; }
.nudge-kicker { display: block; margin-bottom: 2px; color: var(--accent); font-size: 12px; font-weight: 600; }
.nudge strong { display: block; font-size: 15px; font-weight: 600; line-height: 1.35; }
.nudge p { max-width: 64ch; margin: 4px 0 12px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.nudge-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.nudge .button-outline { background: #fff; }
.nudge-dismiss { padding: 8px 4px; border: 0; background: none; color: var(--muted); font-size: 13px; font-weight: 500; }
.nudge-dismiss:hover { color: var(--ink); text-decoration: underline; }

/* Roofing software picker */
.connector-toolbar { display: grid; gap: 10px; margin-bottom: 16px; }
.search-box { position: relative; display: flex; align-items: center; }
.search-box svg { position: absolute; left: 12px; width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.search-box input { padding-inline: 38px 36px; }
.search-clear { position: absolute; right: 6px; display: inline-grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 99px; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; }
.search-clear:hover { background: var(--tint); color: var(--ink); }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 12px; border: 1px solid var(--line-strong); border-radius: 99px; background: #fff; color: var(--muted); font-size: 13px; font-weight: 500; transition: background .15s, border-color .15s, color .15s; }
.chip:hover { background: var(--tint); color: var(--ink); }
.chip.is-active { background: var(--deep); border-color: var(--deep); color: #fff; }
.empty-search { padding: 24px 18px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); font-size: 15px; text-align: center; }
.empty-search p { margin-bottom: 12px; }
.empty-search .actions { justify-content: center; margin-top: 0; gap: 10px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; color: var(--ink); text-align: left; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
button.tile:hover, a.tile:hover { border-color: var(--accent); box-shadow: var(--ring); }
.tile-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; margin-bottom: 8px; }
.tile strong { font-size: 16px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }
.tile-desc { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.tile-cta { margin-top: auto; padding-top: 10px; color: var(--accent); font-size: 13px; font-weight: 600; white-space: nowrap; }
.tile.is-off { background: var(--paper); }
.tile.is-off .tile-cta { color: var(--muted); }
/* Tools that are not ready yet: one short row each */
.tiles-label { margin-top: 26px; }
.tiles-soon { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 0 20px; }
.tiles-soon .tile { flex-direction: row; align-items: center; gap: 10px; padding: 9px 2px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; }
.tiles-soon .tile:hover { box-shadow: none; }
.tiles-soon .tile strong { font-size: 14px; }
.tiles-soon .tile-cta { margin: 0 0 0 auto; padding: 0; color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; }
.tiles-soon .tile:hover .tile-cta { color: var(--accent); }
.tiles-soon .app-mark { width: 28px; height: 28px; border-radius: 7px; }
.tiles-soon .provider-logo { width: 16px; height: 16px; }
/* AI app choices */
.tile-row { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; padding: 18px; }
.tile-row .tile-cta { margin: 0; padding: 0; }
.ai-name { display: flex; align-items: center; gap: 10px; }
.ai-logo { flex: none; width: 26px; height: 26px; color: #242424; }
.tile-short { padding: 12px 14px; }
.tile-short strong { font-size: 14px; }
.tile-short .ai-logo { width: 20px; height: 20px; color: #595959; }
.tiles-small { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.tiles + .linkish { margin-top: 14px; }

/* Provider marks share one tint so a list of tools reads as a list, not a palette. */
.shell .app-mark, dialog .app-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--tint); }
.shell .provider-logo, dialog .provider-logo { width: 21px; height: 21px; }

/* Status: live is a dot, beta a plain pill, coming soon just text */
.status-pill { padding: 2px 8px; font-size: 11px; font-weight: 600; }
.status-pill.is-live { padding-inline: 0; background: none; color: var(--ok); }
.status-pill.is-live::before { background: var(--ok); }
.status-pill.is-beta { border: 0; background: var(--tint); color: #3d555c; }
.status-pill.is-soon { padding-inline: 0; background: none; color: var(--muted); }
.tag { padding: 2px 8px; background: var(--tint); color: #3d555c; font-size: 11px; font-weight: 600; }

/* AI setup steps */
#copy-status { min-height: 22px; margin-top: 6px; color: var(--ok); font-size: 14px; font-weight: 600; }
.do-list { margin: 0; padding: 0; list-style: none; counter-reset: todo; font-size: 16px; line-height: 1.5; }
.do-list li { counter-increment: todo; position: relative; padding: 12px 0 12px 40px; border-top: 1px solid var(--line); }
.do-list li::before { content: counter(todo); position: absolute; left: 0; top: 12px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--tint); color: var(--accent); font-size: 13px; font-weight: 700; }
.do-list strong { font-weight: 600; }
.waiting { display: flex; align-items: baseline; gap: 10px; margin-top: 6px; padding: 12px 14px; border-radius: var(--r-control); background: var(--tint); font-size: 14px; font-weight: 500; }
.waiting i { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .waiting i { animation: none; } }
.wizard details { margin-top: 16px; padding: 0; border: 0; }
.wizard summary { padding-block: 6px; color: var(--accent); font-size: 14px; font-weight: 600; }
.wizard details p { margin-top: 10px; padding: 0; font-size: 14px; }
.wizard details label { display: block; margin-top: 12px; font-size: 13px; font-weight: 600; }
.copy-line { display: flex; align-items: center; gap: 8px; min-width: 0; margin-top: 4px; }
.copy-line input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.copy-line .button { flex: 0 0 auto; }
#setup-message { margin-top: 4px; font-family: inherit; resize: vertical; }
.wizard .prompt { margin-bottom: 16px; padding: 14px 16px; }
.wizard .prompt p { font-size: 17px; font-weight: 600; line-height: 1.4; }

/* Step screenshots */
.wizard .shot, dialog .shot { margin-top: 6px; padding: 0; border: 0; }
.shot summary { display: inline-block; padding: 3px 10px; border: 1px solid var(--line-strong); border-radius: 99px; color: var(--accent); font-size: 13px; font-weight: 600; list-style: none; cursor: pointer; }
.shot summary::-webkit-details-marker { display: none; }
.shot summary::before { content: '▸ '; }
.shot[open] summary::before { content: '▾ '; }
.shot[open] summary { margin-bottom: 10px; }
.shot img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--r-control); }
.do-list .shot { margin-left: -40px; }
.do-list .shot summary { margin-left: 40px; }

/* Panels: AI apps, team, billing, roofing tools, sample prompts */
.panel { padding: 16px 20px 8px; border: 1px solid var(--line); border-radius: var(--r-card); background: #fff; }
.panel > h2, .team h2 { margin: 0; font: 600 15px/1.3 var(--sans); letter-spacing: 0; }
.panel > h2 { margin-bottom: 4px; }
.panel ul { list-style: none; margin: 0; padding: 0; }
.panel li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding-block: 11px; border-top: 1px solid var(--line); }
.panel li:first-child { border-top: 0; }
.panel li > div:first-child { min-width: 0; }
.panel li strong { display: block; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.panel li span { color: var(--muted); font-size: 13px; }
.panel li > div > span { display: block; line-height: 1.4; }
.panel .list-label { padding-block: 14px 2px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 600; }
.panel .list-label + li { border-top: 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: 2px; margin-right: -8px; }
.row-actions .button-outline { margin-right: 8px; }
.manage-row-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.manage-row-info .app-mark { width: 34px; height: 34px; border-radius: 9px; }
.manage-row-info .provider-logo { width: 19px; height: 19px; }
.manage-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.manage-title strong { display: inline; }
.is-connected .conn-state { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 500; }
.is-connected .conn-state::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.manage-search-wrap { padding: 8px 0 4px; }
.manage-search-wrap .search-box input { padding-block: 8px; font-size: 14px; }
.add-row { display: block; width: 100%; margin-top: 2px; padding: 11px 0; border: 0; border-top: 1px solid var(--line); background: none; color: var(--accent); font-size: 14px; font-weight: 600; text-align: left; }
.add-row::before { content: '+ '; }
.add-row:hover { text-decoration: underline; }

/* Collapsible panels (setup views and the prompt guide) */
details.panel { padding: 0 20px; border: 1px solid var(--line); }
details.panel[open] { padding-bottom: 10px; }
details.panel > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 -20px; padding: 15px 20px; color: var(--ink); font-size: 15px; font-weight: 600; list-style: none; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: ''; flex: none; width: 7px; height: 7px; margin-right: 3px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
details.panel[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
details.panel[open] > summary { border-bottom: 1px solid var(--line); }
.manage-section { padding-top: 14px; }
.manage-section + .manage-section { margin-top: 6px; border-top: 1px solid var(--line); }
.manage-section h3, .prompts-help h3 { margin: 0 0 2px; color: var(--muted); font: 600 13px/1.3 var(--sans); letter-spacing: 0; text-transform: none; }

/* Sample prompts */
.prompts-help .guide-note { max-width: 68ch; margin: 14px 0 0; padding: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.prompts-help h3 { margin-top: 20px; }
.prompts-help li { flex-wrap: nowrap; gap: 12px; }
.prompts-help .sample-text { flex: 1 1 auto; min-width: 0; color: var(--ink); font-size: 14px; font-weight: 500; line-height: 1.45; }
.prompts-help .sample-text small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 400; }
.prompts-help .row-actions { flex: 0 0 auto; }
.prompts-help .button-quiet { color: var(--accent); }

/* Team */
.team { padding-bottom: 8px; }
.team-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-bottom: 4px; }
.team-sub { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.invite-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.invite-form input { flex: 1 1 200px; width: auto; }
.invite-form select { flex: 1 1 auto; width: auto; font-weight: 500; }
.invite-form button { flex: 0 0 auto; min-height: 42px; }
.team ul { border-top: 1px solid var(--line); margin-top: 8px; }
.role-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 99px; background: var(--tint); color: #3d555c; font-size: 11px; font-weight: 600; vertical-align: 1px; }
.role-tag.is-owner { background: #f7efe0; color: #8c5f0b; }
.panel li .role-tag { font-size: 11px; color: #3d555c; }
.panel li .role-tag.is-owner { color: #8c5f0b; }

/* A member's actions fold into one menu */
details.row-menu { position: relative; padding: 0; border: 0; }
.row-menu summary { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 10px; border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 600; list-style: none; cursor: pointer; }
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu summary::after { content: ''; width: 5px; height: 5px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); }
.row-menu summary:hover, .row-menu[open] summary { background: var(--tint); color: var(--ink); }
.row-menu-list { position: absolute; top: calc(100% + 4px); right: 0; z-index: 3; display: grid; min-width: 168px; padding: 4px; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: #fff; box-shadow: 0 10px 28px rgb(18 49 58 / .14); }
.row-menu-list .button { justify-content: flex-start; width: 100%; color: var(--ink); }
.row-menu-list .button[data-action="team-remove-member"] { color: var(--danger); }

/* Messages stay in view while the page scrolls */
.notice { position: sticky; top: 12px; z-index: 4; margin-bottom: 14px; padding: 11px 14px; border: 1px solid #bcd9de; border-radius: var(--r-control); background: #fff; color: #1d5360; font-size: 14px; font-weight: 600; box-shadow: 0 8px 24px rgb(18 49 58 / .1); }
.notice.error { border-color: #e6c1be; background: #fdf4f3; color: var(--danger); }
.error { color: var(--danger); }

/* Server-rendered pages (invite, OAuth consent, setup errors) use .card.signin */
.shell .signin { max-width: 520px; min-height: 0; margin: 28px auto; padding: clamp(24px, 5vw, 40px); border-color: var(--line); border-radius: 16px; }
.signin h2 { margin-top: 16px; font-size: clamp(2rem, 4.5vw, 2.6rem); line-height: 1.05; }
.signin > p { margin: 8px 0 22px; font-size: 15px; line-height: 1.55; }
.signin .actions { margin-top: 0; gap: 10px; }

/* Connect dialog */
dialog { width: 100%; max-width: min(480px, calc(100% - 28px)); padding: 26px; border: 1px solid var(--line-strong); border-radius: 16px; color: var(--ink); box-shadow: 0 20px 60px rgb(18 49 58 / .25); }
dialog::backdrop { background: rgb(18 49 58 / .45); }
dialog .kicker { display: none; }
.dialog-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.dialog-title-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
dialog h3 { margin: 0; font: 400 1.75rem/1.1 var(--serif); letter-spacing: -.015em; }
dialog p { margin-bottom: 8px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.beta-banner { margin-bottom: 12px; padding: 10px 12px; border-radius: var(--r-control); background: var(--tint); color: #3d555c; font-size: 13px; line-height: 1.45; }
dialog .text-link { font-size: 14px; font-weight: 600; }
dialog .error { margin-top: 8px; font-size: 14px; }
dialog label { display: block; margin-block: 16px 6px; font-size: 14px; font-weight: 600; }
dialog input, dialog select { padding-block: 12px; font-size: 16px; }
dialog .actions { margin-top: 20px; gap: 8px; }
dialog .actions .button { flex: 1 1 140px; min-height: 48px; font-size: 15px; }

@media (max-width: 900px) {
  .dash { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .shell { padding-block: 18px 42px; }
  .nav { min-height: 56px; }
  .panel, details.panel { padding-inline: 16px; }
  details.panel > summary { margin-inline: -16px; padding-inline: 16px; }
  .button-small, .row-menu summary { min-height: 40px; }
  .prompts-help li { flex-wrap: wrap; }
  .tiles-soon .tile-cta { white-space: normal; text-align: right; }
}
