* {
  box-sizing: border-box;
}

:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --border: #d9e2ec;
  --text: #17212b;
  --muted: #64748b;
  --brand: #0f172a;
  --brand-2: #1e293b;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --radius: 18px;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: white;
  padding: 24px 32px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo-wrap {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(255,255,255,0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 6px;
  flex-shrink: 0;
}

.brand-logo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
}

.topbar p {
  margin: 6px 0 0 0;
  color: #dbe5f0;
  font-size: 14px;
}

.topbar-note {
  margin: 10px 0 0 0;
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.5;
  max-width: 900px;
}

.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  padding: 24px;
  align-items: start;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 20px;
  position: sticky;
  top: 20px;
}

.sidebar-section h2,
.result-card h2 {
  margin: 0 0 14px 0;
  font-size: 20px;
}

.label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
}

textarea,
select,
input[type="file"] {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  background: white;
}

textarea {
  resize: vertical;
  min-height: 150px;
  line-height: 1.5;
}

.field-grid {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.field {
  margin-top: 16px;
}

.helper-text {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.primary-btn,
.secondary-btn {
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.primary-btn {
  width: 100%;
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--brand);
  color: white;
}

.primary-btn:hover {
  background: var(--brand-2);
}

.secondary-btn {
  padding: 10px 14px;
  background: #e2e8f0;
  color: #0f172a;
}

.secondary-btn:hover:not(:disabled) {
  background: #d4dce6;
}

.secondary-btn:disabled,
.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status-box {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--panel-soft);
  border: 1px solid #e2e8f0;
  color: #475569;
  font-size: 13px;
  line-height: 1.5;
}

.notice-box {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 13px;
  line-height: 1.5;
}

.content-area {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  overflow: hidden;
}

.summary-item {
  padding: 18px 20px;
  border-right: 1px solid var(--border);
}

.summary-item:last-child {
  border-right: none;
}

.summary-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 8px;
}

.summary-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.result-card {
  padding: 20px;
}

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

.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.subtext {
  margin: 6px 0 0 0;
  color: var(--muted);
  font-size: 13px;
}

.review-box {
  min-height: 340px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fcfcfd;
  padding: 20px;
  line-height: 1.75;
  font-size: 15px;
  white-space: pre-wrap;
  overflow-x: auto;
}

.review-section-title {
  font-weight: 700;
  font-size: 17px;
  margin: 22px 0 10px 0;
  color: #0f172a;
}

.review-section-title:first-child {
  margin-top: 0;
}

.sources-grid {
  display: grid;
  gap: 14px;
}

.source-card {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
  background: #fcfcfd;
}

.source-card h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  line-height: 1.4;
}

.source-meta {
  margin: 0 0 10px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.source-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

.empty-state {
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  padding: 24px;
  color: var(--muted);
  background: #f8fafc;
}

.app-footer {
  margin: 24px;
  margin-top: 0;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow);
}

.footer-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.hidden {
  display: none;
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .summary-item {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .summary-item:last-child {
    border-bottom: none;
  }

  .result-header {
    flex-direction: column;
  }

  .topbar-left {
    align-items: flex-start;
  }
}
/* ------------------------------------------------------------
   Tool hub / qualitative auditor additions
------------------------------------------------------------ */
.tool-nav {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.tool-tab {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  padding: 9px 14px;
  font-weight: 700;
  cursor: pointer;
}

.tool-tab.active,
.tool-tab:hover {
  background: white;
  color: #0f172a;
}

.tool-view.hidden {
  display: none;
}

.audit-page {
  padding: 24px;
}

.audit-top {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.audit-top h2 {
  margin: 0;
  font-size: 22px;
}

.audit-top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.audit-notice {
  margin: 18px 0 0 0;
}

.audit-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 340px;
  gap: 24px;
  margin-top: 24px;
  align-items: start;
}

.audit-column,
.audit-main-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

input[type="text"] {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  background: white;
}

.compact-btn {
  width: auto;
  margin-top: 0;
  white-space: nowrap;
}

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mini-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px;
  background: #f8fafc;
}

.mini-card-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  color: #0f172a;
}

.mini-card-text {
  margin-top: 5px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.table-wrap {
  overflow-x: auto;
}

.findings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.findings-table th {
  text-align: left;
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
}

.findings-table td {
  vertical-align: top;
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
  line-height: 1.55;
}

.findings-table tr {
  cursor: pointer;
}

.findings-table tr:hover,
.findings-table tr.selected {
  background: #eff6ff;
}

.citation-box {
  min-height: 120px;
}

.citation-card {
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  background: #eff6ff;
  padding: 14px;
}

.citation-label {
  font-weight: 800;
  color: #1d4ed8;
  text-transform: uppercase;
  font-size: 13px;
}

.citation-source {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.citation-card blockquote {
  margin: 12px 0 0 0;
  padding-left: 12px;
  border-left: 4px solid #2563eb;
  color: #1e293b;
  line-height: 1.6;
}

.citation-card p {
  margin: 12px 0 0 0;
  color: #475569;
  line-height: 1.6;
  font-size: 13px;
}

@media (max-width: 1180px) {
  .audit-layout {
    grid-template-columns: 1fr;
  }

  .audit-top {
    flex-direction: column;
  }
}
