/* HQu app styles. All color comes from tokens.css. */

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; }
.muted { color: var(--text-muted); }
.sm { font-size: 12px; }
.boot, .loading, .empty { padding: 40px 20px; text-align: center; color: var(--text-muted); }
.sep { border: none; border-top: 1px solid var(--surface-border); margin: 18px 0; }

/* ---------- Buttons ---------- */
.btn {
  background: var(--accent); color: var(--text-on-accent);
  border: none; border-radius: var(--radius-sm);
  padding: 9px 15px; font-weight: 700; font-size: 14px; cursor: pointer;
  transition: background .12s, transform .05s;
}
.btn:hover { background: var(--accent-strong); }
.btn:active { transform: translateY(1px); }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.block { width: 100%; padding: 12px; font-size: 15px; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--surface-border); }
.btn.ghost:hover { background: var(--bg-sunken); }
.btn.danger { background: transparent; color: #c0392b; border: 1px solid #e6b3ac; }
.btn.danger:hover { background: #fdecec; }
.icon-btn {
  background: transparent; border: none; color: inherit; cursor: pointer;
  font-size: 18px; line-height: 1; padding: 6px 8px; border-radius: var(--radius-sm); opacity: .85;
}
.icon-btn:hover { background: rgba(255,255,255,.15); opacity: 1; }

/* ---------- Top bar / nav ---------- */
.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 10px 18px; background: var(--primary); color: var(--text-on-primary);
  box-shadow: var(--shadow); position: sticky; top: 0; z-index: 20;
}
.logo { font-weight: 800; font-size: 20px; letter-spacing: .5px; white-space: nowrap; display: inline-flex; align-items: center; }
.logo .qu { color: var(--accent); }
.logo-img { height: 30px; width: auto; display: block; }
.tabs { display: flex; gap: 4px; }
.tab {
  padding: 7px 13px; border-radius: 999px; font-weight: 600; font-size: 14px;
  opacity: .82; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.btn.new-btn { white-space: nowrap; }
.tab:hover { opacity: 1; background: rgba(255,255,255,.12); }
.tab.active { opacity: 1; background: rgba(255,255,255,.18); }
.tab-badge {
  background: var(--accent); color: var(--text-on-accent);
  border-radius: 999px; font-size: 11px; font-weight: 800; padding: 1px 7px; min-width: 18px; text-align: center;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--bg-elevated); border: 1px solid var(--surface-border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; min-width: 170px; z-index: 30;
}
.menu.hidden { display: none; }
.menu button {
  display: block; width: 100%; text-align: left; background: transparent; border: none;
  color: var(--text); padding: 11px 15px; font-size: 14px; cursor: pointer;
}
.menu button:hover { background: var(--primary-wash); }

.wrap { max-width: 1200px; margin: 0 auto; padding: 20px; }
/* Board uses the full window width so all stage columns are reachable by scroll. */
.wrap-board { max-width: none; }

/* ---------- Stage badges ---------- */
.stage-badge {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px;
  border-radius: 999px; background: var(--bg-sunken); color: var(--text-muted);
  vertical-align: middle; white-space: nowrap;
}
.stage-badge[data-stage="prospect"]        { background: #eceef7; color: #4a5178; }
.stage-badge[data-stage="contacted"]       { background: #e5ecfb; color: #2f4bad; }
.stage-badge[data-stage="in_conversation"] { background: var(--primary-wash); color: var(--primary); }
.stage-badge[data-stage="verbal"]          { background: #fbf1d6; color: #916c17; }
.stage-badge[data-stage="booked"]          { background: #fdeec2; color: #7a5a05; }
.stage-badge[data-stage="delivered"]       { background: #dcf3e4; color: #1c7a45; }
.stage-badge[data-stage="lost"]            { background: #f1e3e1; color: #9a4a3f; }

/* ---------- Board ---------- */
.board {
  display: flex; gap: 14px; align-items: flex-start;
  overflow-x: auto; overflow-y: visible;
  padding-bottom: 14px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;                       /* Firefox */
  scrollbar-color: var(--primary) var(--bg-sunken);
  overscroll-behavior-x: contain;
  cursor: grab;                                /* signals click-drag to pan */
}
.board.panning { cursor: grabbing; user-select: none; scroll-snap-type: none; }
/* Always-visible horizontal scrollbar so it is obvious the board scrolls (WebKit). */
.board::-webkit-scrollbar { height: 12px; }
.board::-webkit-scrollbar-track { background: var(--bg-sunken); border-radius: 999px; }
.board::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 999px; border: 3px solid var(--bg-sunken); }
.col { scroll-snap-align: start; }
.col {
  flex: 0 0 264px; background: var(--bg-sunken);
  border: 1px solid var(--surface-border); border-radius: var(--radius); padding: 10px;
}
.col-off { opacity: .82; }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 10px; }
.col-title { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.col-count {
  background: var(--bg-elevated); border: 1px solid var(--surface-border);
  border-radius: 999px; font-size: 12px; font-weight: 700; padding: 1px 8px; color: var(--text-muted);
}
.col-body { display: flex; flex-direction: column; gap: 9px; min-height: 60px; border-radius: var(--radius-sm); padding: 2px; }
.col-body.drop-hover { background: var(--primary-wash); outline: 2px dashed var(--primary); outline-offset: -2px; }
.col-empty { color: var(--text-muted); font-size: 12px; text-align: center; padding: 18px 0; border: 1px dashed var(--surface-border); border-radius: var(--radius-sm); }

.card-opp {
  background: var(--bg-elevated); border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm); padding: 11px 12px; cursor: grab;
  box-shadow: 0 1px 2px rgba(0,0,0,.04); border-left: 3px solid var(--primary);
  touch-action: none; /* let pointer drag work on touch instead of scrolling */
  user-select: none;
}
.card-opp:hover { border-left-color: var(--accent); }
.card-opp.dragging { opacity: .35; }
.dnd-active { user-select: none; cursor: grabbing; }
.drag-clone {
  position: fixed; z-index: 999; pointer-events: none; margin: 0;
  box-shadow: 0 10px 30px rgba(0,0,0,.28); transform: rotate(2deg); opacity: .97;
}
.card-title { font-weight: 700; font-size: 14px; margin-bottom: 3px; }
.card-org { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-value { font-weight: 700; font-size: 13px; color: var(--primary); }
.card-notes { font-size: 11px; color: var(--text-muted); }

/* due chips */
.due { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--bg-sunken); color: var(--text-muted); }
.due.today { background: #fbf1d6; color: #916c17; }
.due.overdue { background: #fbe3e0; color: #b42318; }

/* ---------- List / table ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.inp.sm, select.inp.sm { padding: 7px 10px; font-size: 13px; }
.table-host { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--bg-elevated); border: 1px solid var(--surface-border); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--surface-border); font-size: 14px; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); background: var(--bg-sunken); }
.table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.table th.active { color: var(--primary); }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--primary-wash); }
.table tbody tr:last-child td { border-bottom: none; }
.overdue-cell { color: #b42318; font-weight: 600; }

/* ---------- Follow-up ---------- */
.followup { display: flex; flex-direction: column; gap: 10px; }
.followup-item {
  display: flex; justify-content: space-between; gap: 16px; align-items: flex-start;
  background: var(--bg-elevated); border: 1px solid var(--surface-border);
  border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 14px 16px; cursor: pointer;
}
.followup-item:hover { background: var(--primary-wash); }
.followup-item.overdue { border-left-color: #b42318; }
.fu-title { font-weight: 700; margin-bottom: 3px; }
.fu-action { font-size: 14px; }
.fu-org { font-size: 12px; margin-top: 2px; }
.fu-date { text-align: right; white-space: nowrap; }

/* ---------- Detail ---------- */
.detail { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.detail-head { display: flex; justify-content: space-between; align-items: center; }
.detail-actions { display: flex; gap: 8px; }
.detail-card { background: var(--bg-elevated); border: 1px solid var(--surface-border); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.detail-title { font-size: 22px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 24px; margin-top: 16px; }
.info-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 2px; }
.info-value { font-size: 15px; }
.detail-notes { margin-top: 18px; }
.detail-notes p { margin: 4px 0 0; white-space: pre-wrap; }

.note-add { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 16px; }
.note-add textarea { flex: 1; }
.note-list { display: flex; flex-direction: column; gap: 10px; }
.note { position: relative; background: var(--bg-sunken); border: 1px solid var(--surface-border); border-radius: var(--radius-sm); padding: 10px 34px 10px 12px; }
.note-time { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.note-body { white-space: pre-wrap; font-size: 14px; }
.note-del { position: absolute; top: 6px; right: 6px; font-size: 15px; }

/* ---------- Forms / inputs ---------- */
.inp {
  width: 100%; padding: 9px 11px; font-size: 14px; font-family: inherit;
  background: var(--bg-elevated); color: var(--text);
  border: 1px solid var(--surface-border); border-radius: var(--radius-sm);
}
.inp:focus { outline: 2px solid var(--focus-ring); outline-offset: -1px; border-color: transparent; }
select.inp { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: flex; gap: 14px; }
.form-row > .field { flex: 1; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.field-hint { font-size: 12px; color: var(--text-muted); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10,12,24,.5); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow-y: auto; backdrop-filter: blur(2px); }
.modal { background: var(--bg); border: 1px solid var(--surface-border); border-radius: var(--radius); width: 100%; max-width: 440px; box-shadow: var(--shadow); }
.modal.wide { max-width: 620px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--surface-border); }
.modal-head h2 { font-size: 17px; }
.modal-head .icon-btn { color: var(--text-muted); font-size: 22px; }
.modal-body { padding: 20px; }

/* ---------- Stage editor ---------- */
.stage-editor { display: flex; flex-direction: column; gap: 8px; }
.stage-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stage-key { font-size: 11px; background: var(--bg-sunken); padding: 2px 6px; border-radius: 4px; color: var(--text-muted); min-width: 96px; }
.stage-row .inp { width: auto; flex: 1; min-width: 90px; }
.off-toggle { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.stage-add { margin-top: 4px; }

/* ---------- Login ---------- */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-form { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 14px; text-align: center; background: var(--bg-elevated); border: 1px solid var(--surface-border); border-radius: var(--radius); padding: 34px 28px; box-shadow: var(--shadow); }
.login-logo { font-weight: 800; font-size: 34px; color: var(--primary); }
.login-logo .qu { color: var(--accent); }
.login-logo-img { width: 132px; max-width: 60%; height: auto; margin: 0 auto 2px; display: block; }
.login-form .muted { margin: -6px 0 6px; }
.login-error { color: #b42318; font-size: 13px; margin: 0; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 20px); background: var(--ink-900); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; opacity: 0; transition: opacity .25s, transform .25s; z-index: 100; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: #1c7a45; }
.toast.bad { background: #b42318; }

/* ---------- Responsive ---------- */
/* ---------- Toolbar / segmented toggle ---------- */
.toolbar-spacer { flex: 1; }
.seg-toggle { display: inline-flex; border: 1px solid var(--surface-border); border-radius: 999px; overflow: hidden; margin-bottom: 16px; }
.seg { background: var(--bg-elevated); border: none; padding: 7px 18px; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--text-muted); }
.seg.active { background: var(--primary); color: var(--text-on-primary); }

/* ---------- Calendar ---------- */
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.cal-month { font-weight: 700; font-size: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); text-align: center; padding: 4px 0; font-weight: 700; }
.cal-cell { min-height: 92px; background: var(--bg-elevated); border: 1px solid var(--surface-border); border-radius: var(--radius-sm); padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.cal-cell.empty { background: transparent; border: none; }
.cal-cell.is-today { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.cal-day { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.cal-chip { background: var(--primary-wash); color: var(--primary); font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip.overdue { background: #fbe3e0; color: #b42318; }

/* ---------- Attachments ---------- */
.file-add { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.file-add .inp { flex: 1; }
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-item { display: flex; align-items: center; gap: 10px; background: var(--bg-sunken); border: 1px solid var(--surface-border); border-radius: var(--radius-sm); padding: 8px 10px; }
.file-name { font-weight: 600; font-size: 14px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-name:hover { text-decoration: underline; }

/* ---------- Print report (PDF export) ---------- */
.print-report { display: none; }
@media print {
  body > *:not(.print-report) { display: none !important; }
  .print-report { display: block !important; color: #000; }
  .print-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
  .print-logo { height: 40px; width: auto; }
  .print-report h1 { font-size: 22px; margin: 0; color: #1e3a5f; }
  .print-sub { font-size: 12px; color: #444; margin-top: 3px; }
  .print-table { width: 100%; border-collapse: collapse; font-size: 12px; }
  .print-table th, .print-table td { border: 1px solid #ccc; padding: 6px 8px; text-align: left; vertical-align: top; }
  .print-table th { background: #eee; }
  @page { margin: 14mm; }
}

/* ---------- Value tickers (top bar) ---------- */
.tickers { display: flex; gap: 8px; align-items: stretch; }
.ticker {
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding: 5px 12px; border-radius: var(--radius-sm); line-height: 1.15; min-width: 82px;
}
.ticker-label { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; opacity: .92; }
.ticker-amount { font-size: 15px; font-weight: 800; }
.ticker-potential  { background: #15683b; color: #b7ecc6; } /* light-green text, dark-green box */
.ticker-booked     { background: #d8f0dd; color: #2c8a54; } /* medium-green text, light-green box */
.ticker-contracted { background: #5cbd86; color: #0f3f26; } /* dark-green text, medium-green box */

/* ---------- Directory (orgs + contacts) ---------- */
.directory { max-width: 900px; margin: 0 auto; }
.dir-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.dir-head .seg-toggle { margin-bottom: 0; }
.dir-search { margin-bottom: 14px; }
.dir-list { display: flex; flex-direction: column; gap: 10px; }
.dir-card { background: var(--bg-elevated); border: 1px solid var(--surface-border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.dir-org-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; }
.dir-org-head:hover { background: var(--primary-wash); }
.dir-name { font-weight: 700; font-size: 15px; }
.org-type-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg-sunken); color: var(--text-muted); white-space: nowrap; }
.dir-org-body { padding: 4px 16px 16px; border-top: 1px solid var(--surface-border); }
.dir-actions { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.dir-subhead { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 700; margin: 14px 0 6px; }
.dir-contact { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--surface-border); border-radius: var(--radius-sm); background: var(--bg-sunken); margin-bottom: 6px; }
.dir-c-main { flex: 1; min-width: 0; }
.dir-c-actions { display: flex; gap: 6px; flex-shrink: 0; }
.dir-c-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 13px; white-space: nowrap; }
.dir-link { color: var(--primary); }
.dir-link:hover { text-decoration: underline; }
.dir-opp { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.dir-opp:hover { background: var(--primary-wash); }

/* Stack the top bar below desktop: tabs on their own scrollable row, tickers full width. */
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  .topbar-right { order: 2; flex: 1; }
  .tickers { order: 4; width: 100%; justify-content: space-between; }
  .ticker { flex: 1; align-items: center; min-width: 0; }
}

@media (max-width: 640px) {
  .topbar { gap: 8px; padding: 9px 10px; }
  .cal-cell { min-height: 62px; padding: 4px; }
  .cal-chip { font-size: 10px; padding: 1px 4px; }
  .cal-dow { font-size: 10px; }
  .logo { font-size: 18px; }
  .tabs { gap: 2px; }
  .tab { padding: 6px 9px; font-size: 13px; gap: 5px; }
  .tab-badge { padding: 1px 6px; }
  .new-label { display: none; }          /* collapse "+ New" to just "+" */
  .btn.new-btn { padding: 8px 12px; font-size: 16px; }
  .topbar-right { gap: 2px; }
  .icon-btn { padding: 6px 6px; }
  .wrap { padding: 14px; }
  .form-row { flex-direction: column; gap: 14px; }
  .info-grid { grid-template-columns: 1fr; }
  .col { flex-basis: 82vw; }
}
