/* Solstice AI Projects. Colors and type follow the Alterations portal (prototypes/mailbox/static/style.css)
   and the mock-ups in reference/mockups/. No inline styles anywhere: the Content-Security-Policy forbids them. */
:root {
  --navy: #192834; --link: #4d7190; --text: #1f2933; --secondary: #4f5b66; --border: #e3e7eb; --input: #c4ccd4;
  --hover: #f1f4f7; --surface: #f8f9fa;
  --amber: #f59f00; --amber-ink: #6b4f00; --amber-bg: #fff6d6;
  --blue: #597fa0; --blue-ink: #1f5d8a; --blue-bg: #eaf3fb;
  --green: #2fb344; --green-ink: #2b6a3c; --green-bg: #eaf6ee;
  --grey: #dfe4e9; --paused: #8a96a1; --grey-bg: #eef1f4;
  --danger: #a12c2c; --danger-bg: #fcebeb;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text); background: #fff; font-size: 15px; line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; background: #fff; }
h1, h2, p { margin: 0; }
h1 { font-size: 26px; font-weight: 600; line-height: 1.35; letter-spacing: -.5px; }
h2 { font-size: 17px; font-weight: 600; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--navy); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.secondary, .secondary-text { color: var(--secondary); }
.secondary { font-size: 13px; }
.hint { color: var(--secondary); font-weight: 400; font-size: 13px; }

/* Header: the mark and name, the sections, and one account menu on the far right. */
.app-header { min-height: 64px; padding: 10px 24px; background: var(--navy); color: #fff; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 36px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 600; color: #fff; white-space: nowrap; }
.brand img { display: block; flex-shrink: 0; }
a.brand:hover { color: #fff; text-decoration: none; }
.app-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 24px; font-size: 14px; }
.app-nav a { display: inline-flex; align-items: center; min-height: 40px; color: #dbe5ec; font-weight: 600; }
.app-nav a:hover { color: #fff; text-decoration: none; box-shadow: inset 0 -2px 0 #ffffff59; }
.app-nav a[aria-current] { color: #fff; box-shadow: inset 0 -2px 0 #e3bd68; }
.app-header :focus-visible { outline-color: #e3bd68; }
.nav-count { display: inline-block; min-width: 22px; margin-left: 6px; padding: 0 7px; border-radius: 20px; background: var(--amber-bg); color: var(--amber-ink); font-size: 12px; line-height: 1.6; text-align: center; }
.account-menu { position: relative; margin-left: auto; }
.account-menu > summary { display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 10px; margin-right: -10px; border-radius: 8px; color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; list-style: none; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:hover, .account-menu[open] > summary { background: #ffffff1f; }
.account-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu .chevron { flex: none; }
.account-menu[open] .chevron { transform: rotate(180deg); }
.menu-panel { position: absolute; right: -10px; top: calc(100% + 6px); z-index: 40; min-width: 200px; padding: 6px; background: #fff; color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 28px #19283424; }
.menu-panel::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; } /* keeps the hover across the gap */
.menu-panel form { margin: 0; }
.menu-panel a, .menu-item { display: flex; width: 100%; min-height: 38px; align-items: center; justify-content: flex-start; padding: 7px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font-size: 14px; font-weight: 500; text-align: left; white-space: nowrap; }
.menu-panel a:hover, .menu-item:hover { background: var(--hover); color: var(--text); text-decoration: none; filter: none; }
.menu-panel a[aria-current] { font-weight: 600; }

/* Page */
main.page { max-width: 1400px; margin: 24px auto 48px; padding: 0 32px; display: flex; flex-direction: column; gap: 20px; }
.title-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 24px; }
.title-row .button { align-self: center; }
.quiet-link { font-size: 14px; padding: 6px 0; }
.back-link { align-self: flex-start; font-size: 14px; font-weight: 600; padding: 8px 0; margin-bottom: -12px; }
.lead { color: var(--secondary); margin-top: -12px; }
.small-link { font-size: 14px; font-weight: 600; padding: 6px 0; }
.add-line { margin: 0; font-size: 14px; }
.add-line a { font-weight: 600; }
.empty, .empty-line { color: var(--secondary); }
.empty { padding: 20px 10px; }
.empty-line.in-card { padding: 18px 0; border-bottom: 1px solid var(--border); }
.footnote { color: var(--secondary); font-size: 13px; }
.card { border: 1px solid var(--border); border-radius: 8px; padding: 22px; background: #fff; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 6px; }
.card-links { display: flex; gap: 20px; }
.flash { align-self: flex-start; padding: 10px 16px; border: 1px solid #c8e3cf; border-radius: 8px; background: var(--green-bg); color: #246237; font-size: 14px; }
.flash.is-problem { border-color: #f0dc9c; background: #fff8e1; color: var(--amber-ink); }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 16px; border-radius: 8px; background: var(--grey-bg); color: var(--secondary); font-size: 14px; }

/* Buttons */
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 18px; border: 1px solid var(--link); border-radius: 8px; background: var(--link); color: #fff; font: inherit; font-weight: 600; line-height: 1.4; cursor: pointer; white-space: nowrap; text-decoration: none; }
button:hover, .button:hover { filter: brightness(.95); color: #fff; text-decoration: none; }
.button-secondary { background: #fff; color: var(--text); border-color: var(--input); }
.button-secondary:hover { color: var(--text); background: var(--surface); }
.button-small { min-height: 36px; padding: 6px 14px; }
.button-danger { background: #fff; color: var(--danger); border-color: #e3b9b9; }
.button-danger:hover { color: var(--danger); background: var(--danger-bg); }
.text-button { min-height: 36px; padding: 6px 6px; border: 0; background: transparent; color: var(--link); font-size: 14px; }
.text-button:hover { color: var(--navy); background: transparent; text-decoration: underline; filter: none; }
.text-button.is-quiet { color: var(--secondary); }
.text-button.is-danger { color: var(--danger); }
button.wide { width: 100%; }
.centered { align-self: center; }
.inline-form { display: inline; margin: 0; }
.out-arrow { flex: none; }

/* Chips */
.chip { display: inline-block; align-self: flex-start; padding: 2px 10px; border-radius: 20px; font-size: 13px; line-height: 1.5; }
.chip-blue { background: var(--blue-bg); color: var(--blue-ink); }
.chip-grey { background: var(--grey-bg); color: var(--secondary); }
.chip-amber { background: var(--amber-bg); color: var(--amber-ink); font-size: 12px; font-weight: 600; }
.ai-label { color: var(--secondary); font-size: 13px; }

/* Stage bar */
.stage { display: flex; flex-direction: column; gap: 5px; }
.stage-bar { display: flex; gap: 3px; width: 112px; }
.stage.is-wide { margin-top: 10px; }
.stage.is-wide .stage-bar { width: 168px; }
.segment { flex: 1; height: 6px; border-radius: 3px; background: var(--grey); }
.segment.tone-scoping, .segment.tone-being_built { background: var(--amber); }
.segment.tone-testing { background: var(--blue); }
.segment.tone-in_use { background: var(--green); }
.segment.tone-paused { background: var(--paused); }
.stage-label { font-size: 13px; font-weight: 600; }
.stage-label.tone-not_started { color: var(--secondary); font-weight: 400; }
.stage-label.tone-scoping, .stage-label.tone-being_built { color: var(--amber-ink); }
.stage-label.tone-testing { color: var(--blue-ink); }
.stage-label.tone-in_use { color: var(--green-ink); }
.stage-label.tone-paused { color: var(--secondary); }

/* Home: the "This week" card */
.week { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 4px 24px; padding: 16px 22px; }
.week-head { display: flex; align-items: baseline; gap: 12px; }
.week-text { font-size: 16px; }
.week-by { grid-column: 2; color: var(--secondary); font-size: 13px; }

/* Home: the projects table. Every cell is a link to the project, so the whole row opens it without script. */
.table-card { padding: 6px 12px 8px; overflow-x: auto; }
.projects { width: 100%; min-width: 1040px; border-collapse: collapse; text-align: left; font-size: 14px; }
.projects thead th { padding: 14px 10px; font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap; }
/* Sortable headers, as on the Alterations dashboard. */
.projects th.sortable a { display: inline-flex; align-items: center; gap: 3px; color: inherit; text-decoration: none; }
.projects th.sortable .sort-arrow { display: inline-flex; }
.projects th.sortable .icon { opacity: .35; }
.projects th.sortable.is-sorted .icon, .projects th.sortable a:hover .icon, .projects th.sortable a:focus-visible .icon { opacity: .85; }
.projects th.sortable a:hover { color: var(--navy); }
.col-project { width: 24%; } .col-stage { width: 12%; } .col-next { width: 23%; } .col-waiting { width: 15%; } .col-result { width: 18%; } .col-portal { width: 8%; }
.projects .cell { padding: 0; font-weight: 400; border-bottom: 1px solid var(--border); vertical-align: middle; }
.projects tbody tr:last-child .cell { border-bottom: 0; }
.projects tbody tr:hover { background: var(--hover); }
.cell-link { display: flex; flex-direction: column; justify-content: center; min-height: 68px; height: 100%; padding: 12px 10px; color: var(--text); }
.cell-link:hover { color: var(--text); text-decoration: none; }
.cell-link .chip { margin-bottom: 2px; }
.project-name { font-size: 16px; font-weight: 600; color: var(--navy); }
.cell-link:hover .project-name, .cell-link:focus-visible .project-name { text-decoration: underline; }
.result-main { font-size: 18px; font-weight: 600; color: var(--navy); line-height: 1.3; }
.result-note { color: var(--secondary); font-size: 12px; }
.portal-cell { padding: 12px 10px !important; }
.portal-link { display: inline-flex; align-items: center; gap: 5px; padding: 8px 0; font-weight: 600; white-space: nowrap; }
.admin-row { display: flex; gap: 12px; margin-top: -4px; }
.archived h2 { margin-bottom: 6px; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }

/* Project page */
.project-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; }
.project-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 420px; }
.project-lead { margin-top: 2px; font-size: 14px; }
.lead-label { color: var(--secondary); font-size: 13px; margin-right: 4px; }
.what-list { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.project-next { display: flex; flex-direction: column; margin-top: 12px; font-size: 14px; }
.next-label { font-size: 12px; color: var(--secondary); }
.head-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.milestones { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 16px 6px; }
.milestone { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.milestone-bar { height: 6px; border-radius: 3px; background: var(--grey); }
.milestone-bar.tone-done { background: var(--green); }
.milestone-bar.tone-now { background: var(--amber); }
.milestone-title { font-weight: 600; }
.milestone-when { font-size: 13px; color: var(--secondary); }
.milestone-when.tone-done { color: var(--green-ink); font-weight: 600; }
.milestone-when.tone-now { color: var(--amber-ink); font-weight: 600; }
.project-columns { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.column-main { flex: 3 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.column-side { flex: 2 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.column-main:empty, .column-side:empty { display: none; }
.update { display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.update:last-child { border-bottom: 0; padding-bottom: 0; }
.update-date { flex: 0 0 72px; font-weight: 600; white-space: nowrap; }
.update.is-listed .update-date { flex-basis: 64px; }
.update-project { flex: 0 0 120px; font-weight: 600; color: var(--navy); }
.update-body { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.update-text { white-space: pre-line; overflow-wrap: anywhere; }
.update-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.edit-update { padding: 0; font-size: 13px; }
.result-block { margin-top: 12px; }
.result-figure { font-size: 28px; font-weight: 600; color: var(--navy); line-height: 1.15; }
.result-lines { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.result-lines div { display: flex; gap: 12px; }
.result-lines dt { flex: 0 0 72px; font-weight: 600; }
.result-lines dd { margin: 0; min-width: 0; }
.waiting-list { list-style: none; margin: 6px 0 0; padding: 0; }
.waiting-list li { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.waiting-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.who { font-weight: 600; white-space: nowrap; }

/* All updates */
.filter { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 16px; border-radius: 20px; border: 1px solid var(--input); color: var(--text); font-size: 14px; }
.filter-chip:hover { border-color: var(--navy); color: var(--navy); text-decoration: none; }
.filter-chip[aria-current="true"] { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.updates-month { max-width: 1040px; padding: 18px 22px 14px; }
.updates-month h2 { margin-bottom: 4px; }
.updates-month .update:last-child { padding-bottom: 4px; }

/* Check drafts */
.review-list { max-width: 960px; padding: 16px 22px 4px; }
.review-group-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.review-group-head .publish-all { margin-left: auto; }
.review-item { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-start; padding: 18px 0; border-bottom: 1px solid var(--border); }
.review-item:last-child { border-bottom: 0; }
.review-body { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.review-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 14px; }
.review-meta .date { font-weight: 600; }
.review-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.review-item.is-handled .review-body { color: var(--secondary); }
.checker-note { padding: 8px 12px; border-radius: 6px; background: var(--amber-bg); color: var(--amber-ink); font-size: 14px; }
.checker-note-label { font-weight: 600; }
.checker-note.in-form { margin-bottom: 16px; }
.outcome { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.outcome .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--paused); }
.outcome.is-published { color: var(--green-ink); }
.outcome.is-published .dot { background: var(--green); }
.outcome.is-skipped { color: var(--secondary); }

/* Forms */
.form-card { max-width: 960px; }
.form-card.narrow { max-width: 560px; }
.form-card h2 { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
.span-2 { grid-column: 1 / -1; }
.stacked-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: block; font-weight: 600; font-size: 14px; min-width: 0; }
.field input, .field select, .field textarea { display: block; width: 100%; min-height: 40px; margin-top: 6px; padding: 8px 12px; border: 1px solid var(--input); border-radius: 8px; background: #fff; color: var(--text); font: inherit; font-weight: 400; }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; align-self: end; min-height: 40px; }
.check input { width: 18px; height: 18px; margin: 0; }
fieldset.choice { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
fieldset.choice legend { padding: 0; margin-bottom: 4px; }
fieldset.choice .check { min-height: 32px; font-weight: 400; align-self: flex-start; }
.check input { display: inline-block; margin: 0; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.form-error { padding: 10px 14px; margin-bottom: 16px; border: 1px solid #f1d7d7; border-radius: 8px; background: #fff5f5; color: #9a3a3a; font-size: 14px; }
.stacked-form .form-error { margin: 0; }
.list-editor { display: flex; flex-direction: column; }
.list-form { display: grid; gap: 8px 16px; align-items: end; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list-form.is-new { border-bottom: 0; padding-bottom: 0; }
.waiting-form { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) 150px; }
.milestone-form { grid-template-columns: minmax(0, 3fr) minmax(0, 1.4fr) minmax(0, 1fr) 150px; }
@media (min-width: 721px) {
  .list-editor .list-form:not(:first-child) .label-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .list-editor .list-form:not(:first-child) .field input, .list-editor .list-form:not(:first-child) .field select { margin-top: 0; }
}
.list-form .field { font-size: 13px; font-weight: 400; color: var(--secondary); }
.list-form .field input, .list-form .field select { color: var(--text); font-size: 15px; }
.row-actions { display: flex; align-items: center; gap: 8px; }
.archive-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.archive-form .hint { font-size: 13px; }

/* People and History */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table thead th { font-weight: 600; white-space: nowrap; }
.data-table tbody th { font-weight: 600; }
.data-table tbody tr:last-child th, .data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .date { white-space: nowrap; }
.people-table .email { overflow-wrap: anywhere; }
.people-table .row-buttons { text-align: right; white-space: nowrap; padding-top: 6px; padding-bottom: 6px; }
.people-table tr.is-disabled th, .people-table tr.is-disabled td:not(.row-buttons) { color: var(--secondary); }
.history-value { max-width: 320px; overflow-wrap: anywhere; color: var(--secondary); white-space: pre-line; }

/* Sign in, password, errors */
.login-card { width: 100%; max-width: 440px; margin: 40px auto; padding: 30px; display: flex; flex-direction: column; gap: 12px; }
.login-card .stacked-form { margin-top: 8px; }
.login-note { padding-top: 16px; margin-top: 8px; border-top: 1px solid var(--border); font-size: 13px; color: var(--secondary); }
.credentials { margin: 0 0 16px; display: flex; flex-direction: column; gap: 12px; }
.credentials dt { font-size: 13px; color: var(--secondary); }
.credentials dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.credentials .secret { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 20px; letter-spacing: .5px; }
.form-card .secondary-text { margin-bottom: 16px; }

/* Phones and narrow windows: the table becomes one block per project (CSS only). */
@media (max-width: 720px) {
  .app-header { padding: 8px 16px 0; gap: 0 16px; }
  .app-nav { order: 3; width: 100%; gap: 0 12px; font-size: 13px; }
  .nav-count { margin-left: 4px; }
  .account-name { max-width: 40vw; }
  main.page { padding: 0 16px; margin-top: 16px; gap: 16px; }
  h1 { font-size: 23px; }
  .week { grid-template-columns: minmax(0, 1fr); padding: 14px 16px; }
  .week-by { grid-column: 1; }
  .card.table-card { padding: 0; overflow: visible; border: 0; }
  .projects { min-width: 0; }
  .projects thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .projects, .projects tbody, .projects tr, .projects .cell { display: block; width: 100%; }
  .projects tr { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; padding: 4px 0; }
  .projects .cell { border-bottom: 0; }
  .projects .cell.is-empty { display: none; }
  .projects .cell-link { min-height: 0; padding: 6px 14px; }
  .projects th.cell .cell-link { padding-top: 10px; }
  .projects td.cell[data-label]::before { content: attr(data-label); display: block; padding: 6px 14px 0; font-size: 12px; color: var(--secondary); }
  .projects td.cell[data-label] .cell-link { padding-top: 0; }
  .portal-cell { padding: 2px 14px 10px !important; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .waiting-form, .milestone-form { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; }
  .review-list, .updates-month { padding: 4px 16px; }
  .data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .data-table, .data-table tbody, .data-table tr, .data-table th, .data-table td { display: block; width: 100%; }
  .data-table tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
  .data-table tbody tr:last-child { border-bottom: 0; }
  .data-table th, .data-table td { padding: 2px 0; border-bottom: 0; }
  .data-table td[data-label]:not(:empty)::before { content: attr(data-label) ": "; color: var(--secondary); }
  .people-table .row-buttons { text-align: left; white-space: normal; }
  .history-value { max-width: none; }
  .update-date, .update.is-listed .update-date { flex-basis: auto; }
  .update-project { flex-basis: auto; }
  .login-card { margin: 16px auto; padding: 22px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
