/* SMM Agentlik CRM — interfeys üslubları */
:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --ink: #1b1d22;
  --ink-2: #4b4f58;
  --muted: #7a7e87;
  --line: #e4e2dc;
  --side: #17191e;
  --side-ink: #c9ccd3;
  --side-hover: #24272e;
  --primary: #1f6f5c;
  --primary-ink: #ffffff;
  --primary-soft: #e3f1ec;
  --accent: #e8590c;
  --danger: #c92a2a;
  --danger-soft: #fdecec;
  --warn: #b35c00;
  --warn-soft: #fff4e2;
  --info: #1c6ed6;
  --info-soft: #e8f1fd;
  --ok: #2b8a3e;
  --ok-soft: #e6f4ea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 20, 30, .05), 0 4px 16px rgba(20, 20, 30, .04);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14.5px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 18px 0 10px; }
code { background: #efeee9; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ic { flex: none; vertical-align: middle; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- Karkas ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--side); color: var(--side-ink); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; transition: transform .2s; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 650; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--primary); color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .02em; flex: none; }
.logo.lg { width: 52px; height: 52px; border-radius: 14px; font-size: 18px; margin-bottom: 10px; }
.nav { display: flex; flex-direction: column; padding: 6px 10px; gap: 2px; overflow-y: auto; flex: 1; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; color: var(--side-ink); font-size: 14px; }
.nav a:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.nav a.active { background: var(--primary); color: #fff; }
.nav .count { margin-left: auto; background: var(--accent); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 7px; }
.sidebar-foot { padding: 12px 18px; font-size: 11px; color: #6b6f78; }
.main { flex: 1; margin-left: 240px; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: rgba(244, 243, 239, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.search { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; color: var(--muted); }
.search input { border: 0; outline: 0; background: transparent; padding: 9px 0; flex: 1; font: inherit; color: var(--ink); min-width: 0; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--surface); border-color: var(--line); }
.bell .dot { position: absolute; top: 3px; right: 2px; background: var(--accent); color: #fff; font-size: 10px; line-height: 16px; min-width: 16px; padding: 0 4px; border-radius: 8px; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 10px; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover { background: var(--surface); }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #d9e9e3; color: var(--primary); font-weight: 700; font-size: 12px; flex: none; }
.usermenu .menu { position: absolute; right: 0; top: 46px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); min-width: 210px; padding: 6px; }
.usermenu .menu a, .usermenu .menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 8px; color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.usermenu .menu a:hover, .usermenu .menu button:hover { background: var(--surface-2); text-decoration: none; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; }
.menu-head small { color: var(--muted); }
.content { padding: 22px 24px 48px; max-width: 1400px; width: 100%; }
.scrim { display: none; }
.only-mobile { display: none; }

/* ---------- Səhifə başlığı ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }

/* ---------- Kartlar ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card.narrow { max-width: 720px; }
.card.center { margin: 40px auto; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); color: inherit; display: block; }
a.kpi:hover { text-decoration: none; border-color: #cfd8d4; }
.kpi .k-label { color: var(--muted); font-size: 12.5px; }
.kpi .k-value { font-size: 22px; font-weight: 680; letter-spacing: -.01em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12px; color: var(--muted); }
.kpi.warn .k-value { color: var(--warn); }
.kpi.danger .k-value { color: var(--danger); }
.kpi.good .k-value { color: var(--ok); }
dl.facts { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; white-space: pre-line; word-break: break-word; }

/* ---------- Cədvəllər ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t th[data-sort] { cursor: pointer; user-select: none; }
table.t th[data-sort]::after { content: " ↕"; opacity: .35; }
table.t td { padding: 10px; border-bottom: 1px solid #efeee9; vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr:hover td { background: var(--surface-2); }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tfoot td { font-weight: 650; border-top: 1px solid var(--line); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.empty .ic { color: #b9bcc3; margin-bottom: 6px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.filters select, .filters input { min-width: 140px; }

/* ---------- Nişanlar ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 550; background: #eeede8; color: var(--ink-2); white-space: nowrap; }
.b-approved, .b-completed, .b-published, .b-paid, .b-active, .b-connected, .b-finalized { background: var(--ok-soft); color: var(--ok); }
.b-in_progress, .b-scheduled, .b-publishing, .b-partial { background: var(--info-soft); color: var(--info); }
.b-review, .b-awaiting_review, .b-client_approval, .b-awaiting_client, .b-paused, .b-on_leave, .b-needs_check, .b-high { background: var(--warn-soft); color: var(--warn); }
.b-rejected, .b-failed, .b-overdue, .b-error, .b-expired, .b-urgent, .b-terminated { background: var(--danger-soft); color: var(--danger); }
.b-cancelled, .b-void, .b-archived, .b-ended, .b-disconnected, .b-low { background: #efeee9; color: var(--muted); }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); margin: 0 4px 4px 0; }
.overdue-text { color: var(--danger); font-weight: 600; }

/* ---------- Formalar ---------- */
.form label, label.field { display: flex; flex-direction: column; gap: 5px; font-weight: 550; font-size: 13.5px; margin-bottom: 12px; color: var(--ink-2); }
.form label small { font-weight: 400; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #d8d6cf; border-radius: 9px; padding: 8px 11px; width: 100%; min-width: 0; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(31, 111, 92, .25); border-color: var(--primary); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--primary); }
input:disabled { background: var(--surface-2); color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 450; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; }
.checks label { flex-direction: row; align-items: center; gap: 6px; font-weight: 450; margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.span2 { grid-column: span 2; }
.span3 { grid-column: span 3; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 4px; margin: 0 0 14px; }
legend { font-weight: 650; padding: 0 6px; }
.note { background: var(--info-soft); border: 1px solid #cfe0f8; color: #20406b; border-radius: 10px; padding: 10px 14px; margin: 12px 0; font-size: 13.5px; }
.note.warn { background: var(--warn-soft); border-color: #f3d9ad; color: #6d3a00; }
.note.danger { background: var(--danger-soft); border-color: #f2c4c4; color: #7a1717; }
.note.ok { background: var(--ok-soft); border-color: #c5e3cc; color: #1d5a29; }
.inline-form { display: inline; }
.row-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.row-form label { margin: 0; }

/* ---------- Düymələr ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9px; border: 1px solid #d3d1ca; background: #fff; color: var(--ink); font: inherit; font-weight: 560; cursor: pointer; white-space: nowrap; line-height: 1.3; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: #185a4a; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #a61e1e; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn-sm { padding: 4px 10px; font-size: 13px; border-radius: 7px; }
.btn-lg { padding: 11px 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid #d3d1ca; border-radius: 9px; overflow: hidden; background: #fff; }
.seg a { padding: 7px 12px; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; border-right: 1px solid #e4e2dc; }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--primary); color: #fff; }
.seg a:hover { text-decoration: none; }

/* ---------- Bildirişlər ---------- */
.alert { position: relative; padding: 11px 40px 11px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; font-size: 14px; }
.alert-success { background: var(--ok-soft); border-color: #c5e3cc; color: #1d5a29; }
.alert-error { background: var(--danger-soft); border-color: #f2c4c4; color: #7a1717; }
.alert-warning { background: var(--warn-soft); border-color: #f3d9ad; color: #6d3a00; }
.alert-info { background: var(--info-soft); border-color: #cfe0f8; color: #20406b; }
.alert-x { position: absolute; right: 8px; top: 6px; border: 0; background: none; font-size: 20px; cursor: pointer; color: inherit; opacity: .6; }

/* ---------- Siyahı elementləri ---------- */
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid #efeee9; display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.list li:last-child { border-bottom: 0; }
.list .meta { font-size: 12.5px; color: var(--muted); }
.notif.unread { background: #fbfaf3; }
.progress { height: 8px; background: #ecebe6; border-radius: 6px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); }
.progress.warn > span { background: var(--warn); }
.progress.danger > span { background: var(--danger); }

/* ---------- Tablar ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--ink); }

/* ---------- Kanban ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #ecebe6; border-radius: 12px; padding: 10px; min-height: 120px; }
.col-head { display: flex; justify-content: space-between; font-weight: 600; font-size: 13px; padding: 2px 4px 8px; }
.tcard { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-size: 13.5px; }
.tcard .tt { font-weight: 600; color: var(--ink); display: block; margin-bottom: 4px; }
.tcard .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.tcard form { margin-top: 8px; }
.tcard select { padding: 4px 8px; font-size: 12.5px; }

/* ---------- Təqvim ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--line); gap: 1px; }
.cal .dow { background: var(--surface-2); padding: 6px 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.cal .day { background: #fff; min-height: 108px; padding: 6px; font-size: 12.5px; min-width: 0; }
.cal .day.out { background: #faf9f6; color: #b0b3b9; }
.cal .day.today { box-shadow: inset 0 0 0 2px var(--primary); }
.cal .dnum { font-weight: 600; margin-bottom: 4px; display: block; }
.cal .ev { display: block; padding: 2px 6px; margin-bottom: 3px; border-radius: 5px; background: var(--primary-soft); color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.cal .ev.b-overdue, .cal .ev.b-failed, .cal .ev.b-rejected { background: var(--danger-soft); color: var(--danger); }
.cal .ev.b-published, .cal .ev.b-completed { background: var(--ok-soft); color: var(--ok); }
.cal .ev.b-draft, .cal .ev.b-awaiting_review, .cal .ev.b-awaiting_client, .cal .ev.b-review { background: var(--warn-soft); color: var(--warn); }
.cal .ev:hover { text-decoration: none; filter: brightness(.96); }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav strong { min-width: 150px; text-align: center; }
.agenda .day-block { margin-bottom: 14px; }
.agenda h3 { margin: 0 0 6px; font-size: 14px; }

/* ---------- AI söhbət ---------- */
.chat { display: flex; flex-direction: column; height: calc(100vh - 210px); min-height: 460px; }
.chat-log { flex: 1; overflow-y: auto; padding: 4px 2px 12px; }
.msg { max-width: 860px; margin-bottom: 14px; }
.msg .who { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.msg .bubble { padding: 11px 14px; border-radius: 12px; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { margin-left: auto; }
.msg.user .bubble { background: var(--primary); color: #fff; }
.msg.assistant .bubble { background: #fff; border: 1px solid var(--line); }
.ai-items { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.ai-items .ai-item { padding: 10px 12px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 22px 1fr; gap: 8px; }
.ai-items .ai-item:last-child { border-bottom: 0; }
.ai-items .ai-item p { margin: 3px 0; font-size: 13px; white-space: pre-wrap; }
.ai-items .foot { padding: 10px 12px; display: flex; gap: 8px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; border-top: 1px solid var(--line); padding-top: 12px; }
.chat-form textarea { min-height: 56px; max-height: 200px; }
.typing { color: var(--muted); font-style: italic; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; color: var(--ink-2); }
.chip:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Pəncərə (təsdiq) ---------- */
.modal { position: fixed; inset: 0; background: rgba(15, 16, 20, .45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal[hidden] { display: none; }
.modal-card { background: #fff; border-radius: 14px; padding: 22px; max-width: 420px; width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.modal-card p { margin: 0 0 18px; font-size: 15px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- Boş səhifələr (giriş, quraşdırma) ---------- */
body.blank { background: var(--bg); }
.blank-wrap { max-width: 860px; margin: 0 auto; padding: 32px 16px; }
.login { min-height: 80vh; display: grid; place-items: center; }
.login-card { width: 100%; max-width: 400px; padding: 28px; }
.install-head { text-align: center; margin-bottom: 20px; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: 6px 0; display: flex; gap: 10px; align-items: baseline; }
.checklist .mark { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.checklist .ok .mark { background: var(--ok-soft); color: var(--ok); }
.checklist .bad .mark { background: var(--danger-soft); color: var(--danger); }
.checklist .warn .mark { background: var(--warn-soft); color: var(--warn); }
.err-code { font-size: 54px; font-weight: 750; color: #d4d2cb; line-height: 1; margin-bottom: 8px; }

/* ---------- Mobil və planşet ---------- */
@media (max-width: 1100px) {
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-main { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .main { margin-left: 0; }
  .only-mobile { display: inline-grid; }
  .content { padding: 16px 14px 40px; }
  .topbar { padding: 8px 12px; }
  .cols-2, .cols-3, .grid2, .grid3 { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: auto; }
  dl.facts { grid-template-columns: 1fr; gap: 0; }
  dl.facts dt { margin-top: 8px; }
  .hide-sm { display: none; }
  .cal .day { min-height: 70px; padding: 3px; }
  .cal .ev { font-size: 10.5px; padding: 1px 3px; }
  .chat { height: calc(100vh - 170px); }
  .card { padding: 14px; }
  .table-wrap { margin: 0 -14px; padding: 0 14px; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .k-value { font-size: 18px; }
  .cal .dow { font-size: 10px; padding: 4px; }
  .search { display: none; }
}
@media print {
  .sidebar, .topbar, .actions, .btn { display: none !important; }
  .main { margin: 0; }
}

/* ---------- Müştəri müraciətləri (Leads) ---------- */
.b-new { background: var(--info-soft); color: var(--info); }
.b-contacted { background: var(--primary-soft); color: var(--primary); }
.b-awaiting { background: var(--warn-soft); color: var(--warn); }
.b-sold { background: var(--ok-soft); color: var(--ok); }
.lead-kpi-sold .k-value { color: var(--ok); }
.lead-kpi-awaiting .k-value { color: var(--warn); }
.leads-table td.lead-text { min-width: 220px; max-width: 420px; }
.leads-table td.lead-note { min-width: 160px; max-width: 280px; color: var(--ink-2); }
a.plain { color: var(--ink); }
a.tel { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
a.tel.big { font-size: 17px; font-weight: 650; }
.dup-count { display: inline-block; min-width: 30px; text-align: center; padding: 1px 8px; border-radius: 20px; background: var(--warn-soft); color: var(--warn); font-weight: 650; }
.orig-text { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 15px; }
.phone-warn { color: var(--warn); font-weight: 550; }
.phone-ok { color: var(--ok); }
.dup-box .dup-title { margin-bottom: 6px; }
.dup-list { list-style: none; margin: 0; padding: 0; }
.dup-list li { padding: 7px 0; border-top: 1px dashed #f0d6a8; }
.dup-list .meta { font-size: 12.5px; color: #7a5a2a; margin-top: 2px; }
.hist-note { font-size: 12.5px; margin-top: 4px; padding-left: 8px; border-left: 2px solid var(--line); color: var(--ink-2); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 18px; border-left: 2px solid var(--line); margin-left: 5px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: #cfcdc6; }
.timeline li.tl-note::before { background: var(--primary); }
.timeline li.tl-status::before { background: var(--info); }
.timeline li.tl-assign::before { background: var(--accent); }
.timeline .tl-body { margin-top: 3px; white-space: normal; word-break: break-word; }
.timeline li.tl-note .tl-body { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; }

/* ---------- Müraciətlər: cədvəl kimi sürətli giriş ---------- */
.sheet-card { padding-top: 12px; }
.filters-box { margin-bottom: 10px; }
.filters-box > summary { cursor: pointer; color: var(--ink-2); font-weight: 560; display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; list-style: none; }
.filters-box > summary::-webkit-details-marker { display: none; }
.filters-box[open] > summary { margin-bottom: 10px; }
table.sheet td { vertical-align: middle; }
table.sheet thead tr.quick-row td { background: #eef7f2; border-bottom: 0; padding: 8px 6px; vertical-align: top; }
table.sheet thead tr.quick-msg-row td { background: #eef7f2; padding: 0 8px 8px; border-bottom: 2px solid #cfe5da; }
.quick-row input, .quick-row select, .quick-row textarea { padding: 7px 9px; font-size: 14px; background: #fff; }
.quick-row input[type=date] { min-width: 140px; }
.quick-row textarea { min-height: 38px; height: 38px; resize: none; min-width: 260px; line-height: 1.4; overflow: hidden; }
.quick-row [data-q-phone] { min-width: 140px; font-variant-numeric: tabular-nums; }
.quick-row select { min-width: 150px; }
.quick-row .btn { white-space: nowrap; }
.dup-flag { display: inline-block; position: relative; padding: 3px 10px; border-radius: 20px; font-size: 12.5px; font-weight: 650; white-space: nowrap; cursor: default; }
.dup-flag.ok { background: var(--ok-soft); color: var(--ok); }
.dup-flag.bad { background: var(--danger-soft); color: var(--danger); cursor: help; }
.dup-flag.warn { background: var(--warn-soft); color: var(--warn); }
.dup-mgrs { color: var(--danger); margin-top: 3px; max-width: 200px; white-space: normal; }
.dup-pop { display: none; position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; min-width: 240px; max-width: 320px; white-space: normal; background: #1b1d22; color: #fff; font-weight: 450; font-size: 12.5px; line-height: 1.45; padding: 9px 11px; border-radius: 9px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.dup-pop a { color: #9fe0c6; }
.dup-pop .pop-line { display: block; margin-top: 3px; }
.dup-flag:hover .dup-pop, .dup-flag:focus .dup-pop, .dup-flag:focus-within .dup-pop { display: block; }
.link-btn { display: block; border: 0; background: none; padding: 3px 0 0; color: var(--primary); font: inherit; font-size: 12.5px; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.notes-cell { min-width: 220px; max-width: 340px; }
.cell-note { font-size: 13px; margin-bottom: 5px; padding: 4px 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px; }
.cell-note span { display: block; word-break: break-word; }
.cell-note small { color: var(--muted); font-size: 11.5px; }
.note-inline { display: flex; gap: 4px; }
.note-inline input { padding: 5px 8px; font-size: 13px; }
.note-inline .btn { padding: 4px 8px; }
.notes-cell.saved { box-shadow: inset 0 0 0 2px var(--ok-soft); }
select.inline-status { padding: 4px 8px; font-size: 12.5px; border-radius: 20px; width: auto; font-weight: 600; }
select.inline-status.s-new { background: var(--info-soft); color: var(--info); border-color: #cfe0f8; }
select.inline-status.s-contacted { background: var(--primary-soft); color: var(--primary); border-color: #c5e3d6; }
select.inline-status.s-awaiting { background: var(--warn-soft); color: var(--warn); border-color: #f3d9ad; }
select.inline-status.s-sold { background: var(--ok-soft); color: var(--ok); border-color: #c5e3cc; }
select.inline-status.s-rejected { background: var(--danger-soft); color: var(--danger); border-color: #f2c4c4; }
select.inline-status.saved { outline: 2px solid var(--ok); }
tr.row-new td { animation: rowflash 2.2s ease-out; }
@keyframes rowflash { from { background: #d9f2e4; } to { background: transparent; } }
.leads-table.sheet td.lead-text { min-width: 190px; max-width: 320px; }
.quick-row textarea { min-width: 190px; }
.notes-cell { min-width: 180px; }
.quick-row .quick-btn-cell { text-align: right; }

/* ---------- Yığılan sol menyu (nazik zolaq) ---------- */
.sidebar, .main { transition: width .18s ease, margin-left .18s ease; }
.side-toggle { display: flex; align-items: center; gap: 10px; margin: 6px 10px 2px; padding: 9px 10px; border-radius: 8px; background: transparent; border: 1px solid #2c3038; color: var(--side-ink); cursor: pointer; font: inherit; font-size: 13px; }
.side-toggle:hover { background: var(--side-hover); color: #fff; }
.side-toggle .ic { transition: transform .18s ease; }
@media (min-width: 861px) {
  html.side-collapsed .sidebar { width: 64px; }
  html.side-collapsed .main { margin-left: 64px; }
  html.side-collapsed .brand { padding: 18px 15px 14px; }
  html.side-collapsed .brand-name, html.side-collapsed .nav a span, html.side-collapsed .sidebar-foot, html.side-collapsed .side-toggle span, html.side-collapsed .nav .count { display: none; }
  html.side-collapsed .nav { padding: 6px 8px; }
  html.side-collapsed .nav a { justify-content: center; padding: 10px 0; }
  html.side-collapsed .side-toggle { justify-content: center; margin: 6px 8px 2px; padding: 9px 0; }
  html.side-collapsed .side-toggle .ic { transform: rotate(180deg); }
  html.side-collapsed .content { max-width: none; }
}
@media (max-width: 860px) { .side-toggle { display: none; } }

/* ---------- Müraciətlər: şirkət seçimi ---------- */
.company-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.company-card { display: flex; flex-direction: column; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--cc); border-radius: var(--radius); padding: 18px; color: var(--ink); box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s; }
.company-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(20, 20, 30, .08); }
.cc-head { display: flex; gap: 12px; align-items: center; }
.cc-logo, .cb-logo { width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--cc); color: #fff; display: grid; place-items: center; font-weight: 700; letter-spacing: .02em; }
.cc-name { font-weight: 650; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; background: var(--surface-2); border-radius: 10px; padding: 10px 8px; text-align: center; }
.cc-stats b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.cc-stats span { font-size: 11.5px; color: var(--muted); }
.cc-go { color: var(--cc); font-weight: 600; font-size: 13.5px; }

/* ---------- Müraciətlər: seçilmiş şirkətin başlığı ---------- */
.company-banner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--cc); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.company-banner h1 { margin: 1px 0 2px; color: var(--cc); }
.cb-label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.company-banner .actions { margin-left: auto; }

/* ---------- Müraciətlər cədvəli: daha səliqəli görünüş ---------- */
.leads-page .sheet-card { border-top: 4px solid var(--cc); padding: 14px 18px 16px; }
.leads-table.sheet { font-size: 14px; border-collapse: separate; border-spacing: 0; }
.leads-table.sheet thead th { background: #f6f5f1; color: #6b6f78; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.leads-table.sheet thead th:first-child { border-top-left-radius: 8px; }
.leads-table.sheet thead th:last-child { border-top-right-radius: 8px; }
.leads-table.sheet tbody td { padding: 12px; line-height: 1.5; border-bottom: 1px solid #efede7; vertical-align: middle; }
.leads-table.sheet tbody tr:nth-child(even) td { background: #faf9f5; }
.leads-table.sheet tbody tr:hover td { background: #f1f6f3; }
.leads-table.sheet tbody td:first-child { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.leads-table.sheet tbody td:nth-child(2) a { font-weight: 600; font-variant-numeric: tabular-nums; }
.leads-table.sheet td.lead-text a.plain { color: var(--ink); font-weight: 500; }
.leads-table.sheet td.lead-text a.plain:hover { color: var(--primary); text-decoration: none; }
.leads-table.sheet a.tel { color: var(--ink); font-weight: 550; }
.leads-table.sheet a.tel .ic { color: var(--primary); }
table.sheet thead tr.quick-row td { background: #eef7f2; background: color-mix(in srgb, var(--cc) 7%, #fff); padding: 10px 8px; border-bottom: 0; }
table.sheet thead tr.quick-msg-row td { background: #eef7f2; background: color-mix(in srgb, var(--cc) 7%, #fff); border-bottom: 2px solid color-mix(in srgb, var(--cc) 25%, #fff); }
.quick-row input, .quick-row select, .quick-row textarea { border-color: color-mix(in srgb, var(--cc) 25%, #d8d6cf); }
.quick-row input:focus, .quick-row select:focus, .quick-row textarea:focus { border-color: var(--cc); outline-color: color-mix(in srgb, var(--cc) 30%, transparent); }
.leads-page .btn-primary { background: var(--cc); border-color: var(--cc); }
.leads-page .btn-primary:hover { filter: brightness(.92); background: var(--cc); }
.leads-page .kpis { margin-top: 16px; }
.cell-note { background: #fff; }
.leads-table.sheet tbody tr:nth-child(even) .cell-note { background: #fff; }
.leads-table.sheet td.lead-text, .cell-note span { overflow-wrap: anywhere; word-break: break-word; }

/* ---------- Avtomatik idxal (Google Sheet / Meta) ---------- */
.src-pill { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .03em; padding: 1px 7px; border-radius: 6px; vertical-align: middle; text-transform: uppercase; }
.src-pill.src-gsheet { background: #e6f4ea; color: #1e7e34; }
.src-pill.src-meta { background: #e8f0fe; color: #1a57c9; }
.src-card h2 { display: flex; align-items: center; gap: 8px; }
.step { display: flex; align-items: center; gap: 8px; font-weight: 650; margin: 10px 0 8px; color: var(--ink); }
.step-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--cc, var(--primary)); color: #fff; font-size: 12px; }
.map-table td, .map-table th { padding: 7px 10px; }
.map-table input[type=checkbox], .map-table input[type=radio] { width: 17px; height: 17px; }
.rules ol { margin: 0; padding-left: 20px; line-height: 1.7; }
.rules li { margin-bottom: 4px; }
details.payload { margin-top: 12px; }
details.payload summary { cursor: pointer; color: var(--primary); font-size: 13.5px; }
details.payload dl { margin-top: 8px; }
select.inline-assign { padding: 4px 8px; font-size: 13px; width: auto; max-width: 170px; }
select.inline-assign.empty { border-color: #f3d9ad; background: var(--warn-soft); color: var(--warn); font-weight: 600; }
select.inline-assign.saved { outline: 2px solid var(--ok); }

/* ---------- WhatsApp inteqrasiyası ---------- */
.wa-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #25a244; color: #fff; font-size: 11.5px; font-weight: 700; vertical-align: middle; }
.wa-unread-num { color: #1d8a3a; }
.nav .wa-badge { margin-left: auto; }
.wa-banner { margin-bottom: 12px; }
.wa-shell { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100vh - 210px); min-height: 520px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.wa-side { display: flex; flex-direction: column; border-right: 1px solid var(--line); min-height: 0; background: var(--surface-2); }
.wa-filter { padding: 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.wa-filter input[type=search] { width: 100%; }
.wa-filter-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.wa-filter-row select { flex: 1; min-width: 0; padding: 4px 8px; font-size: 13px; }
.wa-list { overflow-y: auto; flex: 1; }
.wa-item { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); color: inherit; }
.wa-item:hover { background: #f1f0eb; text-decoration: none; }
.wa-item.active { background: var(--primary-soft); }
.wa-item.unread .wa-name, .wa-item.unread .wa-prev { font-weight: 650; color: var(--ink); }
.wa-ava { flex: none; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #dfe9e4; color: #24584a; font-weight: 700; font-size: 13px; }
.wa-ava.lg { width: 44px; height: 44px; }
.wa-item-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.wa-item-top, .wa-item-mid { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.wa-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-time { color: var(--muted); font-size: 11.5px; flex: none; }
.wa-prev { color: var(--ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-item-meta { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-ad { color: #1a57c9; font-weight: 600; }
.wa-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.wa-placeholder { margin: auto; text-align: center; padding: 40px; }
.wa-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.wa-head-main { min-width: 0; flex: 1; }
.wa-head-name { font-weight: 650; font-size: 15.5px; }
.wa-head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wa-head-actions label { display: flex; align-items: center; gap: 6px; margin: 0; }
.wa-info { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 14px; border-bottom: 1px solid var(--line); font-size: 13px; background: var(--surface-2); }
.wa-attr summary { cursor: pointer; color: #1a57c9; }
.wa-attr dl { margin: 6px 0 0; }
.wa-thread { flex: 1; overflow-y: auto; padding: 14px 18px; background: #efeae2; display: flex; flex-direction: column; gap: 6px; }
.wa-day { text-align: center; margin: 8px 0; }
.wa-day span { background: #e1f2fb; color: #3b5361; font-size: 11.5px; padding: 3px 10px; border-radius: 8px; }
.wa-msg { display: flex; }
.wa-msg.out { justify-content: flex-end; }
.wa-bubble { max-width: min(560px, 78%); background: #fff; border-radius: 10px; padding: 6px 9px 4px; box-shadow: 0 1px .5px rgba(0, 0, 0, .13); overflow-wrap: anywhere; }
.wa-msg.out .wa-bubble { background: #d9fdd3; }
.wa-msg.out.o-app .wa-bubble { background: #e7f6e4; }
.wa-msg.o-history .wa-bubble { opacity: .93; }
.wa-text { white-space: normal; font-size: 14px; line-height: 1.42; }
.wa-text mark { background: #ffe58f; padding: 0 1px; }
.wa-tpl { font-size: 10.5px; font-weight: 700; text-transform: uppercase; color: #1a57c9; background: #e8f0fe; border-radius: 5px; padding: 0 5px; }
.wa-meta { display: flex; gap: 6px; justify-content: flex-end; align-items: center; font-size: 11px; color: #667781; margin-top: 2px; }
.wa-origin { font-style: italic; }
.wa-tick { letter-spacing: -3px; padding-right: 3px; }
.wa-tick.read { color: #34b7f1; }
.wa-tick.fail { color: var(--danger); font-weight: 800; letter-spacing: 0; }
.wa-err { color: var(--danger); font-size: 12px; margin-top: 3px; }
.wa-ref { font-size: 12px; background: #f0f4ff; border-left: 3px solid #1a57c9; padding: 3px 7px; border-radius: 4px; margin-bottom: 4px; }
.wa-img { display: block; max-width: 300px; max-height: 320px; border-radius: 7px; margin-bottom: 3px; }
.wa-file { display: inline-flex; gap: 6px; align-items: center; background: rgba(0, 0, 0, .04); padding: 6px 10px; border-radius: 7px; margin-bottom: 3px; }
.wa-compose { border-top: 1px solid var(--line); padding: 8px 12px 10px; background: var(--surface); }
.wa-window { font-size: 12.5px; margin-bottom: 6px; }
.wa-window.ok { color: var(--ok); }
.wa-window.closed { color: var(--warn); }
.wa-compose-row { display: flex; gap: 6px; align-items: flex-end; }
.wa-compose-row textarea { flex: 1; resize: none; min-height: 40px; max-height: 160px; }
.wa-attach { cursor: pointer; font-size: 16px; }
.wa-file-chip { font-size: 12.5px; margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.wa-tpl-box { margin-top: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.wa-tpl-vars { display: flex; flex-wrap: wrap; gap: 8px; }
.wa-tpl-prev { white-space: pre-wrap; background: #d9fdd3; border-radius: 8px; padding: 8px 10px; font-size: 13.5px; }
.wa-tpl-prev:empty { display: none; }
.wa-manual summary { cursor: pointer; }
@media (max-width: 900px) {
  .wa-shell { grid-template-columns: 1fr; height: auto; }
  .wa-side { max-height: 300px; border-right: 0; border-bottom: 1px solid var(--line); }
  .wa-thread { min-height: 420px; }
  .wa-bubble { max-width: 92%; }
}
.src-pill.src-whatsapp { background: #dcf8e3; color: #137333; }
