/* Sakan Digital sales CRM. Brand greens from the website, light work surfaces for long tables. */

:root {
  --brand: #0B1A12;
  --brand-2: #14301F;
  --lime: #C6F36B;
  --bg: #F3F6F1;
  --card: #FFFFFF;
  --ink: #15211A;
  --muted: #5D6F62;
  --line: #DDE5DA;
  --accent: #1F6B45;
  --accent-ink: #FFFFFF;
  --over: #B42318;
  --over-bg: #FDECEA;
  --ok: #1F6B45;
  --ok-bg: #E5F4EA;
  --warn: #8A5A00;
  --warn-bg: #FFF4D6;
  --radius: 12px;
  --text: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--text); }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 .6em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.boot { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }
.error { color: var(--over); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ar { font-family: "Geeza Pro", "Noto Naskh Arabic", Tahoma, sans-serif; color: var(--muted); margin: 2px 0 0; }

/* ---------- shell ---------- */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 56px; background: var(--brand); color: #EEF3E8; }
.logo { font-weight: 700; font-size: 18px; letter-spacing: -.02em; color: #EEF3E8; text-decoration: none; }
.logo span { color: var(--lime); }
.logo.big { font-size: 26px; color: var(--brand); margin-bottom: 4px; }
.logo.big span { color: var(--accent); }
.top nav { display: flex; gap: 4px; flex: 1; }
.top nav a { color: #BFD0BF; text-decoration: none; padding: 7px 12px; border-radius: 8px; font-weight: 500; }
.top nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.top nav a[aria-current] { color: var(--brand); background: var(--lime); }
.who { display: flex; gap: 14px; align-items: center; font-size: 14px; }
.who a { color: #EEF3E8; text-decoration: none; }
.who .link { color: #BFD0BF; }
.main { max-width: 1240px; margin: 0 auto; padding: 24px; }

/* ---------- building blocks ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.head-actions { display: flex; gap: 8px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cols > .card { margin-bottom: 18px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 16px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: 600 14px var(--text); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: #B8C7B6; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #185838; }
.btn.danger { color: var(--over); border-color: #F1C2BD; }
.btn.danger:hover { background: var(--over-bg); }
.btn:disabled { opacity: .6; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.danger-text { color: var(--over); }
.spacer { flex: 1; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; }
.form-actions.sticky { position: sticky; bottom: 0; background: var(--card); padding: 12px 0 4px; border-top: 1px solid var(--line); }
form.dirty .form-actions .btn.primary::after { content: "•"; margin-left: 2px; }

label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: #34463A; }
input, select, textarea { font: 400 15px var(--text); color: var(--ink); background: #fff; border: 1px solid #C9D5C6; border-radius: 8px; padding: 8px 10px; width: 100%; min-height: 38px; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid rgba(31,107,69,.18); outline-offset: 0; }
.hint { font-weight: 400; color: var(--muted); font-size: 12px; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
label.check input { width: 18px; min-height: 18px; height: 18px; accent-color: var(--accent); }
fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.grid .wide { grid-column: span 2; }
.lead-form .grid textarea { min-height: 70px; }

.stage, .flag, .prio, .tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #EEF2EC; color: #34463A; }
.stage-won { background: var(--ok-bg); color: var(--ok); }
.stage-lost { background: #F1F1F1; color: #6B6B6B; }
.stage-proposal, .stage-negotiation { background: #E8F0FF; color: #1D4ED8; }
.stage-demo-scheduled, .stage-discovery { background: #F0EDFF; color: #5B3CC4; }
.stage-on-hold { background: var(--warn-bg); color: var(--warn); }
.flag-over { background: var(--over-bg); color: var(--over); }
.flag-ok { background: var(--ok-bg); color: var(--ok); }
.flag-none { background: #F1F1F1; color: #6B6B6B; }
.prio-high { background: var(--over-bg); color: var(--over); }
.prio-medium { background: var(--warn-bg); color: var(--warn); }
.prio-low { background: #F1F1F1; color: #6B6B6B; }
.tag { background: var(--ok-bg); color: var(--ok); }
.guard-note { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 12px 0 0; }
.warn-text { color: var(--warn); }

/* ---------- sign in ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--brand); }
.auth-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 28px; }
.auth-card p { margin: 0; }

/* ---------- dashboard ---------- */
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 4px; }
.tile span { font-size: 13px; color: var(--muted); }
.tile strong { font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile:hover { border-color: var(--accent); }
.tile-over { border-color: #F1C2BD; background: var(--over-bg); }
.tile-over strong { color: var(--over); }
h3.over { color: var(--over); }
.actions { list-style: none; margin: 0 0 14px; padding: 0; }
.actions a { display: grid; grid-template-columns: 96px 1fr auto; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.actions a:hover .what strong { text-decoration: underline; }
.actions .when { font-size: 13px; font-weight: 600; color: var(--muted); }
.actions .when.over { color: var(--over); }
.actions .what strong { display: block; }
.actions .owner { font-size: 13px; color: var(--muted); }
.bars { list-style: none; padding: 0; margin: 0; }
.bars a { display: grid; grid-template-columns: 130px 1fr 32px; align-items: center; gap: 10px; padding: 6px 0; color: var(--ink); text-decoration: none; font-size: 14px; }
.bars i { height: 10px; border-radius: 99px; background: #EEF2EC; position: relative; overflow: hidden; }
.bars i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--accent); border-radius: 99px; }
.bars b { text-align: right; font-variant-numeric: tabular-nums; }
.workflow, .guard ol { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 10px; }
.workflow b { display: block; font-size: 13px; letter-spacing: .04em; color: var(--accent); }
.guard { border-color: #F0D9A0; background: #FFFBEF; }
.guard ol { counter-reset: g; }
.guard li { counter-increment: g; padding-left: 28px; position: relative; }
.guard li::before { content: counter(g); position: absolute; left: 0; top: 1px; width: 20px; height: 20px; border-radius: 50%; background: var(--warn); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }

/* ---------- leads ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px; align-items: center; margin-bottom: 8px; }
.filters input[type=search] { flex: 2 1 240px; width: auto; }
.filters select { flex: 1 1 140px; width: auto; }
.table-wrap { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #F8FAF7; white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
table.leads tbody tr { cursor: pointer; }
table.leads tbody tr:hover, table.leads tbody tr:focus { background: #F6FAF3; outline: none; }
table.leads a { color: var(--ink); text-decoration: none; }
.sub { font-size: 12px; color: var(--muted); }
td.clip { max-width: 260px; }
.empty { text-align: center; padding: 40px; }
.empty .btn { margin-top: 8px; }

/* ---------- lead detail ---------- */
.back { display: inline-block; margin-bottom: 8px; text-decoration: none; font-size: 14px; }
.lead-head .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.lead-head .next { margin: 0; padding: 12px 16px; max-width: 420px; }
.lead-head .next span { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current] { color: var(--accent); border-bottom-color: var(--accent); }
.tabs small { font-weight: 500; background: #EEF2EC; color: var(--muted); padding: 1px 7px; border-radius: 99px; margin-left: 4px; }

.history { list-style: none; padding: 0; margin: 0; }
.history li { border-left: 3px solid var(--line); padding: 4px 0 10px 14px; margin-bottom: 4px; }
.history li.kind-stage { border-left-color: #B9A7F0; }
.history li.kind-demo, .history li.kind-meeting { border-left-color: var(--accent); }
.history p { margin: 4px 0 0; white-space: pre-wrap; }
.h-meta { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.h-meta b { color: var(--ink); }
.h-meta .link { margin-left: auto; }

.sheet-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.sheet .grid { margin: 14px 0 6px; }
.q-area { margin: 22px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.q { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr) minmax(0, .9fr); gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.q.answered .q-text p:first-child::before { content: "✓ "; color: var(--accent); font-weight: 700; }
.q-text p { margin: 0; }
.q-side { display: grid; gap: 8px; }
.q-side label, .ds-side label { font-weight: 500; font-size: 12px; }
.demo-steps { display: grid; gap: 0; margin-top: 10px; }
.demo-step { display: grid; grid-template-columns: 40px minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.demo-step .num { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.demo-step h3 { margin: 0 0 2px; }
.demo-step p { margin: 0; }
.demo-step .ask { color: var(--muted); font-size: 14px; margin-top: 4px; }
.ds-side { display: grid; gap: 8px; }
.status-shown .num { color: var(--accent); }
.status-shown h3::after { content: " ✓"; color: var(--accent); }
.status-needs-verification .num { color: var(--warn); }
.status-not-relevant { opacity: .6; }
.handoff { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0 22px; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }

/* ---------- playbook ---------- */
table.pb td { font-size: 14px; }
.pb .ar { font-size: 14px; }
.objections { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.obj { margin: 0; display: flex; flex-direction: column; }
.obj h3 { margin: 0; font-size: 16px; }
.obj .q-ar { margin-bottom: 10px; }
.obj-reply { background: #F6FAF3; border-radius: 8px; padding: 12px; flex: 1; }
.obj-reply p { margin: 0; }
.obj-reply .ar { margin-top: 8px; color: #34463A; }

/* ---------- team ---------- */
.copyrow { display: flex; gap: 8px; margin-top: 6px; }
#link { margin-top: 14px; padding: 14px; background: var(--ok-bg); border-radius: 8px; }
tr.inactive td { color: var(--muted); }
.row-actions { display: flex; gap: 14px; justify-content: flex-end; white-space: nowrap; }

/* ---------- overlays ---------- */
.modal { position: fixed; inset: 0; background: rgba(11,26,18,.55); display: grid; place-items: center; padding: 16px; z-index: 30; }
.modal .card { max-width: 440px; margin: 0; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--brand); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 40; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--over); }


/* ---------- companies, contacts ---------- */
a.plain { color: inherit; text-decoration: none; }
a.plain:hover { text-decoration: underline; }
.grid .full { grid-column: 1 / -1; }
.grid label.check { align-self: end; min-height: 38px; }
.contact { padding: 16px 20px; }
.gate { margin: 0 0 14px; }
.plain-list { margin: 0 0 14px; padding-left: 20px; display: grid; gap: 6px; }

/* ---------- meetings ---------- */
.meeting { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.meeting-side { position: sticky; top: 72px; max-height: calc(100vh - 90px); overflow: auto; margin: 0; }
.meeting-side .q-area { margin-top: 16px; }
.guide-q { font-weight: 500; font-size: 14px; color: var(--ink); margin-bottom: 12px; }
.guide-q .ar { display: block; font-size: 13px; }
.guide-q textarea { min-height: 38px; overflow: hidden; resize: none; }
.rec .consent { align-items: flex-start; background: #F6FAF3; border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
.rec .consent input { margin-top: 2px; }
.rec .consent .muted { display: block; font-weight: 400; }
.rec-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.btn.file { font-weight: 600; flex-direction: row; color: var(--ink); }
.btn.file.disabled { opacity: .6; cursor: default; }
.rec-live { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 14px; border-radius: 10px; background: var(--over-bg); color: var(--over); }
.rec-live b { font-variant-numeric: tabular-nums; font-size: 18px; }
.rec-live .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--over); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .rec-live .dot { animation: none; } }
#rec-status { margin: 10px 0 0; }
.tips { margin-top: 10px; font-size: 14px; }
.tips summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.tips ul { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; }
#texts textarea[name=transcript] { font-size: 14px; line-height: 1.6; margin-bottom: 14px; }
#texts textarea[readonly] { background: #F8FAF7; }
#analysis h3 { margin-top: 18px; }
.suggest { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.suggest li { border-top: 1px solid var(--line); padding: 10px 0; }
.suggest label.check { align-items: flex-start; font-weight: 400; font-size: 14px; color: var(--ink); }
.suggest label.check input { margin-top: 2px; flex: none; }
.s-ans { display: block; margin-top: 2px; }
.s-ev { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.s-cur { display: block; color: var(--warn); font-size: 13px; margin-top: 2px; white-space: pre-wrap; }
#analysis .btn { margin-bottom: 8px; }

/* ---------- small screens ---------- */
@media (max-width: 1000px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cols, .objections, .handoff, .meeting { grid-template-columns: 1fr; }
  .meeting-side { position: static; max-height: none; }
  .grid { grid-template-columns: 1fr 1fr; }
  .q { grid-template-columns: 1fr; gap: 8px; }
  .demo-step { grid-template-columns: 32px 1fr; }
  .ds-side { grid-column: 2; }
}
@media (max-width: 640px) {
  .top { gap: 10px; padding: 0 16px; height: auto; min-height: 56px; flex-wrap: wrap; padding-block: 8px; }
  .top nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .who { margin-left: auto; }
  .main { padding: 16px; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .grid { grid-template-columns: 1fr; }
  .grid .wide { grid-column: auto; }
  .actions a { grid-template-columns: 80px 1fr; }
  .actions .owner { grid-column: 2; }
  .bars a { grid-template-columns: 110px 1fr 28px; }
  h1 { font-size: 22px; }
}
