/* NorTender web portal — Norwegian B2B: calm, legible, no theatrics. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --ink: #14181f;
  --ink-2: #4a5462;
  --ink-3: #7c8798;
  --line: #dde2e9;
  --brand: #1d4ed8;
  --brand-ink: #ffffff;
  --brand-soft: #eaf0fe;
  --ok: #0f7b4f;
  --ok-soft: #e6f4ed;
  --warn: #9a6300;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #161b22;
    --surface-2: #1f262f;
    --ink: #e8ecf1;
    --ink-2: #a7b1bf;
    --ink-3: #79address;
    --ink-3: #7d8899;
    --line: #2a323d;
    --brand: #4c82f7;
    --brand-ink: #08101f;
    --brand-soft: #17233c;
    --ok: #4ade9a;
    --ok-soft: #12271e;
    --warn: #e0b155;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

/* `display: flex` on a section outranks the user-agent rule for [hidden],
   so hiding a view needs to win explicitly. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
        "Helvetica Neue", Arial, sans-serif;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ---------- topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  line-height: 1;
}

.brand-name { font-weight: 650; letter-spacing: -.01em; }

.topbar-note {
  color: var(--ink-3);
  font-size: 13.5px;
}

@media (max-width: 560px) { .topbar-note { display: none; } }

/* ---------- layout ---------- */

.shell {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.footer {
  padding: 18px 20px 26px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
}
.footer a { color: var(--ink-3); }
.footer-sep { margin: 0 8px; }

/* ---------- chat ---------- */

.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.msg { display: flex; }
.msg-bot { justify-content: flex-start; }
.msg-user { justify-content: flex-end; }

.bubble {
  max-width: 88%;
  padding: 12px 15px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.msg-user .bubble {
  background: var(--brand);
  color: var(--brand-ink);
  border-color: transparent;
}

.bubble p { margin: 0; }
.bubble p + p { margin-top: 9px; }

/* thinking dots */

.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-3);
  animation: blink 1.3s infinite ease-in-out;
}
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink {
  0%, 60%, 100% { opacity: .25; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-2px); }
}

/* ---------- candidate picker ---------- */

.choices { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.choice {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.choice:hover  { border-color: var(--brand); background: var(--brand-soft); }
.choice:active { transform: translateY(1px); }

.choice-name { font-weight: 600; }
.choice-meta { color: var(--ink-2); font-size: 13.5px; margin-top: 3px; }

/* ---------- company summary ---------- */

.company-card {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 13px 15px;
}
.company-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 14px;
  font-size: 14px;
}
.company-card dt { color: var(--ink-3); }
.company-card dd { margin: 0; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  font-size: 12.5px;
  padding: 3px 9px;
  border-radius: 100px;
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid transparent;
  white-space: nowrap;
}

/* ---------- tender card ---------- */

.tender {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 15px 16px;
  box-shadow: var(--shadow);
}

.tender-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.tender-title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.35;
}

.deadline {
  flex: none;
  font-size: 12.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 100px;
  background: var(--surface-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.deadline-soon { background: #fdf1dc; color: var(--warn); }
@media (prefers-color-scheme: dark) { .deadline-soon { background: #33270f; } }

.tender-buyer { color: var(--ink-2); font-size: 14px; margin: 5px 0 0; }
.tender-essence { margin: 9px 0 0; font-size: 14.5px; }

/* Why it matched — deliberately shown as facts, never as a percentage:
   Doffin does not publish qualification requirements, so any "fit score"
   would be a number with nothing behind it. */
.match {
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}
.match-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-3);
  margin-bottom: 7px;
}
.match-list { display: flex; flex-wrap: wrap; gap: 6px; }
.match-item {
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--ok-soft);
  color: var(--ok);
}

.tender-actions { display: flex; gap: 10px; margin-top: 13px; }

/* ---------- buttons ---------- */

.btn {
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: filter .12s, border-color .12s;
}
.btn:hover:not(:disabled) { border-color: var(--brand); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--brand);
  color: var(--brand-ink);
  border-color: transparent;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); border-color: transparent; }

.btn-sm { padding: 7px 12px; font-size: 14px; }
.btn-block { width: 100%; padding: 13px; }

/* ---------- composer ---------- */

.composer {
  display: flex;
  gap: 10px;
  padding: 14px 0 20px;
  background: linear-gradient(to top, var(--bg) 72%, transparent);
  position: sticky;
  bottom: 0;
}

.composer-input {
  flex: 1;
  font: inherit;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.composer-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.composer-input:disabled { background: var(--surface-2); }

/* ---------- signup ---------- */

.signup { padding: 26px 0 40px; }

.link-back {
  border: 0;
  background: none;
  color: var(--ink-2);
  font: inherit;
  padding: 0;
  cursor: pointer;
  margin-bottom: 18px;
}
.link-back:hover { color: var(--brand); }

.signup-title { margin: 0 0 8px; font-size: 26px; letter-spacing: -.02em; }
.signup-lead { margin: 0 0 20px; color: var(--ink-2); }

.company-chip {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 12px 14px;
  margin-bottom: 22px;
  font-size: 14px;
}
.company-chip strong { display: block; font-size: 15px; }
.company-chip span { color: var(--ink-2); }

.form { display: flex; flex-direction: column; gap: 15px; }
.form-row { display: flex; gap: 12px; }
.form-row .field { flex: 1; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 13.5px; font-weight: 600; }
.field-optional { font-weight: 400; color: var(--ink-3); }
.field-hint { font-size: 12.5px; color: var(--ink-3); }

.field input {
  font: inherit;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.field input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13.5px;
  color: var(--ink-2);
}
.consent input { margin-top: 3px; flex: none; }

.form-error {
  margin: 0;
  color: #b42318;
  font-size: 14px;
}

@media (max-width: 520px) {
  .form-row { flex-direction: column; gap: 15px; }
  .signup-title { font-size: 22px; }
}
