:root { color-scheme: light; font-family: Inter, "Segoe UI", "Malgun Gothic", "Noto Sans CJK KR", sans-serif; color: #222b3a; background: #f6f8fc; font-synthesis: none; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { display: grid; grid-template-columns: 270px minmax(0, 1fr); height: 100dvh; margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex="-1"]:focus { outline: 2px solid #719bff; outline-offset: 3px; }
button:disabled { cursor: default; opacity: .6; }
input:disabled, textarea:disabled, textarea:read-only, input:read-only { background: #edf1f7; color: #58667c; }
.sidebar { padding: 24px 16px; background: #172438; color: #e8f0ff; overflow: auto; }
.workspace { display: flex; gap: 11px; align-items: center; padding: 0 8px 25px; border-bottom: 1px solid #3a4b62; }
.mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: #b8cbff; color: #192d51; font-weight: 800; }
.sidebar h2 { color: #bbc9e0; margin: 23px 8px 9px; font-size: .82rem; }
.channels { display: grid; gap: 4px; }
.channels button { padding: 9px 12px; border: 0; border-radius: 7px; background: transparent; color: inherit; text-align: left; overflow-wrap: anywhere; }
.channels button:hover, .channels button[aria-current] { background: #304969; }
#create-channel { margin-top: 24px; padding-top: 1px; border-top: 1px solid #3a4b62; display: grid; gap: 7px; }
#create-channel h2 { margin: 14px 0 4px; }
#create-channel label { font-size: .82rem; }
#create-channel input, #create-channel textarea { width: 100%; border: 1px solid #52647d; border-radius: 5px; padding: 7px; }
#create-channel textarea { resize: vertical; max-height: 140px; }
#create-channel button { border: 1px solid #52647d; border-radius: 5px; padding: 8px; background: #304969; color: #f3f7ff; }
#create-feedback { margin: 0; font-size: .8rem; line-height: 1.5; overflow-wrap: anywhere; }
.optional, .counter { font-size: .76rem; }
.counter { color: #58667c; }
.sidebar .counter, .optional { color: #bbc9e0; }
.demo-note { font-size: .74rem; line-height: 1.6; color: #b9c7dd; margin: 24px 4px 0; }
main { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; background: #fff; }
.channel-header { padding: 23px 30px 17px; border-bottom: 1px solid #e3e9f2; overflow-wrap: anywhere; }
h1 { margin: 0; font-size: 1.28rem; }
.channel-header p { margin: 5px 0 0; color: #525f73; font-size: .87rem; }
#connection-status { font-size: .76rem; color: #63728b; }
.conversation { min-height: 0; display: flex; flex-direction: column; }
#message-status { padding: 12px 30px; color: #58667c; font-size: .87rem; }
#message-status p { margin: 0 0 8px; }
#messages { min-height: 0; flex: 1; overflow: auto; list-style: none; margin: 0; padding: 22px 30px; }
#messages li { display: flex; gap: 11px; margin-bottom: 16px; overflow-wrap: anywhere; }
#messages p { white-space: pre-wrap; margin: 4px 0 0; line-height: 1.55; }
#messages .reply-message { margin-left: 20px; padding-left: 12px; border-left: 2px solid #e3e9f2; }
.avatar { flex: 0 0 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: #274785; background: #e8efff; }
#composer { margin: 0 30px 22px; padding: 10px; border: 1px solid #c9d3e3; border-radius: 9px; }
#composer textarea { width: 100%; padding: 8px; resize: vertical; min-height: 50px; max-height: 22vh; border: 0; border-radius: 5px; }
.composer-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#feedback { color: #4c5970; font-size: .82rem; line-height: 1.5; margin: 8px 0 0; }
#feedback:empty, #create-feedback:empty { display: none; }
#send-message { flex: none; padding: 7px 14px; border: 0; border-radius: 7px; background: #2c57b4; color: white; font-weight: 650; }
.secondary { padding: 7px 10px; border: 1px solid #bac7dc; border-radius: 5px; background: #f5f8fd; color: #274785; font-size: .8rem; }
.recovery-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.recovery-actions:has(button:not([hidden])) { margin-top: 10px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 640px) {
  body { grid-template-columns: 1fr; grid-template-rows: minmax(120px, 32vh) minmax(0, 1fr); }
  .sidebar { padding: 10px 14px; }
  .workspace { padding: 0 0 8px; }
  .sidebar h2 { margin: 12px 0 6px; }
  .channels { display: flex; flex-wrap: wrap; }
  #create-channel { margin-top: 12px; }
  .channel-header, #messages { padding: 15px; }
  #message-status { padding: 10px 15px; }
  #composer { margin: 0 15px 15px; }
}

.account-panel { border-bottom: 1px solid #3a4b62; padding-bottom: 14px; }
.account-panel h2 { margin-left: 0; }
#token-form { display: grid; gap: 7px; }
#token-form label { font-size: .82rem; }
#development-token { min-width: 0; width: 100%; border: 1px solid #52647d; border-radius: 5px; padding: 7px; }
.account-actions { display: flex; gap: 6px; }
.account-actions button { padding: 7px 10px; border: 1px solid #52647d; border-radius: 5px; background: #304969; color: #f3f7ff; }
#auth-status, #project-role { font-size: .8rem; line-height: 1.5; overflow-wrap: anywhere; }
#auth-help { font-size: .72rem; color: #b9c7dd; line-height: 1.55; }
.projects { display: grid; gap: 4px; }
.projects button { padding: 9px 12px; border: 1px solid #52647d; border-radius: 7px; background: transparent; color: inherit; text-align: left; overflow-wrap: anywhere; }
.projects button:hover, .projects button[aria-current] { background: #304969; }

/* Thread rows have their own stable nodes and scroll container. */
body.thread-open { grid-template-columns: 270px minmax(0, 1fr) minmax(320px, 38%); }
.thread-panel { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; background: #fff; border-left: 1px solid #d5dfea; }
.thread-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 23px 20px 17px; border-bottom: 1px solid #e3e9f2; }
.thread-header h2 { margin: 0; font-size: 1.16rem; }
#thread-summary, #thread-status { color: #58667c; font-size: .82rem; line-height: 1.5; }
#thread-summary { margin: 6px 0 0; }
#thread-status { margin: 0; padding: 10px 20px; }
#thread-status:empty { display: none; }
#thread-messages { min-height: 0; overflow: auto; list-style: none; margin: 0; padding: 20px; }
#thread-messages li { display: flex; gap: 10px; margin-bottom: 18px; overflow-wrap: anywhere; }
#thread-messages li:first-child { padding-bottom: 18px; border-bottom: 1px solid #d5dfea; }
#thread-messages p { white-space: pre-wrap; margin: 4px 0 0; line-height: 1.55; }
.thread-link { margin-top: 8px; }
#thread-composer { margin: 0 16px 18px; padding: 10px; border: 1px solid #c9d3e3; border-radius: 9px; }
#thread-composer label { display: block; font-size: .82rem; margin-bottom: 6px; }
#reply-message { width: 100%; padding: 8px; resize: vertical; min-height: 50px; max-height: 22vh; border: 0; border-radius: 5px; }
#reply-feedback { color: #4c5970; font-size: .82rem; line-height: 1.5; margin: 8px 0 0; }
#reply-feedback:empty { display: none; }
#send-reply { flex: none; padding: 7px 14px; border: 0; border-radius: 7px; background: #2c57b4; color: white; font-weight: 650; }
@media (max-width: 999px) {
  body.thread-open { grid-template-columns: 270px minmax(0, 1fr); }
  .thread-panel { position: fixed; inset: 0; z-index: 10; border: 0; }
  body.thread-modal { overflow: hidden; }
}
@media (max-width: 640px) {
  body.thread-open { grid-template-columns: 1fr; }
  .thread-header { padding: 15px; }
  #thread-messages { padding: 15px; }
}

/* Management controls stay inside the sidebar, including the narrow thread's inert background. */
.management-form { display: grid; gap: 7px; margin-top: 20px; padding-top: 8px; border-top: 1px solid #3a4b62; min-width: 0; }
.management-form h2 { margin: 10px 0 4px; }
.management-form p { font-size: .78rem; line-height: 1.5; overflow-wrap: anywhere; margin: 4px 0; }
.management-form label { font-size: .82rem; }
.management-form input, .management-form select { width: 100%; min-width: 0; padding: 7px; border: 1px solid #52647d; border-radius: 5px; font: inherit; }
.management-form button { padding: 8px; border: 1px solid #52647d; border-radius: 5px; background: #304969; color: #f3f7ff; text-align: left; overflow-wrap: anywhere; }
#members-content, #member-form { display: grid; gap: 7px; min-width: 0; }
#members-help { color: #b9c7dd; font-size: .72rem; }
#members-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 5px; }
#members-list button { width: 100%; }
select:focus-visible { outline: 2px solid #719bff; outline-offset: 3px; }
select:disabled { background: #edf1f7; color: #58667c; }

/* Search stays in channel-main, therefore inside the narrow thread's inert background. */
.project-search { padding: 12px 30px; border-bottom: 1px solid #e3e9f2; max-height: 42vh; overflow: auto; min-height: 0; }
.project-search h2 { margin: 0 0 8px; font-size: .95rem; }
#search-form label, #search-help, #search-status { font-size: .8rem; line-height: 1.5; }
#search-help, #search-status { margin: 6px 0; color: #58667c; overflow-wrap: anywhere; }
#search-status:empty { display: none; }
.search-controls { display: flex; flex-wrap: wrap; gap: 6px; margin: 5px 0; }
#search-query { flex: 1 1 160px; min-width: 0; border: 1px solid #bac7dc; border-radius: 5px; padding: 7px; }
#search-submit { padding: 7px 14px; border: 0; border-radius: 5px; background: #2c57b4; color: white; }
#search-results { list-style: none; margin: 8px 0; padding: 0; }
#search-results:empty { display: none; }
#search-results li { padding: 10px 0; border-top: 1px solid #e3e9f2; overflow-wrap: anywhere; }
#search-results p { white-space: pre-wrap; margin: 5px 0; line-height: 1.5; }
.search-location { font-size: .78rem; color: #58667c; }
@media (max-width: 640px) { .project-search { padding: 10px 15px; max-height: 36vh; } }

/* Decision data and controls share channel-main's narrow-thread inert boundary. */
main { grid-template-rows: auto auto auto minmax(0, 1fr) auto; }
.project-decisions { padding: 10px 30px; border-bottom: 1px solid #e3e9f2; max-height: 42vh; overflow: auto; min-height: 0; }
.project-decisions h2 { margin: 0 0 7px; font-size: .95rem; }
.project-decisions h3 { margin: 10px 0 5px; font-size: .9rem; }
.project-decisions p, .project-decisions label { font-size: .8rem; line-height: 1.5; overflow-wrap: anywhere; }
.project-decisions p { margin: 6px 0; color: #58667c; }
#decisions-content, #decision-form { display: grid; gap: 7px; }
#decision-filter-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
#decision-filter, #decision-assignee, #decision-summary { min-width: 0; max-width: 100%; border: 1px solid #bac7dc; border-radius: 5px; padding: 7px; font: inherit; }
#decision-summary { width: 100%; resize: vertical; max-height: 18vh; }
#decisions-list { list-style: none; padding: 0; margin: 0; }
#decisions-list li { padding: 9px 0; border-top: 1px solid #e3e9f2; overflow-wrap: anywhere; }
#decisions-list p, #decision-review-summary { white-space: pre-wrap; }
#decisions-list button, .decision-link { margin: 5px 5px 0 0; }
#save-decision { padding: 7px 14px; border: 0; border-radius: 5px; background: #2c57b4; color: white; }
@media (max-width: 640px) { .project-decisions { padding: 10px 15px; max-height: 36vh; } }

/* Inline files stay within the owning timeline/thread and its inert boundary. */
.files-mode-help { margin: 8px 30px 0; color: #58667c; font-size: .76rem; line-height: 1.5; }
.files-link { margin: 5px 5px 0 0; }
.files-panel { margin-top: 8px; padding: 10px; border: 1px solid #d5dfea; border-radius: 6px; min-width: 0; max-width: 580px; }
.files-panel p, .files-panel label { font-size: .78rem; line-height: 1.5; overflow-wrap: anywhere; }
.files-panel input { display: block; max-width: 100%; margin: 6px 0; }
.files-panel ul { list-style: none; margin: 8px 0; padding: 0; }
#messages .files-panel li, #thread-messages .files-panel li { display: block; margin: 8px 0; padding: 8px 0; border-bottom: 1px solid #e3e9f2; }
.files-panel li button { margin: 5px 5px 0 0; }
.file-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
@media (max-width: 640px) { .files-mode-help { margin: 8px 15px 0; } }
