.trial-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.05rem;
  margin-bottom: 1rem;
  border: 1px solid #cee1f0;
  border-radius: 12px;
  background: #f8fcff;
}
.trial-actions strong { font-size: 1rem; }
.trial-actions p { color: var(--muted); font-size: .85rem; margin-top: .17rem; }
.trial-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.trial-primary, .trial-secondary {
  border: 1px solid #bacfe1;
  border-radius: 8px;
  min-height: 38px;
  padding: .45rem .7rem;
  color: #18496f;
  background: #fff;
  font-size: .89rem;
  font-weight: 650;
  text-decoration: none;
}
.trial-primary { color: white; background: #17567f; border-color: #17567f; }
.trial-primary:hover { background: #124669; }
.trial-primary:disabled { opacity: .65; }
.trial-secondary:hover { background: #eaf4fc; }
.preparation-panel { margin-top: 1rem; }
.preparation-batches { display: grid; gap: .6rem; }
.preparation-batch { border: 1px solid var(--line); border-radius: 12px; background: #fcfdff; }
.preparation-batch > summary { cursor: pointer; padding: .75rem .9rem; font-weight: 650; }
.preparation-count { float: right; color: var(--muted); font-size: .85rem; font-weight: 500; }
.preparation-groups { display: grid; gap: .85rem; padding: .2rem .9rem .9rem; }
.preparation-group { min-width: 0; }
.preparation-group h3 { margin-bottom: .45rem; font-size: .88rem; color: var(--muted); }
.preparation-items { display: grid; grid-template-columns: repeat(auto-fit, minmax(126px, 1fr)); gap: .45rem; }
.preparation-toggle { min-height: 44px; width: 100%; text-align: left; }
.preparation-toggle::before { content: '○'; margin-right: .38rem; }
.preparation-toggle[aria-pressed="true"] { color: #15593f; background: #dff4e9; border-color: #85c5a9; }
.preparation-toggle[aria-pressed="true"]::before { content: '✓'; }
.preparation-panel #preparation-status:not(:empty) { margin-bottom: .65rem; }
#trial-dialog {
  width: min(580px, calc(100% - 1.25rem));
  max-height: calc(100dvh - 1.25rem);
  max-height: calc(100vh - 1.25rem);
  margin: auto;
  padding: 0;
  border: 1px solid #cbdce9;
  border-radius: 16px;
  color: #14283e;
  background: white;
  box-shadow: 0 22px 65px #14283e54;
}
#trial-dialog::backdrop { background: #12294080; }
.trial-dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .85rem 1.15rem;
  background: #f5f9fd;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1;
}
.trial-dialog-content { padding: 1rem 1.15rem 1.15rem; }
.trial-form, .trial-editor, .trial-record { display: grid; gap: .75rem; }
.trial-methods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
.trial-methods button { min-height: 42px; }
.trial-person-tasks { display: flex; flex-wrap: wrap; gap: .42rem; }
.trial-methods button[aria-pressed="true"], .trial-person-tasks button[aria-pressed="true"],
.trial-step-choices button[aria-pressed="true"] {
  color: #174a71;
  background: #e4f2fc;
  border-color: #5a8eaf;
}
.trial-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.trial-form-grid.trial-step-mode { grid-template-columns: minmax(0, 1fr); }
.trial-steps {
  padding: .64rem .72rem;
  border: 1px solid #d1e5f2;
  border-radius: 10px;
  background: #f8fcff;
}
.trial-steps summary { cursor: pointer; color: #225775; font-weight: 650; }
.trial-step-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .4rem;
  margin-top: .55rem;
}
.trial-step-choices button { text-align: left; overflow-wrap: anywhere; }
.trial-step-choices small {
  display: block;
  margin-top: .11rem;
  color: var(--muted);
  font-size: .79rem;
  font-weight: 450;
}
.trial-field { display: grid; gap: .35rem; min-width: 0; font-size: .88rem; }
.trial-field select { width: 100%; min-width: 0; }
.trial-field > span, .trial-team legend { font-weight: 650; }
.trial-field input:not([type="checkbox"]), .trial-field textarea {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  color: #193e59;
  border: 1px solid #cfdeeb;
  border-radius: 8px;
  padding: .53rem .65rem;
  background: #f9fbfd;
}
.trial-field textarea { resize: vertical; }
.trial-chips .trial-field {
  display: inline-flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: flex-end;
  gap: .4rem;
}
.trial-field [type="checkbox"] { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: #17567f; }
.trial-template { background: #eef7fc; border: 1px solid #d1e5f2; padding: .75rem .85rem; border-radius: 10px; }
.trial-template p, .trial-template details { margin-top: .32rem; }
.trial-template p { color: #496679; font-size: .87rem; }
.trial-template .trial-board-range { font-weight: 750; color: #15394f; }
.trial-template .trial-existing { color: #7d490e; }
.trial-template button { margin-top: .5rem; }
.trial-board-all { overflow-wrap: anywhere; line-height: 1.6; }
.trial-board-editor {
  display: grid;
  gap: .35rem;
  max-height: 210px;
  overflow-y: auto;
  padding: .45rem;
  border: 1px solid #dce8f1;
  border-radius: 8px;
}
.trial-board-editor .trial-field { display: grid; grid-template-columns: 1fr minmax(8.5rem, max-content); align-items: center; }
.trial-count { color: #1c5877; font-weight: 650; font-size: .87rem; }
.trial-count:empty, .trial-meta:empty, .trial-error:empty { display: none; }
.trial-team { padding: .5rem; border: 1px solid #cfdeeb; border-radius: 8px; margin: .4rem 0 0; }
.trial-actual > .trial-field { margin-top: .55rem; }
.trial-team legend { font-size: .82rem; }
.trial-chips { display: flex; flex-wrap: wrap; gap: .5rem .8rem; }
.trial-actual summary, .trial-template summary, .trial-preview summary { cursor: pointer; font-size: .9rem; color: #225775; font-weight: 650; }
.trial-meta { color: var(--muted); font-size: .84rem; }
.trial-error { color: #842b20; font-size: .88rem; }
.trial-handoff, .trial-inbox {
  padding: .65rem .75rem;
  background: #f8fcff;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.trial-inbox { margin: .8rem 0 .45rem; }
.trial-handoff summary, .trial-inbox summary { cursor: pointer; color: #225775; font-weight: 650; }
.trial-handoff .trial-field, .trial-handoff .trial-meta, #trial-inbox-content { margin-top: .65rem; }
.trial-inbox-notes { display: grid; gap: .5rem; margin-top: .55rem; }
.trial-inbox-note { padding: .6rem; background: white; border: 1px solid var(--line); border-radius: 7px; }
.trial-inbox-body { margin-top: .35rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.trial-preview { padding: .66rem; background: #f2f7fa; border: 1px solid var(--line); border-radius: 9px; }
.trial-preview pre {
  max-height: 17rem;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: .6rem 0 0;
  font-family: inherit;
  font-size: .86rem;
  line-height: 1.55;
}
.trial-ledger-list { display: grid; gap: .5rem; margin-top: .75rem; }
#trial-admin { max-width: 750px; margin: 0 0 2rem; }
#trial-admin > a { display: inline-flex; align-items: center; }
.trial-ledger-item {
  display: grid; text-align: left; gap: .25rem; padding: .65rem .75rem; border-radius: 8px;
  color: #183c57; border: 1px solid var(--line); background: #f5f9fd; overflow-wrap: anywhere;
}
.trial-ledger-item span { color: var(--muted); font-size: .83rem; }

@media (max-width: 700px) {
  .trial-actions { display: grid; gap: .65rem; }
  .trial-dialog-heading { padding: .7rem .85rem; }
  .trial-dialog-content { padding: .8rem .85rem 1rem; }
  .trial-field textarea, .trial-field input:not([type="checkbox"]), .trial-field select { font-size: 1rem; }
}
@media (max-width: 560px) {
  .trial-form-grid { grid-template-columns: minmax(0, 1fr); }
  .trial-form-grid input[type="date"], .trial-form-grid select { min-height: 44px; }
}
