/* sales-app.css — Kastra Elion Sales Dashboard brand styling
   Navy #1C355E (PMS 534C). Single typeface, Contax, in three weights
   (loaded via @font-face in index.html from Brand Assets):
     700 (Bold)    — headings, page titles, brand moments
     400 (Regular) — general UI text, table data, buttons, nav
     300 (Light)   — tertiary/supporting text: hints, subtitles, captions */

:root {
  --ke-navy: #1C355E;
  --ke-navy-dark: #12233F;
  --ke-cream: #F7F4EC;
  --ke-white: #FFFFFF;
  --ke-ink: #222222;
  --ke-border: #DCD6C4;
  --ke-olive: #6B7A4F;
  --ke-gold: #8C6D3F;
  --ke-danger: #A3342A;
  --font: "Contax", Georgia, serif;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  background: var(--ke-cream);
  color: var(--ke-ink);
  font-family: var(--font);
  font-weight: 400;
}
b, strong { font-weight: 700; }

/* ── PIN login ─────────────────────────────────────────────────────── */
#sales-pin-overlay {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ke-navy);
  background-image: radial-gradient(circle at 50% 0%, var(--ke-navy-dark), var(--ke-navy) 70%);
}
.sales-pin-card {
  background: var(--ke-white);
  border-radius: 12px;
  padding: 40px 36px;
  width: 320px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.sales-pin-logo {
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 2px;
  color: var(--ke-navy);
  margin-bottom: 4px;
}
.sales-pin-sub {
  font-weight: 300;
  font-size: 12px;
  color: #7A7A7A;
  margin-bottom: 24px;
  letter-spacing: 0.5px;
}
.sales-pin-input {
  width: 100%;
  font-size: 28px;
  letter-spacing: 12px;
  text-align: center;
  padding: 12px 0;
  border: 1px solid var(--ke-border);
  border-radius: 8px;
  margin-bottom: 12px;
  font-weight: 400;
}
.sales-pin-input:focus { outline: 2px solid var(--ke-navy); }
.sales-pin-error { color: var(--ke-danger); font-size: 13px; margin-bottom: 12px; font-weight: 400; }
.sales-pin-btn {
  width: 100%;
  padding: 12px;
  background: var(--ke-navy);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.sales-pin-btn:disabled { opacity: 0.6; cursor: default; }
.sales-pin-btn:hover:not(:disabled) { background: var(--ke-navy-dark); }

/* ── App shell ─────────────────────────────────────────────────────── */
#sales-shell { height: 100%; display: flex; flex-direction: column; }
#sales-topbar {
  height: 56px;
  background: var(--ke-navy);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
}
.sales-topbar-title {
  font-weight: 700;
  letter-spacing: 1.5px;
  font-size: 15px;
}
.sales-topbar-logo { height: 20px; display: block; }
.sales-topbar-right { display: flex; align-items: center; gap: 12px; }
.sales-role-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sales-user-name { font-size: 13px; font-weight: 300; opacity: 0.9; }
.sales-logout-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
}
.sales-logout-btn:hover { background: rgba(255,255,255,0.1); }

/* Secondary/outline button for light (white/cream) backgrounds — sales-logout-btn
   is white-on-transparent and only readable against the navy topbar; every
   secondary action elsewhere (table row actions, panel toggles, dismiss/cancel)
   should use this instead so it isn't invisible on a light page. */
.sales-btn-outline {
  background: transparent;
  border: 1px solid #ccc;
  color: #333;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
}
.sales-btn-outline:hover { background: #F0EEE4; }
.sales-btn-outline:disabled { opacity: 0.5; cursor: default; }

#sales-body { flex: 1; display: flex; min-height: 0; }
#sales-sidebar {
  width: 200px;
  background: var(--ke-white);
  border-right: 1px solid var(--ke-border);
  padding: 16px 10px;
  flex-shrink: 0;
}
.sales-nav-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 400;
  color: var(--ke-ink);
  cursor: pointer;
  margin-bottom: 2px;
}
.sales-nav-btn:hover { background: var(--ke-cream); }
.sales-nav-btn.active { background: var(--ke-navy); color: white; font-weight: 700; }

#sales-main { flex: 1; overflow-y: auto; padding: 24px 28px; }

.sales-page-header h1 {
  font-weight: 700;
  color: var(--ke-navy);
  margin: 0 0 12px 0;
  font-size: 24px;
}
.sales-kpi-row { display: flex; gap: 24px; margin-bottom: 18px; flex-wrap: wrap; }
.sales-kpi { font-size: 13px; font-weight: 300; color: #555; }
.sales-kpi b { color: var(--ke-navy); font-size: 15px; font-weight: 700; }

.sales-source-panel {
  background: white;
  border: 1px solid var(--ke-border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.sales-source-btn {
  background: var(--ke-olive);
  color: white;
  border: none;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin-right: 10px;
}
.sales-source-btn:hover:not(:disabled) { opacity: 0.9; }
.sales-source-btn:disabled { opacity: 0.6; cursor: default; }
.sales-source-summary { margin-top: 10px; font-size: 13px; font-weight: 300; color: #444; }

.sales-inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.sales-inline-form input, .sales-inline-form select { padding: 6px 8px; font-size: 13px; }

.sales-chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.sales-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--ke-cream); border: 1px solid var(--ke-border); border-radius: 999px;
  padding: 4px 6px 4px 12px; font-size: 12px; font-weight: 400;
}
.sales-chip button {
  background: none; border: none; cursor: pointer; color: #999; font-size: 14px;
  line-height: 1; padding: 2px 6px; border-radius: 999px;
}
.sales-chip button:hover { background: #E8E2CE; color: var(--ke-danger); }

.sales-toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.sales-search, .sales-toolbar select {
  padding: 8px 10px;
  border: 1px solid var(--ke-border);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 400;
  font-family: var(--font);
}
.sales-search { flex: 1; min-width: 200px; }

.sales-table-wrap { background: white; border: 1px solid var(--ke-border); border-radius: 10px; overflow: hidden; }
.sales-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sales-table th {
  text-align: left;
  background: var(--ke-cream);
  color: var(--ke-navy);
  padding: 10px 12px;
  font-weight: 700;
  border-bottom: 1px solid var(--ke-border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.sales-table th:hover { background: #EFEADA; }
.sales-th-arrow { font-size: 10px; margin-left: 4px; opacity: 0.6; }
.sales-table td { padding: 9px 12px; border-bottom: 1px solid #EFEBDF; font-weight: 400; }
.sales-table tr:last-child td { border-bottom: none; }
.sales-table tr:hover td { background: #FBFAF5; }
.sales-row-clickable { cursor: pointer; }

/* ── Account detail modal ─────────────────────────────────────────── */
.sales-modal-overlay {
  position: fixed; inset: 0; background: rgba(18,35,63,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; z-index: 100;
}
.sales-modal {
  background: white; border-radius: 12px; width: 100%; max-width: 560px;
  max-height: 85vh; overflow-y: auto; padding: 24px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.sales-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px;
}
.sales-modal-header h2 { font-weight: 700; color: var(--ke-navy); font-size: 19px; margin: 0; }
.sales-detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; margin-bottom: 16px;
}
.sales-detail-field { min-width: 0; }
.sales-detail-label { font-size: 11px; font-weight: 700; color: #8A8A8A; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 2px; }
.sales-detail-value { font-size: 14px; font-weight: 400; color: var(--ke-ink); word-break: break-word; }
.sales-detail-score {
  background: var(--ke-cream); border: 1px solid var(--ke-border); border-radius: 8px;
  padding: 12px 14px; margin-bottom: 16px;
}
.sales-detail-score-value { font-size: 22px; font-weight: 700; color: var(--ke-navy); margin: 2px 0 6px; }
.sales-signal-list { margin: 0; padding-left: 18px; font-size: 13px; font-weight: 400; color: #444; }
.sales-signal-list li { margin-bottom: 3px; }
.sales-detail-edit { border-top: 1px solid var(--ke-border); padding-top: 14px; }

.sales-badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 700; }
.sales-badge-won { background: #E4EBDD; color: var(--ke-olive); }
.sales-badge-winback { background: #F3E7D8; color: var(--ke-gold); }
.sales-badge-prospect, .sales-badge-targeted { background: #E7ECF3; color: var(--ke-navy); }

.sales-page-loading, .sales-page-error, .sales-empty {
  padding: 40px;
  text-align: center;
  color: #888;
  font-size: 14px;
  font-weight: 300;
}
.sales-page-error { color: var(--ke-danger); }
.sales-placeholder {
  background: white;
  border: 1px dashed var(--ke-border);
  border-radius: 10px;
  padding: 24px;
  font-size: 13px;
  font-weight: 400;
  color: #555;
  line-height: 1.6;
}
.sales-hint { font-size: 12px; font-weight: 300; color: #888; margin-top: 12px; }
