/* Xo‘ja Qo‘rg‘on CRM — kompaniya logosi ranglari: to‘q yashil #008848, och yashil #60c088 */
:root {
  --bg-1: #0a3f26;
  --bg-2: #0d6b3d;
  --bg-3: #3f9f6c;
  --panel: #ffffff;
  --panel-2: #f4f6f7;
  --text: #2b3338;
  --text-2: #4f5b63;
  --muted: #828b95;
  --line: #e4e8eb;
  --accent: #008848;
  --accent-d: #006b38;
  --link: #007a40;
  --danger: #e5484d;
  --warn: #f5a623;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Open Sans", "Helvetica Neue", Arial, sans-serif; font-size: 13px; color: var(--text);
  background: linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 55%, var(--bg-3) 100%) fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 13px; color: var(--text); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
svg.i.sm { width: 14px; height: 14px; }
svg.i.lg { width: 28px; height: 28px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.sm { font-size: 12px; }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.tag { display: inline-block; background: var(--panel-2); border-radius: 6px; padding: 1px 8px; margin: 2px; color: var(--text-2); }

/* ================= Tugmalar, maydonlar ================= */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: 18px;
  border: 1px solid var(--line); background: #fff; color: var(--text-2); font-weight: 600; font-size: 13px; white-space: nowrap;
}
.btn:hover { border-color: #c9d0d5; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-d); border-color: var(--accent-d); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-ghost { border-color: transparent; color: var(--danger); background: transparent; }
.btn.danger-ghost:hover { background: #fdecec; }
.btn.sm { height: 30px; padding: 0 12px; }
.btn.block { width: 100%; justify-content: center; height: 42px; font-size: 14px; }
.icon-btn { border: 0; background: transparent; color: var(--muted); width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.select, .form input, .form select, .form textarea {
  height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: #fff; outline: none; width: 100%;
}
.form textarea { height: auto; padding: 8px 10px; resize: vertical; }
.select:focus, .form input:focus, .form select:focus, .form textarea:focus { border-color: var(--link); box-shadow: 0 0 0 3px rgba(0,136,72,.14); }
.select { width: auto; border-radius: 18px; padding: 0 12px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label, .lbl { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-2); font-weight: 600; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.form label.check input { width: auto; height: auto; }
.form h4 { margin: 8px 0 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 16px;
  border: 1px solid var(--line); background: #fff; color: var(--text-2); font-size: 12px; white-space: nowrap;
}
.chip b { font-weight: 700; }
.chip:hover { border-color: #c9d0d5; }
.chip.on { background: var(--bg-2); border-color: var(--bg-2); color: #fff; }
.chip.warn:not(.on) b { color: #fff; background: var(--danger); border-radius: 10px; padding: 0 6px; }

/* ================= Kirish ================= */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; background: #fff; border-radius: 16px; padding: 28px; box-shadow: 0 20px 50px rgba(0,0,0,.25); display: flex; flex-direction: column; gap: 14px; }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.login-card input { height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; font-size: 14px; outline: none; }
.login-card input:focus { border-color: var(--link); }
.login-card p { margin: -8px 0 6px; }
.login-logo { display: block; width: 230px; max-width: 80%; margin: 4px auto 2px; }
.login-card .sub { text-align: center; margin: 0 0 8px; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; font-size: 11px; font-weight: 600; }

/* ================= Karkas: oq sarlavha, logo ================= */
.top { height: 62px; display: flex; align-items: center; gap: 18px; padding: 0 20px; color: var(--text); position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.97); box-shadow: 0 1px 0 rgba(0,0,0,.06), 0 4px 18px rgba(0,0,0,.12); }
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; text-decoration: none; }
.brand img { height: 40px; width: auto; display: block; }
.wordmark { font-family: "Marcellus", "Optima", "Candara", serif; font-size: 19px; letter-spacing: .06em; color: #1b1b1b; line-height: 1; }
.wordmark small { display: block; font-family: "Open Sans", sans-serif; font-size: 9.5px; letter-spacing: .28em; color: var(--accent); font-weight: 700; margin-top: 4px; }
.tabs { display: flex; gap: 4px; }
.tabs a { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 18px; color: var(--text-2); font-size: 14px; }
.tabs a:hover { background: #eef6f1; text-decoration: none; }
.tabs a.active { background: var(--accent); color: #fff; font-weight: 600; }
.me { margin-left: auto; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 10px 4px 4px; border-radius: 20px; color: var(--text-2); }
.me:hover { background: #eef6f1; }
.ava { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 12px; flex: none; vertical-align: middle; }
.ava.sm { width: 24px; height: 24px; font-size: 10px; }
.ava.none { background: #c9d0d5; }
main { padding: 0 20px 16px; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 0; color: #fff; }
.toolbar h2 { margin: 0; font-size: 20px; }
.search { position: relative; flex: 0 1 320px; min-width: 200px; }
.search input { width: 100%; height: 36px; border: 0; border-radius: 18px; padding: 0 14px 0 36px; background: rgba(255,255,255,.95); outline: none; }
.search svg { position: absolute; left: 13px; top: 11px; color: var(--muted); }
.seg { display: inline-flex; background: rgba(255,255,255,.15); border-radius: 18px; padding: 3px; }
.seg button { border: 0; background: transparent; color: #fff; width: 34px; height: 30px; border-radius: 15px; }
.seg button.on { background: #fff; color: var(--bg-2); }
.panel { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* ================= Kanban (tilgo-crm uslubi) ================= */
.kwrap { position: relative; }
.kanban { display: flex; gap: 0; overflow-x: auto; padding: 2px 0 14px; align-items: flex-start; min-height: calc(100vh - 150px); scrollbar-width: thin; }
.kcol { width: 280px; flex: none; display: flex; flex-direction: column; padding: 0 7px; border-right: 1px dashed rgba(255,255,255,.25); transition: opacity .15s; position: relative; z-index: 1; }
.kcol:first-child { padding-left: 0; }
.kcol:last-child { border-right: 0; }
.kcol:hover, .kcol:focus-within { z-index: 5; }
.kcol.col-dragging { opacity: .45; }
.khead { position: relative; height: 34px; margin-bottom: 8px; }
.khead[draggable="true"] { cursor: grab; }
.khead[draggable="true"]:active { cursor: grabbing; }
.khead .bar {
  position: relative; height: 34px; padding: 0 30px 0 12px; border-radius: 6px 0 0 6px; color: #fff; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,0) 60%), var(--c);
  clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 50%, calc(100% - 11px) 100%, 0 100%);
  text-shadow: 0 1px 1px rgba(0,0,0,.12);
}
.khead .bar .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.khead .bar .n { font-weight: 400; opacity: .85; font-size: 12px; flex: none; }
.khead .hb-edit { position: absolute; right: 16px; top: 8px; border: 0; background: none; color: #fff; padding: 2px; opacity: 0; transition: opacity .15s; display: inline-flex; }
.khead .hb-add {
  position: absolute; right: -10px; top: 6px; width: 22px; height: 22px; border-radius: 50%; border: 0; z-index: 3; padding: 0;
  background: #fff; color: var(--text-2); box-shadow: 0 1px 4px rgba(0,0,0,.25); display: inline-flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(.7); transition: opacity .15s, transform .15s;
}
.khead:hover .hb-edit, .khead:hover .hb-add { opacity: 1; transform: none; }
.khead .hb-add:hover { background: var(--accent); color: #fff; }
.khead .hb-edit:hover { filter: drop-shadow(0 0 2px rgba(0,0,0,.3)); }
.kquickbtn {
  width: 100%; height: 30px; border: 0; border-radius: 6px; margin-bottom: 8px; background: rgba(255,255,255,.16); color: #fff;
  font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s;
}
.kquickbtn:hover { background: rgba(255,255,255,.28); }
.kquick-gap { height: 38px; }
.kbody { min-height: 120px; border-radius: 6px; padding-bottom: 40px; transition: background .15s; }
.kbody.over { background: rgba(255,255,255,.12); outline: 2px dashed rgba(255,255,255,.45); outline-offset: -2px; }
.col-empty { color: rgba(255,255,255,.65); text-align: center; padding: 14px 0; font-size: 12px; }
.kquick { background: #fff; border-radius: 8px; padding: 12px; margin-bottom: 8px; display: grid; gap: 8px; box-shadow: var(--shadow); animation: fade .15s; }
.kquick input { border: 1px solid #c6cdd3; border-radius: 6px; padding: 7px 9px; outline: none; width: 100%; }
.kquick input:focus { border-color: var(--accent); }

.kcard { background: #fff; border-radius: 8px; padding: 11px 32px 9px 12px; margin-bottom: 8px; cursor: pointer; position: relative; box-shadow: 0 1px 2px rgba(0,0,0,.1); transition: box-shadow .15s, transform .15s; }
.kcard:hover { box-shadow: 0 6px 18px rgba(0,0,0,.18); transform: translateY(-1px); }
.kcard.dragging { opacity: .4; }
.kcard .t { font-size: 13.5px; color: var(--link); font-weight: 600; display: block; word-break: break-word; margin-bottom: 4px; cursor: pointer; }
.kcard .t:hover { text-decoration: underline; }
.kid { color: var(--muted); font-weight: 400; font-size: 12px; }
.kcard .ln { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12px; margin: 3px 0; min-width: 0; }
.kcard .ln span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcard .ln b { color: var(--text); font-weight: 400; }
.badge { display: inline-block; background: #eef4f6; color: var(--link); border-radius: 4px; padding: 1px 7px; font-size: 11px; font-weight: 600; }
.kcard .kquickc { position: absolute; right: 9px; top: 32px; display: flex; flex-direction: column; gap: 6px; }
.kcard .kquickc a, .kcard .kquickc span { color: var(--accent); display: inline-flex; }
.kcard .kquickc a:hover { color: var(--accent-d); }
.kcard .kquickc .off { color: #d5dbe0; }
.kcard .kfoot { display: flex; align-items: center; gap: 8px; margin: 10px -22px 0 0; padding-top: 9px; border-top: 1px solid #f0f2f4; }
.kcard .kact { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.kcard .kact:hover { color: var(--link); }
.kcard .kact .due { font-size: 11.5px; }
.kcard .kupd { margin-left: auto; font-size: 11.5px; color: #a8adb4; white-space: nowrap; }
.kcard .kchk { position: absolute; right: 7px; top: 7px; width: 22px; height: 22px; display: none; align-items: center; justify-content: center; z-index: 2; cursor: pointer; background: #fff; border-radius: 4px; }
.kcard .kchk input { width: 16px; height: 16px; margin: 0; cursor: pointer; accent-color: var(--accent); }
.kcard:hover .kchk, .kcard.sel .kchk { display: inline-flex; }
.kcard.sel { background: #eaf6ef; box-shadow: 0 0 0 2px var(--accent), 0 2px 8px rgba(0,136,72,.22); }
.kcard.sel .kfoot { border-top-color: #c6e6d2; }

.due { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); background: var(--panel-2); border-radius: 10px; padding: 1px 8px; white-space: nowrap; }
.due.today { background: #fff4dd; color: #a46200; }
.due.over { background: #fdecec; color: var(--danger); font-weight: 600; }

/* Ekranga moslangan doska (main.js → fitBoards): sahifa emas, har bir ustun o'zi suriladi */
.kanban.fit { overflow-x: auto; overflow-y: hidden; align-items: stretch; min-height: 0; padding-bottom: 0; }
.kanban.fit .kcol { height: 100%; min-height: 0; }
.kanban.fit .khead, .kanban.fit .knew, .kanban.fit .kquickbtn, .kanban.fit .kquick-gap { flex: none; }
.kanban.fit .kcol:hover, .kanban.fit .kcol:focus-within { z-index: 7; }
.kanban.fit .kbody { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: contain; padding-bottom: 24px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.45) transparent; }
.kanban.fit .kbody::-webkit-scrollbar { width: 6px; }
.kanban.fit .kbody::-webkit-scrollbar-thumb { background: rgba(255,255,255,.45); border-radius: 3px; }
.tablewrap.fit { overflow: auto; overscroll-behavior: contain; }
.tablewrap.fit thead th { position: sticky; top: 0; z-index: 3; }

/* Cheksiz scroll: ustun / jadval oxiridagi qator */
.more-row { text-align: center; font-size: 12px; padding: 12px 8px; color: rgba(255,255,255,.75); }
.panel .more-row { color: var(--muted); border-top: 1px solid var(--line); }
.more-row.done { color: var(--muted); }

/* Ustun tahriri */
.hedit { background: #fff; border-radius: 8px; padding: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.22); position: relative; z-index: 20; }
.hedit .inp { width: 100%; height: 32px; border: 1px solid var(--line); border-radius: 6px; padding: 0 9px; margin-bottom: 8px; outline: none; }
.hedit .inp:focus { border-color: var(--link); }
.hcolors { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.hcolors i { width: 18px; height: 18px; border-radius: 50%; cursor: pointer; border: 2px solid #fff; box-shadow: 0 0 0 1px #dfe3e7; }
.hcolors i.on { box-shadow: 0 0 0 2px var(--text); }
.hbtns { display: flex; gap: 6px; align-items: center; }
.hbtns .icon-btn { margin-left: auto; }
.knew { animation: fade .2s; }
.knew .khead { height: auto; }
@keyframes fade { from { opacity: 0; } }

/* Chet strelkalari */
.kscroll { position: absolute; top: 40vh; width: 46px; height: 92px; border: 0; background: rgba(255,255,255,.28); color: #fff; z-index: 20; display: flex; align-items: center; justify-content: center; transition: background .15s, opacity .2s; }
.kscroll:hover { background: rgba(255,255,255,.5); }
.kscroll.l { left: 0; border-radius: 0 92px 92px 0; padding-right: 8px; }
.kscroll.r { right: 0; border-radius: 92px 0 0 92px; padding-left: 8px; }
.kscroll.off { opacity: 0; pointer-events: none; }
@media (hover: none) { .kscroll { display: none; } }

/* Sudrashda pastdan chiqadigan panel */
.kdropbar { position: fixed; bottom: 0; z-index: 500; display: flex; height: 64px; transform: translateY(100%); transition: transform .18s ease-out; box-shadow: 0 -6px 24px rgba(0,0,0,.25); }
.kdropbar.on { transform: none; }
.kdz { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; color: #fff; font-size: 15px; font-weight: 600; background: var(--c, #a8adb4); opacity: .88; transition: opacity .12s, filter .12s; padding: 0 10px; white-space: nowrap; }
.kdz.del { background: #a8adb4; flex: 0 0 auto; padding: 0 28px; }
.kdz.over { opacity: 1; filter: brightness(1.12); box-shadow: inset 0 0 0 3px rgba(255,255,255,.7); }
.kdz .i { pointer-events: none; }

/* «Tanlangan: N» paneli va kichik menyu */
.kmass { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 2px; background: #fff; border-radius: 12px; padding: 8px 14px; margin-bottom: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.08); min-height: 52px; }
.kmass .kmass-n { display: inline-flex; align-items: center; gap: 6px; padding-right: 12px; margin-right: 6px; border-right: 1px solid var(--line); font-size: 14px; color: var(--text-2); }
.kmass .kmass-x { border: 0; background: none; color: #a8adb4; display: inline-flex; padding: 2px; }
.kmass .kmass-x:hover { color: var(--text); }
.kmass button[data-mk]:not(.kmass-x) { border: 0; background: none; display: inline-flex; align-items: center; gap: 5px; padding: 8px 10px; border-radius: 6px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .2px; color: var(--text-2); white-space: nowrap; }
.kmass button[data-mk]:not(.kmass-x):hover { background: var(--panel-2); color: var(--text); }
.kmass .kmass-all { margin-left: auto; font-size: 12.5px; }
.kmass .kmass-all a { cursor: pointer; }
.popmenu { position: fixed; z-index: 600; background: #fff; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.2); padding: 6px; min-width: 200px; max-height: 60vh; overflow-y: auto; animation: fade .12s; }
.popmenu a { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 6px; color: var(--text); cursor: pointer; }
.popmenu a:hover { background: var(--panel-2); text-decoration: none; }

/* ================= Ro'yxat ================= */
.status-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.leads-tbl tbody tr.sel { background: #eaf6ef; }
.leads-tbl a.tel { color: var(--link); }
.addrow td { padding: 6px 12px; background: #fcfdfd; }
.linkbtn { border: 0; background: none; color: var(--link); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; }
.linkbtn:hover { color: var(--accent-d); }
.qrow td { background: #f1f9f4; }
.qform { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.qform input, .qform select { height: 32px; border: 1px solid #c6cdd3; border-radius: 6px; padding: 0 9px; outline: none; flex: 1 1 140px; min-width: 0; background: #fff; }
.qform input:focus, .qform select:focus { border-color: var(--accent); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:hover { background: #f8fafb; }
.leads-tbl tbody tr { cursor: pointer; }
.tbl .num { text-align: right; }
.tbl tr.off { opacity: .55; }
.w-chk { width: 36px; }
.c-int, .c-com { max-width: 260px; }
.c-name { white-space: nowrap; }
.panel:has(> .tbl) { overflow-x: auto; }
.c-com { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--c); background: color-mix(in srgb, var(--c) 14%, #fff); }
.users-tbl th.num { white-space: normal; min-width: 70px; }
.c-perms { max-width: 300px; }
.c-perms .tag { margin: 1px 2px 1px 0; font-size: 11px; }
.tag.admin { background: #e3f3e9; color: #006b38; font-weight: 600; }

/* Xodim oynasi: chapda ma'lumotlar, o'ngda ruxsatlar */
.user-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 24px; align-items: start; }
.perms-box { background: var(--panel-2); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.perms-h { display: flex; flex-direction: column; gap: 2px; }
.perms-h b { font-size: 14px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.presets .chip { height: 28px; }
.perm-list { display: flex; flex-direction: column; gap: 6px; }
.perm-list.disabled { opacity: .45; pointer-events: none; }
.perm { display: flex; gap: 10px; align-items: flex-start; background: #fff; border-radius: 8px; padding: 9px 12px; cursor: pointer; border: 1px solid transparent; }
.perm:hover { border-color: var(--line); }
.perm input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); flex: none; cursor: pointer; }
.perm span { display: flex; flex-direction: column; gap: 2px; }
.perm b { font-size: 13px; font-weight: 600; }
.perm small { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.perm.fixed { cursor: default; opacity: .75; }
.perm.admin-perm { border-color: #c6e6d2; background: #f3faf6; }

/* ================= Modal ================= */
body.modal-open { overflow: hidden; }
.modal-bg { position: fixed; inset: 0; background: rgba(6,32,19,.55); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 100; overflow-y: auto; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 520px; box-shadow: 0 30px 70px rgba(0,0,0,.3); display: flex; flex-direction: column; }
.modal.wide { max-width: 940px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-h h3 { margin: 0; font-size: 17px; }
.modal-b { padding: 18px 20px; }
.modal-b p { margin-top: 0; }
.modal-f { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); background: #fafbfc; border-radius: 0 0 16px 16px; }

.lead-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; }
.call-btn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 48px; border-radius: 12px; background: var(--accent); color: #fff; font-size: 17px; font-weight: 700; margin-bottom: 16px; }
.call-btn:hover { background: var(--accent-d); }
.results { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.res { height: 38px; border-radius: 8px; border: 1.5px solid var(--line); background: #fff; color: var(--text-2); font-weight: 600; font-size: 12px; }
.res:hover { border-color: var(--c); }
.res.on { background: var(--c); border-color: var(--c); color: #fff; }
.next-call { background: var(--panel-2); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.quick .chip { height: 28px; }
.history { border-left: 1px solid var(--line); padding-left: 20px; max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.ev { display: flex; gap: 10px; }
.ev-i { width: 26px; height: 26px; border-radius: 50%; background: var(--panel-2); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ev-comment .ev-i { background: #fff4dd; color: #a46200; }
.ev-status .ev-i { background: #e6f2f5; color: var(--link); }
.ev-t { white-space: pre-wrap; word-break: break-word; }

/* ================= Toast ================= */
#toast { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
#toast div { background: #1d3328; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 360px; animation: tin .2s; }
#toast div.e { background: var(--danger); }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }

/* ================= Telefon ================= */
@media (max-width: 760px) {
  .top { padding: 0 12px; gap: 8px; }
  .wordmark small, .me-name, .tabs a span { display: none; }
  .wordmark { font-size: 15px; }
  .brand img { height: 34px; }
  main { padding: 0 12px 10px; }
  .search { flex: 1 1 100%; }
  .toolbar .grow { display: none; }
  .row2, .lead-grid, .user-grid { grid-template-columns: 1fr; }
  .results { grid-template-columns: repeat(2, 1fr); }
  .history { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 14px; max-height: none; }
  .modal-bg { padding: 0; }
  .modal { border-radius: 0; min-height: 100%; }
  .modal-f { border-radius: 0; position: sticky; bottom: 0; }
  .kcol { width: 82vw; }
  .kmass .kmass-all { margin-left: 0; }
  /* Ro'yxat jadvali telefonda kartochkalarga aylanadi */
  .leads-tbl thead { display: none; }
  .leads-tbl, .leads-tbl tbody, .leads-tbl tr, .leads-tbl td { display: block; }
  .leads-tbl tr { position: relative; padding: 10px 14px 10px 14px; border-bottom: 1px solid var(--line); }
  .leads-tbl td { border: 0; padding: 2px 0; }
  .leads-tbl td.w-chk { position: absolute; right: 10px; top: 10px; width: auto; }
  .leads-tbl td:empty { display: none; }
  .c-int, .c-com { max-width: none; }
  .leads-tbl td:has(> .muted:only-child) { display: none; }
  .status-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .users-tbl { display: block; overflow-x: auto; }
}
