.mail-section,
.mail-message {
  margin-top: 1.5rem;
}
.mail-composer {
  display: grid;
  gap: 1rem;
}
.mail-composer label {
  display: grid;
  gap: 6px;
}
.mail-composer textarea {
  font: inherit;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 100%;
  resize: vertical;
}
.mail-body {
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.mail-message > button {
  margin: 4px 8px 4px 0;
}
.mail-message input {
  max-width: 100%;
}
.mail-message pre {
  max-height: 32rem;
  overflow: auto;
}

.mail-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(200px, 1fr) minmax(220px, 1fr);
  gap: 24px;
  background: var(--surface);
  border: 0;
  padding: 24px;
  margin: 24px 0 32px;
}
.mail-toolbar label {
  font-size: 14px;
}
.mail-search-control {
  position: relative;
}
.mail-search-control input {
  padding-left: 42px;
}
.mail-search-icon {
  position: absolute;
  left: 14px;
  top: 13px;
  font-size: 27px;
  color: var(--ink);
  pointer-events: none;
}
.mail-group {
  padding: 14px 18px;
  margin-bottom: 10px;
}
.mail-group summary {
  cursor: pointer;
  font-weight: 650;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  list-style: none;
}
.mail-group summary .meta {
  font-weight: 400;
}
.mail-unread-count {
  margin-left: auto;
  background: var(--attention);
  color: var(--ink);
  min-width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.mail-group[open] summary {
  margin-bottom: 14px;
}
.mail-inline-reply:not(:empty) {
  margin-top: 24px;
  border-top: 2px solid var(--line);
  padding-top: 24px;
}
summary:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}
@media (max-width: 650px) {
  .mail-toolbar {
    grid-template-columns: 1fr;
    padding: 18px;
    gap: 18px;
  }
  .mail-group summary {
    gap: 10px;
    flex-wrap: wrap;
  }
  .mail-group summary .meta {
    font-size: 12px;
  }
}

.mail-composer input,
.mail-composer select,
.mail-composer textarea {
  font-size: 15px;
  font-weight: 400;
}
.mail-composer textarea {
  line-height: 1.55;
}

.mail-suggestions {
  margin: 14px 0 6px;
  color: var(--muted);
  font-size: 14px;
}
.mail-suggestions > button {
  display: block;
  text-align: left;
  margin: 8px 0;
  width: 100%;
  overflow-wrap: anywhere;
}
.mail-snackbar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  gap: 14px;
  align-items: center;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 14px 16px;
  background: var(--ink);
  color: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 24px #0003;
  font-size: 15px;
  line-height: 1.5;
}
.mail-snackbar.warning {
  color: var(--ink);
  background: var(--attention);
}
.mail-snackbar > span[role] {
  overflow-wrap: anywhere;
}
.mail-snackbar button {
  background: transparent;
  color: inherit;
  border: 0;
  padding: 4px 10px;
  font-size: 24px;
  flex-shrink: 0;
}
.snackbar-icon {
  font-weight: 700;
  font-size: 22px;
}
.mail-snackbar button:focus-visible {
  outline: 2px solid white;
}
@media (max-width: 650px) {
  .mail-snackbar {
    bottom: 16px;
    width: calc(100vw - 32px);
  }
}

.mail-bulk-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.mail-bulk-history {
  margin-top: 36px;
}
.mail-bulk > a {
  display: inline-block;
  margin: 16px;
}

.mail-message-status {
  display: inline-block;
  border-radius: 5px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 650;
  margin-bottom: 16px;
}
.mail-message-status.unread {
  background: var(--attention);
  color: var(--ink);
}
.mail-message-status.read {
  background: #edf0f2;
  color: var(--muted);
}
.mail-message-status.answered {
  background: var(--canvas);
  color: var(--ink);
}

.mail-outgoing-label {
  display: block;
  margin-bottom: 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0;
}

/* Inline composer header, with template choices anchored to the paste button. */
.mail-composer-fields {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(240px, 2fr) 36px;
  gap: 16px;
  align-items: end;
}
.mail-composer-fields > label {
  min-width: 0;
}
.mail-composer-fields input,
.mail-composer-fields select {
  width: 100%;
  margin: 0;
}
.mail-composer .mail-template-picker {
  position: relative;
  padding: 0;
  margin: 0;
  border: 0;
}
.mail-template-picker .template-trigger {
  width: 36px;
  height: 43px;
  padding: 6px;
}
.mail-template-picker .template-trigger[aria-expanded]::before {
  width: 22px;
  height: 22px;
  margin: 0;
  transform: none;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 4H5v17h14V4h-4M9 2h6v5H9zM8 11h8M8 15h8' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.template-options {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 5;
  width: min(400px, 70vw);
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 4px 14px #1e3d5914;
}
.template-options button {
  margin-top: 10px;
}
.template-options select {
  width: 100%;
}
@media (max-width: 700px) {
  .mail-composer-fields {
    grid-template-columns: minmax(0, 1fr) 36px;
  }
  .mail-composer-fields > label:first-child {
    grid-column: 1 / -1;
  }
}
.mail-template-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0;
}
.mail-template-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 24px 0;
}
.mail-template-list pre {
  max-height: 180px;
  overflow: auto;
}
.mail-template-list button + button {
  margin-left: 8px;
}

.mail-placeholder-definitions {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 2fr;
  gap: 12px 20px;
}
.mail-placeholder-definitions dt {
  font-weight: 650;
  overflow-wrap: anywhere;
}
.mail-placeholder-definitions dd {
  text-align: left;
  margin: 0;
}
.mail-placeholder-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(180px, 2fr) auto;
  gap: 12px;
  align-items: end;
  margin: 8px 0;
}
.mail-placeholder-row .meta {
  grid-column: 1 / -1;
}
.mail-placeholder-row label {
  margin: 0;
  display: grid;
  gap: 6px;
}
.mail-placeholder-row input,
.mail-placeholder-row textarea {
  width: 100%;
}
@media (max-width: 650px) {
  .mail-placeholder-definitions,
  .mail-placeholder-row {
    grid-template-columns: 1fr;
  }
  .mail-placeholder-row button {
    justify-self: start;
  }
}

.municipality-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.municipality-section > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}
.municipality-section > summary::-webkit-details-marker {
  display: none;
}
.municipality-section > summary h2 {
  margin: 0;
  font-size: 22px;
}
.municipality-section > summary p {
  margin: 8px 0 0;
}
.municipality-section[open] > summary {
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
  margin-bottom: 24px;
}
.municipality-section .detail-grid {
  margin-top: 0;
}
.municipality-section .detail-grid > .card {
  border-radius: 0;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.conversation-list-title {
  margin-bottom: 16px;
}
.conversation-table {
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.conversation-table table {
  min-width: 720px;
}
.conversation-table th,
.conversation-table td {
  padding: 14px 16px;
}
.conversation-table td:first-child {
  width: 35%;
}
.conversation-table .mail-unread-count {
  margin-left: 0;
}
.mail-section > .mail-composer {
  border-top: 1px solid var(--line);
  padding-top: 24px;
  margin-top: 24px;
}
.mail-composer > h3 {
  margin: 0;
}
.mail-composer > .notice {
  margin: 0;
}
.mail-composer > button {
  justify-self: start;
}
.mail-composer > p:empty {
  display: none;
}

.mail-group-latest {
  margin-left: auto;
  font-size: 12px;
}
.mail-group summary .mail-unread-count {
  margin-left: 0;
  min-width: 24px;
  height: 24px;
}
@media (max-width: 1000px) {
  .mail-group summary {
    flex-wrap: wrap;
    gap: 10px;
  }
  .mail-group-latest {
    margin-left: 0;
  }
  .mail-toolbar {
    grid-template-columns: 1fr 1fr;
  }
  .mail-toolbar > label:first-child {
    grid-column: 1 / -1;
  }
}

.conversation-title {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 12px 0;
}
.conversation-title :is(h1, h2, h3) {
  margin: 0;
  overflow-wrap: anywhere;
}
.conversation-title .conversation-refresh {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
}
.conversation-title .conversation-refresh::before {
  width: 22px;
  height: 22px;
  margin: 0;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 7v5h-5M4 17v-5h5M5 8a8 8 0 0 1 13-3l2 3M4 16l2 3a8 8 0 0 0 13-3' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.conversation-message > summary {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px 16px;
  cursor: pointer;
  list-style: none;
}
.conversation-message > summary::-webkit-details-marker {
  display: none;
}
.conversation-message > summary::before {
  margin: 0;
  align-self: center;
}
.message-heading-row {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) minmax(180px, 2fr);
  gap: 20px;
  align-items: baseline;
}
.message-time {
  font-size: 14px;
  white-space: nowrap;
}
.message-sender {
  font-size: 14px;
  overflow-wrap: anywhere;
}
.message-subject {
  font-weight: 500;
  overflow-wrap: anywhere;
}
.message-chips {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.message-chips .mail-message-status,
.message-chips .mail-outgoing-label {
  margin: 0;
}
.conversation-message[open] > summary {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 20px;
}
@media (max-width: 850px) {
  .message-heading-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

.mail-suggestions > .mail-conversation-suggestion {
  display: grid;
  grid-template-columns: 18px 1fr;
  text-align: left;
  gap: 4px 8px;
}
.mail-conversation-suggestion::before {
  grid-row: 1 / 3;
}
.mail-conversation-suggestion > span {
  grid-column: 2;
}

.mail-bulk-statistics {
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
}
.mail-bulk-statistics > div {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mail-bulk-statistics strong {
  font-size: 18px;
  font-weight: 500;
}

.mail-template-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.mail-template-tokens label {
  flex: 1;
  min-width: 220px;
}
.mail-placeholder-levels {
  display: grid;
  gap: 24px;
}
.mail-placeholder-levels > .municipality-section,
.mail-template-list > .mail-group {
  margin: 0;
}
.mail-placeholder-row {
  padding: 8px 0;
  border-radius: 0;
  border-left: 0;
  border-bottom: 1px solid var(--line);
}
.mail-placeholder-row .meta:empty {
  display: none;
}
.mail-placeholder-row input,
.mail-placeholder-row textarea {
  padding: 6px 8px;
  min-height: 36px;
}
.mail-placeholder-row .mail-save-icon {
  width: 36px;
  height: 36px;
  padding: 6px;
  background-image: none;
}
.mail-placeholder-row .mail-save-icon::before {
  width: 22px;
  height: 22px;
  margin: 0;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 3h12l4 4v14H3V3h2zm2 0v6h10V3M7 21v-8h10v8' fill='none' stroke='black' stroke-width='1.7' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.draft-warning {
  border: 0;
  border-radius: var(--radius);
  padding: 28px;
  max-width: min(520px, calc(100vw - 32px));
  color: var(--ink);
  background: var(--surface);
}
.draft-warning::backdrop {
  background: rgb(30 61 89 / 35%);
}
.draft-warning h2 {
  margin-top: 0;
  font-size: 22px;
}
.draft-warning-actions {
  display: flex;
  justify-content: flex-end;
  gap: 20px;
  margin-top: 24px;
}

.journal-filters {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}
.journal-filters input,
.journal-filters select {
  width: 100%;
}
@media (max-width: 850px) {
  .journal-filters {
    grid-template-columns: 1fr 1fr;
  }
}

.journal-table td:first-child {
  width: auto;
}
.journal-table td {
  overflow-wrap: anywhere;
  max-width: 320px;
}
.journal-table p {
  margin: 4px 0 0;
}

.journal-table {
  background: var(--surface);
}
.journal-table td:nth-child(2) {
  white-space: nowrap;
}

.mail-send-actions,
.inquiry-assignment {
  display: flex;
  align-items: end;
  gap: 16px;
  margin: 16px 0;
}
.mail-send-actions label,
.inquiry-assignment label {
  min-width: 260px;
}
.inquiry-assignment {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.inquiry-assignment a {
  flex: 1;
}
.inquiry-template-choices {
  border: 0;
  padding: 0;
  margin: 12px 0;
}
.inquiry-template-choices label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}
.inquiry-template-choices input {
  width: auto;
}

/* Status systems share the existing flat disclosure and form language. */
.status-value,
.status-history-entry {
  border-bottom: 1px solid var(--border, #d9d5c9);
  padding: 0.65rem 0;
}
.status-value > summary {
  cursor: pointer;
  padding: 0.4rem 0;
}
.status-fields {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0.6rem 1rem;
  padding: 0.7rem 0;
}
.status-fields label:has(textarea) {
  grid-column: 1 / -1;
}
.status-fields label:has(input[type='checkbox']) {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.status-fields input[type='checkbox'] {
  width: auto;
}
.status-change {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 0.6rem 1rem;
  margin: 0.6rem 0;
}
.status-change label:has(textarea),
.status-change p {
  grid-column: 1 / -1;
}
.status-change button {
  justify-self: start;
}
.case-status-panel {
  margin: 0.6rem 0;
}
.case-status-chip {
  background: #ffc13b33;
  border-color: #ffc13b;
}
.status-history > summary {
  cursor: pointer;
  padding: 0.6rem 0;
  border-bottom: 1px solid #ff6e40;
}
@media (max-width: 700px) {
  .status-fields,
  .status-change {
    grid-template-columns: 1fr;
  }
}
.status-value > summary,
.status-history summary {
  list-style: none;
}
.status-value > summary::-webkit-details-marker,
.status-history summary::-webkit-details-marker {
  display: none;
}

.inline-admin-editor:not(:empty) {
  margin-top: 20px;
  padding: 20px 0 0 20px;
  border-top: 1px solid var(--line);
  border-left: 3px solid var(--attention);
}
.inline-admin-editor > .card {
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
}
.inquiry-unassigned {
  margin-top: 32px;
  border-top: 3px solid var(--attention);
}
.case-status-panel {
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
  margin-bottom: 24px;
}
.status-dialog {
  width: min(760px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 0;
  border-top: 4px solid var(--accent, #ff6e40);
  border-radius: 6px;
  padding: 24px;
  color: var(--ink);
  background: var(--surface);
}
.status-dialog::backdrop {
  background: #1e3d5966;
}
.status-dialog h2 {
  margin-top: 0;
}
.status-dialog-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
.status-dialog-fields label {
  flex: 0 1 300px;
  min-width: 0;
}
.status-dialog-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.status-dialog-form > label {
  margin-top: 16px;
}
.status-dialog-form textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 180px;
}
.status-dialog-actions {
  display: flex;
  gap: 20px;
  margin-top: 20px;
}
.status-history-table td {
  vertical-align: top;
}
.status-history-table td:nth-child(4) {
  white-space: pre-wrap;
  min-width: 180px;
}
.status-audit summary {
  list-style: none;
  font-weight: normal;
}
.status-audit summary::-webkit-details-marker {
  display: none;
}

/* Shared section rhythm for case history and conversations. */
.case-section-title {
  min-height: 32px;
  margin: 0 0 16px;
  gap: 16px;
}
.case-section-title h3 {
  font-size: 18px;
  font-weight: 500;
}
.case-section-title > button {
  margin: 0;
}
.status-history-table td:first-child {
  width: auto;
}
.status-history-table td:nth-child(2) {
  white-space: nowrap;
}
.case-section-title [data-direction='down']::before {
  transform: rotate(90deg);
}

.mail-problems .table-wrap {
  background: var(--surface);
}
.mail-problems > h3 {
  margin: 24px 0 12px;
}

.campaign-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(12rem, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.campaign-item-editor {
  background: #fff;
}
.campaign-item-editor {
  display: grid;
  gap: 0.75rem;
  padding: 1rem 0;
}
.campaign-item-editor textarea {
  width: 100%;
  box-sizing: border-box;
}
.campaigns .mail-actions {
  margin: 1rem 0;
}
.campaigns td {
  vertical-align: top;
}
.campaigns details {
  min-width: 22rem;
}
.campaigns pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.campaign-form {
  background: transparent;
}
.campaign-section-body {
  padding: 0;
}
.campaign-technical {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}
.campaign-pacing {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.campaign-pacing > label {
  flex: 0 0 10rem;
}
.campaign-pacing > .meta {
  margin: 0;
}
.campaign-fields label {
  min-width: 0;
}
.campaign-fields input,
.campaign-fields select {
  width: 100%;
  box-sizing: border-box;
}
@media (max-width: 700px) {
  .campaign-fields {
    grid-template-columns: 1fr;
  }
}

/* Campaign tables use the same white rows and sticky headings as the directory. */
.campaigns .table-wrap {
  background: var(--surface);
}
.campaigns .campaign-message-row[hidden] {
  display: none;
}
.campaign-message-row > td {
  padding-top: 0;
}
.campaign-item-editor input:not([type='checkbox']) {
  width: 100%;
  box-sizing: border-box;
}
.campaign-item-editor :is(input, textarea)::selection {
  background: var(--accent);
  color: var(--ink);
}

/* Shared dispatch rhythm: same compact titles, white tables and form spacing as mail. */
.mail-dispatch-section {
  margin: 24px 0;
}
:is(.campaigns, .mail-problems, .mail-journal) .table-wrap {
  background: var(--surface);
}
:is(.campaigns, .mail-problems) .conversation-title > button:not(.conversation-refresh) {
  margin-left: auto;
}
.campaigns .campaign-fields {
  gap: 16px;
  margin: 0 0 20px;
}
.campaigns .campaign-technical {
  padding-top: 20px;
  margin-bottom: 0;
}
.campaigns .campaign-item-editor {
  gap: 12px;
  padding: 12px 0;
}
.campaigns .campaign-item-editor > button {
  justify-self: start;
}
.campaigns .campaign-message-row:hover {
  background: var(--surface);
}
.mail-problems td > .meta {
  margin: 4px 0 0;
}
.mail-problems > .meta {
  margin: 8px 0 16px;
}

.assignment-dialog > label:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 16px 0;
}
.assignment-dialog > label > :is(input, select, textarea) {
  box-sizing: border-box;
  width: 100%;
}
.assignment-dialog > label > textarea {
  min-height: 100px;
  resize: vertical;
}

.operation-error {
  font-weight: 700;
  color: #a02323;
}
.operation-warning {
  font-weight: 600;
}

/* V1 operational surfaces reuse the existing cream/white, blue and orange design. */
.mail-inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px 20px;
}
.mail-inline-form > label {
  flex: 1 1 220px;
}
.mail-inline-form > button {
  flex: 0 1 auto;
}
#mail-health {
  font-size: 13px;
  line-height: 1.5;
}
.mail-health > strong {
  color: var(--ink);
  font-weight: 600;
}
.mail-health ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  padding-left: 18px;
  margin: 8px 0;
}
.mail-health-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 12px;
}
.mail-health > small {
  display: block;
  margin-top: 8px;
  font-size: 12px;
}
.mail-panel {
  background: var(--surface);
  padding: 24px;
  border-radius: var(--radius);
  margin: 24px 0;
}
.mail-panel > h3 {
  font-size: 19px;
  margin-bottom: 16px;
}
.mail-panel > label {
  display: block;
  max-width: 480px;
  margin-bottom: 20px;
}
.mail-panel > .table-wrap {
  margin-top: 20px;
}
.mail-disclosure {
  margin: 16px 0;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  min-width: 0;
}
.mail-disclosure > summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  list-style: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  padding: 8px 0;
}
.mail-disclosure > summary::-webkit-details-marker {
  display: none;
}
.mail-disclosure > summary::before {
  margin: 0;
  align-self: center;
}
.mail-disclosure[open] > summary {
  margin-bottom: 16px;
}
.mail-disclosure .disclosure-body > :first-child {
  margin-top: 0;
}
.mail-disclosure .disclosure-body > :last-child {
  margin-bottom: 0;
}
.card.mail-disclosure {
  border: 0;
  padding: 20px 24px;
}
.card.mail-disclosure > summary {
  padding: 0;
}
.mail-disclosure .meta {
  font-size: 13px;
}
.mail-actions,
.mail-template-actions,
.status-dialog-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
}
.mail-actions > button + button,
.mail-template-actions > button + button,
.status-dialog-actions > button + button {
  margin-left: 0;
}
.mail-actions > a {
  display: inline-block;
  padding: 8px 0;
  font-size: 14px;
}
main button:not(.conversation-refresh):not(.mail-icon-button):not(.template-trigger),
.status-dialog button:not(.conversation-refresh) {
  min-height: 40px;
  padding: 8px 10px;
  line-height: 1.5;
  font-size: 14px;
  text-align: left;
  max-width: 100%;
  overflow-wrap: anywhere;
}
main .meta,
main .notice {
  font-size: 13px;
}
main .notice {
  line-height: 1.6;
}
.mail-settings {
  margin-top: 24px;
}
.mail-settings > .notice {
  margin: 0;
}
.mail-fieldset {
  border: 0;
  border-top: 1px solid var(--line);
  padding: 20px 0 0;
  margin: 16px 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 24px;
  min-width: 0;
}
.mail-fieldset legend {
  font-size: 19px;
  padding: 0 12px 0 0;
}
.mail-fieldset > label:has(input[type='checkbox']),
.mail-fieldset > label:has(input[type='email']) {
  grid-column: 1 / -1;
}
.mail-fieldset > label:has(input[type='checkbox']) {
  margin: 0;
  padding: 8px 0;
}
.mail-settings > button {
  margin-top: 8px;
}
.contact-editor[open] > summary {
  padding-bottom: 16px;
  margin-bottom: 16px;
}
.contact-editor > .meta {
  margin: 0 0 16px;
}
.contact-editor-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  max-width: none;
  gap: 12px 16px;
  border-color: var(--line);
  padding: 0 0 16px;
}
.contact-editor-form > label:not(:has(input[type='checkbox'])) {
  display: grid;
  flex: 1 1 220px;
  gap: 6px;
  min-width: 0;
  margin: 0;
}
.contact-editor-form input:not([type='checkbox']),
.contact-editor-form select {
  width: 100%;
  min-width: 0;
}
.contact-editor-form > label:has(input[type='checkbox']) {
  flex-basis: 100%;
  margin: 0;
}
.contact-editor-form button {
  flex: 0 0 auto;
  margin: 0;
  max-width: 100%;
}
.mail-disclosure .contact-editor-form {
  border: 0;
  padding: 0;
}
.contact-editor-form + .mail-disclosure {
  border-top: 0;
}
.mail-review-dialog > div > label:not([hidden]),
.mail-review-dialog section > label:not([hidden]),
.delivery-report > label:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}
.mail-review-dialog > div > label:has(input[type='checkbox']) {
  flex-direction: row;
}
.mail-review-dialog > button {
  margin-top: 20px;
}
.mail-review-dialog section {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 24px;
}
.status-dialog {
  overflow-wrap: anywhere;
}
.status-dialog label {
  min-width: 0;
}
.status-dialog input:not([type='checkbox']),
.status-dialog select,
.status-dialog textarea {
  width: 100%;
  min-width: 0;
}
.status-dialog .table-wrap {
  max-width: 100%;
}
.assignment-dialog > label:has(input[type='checkbox']) {
  flex-direction: row;
}
.assignment-dialog > button {
  margin-top: 12px;
  margin-bottom: 12px;
}
.assignment-dialog > div:not(:empty) {
  margin: 16px 0;
}
.message-metadata:empty {
  display: none;
}
.message-metadata {
  margin: 20px 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.message-metadata h3 {
  font-size: 16px;
  margin: 0 0 12px;
}
.message-metadata > .notice:first-child {
  margin-top: 0;
}
.attachment-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.attachment-list > li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.attachment-list strong {
  font-weight: 500;
  font-size: 14px;
}
.attachment-list .mail-disclosure {
  border: 0;
  margin: 4px 0 0;
  padding: 0;
}
.attachment-list summary {
  font-size: 13px;
  color: var(--muted);
}
.balance-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 24px;
  margin: 24px 0 16px;
}
.balance-summary .card {
  min-width: 0;
  border: 0;
}
.balance-summary h2 {
  font-size: 19px;
  margin-bottom: 20px;
}
.balance-summary .balance-highlights {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 24px;
}
.balance-highlights > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.balance-highlights dt {
  font-size: 13px;
  line-height: 1.4;
}
.balance-highlights dd {
  order: -1;
  text-align: left;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.balance-counts {
  font-size: 14px;
  line-height: 1.5;
}
.balance-counts dd {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.mail-balance > h2 {
  margin: 32px 0 20px;
}
.balance-filter {
  max-width: 640px;
  margin-bottom: 20px;
}
.balance-filter > p {
  margin: 0 0 12px;
}
.mail-balance td {
  vertical-align: top;
}
.mail-balance td .meta {
  margin: 8px 0 0;
}
.mail-balance td strong {
  font-weight: 500;
}
.mail-balance td .mail-actions {
  flex-direction: column;
  align-items: start;
  gap: 8px;
}
.mail-balance .conversation-title {
  justify-content: space-between;
  flex-wrap: wrap;
}
.campaigns td > a,
.campaigns td > button {
  display: block;
  margin-top: 12px;
}
.campaign-detail-toggle {
  min-width: 0;
}
.campaign-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.campaign-fields > *,
.campaign-section-body,
.campaign-form {
  min-width: 0;
}
.mail-problems > h3 {
  margin-top: 32px;
}
@media (max-width: 700px) {
  .mail-panel,
  .card.mail-disclosure,
  .card.mail-settings {
    padding: 20px;
  }
  .mail-fieldset,
  .campaign-fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .mail-health ul {
    display: block;
  }
  .mail-health li + li {
    margin-top: 4px;
  }
  .balance-summary {
    grid-template-columns: minmax(0, 1fr);
  }
  .balance-summary .card {
    padding: 20px;
  }
  .mail-inline-form > label {
    flex-basis: 100%;
  }
  .status-dialog {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    padding: 20px;
  }
  .conversation-title {
    flex-wrap: wrap;
  }
  .mail-actions {
    gap: 8px 12px;
  }
}

.mail-send-actions,
.inquiry-assignment {
  flex-wrap: wrap;
}
.mail-send-actions label,
.inquiry-assignment label {
  min-width: 0;
  flex: 1 1 260px;
  max-width: 100%;
}
.mail-composer {
  grid-template-columns: minmax(0, 1fr);
}
.mail-composer > * {
  min-width: 0;
}
.campaign-detail-toggle > summary {
  display: flex;
  align-items: baseline;
  list-style: none;
  line-height: 1.5;
}
.campaign-detail-toggle > summary::-webkit-details-marker {
  display: none;
}
.mail-review-dialog .conversation-table table {
  min-width: 600px;
}
.mail-panel > h2 {
  margin-bottom: 16px;
}
@media (max-width: 700px) {
  .inquiry-assignment > button {
    margin-left: 0;
  }
  .mail-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }
  .mail-toolbar > * {
    min-width: 0;
  }
}

/* Test administration lives in settings; operational pages retain only the status hint. */
.test-mode > .intro {
  max-width: 900px;
  margin-bottom: 20px;
}
.test-mode .mail-inline-form {
  max-width: 900px;
}
.test-mode .mail-inline-form > label {
  flex: 1 1 320px;
}
#mail-health .mail-health-actions {
  align-items: center;
}
#mail-health .mail-health-actions button {
  font-size: 13px;
  padding: 6px 8px;
  margin: 0;
}
.inbox-scope {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}
.inbox-scope > p {
  flex: 1 1 320px;
}

.balance-explanation {
  margin: 12px 0 24px;
  line-height: 1.6;
}
.balance-overview + .mail-disclosure {
  margin-top: 24px;
}

.mail-review-dialog form label:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}
.mail-review-dialog .review-section {
  min-width: 0;
  border: 0;
  border-top: 1px solid var(--line);
  padding: 16px 0 0;
  margin: 24px 0 0;
}
.mail-review-dialog .review-section > legend {
  padding: 0 12px 0 0;
  font-weight: 600;
}
.mail-review-dialog .status-dialog-actions {
  margin-top: 24px;
}
.mail-review-dialog [role='alert']:not([hidden]) {
  margin-top: 24px;
}

.campaigns .campaign-run-panel {
  min-width: 0;
}
.campaign-run-panel > summary {
  font-size: 19px;
}
.campaign-run-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 24px 32px;
  margin-bottom: 24px;
}
.campaign-run-overview h3 {
  margin: 0 0 12px;
  font-size: 15px;
}
.campaign-run-facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin: 0;
}
.campaign-run-facts > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
  gap: 12px;
  align-items: baseline;
}
.campaign-run-facts dt {
  color: var(--muted);
  font-size: 13px;
}
.campaign-run-facts dd {
  margin: 0;
  text-align: left;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.campaign-message-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 24px;
  padding-bottom: 20px;
}
.campaign-message-toolbar > label {
  display: grid;
  gap: 8px;
  flex: 0 1 320px;
  min-width: 0;
  margin: 0;
}
.campaign-message-toolbar select {
  width: 100%;
  min-width: 0;
}
.campaign-message-toolbar > .mail-actions {
  flex: 1 1 320px;
  gap: 8px 16px;
}

/* Current substantive answer, within its municipal inquiry group. */
.case-response-panel {
  margin: 0 0 24px;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--line);
}
.response-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.6;
}
.response-form {
  display: grid;
  gap: 0.75rem;
}
.response-form > :is(p, .case-section-title) {
  margin: 0;
}
.response-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 5rem;
}
.response-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}
.response-feedback:empty {
  display: none;
}

/* Structured response capture: one inquiry, one active section and draft. */
.response-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
}
main .case-response-panel .response-tabs button[aria-pressed='true'] {
  background: var(--soft);
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
  border-left: 3px solid var(--accent);
}
main .case-response-panel .response-tabs button::before {
  display: none;
}
.response-source-preview {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 0.8rem;
}
.response-context .disclosure-body {
  display: grid;
  gap: 0.75rem;
}
.response-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}
.response-main,
.response-context,
.response-item-body,
.response-significance {
  display: grid;
  gap: 0.8rem;
  min-width: 0;
}
.response-form h4 {
  margin: 0;
  font-size: 15px;
}
.response-context {
  padding: 0;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}
.response-context p {
  margin: 0;
}
.response-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}
.response-items {
  display: grid;
  gap: 1rem;
}
.response-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.response-significance {
  align-content: start;
}
.response-form .response-check {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 0.55rem;
  font-size: 13px;
}
.response-form .response-check input {
  width: auto;
  margin: 0;
}
.response-reference {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.response-reference span {
  flex-basis: 100%;
}
.response-source-list {
  display: grid;
  gap: 0.5rem;
  margin: 0.5rem 0;
}
.response-source-list button {
  text-align: left;
  white-space: normal;
}
.response-source-body {
  max-height: 320px;
  overflow: auto;
  font-size: 12px;
}
.response-notice {
  padding: 0.75rem 1rem;
  border-left: 3px solid #b17c23;
  background: #fff7e7;
  font-size: 13px;
}
.response-form button {
  padding: 0.55rem 0.8rem;
}
.response-significance [hidden] {
  display: none;
}
.response-layout[data-sources='closed'] > .response-context {
  position: absolute;
  top: 0;
  right: 0;
}
.response-layout[data-sources='closed'] .response-section-heading {
  padding-right: 190px;
}
.response-context > .mail-disclosure {
  margin: 0;
  padding: 0;
  border: 0;
}
.response-context > .mail-disclosure > summary {
  padding: 0;
  font-size: 13px;
}
.response-main > .mail-disclosure {
  margin: 0;
  padding-top: 0.35rem;
}
.response-layout[data-sources='open'] {
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
}
.response-layout[data-sources='open'] > .response-context {
  padding: 0.8rem;
  background: var(--canvas);
}
.response-section-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--line);
}
.response-form .response-item > summary {
  margin-bottom: 0;
  cursor: pointer;
  padding: 0.7rem 0.9rem;
  background: var(--canvas);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.response-item > summary > * {
  margin-right: 0.65rem;
}
.response-item > summary strong {
  color: var(--ink);
}
.response-item-fields {
  display: grid;
  gap: 0.8rem;
  padding: 0.9rem;
}
.response-item .response-significance {
  border-top: 1px solid var(--line);
  padding-top: 0.65rem;
}
.response-footer {
  display: grid;
  gap: 0.5rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--canvas);
}
.response-footer p {
  margin: 0;
}
.response-form label {
  gap: 0.3rem;
}
.response-form .response-grid {
  gap: 0.6rem 1rem;
}
@media (max-width: 1100px) {
  .response-layout[data-sources='open'] {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  .response-layout[data-sources='closed'] > .response-context {
    position: static;
    grid-row: 1;
    justify-self: end;
  }
  .response-layout[data-sources='closed'] .response-section-heading {
    padding-right: 0;
  }
  .response-grid {
    grid-template-columns: 1fr;
  }
  .response-tabs button {
    flex: 1 1 100%;
  }
}

/* Inquiry statistics: shared typography and controls, readable chart labels. */
.statistics-view {
  width: 100%;
}
.statistics-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem 1.25rem;
  align-items: end;
  margin-block: 1.5rem;
}
.statistics-filters label {
  display: grid;
  gap: 0.4rem;
}
.statistics-filters button {
  justify-self: start;
  margin-block: 0.35rem;
}
.statistics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 1.25rem;
  margin-block: 1.5rem;
}
.statistics-card {
  min-width: 0;
  margin-block: 1rem;
}
.statistics-card h3 {
  margin-top: 0;
}
.statistics-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 1rem;
  margin-block: 1.5rem;
}
.statistics-tiles > div {
  border-left: 3px solid var(--accent, #eb804b);
  padding: 0.35rem 0.85rem;
}
.statistics-tiles dt {
  font-size: 0.85rem;
}
.statistics-tiles dd {
  margin: 0.4rem 0 0;
  font-size: 1.5rem;
  font-weight: 650;
}
.statistics-bars {
  margin-block: 1.5rem;
}
.statistics-bars h4 {
  margin-bottom: 0.3rem;
  font-size: 1rem;
}
.statistics-bars ul {
  list-style: none;
  padding: 0;
}
.statistics-bars li {
  margin-block: 0.9rem;
}
.statistics-bar-label {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
  font-size: 0.85rem;
}
.statistics-bar-label strong {
  font-weight: 500;
}
.statistics-track {
  background: #eeeadd;
  border-radius: 3px;
  height: 6px;
  margin-top: 0.4rem;
  overflow: hidden;
}
.statistics-track span {
  display: block;
  background: #385566;
  height: 100%;
}
.statistics-view .mail-disclosure {
  margin-block: 1rem;
}

.person-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
}
.person-fields input,
.person-fields select {
  width: 100%;
  box-sizing: border-box;
}
.person-dialog .notice {
  white-space: normal;
}
.person-proposal {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.person-proposal button {
  margin-left: auto;
}
.municipality-people {
  margin: 0;
}
.municipality-people > summary h2 {
  margin: 0;
}
.municipality-people .table-wrap {
  margin-top: 16px;
}
@media (max-width: 600px) {
  .person-fields {
    grid-template-columns: 1fr;
  }
}

.person-dialog textarea {
  min-height: 80px;
}
.person-dialog .status-dialog-actions {
  flex-wrap: wrap;
  gap: 12px;
}
.person-dialog label:has(input[type='checkbox']) {
  flex-direction: row;
  align-items: center;
}

.bulk-response-capture > .case-response-panel {
  margin: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.bulk-response-capture {
  border-left-color: var(--accent);
}

/* Reply drafts use the same dialog and campaign hierarchy as existing admin forms. */
.reply-draft-dialog {
  width: min(960px, calc(100vw - 48px));
}
.reply-draft-dialog .campaign-item-editor {
  background: transparent;
}
.reply-draft-dialog label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.reply-draft-dialog label:has(input[type='checkbox']) {
  flex-direction: row;
  justify-content: flex-end;
  align-items: baseline;
  gap: 10px;
}
.reply-draft-dialog .reply-source {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.reply-draft-dialog .reply-source .mail-body {
  max-height: 18rem;
  overflow: auto;
}
.reply-draft-dialog .campaign-item-editor > button {
  justify-self: start;
}

.reply-draft-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 12px 16px;
}
.reply-draft-fields .reply-draft-subject {
  grid-column: 1 / -1;
}
.reply-run-facts {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 24px;
}
.reply-run-facts > div {
  display: block;
}
.reply-run-facts dd {
  margin-top: 4px;
}
@media (max-width: 700px) {
  .reply-draft-fields,
  .reply-run-facts {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* One compact attachment disclosure shared by municipality, message and capture. */
.case-attachments {
  margin: 1rem 0;
}
.case-attachments .disclosure-body {
  padding: 1rem;
}
.attachment-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.75rem 0 1rem;
}
.attachment-toolbar label {
  display: grid;
  gap: 0.35rem;
  max-width: 100%;
}
.attachment-toolbar select {
  max-width: 34rem;
  width: 100%;
}
.attachment-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  min-width: 9rem;
}
.attachment-actions :is(button, a) {
  margin: 0;
  padding: 0.45rem 0.7rem;
  line-height: 1.3;
  white-space: nowrap;
}
.attachment-actions a {
  text-decoration: underline;
  text-underline-offset: 0.3em;
}
.attachment-name,
.attachment-source,
.attachment-state {
  display: grid;
  gap: 0.35rem;
  overflow-wrap: anywhere;
}
.attachment-name {
  min-width: 10rem;
}
.attachment-source {
  min-width: 10rem;
}
.case-attachments table {
  font-size: 0.875rem;
}
.case-attachments td {
  vertical-align: top;
  padding: 0.8rem;
}
.attachment-feedback:empty {
  display: none;
}
.attachment-feedback[role='alert'] {
  color: var(--danger, #a43131);
}
@media (max-width: 700px) {
  .case-attachments .disclosure-body {
    padding: 0.75rem;
  }
  .attachment-toolbar select {
    max-width: 100%;
  }
}

.case-attachments {
  container-type: inline-size;
}
.case-attachments .attachment-actions a::before {
  content: '↗';
  margin-right: 0.4rem;
}
.case-attachments td:first-child {
  width: auto;
}
@container (max-width: 760px) {
  .case-attachments .table-wrap {
    max-height: none;
    overflow: visible;
  }
  .case-attachments table {
    min-width: 0;
    width: 100%;
    display: block;
  }
  .case-attachments thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .case-attachments tbody {
    display: block;
  }
  .case-attachments tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.4rem 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid var(--line);
  }
  .case-attachments tbody tr:last-child {
    border-bottom: 0;
  }
  .case-attachments td {
    display: block;
    padding: 0;
    border: 0;
    width: auto;
  }
  .case-attachments td:nth-child(1),
  .case-attachments td:nth-child(2),
  .case-attachments td:nth-child(5) {
    grid-column: 1 / -1;
  }
  .case-attachments .attachment-name,
  .case-attachments .attachment-source {
    min-width: 0;
  }
  .case-attachments .attachment-source {
    margin-bottom: 0.4rem;
  }
  .case-attachments .attachment-actions {
    margin-top: 0.4rem;
  }
}

/* Projection: shared application tokens, SVG with no external chart dependency. */
.projection-panel {
  margin-block: 1.5rem;
  padding: 1.5rem;
  min-width: 0;
}
.projection-panel h3 {
  margin-top: 0;
}
.projection-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem 1.25rem;
  margin-block: 1.5rem;
}
.projection-controls label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.875rem;
}
.projection-controls select {
  width: 100%;
  min-width: 0;
}
.projection-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1rem;
}
.projection-legend label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
}
.projection-legend input,
.projection-date-control input {
  width: auto;
}
.projection-chart-scroll {
  width: 100%;
  overflow-x: auto;
}
.projection-chart-scroll svg {
  display: block;
  width: 100%;
  min-width: 680px;
  height: auto;
}
.projection-axis {
  font:
    12px -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  fill: var(--muted);
}
.projection-grid {
  stroke: var(--line);
  stroke-opacity: 0.55;
}
.projection-goal-0 {
  color: #216aa4;
}
.projection-goal-1 {
  color: #976318;
}
.projection-goal-2 {
  color: #2c775b;
}
.projection-line {
  stroke: currentColor;
  stroke-width: 2.8;
}
.projection-recent {
  stroke-dasharray: 9 5;
}
.projection-average {
  stroke-dasharray: 2 5;
  stroke-width: 2.4;
}
.projection-plan {
  stroke: var(--muted);
  stroke-width: 1.3;
  stroke-dasharray: 5 5;
  opacity: 0.65;
}
.projection-target {
  stroke: var(--muted);
  stroke-dasharray: 2 5;
  opacity: 0.55;
}
.projection-deadline-band {
  fill: var(--attention);
  fill-opacity: 0.13;
}
.projection-deadline-line {
  stroke: var(--attention);
  stroke-opacity: 0.6;
}
.projection-now {
  stroke: var(--ink);
  stroke-dasharray: 3 4;
  opacity: 0.5;
}
.projection-cursor {
  stroke: var(--muted);
  stroke-opacity: 0.4;
}
.projection-date-control {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  margin-block: 0.75rem;
}
.projection-date-control input {
  flex: 1;
  min-width: 60px;
}
.projection-readout {
  font-size: 0.875rem;
  min-height: 2.75rem;
  line-height: 1.65;
  margin-block: 0.5rem;
}
.projection-summary {
  padding: 1rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: var(--canvas);
  line-height: 1.6;
}
.projection-table table {
  min-width: 920px;
  font-size: 0.875rem;
}
.projection-table td {
  vertical-align: top;
}
.projection-table small {
  display: block;
  margin-top: 0.4rem;
  color: var(--muted);
  line-height: 1.5;
}
.projection-table button {
  padding: 0.65rem 0.8rem;
  text-align: left;
  line-height: 1.4;
}
.projection-table button[aria-pressed='true'] {
  border-color: currentColor;
  background: var(--canvas);
}
@media (max-width: 640px) {
  .projection-panel {
    padding: 1rem;
  }
  .projection-controls {
    grid-template-columns: 1fr;
  }
}

.projection-table td:first-child {
  width: 25%;
}
main .projection-table button::before {
  display: none;
}
main .projection-table button[aria-pressed='true'] {
  background: var(--soft);
  font-weight: 650;
  text-decoration: none;
  border-left: 3px solid var(--accent);
}
@media (min-width: 641px) and (max-width: 1000px) {
  .projection-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.case-note {
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.case-note:first-child {
  padding-top: 0;
}
.case-note:last-child {
  border-bottom: 0;
}
.case-note h4 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}
.case-note-text,
.case-note-source {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.case-note-source {
  max-height: 24rem;
  overflow: auto;
  font-family: inherit;
}
.case-notes blockquote {
  margin: 0.5rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--line);
}
.case-notes .error:empty,
.case-note-dialog .error:empty {
  display: none;
}
.case-note-dialog textarea {
  min-height: 5rem;
  height: 6rem;
}
.case-note-dialog fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  margin: 0.5rem 0;
  display: grid;
  gap: 0.75rem;
}
.case-note-dialog legend {
  font-size: 0.875rem;
  font-weight: 600;
}
