@font-face {
  font-family: "Noto Sans KR";
  src: url("/fonts/NotoSansKR-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
:root {
  font-family:
    "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  font-size: 16px;
  color-scheme: light;
  --text: #292822;
  --surface: #fbfaf7;
  --surface-alt: #f5f3ed;
  --soft: #f0eee7;
  --selected: #e7e3d9;
  --navy: #2d392e;
  --on-accent: #ffffff;
  --accent-hover: #465344;
  --line: #d9d5c9;
  --muted: #706e64;
  --tint: var(--soft);
  --focus: #587c63;
  --link: #315d47;
  --danger: #a02736;
  --danger-hover: #7d1e2a;
  --danger-bg: #fff0f0;
  --on-danger: #ffffff;
  --warning: #76500b;
  --warning-bg: #fff4dc;
  --backdrop: #161b1766;
  --shadow: #20241c18;
  color: var(--text);
  background: var(--surface);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --text: #eeece3;
  --surface: #201f1d;
  --surface-alt: #25241f;
  --soft: #2c2a25;
  --selected: #38352d;
  --navy: #d5dece;
  --on-accent: #252c22;
  --accent-hover: #b9cbb0;
  --line: #4c493f;
  --muted: #b8b4a7;
  --focus: #a4c7a3;
  --link: #bed8bc;
  --danger: #f497a1;
  --danger-hover: #ffc0c7;
  --danger-bg: #43252c;
  --on-danger: #34121a;
  --warning: #ebca82;
  --warning-bg: #3a3020;
  --backdrop: #00000088;
  --shadow: #00000033;
}
/* All product surfaces, including native dialogs, share the selected theme. */
body,
dialog {
  color: var(--text);
  background: var(--surface);
}
:where(h1, h2, h3, h4, strong, b, p, label, summary) {
  color: inherit;
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}
a {
  color: var(--link);
}
.workbench-dialog {
  width: min(920px, calc(100vw - 24px));
  max-height: 90dvh;
  overflow: auto;
}
.workbench-dialog > .dialog-header {
  position: sticky;
  top: -1px;
  background: var(--surface);
  padding-bottom: 10px;
  z-index: 1;
}
.workbench-dialog select {
  font: inherit;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  color: inherit;
  max-width: 100%;
}
.workbench-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0;
}
.work-report-card {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--soft);
  max-width: 900px;
  margin: 20px auto;
  padding: 20px;
}
.work-report-card p {
  margin: 12px 0;
}
.work-finding {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 3px;
  margin: 12px 0;
  overflow-wrap: anywhere;
}
.work-finding h3 {
  font-size: 1rem;
  margin: 12px 0 6px;
}
.work-finding p {
  line-height: 1.6;
  margin-bottom: 10px;
  white-space: pre-wrap;
}
.work-finding button {
  margin: 5px 8px 0 0;
}
.work-locator {
  color: var(--navy);
  font-weight: 600;
}
.work-badge {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 5px;
  background: var(--selected);
  font-size: 0.8rem;
}
.work-badge.error,
.work-badge.difference {
  color: var(--danger);
  background: var(--danger-bg);
}
.work-badge.unchecked,
.work-badge.review {
  color: var(--warning);
  background: var(--warning-bg);
}
#work-report-details {
  overflow-wrap: anywhere;
  margin-top: 12px;
}
#work-report-details a {
  margin-left: 10px;
}
@media (max-width: 600px) {
  .workbench-dialog {
    padding: 16px;
  }
  .workbench-dialog .dialog-header h2 {
    font-size: 1.1rem;
  }
  .work-finding {
    padding: 14px;
  }
  .workbench-actions button {
    flex: 1 1 120px;
    word-break: keep-all;
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 3px;
  padding: 9px 13px;
  min-height: 40px;
}
button:hover {
  background: var(--soft);
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
input,
textarea {
  width: 100%;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 11px;
}
label {
  display: block;
  font-size: 0.9rem;
  margin: 18px 0 7px;
}
h1,
h2,
p {
  margin-top: 0;
}
.primary {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--on-accent);
}
.primary:hover {
  background: var(--accent-hover);
}
.muted {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
}
[hidden] {
  display: none !important;
}
.brand {
  font-size: 1.48rem;
  letter-spacing: -0.7px;
  white-space: nowrap;
}
.brand strong {
  font-weight: 700;
}
.text-button {
  border: 0;
  background: transparent;
  font-size: 0.82rem;
}
.form-error {
  color: var(--danger);
  font-size: 0.85rem;
  line-height: 1.6;
  margin: 10px 0;
  white-space: pre-wrap;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
#notice {
  position: fixed;
  z-index: 1000;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  background: var(--navy);
  color: var(--on-accent);
  max-width: min(92vw, 660px);
  padding: 12px 18px;
  border-radius: 3px;
  box-shadow: 0 6px 30px var(--shadow);
  line-height: 1.6;
  font-size: 0.9rem;
}
.auth-view {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: var(--soft);
  padding: 24px;
}
.auth-card {
  width: min(460px, 100%);
  padding: 36px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
}
.auth-card .brand {
  margin-bottom: 6px;
}
.auth-card h1 {
  font-size: 1.4rem;
  margin-top: 30px;
}
.auth-card form > button {
  width: 100%;
  margin-top: 22px;
}
.auth-footer {
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--muted);
  margin: 24px 0 0;
}
.password-field {
  display: flex;
  gap: 6px;
}
.password-field button {
  white-space: nowrap;
  font-size: 0.8rem;
}
.workspace {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  height: 100dvh;
}
#sidebar {
  display: flex;
  flex-direction: column;
  background: var(--surface-alt);
  border-right: 1px solid var(--line);
  padding: 26px 16px 12px;
  min-height: 0;
}
.sidebar-subtitle {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 7px 0 25px;
}
.new-chat {
  text-align: left;
  font-size: 0.95rem;
}
.rules-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--navy);
  text-align: left;
  margin-top: 10px;
  padding: 11px 13px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}
.rules-button:hover {
  border-color: var(--navy);
  background: var(--soft);
}
.rules-button > svg {
  flex-shrink: 0;
}
.rules-button-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.rules-button-title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
}
.rules-button-description {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.5;
}
.list-title {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 24px 6px 8px;
}
#conversation-search {
  font-size: 0.85rem;
  padding: 9px 10px;
  margin-bottom: 12px;
}
#conversation-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 2px;
}
.conversation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: start;
  border-radius: 3px;
  margin-bottom: 5px;
}
.conversation-row.selected {
  background: var(--selected);
}
.conversation-open {
  min-width: 0;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 9px;
}
.conversation-name {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.88rem;
}
.conversation-date {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 4px;
}
.conversation-more {
  border: 0;
  background: transparent;
  padding: 4px;
  font-size: 1.3rem;
  min-width: 32px;
}
.row-menu {
  grid-column: 1/-1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  margin: 0 6px 7px;
  padding: 4px;
  display: flex;
  gap: 4px;
}
.row-menu button {
  border: 0;
  font-size: 0.8rem;
  flex: 1;
  padding: 6px;
}
.danger-text {
  color: var(--danger);
}
.list-empty {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 12px 5px;
}
.account {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 12px;
}
.account-button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px;
  font-size: 0.85rem;
}
.account-button span:last-child {
  color: var(--muted);
  font-size: 0.75rem;
}
#usage {
  margin: 5px 6px;
}
.version {
  font-size: 0.68rem;
  color: var(--muted);
  margin: 6px;
}
.chat-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.chat-header {
  min-height: 68px;
  padding: 13px 28px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  align-items: center;
}
.header-text {
  min-width: 0;
  flex: 1;
}
.chat-header h1 {
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 0 4px;
}
.chat-header p {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
}
.badge {
  font-size: 0.72rem;
  background: var(--warning-bg);
  color: var(--warning);
  padding: 6px 9px;
  border-radius: 6px;
  white-space: nowrap;
}
#menu-toggle {
  display: none;
}
.messages {
  flex: 1;
  overflow: auto;
  padding: 26px max(24px, calc((100% - 840px) / 2));
  overflow-wrap: anywhere;
}
.empty-state {
  padding-top: clamp(26px, 9vh, 105px);
}
.empty-state h2 {
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 600;
  margin-bottom: 16px;
}
.empty-state p {
  color: var(--muted);
  line-height: 1.8;
}
.message {
  margin: 0 0 27px;
  min-width: 0;
}
.speaker {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 9px;
}
.message.user {
  margin-left: 36px;
}
.message.user .text {
  background: var(--soft);
  border-radius: 3px;
  padding: 14px 18px;
  white-space: pre-wrap;
  line-height: 1.75;
}
.message.user .text.collapsed {
  max-height: 180px;
  overflow: hidden;
}
.message.assistant .text {
  line-height: 1.75;
}
.text p {
  margin: 0 0 14px;
}
.text h1,
.text h2,
.text h3,
.text h4 {
  font-size: 1.12rem;
  margin: 22px 0 12px;
}
.text ul,
.text ol {
  padding-left: 25px;
}
.text pre {
  overflow: auto;
  background: var(--soft);
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 3px;
  font-size: 0.86rem;
  white-space: pre;
}
.text code {
  font-family: Consolas, monospace;
  background: var(--soft);
  padding: 2px 4px;
  border-radius: 3px;
}
.text pre code {
  padding: 0;
}
.text blockquote {
  border-left: 3px solid var(--line);
  padding-left: 16px;
  margin-left: 0;
  color: var(--muted);
}
.text a {
  color: var(--link);
}
.table-wrap {
  overflow-x: auto;
  max-width: 100%;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.86rem;
  text-align: left;
}
th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
th {
  background: var(--surface-alt);
  font-weight: 600;
}
.text table {
  margin-bottom: 16px;
}
.text th,
.text td {
  min-width: 90px;
}
.message-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}
.copy {
  border: 0;
  background: transparent;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 5px 9px;
  min-height: 32px;
}
.optimistic-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 6px;
}
.composer-area {
  position: relative;
  padding: 10px max(24px, calc((100% - 840px) / 2)) 14px;
}
.composer {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 12px 14px;
  box-shadow: 0 4px 18px var(--shadow);
}
.composer textarea {
  border: 0;
  resize: none;
  min-height: 56px;
  max-height: 200px;
  padding: 2px;
  line-height: 1.65;
  display: block;
}
.composer-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.composer-bottom span {
  font-size: 0.7rem;
  color: var(--muted);
}
#char-count {
  margin-left: auto;
}
#send {
  font-size: 0.88rem;
  min-width: 80px;
}
.composer-note {
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.6;
  text-align: center;
  margin: 9px 0 0;
}
.request-status {
  background: var(--soft);
  border-radius: 3px;
  margin-bottom: 10px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
  line-height: 1.6;
}
.request-status.error {
  background: var(--danger-bg);
  color: var(--danger);
}
.request-status button {
  flex-shrink: 0;
}
.latest-button {
  display: block;
  margin: 0 auto 10px;
  font-size: 0.8rem;
  box-shadow: 0 2px 10px var(--shadow);
}
.sidebar-backdrop {
  display: none;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 26px;
  width: min(920px, 94vw);
  max-height: 85dvh;
  overflow: auto;
}
dialog::backdrop {
  background: var(--backdrop);
}
dialog h2 {
  font-size: 1.2rem;
}
.small-dialog {
  max-width: 470px;
}
.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.dialog-header h2 {
  margin: 0;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.danger-button {
  background: var(--danger);
  color: var(--on-accent);
  border-color: var(--danger);
}
.danger-button:hover {
  background: var(--danger-hover);
}
.delete-title {
  overflow-wrap: anywhere;
  font-weight: bold;
}
.invite-form {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}
.invite-form label {
  flex: 1;
  min-width: 0;
}
.invite-form button {
  white-space: nowrap;
  margin-bottom: 7px;
}
.invite-result {
  background: var(--soft);
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 3px;
  margin: 18px 0;
}
.invite-result strong {
  overflow-wrap: anywhere;
}
.invite-result label {
  font-size: 0.8rem;
  margin-top: 8px;
}
.link-copy {
  display: flex;
  gap: 8px;
}
.link-copy button {
  white-space: nowrap;
  font-size: 0.8rem;
}
.link-copy input {
  font-size: 0.85rem;
}
#users-table td {
  vertical-align: top;
}
#users-table td:last-child {
  min-width: 195px;
}
#users-table button {
  font-size: 0.75rem;
  padding: 6px;
  margin: 0 4px 4px 0;
}
.user-login {
  font-size: 0.73rem;
  color: var(--muted);
  display: block;
  overflow-wrap: anywhere;
  margin-top: 4px;
}
.status-label {
  white-space: nowrap;
  font-size: 0.8rem;
}
#password-form > button {
  margin-top: 18px;
}
#usage-details {
  white-space: pre-line;
}
@media (max-width: 950px) {
  .workspace {
    grid-template-columns: 244px minmax(0, 1fr);
  }
  .chat-header {
    padding: 13px 20px;
  }
  .messages {
    padding: 24px;
  }
  .composer-area {
    padding: 10px 24px 14px;
  }
  .brand {
    font-size: 1.35rem;
  }
  .sidebar-subtitle {
    font-size: 0.7rem;
  }
  .invite-form {
    flex-wrap: wrap;
  }
  .invite-form label {
    flex-basis: 40%;
  }
}
@media (max-width: 650px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  #sidebar {
    display: none;
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    z-index: 40;
  }
  #sidebar.open {
    display: flex;
  }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: var(--backdrop);
    z-index: 35;
    border: 0;
    border-radius: 0;
  }
  #menu-toggle {
    display: block;
  }
  .chat-header {
    padding: 10px 14px;
    gap: 10px;
    min-height: 64px;
  }
  .badge {
    font-size: 0.65rem;
    flex-shrink: 0;
    text-align: center;
  }
  .messages {
    padding: 22px 16px;
  }
  .message.user {
    margin-left: 18px;
  }
  .composer-area {
    padding: 8px 14px 12px;
  }
  .composer-bottom {
    gap: 6px;
  }
  .composer-note {
    font-size: 0.67rem;
  }
  .auth-card {
    padding: 25px;
  }
  .invite-form {
    display: block;
  }
  .invite-form button {
    margin-top: 10px;
  }
  .link-copy {
    flex-wrap: wrap;
  }
  .link-copy input {
    flex-basis: 100%;
  }
  .request-status {
    flex-wrap: wrap;
  }
  dialog {
    padding: 21px;
  }
  .brand {
    font-size: 1.5rem;
  }
  .sidebar-subtitle {
    font-size: 0.75rem;
  }
}
@media (pointer: coarse) {
  button,
  .copy {
    min-height: 44px;
  }
  .conversation-row {
    grid-template-columns: minmax(0, 1fr) 44px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}

/* Documents: the same reading width and keyboard controls as chat. */
select {
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 10px;
  min-width: 0;
}
select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.composer.dragging {
  border: 2px dashed var(--navy);
  background: var(--soft);
}
.drop-hint {
  padding: 12px;
  color: var(--navy);
  text-align: center;
  font-weight: 700;
}
.attachment-list,
.sent-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.file-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: min(100%, 340px);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 3px 6px 3px 10px;
  font-size: 0.82rem;
}
.file-chip span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-summary {
  flex-basis: 100%;
  padding: 0 0 4px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.attachment-list {
  max-height: 145px;
  overflow: auto;
}
.document-image {
  display: block;
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  margin: 12px auto;
  border: 1px solid var(--line);
}
.file-settings-form {
  display: grid;
  gap: 12px;
}
.file-settings-form input[type="text"],
.file-settings-form select {
  width: 100%;
  margin: 8px 0;
}
.file-settings-form input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
}
#file-settings-info {
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.format-help {
  text-align: left;
}
.format-help summary {
  cursor: pointer;
  text-align: center;
}
.remove-file {
  padding: 2px 8px;
  min-height: 32px;
  flex: none;
  border: 0;
  background: transparent;
}
#attachment-status {
  margin: 8px 0;
}
.file-help {
  margin: 6px 0;
  font-size: 0.74rem;
  color: var(--muted);
  text-align: center;
}
.sent-files {
  margin-top: 8px;
}
.download-link {
  display: inline-block;
  color: var(--navy);
  font-size: 0.85rem;
  padding: 8px 0;
  overflow-wrap: anywhere;
}
.rules-home {
  width: min(850px, 100%);
  margin: 30px auto;
}
.rules-home h2 {
  font-size: 1.7rem;
  letter-spacing: -0.6px;
}
.rules-search {
  display: flex;
  gap: 8px;
  margin: 24px 0 16px;
}
.rules-search input {
  flex: 1;
}
.rules-search button {
  flex: none;
}
.search-results > .primary {
  margin: 4px 0 12px;
}
.source-card {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 16px;
  margin: 12px 0;
  background: var(--surface);
  overflow-wrap: anywhere;
}
.source-card strong {
  font-size: 0.95rem;
}
.source-card .muted {
  margin: 6px 0;
}
.source-snippet {
  line-height: 1.7;
  font-size: 0.9rem;
  margin-bottom: 6px;
}
.answer-sources {
  margin-top: 12px;
}
.answer-sources summary {
  cursor: pointer;
  color: var(--navy);
  padding: 10px 0;
  font-size: 0.88rem;
}
.source-dialog {
  width: min(800px, 95vw);
}
.source-text {
  font: inherit;
  white-space: pre-wrap;
  line-height: 1.85;
  padding: 16px;
  background: var(--soft);
  max-height: 55vh;
  overflow: auto;
  overflow-wrap: anywhere;
}
.documents-dialog {
  width: min(950px, 96vw);
}
.document-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}
.document-form label input,
.document-form label select {
  display: block;
  width: 100%;
  margin-top: 7px;
}
.document-form > button {
  margin-top: 14px;
}
.document-list {
  margin-top: 24px;
}
.document-card {
  border-top: 1px solid var(--line);
  padding: 22px 0;
  display: grid;
  gap: 10px;
}
.document-card p {
  margin: 0;
}
.document-card .inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0;
}
.inline-check input {
  width: 18px;
  height: 18px;
  flex: none;
}
.document-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.document-controls input {
  max-width: 90px;
}
#attach-file {
  flex: none;
  padding: 6px;
}
@media (max-width: 700px) {
  .rules-search {
    flex-wrap: wrap;
  }
  .rules-search input {
    flex-basis: 100%;
  }
  .rules-search select {
    flex: 1;
  }
  .document-form {
    grid-template-columns: 1fr;
  }
  .rules-home h2 {
    font-size: 1.4rem;
  }
  .file-help {
    font-size: 0.68rem;
  }
  #input-hint {
    max-width: 130px;
  }
}
.document-mode {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
  font-size: 13px;
}
.document-mode select {
  width: auto;
  padding: 6px 8px;
}
.document-mode span {
  color: var(--muted);
}
.review-coverage {
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 13px;
}
.review-coverage p {
  margin: 6px 0;
}
.review-incomplete {
  border-color: var(--warning);
  background: var(--warning-bg);
}

/* Sent files are managed separately from the next message's upload queue. */
#conversation-files-open {
  flex-shrink: 0;
  white-space: nowrap;
}
#conversation-files-list {
  max-height: 50vh;
}
#conversation-files-list .file-chip {
  width: 100%;
  max-width: none;
}
.message-actions {
  flex-wrap: wrap;
}
.export-choices {
  flex-basis: 100%;
  display: grid;
  gap: 10px;
  min-width: 0;
}
.export-choice {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 12px;
}
.export-choice p {
  margin: 0 0 8px;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.upload-queue {
  max-height: 160px;
  overflow: auto;
}
.upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 6px;
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
}
.upload-row span {
  flex: 1;
  min-width: 160px;
  overflow-wrap: anywhere;
}
.upload-row small {
  flex-basis: 100%;
}

/* Editorial appearance; existing navigation, file controls and chat flow stay put. */
.brand {
  font-weight: 400;
  letter-spacing: -0.8px;
  padding-bottom: 13px;
  border-bottom: 3px solid var(--text);
}
#brand-signature {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 3px solid var(--text);
  border-radius: 0;
  padding: 0 0 13px;
  min-height: 0;
  background: transparent;
  text-align: left;
  user-select: none;
}
.sidebar-subtitle {
  margin-top: 11px;
  min-height: 1.8em;
}
.signature-visible {
  color: var(--navy);
  letter-spacing: 1px;
  font-weight: 600;
}
#sidebar {
  background: var(--surface);
}
.new-chat.primary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--text);
  border-radius: 0;
}
.new-chat:hover {
  background: var(--soft);
}
.rules-button {
  background: var(--soft);
  border-color: var(--navy);
  border-radius: 0;
}
#conversation-search {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.conversation-row {
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  margin: 0;
}
.conversation-row.selected {
  background: transparent;
  box-shadow: inset 0 -2px var(--navy);
}
.conversation-row.selected .conversation-name {
  font-weight: 700;
}
.conversation-open {
  padding: 14px 7px;
}
.conversation-date {
  font-variant-numeric: tabular-nums;
}
.account {
  border-top: 2px solid var(--text);
}
.chat-header {
  min-height: 80px;
  flex-wrap: wrap;
}
.chat-header h1 {
  font-size: 1.05rem;
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin: 0 0 0 auto;
  min-height: 40px;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--text);
}
.theme-toggle input {
  appearance: none;
  width: 38px;
  height: 22px;
  min-width: 38px;
  margin: 0;
  padding: 0;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
  cursor: pointer;
}
.theme-toggle input::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 150ms ease;
}
.theme-toggle input:checked {
  background: var(--navy);
  border-color: var(--navy);
}
.theme-toggle input:checked::before {
  transform: translateX(16px);
  background: var(--on-accent);
}
.auth-theme-toggle {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}
.auth-view,
.auth-card {
  background: var(--surface);
}
.auth-card {
  border-radius: 3px;
}
.message.user {
  margin-left: 0;
}
.message.user .text {
  background: transparent;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 4px 0 20px;
}
.message.assistant .text {
  line-height: 1.9;
}
.text h1,
.text h2 {
  font-size: 1.5rem;
  letter-spacing: -0.6px;
}
.text h3,
.text h4 {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.speaker {
  letter-spacing: 0.3px;
}
.composer {
  border: 0;
  border-top: 2px solid var(--text);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 13px 0 9px;
  box-shadow: none;
  background: var(--surface);
}
.composer textarea {
  background: transparent;
}
.file-chip {
  background: var(--soft);
  border: 0;
  border-left: 2px solid var(--line);
  border-radius: 0;
}
.source-card {
  border-radius: 2px;
}
.danger-button {
  color: var(--on-danger);
}
.work-report-card,
.review-coverage {
  border-radius: 3px;
}
@media (max-width: 650px) {
  .chat-header {
    gap: 6px 10px;
  }
  .header-text {
    flex-basis: calc(100% - 60px);
  }
  .theme-toggle {
    min-height: 40px;
  }
  .chat-header .badge {
    white-space: normal;
  }
  .text h1,
  .text h2 {
    font-size: 1.25rem;
  }
}
@media (pointer: coarse) {
  .theme-toggle {
    min-height: 44px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .theme-toggle input::before {
    transition: none;
  }
}
