/* Signature ink stays on white paper in both display themes. */
.signature-card, #view-safety-first > .card, .tbm-detail-card { margin-top: 16px; }
#signature-pad, .signature-preview { display: block; width: 100%; max-width: 600px; height: auto; aspect-ratio: 10 / 3; background: #fff; border: 1px solid #8da6ad; border-radius: 7px; }
#signature-pad { touch-action: none; cursor: crosshair; }
.signature-preview { max-width: 300px; margin: 10px 0; }
.signature-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.workspace textarea { width: 100%; min-height: 90px; padding: 10px; border: 1px solid #ccdcd9; border-radius: 7px; font: inherit; font-size: 13px; resize: vertical; color: var(--ink); background: #fff; }
.tbm-wide { grid-column: 1 / -1; }
.tbm-description { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.tbm-sign-form { display: grid; gap: 14px; max-width: 640px; margin-top: 18px; }
.tbm-sign-form > label { display: grid; gap: 6px; font-size: 13px; }
.tbm-sign-form > .check-label { display: flex; align-items: center; }
.tbm-sign-form .primary-button { width: fit-content; }
.tbm-sign-form button:disabled { opacity: .55; cursor: not-allowed; }
.tbm-meetings-table { min-width: 780px; }
.tbm-meetings-table p { margin: 4px 0 0; }
.tbm-attendee { padding: 14px 0; border-top: 1px solid var(--line); }
.tbm-answer-record { font-size: 12px; margin: 4px 0; }
.tbm-signed-heading { margin-top: 24px !important; }
@media (max-width: 680px) {
  .workspace textarea { font-size: 16px; }
  .signature-actions > button { flex: 1; }
}

.tbm-topic-catalog { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(280px,100%),1fr)); gap:12px; margin-top:12px; }
.tbm-topic-catalog fieldset,.jha-row,.jha-job-types { border:1px solid var(--line); border-radius:8px; padding:12px; min-width:0; }
.tbm-topic-catalog .check-label { display:flex; gap:8px; align-items:flex-start; font-size:12px; margin:7px 0; }
#view-safety-first summary { cursor:pointer; padding:10px 0; font-weight:600; }
.jha-row { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin:12px 0; }
.jha-row label { display:grid; gap:5px; font-size:13px; }
.jha-job-types .check-label { display:flex; gap:8px; margin:5px 0; }
.jha-hazards-table { min-width:1000px; table-layout:fixed; width:100%; }
.jha-detail { border-top:1px solid var(--line); margin-top:18px; padding-top:12px; }
@media(max-width:900px) { .jha-row { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:600px) { .jha-row { grid-template-columns:1fr; } }

.signature-request-banner{border:1px solid var(--line);border-radius:10px;padding:12px 16px;margin:12px 0;background:#f4faf8;color:var(--ink)}.signature-request-line{display:flex;gap:12px;justify-content:space-between;align-items:center;margin-top:8px}.signature-request-line span{overflow-wrap:anywhere}.tbm-roster-table{min-width:650px;width:100%}
@media(max-width:600px){.signature-request-line{align-items:flex-start;flex-direction:column}}

:root[data-theme="dark"] .signature-request-banner{background:var(--night-raised);color:var(--night-ink)}

.safety-site-folder{margin:10px 0;border:1px solid var(--border,#dbe7e7);border-radius:8px;padding:10px}.safety-site-folder summary{cursor:pointer;font-weight:700}.safety-site-folder .table-scroll{margin-top:10px}.safety-site-folder td:last-child button{white-space:normal;overflow-wrap:anywhere;text-align:left}
.safety-engineer-folder{margin:12px 0;border:1px solid var(--border,#dbe7e7);border-radius:8px;padding:12px}.safety-engineer-folder>summary{cursor:pointer;font-weight:700;overflow-wrap:anywhere}.safety-site-folder>summary{overflow-wrap:anywhere}
.safety-start-actions{display:flex;gap:12px;flex-wrap:wrap;margin:0 0 18px}.safety-start-actions>button{min-height:48px;min-width:180px}
.safety-preset-tools{padding:12px;margin:12px 0;border:1px solid var(--line);border-radius:8px}.safety-preset-tools>summary{min-height:44px;cursor:pointer;font-weight:700}.safety-preset-tools label{display:flex;flex-direction:column;gap:6px;margin:12px 0}.safety-preset-tools button{min-height:44px;white-space:normal}.safety-preset-row{border-top:1px solid var(--line);padding:12px 0;overflow-wrap:anywhere}.safety-preset-row button{margin:4px;min-height:44px}
#view-safety-first>details.card>summary{font-size:16px;min-height:44px;overflow-wrap:anywhere}
#view-safety-first>.card{margin-bottom:16px}
#jha-checklist>details{border:1px solid var(--line);border-radius:8px;padding:8px 12px;min-width:0}
#jha-checklist>details>summary{min-height:44px;overflow-wrap:anywhere}
@media(max-width:680px){
 .safety-start-actions{display:grid;grid-template-columns:minmax(0,1fr);gap:10px}
 .safety-start-actions>button{width:100%;min-width:0}
 #view-safety-first .feature-form{grid-template-columns:minmax(0,1fr)}
 #view-safety-first :is(input:not([type=checkbox]),select,textarea){font-size:16px}
 #view-safety-first .check-label{min-height:44px;align-items:flex-start;padding:8px 0}
 #view-safety-first :is(.feature-form,.tbm-sign-form)>button{width:100%;min-height:48px;white-space:normal}
 #view-safety-first :is(.safety-engineer-folder,.safety-site-folder){padding:8px}
}

.tbm-override-button{display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;margin-left:6px;padding:8px;vertical-align:middle}
.tbm-override-dialog{width:min(680px,95vw);max-height:88vh;overflow:auto;box-sizing:border-box;padding:20px;border:1px solid var(--line);border-radius:10px;background:var(--surface,#f1f2eb);color:var(--ink)}
.tbm-override-dialog::backdrop{background:#0009}.tbm-override-form{display:grid;gap:12px;min-width:0}.tbm-override-form>label{display:grid;gap:6px}.tbm-override-form :is(select,textarea){width:100%;min-width:0;box-sizing:border-box;font:inherit;color:var(--ink);background:var(--surface,#f1f2eb);border:1px solid var(--line);padding:10px}.tbm-override-form .check-label{display:flex;align-items:flex-start;gap:8px}.tbm-override-form .check-label input{width:auto;min-width:18px;margin-top:3px}.tbm-override-dialog :is(p,h2,td){overflow-wrap:anywhere}.tbm-override-dialog button{min-height:44px;white-space:normal}.tbm-override-dialog th,.tbm-override-dialog td{padding:7px}.tbm-override-dialog .table-scroll{max-height:34vh;overflow:auto}
:root[data-theme=dark] .tbm-override-dialog,:root[data-theme=dark] .tbm-override-form :is(select,textarea){background:#192f3a;color:#e4eeee}
@media(max-width:680px){.tbm-override-dialog{padding:12px}.tbm-override-dialog h2{font-size:18px}.tbm-override-form :is(select,textarea){font-size:16px}.tbm-override-form .signature-actions{display:grid;grid-template-columns:minmax(0,1fr)}}

.tbm-override-dialog .table-scroll table{min-width:0;width:100%;table-layout:fixed}.tbm-override-dialog th:nth-child(1){width:40%}.tbm-override-dialog th:nth-child(2){width:20%}.tbm-override-dialog th:nth-child(3){width:40%}
