:root { color-scheme: light; }
* { box-sizing: border-box; }
body { margin: 0; background: #fff; color: #171717; font: 16px/1.5 Helvetica, Arial, "Nimbus Sans", sans-serif; }
a { color: #174b70; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid #175f96; outline-offset: 2px; }
.shell { width: min(100% - 36px, 960px); margin: 0 auto; }
.site-header { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; padding: 17px 0; border-bottom: 1px solid #bbb; }
.brand { color: #171717; font-weight: 700; text-decoration: none; font-size: 19px; }
.brand span { font-weight: 400; margin-left: 12px; }
.header-note, footer, .muted { color: #666; font-size: 14px; }
main { padding: 34px 0 70px; min-height: 65vh; }
h1 { font-size: clamp(28px, 4vw, 34px); line-height: 1.2; margin: 0 0 12px; }
h2 { font-size: 23px; line-height: 1.25; margin: 40px 0 15px; }
h3 { font-size: 18px; margin: 0 0 6px; }
p { margin: 0 0 16px; max-width: 67ch; }
.intro { font-size: 18px; max-width: 61ch; }
.rule { border: 0; border-top: 1px solid #ccc; margin: 28px 0; }
.panel { border: 1px solid #c8c8c8; padding: 22px; margin: 18px 0; }
.panel > h2:first-child { margin-top: 0; }
.panel p:last-child { margin-bottom: 0; }
.form-grid { display: grid; gap: 15px; max-width: 580px; }
label { display: block; font-weight: 600; }
input, textarea { display: block; width: 100%; margin-top: 5px; padding: 10px 11px; border: 1px solid #999; border-radius: 0; background: #fff; color: #171717; font: inherit; }
input[type="file"] { padding: 9px; }
textarea { min-height: 100px; resize: vertical; }
.trap { position: absolute; left: -9999px; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 15px; }
button, .button { display: inline-block; padding: 9px 14px; border: 1px solid #333; border-radius: 0; background: #fff; color: #171717; font: 600 15px/1.3 Helvetica, Arial, sans-serif; text-decoration: none; cursor: pointer; }
button.primary { background: #222; color: #fff; }
button:disabled { opacity: .5; cursor: wait; }
.list { border-top: 1px solid #ccc; }
.row { border-bottom: 1px solid #ccc; padding: 16px 0; }
.row-head { display: flex; justify-content: space-between; gap: 15px; align-items: baseline; }
.row-title { font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.row-meta { color: #666; font-size: 14px; }
.row p { margin: 6px 0; }
.notice { border-left: 3px solid #174b70; padding: 9px 13px; margin: 18px 0; background: #f4f7f9; max-width: 680px; }
.notice.error { border-color: #9b2d24; background: #fbf4f3; }
.empty { color: #666; padding: 15px 0; }
.room-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; }
.file-name { overflow-wrap: anywhere; }
.progress { margin-top: 10px; font-size: 14px; }
.preview { border: 1px solid #bbb; margin-top: 14px; padding: 10px; }
.preview button { margin-bottom: 10px; }
.preview img, .preview iframe { display: block; width: 100%; max-height: 65vh; object-fit: contain; border: 0; }
.preview iframe { height: 65vh; }
.agreement-body, .message-body { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; max-width: 75ch; }
.agreement-body { margin: 15px 0; }
.agreement-input { min-height: 300px; }
.accept-box { border-top: 1px solid #ccc; margin-top: 18px; padding-top: 14px; max-width: 480px; display: grid; gap: 12px; }
.accept-box label:has(input[type="checkbox"]) { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; }
.accept-box input[type="checkbox"] { width: auto; margin: 5px 0 0; }
.check-line { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; margin: 10px 0; }
.check-line input[type="checkbox"] { width: auto; margin: 5px 0 0; }
.receipt { border-left: 3px solid #333; padding-left: 12px; margin-top: 14px; }
.error-text { color: #9b2d24; }
.print-sheet { display: none; }
@media print {
  body.printing-agreement > *:not(.print-sheet) { display: none; }
  body.printing-agreement .print-sheet { display: block; padding: 12mm; }
  body.printing-agreement .print-sheet .agreement-body { max-width: none; }
}
footer { border-top: 1px solid #ccc; padding: 17px 0 35px; }
@media (max-width: 700px) { .header-note { display: none; } .room-grid { grid-template-columns: 1fr; gap: 8px; } .panel { padding: 17px; } .row-head { display: block; } }

/* Room workspace */
.workspace-page .shell { width: 100%; max-width: none; padding: 0 28px; }
.workspace-page main { padding: 22px 0 30px; min-height: calc(100vh - 130px); }
.workspace-page .site-header { padding: 12px 0; }
.workspace-header { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 18px; }
.workspace-header h1 { font-size: 28px; margin-bottom: 3px; }
.workspace-subtitle { color: #666; font-size: 14px; margin: 0; }
.workspace-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.workspace-controls button { padding: 7px 12px; }
.workspace-alert { border-left: 3px solid #333; background: #f6f6f6; padding: 9px 13px; margin: 0 0 15px; max-width: none; }
.timeline-rail { position: relative; width: 100%; height: clamp(480px, 62vh, 760px); overflow-x: auto; overflow-y: hidden; overscroll-behavior-inline: contain; scroll-snap-type: x proximity; scrollbar-color: #999 #eee; border: 1px solid #bbb; background: #f8f8f6; }
.timeline-rail:focus-visible { outline: 2px solid #175f96; }
.timeline-track { display: flex; align-items: stretch; width: max-content; min-width: 100%; height: 100%; gap: 0; padding: 44px 28px 16px; position: relative; }
.timeline-track::before { content: ""; position: absolute; top: 29px; left: 0; right: 0; height: 1px; background: #888; }
.event-card { flex: none; position: relative; width: min(400px, 80vw); max-height: 100%; overflow-y: auto; scroll-snap-align: start; border: 1px solid #aaa; background: #fff; padding: 16px 18px; }
.event-card::before { content: ""; position: absolute; top: 0; left: 22px; width: 7px; height: 7px; background: #252525; }
.event-agreement { width: min(480px, 84vw); }
.event-acceptance { width: min(300px, 72vw); }
.event-head { display: flex; align-items: start; justify-content: space-between; gap: 8px; border-bottom: 1px solid #ddd; padding-bottom: 11px; margin-bottom: 13px; }
.event-kind { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; }
.event-icon { display: inline-flex; width: 19px; height: 19px; }
.event-icon svg { width: 100%; height: 100%; }
.event-date { color: #666; font-size: 12px; text-align: right; white-space: nowrap; }
.event-card h2 { font-size: 21px; margin: 0 0 4px; overflow-wrap: anywhere; }
.event-by { color: #666; font-size: 13px; margin-bottom: 13px; }
.time-gap { flex: none; align-self: start; position: relative; margin-top: -34px; padding-top: 3px; text-align: center; color: #555; font-size: 12px; white-space: nowrap; }
.document-stamp { display: inline-block; border: 2px solid #333; padding: 4px 9px; font-size: 14px; font-weight: 700; letter-spacing: .02em; margin: 2px 0 14px; }
.document-stamp.accepted { color: #1b5b3e; border-color: #1b5b3e; }
.document-stamp.pending { color: #555; border-color: #777; }
.document-paper { border: 1px solid #ddd; padding: 14px; max-height: 280px; overflow-y: auto; background: #fff; }
.document-paper .agreement-body { margin: 0; font-size: 14px; line-height: 1.5; }
.document-receipt { font-size: 12px; color: #555; margin: 11px 0; overflow-wrap: anywhere; }
.event-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.event-actions button { padding: 7px 10px; font-size: 13px; }
.workspace-accept { border-top: 1px solid #ddd; margin-top: 15px; padding-top: 10px; }
.workspace-accept label { font-size: 14px; }
.workspace-accept button { margin: 7px 7px 7px 0; }
.workspace-accept input { margin-top: 5px; }
.file-details, .file-ack, .acceptance-summary { font-size: 14px; color: #555; }
.chat-preview, .chat-full { display: flex; flex-direction: column; gap: 10px; }
.chat-bubble { border-left: 2px solid #999; background: #f6f6f6; padding: 9px 11px; max-width: 92%; overflow-wrap: anywhere; }
.chat-bubble.mine { border-color: #174b70; align-self: end; }
.chat-bubble.theirs { align-self: start; }
.chat-author { font-size: 12px; color: #666; margin-bottom: 3px; }
.chat-bubble p { margin: 0; }
.event-chat > button { margin-top: 16px; }
.timeline-empty { padding: 20px; color: #666; }
.workspace-compose { display: grid; grid-template-columns: minmax(220px, 1.3fr) minmax(280px, 1fr) minmax(280px, 1fr); gap: 14px; align-items: start; border-top: 1px solid #aaa; margin-top: 18px; padding-top: 15px; }
.workspace-compose h2 { grid-column: 1 / -1; font-size: 19px; margin: 0; }
.workspace-compose textarea { min-height: 76px; margin: 0; }
.compose-actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: start; }
.compose-actions input { min-width: 170px; flex: 1; margin: 0; }
.compose-upload { display: flex; flex-wrap: wrap; gap: 7px; align-items: start; }
.compose-upload input { width: auto; max-width: 100%; margin: 0; }
.workspace-compose .progress { grid-column: 1 / -1; margin: 0; }
.preview-dialog, .conversation-dialog { border: 1px solid #555; border-radius: 0; padding: 20px; width: min(100% - 30px, 920px); max-height: 90vh; overflow: auto; }
.preview-dialog::backdrop, .conversation-dialog::backdrop { background: rgb(0 0 0 / .55); }
.preview-dialog h2, .conversation-dialog h2 { margin: 0 0 12px; }
.preview-dialog > button, .conversation-dialog > button { margin-bottom: 14px; }
.preview-dialog img, .preview-dialog iframe { display: block; width: 100%; max-height: 70vh; object-fit: contain; border: 0; }
.preview-dialog iframe { height: 70vh; }
.conversation-dialog .chat-full { max-height: 55vh; overflow-y: auto; margin-bottom: 15px; }
.conversation-dialog textarea { min-height: 70px; }
@media (max-width: 950px) { .workspace-compose { grid-template-columns: 1fr 1fr; } .workspace-compose textarea { grid-column: 1 / -1; } }
@media (max-width: 700px) {
  .workspace-page .shell { padding: 0 14px; }
  .workspace-header { align-items: start; flex-direction: column; gap: 12px; }
  .workspace-header h1 { font-size: 24px; }
  .timeline-rail { height: 58vh; min-height: 430px; }
  .timeline-track { padding-left: 14px; padding-right: 14px; }
  .event-card { width: 82vw; padding: 13px; }
  .event-agreement { width: 86vw; }
  .event-acceptance { width: 72vw; }
  .event-head { display: block; }
  .event-date { display: block; text-align: left; margin-top: 5px; }
  .workspace-compose { grid-template-columns: 1fr; }
  .workspace-compose textarea { grid-column: auto; }
}
