:root {
  --ink: #171717;
  --muted: #686868;
  --line: #ddd8d1;
  --surface: #f1efeb;
  --card: #fff;
  --accent: #c83e49;
  --accent-dark: #a72f3a;
  --accent-soft: #fae9eb;
  --amber: #9a621d;
  --amber-soft: #fff1dc;
  --blue: #285e84;
  --blue-soft: #e7f1f8;
  --green: #29715b;
  --green-soft: #e5f2ec;
  --shadow: 0 18px 50px rgba(42, 32, 28, .09);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--surface); }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea, a { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

.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;
}

.gate-card {
  width: min(480px, calc(100vw - 32px));
  margin: 15vh auto;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: center;
}
.gate-card#loading {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: grid;
  width: auto;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 24px;
  place-content: center;
  justify-items: center;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
}
.gate-card#loading p { margin: 0; }
.gate-card > .brand-mark { margin: 0 auto 18px; }
.gate-card h1 { margin: 6px 0 10px; font: 700 2rem/1.1 Georgia, serif; }
.gate-card p { color: var(--muted); }
.gate-actions { display: grid; gap: 10px; margin-top: 22px; }

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font: 800 .88rem/1 Georgia, serif;
  letter-spacing: .05em;
}
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: .68rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px max(22px, calc((100vw - 1180px) / 2));
  border-top: 6px solid var(--accent);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(16px);
}
.brand { display: inline-flex; align-items: center; gap: 11px; padding: 0; border: 0; color: var(--accent-dark); background: transparent; text-align: left; }
.brand strong, .brand small { display: block; }
.brand strong { font: 700 1.05rem/1.12 Georgia, serif; }
.brand small { margin-top: 3px; color: var(--muted); font-size: .7rem; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.beta-badge, .user-chip, .active-badge, .verified-badge, .count-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 820;
  white-space: nowrap;
}
.beta-badge, .user-chip { color: var(--accent-dark); background: var(--accent-soft); }
.text-button { border: 0; color: var(--muted); background: transparent; font-size: .74rem; font-weight: 750; }

.builder-shell { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: 44px 0 76px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-head h1 { margin: 0; font: 700 clamp(2.6rem, 5vw, 3.7rem)/.98 Georgia, serif; letter-spacing: -.04em; }
.page-head p:last-child { margin: 11px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.page-head-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.section-heading h2 { margin: 0; font-size: .93rem; }
.section-heading span { color: var(--muted); font-size: .74rem; }

.daily-activity { margin: -8px 0 20px; }
.daily-activity-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 11px; }
.daily-activity-head .eyebrow { margin-bottom: 4px; }
.daily-activity-head h2 { margin: 0; font: 700 1.25rem/1.08 Georgia, serif; }
.daily-activity-head time { color: var(--muted); font-size: .68rem; font-weight: 720; }
.daily-brief-meta { display: flex; align-items: center; gap: 9px; }
.daily-brief-ai { padding: 4px 8px; border-radius: 999px; color: #496272; background: #eaf2f7; font-size: .58rem; font-weight: 820; letter-spacing: .02em; }
.daily-brief-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 15px; padding: 20px 22px 16px; border: 1px solid #d8dfe2; border-radius: 17px; background: linear-gradient(135deg, #fff 0%, #fbfcfc 100%); box-shadow: 0 3px 16px rgba(42, 32, 28, .045); }
.daily-brief-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; color: #496272; background: #eaf2f7; font-size: .88rem; }
.daily-brief-copy { min-width: 0; }
.daily-brief-sections { display: grid; gap: 15px; }
.daily-brief-overview { margin: 0 0 2px; color: #383431; font: 700 .96rem/1.5 Georgia, serif; overflow-wrap: anywhere; }
.daily-brief-section { min-width: 0; }
.daily-brief-section > h3 { margin: 0 0 5px; color: #4e4945; font-size: .63rem; font-weight: 850; letter-spacing: .055em; text-transform: uppercase; }
.daily-brief-section[data-daily-brief-kind="completed"] > h3 { color: #426333; }
.daily-brief-section[data-daily-brief-kind="new"] > h3,
.daily-brief-section[data-daily-brief-kind="activity"] > h3 { color: #496272; }
.daily-brief-section[data-daily-brief-kind="followup"] > h3,
.daily-brief-section[data-daily-brief-kind="attention"] > h3 { color: #8c5b17; }
.daily-brief-narrative { display: grid; gap: .58rem; margin: 0; font-size: .84rem; line-height: 1.62; overflow-wrap: anywhere; }
.daily-brief-home-narrative { display: block; }
.daily-brief-home-narrative strong { font-weight: 820; }
.daily-brief-more { margin-top: 4px; padding: 0; border: 0; color: var(--accent); background: transparent; font-size: .63rem; font-weight: 820; }
.daily-brief-more:hover { color: var(--accent-dark); }
.daily-brief-loading, .daily-brief-empty { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.5; }
.daily-brief-status { margin-top: 14px !important; color: var(--muted); font-size: .6rem !important; line-height: 1.35 !important; }
.daily-brief-card[aria-busy="true"] .daily-brief-status::before { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: #6b8797; content: ""; animation: daily-brief-pulse 1.2s ease-in-out infinite; }
@keyframes daily-brief-pulse { 50% { opacity: .3; transform: scale(.82); } }

.agent-access-button { gap: 8px; }
.agent-access-count {
  display: inline-flex;
  min-width: 21px;
  height: 21px;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-radius: 999px;
  color: #fff;
  background: var(--green);
  font-size: .59rem;
  font-weight: 850;
}
.portfolio-agent-management { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.portfolio-agent-management > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.portfolio-agent-management h3 { margin: 0; font-size: .75rem; }
.portfolio-agent-management > header span { color: var(--muted); font-size: .6rem; }
#portfolio-agent-dialog { max-height: calc(100dvh - 28px); overflow-y: auto; }
#portfolio-agent-connections { max-height: min(360px, 45dvh); margin-top: 11px; border: 1px solid var(--line); border-radius: 11px; background: #fff; overflow-y: auto; }
#portfolio-agent-connections:empty { display: none; }
.portfolio-agent-empty { margin: 12px 0 0; color: var(--muted); font-size: .65rem; }
#portfolio-agent-connections .agent-row { padding: 11px 12px; }
.agent-flow { display: grid; gap: 8px; margin-top: 17px; }
.agent-flow > div { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 9px; }
.agent-flow strong { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 50%; color: var(--green); background: var(--green-soft); font-size: .65rem; }
.agent-flow span { color: var(--muted); font-size: .67rem; line-height: 1.45; }

.portfolio-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 240px);
  gap: 12px;
  margin: 0 0 24px;
}
.portfolio-search input, .portfolio-sort select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
}
.portfolio-search input {
  padding: 11px 14px;
}
.portfolio-sort {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
.portfolio-sort span { color: var(--muted); font-size: .68rem; font-weight: 820; }
.portfolio-sort select { padding: 10px 12px; }
.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
  font-size: .76rem;
  font-weight: 800;
  white-space: nowrap;
}
.button.primary { border-color: var(--accent); color: #fff; background: var(--accent); }
.button.primary:hover { background: var(--accent-dark); }
.button.secondary { background: #fff; }
.button.danger { border-color: var(--accent); color: #fff; background: var(--accent); }
.button.danger:hover { background: var(--accent-dark); }
.button.danger-subtle { border-color: #e7b7bc; color: var(--accent-dark); background: #fff8f8; }
.button.small { min-height: 34px; padding: 6px 10px; font-size: .68rem; }
.button:disabled { opacity: .58; cursor: progress; }

.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.project-card { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 3px 16px rgba(42, 32, 28, .04); transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.project-card:hover { border-color: #c9bdb3; box-shadow: var(--shadow); transform: translateY(-1px); }
.project-card:focus-visible { outline: 3px solid rgba(200, 62, 73, .25); outline-offset: 3px; }
.project-card:first-child { box-shadow: var(--shadow); }
.project-card-body { padding: 18px; }
.project-card-heading { display: flex; justify-content: space-between; gap: 18px; }
.project-card-heading h2 { margin: 0; font: 700 1.4rem/1.08 Georgia, serif; letter-spacing: -.02em; }
.address { margin: 6px 0 0; color: var(--muted); font-size: .72rem; }
.project-updated { flex: 0 0 auto; color: var(--muted); font-size: .62rem; white-space: nowrap; }
.project-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 13px; }
.project-metric { padding: 8px 7px; border: 1px solid #e6e0d9; border-radius: 10px; text-align: center; }
.project-metric.ready { border-color: #efd2a5; background: var(--amber-soft); }
.project-metric strong, .project-metric span { display: block; }
.project-metric strong { font: 700 1.25rem/1 Georgia, serif; }
.project-metric span { margin-top: 5px; color: var(--muted); font-size: .57rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.project-progress { margin-top: 11px; }
.project-progress-copy { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.project-progress-copy span { color: var(--muted); font-size: .6rem; font-weight: 750; }
.project-progress-copy strong { color: var(--green); font-size: .62rem; }
.project-progress-track { overflow: hidden; width: 100%; height: 8px; border-radius: 999px; background: #e8e4df; }
.project-progress-fill { display: block; height: 100%; border-radius: inherit; background: var(--green); transition: width .25s ease; }
.project-activity { margin-top: 11px; padding: 9px 10px; border-radius: 10px; background: #f7f5f2; }
.project-activity strong { display: block; font-size: .68rem; }
.project-activity p { margin: 4px 0 0; font-size: .65rem; line-height: 1.4; }
.project-activity span { display: block; margin-top: 4px; color: var(--muted); font-size: .59rem; }
.completion-note { color: #4d4946 !important; font-style: italic; }
.verified-check { display: grid; width: 18px; height: 18px; place-items: center; border-radius: 50%; color: var(--green); background: var(--green-soft); font-size: .6rem; font-weight: 900; }
.project-card-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; border-top: 1px solid var(--line); background: #fbfaf8; }
.open-project, .project-access { display: flex; align-items: center; min-height: 44px; padding: 10px 18px; text-decoration: none; }
.open-project { justify-content: space-between; border-right: 1px solid var(--line); color: var(--accent); font-size: .75rem; font-weight: 820; }
.project-access { justify-content: center; color: var(--muted); font-size: .67rem; font-weight: 780; white-space: nowrap; }
.open-project:hover, .open-project:focus-visible, .project-access:hover, .project-access:focus-visible { background: var(--accent-soft); }
.empty-state, .panel-empty { color: var(--muted); text-align: center; }
.empty-state { margin: 28px 0; }
.archived-projects { margin-top: 26px; border-top: 1px solid var(--line); }
.archived-projects > summary { display: flex; min-height: 48px; align-items: center; gap: 8px; padding: 16px 2px 10px; color: var(--muted); font-size: .77rem; font-weight: 820; cursor: pointer; }
.archived-projects > summary span { display: inline-flex; min-width: 24px; min-height: 24px; align-items: center; justify-content: center; padding: 3px 7px; border-radius: 999px; color: #625b56; background: #e5e1dc; font-size: .65rem; }
.archived-projects-help { max-width: 680px; margin: 2px 0 13px; color: var(--muted); font-size: .68rem; line-height: 1.5; }
.archived-project-grid { display: grid; gap: 9px; }
.archived-project-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 15px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255, 255, 255, .72); }
.archived-project-row h3 { margin: 0; font: 700 1rem/1.15 Georgia, serif; }
.archived-project-row p { margin: 5px 0 0; color: var(--muted); font-size: .65rem; line-height: 1.4; }
.archive-dialog-name { margin: -7px 0 15px; font: 700 1.05rem/1.35 Georgia, serif; }

.back-button { margin-bottom: 24px; padding: 0; border: 0; color: var(--muted); background: transparent; font-size: .75rem; font-weight: 800; }
.detail-progress-summary { margin: 16px 0 24px; padding: 17px 19px 16px; border: 1px solid var(--line); border-radius: 17px; background: #fff; box-shadow: 0 2px 12px rgba(42, 32, 28, .035); }
.detail-progress-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.detail-progress-metric { display: flex; min-width: 0; align-items: baseline; gap: 7px; padding: 1px 16px; border-left: 1px solid var(--line); }
.detail-progress-metric:first-child { padding-left: 0; border-left: 0; }
.detail-progress-metric strong { font: 700 1.35rem/1 Georgia, serif; }
.detail-progress-metric.primary strong { color: var(--accent); }
.detail-progress-metric span { color: var(--muted); font-size: .66rem; font-weight: 760; }
.detail-progress-copy { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 15px 0 7px; padding-top: 13px; border-top: 1px solid var(--line); }
.detail-progress-copy span { color: var(--muted); font-size: .62rem; font-weight: 750; }
.detail-progress-copy strong { color: var(--green); font-size: .64rem; }
/* One quiet signal, not a queue: review starts in the shared punch list. */
.ready-chip { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 7px 13px; border: 1px solid #cfd9ae; border-radius: 999px; background: #f2f6e6; color: #4d6114; font-size: .76rem; font-weight: 800; text-decoration: none; }
.ready-chip:hover { border-color: #4d6114; }
.project-tabs { display: flex; gap: 6px; margin: -8px 0 24px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.project-tab { padding: 9px 13px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; text-decoration: none; font-size: .74rem; font-weight: 800; }
.project-tab.active { color: var(--accent-dark); background: var(--accent-soft); }
.priority-panel { margin-bottom: 18px; }
.priority-panel.is-empty .panel-head { padding-bottom: 12px; border-bottom: 0; }
.priority-panel.is-empty .panel-head p { display: none; }
.priority-panel.is-empty .count-badge { color: var(--muted); background: #efedea; }
.priority-panel.is-empty .panel-empty { padding: 0 19px 16px; text-align: left; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr); gap: 18px; align-items: start; }
.detail-side-stack { display: grid; min-width: 0; gap: 18px; }
.panel { overflow: hidden; scroll-margin-top: 86px; border: 1px solid var(--line); border-radius: 17px; background: #fff; box-shadow: 0 2px 12px rgba(42, 32, 28, .035); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 19px 14px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: .86rem; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: .64rem; line-height: 1.4; }
.count-badge { color: var(--amber); background: var(--amber-soft); }
.verified-badge, .active-badge { color: var(--green); background: var(--green-soft); }
.request-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 18px; }
.request-row + .request-row, .link-row + .link-row { border-top: 1px solid var(--line); }
.area-label { display: block; margin-bottom: 5px; color: #746f6b; font-size: .58rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.request-row h3, .link-row h3, .accomplishment-row h3 { margin: 0; font-size: .74rem; }
.request-row p, .link-row p, .accomplishment-row p { margin: 4px 0 0; color: var(--muted); font-size: .61rem; line-height: 1.4; }
.panel-empty { margin: 0; padding: 22px 18px; font-size: .7rem; }
.day-group { padding: 16px 19px; }
.day-group + .day-group { border-top: 1px solid var(--line); }
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 5px; }
.day-head strong { font-size: .64rem; letter-spacing: .07em; text-transform: uppercase; }
.day-head span { color: var(--green); font-size: .59rem; font-weight: 800; }
.accomplishment-row { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 9px; padding: 10px 0; }
.accomplishment-row + .accomplishment-row { border-top: 1px solid #eeeae5; }
.accomplishment-row time { color: var(--muted); font-size: .59rem; white-space: nowrap; }
.show-more { width: 100%; padding: 10px 0 0; border: 0; border-top: 1px solid #eeeae5; color: var(--accent); background: transparent; font-size: .64rem; font-weight: 800; text-align: left; }
.links-head { align-items: center; }
.link-row { display: grid; grid-template-columns: minmax(130px, .75fr) minmax(0, 1.25fr) auto; align-items: center; gap: 12px; padding: 14px 17px; }
.link-copy { min-width: 0; }
.link-display { display: flex; min-width: 0; align-items: center; gap: 7px; }
.link-value { width: 100%; min-width: 0; height: 36px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; color: #4f4a46; background: #f7f5f2; font-size: .62rem; }
.link-status { color: var(--muted); font-size: .62rem; line-height: 1.35; }
.checked-area { display: block; margin-top: 4px; color: #817a74; font-size: .56rem; }
.agent-access-head { align-items: center; }
.agent-access-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.agent-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 15px 17px; }
.agent-row + .agent-row { border-top: 1px solid var(--line); }
.agent-row h3 { margin: 0; font-size: .74rem; }
.agent-row p { margin: 4px 0 0; color: var(--muted); font-size: .61rem; line-height: 1.4; }
.agent-row.revoked { opacity: .62; }
.agent-actions { display: flex; align-items: center; gap: 6px; }
.agent-provider { display: inline-flex; margin-top: 7px; padding: 4px 7px; border-radius: 999px; color: var(--blue); background: var(--blue-soft); font-size: .57rem; font-weight: 850; }
.agent-status { display: inline-flex; margin-top: 7px; padding: 4px 7px; border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: .57rem; font-weight: 850; text-transform: capitalize; }
.agent-row.revoked .agent-status, .agent-row.expired .agent-status { color: var(--muted); background: #efedea; }
.agent-feature-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 14px 17px 10px; border-top: 1px solid var(--line); background: #fbfaf8; }
.agent-feature-heading strong { font-size: .7rem; }
.agent-feature-heading span { color: var(--muted); font-size: .58rem; }
.agent-feature-row { padding: 14px 17px; border-top: 1px solid var(--line); }
.agent-feature-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.agent-feature-row h3 { margin: 0; font-size: .72rem; line-height: 1.4; }
.agent-feature-row p { margin: 6px 0 0; color: var(--muted); font-size: .61rem; line-height: 1.45; white-space: pre-wrap; }
.agent-feature-row .agent-status { flex: none; margin-top: 0; }
.agent-feature-row .agent-feature-meta { font-size: .56rem; }

.dialog { width: min(510px, calc(100vw - 28px)); padding: 0; border: 1px solid var(--line); border-radius: 20px; color: var(--ink); background: #fff; box-shadow: 0 30px 90px rgba(0, 0, 0, .24); }
.dialog::backdrop { background: rgba(31, 26, 24, .46); backdrop-filter: blur(3px); }
.dialog form, .dialog > section { padding: 22px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.dialog-head h2 { margin: 0; font: 700 1.7rem/1.08 Georgia, serif; }
.icon-button { display: grid; width: 44px; height: 44px; flex: 0 0 44px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: #fff; font-size: 1.15rem; }
.dialog label { display: grid; gap: 7px; margin-top: 16px; font-size: .73rem; font-weight: 800; }
.dialog label span { color: var(--muted); font-weight: 500; }
.dialog input:not([type="checkbox"]), .dialog select { min-height: 46px; width: 100%; padding: 11px 12px; border: 1px solid #cfc9c2; border-radius: 11px; background: #fff; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.one-time-note { padding: 12px; border-radius: 11px; color: #6e4b1c; background: var(--amber-soft); font-size: .69rem; line-height: 1.45; }
.dialog-copy { margin: -7px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.55; }
.people-dialog { max-height: calc(100dvh - 28px); overflow-y: auto; }
.dialog .invite-builder-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 9px; padding: 0; }
.dialog .invite-builder-form label { margin-top: 18px; }
.invite-builder-form .button { min-height: 46px; }
.people-status { margin: 12px 0 0; padding: 9px 11px; border-radius: 9px; color: var(--green); background: var(--green-soft); font-size: .66rem; line-height: 1.45; }
.people-status.error { color: var(--accent-dark); background: var(--accent-soft); }
.builder-referral { display: grid; gap: 12px; margin-top: 20px; padding: 16px; border: 1px solid #cfe3d8; border-radius: 13px; background: var(--green-soft); }
.builder-referral h3 { margin: 0; font-size: .76rem; }
.builder-referral > div > p { margin: 5px 0 0; color: #4c625a; font-size: .64rem; line-height: 1.48; }
.builder-referral > .button { justify-self: start; }
.builder-referral-result { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; padding-top: 12px; border-top: 1px solid #c5dbcf; }
.dialog .builder-referral-result label { min-width: 0; margin: 0; }
.builder-referral-result input { overflow: hidden; color: #4f4a46; background: #fff; text-overflow: ellipsis; }
.builder-referral-result .button { min-height: 46px; }
.builder-referral-result p { grid-column: 1 / -1; margin: 0; color: var(--green); font-size: .64rem; font-weight: 750; }
.people-section { margin-top: 20px; }
.people-section > header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.people-section h3 { margin: 0; font-size: .75rem; }
.people-section > header span { color: var(--muted); font-size: .6rem; }
.people-list { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.person-row { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; }
.person-row + .person-row { border-top: 1px solid var(--line); }
.person-copy { display: grid; min-width: 0; gap: 4px; }
.person-heading { display: flex; min-width: 0; align-items: center; gap: 7px; }
.person-copy strong { overflow: hidden; font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.person-email { overflow: hidden; color: var(--muted); font-size: .6rem; text-overflow: ellipsis; white-space: nowrap; }
.person-role { padding: 3px 6px; border-radius: 999px; color: var(--muted); background: #efedea; font-size: .52rem; font-weight: 850; }
.person-role.owner { color: var(--accent-dark); background: var(--accent-soft); }
.person-row .button { flex: none; }
.agent-permissions { display: grid; gap: 8px; margin: 16px 0 0; padding: 0; border: 0; }
.agent-permissions legend { margin-bottom: 2px; font-size: .73rem; font-weight: 800; }
.dialog .agent-permissions label { display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: start; gap: 10px; margin: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; font-weight: 500; cursor: pointer; }
.agent-permissions input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--green); }
.agent-permissions span { display: grid; gap: 3px; color: var(--ink); }
.agent-permissions strong { font-size: .7rem; }
.agent-permissions small { color: var(--muted); font-size: .62rem; line-height: 1.4; }
.authority-card { display: grid; gap: 5px; margin-top: 16px; padding: 13px 14px; border: 1px solid #cfe3d8; border-radius: 12px; background: var(--green-soft); }
.authority-card strong { color: var(--green); font-size: .73rem; }
.authority-card span { color: #4c625a; font-size: .64rem; line-height: 1.45; }
.agent-compatibility { margin: 13px 0 0; color: var(--ink); font-size: .66rem; font-weight: 700; line-height: 1.5; }
.agent-copy-fallback { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #f7f5f2; }
.agent-copy-fallback label { margin-top: 0; }
.agent-copy-fallback input { margin-top: 7px; background: #fff; }
.agent-copy-fallback p { margin: 7px 0 0; color: var(--muted); font-size: .62rem; line-height: 1.45; }
.agent-copy-status { margin: 9px 0 0; color: var(--green); font-size: .66rem; font-weight: 800; line-height: 1.4; text-align: right; }
.agent-copy-status.error { color: var(--accent-dark); }
.button.primary.is-copied,
.button.primary.is-copied:hover { border-color: var(--green); background: var(--green); }
.credential-label { display: block; margin: 17px 0 7px; font-size: .7rem; font-weight: 800; }
.credential-output { width: 100%; min-height: 210px; resize: vertical; padding: 12px; border: 1px solid #cfc9c2; border-radius: 11px; color: #302e2c; background: #f7f5f2; font: 500 .67rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.toast { position: fixed; z-index: 50; right: 20px; bottom: 20px; max-width: min(360px, calc(100vw - 40px)); padding: 12px 16px; border-radius: 11px; color: #fff; background: var(--accent); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #8f2430; }

@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  button, input, select, textarea, a { font-size: 16px; }
  .topbar { min-height: 68px; padding: max(10px, env(safe-area-inset-top)) 14px 10px; }
  .brand small, .user-chip { display: none; }
  .brand strong { font-size: .92rem; }
  .brand-mark { width: 38px; height: 38px; }
  .beta-badge { min-height: 27px; font-size: .64rem; }
  .text-button { font-size: .72rem; }
  #workspace-switcher { max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .builder-shell { width: min(100% - 24px, 620px); padding: 28px 0 max(54px, env(safe-area-inset-bottom)); }
  .page-head { display: block; margin-bottom: 24px; }
  .page-head h1 { font-size: 2.6rem; }
  .page-head .button { width: 100%; margin-top: 18px; }
  .page-head-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 18px; }
  .page-head-actions .button { margin-top: 0; }
  #portfolio-view #new-project-button { grid-column: 1 / -1; }
  .detail-head .page-head-actions { row-gap: 16px; }
  .detail-head #detail-add-item { min-height: 52px; grid-column: 1 / -1; }
  .detail-progress-metric { display: grid; gap: 4px; padding: 1px 12px; }
  .detail-progress-metric strong { font-size: 1.45rem; }
  .detail-progress-metric span { font-size: .62rem; }
  .project-grid { grid-template-columns: 1fr; }
  .daily-activity { margin-top: -4px; }
  .daily-activity-head { align-items: center; }
  .daily-brief-meta { display: grid; justify-items: end; gap: 5px; }
  .daily-brief-card { grid-template-columns: 1fr; padding: 17px 17px 14px; }
  .daily-brief-mark { display: none; }
  .daily-brief-sections { gap: 14px; }
  .daily-brief-overview { font-size: .92rem; }
  .daily-brief-narrative { font-size: .8rem; line-height: 1.58; }
  .portfolio-agent-management > header { align-items: flex-start; }
  .builder-referral-result { grid-template-columns: 1fr; }
  .builder-referral-result p { grid-column: 1; }
  .portfolio-tools { grid-template-columns: 1fr; }
  .project-card-heading { display: block; }
  .archived-project-row { grid-template-columns: 1fr; }
  .archived-project-row .button { width: 100%; }
  .project-updated { display: block; margin-top: 8px; }
  .project-tabs { overflow-x: auto; }
  .detail-grid { grid-template-columns: 1fr; }
  .request-row { align-items: flex-start; }
  .request-row .button { min-width: 74px; }
  .links-head { display: block; }
  .link-row { grid-template-columns: minmax(0, 1fr) auto; }
  .link-display { grid-column: 1 / -1; grid-row: 2; }
  .link-value { font-size: 16px; }
  .link-display .button { min-height: 44px; }
  .agent-access-head { display: block; }
  .agent-access-actions { display: grid; grid-template-columns: 1fr; margin-top: 12px; }
  .agent-access-head .button { width: 100%; }
  .agent-row { grid-template-columns: 1fr; }
  .agent-actions { width: 100%; }
  .agent-actions .button { flex: 1; }
  .dialog form, .dialog > section { padding: 19px; }
  .dialog .invite-builder-form { grid-template-columns: 1fr; padding: 0; }
  .dialog-actions .button { flex: 1; }
  .portfolio-agent-actions { display: grid; grid-template-columns: 1fr; }
  .agent-copy-status { text-align: center; }
  .gate-card { margin-top: 9vh; padding: 26px 20px; }
}

@media (max-width: 380px) {
  .beta-badge { display: none; }

  .request-row { display: block; }
  .request-row .button { width: 100%; margin-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
