/* Aeroplus Sourcing — official design skin (Aeroplus Sourcing.dc.html).
   Tokens copied verbatim from the design's root div; --warning added for
   awaiting_reply. No Google Fonts CDN (GFW/offline): the stacks below apply
   Space Grotesk/Manrope only if locally installed, else system fonts. */

:root {
  --bg: #ffffff;
  --bg-soft: #F7F8FA;
  --surface: #ffffff;
  --border: #E7E8EC;
  --text: #14161B;
  --muted: #787D87;
  --muted-2: #A6ABB5;
  --accent: #2453FF;
  --accent-soft: #EEF2FF;
  --accent-dark: #1638B3;
  --success: #1C9A6C;
  --danger: #DC2626;
  --warning: #D97706;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-display: 'Space Grotesk', 'Manrope', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'Space Grotesk', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input, textarea, button { font-family: inherit; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulseDot { 0%, 80%, 100% { opacity: .25; transform: scale(.85); } 40% { opacity: 1; transform: scale(1); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modalIn { from { opacity: 0; transform: scale(.97) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }

body { background: var(--bg); color: var(--text); font-family: var(--font-body); }
.app { height: 100vh; width: 100%; display: flex; overflow: hidden; }

/* ---- Sidebar ---------------------------------------------------------- */
.sidebar {
  width: 272px; flex-shrink: 0; display: flex; flex-direction: column;
  border-right: 1px solid var(--border); background: var(--bg-soft);
  transition: width .2s ease; overflow: visible; position: relative;
}
.sidebar--collapsed { width: 78px; }
.sidebar__toggle {
  position: absolute; top: 28px; right: -12px; width: 24px; height: 24px;
  border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted-2); display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0; z-index: 20; box-shadow: 0 2px 6px rgba(20,22,27,.08);
}
.sidebar__toggle:hover {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 4px 10px rgba(36,83,255,.28);
}
.sidebar__toggle svg { transition: transform .2s ease; }
.sidebar--collapsed .sidebar__toggle svg { transform: rotate(180deg); }
.sidebar__inner { overflow: hidden; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.sidebar__header { display: flex; align-items: center; justify-content: flex-start; padding: 24px 18px; flex-shrink: 0; }
.sidebar--collapsed .sidebar__header { justify-content: center; }
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand__logo { flex-shrink: 0; }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; white-space: nowrap; }
.sidebar--collapsed .brand__text { display: none; }
.brand__name { font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: -.01em; color: var(--text); }
.brand__sub { font-size: 9.5px; letter-spacing: .18em; color: var(--muted-2); font-weight: 600; }
.sidebar__new { padding: 0 14px; flex-shrink: 0; display: flex; justify-content: flex-start; }
.sidebar--collapsed .sidebar__new { justify-content: center; }
.btn-new {
  width: 100%; padding: 10px 12px; display: flex; align-items: center; justify-content: center;
  gap: 9px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 13.5px; font-weight: 700; cursor: pointer;
  white-space: nowrap; overflow: hidden; flex-shrink: 0;
}
.btn-new:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn-new svg { flex-shrink: 0; }
.sidebar--collapsed .btn-new { width: 40px; height: 40px; padding: 0; border-radius: 50%; }
.sidebar--collapsed .btn-new__label { display: none; }
.sidebar__label { padding: 22px 18px 8px; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--muted-2); flex-shrink: 0; }
.sidebar--collapsed .sidebar__label { visibility: hidden; }
.sidebar__list { flex: 1; overflow-y: auto; padding: 6px 10px 10px; display: flex; flex-direction: column; gap: 2px; }
.session-row { display: flex; align-items: center; justify-content: flex-start; gap: 10px; padding: 9px 8px; border-radius: 10px; cursor: pointer; background: transparent; }
.sidebar--collapsed .session-row { justify-content: center; }
.session-row--active { background: var(--accent-soft); }
.session-row__dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: var(--muted-2); }
.session-row__dot--searching { background: var(--accent); animation: pulseDot 1.1s ease-in-out infinite; }
.session-row__dot--success { background: var(--success); }
.session-row__dot--muted { background: var(--muted-2); }
.session-row__dot--warning { background: var(--warning); }
.session-row__dot--danger { background: var(--danger); }
.session-row__text { min-width: 0; }
.sidebar--collapsed .session-row__text { display: none; }
.session-row__query { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); font-weight: 500; }
.session-row--active .session-row__query { color: var(--accent-dark); font-weight: 700; }
.session-row__time { font-size: 11px; color: var(--muted-2); margin-top: 1px; }
.sidebar__footer { padding: 14px; border-top: 1px solid var(--border); flex-shrink: 0; display: flex; flex-direction: column; gap: 4px; }
.sidebar--collapsed .sidebar__footer { align-items: center; }
/* Discreet admin entry point (#61): small/muted, never promoted like btn-settings. */
.sidebar__admin-link { border: none; background: transparent; color: var(--muted-2); font-size: 11px; font-weight: 700; cursor: pointer; padding: 4px 10px; align-self: flex-start; }
.sidebar__admin-link:hover { color: var(--muted); text-decoration: underline; }
.sidebar--collapsed .sidebar__admin-link { display: none; }
.btn-settings {
  width: 100%; display: flex; align-items: center; justify-content: flex-start; gap: 10px;
  padding: 9px 10px; border-radius: 10px; border: none; background: transparent;
  color: var(--muted); font-size: 13.5px; font-weight: 700; cursor: pointer;
  white-space: nowrap; overflow: hidden; flex-shrink: 0;
}
.btn-settings:hover { background: var(--surface); color: var(--text); }
.btn-settings svg { flex-shrink: 0; }
.sidebar--collapsed .btn-settings { width: 40px; height: 40px; padding: 0; border-radius: 50%; justify-content: center; }
.sidebar--collapsed .btn-settings__label { display: none; }

/* ---- Main / hero home -------------------------------------------------- */
.main { flex: 1; display: flex; flex-direction: column; position: relative; background: var(--bg); overflow: hidden; }
.main__scroll { flex: 1; overflow-y: auto; }
.hero { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 40px 24px; }
.hero__logo { margin-bottom: 22px; }
.hero__title { font-family: var(--font-display); font-size: 27px; font-weight: 600; color: var(--text); letter-spacing: -.01em; margin-bottom: 10px; }
.hero__sub { font-size: 14.5px; color: var(--muted); max-width: 460px; text-align: center; line-height: 1.6; margin-bottom: 34px; }
/* ---- Chat bar (fixed bottom, design's search-input anatomy reused) ------ */
#chatbar-root:not([hidden]) {
  flex-shrink: 0; padding: 14px 40px 20px; background: var(--bg);
  border-top: 1px solid transparent; display: flex; justify-content: center;
}
.chatbar { width: 100%; max-width: 720px; }
.chatbar__retry {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 8px; padding: 9px 12px; border: 1px solid rgba(220,38,38,.2);
  border-radius: 12px; background: rgba(220,38,38,.06); color: var(--danger); font-size: 12.5px;
}
.chatbar__retry[hidden] { display: none; }
.chatbar__retry button { border: none; background: transparent; color: var(--danger); font-weight: 700; cursor: pointer; }
.chatbar__inner {
  display: flex; align-items: flex-end; gap: 10px; width: 100%;
  padding: 8px 8px 8px 20px; border: 1.5px solid var(--border); border-radius: 18px;
  background: var(--surface); box-shadow: 0 1px 2px rgba(20,22,27,.05);
}
.chatbar__inner:hover, .chatbar__inner:focus-within { border-color: var(--muted-2); }
.chatbar__input {
  flex: 1; min-width: 0; min-height: 24px; max-height: 192px; resize: none;
  border: none; outline: none; background: transparent; font: inherit;
  font-size: 14.5px; line-height: 24px; color: var(--text); padding: 7px 0; overflow-y: hidden;
}
.chatbar__submit {
  width: 38px; height: 38px; border-radius: 12px; border: none; background: var(--accent);
  color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.chatbar__submit:hover { background: var(--accent-dark); }
.chatbar__submit:disabled { background: var(--muted-2); cursor: default; }
.chatbar__submit .spinner-sm { border-color: rgba(255,255,255,.4); border-top-color: #fff; }
.chatbar__submit--stop { background: var(--text); }
.stop-square { width: 11px; height: 11px; border-radius: 2px; background: #fff; }
.scroll-pill {
  position: absolute; z-index: 8; left: 50%; bottom: 90px; transform: translateX(-50%);
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); box-shadow: 0 4px 14px rgba(20,22,27,.12);
  font-size: 18px; cursor: pointer;
}
.scroll-pill[hidden] { display: none; }

.mode-row { display: flex; gap: 8px; margin-top: 18px; }
.chip {
  padding: 9px 16px; border-radius: 11px; font-size: 13px; font-weight: 700; cursor: pointer;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
}
.chip--active { border-color: var(--accent); background: var(--accent); color: #ffffff; }
.mode-desc { margin-top: 10px; font-size: 12.5px; color: var(--muted); text-align: center; max-width: 460px; line-height: 1.6; }
.scope { margin-top: 18px; max-width: 640px; width: 100%; }
.scope__summary { font-size: 12.5px; color: var(--muted); cursor: pointer; text-align: center; list-style: none; }
.scope__summary::-webkit-details-marker { display: none; }
.scope__summary:hover { color: var(--accent); }
.scope__body { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.scope-chip {
  padding: 3px 9px; border-radius: 6px; border: 1px solid var(--border); font-size: 11px;
  color: var(--muted); font-weight: 600; cursor: pointer; background: var(--surface); user-select: none;
}
.scope-chip--on { border-color: var(--accent); color: var(--accent-dark); background: var(--accent-soft); }

/* ---- Task detail -------------------------------------------------------- */
.detail { max-width: 880px; margin: 0 auto; padding: 52px 40px 120px; }
.detail__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.detail__eyebrow { font-size: 11.5px; color: var(--muted-2); font-weight: 700; letter-spacing: .04em; margin-bottom: 7px; }
.detail__query { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.4; max-width: 620px; overflow-wrap: anywhere; }
.btn-newsearch {
  flex-shrink: 0; display: flex; align-items: center; gap: 6px; padding: 9px 14px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.btn-newsearch:hover { border-color: var(--accent); color: var(--accent); }
.pulse-dots { display: flex; gap: 4px; }
.pulse-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; animation: pulseDot 1.1s ease-in-out infinite; }
.pulse-dots span:nth-child(2) { animation-delay: .15s; }
.pulse-dots span:nth-child(3) { animation-delay: .3s; }

/* ---- Card stream (macro-step cards, #39) -------------------------------- */
.card-stream { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.chatcard { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); animation: fadeInUp .3s ease; }
.chatcard--collapsed { display: flex; align-items: center; gap: 12px; padding: 12px 18px; cursor: pointer; }
.chatcard--collapsed:hover { border-color: #D7D9E0; }
.chatcard--expanded { padding: 18px 20px; }
.chatcard__head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; cursor: pointer; }
.chatcard__icon { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; position: relative; }
.chatcard__icon--done { background: var(--accent); }
.chatcard__icon--running { background: var(--accent-soft); }
.chatcard__icon--pending { border: 1.5px solid var(--border); background: var(--bg); }
.chatcard__ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.chatcard__label { font-size: 14px; font-weight: 700; color: var(--text); }
.chatcard__oneline { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.chatcard__result { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatcard__body { padding-left: 36px; display: flex; flex-direction: column; gap: 6px; }
.chatline { font-size: 13px; color: var(--text); line-height: 1.6; overflow-wrap: anywhere; }
.chatline--muted { color: var(--muted); }
.chatline--error { color: var(--danger); }

.log { margin-bottom: 32px; }
.log__summary { font-size: 12.5px; color: var(--muted); cursor: pointer; list-style: none; padding: 4px 0; }
.log__summary::-webkit-details-marker { display: none; }
.log__summary:hover { color: var(--accent); }
.log__body { background: var(--bg-soft); border-radius: 12px; padding: 12px 14px; margin-top: 8px; max-height: 320px; overflow-y: auto; }
.log-line { font-family: var(--font-mono); font-size: 12px; line-height: 1.7; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.log-line--error { color: var(--danger); }

.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--accent-soft); border-radius: 12px; padding: 13px 16px;
  font-size: 13.5px; color: var(--accent-dark); font-weight: 600; margin-bottom: 20px;
}
.banner__left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.banner__btn {
  flex-shrink: 0; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--accent);
  background: var(--surface); color: var(--accent); font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.banner__btn:hover { background: var(--accent); color: #fff; }

.results-headline { margin-bottom: 16px; font-size: 15px; font-weight: 700; color: var(--text); }
.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; animation: fadeInUp .4s ease; }
.result-card { border: 1px solid var(--border); border-radius: 16px; padding: 20px; background: var(--surface); display: flex; flex-direction: column; gap: 14px; }
.result-card:hover { box-shadow: 0 8px 24px rgba(20,22,27,.07); border-color: #D7D9E0; }
.result-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.result-card__id { display: flex; gap: 10px; min-width: 0; }
.result-card__icon { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.result-card__supplier { font-size: 14.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-card__contact { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.match-badge--exact { background: var(--accent-soft); color: var(--accent-dark); }
.match-badge--rel { background: var(--bg-soft); color: var(--muted); }
.pn-line { font-size: 12.5px; color: var(--muted); font-family: var(--font-mono); background: var(--bg-soft); border-radius: 8px; padding: 8px 10px; overflow-wrap: anywhere; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.cert-chip { padding: 3px 9px; border-radius: 6px; border: 1px solid var(--border); font-size: 11px; color: var(--muted); font-weight: 600; }
.link-chip { padding: 3px 9px; border-radius: 6px; border: 1px solid var(--border); font-size: 11px; color: var(--accent-dark); font-weight: 600; text-decoration: none; }
.link-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.price-block { min-height: 28px; }
.price { font-size: 19px; font-weight: 700; color: var(--text); font-family: var(--font-display); }
.price-unit { font-size: 12px; color: var(--muted); }
.price-pending { font-size: 12.5px; color: var(--muted-2); font-weight: 600; padding-top: 5px; }
.btn-rfq { width: 100%; padding: 10px; border-radius: 10px; border: none; background: var(--text); color: #fff; font-size: 13px; font-weight: 700; cursor: pointer; }
.btn-rfq:hover { background: var(--accent); }
.rfq-status-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rfq-badge { padding: 5px 12px; border-radius: 20px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.rfq-badge--sent { background: rgba(28,154,108,.1); color: var(--success); }
.rfq-badge--skipped { background: var(--bg-soft); color: var(--muted); }
.rfq-badge--failed { background: rgba(220,38,38,.08); color: var(--danger); }
.btn-retry { padding: 5px 12px; border-radius: 20px; border: 1px solid var(--danger); background: var(--surface); color: var(--danger); font-size: 11.5px; font-weight: 700; cursor: pointer; }
.btn-retry:hover { background: var(--danger); color: #fff; }

.summary-card { border: 1px solid var(--border); border-radius: 16px; padding: 22px 22px 20px 20px; background: var(--surface); margin-top: 20px; }
.summary-card__title { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--muted-2); margin-bottom: 14px; }
.summary-card__body { font-size: 13.5px; line-height: 1.7; color: var(--text); overflow-wrap: anywhere; }

/* ---- Chat bubbles + markdown -------------------------------------------- */
.chat-strip { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.chat-message { display: flex; flex-direction: column; max-width: 78%; animation: fadeInUp .25s ease; }
.chat-message.chat-bubble--user { align-self: flex-end; align-items: flex-end; }
.chat-message.chat-bubble--assistant { align-self: flex-start; align-items: flex-start; }
.chat-bubble { padding: 10px 15px; border-radius: 14px; font-size: 13.5px; line-height: 1.65; overflow-wrap: anywhere; }
.chat-bubble--user .chat-bubble { white-space: pre-wrap; background: var(--accent-soft); color: var(--accent-dark); border-bottom-right-radius: 4px; }
.chat-bubble--assistant .chat-bubble { width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-status { margin: 0 0 6px 4px; color: var(--muted); font-size: 12.5px; animation: pulseDot 1.3s ease-in-out infinite; }
.chat-bubble.streaming::after { content: "●"; display: inline-block; margin-left: 4px; color: var(--accent); animation: pulseDot 1s ease-in-out infinite; }
.message-actions { display: flex; gap: 3px; min-height: 27px; margin-top: 3px; opacity: 0; transition: opacity .15s; }
.chat-message:hover .message-actions, .message-actions:focus-within { opacity: 1; }
.message-actions button { border: none; border-radius: 7px; padding: 4px 7px; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.message-actions button:hover { background: var(--bg-soft); color: var(--text); }
.chat-bubble--assistant .chat-bubble > :first-child, .summary-card__body > :first-child { margin-top: 0; }
.chat-bubble--assistant .chat-bubble > :last-child, .summary-card__body > :last-child { margin-bottom: 0; }
.chat-bubble--assistant p, .summary-card__body p { margin: 0 0 10px; }
.chat-bubble--assistant ul, .chat-bubble--assistant ol, .summary-card__body ul, .summary-card__body ol { margin: 8px 0; padding-left: 22px; }
.chat-bubble--assistant table, .summary-card__body table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 12.5px; }
.chat-bubble--assistant th, .chat-bubble--assistant td, .summary-card__body th, .summary-card__body td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; }
.chat-bubble--assistant a, .summary-card__body a { color: var(--accent); }
.chat-bubble--assistant code, .summary-card__body code { font-family: Consolas, monospace; font-size: .92em; }
.markdown-code { overflow: hidden; margin: 10px 0; border-radius: 10px; background: #151821; color: #f5f7fb; }
.markdown-code__head { display: flex; justify-content: space-between; padding: 6px 10px; background: #232735; color: #b9c0d0; font-size: 11px; }
.markdown-code__copy { border: none; background: transparent; color: #dce2ef; cursor: pointer; }
.markdown-code pre { margin: 0; padding: 12px; overflow-x: auto; white-space: pre; }

/* ---- Inline task activity card ----------------------------------------- */
.activity-card { align-self: stretch; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); overflow: hidden; }
.activity-card__toggle { display: flex; align-items: center; gap: 10px; width: 100%; padding: 13px 15px; border: none; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.activity-card__label { flex: 1; font-size: 13.5px; font-weight: 650; }
.activity-card__label--shimmer { background: linear-gradient(90deg,var(--muted),var(--text),var(--muted)); background-size: 200% 100%; color: transparent; background-clip: text; animation: shimmer 1.7s linear infinite; }
.activity-card__chevron { color: var(--muted); transition: transform .18s; }
.activity-card.is-open .activity-card__chevron { transform: rotate(180deg); }
.activity-card__body { display: none; padding: 0 16px 11px 48px; }
.activity-card.is-open .activity-card__body { display: block; }
.activity-card__step { padding: 4px 0; color: var(--muted); font-size: 12.5px; }
.activity-card__step--error { color: var(--danger); }
.activity-card__link { display: inline-block; margin: 0 16px 10px 48px; color: var(--accent); font-size: 12.5px; text-decoration: none; }
.activity-card__notice { padding: 8px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11.5px; }
.activity-card--error { border-color: rgba(220,38,38,.25); }

@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (hover: none) { .message-actions { opacity: 1; } }

.notfound { display: flex; flex-direction: column; align-items: center; padding: 40px 20px; color: var(--muted); }
.notfound__icon { margin-bottom: 14px; color: var(--muted-2); }
.notfound__text { font-size: 14px; font-weight: 600; }

.loading-view, .error-view { padding: 60px 40px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* ---- Settings ---------------------------------------------------------- */
.settings { max-width: 620px; margin: 0 auto; padding: 52px 40px 120px; }
.settings__title { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.settings__sub { font-size: 13.5px; color: var(--muted); margin-bottom: 32px; }
.settings__section-label { font-size: 12px; font-weight: 700; color: var(--muted-2); letter-spacing: .04em; margin-bottom: 10px; }
.chips-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.enc-chips { display: flex; gap: 8px; }
.enc-chips .chip { padding: 8px 16px; border-radius: 10px; }
.field { margin-bottom: 18px; }
.field--tight { margin-bottom: 8px; }
.field__label { font-size: 12.5px; font-weight: 700; color: var(--text); margin-bottom: 7px; }
.text-input {
  width: 100%; padding: 11px 14px; border-radius: 10px; border: 1.5px solid var(--border);
  font-size: 14px; outline: none; background: var(--surface); color: var(--text);
}
.text-input:focus { border-color: var(--accent); }
.text-input[readonly] { background: var(--bg-soft); color: var(--muted); }
.pw-wrap { position: relative; }
.pw-wrap .text-input { padding-right: 44px; }
.pw-eye {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px;
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.field__hint { font-size: 11.5px; color: var(--muted); line-height: 1.6; margin-bottom: 18px; }
.grid-hostport { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-bottom: 18px; }
.settings__enc { margin-bottom: 26px; }
.testing-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.spinner-sm { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; flex-shrink: 0; }
.test-line { font-size: 13px; margin-bottom: 6px; font-weight: 700; overflow-wrap: anywhere; }
.test-line--ok { color: var(--success); }
.test-line--err { color: var(--danger); }
.test-results { margin-bottom: 16px; }
.settings__actions { display: flex; gap: 10px; }
.btn-secondary { padding: 11px 18px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font-size: 13.5px; font-weight: 700; cursor: pointer; }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { padding: 11px 22px; border-radius: 10px; border: none; background: var(--accent); color: #fff; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled, .btn-secondary:disabled, .btn-rfq:disabled { opacity: .6; cursor: default; }

/* ---- Settings sub-nav + persona / RFQ profiles (#44) -------------------- */
.settings__tabs { display: flex; gap: 8px; margin-bottom: 26px; }
.settings__tab { padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--border); background: var(--surface); color: var(--muted); font-size: 12.5px; font-weight: 700; cursor: pointer; }
.settings__tab:hover { border-color: var(--accent); color: var(--accent); }
.settings__tab--active, .settings__tab--active:hover { border-color: var(--accent); background: var(--accent); color: #fff; }
.persona-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.persona-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.persona-card { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text); }
.persona-card:hover { border-color: var(--accent); }
.persona-card--active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.persona-card__badge { font-size: 10px; font-weight: 700; color: var(--success); background: rgba(28,154,108,.1); padding: 2px 7px; border-radius: 20px; }
.persona-card__del { border: none; background: transparent; color: var(--muted-2); cursor: pointer; padding: 0 2px; font-size: 12px; line-height: 1; }
.persona-card__del:hover { color: var(--danger); }
.chip--add { border-style: dashed; color: var(--muted); }
.chip--add:hover { border-color: var(--accent); color: var(--accent); }
.chip-inline-input { flex-basis: 100%; margin-top: 4px; }
.chip-other-input { margin-top: 8px; }

/* ---- Site management (#45) ---------------------------------------------- */
.settings--wide { max-width: 920px; }
.sites-table-wrap { overflow-x: auto; margin-bottom: 30px; border: 1px solid var(--border); border-radius: 14px; }
.sites-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.sites-table th {
  text-align: left; font-size: 11.5px; font-weight: 700; color: var(--muted-2); letter-spacing: .04em;
  padding: 12px 16px; background: var(--bg-soft); border-bottom: 1px solid var(--border);
}
.sites-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.sites-table tr:last-child td { border-bottom: none; }
.site-row__actions { display: flex; gap: 6px; white-space: nowrap; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.origin-badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.origin-badge--bundled { background: var(--bg-soft); color: var(--muted); }
.origin-badge--custom { background: var(--accent-soft); color: var(--accent-dark); }
.origin-badge--override { background: rgba(217,119,6,.12); color: var(--warning); }
/* Read-only supplier-status badges (#61): same visual language as origin-badge. */
.origin-badge--ready { background: rgba(28,154,108,.1); color: var(--success); }
.origin-badge--needs-login { background: rgba(217,119,6,.12); color: var(--warning); }
.switch {
  position: relative; width: 38px; height: 22px; border-radius: 20px; border: none; cursor: pointer;
  background: var(--border); padding: 0; flex-shrink: 0;
}
.switch__knob {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(20,22,27,.3); transition: left .15s ease;
}
.switch--on { background: var(--success); }
.switch--on .switch__knob { left: 18px; }

/* ---- Email modal -------------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20,22,27,.42); display: flex;
  align-items: center; justify-content: center; z-index: 400; padding: 24px;
}
.modal {
  width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto; background: var(--surface);
  border-radius: 18px; padding: 26px; box-shadow: 0 24px 70px rgba(20,22,27,.24); animation: modalIn .2s ease;
}
.modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal__title { font-size: 16.5px; font-weight: 700; color: var(--text); }
.modal__persona { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.modal__close { width: 28px; height: 28px; border-radius: 8px; border: none; background: var(--bg-soft); color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.modal-warning { background: var(--bg-soft); border-radius: 12px; padding: 16px; margin-bottom: 6px; }
.modal-warning__title { font-size: 13.5px; color: var(--text); font-weight: 700; margin-bottom: 6px; }
.modal-warning__desc { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin-bottom: 14px; }
.modal-warning .btn-primary { padding: 9px 16px; font-size: 13px; }
.modal-busy { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted); padding: 18px 0 24px; }
.modal-busy .spinner-sm { width: 16px; height: 16px; }
.modal-error { font-size: 13px; color: var(--danger); font-weight: 700; margin-bottom: 16px; overflow-wrap: anywhere; }
.modal__to { font-size: 12px; color: var(--muted); margin-bottom: 16px; overflow-wrap: anywhere; }
.modal__to strong { color: var(--text); font-weight: 700; }
.modal-field { margin-bottom: 14px; }
.modal-field--body { margin-bottom: 20px; }
.modal-field__label { font-size: 12px; font-weight: 700; color: var(--muted-2); margin-bottom: 6px; }
.modal-field .text-input { padding: 10px 12px; border-radius: 9px; font-size: 13.5px; }
.modal-textarea {
  width: 100%; padding: 12px; border-radius: 9px; border: 1.5px solid var(--border);
  font-size: 13px; line-height: 1.7; outline: none; color: var(--text); resize: vertical;
  background: var(--bg-soft);
}
.modal__receipt { font-size: 11.5px; color: var(--muted-2); margin-bottom: 14px; overflow-wrap: anywhere; }
.modal__cta { width: 100%; padding: 12px; border-radius: 11px; border: none; background: var(--accent); color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
.modal__cta:hover { background: var(--accent-dark); }
.modal__cta--danger { background: var(--danger); }
.modal__cta--danger:hover { background: #b91c1c; }

/* ---- noVNC live-login modal (#47): wider than the email modal to fit the
   streamed login page; reuses every other .modal* class above. -------------- */
.modal--novnc { max-width: 960px; }
.novnc-frame { width: 100%; height: 560px; border: 0; border-radius: 10px; background: #000; display: block; }
.novnc-hint { font-size: 11.5px; color: var(--muted); line-height: 1.6; margin: 12px 0 16px; }

/* ---- Toast -------------------------------------------------------------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 12px 22px; border-radius: 12px;
  font-size: 13.5px; font-weight: 600; box-shadow: 0 10px 30px rgba(20,22,27,.2);
  animation: toastIn .25s ease; z-index: 500; white-space: nowrap;
}
.toast--error { background: var(--danger); }
