/* app.css — production additions on top of design.css
   Only classes not covered by the design system. */

/* ── Login / password gate ──────────────────────────────── */
.login {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--bg);
  padding: var(--s-6);
}
.login__brand {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; margin-bottom: var(--s-7); text-align: center;
}
.login__brand-mark {
  width: 64px; height: 64px;
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.login__brand-name { font-family: var(--f-disp); font-weight: 800; font-size: 22px; }
.login__brand-tag  { font-size: 12px; color: var(--text-3); letter-spacing: .08em; text-transform: uppercase; margin: 0; }
/* legacy aliases */
.login__logo { display: flex; align-items: center; gap: 10px; margin-bottom: var(--s-7); }
.login__mark  { width: 36px; height: 36px; background: var(--accent); color: var(--accent-on); border-radius: var(--r-2); font-family: var(--f-disp); font-weight: 800; font-size: 16px; display: flex; align-items: center; justify-content: center; }
.login__card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-5);
  padding: var(--s-7);
  box-shadow: var(--shadow-pop);
}
.login__title { font-family: var(--f-disp); font-weight: 700; font-size: 22px; margin-bottom: var(--s-2); }
.login__sub { font-size: 13px; color: var(--text-2); margin-bottom: var(--s-5); }
.login__form { display: flex; flex-direction: column; gap: var(--s-4); }
.login__error { font-size: 12px; color: var(--c-rej); margin: 0; }
.login__footer { display: flex; justify-content: space-between; margin-top: var(--s-5); font-family: var(--f-mono); font-size: 10.5px; color: var(--text-3); }
.login__copy { font-size: 11px; color: var(--text-3); margin-top: var(--s-4); text-align: center; }

.btn--block { width: 100%; justify-content: center; }
.btn--lg { padding: 10px 16px; font-size: 14px; }

/* ── Loading screen ─────────────────────────────────────── */
.fullscreen-center {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--bg); z-index: 200;
  gap: var(--s-4);
}
.loading-wrap { display: flex; flex-direction: column; align-items: center; gap: var(--s-4); }
.loading-icon { opacity: .8; }
.loading-spinner {
  width: 32px; height: 32px;
  border: 2px solid var(--line-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.loading-msg { font-family: var(--f-mono); font-size: 12px; color: var(--text-3); }
/* legacy aliases */
.splash-msg { font-family: var(--f-mono); font-size: 12px; color: var(--text-3); }
.spinner { width: 32px; height: 32px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Input group (login form field) ────────────────────────── */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  box-sizing: border-box;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.input::placeholder { color: var(--text-3); }
.input[type="password"] { letter-spacing: .12em; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
select.input { cursor: pointer; }
.input.mono { font-family: var(--f-mono); }

/* ── Status / toast message (inline) ───────────────────────── */
.status-msg {
  font-size: 12.5px; color: var(--text-2);
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  font-family: var(--f-mono);
}
.status-msg.ok  { color: var(--c-inv); border-color: rgba(20,168,122,.3); background: rgba(20,168,122,.08); }
.status-msg.err { color: var(--c-rej); border-color: rgba(239,68,68,.3);  background: rgba(239,68,68,.08); }

/* ── Origination step badges ─────────────────────────────── */
.nd-step {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-radius: var(--r-3);
  font-size: 12.5px; font-weight: 500;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.nd-step-waiting { color: var(--text-3); }
.nd-step-running { color: var(--accent); border-color: var(--accent-ring); background: var(--accent-soft); }
.nd-step-done    { color: var(--c-inv);  border-color: rgba(20,168,122,.3); background: rgba(20,168,122,.08); }
.nd-step-error   { color: var(--c-rej);  border-color: rgba(239,68,68,.3);  background: rgba(239,68,68,.08); }

/* ── Form labels (CRM modal forms) ──────────────────────── */
.form-label { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin-bottom: 5px; display: block; }
.form-hint  { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.form-section-title { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); margin: 16px 0 8px; }
.form-group   { display: flex; flex-direction: column; margin-bottom: 12px; }
.form-group-2 { flex: 2; }
.form-row     { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  transition: border-color var(--t-fast);
  box-sizing: border-box;
  outline: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.form-input::placeholder { color: var(--text-3); }
.form-select-sm { font-size: 12px; padding: 5px 8px; }
.form-textarea  { resize: vertical; min-height: 72px; }
.form-actions   { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 6px; }
.checkbox-label { display: flex; align-items: center; gap: 5px; font-size: 12.5px; cursor: pointer; padding: 4px 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-pill); }
.checkbox-label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent-ring); color: var(--accent); }

/* ── CRM modal chrome ────────────────────────────────────── */
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.modal-header .modal-title { font-family: var(--f-disp); font-size: 16px; font-weight: 700; }
.modal-close  { color: var(--text-3); padding: 4px 6px; border-radius: var(--r-2); font-size: 16px; }
.modal-close:hover { color: var(--text); background: var(--surface-2); }
.modal-body   { padding: 16px 20px; overflow-y: auto; }
.modal-body-tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 20px; margin-bottom: 16px; }
.modal-tab    { padding: 8px 12px; font-size: 12.5px; font-weight: 600; color: var(--text-3); border-bottom: 2px solid transparent; background: none; border-top: none; border-left: none; border-right: none; cursor: pointer; }
.modal-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.modal-tab-bar { display: flex; border-bottom: 1px solid var(--line); margin: -16px -20px 16px; padding: 0 20px; }

/* ── Legacy btn aliases ─────────────────────────────────── */
.btn-primary   { background: var(--accent); color: var(--accent-on); border: none; padding: 8px 16px; border-radius: var(--r-3); font-size: 13px; font-weight: 700; cursor: pointer; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); padding: 8px 16px; border-radius: var(--r-3); font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-ghost     { background: none; color: var(--text-2); border: none; padding: 8px 12px; border-radius: var(--r-3); font-size: 13px; cursor: pointer; }
.btn-ghost:hover { background: var(--hover); }
.btn-outline   { background: none; color: var(--text-2); border: 1px solid var(--line); padding: 8px 14px; border-radius: var(--r-3); font-size: 13px; font-weight: 500; cursor: pointer; }
.btn-outline:hover { border-color: var(--text-2); }
.btn-gold      { background: var(--gold); color: #231a05; border: none; padding: 8px 16px; border-radius: var(--r-3); font-size: 13px; font-weight: 700; cursor: pointer; }
.btn-sm        { font-size: 12px; padding: 5px 10px; }
.btn-icon      { padding: 6px; display: inline-flex; align-items: center; justify-content: center; }

/* ── Legacy token aliases ───────────────────────────────── */
:root {
  --green:    #14a87a;
  --red:      #ef4444;
  --border:   var(--line);
  --surface2: var(--surface-2);
  --text2:    var(--text-2);
  --text3:    var(--text-3);
  --ff-body:  var(--f-ui);
  --ff-num:   var(--f-mono);
  --space-sm: var(--s-3);
  --space-md: var(--s-5);
  --chip-rejected-cl: var(--c-rej);
}

/* ── Drawer animation (production uses class toggling) ──── */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(5,10,25,.45);
  z-index: 90;
  display: none;
}
.drawer-backdrop.open { display: block; animation: fade .12s var(--ease); }
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: min(720px, 86vw);
  background: var(--bg);
  border-left: 1px solid var(--line-2);
  box-shadow: var(--shadow-pop);
  z-index: 95;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--t-med) var(--ease);
}
.drawer.open { transform: translateX(0); }
.drawer__hd {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  gap: var(--s-4);
}
.drawer__body { flex: 1; overflow-y: auto; padding: 24px; }
.drawer__ft   { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.modal-title  { font-family: var(--f-disp); font-weight: 700; font-size: 20px; letter-spacing: -.01em; }
.modal-sub    { font-size: 13px; color: var(--text-2); margin-top: 3px; }

/* ── CRM overlay modal ───────────────────────────────────── */
#modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(5,10,25,.55);
  z-index: 100;
  align-items: center; justify-content: center;
}
#modal-overlay.open { display: flex; }
#modal-overlay .modal-box {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-5);
  box-shadow: var(--shadow-pop);
  width: 100%; max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  display: flex; flex-direction: column;
}

/* ── Page wrapper (within .main) ────────────────────────── */
.page { padding: var(--s-6) var(--s-7); max-width: 1480px; }
.page--full { max-width: none; padding: 0; }

/* ── Pipeline tbl wrap ───────────────────────────────────── */
.pipe-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-4); overflow: hidden; }
.tbl-wrap  { overflow-x: auto; }

/* ── Mkt depth options ───────────────────────────────────── */
.mkt-depth-opt { display: flex; flex-direction: column; flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-3); cursor: pointer; gap: 3px; }
.mkt-depth-opt span { font-size: 12.5px; font-weight: 600; }
.mkt-depth-opt small { font-size: 11px; color: var(--text-3); }
.mkt-depth-opt:has(input:checked) { border-color: var(--accent-ring); background: var(--accent-soft); }

/* ── Tweaks toggle button (fixed bottom-right) ──────────── */
#tweaks-toggle {
  position: fixed; bottom: 16px; right: 16px;
  z-index: 110;
}

/* ── Connectivity indicator ─────────────────────────────── */
.conn-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-3); flex-shrink: 0;
  transition: background var(--t-fast);
}
.conn-dot.ok  { background: var(--c-inv); box-shadow: 0 0 6px rgba(20,168,122,.5); }
.conn-dot.err { background: var(--c-rej); }

/* ── Loading screen progress bar ────────────────────────── */
#splash-bar-wrap {
  width: 180px; height: 3px;
  background: var(--line);
  border-radius: 9999px;
  overflow: hidden;
}
#splash-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 9999px;
  width: 0;
  transition: width var(--t-med);
}

/* ── Misc production utilities ──────────────────────────── */
.sb__item-label { /* shown/hidden by data-sidebar="compact" in design.css */ }
.icon { display: none; } /* Material Icons fallback — hide until font loads */
