/* ── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:    #1a2744;
  --navy2:   #1e2f52;
  --navy3:   #243660;
  --gold:    #c9a84c;
  --gold2:   #e8c76a;
  --white:   #ffffff;
  --offwhite:#f7f8fc;
  --muted:   #8993a9;
  --border:  #e2e6f0;

  --red:     #e53e3e;
  --red-bg:  #fff5f5;
  --red-brd: #fed7d7;

  --orange:  #dd6b20;
  --orange-bg:#fffaf0;
  --orange-brd:#fbd38d;

  --blue:    #3182ce;
  --blue-bg: #ebf8ff;
  --blue-brd:#bee3f8;

  --purple:  #805ad5;
  --purple-bg:#faf5ff;
  --purple-brd:#d6bcfa;

  --green:   #38a169;

  --sidebar-w: 220px;
  --header-h:  64px;
  --radius:    10px;
  --shadow:    0 2px 12px rgba(0,0,0,.08);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: #2d3748;
  background: var(--offwhite);
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  transition: opacity .15s, transform .1s;
}
button:hover { opacity: .85; }
button:active { transform: scale(.97); }
button:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ── Layout ─────────────────────────────────────────────────────────────── */

#app { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
#sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  z-index: 10;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo .brand {
  font-size: 18px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: .5px;
}
.sidebar-logo .tagline {
  font-size: 11px;
  color: rgba(255,255,255,.4);
  margin-top: 2px;
}

nav { flex: 1; padding: 16px 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.65);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all .15s;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-item.active {
  color: var(--gold);
  border-left-color: var(--gold);
  background: rgba(201,168,76,.08);
}
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 11px;
  color: rgba(255,255,255,.3);
}

/* Main */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
#header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.greeting { font-size: 20px; font-weight: 700; color: var(--navy); }
.greeting span { color: var(--gold); }

.header-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }

.header-right { display: flex; align-items: center; gap: 12px; }

.action-count-pill {
  background: var(--red);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
}

.btn-primary {
  background: var(--gold);
  color: var(--navy);
  font-weight: 700;
}
.btn-secondary {
  background: var(--offwhite);
  color: var(--navy);
  border: 1px solid var(--border);
}

/* Content */
#content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}

.live-call-overlay {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1100;
  max-width: 360px;
  background: var(--red-bg);
  border: 1px solid var(--red-brd);
  border-left: 4px solid var(--red);
  box-shadow: var(--shadow);
  border-radius: 12px;
  padding: 14px 16px;
}

.live-call-overlay.hidden { display: none; }
.live-call-title { color: var(--red); font-size: 14px; font-weight: 800; }
.live-call-meta { margin-top: 4px; color: var(--muted); font-size: 12px; }

/* Sections */
.section { display: none; }
.section.active { display: block; }

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 20px;
}

/* ── Today's Actions ─────────────────────────────────────────────────────── */

.action-group { margin-bottom: 28px; }
.action-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.action-group-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.badge-red    { background: var(--red);    color: #fff; }
.badge-orange { background: var(--orange); color: #fff; }
.badge-blue   { background: var(--blue);   color: #fff; }
.badge-purple { background: var(--purple); color: #fff; }

.action-count-label { font-size: 13px; color: var(--muted); }

.action-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-left: 4px solid transparent;
  padding: 16px 20px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform .1s;
}
.action-card:hover { transform: translateY(-1px); }

.action-card.call    { border-left-color: var(--red); }
.action-card.linkedin { border-left-color: var(--orange); }
.action-card.email   { border-left-color: var(--blue); }
.action-card.domain  { border-left-color: var(--purple); }

.action-card-info { flex: 1; min-width: 0; }
.action-card-name { font-weight: 700; font-size: 15px; }
.action-card-company { color: var(--muted); font-size: 13px; }
.action-card-domain { font-size: 12px; color: var(--purple); font-weight: 600; margin-top: 2px; }
.action-card-reason {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.action-card-meta { text-align: right; min-width: 120px; }
.last-contact-label { font-size: 11px; color: var(--muted); }
.last-contact-val { font-size: 13px; font-weight: 600; }

.action-btns { display: flex; gap: 6px; flex-shrink: 0; }
.btn-call     { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-brd); }
.btn-linkedin { background: var(--orange-bg); color: var(--orange); border: 1px solid var(--orange-brd); }
.btn-email2   { background: var(--blue-bg); color: var(--blue); border: 1px solid var(--blue-brd); }
.btn-done     { background: #f0fff4; color: var(--green); border: 1px solid #c6f6d5; }

.countdown-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 4px;
}
.chip-red    { background: var(--red-bg); color: var(--red); }
.chip-orange { background: var(--orange-bg); color: var(--orange); }
.chip-blue   { background: var(--blue-bg); color: var(--blue); }

.action-countdown {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  font-weight: 600;
}

.urgent-card {
  border-left: 4px solid #c53030 !important;
  background: #fff5f5 !important;
}

.empty-state {
  text-align: center;
  padding: 32px;
  color: var(--muted);
  font-size: 14px;
}

/* ── Pipeline / Kanban ───────────────────────────────────────────────────── */

#pipeline-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: calc(100vh - 180px);
}

.kanban-col {
  min-width: 220px;
  flex: 1;
  background: #eef0f7;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}

.kanban-col-header {
  padding: 12px 14px;
  font-weight: 700;
  font-size: 13px;
  color: var(--navy);
  border-bottom: 2px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.col-count {
  background: var(--navy);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

.kanban-cards { padding: 10px; flex: 1; }

.deal-card {
  background: var(--white);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: grab;
  border-left: 3px solid var(--gold);
  transition: box-shadow .15s, transform .1s;
}
.deal-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.12); transform: translateY(-1px); }
.deal-card.stale { border-left-color: var(--orange); }
.deal-card.drag-over { outline: 2px dashed var(--gold); }

.deal-domain { font-weight: 700; font-size: 14px; color: var(--navy); }
.deal-buyer { font-size: 12px; color: var(--muted); margin-top: 2px; }
.deal-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}
.deal-days {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 8px;
}
.deal-days.fresh { background: #f0fff4; color: var(--green); }
.deal-days.warn  { background: var(--orange-bg); color: var(--orange); }

/* ── Contacts / Intelligence ─────────────────────────────────────────────── */

.contacts-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center;
}
.search-input {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: var(--white);
}
.search-input:focus { border-color: var(--blue); }

.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.contact-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  cursor: pointer;
  transition: transform .1s;
  border-top: 3px solid var(--gold);
}
.contact-card:hover { transform: translateY(-2px); }

.contact-card-header { display: flex; justify-content: space-between; align-items: flex-start; }
.contact-name { font-size: 16px; font-weight: 700; color: var(--navy); }
.contact-company { font-size: 13px; color: var(--muted); margin-top: 2px; }
.contact-stage-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 10px;
  white-space: nowrap;
}
.stage-Prospect       { background: #edf2f7; color: #718096; }
.stage-Contacted      { background: var(--blue-bg); color: var(--blue); }
.stage-Replied        { background: #f0fff4; color: var(--green); }
.stage-Negotiating    { background: var(--orange-bg); color: var(--orange); }
.stage-Under-Contract { background: var(--purple-bg); color: var(--purple); }
.stage-Closed         { background: #1a2744; color: var(--gold); }

.contact-domain { font-size: 13px; font-weight: 600; color: var(--purple); margin-top: 10px; }
.contact-timeline { margin-top: 10px; font-size: 12px; color: var(--muted); }
.contact-timeline div { margin-top: 3px; }

.contact-quick-btns { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.contact-quick-btns button { font-size: 11px; padding: 5px 10px; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.hidden { display: none; }

.modal {
  background: var(--white);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}
.modal-title { font-size: 20px; font-weight: 800; color: var(--navy); }
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--muted);
  padding: 0;
  line-height: 1;
}
.modal-section { margin-bottom: 20px; }
.modal-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 8px;
}

.activity-list { list-style: none; }
.activity-item {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--offwhite);
  margin-bottom: 6px;
  font-size: 13px;
}
.activity-item .act-type {
  font-weight: 700;
  text-transform: capitalize;
}
.activity-item .act-date { color: var(--muted); font-size: 11px; }

.field-group { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field-val { font-size: 14px; font-weight: 500; }

.stage-selector { display: flex; gap: 8px; flex-wrap: wrap; }
.stage-btn {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: var(--offwhite);
  border: 1px solid var(--border);
  color: var(--navy);
}
.stage-btn.active { background: var(--navy); color: var(--gold); border-color: var(--navy); }

.log-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-top: 8px; }
.log-form select, .log-form input, .log-form textarea {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}
.log-form select:focus, .log-form input:focus, .log-form textarea:focus {
  border-color: var(--blue);
}

/* ── Digest ──────────────────────────────────────────────────────────────── */

.digest-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.digest-card h3 { font-size: 16px; font-weight: 700; color: var(--navy); margin-bottom: 14px; }
.digest-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.digest-row:last-child { border-bottom: none; }
.digest-num { font-weight: 700; font-size: 18px; color: var(--gold); }

/* ── Inquiries ───────────────────────────────────────────────────────────── */

.inquiry-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 12px;
  border-left: 4px solid var(--purple);
}
.inquiry-domain { font-size: 16px; font-weight: 800; color: var(--navy); }
.inquiry-from { color: var(--muted); font-size: 13px; margin-top: 4px; }
.inquiry-offer { font-weight: 700; color: var(--green); margin-top: 6px; }
.inquiry-message { margin-top: 8px; font-size: 13px; color: #555; }
.inquiry-time { font-size: 11px; color: var(--muted); margin-top: 8px; }
.bridge-metrics {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}
.bridge-metrics strong { color: var(--navy); }
.bridge-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.bridge-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.bridge-stat-grid-compact {
  margin-top: 12px;
}
.bridge-stat {
  background: var(--offwhite);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  min-width: 0;
}
.bridge-stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  font-weight: 700;
}
.bridge-stat-value {
  color: var(--navy);
  font-size: 16px;
  font-weight: 800;
  margin-top: 6px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.bridge-stat-control {
  margin-top: 8px;
}
.bridge-contact-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}
.bridge-input,
.bridge-select {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--white);
  color: var(--navy);
}
.bridge-input:focus,
.bridge-select:focus {
  border-color: var(--blue);
}
.btn-open-contact {
  background: var(--blue-bg);
  color: var(--blue);
  border: 1px solid var(--blue-brd);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
}
.review-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .2px;
}
.review-badge.review-good {
  background: #f0fff4;
  color: var(--green);
  border: 1px solid #c6f6d5;
}
.review-badge.review-warn {
  background: #fffaf0;
  color: var(--orange);
  border: 1px solid var(--orange-brd);
}
.review-badge.review-info {
  background: var(--blue-bg);
  color: var(--blue);
  border: 1px solid var(--blue-brd);
}
.review-badge.review-neutral {
  background: #edf2f7;
  color: #4a5568;
  border: 1px solid #cbd5e0;
}

/* ── Add Contact Form ────────────────────────────────────────────────────── */

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field label { font-size: 12px; font-weight: 600; color: var(--navy); }
.form-field input, .form-field select, .form-field textarea {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  border-color: var(--blue);
}
.form-field.full { grid-column: 1 / -1; }

.form-actions { margin-top: 20px; display: flex; gap: 10px; justify-content: flex-end; }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c1c9d6; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0aec0; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar { width: 60px; }
  .nav-item span, .sidebar-logo .tagline, .sidebar-logo .brand { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .nav-item .nav-icon { font-size: 18px; width: auto; }
  #content { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .field-group { grid-template-columns: 1fr; }
  #pipeline-board { flex-direction: column; }
  .action-card { flex-wrap: wrap; }
  .action-btns { width: 100%; justify-content: flex-end; }
}

@media (max-width: 900px) {
  .modal {
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    padding: 20px;
  }
  .modal-title {
    font-size: 18px;
  }
  .bridge-stat-grid {
    grid-template-columns: 1fr 1fr;
  }
  .bridge-contact-controls {
    grid-template-columns: 1fr;
  }
  .bridge-contact-controls > * {
    width: 100%;
  }
  .btn-open-contact {
    justify-content: center;
  }
  .live-call-overlay {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }
}

@media (max-width: 560px) {
  .bridge-stat-grid {
    grid-template-columns: 1fr;
  }
  .modal-backdrop {
    padding: 12px;
  }
  .modal {
    padding: 16px;
    border-radius: 12px;
  }
  .bridge-input,
  .bridge-select,
  .log-form select,
  .log-form input,
  .log-form textarea {
    font-size: 16px;
  }
  .live-call-title { font-size: 13px; }
  .live-call-meta { font-size: 11px; }
}

/* Toast */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--navy);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
  z-index: 999;
  transform: translateY(80px);
  opacity: 0;
  transition: all .3s;
}
#toast.show {
  transform: translateY(0);
  opacity: 1;
}
#toast.success { border-left: 4px solid var(--green); }
#toast.error   { border-left: 4px solid var(--red); }
