:root {
  --ufp-navy: #071a33;
  --ufp-ink: #12243d;
  --ufp-blue: #005da8;
  --ufp-blue-dark: #004b88;
  --ufp-cyan: #12a8c4;
  --ufp-teal: #008b8f;
  --ufp-green: #2f7d57;
  --ufp-amber: #a86516;
  --ufp-red: #a83d3d;
  --canvas: #eef3f7;
  --panel: #ffffff;
  --panel-soft: #f7fafc;
  --line: #d6e0ea;
  --line-strong: #b7c6d6;
  --muted: #5f6f83;
  --soft-blue: #e8f2fb;
  --soft-cyan: #e5f7fa;
  --soft-green: #e8f5ee;
  --soft-amber: #fff2df;
  --shadow: 0 14px 30px rgba(7, 26, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ufp-ink);
  background:
    linear-gradient(180deg, rgba(7, 26, 51, 0.04), rgba(238, 243, 247, 0) 260px),
    var(--canvas);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  align-items: center;
  background: var(--ufp-blue);
  border: 1px solid var(--ufp-blue);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.9rem;
  font-weight: 800;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

button:hover {
  background: var(--ufp-blue-dark);
  border-color: var(--ufp-blue-dark);
  box-shadow: 0 8px 18px rgba(0, 93, 168, 0.18);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

input,
textarea {
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ufp-ink);
  padding: 11px 12px;
  width: 100%;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--ufp-blue);
  outline: 3px solid rgba(0, 93, 168, 0.14);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  color: #fff;
  font-size: 1.42rem;
  line-height: 1.08;
  margin-bottom: 0;
}

h2 {
  color: var(--ufp-navy);
  font-size: 1.1rem;
  line-height: 1.2;
  margin-bottom: 10px;
}

h3 {
  color: var(--ufp-navy);
  font-size: 0.93rem;
  margin-bottom: 8px;
}

label {
  color: #27384d;
  display: grid;
  font-size: 0.84rem;
  font-weight: 800;
  gap: 7px;
}

a {
  color: var(--ufp-blue);
}

.app-shell {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr) minmax(260px, 310px);
  min-height: 100vh;
  padding: 16px;
}

.sidebar,
.workspace,
.research-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.sidebar,
.research-panel {
  align-self: start;
  display: grid;
  gap: 18px;
  padding: 18px;
  position: sticky;
  top: 16px;
}

.sidebar {
  background:
    linear-gradient(180deg, var(--ufp-navy) 0, var(--ufp-navy) 118px, #fff 118px),
    #fff;
}

.workspace {
  min-height: calc(100vh - 32px);
  padding: 20px;
}

.app-brand {
  align-items: center;
  display: flex;
  gap: 12px;
  min-height: 76px;
}

.brand-mark {
  align-items: center;
  background: var(--ufp-blue);
  border: 2px solid rgba(255, 255, 255, 0.34);
  border-radius: 4px;
  color: #fff;
  display: flex;
  font-size: 1.35rem;
  font-weight: 950;
  height: 48px;
  justify-content: center;
  width: 48px;
}

.eyebrow {
  color: var(--ufp-blue);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0 0 5px;
  text-transform: uppercase;
}

.app-brand .eyebrow {
  color: var(--ufp-cyan);
}

.mode-tabs {
  background: #edf3f8;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(2, 1fr);
  padding: 4px;
}

.mode-tab {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  min-height: 36px;
  padding: 8px 10px;
}

.mode-tab:hover {
  background: #fff;
  border-color: #fff;
  color: var(--ufp-blue);
  box-shadow: none;
}

.mode-tab.active {
  background: var(--panel);
  border-color: #fff;
  color: var(--ufp-navy);
  box-shadow: 0 2px 7px rgba(7, 26, 51, 0.08);
}

.lookup-form,
.batch-panel,
.saved-list,
.batch-list,
.source-list,
.query-run-list {
  display: grid;
  gap: 12px;
}

.button-row,
.topbar-actions {
  display: flex;
  gap: 10px;
}

.button-row button {
  flex: 1;
}

.secondary-button {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--ufp-blue);
}

.secondary-button:hover {
  background: var(--soft-blue);
  border-color: #9fb9d2;
  color: var(--ufp-blue-dark);
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.section-heading,
.topbar,
.brief-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.section-heading {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.section-heading h2,
.research-panel h2 {
  font-size: 0.95rem;
  margin-bottom: 0;
}

.section-heading span {
  align-items: center;
  background: var(--ufp-navy);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 0.76rem;
  font-weight: 900;
  height: 26px;
  justify-content: center;
  min-width: 26px;
  padding: 0 8px;
}

.saved-row,
.batch-row,
.source-row {
  align-items: center;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 52px;
  padding: 10px;
}

.saved-row strong,
.batch-row strong {
  color: var(--ufp-navy);
  display: block;
  font-size: 0.9rem;
}

.saved-row span,
.batch-row span,
.list-empty {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
  margin: 2px 0 0;
}

.saved-row button,
.batch-row button {
  min-height: 34px;
  padding: 7px 10px;
}

.topbar {
  border-bottom: 2px solid var(--line);
  margin-bottom: 18px;
  padding-bottom: 16px;
}

.topbar h2 {
  font-size: 1.28rem;
  margin-bottom: 0;
}

.empty-state {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(0, 93, 168, 0.08), rgba(18, 168, 196, 0.08)),
    var(--panel-soft);
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  display: grid;
  justify-items: center;
  margin-top: 22px;
  min-height: 430px;
  padding: 36px;
  text-align: center;
}

.empty-state h2 {
  font-size: 1.35rem;
  max-width: 500px;
}

.empty-visual {
  background:
    linear-gradient(90deg, var(--ufp-blue) 0 42%, var(--ufp-cyan) 42% 56%, var(--ufp-navy) 56%),
    #fff;
  border-radius: 5px;
  box-shadow: 0 14px 28px rgba(7, 26, 51, 0.12);
  height: 86px;
  margin-bottom: 18px;
  width: 148px;
}

.brief {
  display: grid;
  gap: 16px;
}

.brief-header {
  background:
    linear-gradient(90deg, var(--ufp-navy), #0d315d 70%, var(--ufp-blue)),
    var(--ufp-navy);
  border-radius: 6px;
  color: #fff;
  padding: 18px;
}

.brief-header h2 {
  color: #fff;
  font-size: 1.45rem;
  margin-bottom: 4px;
}

.brief-header .muted {
  color: #cbd8e6;
  margin-bottom: 0;
}

.fit-score {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  color: #fff;
  font-size: 1.04rem;
  font-weight: 950;
  min-width: 104px;
  padding: 12px 14px;
  text-align: center;
}

.customer-relationship {
  align-items: center;
  background: #f4f7fa;
  border: 1px solid var(--line);
  border-left: 5px solid #7a8899;
  border-radius: 6px;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 140px 180px;
  padding: 16px 18px;
}

.customer-relationship.is-customer {
  background: #eef9f4;
  border-left-color: #16845b;
}

.customer-relationship.is-new-prospect {
  background: #f3f8fc;
  border-left-color: var(--ufp-blue);
}

.customer-relationship span {
  color: var(--muted);
  display: block;
  font-size: 0.72rem;
  font-weight: 850;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.customer-relationship strong {
  color: var(--ufp-navy);
  font-size: 1.05rem;
}

.customer-relationship p {
  color: #35465d;
  line-height: 1.4;
  margin: 5px 0 0;
}

.relationship-check-button {
  background: var(--ufp-blue);
  border: 0;
  border-radius: 5px;
  color: #fff;
  font-weight: 850;
  margin-top: 11px;
  padding: 9px 12px;
}

.relationship-check-button:hover {
  background: var(--ufp-navy);
}

.relationship-metric {
  border-left: 1px solid var(--line);
  padding-left: 18px;
}

.relationship-metric strong {
  font-size: 1.35rem;
}

.relationship-projects {
  border-top: 1px solid var(--line);
  grid-column: 1 / -1;
  padding-top: 14px;
}

.relationship-projects ul {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.relationship-projects li {
  align-items: baseline;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(18, 70, 82, 0.12);
  border-radius: 5px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 9px 11px;
}

.relationship-projects li strong {
  font-size: 0.92rem;
}

.relationship-projects li span {
  font-size: 0.78rem;
  margin: 0;
  text-align: right;
  text-transform: none;
}

.brief-strip,
.summary-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.brief-strip div,
.topline,
.summary-grid > div,
.research-summary,
.next-steps {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

.brief-strip span {
  color: var(--muted);
  display: block;
  font-size: 0.72rem;
  font-weight: 850;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.brief-strip strong {
  color: var(--ufp-navy);
  font-size: 1rem;
}

.topline {
  border-left: 5px solid var(--ufp-cyan);
}

.topline p,
.summary-grid p,
.research-summary p,
.matrix-card p {
  color: #35465d;
  line-height: 1.46;
  margin-bottom: 0;
}

.matrix-card p strong {
  color: var(--ufp-navy);
  font-weight: 950;
}

.summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.research-summary {
  align-items: center;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.matrix {
  display: grid;
  gap: 12px;
}

.matrix-group {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.matrix-group[open] {
  border-color: #a8bfd6;
  box-shadow: 0 8px 18px rgba(7, 26, 51, 0.06);
}

.matrix-group summary {
  align-items: center;
  background: linear-gradient(90deg, #f9fbfd, #edf4fa);
  color: var(--ufp-navy);
  cursor: pointer;
  display: flex;
  font-size: 1rem;
  font-weight: 950;
  justify-content: space-between;
  list-style: none;
  min-height: 58px;
  padding: 16px 18px;
}

.matrix-group summary::-webkit-details-marker {
  display: none;
}

.matrix-group summary::after {
  color: var(--ufp-blue);
  content: "+";
  font-size: 1.35rem;
  line-height: 1;
}

.matrix-group[open] summary {
  background: var(--ufp-navy);
  color: #fff;
}

.matrix-group[open] summary::after {
  color: var(--ufp-cyan);
  content: "-";
}

.matrix-cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 14px;
}

.matrix-card {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--ufp-blue);
  border-radius: 5px;
  display: grid;
  gap: 8px;
  min-height: 136px;
  padding: 14px;
}

.matrix-card strong {
  color: var(--ufp-navy);
  display: block;
  font-size: 0.92rem;
}

.source-tag,
.source-state {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.1;
  padding: 5px 8px;
  width: fit-content;
}

.source-tag {
  background: var(--soft-blue);
  color: var(--ufp-blue-dark);
}

.source-state {
  background: var(--soft-amber);
  color: var(--ufp-amber);
}

.source-state.ready {
  background: var(--soft-green);
  color: var(--ufp-green);
}

.query-links {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 6px;
  margin-top: 4px;
  padding-top: 10px;
}

.query-links a {
  color: var(--ufp-blue);
  font-size: 0.77rem;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.query-links a:hover {
  text-decoration: underline;
}

.next-steps ul,
.automation-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 20px;
}

.next-steps li,
.automation-list li {
  color: #35465d;
  line-height: 1.4;
}

.automation-list li {
  color: var(--muted);
  font-weight: 800;
}

.automation-list li.done {
  color: var(--ufp-green);
}

.research-panel section + section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.source-row,
.query-run-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.source-row strong,
.query-run-row strong {
  color: var(--ufp-navy);
  display: block;
  font-size: 0.88rem;
}

.source-row span:first-of-type,
.query-run-row span {
  color: var(--muted);
  display: block;
  font-size: 0.76rem;
  margin-top: 3px;
}

.query-run-row {
  align-items: center;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 10px;
  min-height: 48px;
  padding: 10px;
}

.query-run-row a {
  background: var(--soft-cyan);
  border: 1px solid rgba(18, 168, 196, 0.28);
  border-radius: 999px;
  color: #066f80;
  font-size: 0.75rem;
  font-weight: 900;
  padding: 6px 9px;
  text-decoration: none;
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .research-panel,
  .topbar-actions {
    display: none;
  }

  .app-shell {
    display: block;
    padding: 0;
  }

  .workspace {
    border: 0;
    box-shadow: none;
    min-height: 0;
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: minmax(290px, 350px) minmax(0, 1fr);
  }

  .research-panel {
    grid-column: 1 / -1;
    position: static;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .research-panel {
    position: static;
  }

  .workspace {
    min-height: auto;
  }

  .brief-strip,
  .customer-relationship,
  .summary-grid,
  .research-summary,
  .matrix-cards {
    grid-template-columns: 1fr;
  }

  .relationship-metric {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 12px;
  }

  .relationship-projects li {
    align-items: flex-start;
    display: grid;
  }

  .relationship-projects li span {
    text-align: left;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 10px;
  }

  .sidebar,
  .workspace,
  .research-panel {
    padding: 14px;
  }

  .topbar,
  .brief-header,
  .section-heading {
    align-items: stretch;
    display: grid;
  }

  .topbar-actions,
  .button-row {
    display: grid;
  }

  .brief-header {
    gap: 12px;
  }

  .fit-score {
    width: 100%;
  }
}
[hidden] {
  display: none !important;
}

.password-gate {
  align-items: center;
  background: radial-gradient(circle at top, #eefbfc 0, #f4f7f8 42%, #e9eff1 100%);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.password-card {
  background: #fff;
  border: 1px solid rgba(18, 70, 82, 0.14);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(21, 60, 70, 0.14);
  display: grid;
  gap: 14px;
  max-width: 400px;
  padding: 34px;
  width: 100%;
}

.password-card .brand-mark {
  margin-bottom: 4px;
}

.password-card h1,
.password-card p {
  margin: 0;
}

.password-card label {
  font-size: 0.85rem;
  font-weight: 800;
  margin-top: 8px;
}

.password-card input {
  font-size: 1rem;
  width: 100%;
}

.password-error {
  color: #b42318;
  font-size: 0.85rem;
  font-weight: 700;
  min-height: 1.25em;
}
