.tc-dialog {
  width: min(1100px, calc(100vw - 24px));
  height: min(900px, calc(100dvh - 30px));
  padding: 0;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.tc-dialog[open] {
  display: flex;
  flex-direction: column;
}
.tc-dialog [hidden] {
  display: none !important;
}
.tc-header,
.tc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  flex-shrink: 0;
}
.tc-header {
  border-bottom: 1px solid var(--line);
}
.tc-header h2 {
  margin: 0;
}
.tc-footer {
  border-top: 1px solid var(--line);
}
.tc-footer .mini {
  max-width: 70%;
}
.tc-body {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}
.tc-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  min-height: 0;
  border-right: 1px solid var(--line);
  padding-right: 14px;
}
.tc-sidebar p {
  margin: 0;
}
.tc-sidebar .inline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.tc-contractor {
  display: grid;
  gap: 6px;
}
.tc-contractor > strong {
  font-size: var(--ui-label-size);
  color: var(--pill-green);
}
.tc-record-list {
  display: grid;
  gap: 6px;
  overflow: auto;
}
.tc-record {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--inbg);
  font-size: 0.75rem;
  cursor: pointer;
}
.tc-record input {
  width: 15px;
  height: 15px;
  accent-color: var(--pill-green);
  flex-shrink: 0;
}
.tc-record-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  min-width: 24px;
  cursor: pointer;
}
.tc-record-preview {
  display: grid;
  gap: 4px;
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.tc-record-preview strong,
.tc-record-preview small {
  overflow-wrap: anywhere;
}
.tc-record-preview:focus-visible {
  outline: 2px solid var(--pill-green);
  outline-offset: 3px;
  border-radius: 3px;
}
.tc-record-active {
  border-color: var(--pill-green);
  background: color-mix(in srgb, var(--pill-green) 9%, var(--card));
  box-shadow: inset 3px 0 var(--pill-green);
}
.tc-preview-controls {
  flex-wrap: wrap;
  align-items: center;
}
.tc-preview-selection {
  margin-right: auto;
  color: var(--pill-green);
}
.tc-preview-excluded {
  color: var(--warn, #b7791f);
}
.tc-dialog .pill:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.tc-record span {
  display: grid;
  gap: 4px;
  overflow-wrap: anywhere;
}
.tc-preview-pane {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  min-width: 0;
}
.tc-preview-pane .inline {
  display: flex;
  gap: 6px;
}
.tc-preview-frame {
  flex: 1;
  overflow: auto;
  min-height: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--inbg);
}
.tc-preview-frame canvas {
  width: 100%;
  height: auto;
  box-shadow: 0 3px 13px #0002;
  background: white;
}
.tc-preview-pane .status {
  font-size: 0.72rem;
  line-height: 1.4;
  margin: 0;
}
.mobile-export-options {
  display: grid;
  gap: 10px;
  padding: 14px;
}
.mobile-export-options .pill {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
  border-radius: 9px;
}
.mobile-export-options small {
  font-size: 0.75rem;
  color: var(--mut);
}
.mobile-export-dialog {
  max-width: 420px;
  width: calc(100vw - 24px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
}
@media (max-width: 650px) {
  .tc-dialog {
    height: calc(100dvh - 24px);
  }
  .tc-body {
    grid-template-columns: 1fr;
    overflow: auto;
    display: block;
  }
  .tc-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 0 10px;
    margin-bottom: 10px;
    overflow: visible;
  }
  .tc-record-list {
    max-height: 120px;
  }
  .tc-preview-frame {
    max-height: 55dvh;
    overflow: auto;
  }
  .tc-footer {
    padding: 9px 12px;
  }
  .tc-footer .mini {
    font-size: 0.65rem;
  }
  .tc-header {
    padding: 10px 12px;
  }
}

.tc-dialog .pill {
  text-decoration: none;
  margin: 0;
  white-space: nowrap;
}
@media (max-width: 650px) {
  .tc-footer .pill {
    flex-shrink: 0;
  }
  .tc-footer .mini {
    max-width: none;
    flex: 1;
  }
}

.tc-configurations > summary {
  display: inline-block;
  cursor: pointer;
}
.tc-configuration-fields {
  display: grid;
  gap: 6px;
  margin-top: 7px;
}
.tc-configuration-fields .field,
.tc-output {
  display: grid;
  gap: 4px;
  margin: 0;
}
.tc-configuration-fields .field > span,
.tc-output > span {
  font-size: var(--ui-label-size);
  color: var(--pill-green);
}
.tc-configuration-fields input,
.tc-output select {
  width: 100%;
  min-height: 30px;
  padding: 5px 7px;
  font: inherit;
  font-size: 0.75rem;
}
.tc-report-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 0;
}
@media (max-width: 650px) {
  .tc-footer {
    flex-wrap: wrap;
  }
  .tc-footer .mini {
    flex-basis: 100%;
  }
  .tc-report-actions {
    width: 100%;
  }
  .tc-configuration-fields input,
  .tc-output select {
    font-size: 16px;
  }
  .tc-sidebar {
    overflow: visible;
  }
}

.tc-signature-dialog {
  width: min(640px, calc(100vw - 32px));
  max-width: 640px;
  max-height: 90dvh;
  padding: 0;
  margin: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  overflow: auto;
}
.tc-signature-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}
.tc-signature-header,
.tc-signature-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}
.tc-signature-header {
  border-bottom: 1px solid var(--line);
}
.tc-signature-header h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--heading-ink, var(--text));
}
.tc-signature-body {
  padding: 14px 16px;
}
.tc-signature-body .mini {
  margin: 0 0 10px;
}
.tc-signature-body .field {
  display: grid;
  gap: 6px;
  font-size: 0.8rem;
}
.tc-signature-actions {
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
  position: sticky;
  bottom: 0;
  background: var(--card);
}
.tc-signature-actions .pill {
  font-size: 0.8rem;
}

.tc-signature-dialog canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 10 / 3;
  touch-action: none;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 12px 0;
  cursor: crosshair;
}
.tc-signature-dialog .inline {
  gap: 8px;
  flex-wrap: wrap;
}

.tc-signature-body .status:empty {
  display: none;
}
