/* ============================================================
   Sales CRM — App-level styles
   ============================================================ */

/* Inter font */
:root { font-family: 'Inter', 'Inter var', sans-serif; }

/* Active nav link */
[data-shell-nav] a           { color: rgb(82 82 91); text-decoration: none; padding: 4px 2px; border-bottom: 2px solid transparent; transition: color .15s, border-color .15s; }
[data-shell-nav] a:hover     { color: rgb(24 24 27); }
[data-shell-nav] a.is-active { color: rgb(37 99 235); font-weight: 600; border-bottom-color: rgb(37 99 235); }

/* Quiet page-leaving transition */
html.tada-leaving body { opacity: 0.55; transition: opacity .15s; }

/* ---- KPI cards ---- */
.kpi-card { background: #fff; border: 1px solid rgb(228 228 231); border-radius: 12px; padding: 20px 24px; }
.kpi-label { font-size: 12px; color: rgb(113 113 122); text-transform: uppercase; letter-spacing: .04em; font-weight: 500; }
.kpi-value { font-size: 28px; font-weight: 700; color: rgb(24 24 27); line-height: 1.2; margin-top: 4px; }
.kpi-sub   { font-size: 12px; color: rgb(113 113 122); margin-top: 4px; }

/* ---- Stage badges ---- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.badge-lead       { background: rgb(219 234 254); color: rgb(30 64 175); }
.badge-qualified  { background: rgb(209 250 229); color: rgb(6 95 70); }
.badge-proposal   { background: rgb(254 243 199); color: rgb(120 53 15); }
.badge-negotiation{ background: rgb(237 233 254); color: rgb(91 33 182); }
.badge-won        { background: rgb(220 252 231); color: rgb(21 128 61); }
.badge-lost       { background: rgb(254 226 226); color: rgb(153 27 27); }
.badge-active     { background: rgb(209 250 229); color: rgb(6 95 70); }
.badge-inactive   { background: rgb(244 244 245); color: rgb(113 113 122); }
.badge-planning   { background: rgb(219 234 254); color: rgb(30 64 175); }
.badge-onhold     { background: rgb(254 243 199); color: rgb(120 53 15); }
.badge-completed  { background: rgb(220 252 231); color: rgb(21 128 61); }
.badge-high       { background: rgb(254 226 226); color: rgb(153 27 27); }
.badge-medium     { background: rgb(254 243 199); color: rgb(120 53 15); }
.badge-low        { background: rgb(209 250 229); color: rgb(6 95 70); }
.badge-call       { background: rgb(219 234 254); color: rgb(30 64 175); }
.badge-email      { background: rgb(237 233 254); color: rgb(91 33 182); }
.badge-meeting    { background: rgb(254 243 199); color: rgb(120 53 15); }
.badge-note       { background: rgb(244 244 245); color: rgb(63 63 70); }
.badge-default    { background: rgb(244 244 245); color: rgb(63 63 70); }

/* ---- Table ---- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: rgb(113 113 122); padding: 10px 14px; text-align: left; border-bottom: 1px solid rgb(228 228 231); background: rgb(250 250 250); }
.data-table td { font-size: 13px; color: rgb(24 24 27); padding: 11px 14px; border-bottom: 1px solid rgb(244 244 245); vertical-align: middle; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { cursor: pointer; transition: background .1s; }
.data-table tbody tr:hover { background: rgb(249 250 251); }

/* ---- Search input ---- */
.search-input { font-size: 13px; border: 1px solid rgb(228 228 231); border-radius: 8px; padding: 7px 12px; outline: none; transition: box-shadow .15s; width: 220px; }
.search-input:focus { box-shadow: 0 0 0 3px rgb(59 130 246 / 0.2); border-color: rgb(147 197 253); }

/* ---- Btn ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; border-radius: 8px; padding: 7px 14px; cursor: pointer; border: none; transition: opacity .15s; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: rgb(37 99 235); color: #fff; }
.btn-primary:hover:not(:disabled) { background: rgb(29 78 216); }
.btn-secondary { background: #fff; color: rgb(63 63 70); border: 1px solid rgb(228 228 231); }
.btn-secondary:hover:not(:disabled) { background: rgb(244 244 245); }
.btn-danger { background: rgb(239 68 68); color: #fff; }

/* ---- Detail card ---- */
.detail-card { background: #fff; border: 1px solid rgb(228 228 231); border-radius: 12px; overflow: hidden; }
.detail-card-header { padding: 20px 24px 16px; border-bottom: 1px solid rgb(244 244 245); }
.detail-field { display: grid; grid-template-columns: 160px 1fr; gap: 8px; padding: 10px 24px; border-bottom: 1px solid rgb(244 244 245); align-items: start; font-size: 13px; }
.detail-field:last-child { border-bottom: none; }
.detail-field-label { color: rgb(113 113 122); font-weight: 500; padding-top: 1px; }
.detail-field-value { color: rgb(24 24 27); word-break: break-word; }

/* ---- Workflow run box ---- */
.run-box { background: rgb(248 250 252); border: 1px solid rgb(228 228 231); border-radius: 8px; padding: 14px 16px; font-size: 13px; }
.run-box.success { border-color: rgb(134 239 172); background: rgb(240 253 244); }
.run-box.failure { border-color: rgb(252 165 165); background: rgb(254 242 242); }
.run-box.running { border-color: rgb(147 197 253); background: rgb(239 246 255); }

/* ---- Toast ---- */
#toast { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast-msg { background: rgb(24 24 27); color: #fff; font-size: 13px; border-radius: 8px; padding: 10px 16px; opacity: 0; transform: translateY(8px); animation: toastIn .2s forwards, toastOut .2s 3.5s forwards; pointer-events: auto; max-width: 320px; }
.toast-msg.toast-success { background: rgb(21 128 61); }
.toast-msg.toast-error   { background: rgb(185 28 28); }
@keyframes toastIn  { to { opacity:1; transform:translateY(0); } }
@keyframes toastOut { to { opacity:0; transform:translateY(6px); } }

/* ---- Pagination ---- */
.paginator { display: flex; align-items: center; gap: 8px; font-size: 13px; color: rgb(113 113 122); }
.page-btn { padding: 4px 10px; border-radius: 6px; border: 1px solid rgb(228 228 231); background: #fff; cursor: pointer; font-size: 13px; }
.page-btn:hover:not(:disabled) { background: rgb(244 244 245); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---- Progress bar ---- */
.progress-bar-wrap { background: rgb(228 228 231); border-radius: 999px; height: 6px; overflow: hidden; }
.progress-bar-fill { background: rgb(37 99 235); height: 100%; border-radius: 999px; transition: width .3s; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .data-table th, .data-table td { padding: 9px 10px; }
  .detail-field { grid-template-columns: 1fr; }
  .kpi-value { font-size: 22px; }
}
