/* Current redesign search panel and admin/document tables. */
.search-layout-shell {
  width: min(1472px, calc(100% - 64px));
}

.search-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 22px;
  align-items: start;
}

.search-panel {
  min-height: calc(100vh - 118px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 22px 28px 18px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.search-panel .section-heading {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  padding-bottom: 16px;
  border-bottom: 1px solid #eef2f6;
}

.search-panel .section-heading h2 {
  font-size: 29px;
}

.search-panel .section-heading .muted {
  margin-top: 7px;
}

.chat-thread {
  flex: 1;
  min-height: 280px;
  overflow: auto;
  padding: 14px 0 12px;
}

.message {
  margin-bottom: 14px;
}

.message-label {
  margin: 0 0 8px;
  color: #8b98a2;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message.user {
  display: grid;
  justify-items: end;
}

.message.user .message-label {
  margin-right: 4px;
}

.message-body {
  border-radius: 22px;
  padding: 13px 17px;
  font-size: 15px;
  line-height: 1.4;
}

.message.user .message-body {
  max-width: 590px;
  border: 1px solid var(--blue-line);
  border-bottom-right-radius: 8px;
  background: var(--blue-soft);
  color: #17498d;
  font-weight: 800;
}

.message.assistant .message-body {
  max-width: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(32, 51, 75, 0.06);
  color: #455057;
}

.message.assistant .message-body > p {
  grid-column: 1 / -1;
  margin: 0;
}

.message.assistant .message-body > p + .chat-result-card {
  margin-top: 0;
}

.chat-result-card {
  width: 100%;
  min-width: 0;
}

.chat-search-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.search-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid #eef2f6;
}

.search-composer textarea {
  min-height: 54px;
  max-height: 160px;
  padding: 15px 18px;
  border-radius: 18px;
}

.search-composer button {
  min-height: 54px;
  border-radius: 18px;
  padding: 0 24px;
}

.search-side {
  display: grid;
  gap: 16px;
}

.search-mode-panel,
.search-side-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(30, 53, 83, 0.07);
}

.search-form-actions {
  display: grid;
  gap: 12px;
  align-items: stretch;
  justify-items: stretch;
}

.search-mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 0;
  border-radius: 18px;
  background: #eef2f6;
}

.search-mode-option {
  margin: 0;
  min-width: 0;
}

.search-mode-option span {
  display: block;
  width: 100%;
  padding: 12px 8px;
  border-radius: 14px;
  color: #60707b;
  font-size: 14px;
  font-weight: 900;
  text-align: center;
}

.search-mode-option input:checked + span {
  background: #fff;
  color: #184f9f;
  box-shadow: 0 6px 16px rgba(30, 53, 83, 0.1);
}

.admin-sidebar-card {
  padding: 18px 16px;
}

.admin-nav {
  gap: 8px;
}

.admin-nav-link {
  padding: 11px 12px;
}

.access-stats-grid {
  gap: 14px;
}

.access-stat-card {
  padding: 16px;
}

.access-stat-card strong {
  color: #202c31;
  font-size: 26px;
  font-weight: 900;
}

.roles-section-divider {
  border-top-color: #e5ebf1;
  margin: 10px 0 18px;
}

.roles-browser-toolbar,
.role-compose-header {
  align-items: end;
}

.role-compose-card {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.role-compose-fields {
  gap: 12px;
}

.role-compose-field > label {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.permission-group-card {
  padding: 14px;
  background: #fff;
}

.permission-group-card-active {
  border-color: var(--blue-line);
  background: #f7fbff;
}

.permission-option {
  background: #f8fafc;
  border-color: #edf2f6;
  border-radius: 14px;
}

.permission-option input,
.checkbox-row input {
  width: auto;
  box-shadow: none;
}

.checkbox-row {
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #edf2f6;
  padding: 10px 12px;
}

.admin-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.admin-content {
  grid-template-columns: minmax(0, 1fr);
}

.admin-grid .admin-table-card {
  padding: 18px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
}

.document-table-wrap {
  border-radius: 20px;
  overflow: auto;
}

.document-table {
  border-collapse: separate;
  border-spacing: 0;
}

.document-table th,
.document-table td {
  border-bottom-color: #edf2f6;
}

.document-table th {
  background: #f8fafc;
  color: #7a8790;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.document-table tbody tr:hover {
  background: #fbfdff;
}

.document-primary-cell strong,
.table-link {
  color: #26343c;
  font-weight: 850;
}

.table-link:hover {
  color: var(--accent-2);
}

.document-icon-actions {
  gap: 7px;
}

.icon-button {
  width: 38px;
  height: 38px;
  min-height: 38px;
  border-radius: 14px;
  background: #fff;
  border-color: #dfe8ef;
  color: #334047;
  box-shadow: 0 5px 14px rgba(30, 53, 83, 0.06);
}

.icon-button-with-label {
  width: auto;
  padding: 0 12px;
  border-radius: 999px;
}

.icon-button-accent {
  color: #184f9f;
  background: #edf5ff;
  border-color: #d6e7ff;
}

.status-processed,
.diagnostic-status-ok {
  background: #eaf8f1;
  border-color: #ccebdc;
  color: var(--success);
}

.status-failed,
.diagnostic-status-error {
  background: #fff0f0;
  border-color: #ffd4d4;
  color: var(--danger);
}

.status-needs_ocr,
.diagnostic-status-warn {
  background: #fff7e8;
  border-color: #ffe1ab;
  color: var(--warning);
}

.status-no_recipes,
.diagnostic-status-muted {
  background: #f4f7fa;
  border-color: #e1e8ef;
  color: #687781;
}

.diagnostic-status-info {
  background: #edf5ff;
  border-color: #d6e7ff;
  color: #184f9f;
}
