/* Three visual layers: page background, section headings, readable descriptions. */
:root {
  --topic: #087d62;
  --description: #263c36;
  --surface-topic: #e3eae7;
  --surface-description: #fff;
}
[data-theme="dark"] {
  --paper: #20242d;
  --white: #303641;
  --line: #424957;
  --ink: #f1f3f5;
  --muted: #b0bac4;
  --topic: #70e1bd;
  --description: #ecf2f4;
  --surface-topic: #3b4351;
  --surface-description: #2c323e;
  --accent-soft: #344638;
  --brand: #70e1bd;
}
[data-theme="dark"] .sidebar {
  background: #191e25;
  border-color: var(--line);
}
[data-theme="dark"] .topbar {
  background: #252b35;
  border-color: var(--line);
}
.quickbar {
  display: none;
}
.panel-head,
.data-table th {
  background: var(--surface-topic) !important;
}
.panel-head h2,
.page-head h1,
.info-card h3,
.modal-title,
.agenda-day h2 {
  color: var(--topic);
}
.panel-body,
.info-card,
.data-table td {
  color: var(--description);
}
[data-theme="dark"] .info-card,
[data-theme="dark"] .panel,
[data-theme="dark"] .modal-panel {
  background: var(--surface-description);
}
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] .form-grid input,
[data-theme="dark"] .form-grid select,
[data-theme="dark"] .form-grid textarea {
  background: #252b35 !important;
  border-color: var(--line);
}
[data-theme="dark"] .data-table tbody tr:hover td {
  background: #343e4c;
}
[data-theme="dark"] .btn.ghost,
[data-theme="dark"] .icon-btn {
  background: #303743;
}
.operation-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.page-head .btn{white-space:nowrap}
.operation-tools input,
.operation-tools select {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
}
.disclosure {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 14px 0;
  background: var(--white);
}
.disclosure > summary {
  cursor: pointer;
  padding: 14px;
  font-weight: 700;
  color: var(--topic);
}
.disclosure > div {
  padding: 0 14px 14px;
}
.disclosure .form-grid {
  margin-top: 12px;
}
.agenda-day {
  margin: 20px 0;
}
.agenda-day h2 {
  font-size: 14px;
}
.agenda-entry {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 8px 0;
}
.agenda-entry time {
  font-weight: 700;
  min-width: 110px;
}
.agenda-entry > div {
  flex: 1;
  min-width: 0;
}
.agenda-entry p {
  color: var(--muted);
  margin: 5px 0;
  font-size: 12px;
}
.agenda-entry .btn {
  flex: none;
}
.inbox {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: calc(100dvh - 300px);
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--white);
}
.inbox-sidebar {
  overflow: auto;
  border-right: 1px solid var(--line);
}
.inbox-sidebar > input {
  width: calc(100% - 24px);
  margin: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.thread-list button {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 16px;
  cursor: pointer;
}
.thread-list button.selected {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 var(--topic);
}
.thread-list b,
.thread-list small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread-list small {
  color: var(--muted);
  margin-top: 5px;
}
.thread-list em {
  float: right;
  font-style: normal;
  color: var(--topic);
}
.chat-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.chat-head {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.chat-head h2 {
  margin: 0;
  font-size: 15px;
  color: var(--topic);
}
.chat-head small {
  color: var(--muted);
}
.chat-messages {
  flex: 1;
  overflow: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--paper);
}
.chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  align-self: flex-start;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.chat-bubble.outbound {
  align-self: flex-end;
  border-color: var(--topic);
}
.chat-bubble small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 6px;
}
.chat-compose {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
}
.chat-compose textarea {
  flex: 1;
  resize: vertical;
  min-height: 50px;
  max-height: 150px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.connection-summary {
  font-size: 12px;
  color: var(--muted);
}
.identity-preview {
  max-width: 150px;
  max-height: 85px;
  object-fit: contain;
}
.fiscal-notice {
  padding: 14px;
  border-left: 3px solid var(--topic);
  background: var(--paper);
  font-size: 13px;
  line-height: 1.6;
}
.form-grid .check-label {
  flex-direction: row;
  align-items: center;
}
.form-grid .check-label input {
  width: auto;
}
.chat-tools {
  display: flex;
  gap: 6px;
}
.chat-empty {
  margin: auto;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}
@media (max-width: 900px) {
  .inbox {
    grid-template-columns: 220px minmax(0, 1fr);
  }
}
@media (max-width: 650px) {
  .page-head{flex-direction:column;align-items:stretch;gap:12px}
  .page-head>div{width:100%}
  .page-head .page-actions{justify-content:flex-start;flex-wrap:wrap}
  .inbox {
    display: flex;
    flex-direction: column;
    height: auto;
  }
  .inbox-sidebar {
    max-height: 220px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .chat-pane {
    min-height: 440px;
  }
  .chat-messages {
    max-height: 450px;
  }
  .chat-head {
    flex-wrap: wrap;
  }
  .agenda-entry {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .agenda-entry time {
    min-width: 100%;
    font-size: 12px;
  }
  .chat-compose {
    flex-wrap: wrap;
  }
  .chat-compose textarea {
    min-width: 100%;
  }
  .operation-tools {
    align-items: stretch;
  }
}
