* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f5f7fb;
  color: #1f2937;
}

.hidden {
  display: none !important;
}

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

.app.wide-layout {
  max-width: 1280px;
}

/* ===== HEADER ===== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 900;
  width: 100%;
  margin: 0 auto 20px;
  padding: 12px 0;
  background: #f5f7fb;
}

.app-header h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.app-header p {
  margin: 0;
  color: #6b7280;
}

.app-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.brand-block {
  flex: 0 0 220px;
  min-height: 50px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.header-actions {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  flex: 1 1 auto;
  min-width: 0;
}

.user-info {
  font-size: 14px;
  color: #374151;
  background: #ffffff;
  border: 1px solid #d1d5db;
  padding: 10px 12px;
  border-radius: 10px;
  min-height: 42px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions > button {
  flex: 0 0 auto;
}

.header-placeholder {
  visibility: hidden;
  pointer-events: none;
}

.mobile-menu-button {
  display: none;
  white-space: nowrap;
}

.system-alert {
  margin-top: 10px;
  padding: 10px 14px;
  border: 1px solid #fecaca;
  border-radius: 12px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

/* ===== BUTTONS ===== */

.send-button {
  border: none;
  background: #111827;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
}

.send-button:hover {
  opacity: 0.92;
}

.send-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.secondary-button {
  position: relative;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  min-height: 42px;
}

.secondary-button:hover {
  background: #f9fafb;
}

.secondary-button.active-filter {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.button-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.button-badge.info-badge {
  right: 13px;
  background: #2563eb;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
  font-size: 12px;
  font-weight: 700;
}

.count-badge.info-badge {
  background: #dbeafe;
  color: #1d4ed8;
}

.secondary-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.new-chat-button {
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  min-height: 42px;
  min-width: 84px;
}

.new-chat-button:hover {
  background: #f9fafb;
}

.new-chat-button.active-filter {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.new-chat-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.logout-button {
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  min-height: 42px;
  min-width: 84px;
}

.logout-button:hover {
  background: #f9fafb;
}

.logout-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.table-action-button {
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.2;
}

.table-action-button:hover {
  background: #f9fafb;
}

.table-action-button:disabled,
.table-action-button.is-processing,
.table-action-button.is-processing:hover {
  background: #ffffff;
  color: #6b7280;
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===== AUTH ===== */

.auth-layout {
  display: flex;
  justify-content: center;
}

.auth-card {
  background: #ffffff;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 420px;
}

.auth-card h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.auth-subtitle {
  margin: 0 0 20px;
  color: #6b7280;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-form label:has(input[name="createUserRoles"]) {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 3px 0;
  font-size: 15px;
}

.admin-form input[name="createUserRoles"] {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: #2563eb;
}

.auth-input {
  width: 100%;
  padding: 14px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  font-size: 16px;
  outline: none;
  background: #ffffff;
  color: #111827;
  font-family: inherit;
}

.auth-input:focus {
  border-color: #2563eb;
}

textarea.auth-input {
  resize: vertical;
  min-height: 96px;
  line-height: 1.45;
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #ffffff;
  cursor: pointer;
  font-size: 14px;
  color: #111827;
}

.checkbox-option:hover {
  background: #f9fafb;
}

.checkbox-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #2563eb;
}

.checkbox-option span {
  display: inline-block;
}

.checkbox-option.compact-checkbox {
  padding: 6px 8px;
  border: none;
  background: transparent;
}

.openai-check-toggle {
  width: auto;
  min-height: 34px;
  padding: 8px 10px;
  text-align: center;
  font-weight: 700;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.openai-check-toggle.needs-check {
  border: 1px solid #2563eb;
  background: #dbeafe;
  color: #1d4ed8;
}

.openai-check-toggle.needs-check:hover {
  background: #bfdbfe;
}

.openai-check-toggle.is-checked {
  border: 1px solid #e5e7eb;
  background: #f3f4f6;
  color: #6b7280;
}

.file-dropzone {
  position: relative;
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.file-dropzone:hover {
  border-color: #2563eb;
  background: #eff6ff;
}

.file-dropzone.dragover {
  border-color: #2563eb;
  background: #dbeafe;
}

.file-dropzone-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 6px;
}

.file-dropzone-subtitle {
  font-size: 13px;
  color: #6b7280;
}

.file-dropzone-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-dropzone-file {
  font-size: 13px;
  color: #374151;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
}

.upload-status {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.upload-status-text {
  font-size: 14px;
  color: #1d4ed8;
}

.upload-progress {
  width: 100%;
  height: 10px;
  background: #dbeafe;
  border-radius: 999px;
  overflow: hidden;
}

.upload-progress-bar {
  width: 0%;
  height: 100%;
  background: #2563eb;
  border-radius: 999px;
  transition: width 0.2s ease;
}

.auth-error {
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
}

.auth-button {
  width: 100%;
}

.admin-success {
  color: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
}

/* ===== CHAT ===== */

.chat-layout {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  padding: 20px;
  max-width: 1000px;
  margin: 0 auto;
}

.chat-panel-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.chat-messages {
  min-height: 400px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 12px;
  background: #f9fafb;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  margin-bottom: 16px;
}

.message {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.message.user {
  align-items: flex-end;
}

.message.assistant {
  align-items: flex-start;
}

.message-bubble {
  max-width: 75%;
  padding: 12px 14px;
  border-radius: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.user .message-bubble {
  background: #2563eb;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
  background: #e5e7eb;
  color: #111827;
  border-bottom-left-radius: 4px;
}

.message-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-input {
  width: 100%;
  resize: vertical;
  min-height: 80px;
  padding: 14px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  font-size: 17px;
  line-height: 1.5;
  outline: none;
  background: #ffffff;
}

.chat-input:focus {
  border-color: #2563eb;
}

.chat-actions {
  display: flex;
  justify-content: flex-end;
}

.typing {
  font-style: italic;
  color: #6b7280;
}

/* ===== SOURCES ===== */

.sources {
  width: 75%;
  margin-top: 8px;
  padding: 10px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  box-sizing: border-box;
}

.sources-title {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 14px;
  color: #374151;
}

.sources-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.source-item {
  padding: 10px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
}

.source-file {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  color: #111827;
}

.source-text {
  font-size: 13px;
  line-height: 1.45;
  color: #4b5563;
  margin-top: 4px;
}

.source-download-button {
  margin-top: 8px;
}

/* ===== ADMIN ===== */

.admin-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-header-row h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.admin-subtitle {
  margin: 0;
  color: #6b7280;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
}

.documents-catalog-grid {
  grid-template-columns: minmax(240px, 0.85fr) minmax(0, 2.15fr);
}

.documents-catalog-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.documents-catalog-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.admin-card {
  background: #ffffff;
  padding: 18px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  min-width: 0;
}

.admin-card h3 {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 18px;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.system-health-summary {
  padding: 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}

.system-health-summary.is-ok {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.system-health-summary.is-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.system-health-checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.system-health-check {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}

.system-health-check.is-ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.system-health-check.is-error {
  border-color: #fecaca;
  background: #fff1f2;
}

.system-health-check-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
  font-size: 12px;
  font-weight: 700;
}

.system-health-check.is-ok .system-health-check-status {
  background: #dcfce7;
  color: #166534;
}

.system-health-check.is-error .system-health-check-status {
  background: #fee2e2;
  color: #991b1b;
}

.system-health-check-label {
  font-weight: 700;
  color: #111827;
  margin-bottom: 3px;
}

.system-health-check-message {
  color: #4b5563;
  font-size: 13px;
  line-height: 1.35;
}

.admin-form select.auth-input {
  min-height: 46px;
  width: min(100%, 520px);
}

.documents-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.documents-toolbar .auth-input {
  flex: 1;
  min-width: 260px;
}

.documents-toolbar .catalog-control {
  flex: 0 1 190px;
  min-width: 170px;
  padding: 10px 12px;
  font-size: 14px;
}

.catalog-reset-button {
  width: 100%;
}

.catalog-sidebar-group {
  margin-bottom: 22px;
}

.catalog-sidebar-group:last-child {
  margin-bottom: 0;
}

.catalog-sidebar-group h3 {
  margin: 0 0 12px;
}

.catalog-sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: 14px;
  color: #111827;
  line-height: 1.4;
  text-align: left;
}

.catalog-sidebar-link .count-badge {
  flex-shrink: 0;
}

.catalog-sidebar-link-text {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.catalog-sidebar-link.active-filter {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.catalog-documents-list {
  overflow-x: auto;
}

.catalog-documents-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 820px;
}

.openai-checks-table {
  min-width: 640px;
}

.catalog-documents-table th,
.catalog-documents-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

.catalog-documents-table th {
  color: #6b7280;
  font-weight: 600;
  background: #f9fafb;
  vertical-align: middle;
}

.catalog-documents-table th.catalog-th-id,
.catalog-documents-table .catalog-id-cell {
  width: 56px;
  max-width: 72px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.catalog-th-title,
.catalog-title-cell {
  width: 24%;
}

.catalog-th-file,
.catalog-file-cell {
  width: 25%;
}

.catalog-th-section,
.catalog-section-cell {
  width: 14%;
}

.catalog-th-access,
.catalog-roles-cell {
  width: 16%;
}

.catalog-th-updated,
.catalog-updated-cell {
  width: 18%;
}

.catalog-document-main-row td {
  vertical-align: top;
}

.catalog-documents-table td.catalog-title-cell {
  vertical-align: top;
}

.catalog-documents-table .table-empty-cell {
  padding: 18px 10px;
  color: #6b7280;
  text-align: center;
}

.openai-checks-table .catalog-title-cell {
  width: 25%;
}

.openai-checks-table .catalog-file-cell {
  width: 30%;
}

.openai-check-main-row td {
  border-bottom: none;
}

.openai-check-actions-row td {
  padding-top: 0;
  border-bottom: 1px solid #e5e7eb;
}

.openai-check-actions {
  width: 100%;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  padding-left: 0;
}

.openai-check-actions .table-action-button {
  width: auto;
  min-height: 34px;
  padding: 8px 10px;
  text-align: center;
  white-space: nowrap;
}

.catalog-header-button,
.catalog-header-select {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #374151;
  font: inherit;
  font-weight: 600;
  text-align: left;
}

.catalog-header-button {
  cursor: pointer;
  padding: 6px 8px;
}

.catalog-header-button:hover,
.catalog-header-button:focus-visible,
.catalog-header-select:focus-visible {
  border-color: #bfdbfe;
  background: #eff6ff;
  outline: none;
}

.catalog-header-select {
  cursor: pointer;
  padding: 6px 26px 6px 8px;
  appearance: none;
  -webkit-appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, #6b7280 50%) right 12px center / 5px 5px no-repeat,
    linear-gradient(135deg, #6b7280 50%, transparent 50%) right 7px center / 5px 5px no-repeat;
}

.catalog-document-title {
  font-weight: 700;
  color: #111827;
}

.catalog-document-summary {
  margin-top: 4px;
  color: #6b7280;
  line-height: 1.35;
}

.catalog-title-cell {
  min-width: 220px;
}

.catalog-actions-cell {
  padding-top: 0;
  border-bottom: 1px solid #e5e7eb;
}

.catalog-table-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-start;
  padding: 0 0 10px 64px;
}

.catalog-document-main-row td {
  border-bottom: none;
}

.catalog-document-actions-row td::before {
  display: none;
}

.issue-description-row td {
  border-bottom: none;
  padding: 12px 8px 4px;
}

.issue-description-cell {
  background: #ffffff;
}

.issue-meta-row td {
  border-bottom: none;
  padding-top: 4px;
  padding-bottom: 8px;
  vertical-align: middle;
}

.issue-actions-row .catalog-actions-cell {
  padding-top: 0;
  border-bottom: 1px solid #e5e7eb;
}

.issue-actions-row .catalog-table-actions {
  padding: 0 0 12px;
}

.issue-actions-row td::before,
.issue-description-row td::before {
  display: none;
}

.proposals-table {
  min-width: 980px;
}

.proposal-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  margin-right: 6px;
  margin-bottom: 4px;
}

.proposal-type {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  margin-right: 6px;
  margin-bottom: 4px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 700;
}

.proposal-status-pending {
  background: #fef3c7;
  color: #92400e;
}

.proposal-status-processing {
  background: #dbeafe;
  color: #1d4ed8;
}

.proposal-status-approved {
  background: #dcfce7;
  color: #166534;
}

.proposal-status-rejected {
  background: #fee2e2;
  color: #991b1b;
}

.proposal-status-open {
  background: #fef3c7;
  color: #92400e;
}

.proposal-status-in_progress {
  background: #dbeafe;
  color: #1d4ed8;
}

.proposal-status-resolved {
  background: #dcfce7;
  color: #166534;
}

.proposal-status-cancelled {
  background: #f3f4f6;
  color: #4b5563;
}

.proposal-roles-picker {
  display: flex;
  gap: 8px;
  flex-basis: 100%;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.proposal-role-option {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #374151;
}

.proposal-section-select {
  width: 100%;
  min-width: 150px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  font: inherit;
}

.proposal-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  color: #4b5563;
  font-size: 13px;
}

.activity-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.activity-details-card {
  max-width: 680px;
}

.activity-detail-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #e5e7eb;
}

.activity-detail-label {
  color: #6b7280;
  font-size: 13px;
  font-weight: 600;
}

.activity-detail-value {
  color: #111827;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.admin-users-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.users-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-layout .users-table {
  min-width: 760px;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
}

.users-table th,
.users-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

.users-table th {
  font-size: 13px;
  color: #6b7280;
  font-weight: 600;
}

.users-table td {
  font-size: 14px;
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ===== SECTIONS ===== */

.sections-tree {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
}

.section-node {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-node-label {
  padding: 10px 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: 14px;
  color: #111827;
  line-height: 1.4;
}

.section-node > .section-node-label:not(.document-list-item) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-count {
  min-width: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.document-list-item {
  padding: 8px 10px;
}

.document-list-item > div {
  margin-top: 3px !important;
}

.document-list-item > div:first-child {
  margin-top: 0 !important;
}

.document-actions {
  margin-top: 6px !important;
}

.section-children {
  margin-left: 18px;
  padding-left: 14px;
  border-left: 2px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.empty-state {
  padding: 14px;
  border-radius: 10px;
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  color: #6b7280;
  font-size: 14px;
}

/* ===== MODAL ===== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
  padding: 20px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.modal-header h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.3;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-label {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.modal-note {
  margin: 0;
  color: #4b5563;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-line;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: #111827;
}

.checkbox-option input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: #2563eb;
  appearance: checkbox;
  -webkit-appearance: checkbox;
}

.checkbox-option span {
  display: inline-block;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 900px) {
  .app {
    padding: 12px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .documents-catalog-layout {
    grid-template-columns: 1fr;
  }

  .app-header-top {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-block {
    flex: 0 0 auto;
    align-items: center;
  }

  .app-header h1 {
    font-size: 22px;
  }

  .app-header p {
    font-size: 13px;
  }

  .mobile-menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 86px;
  }

  .header-actions {
    display: none;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    width: 100%;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
  }

  .app.mobile-nav-open .header-actions {
    display: flex;
  }

  .header-actions .header-placeholder {
    display: none;
  }

  .user-info {
    width: 100%;
  }

  .system-health-check {
    grid-template-columns: 1fr;
  }

  .activity-filters {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .message-bubble,
  .sources {
    width: 100%;
    max-width: 100%;
  }

  .catalog-documents-list {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .catalog-documents-table {
    min-width: 820px;
  }

  .activity-detail-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .chat-input {
    font-size: 16px;
  }

  .modal-card {
    padding: 16px;
  }

  .modal-header {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-actions {
    justify-content: stretch;
  }

  .modal-actions .send-button {
    width: 100%;
  }

  .section-children {
    margin-left: 12px;
    padding-left: 10px;
  }
}