:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --card: #ffffff;
  --soft: #f3f4f1;
  --line: #dedfd9;
  --line-strong: #c8cac2;
  --text: #171817;
  --muted: #686b66;
  --green: #0f8f70;
  --green-dark: #08745b;
  --green-soft: #eaf7f2;
  --warning: #8a5b10;
  --warning-bg: #fff8e8;
  --danger: #a23b34;
  --shadow: 0 1px 2px rgba(18, 20, 18, 0.04), 0 12px 36px rgba(18, 20, 18, 0.05);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
  padding: 0 28px;
  background: rgba(247, 247, 245, 0.9);
  border-bottom: 1px solid rgba(222, 223, 217, 0.8);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--text);
  font-size: 15px;
  font-weight: 680;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand-mark, .assistant-avatar {
  display: grid;
  place-items: center;
  color: white;
  background: var(--text);
  font-family: Georgia, serif;
  font-weight: 700;
}

.brand-mark { width: 29px; height: 29px; border-radius: 9px; font-size: 14px; }
.assistant-avatar { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 12px; font-size: 17px; }

.local-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.local-badge span { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-chip {
  max-width: 180px;
  overflow: hidden;
  padding: 6px 10px;
  color: #454844;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-link,
.text-button {
  padding: 6px 4px;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
  text-decoration: none;
}

.admin-link:hover,
.text-button:hover { color: var(--text); }

.app-shell {
  display: grid;
  grid-template-columns: 210px minmax(0, 940px);
  gap: 30px;
  width: min(1220px, 100%);
  margin: 0 auto;
  padding: 48px 20px 80px;
}
.module-stage { min-width: 0; }
.conversation { width: 100%; margin: 0; }
.module-panel[hidden] { display: none; }

.workspace-sidebar {
  position: sticky;
  top: 94px;
  align-self: start;
}
.sidebar-intro { padding: 0 10px 20px; }
.sidebar-intro > span { color: var(--green-dark); font-size: 9px; font-weight: 800; letter-spacing: 0.14em; }
.sidebar-intro strong { display: block; margin-top: 6px; font-size: 14px; }
.sidebar-intro p, .sidebar-note p { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.module-nav { display: flex; flex-direction: column; gap: 5px; }
.module-nav-button {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  width: 100%;
  cursor: pointer;
  align-items: center;
  padding: 10px;
  color: var(--muted);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  transition: 140ms ease;
}
.module-nav-link { text-decoration: none; }
.module-nav-button:hover { color: var(--text); background: rgba(255,255,255,.7); }
.module-nav-button.is-active {
  color: var(--text);
  background: #fff;
  border-color: var(--line);
  box-shadow: 0 5px 18px rgba(18,20,18,.04);
}
.module-nav-button > span:last-child { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.module-nav-button strong { font-size: 12px; }
.module-nav-button small { overflow: hidden; color: #8a8d87; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.module-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: #585b56;
  background: var(--soft);
  border-radius: 9px;
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 700;
}
.module-nav-button.is-active .module-icon { color: #fff; background: var(--text); }
.sidebar-note {
  margin-top: 22px;
  padding: 13px;
  background: var(--green-soft);
  border: 1px solid #cde8dd;
  border-radius: 12px;
}
.sidebar-note strong { color: var(--green-dark); font-size: 10px; }

.auth-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 10%, rgba(15, 143, 112, 0.09), transparent 34%),
    var(--bg);
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  padding: 30px 18px;
  place-items: center;
}

.auth-card {
  width: min(430px, 100%);
  padding: 42px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.auth-brand { margin-bottom: 48px; }
.auth-card h1 { margin: 8px 0 10px; font-size: 30px; letter-spacing: -0.035em; }
.auth-intro { margin: 0 0 28px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.auth-form { display: grid; gap: 18px; }
.auth-form label,
.admin-create-form label {
  display: grid;
  gap: 7px;
  color: #454844;
  font-size: 11px;
  font-weight: 700;
}

.auth-form input,
.admin-create-form input,
.admin-create-form select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
}

.auth-form input:focus,
.admin-create-form input:focus,
.admin-create-form select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.auth-submit { width: 100%; min-height: 45px; justify-content: center; }
.auth-footnote { margin: 22px 0 0; color: #8a8d87; font-size: 10px; text-align: center; }

.admin-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 48px 0 80px;
}

.admin-heading { margin-bottom: 24px; }
.admin-heading h1 { margin: 7px 0 8px; font-size: 32px; letter-spacing: -0.035em; }
.admin-heading p:last-child { margin: 0; color: var(--muted); font-size: 13px; }
.admin-shell > .work-card { margin-bottom: 18px; }
.admin-create-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr 150px auto;
  gap: 12px;
  align-items: end;
}

.admin-create-form .primary-button { min-height: 44px; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th,
.admin-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  text-align: left;
  vertical-align: middle;
}
.admin-table th { color: var(--muted); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.admin-table td:last-child { display: flex; flex-wrap: wrap; gap: 6px; min-width: 210px; }
.table-action {
  padding: 6px 8px;
  color: #4d514c;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
}
.table-action:hover { border-color: var(--line-strong); }
.table-action.is-danger { color: var(--danger); }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.admin-knowledge-card { display: grid; gap: 22px; }
.admin-knowledge-card > .section-heading,
.admin-knowledge-card > .section-intro { margin: 0; }
.admin-knowledge-section {
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.admin-subheading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.admin-subheading h3 { margin: 4px 0 0; font-size: 17px; }
.admin-review-list { display: grid; gap: 12px; }
.admin-review-card {
  padding: 15px;
  background: #fffdf8;
  border: 1px solid #eadfca;
  border-radius: 13px;
}
.admin-review-card h4 { margin: 10px 0 5px; font-size: 13px; line-height: 1.45; }
.admin-review-card > p { margin: 0; color: #66625a; font-size: 10px; line-height: 1.6; }
.admin-review-options { display: grid; gap: 8px; margin-top: 12px; }
.admin-review-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.admin-review-option span { display: grid; gap: 4px; }
.admin-review-option strong { font-size: 10px; line-height: 1.5; }
.admin-review-option small { color: var(--muted); font-size: 8px; line-height: 1.5; }
.admin-knowledge-table td:nth-child(1) { min-width: 220px; }
.admin-knowledge-table td:nth-child(2) { min-width: 260px; line-height: 1.55; }
.admin-knowledge-table td:nth-child(3) { min-width: 190px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.admin-knowledge-table td:last-child { min-width: 90px; }
.knowledge-status-select {
  min-width: 108px;
  height: 34px;
  margin: 0;
  padding: 0 26px 0 8px;
  font-size: 9px;
}
.compact-list { display: grid; max-height: 360px; overflow: auto; color: var(--muted); font-size: 10px; }
.compact-list-row { padding: 10px 0; border-bottom: 1px solid var(--line); line-height: 1.5; }

@media (max-width: 920px) {
  .local-badge { display: none; }
  .admin-create-form { grid-template-columns: 1fr 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .topbar { padding: 0 14px; }
  .topbar-actions { gap: 7px; }
  .user-chip { max-width: 92px; }
  .auth-card { padding: 30px 24px; }
  .admin-create-form { grid-template-columns: 1fr; }
  .admin-link { display: none; }
  .admin-review-option { grid-template-columns: 1fr; }
  .admin-review-option .table-action { justify-self: start; }
}

.assistant-row { display: flex; gap: 17px; align-items: flex-start; width: min(760px, 100%); margin: 0 auto 42px; }
.assistant-copy h1 { margin: 1px 0 9px; font-size: clamp(25px, 3.6vw, 34px); line-height: 1.18; letter-spacing: -0.035em; }
.beta-badge {
  display: inline-flex;
  transform: translateY(-3px);
  align-items: center;
  min-height: 22px;
  margin-left: 7px;
  padding: 0 8px;
  color: #7a520d;
  background: #fff0c9;
  border: 1px solid #ead39d;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .04em;
  vertical-align: middle;
}
.assistant-copy p { margin: 0; color: #4c4f4b; font-size: 15px; line-height: 1.8; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(700px, 100%); margin: 0 auto 18px; }
.step { display: flex; align-items: center; justify-content: center; gap: 8px; color: #8a8d87; font-size: 12px; font-weight: 650; }
.step span { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--line-strong); border-radius: 50%; font-size: 11px; }
.step.is-active { color: var(--text); }
.step.is-active span { color: #fff; background: var(--text); border-color: var(--text); }
.step.is-done { color: var(--green-dark); }
.step.is-done span { color: #fff; background: var(--green); border-color: var(--green); }

.composer-card, .review-card, .download-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.composer-card { padding: clamp(22px, 4vw, 34px); }
.review-card { padding: clamp(20px, 3vw, 30px); }

.section-heading, .block-title, .action-row, .review-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.section-heading { margin-bottom: 22px; }
.section-heading h2, .download-card h2 { margin: 3px 0 0; font-size: 20px; letter-spacing: -0.025em; }
.eyebrow { margin: 0; color: var(--green-dark); font-size: 10px; font-weight: 800; letter-spacing: 0.13em; }
.file-rule { color: var(--muted); font-size: 12px; }

.dropzone {
  display: flex;
  min-height: 230px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 30px;
  text-align: center;
  background: #fafbf9;
  border: 1.5px dashed #c7cac2;
  border-radius: 15px;
  transition: 160ms ease;
}

.dropzone:hover, .dropzone.is-dragging { background: var(--green-soft); border-color: var(--green); transform: translateY(-1px); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 4px; color: var(--green-dark); background: var(--green-soft); border-radius: 13px; font-size: 22px; font-weight: 500; }
.dropzone strong { font-size: 15px; }
.dropzone span:last-child { color: var(--muted); font-size: 12px; }

.selected-file { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px 14px; background: var(--soft); border-radius: 12px; }
.selected-file > div:nth-child(2) { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 2px; }
.selected-file strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.selected-file span { color: var(--muted); font-size: 11px; }
.file-token { display: grid; place-items: center; width: 38px; height: 38px; color: var(--green-dark); background: #fff; border: 1px solid var(--line); border-radius: 10px; font-size: 9px; font-weight: 800; letter-spacing: 0.06em; }

.icon-button, .text-button { cursor: pointer; color: var(--muted); background: transparent; border: 0; }
.icon-button { width: 32px; height: 32px; border-radius: 8px; font-size: 21px; }
.icon-button:hover { color: var(--text); background: #e7e8e4; }
.text-button { padding: 7px 0; font-size: 12px; font-weight: 650; }
.text-button:hover { color: var(--green-dark); }

.notes-field { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; }
.notes-field > span, .field-grid label { color: #353735; font-size: 12px; font-weight: 680; }
.notes-field em { color: var(--muted); font-style: normal; font-weight: 500; }
textarea, input[type="text"], input[type="date"], input[type="search"], select {
  width: 100%;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border 140ms, box-shadow 140ms;
}
textarea { min-height: 74px; padding: 11px 13px; line-height: 1.55; resize: vertical; }
input[type="text"], input[type="date"], input[type="search"], select { height: 41px; margin-top: 7px; padding: 0 11px; }
textarea:focus, input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(15, 143, 112, 0.1); }
textarea[readonly], input[readonly] { color: #565a55; background: #f7f8f6; cursor: default; }
.notes-field small { color: var(--muted); font-size: 11px; line-height: 1.5; }

.action-row { align-items: flex-end; margin-top: 24px; }
.trust-note { max-width: 470px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.primary-button, .secondary-button {
  display: inline-flex;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: 150ms ease;
}
.primary-button { color: #fff; background: var(--text); border: 1px solid var(--text); }
.primary-button:hover { background: #303230; transform: translateY(-1px); }
.primary-button:disabled { cursor: not-allowed; color: #a3a59f; background: #e8e9e5; border-color: #e8e9e5; transform: none; }
.primary-button b { font-size: 17px; font-weight: 500; }
.secondary-button { color: var(--text); background: #fff; border: 1px solid var(--line-strong); }
.secondary-button:hover { border-color: #969a92; }
.secondary-button.compact { min-height: 34px; padding: 0 12px; font-size: 11px; }

.status { margin-top: 16px; padding: 11px 13px; color: #3f4440; background: var(--soft); border-radius: 10px; font-size: 12px; line-height: 1.5; }
.status.is-error { color: var(--danger); background: #fff0ee; }
.status.is-warning { color: var(--warning); background: var(--warning-bg); }
.status.is-loading::before { display: inline-block; width: 11px; height: 11px; margin-right: 8px; content: ""; border: 2px solid #b6bab4; border-top-color: var(--green); border-radius: 50%; vertical-align: -2px; animation: spin 0.75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.review-card { margin-top: 22px; }
.warning-box { margin-bottom: 22px; padding: 14px 16px; color: var(--warning); background: var(--warning-bg); border: 1px solid #f0ddb0; border-radius: 12px; font-size: 12px; }
.warning-box strong { display: block; margin-bottom: 6px; }
.warning-box ul { margin: 0; padding-left: 18px; line-height: 1.7; }

.review-block { padding: 23px 0; border-top: 1px solid var(--line); }
.review-block h3 { margin: 0; font-size: 14px; }
.block-title { align-items: flex-end; margin-bottom: 15px; }
.block-title p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.block-title > span { color: var(--muted); font-size: 10px; }
.field-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.field-grid .wide { grid-column: span 2; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.review-table { width: 100%; min-width: 700px; border-collapse: collapse; table-layout: fixed; }
.review-table th { padding: 11px 10px; color: var(--muted); background: #f8f8f6; border-bottom: 1px solid var(--line); font-size: 10px; letter-spacing: 0.04em; text-align: left; }
.review-table th:nth-child(1) { width: 27%; }
.review-table th:nth-child(2) { width: 40%; }
.review-table th:nth-child(3) { width: 24%; }
.review-table th:nth-child(4) { width: 9%; }
.review-table td { padding: 7px; border-top: 1px solid #ecece8; vertical-align: middle; }
.review-table tr:first-child td { border-top: 0; }
.review-table input { height: 36px; margin: 0; border-color: transparent; background: transparent; }
.review-table input:focus { background: #fff; border-color: var(--green); }
.row-actions { display: flex; align-items: center; justify-content: center; }
.row-actions button { width: 27px; height: 27px; cursor: pointer; color: var(--muted); background: transparent; border: 0; border-radius: 7px; }
.row-actions button:hover { color: var(--danger); background: #fff0ee; }

.two-column { display: grid; grid-template-columns: 1fr 1.25fr; gap: 18px; }
.two-column .notes-field { margin: 0; }
.review-footer { padding-top: 22px; border-top: 1px solid var(--line); }
.review-footer strong { font-size: 13px; }
.review-footer p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }

.download-card { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; margin-top: 22px; padding: 24px 26px; border-color: #b9decf; }
.success-mark { display: grid; place-items: center; width: 45px; height: 45px; color: #fff; background: var(--green); border-radius: 14px; font-size: 22px; }
.download-copy p:last-child { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.download-button { background: var(--green-dark); border-color: var(--green-dark); }
.download-button:hover { background: #075f4c; }

.footer-note { width: min(680px, 100%); margin: 23px auto 0; color: #8a8d87; font-size: 10px; line-height: 1.6; text-align: center; }
.is-hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

.module-hero { margin-bottom: 32px; }
.module-hero .eyebrow { margin-bottom: 4px; }
.work-card, .roadmap-card {
  padding: clamp(21px, 3vw, 30px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.work-card + .work-card, .roadmap-card { margin-top: 20px; }
.work-card .section-heading h2, .roadmap-card h2 { margin: 3px 0 0; font-size: 20px; letter-spacing: -0.025em; }
.optional-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  vertical-align: 2px;
}
.feature-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 18px; }
.vq-input-grid { align-items: stretch; }
.notes-field.flush { margin-top: 0; }
.compact-dropzone {
  display: flex;
  min-height: 190px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 22px;
  text-align: center;
  background: #fafbf9;
  border: 1.5px dashed #c7cac2;
  border-radius: 14px;
  transition: 150ms ease;
}
.compact-dropzone:hover, .compact-dropzone.is-dragging {
  background: var(--green-soft);
  border-color: var(--green);
  transform: translateY(-1px);
  box-shadow: 0 0 0 4px rgba(15, 143, 112, .08);
}
.compact-dropzone.has-file {
  background: #f2faf6;
  border-style: solid;
  border-color: #9fd3bf;
}
.compact-dropzone input, .file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.compact-dropzone strong { font-size: 13px; }
.compact-dropzone > span:last-child { max-width: 100%; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.vq-selected-file {
  min-height: 190px;
  margin-top: 0;
  padding: 20px;
  border: 1px solid #b9decf;
}
.declaration-dropzone { min-height: 150px; }
.compact-action-row { margin-top: 14px; }
.result-card { scroll-margin-top: 84px; }
.result-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.status-chip {
  display: inline-flex;
  align-items: center;
  width: max-content;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 750;
  white-space: nowrap;
}
.status-chip.auto_filled { color: #08745b; background: #e5f6ef; }
.status-chip.review { color: #865910; background: #fff2d2; }
.status-chip.missing { color: #a23b34; background: #ffebe8; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 18px; }
.metric {
  padding: 13px 14px;
  background: var(--soft);
  border-radius: 11px;
}
.metric strong { display: block; font-size: 19px; letter-spacing: -.03em; }
.metric span { color: var(--muted); font-size: 9px; }
.result-table, .knowledge-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}
.result-table th, .knowledge-table th {
  padding: 11px;
  color: var(--muted);
  background: #f8f8f6;
  border-bottom: 1px solid var(--line);
  font-size: 9px;
  letter-spacing: .04em;
  text-align: left;
}
.result-table td, .knowledge-table td { padding: 12px 11px; border-top: 1px solid #ecece8; vertical-align: top; }
.result-table tbody tr:first-child td, .knowledge-table tbody tr:first-child td { border-top: 0; }
.result-table th:nth-child(1) { width: 12%; }
.result-table th:nth-child(2) { width: 29%; }
.result-table th:nth-child(3) { width: 39%; }
.result-table th:nth-child(4) { width: 20%; }
.result-table .question-cell strong { display: block; font-size: 11px; line-height: 1.55; }
.result-table .question-cell small, .source-cell small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.result-table textarea { min-height: 76px; margin: 0; font-size: 11px; }
.source-cell { color: #464944; font-size: 9px; line-height: 1.45; word-break: break-word; }
.requested-documents { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.vq-export-footer { margin-top: 22px; }
.document-list { display: grid; gap: 8px; }
.document-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  background: var(--soft);
  border-radius: 10px;
}
.document-kind {
  padding: 4px 6px;
  color: var(--green-dark);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .05em;
}
.document-item strong { font-size: 11px; }
.document-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}
.document-item button { white-space: nowrap; }
.document-item.availability-missing,
.document-item.availability-unmatched {
  background: #fff8ed;
  box-shadow: inset 3px 0 0 #d88b26;
}
.document-item.availability-not-applicable {
  background: #f3f3f1;
}
.document-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.document-availability {
  display: inline-flex;
  align-items: center;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 8px;
  font-style: normal;
  font-weight: 750;
  white-space: nowrap;
}
.document-availability.available {
  color: var(--green-dark);
  background: var(--green-soft);
  border-color: #c9ddcf;
}
.document-availability.missing,
.document-availability.unmatched {
  color: #8a5313;
  background: #fff;
  border-color: #e9c998;
}
.document-availability.not-applicable {
  color: #666a65;
  background: #fff;
  border-color: var(--line);
}
.inline-upload { display: flex; align-items: center; gap: 10px; }
.inline-upload > span { min-width: 0; overflow: hidden; flex: 1; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.file-button { cursor: pointer; }
.declaration-workflow {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.declaration-workflow > .work-card { margin-top: 0; }
.declaration-coa-card { order: 1; }
.declaration-customer-card { order: 2; }
.declaration-batch-card { order: 3; }
.declaration-quick-card { order: 4; }
.declaration-workflow.has-customer-results .declaration-coa-card { order: 1; }
.declaration-workflow.has-customer-results .declaration-customer-card { order: 2; }
.declaration-workflow.has-customer-results .declaration-batch-card { order: 3; }
.declaration-workflow.has-customer-results .declaration-quick-card { order: 4; }
.declaration-quick-card details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  cursor: pointer;
  list-style: none;
}
.declaration-quick-card summary::-webkit-details-marker { display: none; }
.declaration-quick-card summary h2 { margin: 4px 0 5px; }
.declaration-quick-card summary p:last-child {
  max-width: 660px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}
.details-action {
  flex: 0 0 auto;
  padding: 6px 9px;
  color: var(--green-dark);
  background: var(--green-soft);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 750;
}
.declaration-quick-card details[open] > summary {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.declaration-quick-body { padding-top: 18px; }
.declaration-search-field {
  max-width: 700px;
}
.declaration-search-label {
  display: block;
  color: #353735;
  font-size: 12px;
  font-weight: 680;
}
.declaration-template-combobox { position: relative; margin-top: 7px; }
.declaration-template-combobox input {
  width: 100%;
  height: 46px;
  margin: 0;
  padding-right: 42px;
  background: #fff;
  border-color: var(--line-strong);
}
.declaration-template-combobox::after {
  position: absolute;
  top: 15px;
  right: 15px;
  color: var(--muted);
  content: "⌕";
  font-size: 17px;
  pointer-events: none;
}
.declaration-template-results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  display: grid;
  width: 100%;
  max-height: 360px;
  overflow: auto;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 18px 42px rgba(18, 20, 18, .14);
}
.declaration-template-result {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 11px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}
.declaration-template-result:hover,
.declaration-template-result:focus-visible {
  background: var(--green-soft);
  outline: none;
}
.declaration-template-result > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}
.declaration-template-result strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.declaration-template-result small {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.declaration-template-result em {
  flex: 0 0 auto;
  color: var(--green-dark);
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
}
.declaration-template-result.is-unmatched em { color: var(--warning); }
.declaration-intake-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: stretch; }
.declaration-intake-grid .notes-field textarea { min-height: 150px; }
.declaration-selected-file { min-height: 150px; margin-top: 0; padding: 20px; border: 1px solid #b9decf; }
.coa-link-actions {
  display: flex;
  min-height: 150px;
  align-items: flex-start;
  justify-content: space-between;
  flex-direction: column;
  padding: 20px;
  background: #fafbf9;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.coa-link-actions p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.coa-context-panel { margin-top: 18px; padding: 18px; background: #f8faf7; border: 1px solid var(--line); border-radius: 13px; }
.coa-context-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.coa-context-grid label { min-width: 0; color: #353735; font-size: 12px; font-weight: 680; }
.coa-context-grid label > span em { color: var(--muted); font-style: normal; font-weight: 500; }
.coa-context-grid small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; font-weight: 500; line-height: 1.45; }
.inline-field-action { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.inline-field-action .secondary-button { height: 41px; margin-top: 7px; }
.checkbox-field { display: flex; grid-column: 1 / -1; align-items: center; gap: 9px; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.checkbox-field input { flex: 0 0 auto; }
.checkbox-field span { line-height: 1.5; }
.declaration-batch-heading { align-items: center; }
.batch-count {
  padding: 6px 9px;
  color: var(--green-dark);
  background: var(--green-soft);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
}
.declaration-product-field { max-width: 560px; }
.declaration-batch-empty {
  margin-top: 18px;
  padding: 24px;
  color: var(--muted);
  background: #fafbf9;
  border: 1px dashed #d7d9d3;
  border-radius: 12px;
  font-size: 11px;
  text-align: center;
}
.declaration-batch-list { display: flex; margin-top: 18px; flex-direction: column; gap: 9px; }
.declaration-batch-item {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) minmax(220px, .8fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.declaration-batch-item.needs-template { background: #fffaf5; border-color: #edcba8; }
.declaration-check { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; font-weight: 700; }
.declaration-check input { accent-color: var(--green); }
.declaration-requirement-main { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.declaration-requirement-main input { height: 37px; margin: 0; }
.declaration-requirement-main small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.declaration-requirement-main small b { color: var(--green-dark); font-weight: 750; }
.declaration-template-select { display: flex; min-width: 0; flex-direction: column; gap: 4px; color: var(--muted); font-size: 9px; font-weight: 700; }
.declaration-template-select select { height: 37px; margin: 0; font-size: 10px; }
.full-button { width: 100%; margin-top: 22px; }
.knowledge-heading { align-items: flex-end; }
.search-field { width: min(260px, 44%); }
.search-field input { margin: 0; }
.knowledge-table th:nth-child(1) { width: 24%; }
.knowledge-table th:nth-child(2) { width: 37%; }
.knowledge-table th:nth-child(3) { width: 15%; }
.knowledge-table th:nth-child(4) { width: 24%; }
.knowledge-table td { color: #3b3d3a; font-size: 10px; line-height: 1.55; word-break: break-word; }
.knowledge-table td strong { color: var(--text); font-size: 11px; }
.knowledge-meta { display: flex; flex-direction: column; gap: 6px; }
.knowledge-review-card { background: #fffdf8; }
.count-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  color: #7b5516;
  background: #fff0ca;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}
.section-intro { margin: 4px 0 18px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.knowledge-review-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.knowledge-review-item {
  padding: 15px;
  background: #fff;
  border: 1px solid #eadfca;
  border-radius: 13px;
}
.knowledge-review-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.review-category { color: #806d50; font-size: 9px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.knowledge-review-item h3 { margin: 12px 0 6px; font-size: 13px; line-height: 1.45; }
.knowledge-review-item > p { margin: 0; color: #66625a; font-size: 10px; line-height: 1.6; }
.review-options { display: grid; gap: 7px; margin-top: 13px; }
.review-option { display: grid; gap: 3px; padding: 9px 10px; background: #faf9f6; border-radius: 9px; }
.review-option strong { color: #76531a; font-size: 9px; }
.review-option span { color: #30322f; font-size: 10px; line-height: 1.5; white-space: pre-line; }
.review-option small { color: var(--muted); font-size: 8px; line-height: 1.5; }
.empty-state { padding: 26px; color: var(--muted); font-size: 11px; text-align: center; }
.roadmap-card { background: #fdfdfc; box-shadow: none; }
.roadmap-card ol { margin: 17px 0 0; padding-left: 20px; color: #4c4f4b; font-size: 12px; line-height: 1.8; }

@media (max-width: 720px) {
  .topbar { padding: 0 16px; }
  .app-shell { display: block; padding: 22px 12px 60px; }
  .workspace-sidebar { position: static; margin-bottom: 30px; }
  .sidebar-intro, .sidebar-note { display: none; }
  .module-nav { display: grid; grid-template-columns: repeat(5, minmax(72px, 1fr)); gap: 5px; overflow-x: auto; }
  .module-nav-button { display: flex; min-width: 72px; flex-direction: column; gap: 5px; padding: 8px 5px; text-align: center; }
  .module-nav-button > span:last-child { align-items: center; }
  .module-nav-button small { display: none; }
  .assistant-row { gap: 12px; margin-bottom: 30px; }
  .assistant-avatar { width: 34px; height: 34px; flex-basis: 34px; }
  .assistant-copy h1 { font-size: 24px; }
  .steps { gap: 3px; }
  .step { flex-direction: column; gap: 5px; text-align: center; }
  .file-rule, .trust-note { display: none; }
  .dropzone { min-height: 190px; padding: 22px 14px; }
  .field-grid { grid-template-columns: 1fr 1fr; }
  .field-grid .wide { grid-column: span 2; }
  .two-column { grid-template-columns: 1fr; }
  .review-footer, .action-row { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
  .download-card { grid-template-columns: auto 1fr; }
  .download-card .download-button { grid-column: 1 / -1; }
  .feature-grid, .declaration-intake-grid { grid-template-columns: 1fr; }
  .coa-context-grid { grid-template-columns: 1fr; }
  .checkbox-field { grid-column: auto; }
  .knowledge-review-list { grid-template-columns: 1fr; }
  .declaration-batch-item { grid-template-columns: auto minmax(0, 1fr) auto; }
  .declaration-template-select { grid-column: 2 / -1; }
  .document-item {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }
  .document-actions {
    grid-column: 2;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .result-legend { display: none; }
  .inline-upload { align-items: stretch; flex-wrap: wrap; }
  .inline-upload > span { order: 3; width: 100%; flex-basis: 100%; }
}

@media (max-width: 450px) {
  .brand { font-size: 13px; }
  .local-badge { display: none; }
  .field-grid { grid-template-columns: 1fr; }
  .field-grid .wide { grid-column: auto; }
  .section-heading { align-items: flex-start; }
  .metric-grid { grid-template-columns: 1fr; }
  .knowledge-heading { align-items: stretch; flex-direction: column; }
  .search-field { width: 100%; }
  .declaration-quick-card details > summary { align-items: flex-start; flex-direction: column; }
  .declaration-batch-item { grid-template-columns: auto minmax(0, 1fr) auto; }
  .declaration-template-select { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
