.home-surface {
  --home-rule: #d0d7e2;
  --home-soft-ink: #475973;
  width: 100%;
  max-width: none;
  margin: 0;
  color: var(--ink);
}
.home-intro {
  margin-bottom: 20px;
  max-width: 760px;
}
.home-intro h1 {
  margin: 0;
  font-size: clamp(28px, 3vw, 36px);
  line-height: 1.13;
  letter-spacing: -1.6px;
}
.home-delegation {
  padding: 22px 24px 18px;
  border: 1px solid #c3cdda;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 5px 22px #19283c05;
}
.home-delegation label {
  font-size: 13px;
  color: var(--ink);
  margin: 0 0 8px;
}
.home-delegation textarea {
  border: 0;
  box-shadow: none;
  border-radius: 2px;
  padding: 0;
  min-height: 65px;
  font-size: 15px;
  line-height: 1.65;
  background: transparent;
}
.home-delegation textarea:focus {
  box-shadow: none;
}
.home-delegation textarea::placeholder {
  color: #7b90ae;
}
.home-delegation-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.home-primary {
  border: 1px solid var(--teal);
  border-radius: 4px;
  background: var(--teal);
  color: #fff;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
}
.home-primary:hover {
  background: #172f51;
}
.conversation-stop { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px; padding: 0; border: 1px solid var(--teal); border-radius: 50%; background: var(--teal); color: #fff; cursor: pointer; }
.conversation-stop:hover { background: #172f51; }
.conversation-stop:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.conversation-stop:disabled { opacity: .5; cursor: default; }
.conversation-stop > span { width: 12px; height: 12px; border-radius: 2px; background: currentColor; }
.home-secondary {
  border: 1px solid #c0cad9;
  border-radius: 4px;
  padding: 10px 14px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
}
.home-scope {
  margin: 9px 2px 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}
.home-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}
.home-section-heading h2 {
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -.6px;
  margin: 0;
}
.home-matter-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.home-matter-caption {
  display: block;
  color: #5c7496;
  font-size: 12px;
  margin: 0 0 6px;
}
.home-title-button {
  display: inline;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}
.home-title-button:hover {
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.home-text-button {
  padding: 0;
  border: 0;
  color: var(--teal);
  background: transparent;
  font-size: 12px;
  text-align: left;
  line-height: 1.6;
}
.home-text-button:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.home-matters {
  margin-top: 30px;
}
.home-matter-list {
  border-top: 1px solid var(--home-rule);
  margin-top: 18px;
}
.home-matter-row {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto;
  align-items: start;
  gap: 28px;
  padding: 21px 0;
  border-bottom: 1px solid var(--home-rule);
}
.home-matter-identity {
  min-width: 0;
  overflow-wrap: anywhere;
}
.home-matter-identity h3 {
  margin: 0 0 5px;
  font-size: 13px;
  font-weight: 600;
}
.home-matter-identity p {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}
.home-matter-update p {
  font-size: 12px;
  line-height: 1.75;
  margin: 0 0 8px;
  color: #546b8a;
}
.home-refresh-status {
  color: var(--muted);
  font-size: 13px;
  margin: 8px 0;
}
.home-empty {
  padding: 17px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}
@media (max-width: 1150px) {
  .home-section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }
  .home-matter-row {
    grid-template-columns: minmax(210px, .95fr) minmax(0, 1fr);
    gap: 20px;
  }
}
@media (max-width: 580px) {
  .home-intro h1 {
    font-size: 35px;
    letter-spacing: -1.8px;
  }
  .home-delegation {
    padding: 19px 17px 16px;
  }
  .home-delegation textarea {
    font-size: 14px;
    min-height: 85px;
  }
  .home-delegation-bottom {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
  }
  .home-primary {
    align-self: flex-start;
  }
  .home-matter-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
}
.home-delegation select {
  width: auto;
  max-width: 100%;
  min-height: 36px;
  margin: 10px 0 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-size: 12px;
}
.home-delegation select:focus-visible {
  outline: 3px solid #6b89b3;
  outline-offset: 3px;
}
.conversation-surface { max-width: none; }
.conversation-surface .home-intro h1 { font-size: 40px; }
.conversation-messages { display: grid; gap: 16px; margin: 22px 0; }
.conversation-turn { padding: 16px 20px; border-radius: 7px; background: var(--paper); border: 1px solid #d0d7e2; }
.conversation-turn p:last-of-type { white-space: pre-wrap; font-size: 14px; line-height: 1.75; margin: 0; overflow-wrap: anywhere; }
.conversation-user { margin-left: 40px; background: #e7ebf1; }
.conversation-assistant { margin-right: 40px; }
.conversation-heading { display: block; font-weight: 650; margin: .4em 0 .15em; }
.conversation-streaming-chunk { animation: conversation-text-fade 280ms ease-out; }
@keyframes conversation-text-fade { from { opacity: 0; } to { opacity: 1; } }
.conversation-progress { padding: 12px 14px; border-left: 2px solid #8fa1bb; border-radius: 4px; background: #f0f2f6; font-size: 13px; line-height: 1.5; }
.conversation-progress-status { margin: 0 0 8px; color: var(--teal); font-weight: 600; }
.conversation-progress ol { margin: 0; padding-left: 18px; }
.conversation-progress li + li { margin-top: 8px; }
.conversation-progress small { display: block; color: var(--muted); font-size: 11px; }
.conversation-progress a { text-underline-offset: 2px; }
.conversation-progress-history { margin-top: 10px; }
.conversation-progress-history > summary { cursor: pointer; font-size: 11px; color: var(--teal); }
.conversation-progress-history[open] > ol { margin-top: 8px; }
.conversation-approach { display: grid; gap: 12px; }
.conversation-approach .hint { font-size: 12px; line-height: 1.5; }
.conversation-approach h3 { cursor: pointer; }
.conversation-work { position: relative; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.conversation-work p { flex-basis: 100%; margin: 0; }
.conversation-work a { text-decoration: none; }
.conversation-directions { flex-basis: 100%; display: grid; gap: 12px; }
.conversation-directions h2 { font-size: 16px; margin: 0; }
.conversation-direction { display: grid; gap: 10px; padding: 14px 16px; border: 1px solid #d0d7e2; border-radius: 7px; background: var(--paper); }
.conversation-direction .saved-instruction { white-space: pre-wrap; overflow-wrap: anywhere; }
.conversation-direction summary { cursor: pointer; }
.conversation-direction-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.conversation-direction button:disabled { opacity: .5; cursor: default; }
@media (max-width: 580px) {
  .conversation-user { margin-left: 14px; }
  .conversation-assistant { margin-right: 14px; }
  .conversation-surface .home-intro h1 { font-size: 32px; }
}

.home-new-investigation { margin: 18px 0; }
.home-new-investigation > h3 { cursor: pointer; color: var(--teal); font-size: 14px; padding: 8px 0; }
.home-new-investigation .home-delegation { margin-top: 12px; }
.home-matter-update { text-align: right; }
@media (max-width: 580px) { .home-matter-update { text-align: left; } .home-intro h1 { font-size: 30px; } }

.workspace > main:has(> #home-view:not([hidden]) > .home-dashboard) {
  position: relative;
  padding-top: 20px;
}
main:has(> #home-view:not([hidden]) > .home-dashboard) > .app-help {
  position: absolute;
  top: 20px;
  right: 24px;
  margin: 0;
}
.home-dashboard .home-intro {
  max-width: none;
  padding-right: 75px;
  margin-bottom: 10px;
}
.home-dashboard .home-new-investigation {
  margin: 0 0 10px;
}

.home-dashboard .home-matters {
  margin-top: 12px;
}
.home-dashboard .home-section-heading {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}
.home-dashboard .home-matter-list {
  margin-top: 8px;
}
.home-dashboard .home-delegation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  padding: 14px 16px;
  margin-top: 4px;
}
.home-dashboard .home-delegation label,
.home-dashboard .home-delegation textarea {
  grid-column: 1 / -1;
  margin: 0;
}
.home-dashboard .home-delegation textarea {
  min-height: 54px;
}
.home-dashboard .home-delegation select,
.home-dashboard .home-delegation-bottom {
  margin: 0;
}
@media (max-width: 580px) {
  .home-dashboard .home-delegation {
    grid-template-columns: minmax(0, 1fr);
  }
  .home-dashboard .home-delegation-bottom {
    justify-self: end;
  }
}
.conversation-message-progress { padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; overflow: hidden; }
.conversation-message-progress > summary { display: flex; align-items: center; gap: 10px; padding: 11px 13px; cursor: pointer; list-style: none; color: var(--ink); }
.conversation-message-progress > summary::-webkit-details-marker { display: none; }
.conversation-message-progress > summary::after { content: ''; width: 6px; height: 6px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); flex: 0 0 auto; margin: 0 2px 3px 1px; }
.conversation-message-progress[open] > summary::after { transform: rotate(225deg); margin-top: 5px; }
.conversation-message-progress > summary:focus-visible { outline-offset: -3px; border-radius: 9px; }
.message-progress-indicator { display: grid; place-items: center; width: 16px; height: 16px; flex: 0 0 16px; border: 1.5px solid #bac6d5; border-radius: 50%; color: var(--teal); font-size: 11px; line-height: 1; }
[data-status="working"] > summary .message-progress-indicator { border-color: #d6dfeb; border-top-color: var(--teal); animation: message-progress-spin 1.1s linear infinite; }
[data-status="completed"] > summary .message-progress-indicator::after { content: '✓'; }
[data-status="failed"] > summary .message-progress-indicator::after { content: '!'; }
[data-status="waiting"] > summary .message-progress-indicator::after { content: '·'; }
.message-progress-copy { display: grid; gap: 2px; min-width: 0; flex: 1; }
.message-progress-title { font-size: 12px; font-weight: 600; }
.message-progress-latest { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.message-progress-count { flex: 0 0 auto; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.conversation-message-progress[open] > ol, .message-progress-history > ol { margin: 0; padding: 12px 16px 10px 34px; list-style: none; }
.conversation-message-progress[open] > ol { border-top: 1px solid var(--line); max-height: 220px; overflow-y: auto; overscroll-behavior: contain; }
.message-progress-history { border-top: 1px solid var(--line); }
.message-progress-history > summary { padding: 8px 13px; cursor: pointer; font-size: 11px; color: var(--teal); }
.message-progress-history > ol { max-height: 220px; overflow-y: auto; overscroll-behavior: contain; }
.conversation-message-progress li { position: relative; padding: 0 0 9px 5px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.conversation-message-progress li + li { margin-top: 0; }
.conversation-message-progress li:last-child { padding-bottom: 0; }
.message-progress-check::before { content: '·'; position: absolute; left: -20px; top: 1px; display: grid; place-items: center; width: 14px; height: 14px; font-size: 12px; line-height: 1; }
.conversation-message-progress li[data-status="completed"] > .message-progress-check::before { content: '✓'; color: var(--teal); }
.conversation-message-progress li[data-status="failed"] > .message-progress-check::before { content: '!'; color: #9a481f; border: 1px solid currentColor; border-radius: 50%; }
.conversation-message-progress li[data-status="interrupted"] > .message-progress-check::before { content: '−'; color: #7c6144; border: 1px solid currentColor; border-radius: 50%; }
.conversation-message-progress li[data-current="true"] { color: var(--ink); }
.conversation-message-progress li[data-status="running"] > .message-progress-check::before { content: ''; border: 1.5px solid #d6dfeb; border-top-color: var(--teal); border-radius: 50%; animation: message-progress-spin 1.1s linear infinite; }
.conversation-message-progress .message-progress-reused { display: inline; margin-left: 6px; font-size: 10px; }
@keyframes message-progress-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .conversation-streaming-chunk { animation: none; }
  [data-status="working"] > summary .message-progress-indicator, .conversation-message-progress li[data-status="running"] > .message-progress-check::before { animation: none; }
}

.conversation-elapsed, .conversation-answer-time { font-variant-numeric: tabular-nums; }
.conversation-answer-time { display: block; margin-top: 8px; }

/* Matters home: native chat activity, the question box and the matters table. */
.home-dashboard .home-intro { margin-bottom: 14px; }
.home-dashboard .home-intro h1 { font-size: 26px; letter-spacing: -.5px; }

.home-dashboard .home-new-investigation { margin: 0 0 22px; }
.home-dashboard .home-delegation { grid-template-columns: minmax(150px, 240px) minmax(0, 1fr) auto; align-items: center; gap: 10px; margin: 0; padding: 12px 14px; border-color: #dce5f0; border-radius: 10px; box-shadow: none; }
.home-dashboard .home-delegation > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.home-dashboard .home-delegation select { min-height: 40px; padding: 0 10px; border: 1px solid #dce5f0; border-radius: 8px; background: var(--paper); font-size: 13px; }
.home-dashboard .home-delegation textarea { grid-column: auto; min-height: 40px; max-height: 160px; padding: 9px 11px; border: 1px solid #dce5f0; border-radius: 8px; background: var(--paper); font-size: 14px; line-height: 1.45; field-sizing: content; resize: vertical; }
.home-dashboard .home-delegation textarea:focus { border-color: var(--teal); }
.home-dashboard .home-delegation .home-primary { min-height: 40px; padding: 0 16px; border-radius: 7px; }

.home-dashboard .home-matters { margin-top: 0; }
.home-dashboard .home-matters .home-section-heading { margin-bottom: 4px; }
.home-dashboard .home-matters .home-section-heading h2 { font-size: 17px; letter-spacing: -.2px; }
.home-dashboard .home-matters .home-section-heading .home-primary { padding: 8px 14px; border-radius: 7px; }
.home-matter-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 6px 0 10px; }
.home-matter-find { flex: 1 1 220px; max-width: 280px; min-height: 36px; padding: 7px 11px; border: 1px solid #dce5f0; border-radius: 8px; background: var(--paper); font-size: 13px; }
.home-matter-sort { width: auto; margin-left: auto; min-height: 32px; padding: 0 4px; border: 0; background: transparent; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.home-matter-table-wrap { position: relative; border: 1px solid #dce5f0; border-radius: 10px; background: var(--paper); }
.home-matter-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.home-matter-table th { padding: 8px 12px; border-bottom: 1px solid #dce5f0; background: #fbfcfe; color: var(--muted); font-size: 11.5px; font-weight: 500; text-align: left; white-space: nowrap; }
.home-matter-table th:first-child { border-top-left-radius: 10px; }
.home-matter-table th:last-child { border-top-right-radius: 10px; }
.home-matter-table td { padding: 10px 12px; border-bottom: 1px solid #e7edf5; vertical-align: middle; }
.home-matter-table tbody tr:last-child td { border-bottom: 0; }
.home-matter-table tbody tr:last-child td:first-child { border-bottom-left-radius: 10px; }
.home-matter-table tbody tr:last-child td:last-child { border-bottom-right-radius: 10px; }
.home-matter-table tbody tr:hover td { background: #f8fafd; }
.home-matter-table td.home-empty { padding: 14px 12px; }
.home-matter-name { min-width: 200px; overflow-wrap: anywhere; }
.home-matter-table .home-title-button { color: var(--teal); font-weight: 600; }
.home-matter-number, .home-matter-updated { white-space: nowrap; font-variant-numeric: tabular-nums; }
.home-matter-status { white-space: nowrap; }
.home-status-badge { display: inline-block; padding: 3px 9px; border-radius: 12px; background: #edf1f6; color: #475973; font-size: 12px; font-weight: 500; }
.home-status-badge[data-status="ready"] { background: #e7f3ed; color: #236044; }
.home-status-badge[data-status="processing"] { background: #eaf1fc; color: #254f83; }
.home-matter-actions { position: relative; width: 44px; text-align: right; }
.home-matter-menu > summary { padding: 2px 10px; border-radius: 6px; color: var(--muted); font-size: 16px; line-height: 1.4; list-style: none; cursor: pointer; }
.home-matter-menu > summary::-webkit-details-marker { display: none; }
.home-matter-menu > summary:hover, .home-matter-menu[open] > summary { background: var(--soft); color: var(--ink); }
.home-matter-menu-panel { position: absolute; top: calc(100% - 6px); right: 8px; z-index: 20; min-width: 170px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); box-shadow: 0 6px 20px #10264622; text-align: left; }
button.home-matter-rename, button.home-matter-delete { display: block; width: 100%; padding: 6px 10px; text-align: left; font-size: 13px; }
button.home-matter-rename { color: var(--teal); }
button.home-matter-delete { color: #a8321f; }
.home-matter-unavailable p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

.home-more { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 24px; margin-top: 14px; color: var(--muted); font-size: 13px; }
.home-more > :is(.home-deleted-matters, .home-scope) { margin: 0; padding: 0; border: 0; }
.home-more .home-deleted-matters > summary { padding: 4px 0; color: var(--muted); font-size: 13px; cursor: pointer; }
.home-more .home-deleted-matters > summary:hover { color: var(--ink); }
.home-more .home-empty { padding: 4px 0; }
.home-more > :is(details[open], :has(details[open])) { flex-basis: 100%; }
@media (max-width: 900px) {
  .home-matter-table-wrap { overflow-x: auto; }
  .home-matter-menu-panel { position: static; box-shadow: none; }
}
@media (max-width: 580px) {
  .home-dashboard .home-delegation { grid-template-columns: minmax(0, 1fr); }
  .home-matter-sort { margin-left: 0; }
}

.home-deleted-matters .home-matter-row { grid-template-columns: minmax(0, 1fr) auto auto; }
button.home-delete-forever { color: #a8321f; }

.home-matter-table .matter-library-actions { text-align: right; white-space: nowrap; }
