/* Salish — Puget Sound. Tokens taken from design/project/*.dc.html. */

:root {
  --ink: #0f1f1e;
  --ink-raised: #16403c;
  --ink-active: #123331;
  --ink-hairline: #1b403b;

  --page: #e9eeec;
  --card: #f7f9f8;
  --card-sunk: #eef3f1;
  --selected: #d7e7e2;

  --border: #c7d3cf;
  --border-input: #b5c4c0;
  --border-soft: #d9e2de;

  --accent: #86bfb2;
  --teal: #1f6f6a;
  --teal-deep: #12514d;
  --rust: #9c5540;

  --text: #0f1f1e;
  --text-strong: #243936;
  --text-muted: #4a5c59;
  --text-dim: #8ca29e;

  --radius: 2px;
  --bar-height: 64px;
  --column: 820px;

  --sans: "Archivo", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: var(--teal);
}
a:hover {
  color: var(--teal-deep);
}

button,
input,
select,
textarea {
  font-family: inherit;
  color: var(--text);
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-stretch: 125%;
  font-weight: 300;
  font-size: 36px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
  font-weight: 600;
}

p {
  margin: 0;
}

/* Layout ------------------------------------------------------------------ */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page {
  flex-grow: 1;
  padding: 32px;
}

.page--narrow {
  max-width: 940px;
  margin: 0 auto;
  width: 100%;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.stack--tight {
  gap: 12px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Top bar ----------------------------------------------------------------- */

.topbar {
  height: var(--bar-height);
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 56px;
  background: var(--ink);
  border-bottom: 1px solid var(--ink-hairline);
  color: #e9eeec;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #e9eeec;
}

.wordmark span {
  font-stretch: 125%;
  font-weight: 800;
  font-size: 26px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.topbar nav {
  display: flex;
  gap: 8px;
  flex-grow: 1;
  height: var(--bar-height);
}

.topbar nav a,
.topbar nav span {
  display: flex;
  align-items: center;
  height: var(--bar-height);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-dim);
  border-bottom: 2px solid transparent;
}

.topbar nav a:hover {
  color: #fff;
}

.topbar nav a[aria-current="page"] {
  color: #fff;
  border-bottom-color: var(--accent);
}

.topbar nav span[aria-disabled="true"] {
  color: #4f625e;
  cursor: not-allowed;
}

.avatar-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--ink-hairline);
  border-radius: var(--radius);
  background: var(--ink-raised);
  color: #e9eeec;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

/* Surfaces ---------------------------------------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card__intro {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-muted);
}

.muted {
  color: var(--text-muted);
  font-size: 14px;
}

.mono {
  font-family: var(--mono);
}

.label-mono {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* Forms ------------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-strong);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="number"],
.field select,
input.input {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 15px;
}

.field textarea,
textarea.input {
  padding: 12px 14px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 15px;
  line-height: 1.6;
  resize: vertical;
}

.field :is(input, select, textarea):focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: -1px;
}

.errors {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--rust);
  font-size: 13px;
}

.btn {
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--text-muted);
}

.btn--primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.btn--primary:hover {
  background: #17332f;
}

.btn--small {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

/* Messages ---------------------------------------------------------------- */

.notice {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 14px;
}

.notice--error {
  border-color: var(--rust);
  color: var(--rust);
}

/* Sign-in ----------------------------------------------------------------- */

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.auth__panel {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth__mark {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.auth__mark span {
  font-stretch: 125%;
  font-weight: 800;
  font-size: 26px;
  line-height: 1;
  letter-spacing: -0.04em;
}

/* Placeholder pages ------------------------------------------------------- */

.placeholder {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 28px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text-muted);
}

/* Onboarding and chat ------------------------------------------------------ */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

/* Chat fills the viewport and only the thread scrolls: a page scrollbar plus an
   inner one makes the newest message hard to keep in view. */
.onboarding {
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
}

.app--chat {
  height: 100vh;
  overflow: hidden;
}

.setup {
  background: var(--ink);
  color: #e9eeec;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.setup__progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setup__count {
  display: flex;
}

.setup__count span:first-child {
  flex-grow: 1;
}

.setup__count-now {
  color: #e9eeec;
}

.setup__bars {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 3px;
}

.setup__bar {
  height: 4px;
  background: var(--ink-hairline);
}

.setup__bar--done,
.setup__bar--now {
  background: var(--accent);
}

.setup__steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

.setup__step {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  padding: 0 10px;
  border-left: 2px solid transparent;
  font-size: 14px;
  color: var(--text-dim);
}

.setup__step--done {
  color: #b9cfc6;
}

.setup__step--now {
  border-left-color: var(--accent);
  background: var(--ink-active);
  color: #fff;
  font-weight: 500;
}

.setup__num {
  font-family: var(--mono);
  font-size: 11px;
  width: 18px;
  color: var(--text-dim);
}

.setup__label {
  flex-grow: 1;
}

.setup__meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 400;
}

.setup__foot {
  margin-top: auto;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
}

.talk {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  flex-grow: 1;
}

.talk__inner {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-height: 0;
  padding: 28px calc((100% - var(--column)) / 2) 24px;
  gap: 16px;
}

.thread {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex-grow: 1;
  min-height: 0;
  padding: 24px;
  background: #eff3f1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-y: auto;
}

.talk__input {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.msg {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.msg__avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.msg__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  font-size: 16px;
  line-height: 1.55;
}

.msg--mine {
  justify-content: flex-end;
}

.bubble {
  max-width: 560px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  line-height: 1.5;
}

/* Widgets and composer ----------------------------------------------------- */

.widget {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.widget__grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* One input per row. Two short fields side by side reads as a broken layout at
   this width, and every field then needs its own column rule. */
.widget__grid .field input[type="text"],
.widget__grid .field input[type="email"],
.widget__grid .field select,
.widget__grid .field textarea {
  width: 100%;
}

.widget__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.field--check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 400;
}

.field--check input {
  width: 16px;
  height: 16px;
  accent-color: var(--ink);
}

.entries {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card-sunk);
  border-radius: var(--radius);
  font-size: 15px;
}

.composer__box {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 10px 10px 16px;
  background: var(--card);
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(11, 19, 22, 0.05);
}

.composer__field {
  flex-grow: 1;
  display: flex;
}

.composer__field textarea {
  flex-grow: 1;
  border: 0;
  outline: none;
  resize: none;
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  background: transparent;
  padding-top: 4px;
}

.composer__send {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

/* Tracker ------------------------------------------------------------------ */

.tracker__head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
}

.tracker__head .stack {
  flex-grow: 1;
}

.tracker__head h1 {
  font-size: 40px;
  letter-spacing: -0.01em;
}

.tracker__head .btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--text);
}

.tracker__head .btn--primary {
  color: #fff;
}

.unit-toggle {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--border-soft);
  border-radius: var(--radius);
}

.unit-toggle button {
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.unit-toggle button[aria-pressed="true"] {
  background: var(--card);
  box-shadow: 0 1px 2px rgba(11, 19, 22, 0.08);
}

.columns {
  position: relative;
}

.columns summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  height: 42px;
}

.columns summary::-webkit-details-marker {
  display: none;
}

.columns__menu {
  position: absolute;
  right: 0;
  z-index: 5;
  margin-top: 6px;
  width: 220px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(11, 19, 22, 0.1);
}

.filters {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chip-btn {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.chip-btn.is-on {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  width: 280px;
  padding: 0 12px;
  background: var(--card);
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
}

.search input {
  border: 0;
  outline: none;
  font: inherit;
  font-size: 14px;
  flex-grow: 1;
  background: transparent;
}

.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  height: 44px;
  padding: 0 20px;
  background: #dde6e3;
  border-bottom: 1px solid var(--border);
}

.table th button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.table th[aria-sort="ascending"] button::after {
  content: " ↑";
}

.table th[aria-sort="descending"] button::after {
  content: " ↓";
}

.table td {
  height: 60px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 15px;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table tr:hover td {
  background: var(--card-sunk);
}

.table .num {
  text-align: right;
  font-family: var(--mono);
  font-size: 14px;
}

.table__link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

.table__link:hover {
  color: var(--teal);
}

.status-cell select {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 13px;
}

/* Job detail --------------------------------------------------------------- */

.detail__head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
}

.detail__head .stack {
  flex-grow: 1;
}

.detail__head .btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--text);
}

.detail__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.reqs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.reqs .entries {
  margin-top: 8px;
}

.posting {
  max-height: 520px;
  overflow: auto;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-strong);
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-sunk);
  font-family: var(--mono);
  font-size: 12px;
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 0;
  font-size: 14px;
}

.facts dt {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  align-self: center;
}

.facts dd {
  margin: 0;
}

.field--wide {
  grid-column: 1 / -1;
}

.req-row {
  display: grid;
  grid-template-columns: 120px 1fr max-content;
  align-items: center;
  gap: 12px;
}

.req-row input[type="text"],
.req-row select {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 14px;
}

.posting h3 {
  margin: 18px 0 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.posting h3:first-child {
  margin-top: 0;
}

.posting p {
  margin: 0 0 10px;
}

.posting ul {
  margin: 0 0 14px;
  padding-left: 18px;
}

.posting li {
  margin-bottom: 4px;
}

/* Apply editor ------------------------------------------------------------- */

.app--editor {
  height: 100vh;
  overflow: hidden;
}

.editor__bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 32px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.editor__job {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
}

.editor__job a {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.unit-toggle a {
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text);
}

.unit-toggle a[aria-selected="true"] {
  background: var(--card);
  box-shadow: 0 1px 2px rgba(11, 19, 22, 0.08);
}

.editor {
  flex-grow: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 0;
}

.editor__source {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
}

.editor__tools {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
}

.editor__tools button {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 13px;
  cursor: pointer;
}

.editor__status {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

#source {
  flex-grow: 1;
  border: 0;
  outline: none;
  resize: none;
  padding: 20px 24px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  background: var(--card);
}

.editor__preview {
  min-height: 0;
  overflow: auto;
  padding: 28px;
  background: var(--page);
}

.editor__preview svg {
  width: 100%;
  height: auto;
  background: #fff;
  box-shadow: 0 2px 10px rgba(11, 19, 22, 0.12);
}

.table-wrap--inline {
  max-width: 100%;
  overflow-x: auto;
}

.table--compact th,
.table--compact td {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.table--compact th {
  background: var(--card-sunk);
}

/* Dashboard (plain for V1) -------------------------------------------------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tile__n {
  font-family: var(--mono);
  font-size: 30px;
  line-height: 1;
}

/* Browsers without the File System Access API never get past the door. */

.card--unsupported {
  display: none;
}

[data-unsupported="true"] .card--unsupported {
  display: flex;
}

[data-unsupported="true"] .card--supported {
  display: none;
}

/* Typing indicator and sound control ---------------------------------------- */

.msg--typing .msg__avatar {
  background: var(--ink);
}

.dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  height: 32px;
}

.dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: dot 1.1s infinite ease-in-out;
}

.dots i:nth-child(2) {
  animation-delay: 0.16s;
}

.dots i:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes dot {
  0%, 60%, 100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dots i {
    animation: none;
    opacity: 0.5;
  }
}

.composer__mute {
  width: 36px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
}

.composer__mute:hover {
  color: var(--text-muted);
}

.composer__mute .cross {
  display: none;
}

.composer__mute[aria-pressed="true"] .wave {
  display: none;
}

.composer__mute[aria-pressed="true"] .cross {
  display: inline;
}
