:root {
  --bg: #ffffff;
  --panel: #fafbfc;
  --soft: #f4f5f7;
  --soft-2: #eceef2;
  --line: #eceef2;
  --text: #15171a;
  --muted: #858b96;
  --muted-2: #a9aeb7;
  --primary: #3460f5;
  --primary-hover: #2a52de;
  --primary-soft: #eaf0ff;
  --green: #22a55b;
  --green-soft: #e3f6ea;
  --red: #e5484d;
  --red-soft: #fdecec;
  --amber: #c27b0a;
  --amber-soft: #fff4dd;
  --violet-soft: #f1efff;
  --peach-soft: #fdf1ea;
  --sky-soft: #e9f3fd;
  --lime-soft: #f1f8e2;
  --pink-soft: #fdeef6;
  --bubble-in: #efeff2;
  --bubble-out: #7b5cf5;
  --radius: 16px;
  --rail: 64px;
  --side: 232px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .14);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111214; --panel: #16171a; --soft: #1d1f23; --soft-2: #26282d; --line: #26282d;
    --text: #eceef1; --muted: #8d939e; --muted-2: #676c75;
    --primary: #5b7fff; --primary-hover: #6d8dff; --primary-soft: #1f2a4d;
    --green-soft: #12301f; --red-soft: #3a1717; --amber-soft: #36290c;
    --violet-soft: #221f38; --peach-soft: #2d221c; --sky-soft: #172636; --lime-soft: #1f2a14; --pink-soft: #2e1a25;
    --bubble-in: #26282d; --shadow: none; --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1 { font-size: 24px; font-weight: 800; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 18px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
h3 { font-size: 16px; font-weight: 700; margin: 0; }
svg { width: 20px; height: 20px; flex-shrink: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; word-break: break-all; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }

/* ================= Layout ================= */
.app { display: flex; height: 100vh; height: 100dvh; }
.rail { width: var(--rail); flex-shrink: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 4px; background: var(--bg); z-index: 5; }
.rail .logo { width: 36px; height: 36px; border-radius: 11px; background: var(--primary); color: #fff; display: grid; place-items: center; margin-bottom: 14px; }
.rail a, .rail button.rail-btn { position: relative; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); border: 0; background: none; }
.rail a:hover, .rail button.rail-btn:hover { background: var(--soft); color: var(--text); }
.rail a.on { background: var(--primary-soft); color: var(--primary); }
.rail a .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.rail a::after { content: attr(data-tip); position: absolute; left: 52px; top: 50%; transform: translateY(-50%); background: var(--text); color: var(--bg); padding: 5px 9px; border-radius: 8px; font-size: 12px; font-weight: 600; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 50; }
.rail a:hover::after { opacity: 1; }
.rail .spacer { flex: 1; }

.side { width: var(--side); flex-shrink: 0; border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; overflow: auto; background: var(--bg); }
.side h1 { font-size: 22px; padding: 2px 6px 12px; }
.side .btn.primary { width: 100%; margin-bottom: 14px; }
.side .group-title { display: flex; align-items: center; justify-content: space-between; font-weight: 700; padding: 12px 8px 6px; }
.side .group-title button { border: 0; background: var(--soft-2); color: var(--muted); width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; padding: 0; }
.side .group-title button svg { width: 14px; height: 14px; }
.side a.item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; color: var(--text); font-weight: 500; }
.side a.item:hover { background: var(--soft); }
.side a.item.on { background: var(--soft); font-weight: 600; }
.side a.item .count { margin-left: auto; color: var(--muted); font-size: 12px; }

.main { flex: 1; min-width: 0; overflow: auto; position: relative; }
.page { padding: 22px 28px 48px; max-width: 1240px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; min-height: 40px; flex-wrap: wrap; }
.page-head h2 .count { color: var(--muted); font-weight: 600; }
.page-head .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.mobile-bar { display: none; }
.mobile-chips { display: none; }

@media (max-width: 900px) {
  .side { display: none; }
  .mobile-chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 12px; margin: -4px 0 8px; scrollbar-width: none; }
  .mobile-chips a, .mobile-chips button { flex-shrink: 0; padding: 7px 12px; border-radius: 99px; background: var(--soft); color: var(--text); font-weight: 600; font-size: 13px; border: 0; white-space: nowrap; }
  .mobile-chips .on { background: var(--text); color: var(--bg); }
  .mobile-chips .primary { background: var(--primary); color: #fff; }
}
@media (max-width: 720px) {
  .rail { display: none; }
  .page { padding: 16px 16px 96px; }
  .mobile-bar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--bg); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .mobile-bar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 600; color: var(--muted); position: relative; padding: 2px 0; }
  .mobile-bar a.on { color: var(--primary); }
  .mobile-bar svg { width: 22px; height: 22px; }
  .mobile-bar .dot { position: absolute; top: -2px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--red); color: #fff; font-size: 10px; display: grid; place-items: center; }
  h1 { font-size: 22px; }
}

/* ================= Buttons & inputs ================= */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-weight: 600; white-space: nowrap; transition: background .12s, border-color .12s, opacity .12s; color: var(--text); }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--soft); }
.btn.soft { background: var(--soft); border-color: transparent; }
.btn.soft:hover { background: var(--soft-2); }
.btn.danger { color: var(--red); }
.btn.danger-fill { background: var(--red); border-color: var(--red); color: #fff; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.lg { height: 46px; font-size: 15px; border-radius: 12px; }
.btn.icon { width: 38px; padding: 0; }
.btn.icon.sm { width: 32px; }
.btn svg { width: 18px; height: 18px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.full { width: 100%; }

input[type=text], input[type=url], input[type=password], input[type=search], input[type=number], input[type=tel], input[type=email], textarea, select.plain {
  width: 100%; height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg); outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; min-height: 96px; padding: 11px 13px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select.plain:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
::placeholder { color: var(--muted-2); }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.field > label, .label { font-weight: 600; font-size: 14px; }
.hint { font-size: 12.5px; color: var(--muted); }
.ta-wrap { position: relative; }
.ta-wrap textarea { padding-bottom: 26px; }
.counter { position: absolute; right: 12px; bottom: 8px; font-size: 11.5px; color: var(--muted-2); pointer-events: none; }

.select { position: relative; display: flex; align-items: center; height: 42px; border: 1px solid var(--line); border-radius: 11px; padding: 0 12px; gap: 8px; background: var(--bg); cursor: pointer; }
.select select { appearance: none; border: 0; background: transparent; outline: none; flex: 1; height: 100%; font-weight: 500; cursor: pointer; padding-right: 20px; min-width: 0; }
.select > svg { position: absolute; right: 12px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.select.disabled { background: var(--soft); cursor: default; }
.select-ava:empty { display: none; }

.toggle { position: relative; width: 44px; height: 26px; flex-shrink: 0; display: inline-block; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle span { position: absolute; inset: 0; background: var(--soft-2); border-radius: 99px; transition: .18s; cursor: pointer; }
.toggle span::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .18s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle input:checked + span { background: var(--green); }
.toggle input:checked + span::before { transform: translateX(18px); }

.option-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; margin-bottom: 8px; transition: border-color .12s, background .12s; }
.option-card:hover { background: var(--panel); }
.option-card.on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.option-card .grow { font-weight: 500; }
.option-card svg { color: var(--muted); }
.cbox { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--muted-2); display: grid; place-items: center; flex-shrink: 0; }
.on > .cbox, .cbox.on { background: var(--primary); border-color: var(--primary); }
.cbox svg { width: 14px; height: 14px; color: #fff; display: none; }
.on > .cbox svg, .cbox.on svg { display: block; }
.radio { display: flex; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; font-weight: 500; }
.radio i { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--muted-2); flex-shrink: 0; position: relative; }
.radio.on i { border: 5.5px solid var(--primary); }

.switch-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--soft); border-radius: 12px; margin-bottom: 12px; }
.switch-card .t { font-weight: 600; }
.switch-card .d { font-size: 12.5px; color: var(--muted); }

.tabs { display: inline-flex; background: var(--soft); border-radius: 11px; padding: 3px; gap: 2px; }
.tabs button { border: 0; background: transparent; height: 32px; padding: 0 14px; border-radius: 9px; font-weight: 600; color: var(--muted); font-size: 13px; white-space: nowrap; }
.tabs button.on { background: var(--bg); color: var(--text); box-shadow: var(--shadow); }
.linktabs { display: flex; gap: 16px; }
.linktabs button { border: 0; background: none; padding: 0; color: var(--muted); font-weight: 500; }
.linktabs button.on { color: var(--primary); }

.chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 99px; background: var(--soft); font-size: 12.5px; font-weight: 600; }
.chip.blue { background: var(--primary-soft); color: var(--primary); }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip button { border: 0; background: none; padding: 0; display: grid; place-items: center; color: inherit; opacity: .6; }
.chip button svg { width: 13px; height: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.ava { position: relative; display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; flex-shrink: 0; font-weight: 700; }
.ava img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ================= Cards ================= */
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; gap: 14px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

.create-card { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; min-height: 112px; transition: box-shadow .15s, transform .15s; }
.create-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.create-card .ic { display: flex; gap: 4px; margin-bottom: 4px; }
.create-card .ic span { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--soft); }
.create-card .ic svg { width: 15px; height: 15px; }
.create-card .t { font-weight: 700; font-size: 15px; }
.create-card .d { color: var(--muted); font-size: 13px; }
.create-card .go { position: absolute; top: 16px; right: 16px; color: var(--text); }
.create-card::before { content: ""; position: absolute; right: -30px; top: -10px; width: 140px; height: 140px; background: radial-gradient(circle at center, var(--primary-soft), transparent 70%); opacity: .7; pointer-events: none; }

.auto-card { padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line); cursor: pointer; transition: box-shadow .15s; display: flex; flex-direction: column; gap: 12px; background: var(--bg); }
.auto-card:hover { box-shadow: var(--shadow-lg); }
.auto-card .top { display: flex; align-items: center; gap: 8px; }
.auto-card .top .kind { color: var(--green); }
.auto-card .top .kind.flow { color: var(--primary); }
.auto-card .top .name { font-weight: 700; font-size: 15px; flex: 1; }
.auto-card .menu { border: 0; background: none; color: var(--muted); padding: 2px; border-radius: 6px; }
.auto-card .menu:hover { background: var(--soft); }
.auto-card .nums { display: flex; gap: 28px; }
.auto-card .nums .l { font-size: 12px; color: var(--muted); }
.auto-card .nums .v { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.auto-card .foot { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.auto-card.off { opacity: .6; }

.stat { padding: 16px; border-radius: 14px; background: var(--soft); }
.stat .l { color: var(--text); font-weight: 600; font-size: 14px; min-height: 40px; }
.stat .v { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }

.promo { display: grid; grid-template-columns: 1.1fr 1fr; gap: 14px; }
.promo .big, .promo .sm { border-radius: 20px; padding: 22px; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; min-height: 150px; }
.promo .big { grid-row: span 2; background: var(--violet-soft); min-height: 320px; }
.promo .sm:nth-child(2) { background: var(--sky-soft); }
.promo .sm:nth-child(3) { background: var(--peach-soft); }
.promo .art { flex: 1; display: grid; place-items: center; color: var(--primary); opacity: .9; }
.promo .art svg { width: 64px; height: 64px; stroke-width: 1.2; }
.promo .big .art svg { width: 110px; height: 110px; }
.promo .t { font-weight: 700; font-size: 17px; }
.promo .big .t { font-size: 20px; }
.promo .d { color: var(--muted); font-size: 13px; }
@media (max-width: 720px) { .promo { grid-template-columns: 1fr; } .promo .big { min-height: 220px; } }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; opacity: .45; margin-bottom: 8px; }

/* ================= Table ================= */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--panel); }
.table .num { text-align: right; white-space: nowrap; }
.acc-link { display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-weight: 500; }
.acc-link svg { width: 16px; height: 16px; }
@media (max-width: 720px) { .table .hide-m { display: none; } }

/* ================= Wizard + phone ================= */
.split { display: grid; grid-template-columns: minmax(360px, 520px) 1fr; height: 100%; }
.split .left { display: flex; flex-direction: column; border-right: 1px solid var(--line); min-height: 0; background: var(--bg); }
.split .left .scroll { flex: 1; overflow: auto; padding: 20px 26px 28px; }
.split .left .foot { display: flex; gap: 10px; padding: 14px 26px; border-top: 1px solid var(--line); background: var(--bg); }
.split .left .foot .btn { flex: 1; height: 44px; }
.split .right { background: var(--soft); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; gap: 18px; min-height: 0; overflow: auto; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; border: 0; background: none; padding: 0; margin-bottom: 18px; }
.back-link svg { width: 18px; height: 18px; }
.wiz-title { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.wiz-title input { border: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; padding: 0; height: auto; flex: 1; min-width: 0; background: transparent; }
.wiz-title input:focus { box-shadow: none; }
.wiz-title .step { color: var(--muted); white-space: nowrap; }
.sec-title { font-size: 18px; font-weight: 700; margin: 22px 0 6px; }
.sec-title:first-child { margin-top: 0; }
.sec-sub { color: var(--muted); margin-bottom: 12px; }
.btn-input { max-width: 240px; }
.reply-row { display: flex; gap: 8px; margin-bottom: 8px; }
.reply-row input { flex: 1; }
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .split .right { display: none; }
  .split.show-preview .right { display: flex; position: fixed; inset: 0; z-index: 40; }
  .split.show-preview .right .close-preview { display: inline-flex; }
  .split .left .scroll { padding: 16px; }
  .split .left .foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
}
.close-preview { display: none; position: absolute; top: 16px; right: 16px; }
.preview-btn { display: none; }
@media (max-width: 900px) { .preview-btn { display: inline-flex; } }

.phone { width: 300px; height: 600px; border-radius: 44px; border: 10px solid #111; background: #fff; position: relative; overflow: hidden; box-shadow: var(--shadow-lg); color: #111; flex-shrink: 0; }
.phone::before { content: ""; position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 90px; height: 24px; background: #111; border-radius: 99px; z-index: 3; }
.phone .scr { position: absolute; inset: 0; display: flex; flex-direction: column; padding-top: 38px; font-size: 12px; }
.phone .ph-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid #eee; }
.phone .ph-head b { font-size: 12.5px; display: block; }
.phone .ph-head small { color: #888; font-size: 10.5px; }
.phone .ph-head svg { width: 18px; height: 18px; }
.phone .ph-body { flex: 1; overflow: auto; padding: 10px 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.phone .ph-note { text-align: center; color: #888; font-size: 10.5px; margin: 4px 14px 8px; }
.phone .b-row { display: flex; align-items: flex-end; gap: 6px; }
.phone .b-row.out { justify-content: flex-end; }
.phone .b { max-width: 78%; padding: 8px 11px; border-radius: 18px; white-space: pre-wrap; word-break: break-word; line-height: 1.35; }
.phone .b.in { background: #efeff2; border-bottom-left-radius: 6px; }
.phone .b.out { background: #7b5cf5; color: #fff; border-bottom-right-radius: 6px; }
.phone .b .pbtn { display: block; background: #fff; color: #111; text-align: center; border-radius: 10px; padding: 7px; margin-top: 7px; font-weight: 600; }
.phone .b img { width: 100%; border-radius: 12px; margin-bottom: 6px; display: block; }
.phone .ph-input { margin: 8px 10px 22px; height: 34px; border-radius: 99px; background: #efeff2; }
.phone .post { flex: 1; display: flex; flex-direction: column; }
.phone .post .img { flex: 1; background: #ececf0; display: grid; place-items: center; text-align: center; padding: 26px; color: #555; font-size: 13px; }
.phone .post .bar { display: flex; gap: 12px; padding: 10px 12px; }
.phone .post .bar svg { width: 18px; height: 18px; }
.phone .cm { padding: 4px 12px; display: flex; gap: 6px; font-size: 11.5px; }
.phone .cm.reply { padding-left: 34px; color: #333; }
.phone .ph-nav { display: flex; justify-content: space-around; padding: 10px 0 22px; border-top: 1px solid #eee; }
.phone .ph-nav svg { width: 18px; height: 18px; }
.phone .mini-ava { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, #f9b, #a7f); flex-shrink: 0; }
.phone .flow-list { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.phone .flow-step { background: #f4f4f7; border-radius: 12px; padding: 9px 11px; }
.phone .flow-step b { display: block; font-size: 11px; color: #7b5cf5; margin-bottom: 2px; }
.phone .flow-arrow { text-align: center; color: #bbb; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; max-height: 300px; overflow: auto; margin-top: 8px; }
.media-grid button { border: 2px solid transparent; padding: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: var(--soft); position: relative; }
.media-grid button.on { border-color: var(--primary); }
.media-grid button .cbox { position: absolute; top: 5px; right: 5px; background: rgba(255,255,255,.85); }
.media-grid button.on .cbox { background: var(--primary); }
.media-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ================= Detail ================= */
.detail-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.detail-head .acc { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.bars { display: flex; align-items: flex-end; gap: 3px; padding-top: 10px; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; min-width: 0; }
.bar-stack { flex: 1; display: flex; align-items: flex-end; gap: 2px; border-left: 1px dashed var(--line); padding: 0 2px; }
.bar { flex: 1; border-radius: 5px 5px 0 0; min-height: 0; }
.bar-label { height: 20px; font-size: 10.5px; color: var(--muted); text-align: center; white-space: nowrap; overflow: visible; padding-top: 4px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.funnel { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: stretch; gap: 8px; }
.funnel .arrow { display: grid; place-items: center; color: var(--muted-2); }
.funnel .arrow svg { width: 16px; height: 16px; }
.progress { height: 4px; background: var(--soft-2); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.progress i { display: block; height: 100%; background: var(--text); border-radius: 99px; }
@media (max-width: 720px) { .funnel { grid-template-columns: 1fr; } .funnel .arrow { transform: rotate(90deg); } }

/* ================= Chats ================= */
.chats { display: grid; grid-template-columns: 320px 1fr 300px; height: 100%; }
.chats .list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.chats .list-head { padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px; }
.chats .list-head .row select { border: 0; background: none; font-weight: 700; font-size: 16px; padding: 0; outline: none; cursor: pointer; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); }
.search input { padding-left: 36px; height: 38px; background: var(--bg); }
.chats .threads { flex: 1; overflow: auto; padding: 4px 8px; }
.thread { display: flex; gap: 10px; padding: 10px; border-radius: 12px; cursor: pointer; align-items: center; }
.thread:hover { background: var(--soft); }
.thread.on { background: var(--soft); }
.thread .t1 { display: flex; align-items: center; gap: 6px; }
.thread .t1 b { flex: 1; font-weight: 600; }
.thread .t1 time { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.thread .t2 { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.thread .t2 span { flex: 1; }
.unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.chat-head { display: none; padding: 10px 12px; border-bottom: 1px solid var(--line); align-items: center; gap: 10px; }
.chat-body { flex: 1; overflow: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 4px; }
.day-sep { text-align: center; color: var(--muted); font-size: 12px; margin: 12px 0 6px; }
.msg { display: flex; align-items: flex-end; gap: 8px; }
.msg.out { justify-content: flex-end; }
.msg .bub { max-width: min(70%, 520px); padding: 9px 13px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; position: relative; }
.msg.in .bub { background: var(--bubble-in); border-bottom-left-radius: 6px; }
.msg.out .bub { background: var(--primary); color: #fff; border-bottom-right-radius: 6px; }
.msg .bub.comment { background: var(--amber-soft); color: var(--text); }
.msg .bub .meta { font-size: 10.5px; opacity: .7; text-align: right; margin-top: 3px; }
.msg .bub .btns { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.msg .bub .btns span { background: rgba(255,255,255,.18); border-radius: 10px; padding: 6px 10px; text-align: center; font-weight: 600; font-size: 13px; }
.msg .bub .tag-c { font-size: 11px; font-weight: 600; margin-bottom: 3px; color: var(--amber); }
.composer { margin: 0 16px 16px; border: 1px solid var(--line); border-radius: 22px; padding: 5px 5px 5px 16px; display: flex; align-items: flex-end; gap: 8px; background: var(--bg); }
.composer:focus-within { border-color: var(--primary); }
.composer textarea { flex: 1; border: 0; padding: 8px 0; min-height: 36px; height: 36px; max-height: 140px; line-height: 20px; resize: none; background: transparent; box-shadow: none !important; outline: 0; overflow-y: auto; }
.composer .send { flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--primary); color: #fff; cursor: pointer; transition: opacity .15s; }
.composer .send:disabled { opacity: .35; cursor: default; }
.composer .send svg { width: 18px; height: 18px; }
@media (max-width: 900px) { .composer { margin: 0 8px calc(8px + env(safe-area-inset-bottom)); } }
.composer { padding-left: 5px; }
.composer .attach { flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--soft); color: var(--text); cursor: pointer; }
.composer .attach svg { width: 20px; height: 20px; }
.composer .cmp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.composer .tray { display: none; gap: 8px; overflow-x: auto; padding: 6px 0 4px; }
.composer .tray.on { display: flex; }
.tr-item { position: relative; flex-shrink: 0; width: 64px; height: 64px; border-radius: 12px; overflow: hidden; background: var(--soft); }
.tr-item img, .tr-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tr-item button { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; padding: 0; cursor: pointer; }
.tr-item button svg { width: 12px; height: 12px; }
.tr-item .tr-badge { position: absolute; left: 4px; bottom: 2px; }
.tr-item .tr-badge svg, .pp-badge svg { width: 14px; height: 14px; fill: #fff; stroke: #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.tr-item.up::after { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,.55); }
.tr-item.up::before { content: ''; position: absolute; z-index: 1; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px; border: 2.5px solid var(--primary); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.tr-item.err { outline: 2px solid var(--red); outline-offset: -2px; }
.composer .send.loading { opacity: .6; }
@keyframes spin { to { transform: rotate(360deg); } }
.pp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: max-content; align-content: start; gap: 6px; max-height: min(60dvh, 520px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
@media (min-width: 640px) { .pp-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* aspect-ratio o'rniga padding — iOS Safari'da katakchalar siqilib qolmasligi uchun */
.pp-item { position: relative; display: block; width: 100%; height: 0; padding: 125% 0 0; border: 0; border-radius: 10px; overflow: hidden; background: var(--soft); cursor: pointer; -webkit-appearance: none; appearance: none; }
.pp-item img, .pp-item .pp-ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 720px) {
  .modal-wrap:has(.pp-grid) { padding: 0; place-items: end stretch; }
  .modal:has(.pp-grid) { max-width: none; height: calc(var(--vvh, 100dvh) - 40px); max-height: none; border-radius: 20px 20px 0 0; display: flex; flex-direction: column; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .modal:has(.pp-grid) .pp-grid { flex: 1; max-height: none; min-height: 0; }
}
.pp-item .pp-ph { background: linear-gradient(135deg, var(--soft), var(--line)); }
.pp-badge { position: absolute; top: 6px; right: 6px; color: #fff; font-size: 14px; line-height: 1; }
.pp-check { position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.25); display: grid; place-items: center; color: transparent; }
.pp-check svg { width: 13px; height: 13px; }
.pp-item.on { box-shadow: inset 0 0 0 3px var(--primary); }
.pp-item.on .pp-check { background: var(--primary); border-color: var(--primary); color: #fff; }
.window-warn { margin: 0 16px 8px; padding: 8px 12px; border-radius: 10px; background: var(--amber-soft); color: var(--amber); font-size: 12.5px; }
.info { border-left: 1px solid var(--line); overflow: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.info .who { display: flex; align-items: center; gap: 10px; }
.info .who b { font-size: 16px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 10px 8px; align-items: center; font-size: 13.5px; }
.kv .k { color: var(--muted); }
.kv input { height: 32px; border-color: transparent; padding: 0 8px; margin-left: -8px; width: calc(100% + 8px); }
.kv input:hover { border-color: var(--line); }
.info .sec { border-top: 1px solid var(--line); padding-top: 14px; }
.info .sec h4 { margin: 0 0 10px; font-size: 15px; display: flex; align-items: center; justify-content: space-between; }
.tag-add { border: 1px dashed var(--muted-2); background: none; border-radius: 99px; height: 26px; padding: 0 10px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
@media (max-width: 1200px) { .chats { grid-template-columns: 300px 1fr; } .info { display: none; } .chats.show-info .info { display: flex; position: fixed; right: 0; top: 0; bottom: 0; width: 320px; background: var(--bg); z-index: 40; box-shadow: var(--shadow-lg); } .chat-head { display: flex; } }
@media (max-width: 720px) {
  .chats { grid-template-columns: 1fr; height: calc(100dvh - 64px - env(safe-area-inset-bottom)); }
  .chats.open .list { display: none; }
  .chats:not(.open) .chat { display: none; }
  .chats.show-info .info { width: 100%; }
  /* Ochiq chat — butun ekran; balandlik klaviaturaga moslashadi (iOS/Android) */
  .chats.open { position: fixed; left: 0; right: 0; top: 0; height: var(--vvh, 100dvh); z-index: 35; background: var(--bg); }
  .chats.open .chat { height: 100%; }
  .chats.open .chat-body { padding: 12px; overscroll-behavior: contain; }
  .chats.open .msg .bub { max-width: 82%; }
}

/* ================= Builder ================= */
.builder { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--panel); }
.b-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg); z-index: 3; flex-wrap: wrap; }
.b-top input.name { border: 0; font-weight: 800; font-size: 18px; height: 36px; padding: 0 6px; width: auto; min-width: 120px; flex: 1; max-width: 420px; background: transparent; }
.b-top input.name:focus { box-shadow: none; background: var(--soft); }
.b-top .acc { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.b-top .stats-mini { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin-left: auto; }
.b-top .stats-mini b { color: var(--text); font-size: 14px; }
.canvas { position: relative; flex: 1; overflow: hidden; cursor: grab; touch-action: none;
  background-color: var(--panel); background-image: radial-gradient(var(--soft-2) 1.2px, transparent 1.2px); background-size: 22px 22px; }
.canvas.panning { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; width: 1px; height: 1px; }
.edges path { fill: none; stroke: var(--muted-2); stroke-width: 2; }
.edges path.temp { stroke: var(--primary); stroke-dasharray: 6 5; }
.node { position: absolute; width: 270px; background: var(--bg); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); cursor: default; user-select: none; }
.node.sel { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft), var(--shadow); }
.node .nh { display: flex; align-items: center; gap: 7px; padding: 11px 14px 8px; cursor: move; font-weight: 700; }
.node .nh svg { width: 17px; height: 17px; }
.node .nh .cnt { margin-left: auto; display: flex; align-items: center; gap: 3px; color: var(--muted); font-size: 12px; font-weight: 600; }
.node .nh .cnt svg { width: 13px; height: 13px; }
.node.t-message .nh svg { color: var(--primary); }
.node.t-condition .nh svg { color: #16a37f; }
.node.t-action .nh svg { color: #e0a100; }
.node.t-start { width: 240px; background: var(--text); color: var(--bg); border-color: var(--text); }
.node.t-start .nb .trig { background: rgba(255,255,255,.1); }
.node.t-note { background: #fff8d6; border-color: #f2e3a0; color: #5c4a00; }
.node .nb { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 7px; }
.node .txt { background: var(--soft); border-radius: 12px; padding: 9px 11px; white-space: pre-wrap; word-break: break-word; font-size: 12.5px; max-height: 190px; overflow: hidden; line-height: 1.4; }
.node .txt.empty-t { color: var(--muted); font-style: italic; }
.node .img-prev { width: 100%; height: 110px; object-fit: cover; border-radius: 10px; display: block; }
.node .nbtn { position: relative; border: 1px solid var(--line); border-radius: 11px; padding: 7px 26px 7px 10px; text-align: center; font-weight: 600; font-size: 12.5px; background: var(--bg); }
.node .nbtn small { display: block; color: var(--muted); font-weight: 500; font-size: 10.5px; }
.node .nbtn .lk { color: var(--primary); }
.node .add-btn { border: 1px solid var(--line); border-radius: 11px; height: 32px; background: var(--soft); color: var(--muted); font-size: 12.5px; font-weight: 600; }
.node .trig { border-radius: 10px; padding: 8px 10px; font-size: 12.5px; background: var(--soft); display: flex; align-items: center; gap: 6px; }
.node .trig svg { width: 15px; height: 15px; }
.node .cond-out { position: relative; display: flex; align-items: center; padding: 6px 26px 6px 10px; border-radius: 10px; font-weight: 600; font-size: 12.5px; }
.node .cond-out.yes { background: var(--green-soft); color: var(--green); }
.node .cond-out.no { background: var(--red-soft); color: var(--red); }
.node .act { display: flex; align-items: center; gap: 7px; background: var(--soft); border-radius: 10px; padding: 7px 10px; font-size: 12.5px; }
.node .act svg { width: 15px; height: 15px; color: var(--muted); }
.node .act small { color: var(--muted); display: block; font-size: 10.5px; }
.port { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--primary); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--primary); right: -7px; top: 50%; transform: translateY(-50%); cursor: crosshair; z-index: 2; }
.port.linked { background: var(--bg); }
.port.next { top: auto; bottom: -7px; right: 50%; transform: translateX(50%); }
.node .next-row { position: relative; height: 6px; }
.node .in-port { position: absolute; left: -6px; top: 18px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--muted-2); }
.node.drop-target { box-shadow: 0 0 0 3px var(--primary); }
.b-tools { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 3; }
.b-tools button { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); display: grid; place-items: center; color: var(--text); box-shadow: var(--shadow); }
.b-tools button.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.add-menu { position: absolute; right: 64px; top: 50%; transform: translateY(-70%); width: 300px; background: var(--bg); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 4; }
.add-menu button { display: flex; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 10px; border-radius: 10px; }
.add-menu button:hover { background: var(--soft); }
.add-menu b { display: block; }
.add-menu small { color: var(--muted); font-size: 12px; }
.drawer { position: absolute; right: 0; top: 0; bottom: 0; width: 380px; background: var(--bg); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); z-index: 5; display: flex; flex-direction: column; }
.drawer .d-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer .d-body { flex: 1; overflow: auto; padding: 18px; }
.drawer .d-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.btn-edit { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 720px) { .drawer { width: 100%; } .builder { bottom: calc(60px + env(safe-area-inset-bottom)); } .b-top .stats-mini { display: none; } }

/* ================= Misc ================= */
.modal-wrap { position: fixed; inset: 0; background: rgba(15, 17, 22, .45); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .15s; }
.modal { width: 100%; max-width: 460px; max-height: calc(100dvh - 32px); overflow: auto; background: var(--bg); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 20px; }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.modal-head h3 { flex: 1; font-size: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.x-btn { border: 0; background: var(--soft-2); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.x-btn svg { width: 14px; height: 14px; }
@keyframes fade { from { opacity: 0; } }

.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tpl { position: relative; border-radius: 18px; padding: 20px; cursor: pointer; min-height: 150px; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; border: 0; text-align: left; transition: transform .12s; }
.tpl:hover { transform: translateY(-2px); }
.tpl.wide { grid-column: span 2; min-height: 170px; }
.tpl .art { position: absolute; right: 20px; top: 18px; opacity: .85; color: var(--primary); }
.tpl .art svg { width: 56px; height: 56px; stroke-width: 1.3; }
.tpl .go { position: absolute; right: 16px; top: 16px; }
.tpl b { font-size: 17px; }
.tpl span { color: var(--muted); font-size: 13px; max-width: 460px; }
.tpl .pop { display: inline-block; background: #e8458f; color: #fff; font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 6px; transform: rotate(-3deg); margin-left: 8px; vertical-align: middle; }
@media (max-width: 640px) { .tpl-grid { grid-template-columns: 1fr; } .tpl.wide { grid-column: auto; } }

.popmenu { position: fixed; z-index: 120; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 5px; min-width: 180px; }
.popmenu button { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: none; padding: 9px 10px; border-radius: 8px; text-align: left; font-weight: 500; }
.popmenu button:hover { background: var(--soft); }
.popmenu button.danger { color: var(--red); }
.popmenu svg { width: 17px; height: 17px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--soft); }
.login .modal { max-width: 380px; padding: 28px; }
.login .logo { width: 44px; height: 44px; border-radius: 13px; background: var(--primary); color: #fff; display: grid; place-items: center; margin-bottom: 14px; }
.login .logo svg { width: 22px; height: 22px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 12px; font-weight: 500; transition: .25s; z-index: 200; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: var(--red); color: #fff; }
@media (max-width: 720px) { .toast { bottom: 80px; } }

.log { font-size: 13px; padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; gap: 12px; }
.log:last-child { border: 0; }
.log time { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 44px; }
.copy { display: flex; gap: 8px; align-items: center; background: var(--soft); border-radius: 10px; padding: 8px 10px; margin-top: 6px; }
.copy .mono { flex: 1; }
.steps { padding-left: 20px; margin: 0; }
.steps li { margin-bottom: 12px; }
.acc-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.acc-row:last-child { border: 0; }

@media (min-width: 1201px) { .hide-wide { display: none; } }
.node .nb .port { right: -20px; }
.node .next-row { padding-right: 6px; }
.thread .t2 span { flex: initial; }
.thread .t2 span.truncate { flex: 1; }
.mobile-bar button.more { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 600; color: var(--muted); border: 0; background: none; padding: 2px 0; }
.mobile-bar button.more.on { color: var(--primary); }
.builder.has-drawer .b-tools { right: 394px; }
.builder.has-drawer .add-menu { right: 444px; }
@media (max-width: 720px) { .builder.has-drawer .b-tools { display: none; } }
.node { isolation: isolate; z-index: 1; }
.node.sel { z-index: 3; }

/* ================= Buyurtmalar ================= */
.chip.violet { background: var(--violet-soft); color: #6a4ce0; }
.sdot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--muted-2); }
.sdot.blue { background: var(--primary); } .sdot.violet { background: #7b5cf5; } .sdot.amber { background: #e0a100; } .sdot.green { background: var(--green); } .sdot.red { background: var(--red); }
.status-sel { appearance: none; border: 0; border-radius: 99px; height: 28px; padding: 0 12px; font-weight: 600; font-size: 12.5px; cursor: pointer; outline: none; }
.status-sel.blue { background: var(--primary-soft); color: var(--primary); }
.status-sel.violet { background: var(--violet-soft); color: #6a4ce0; }
.status-sel.amber { background: var(--amber-soft); color: var(--amber); }
.status-sel.green { background: var(--green-soft); color: var(--green); }
.status-sel.red { background: var(--red-soft); color: var(--red); }
.ord-items { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.ord-row { display: grid; grid-template-columns: 1fr 70px 130px 32px; gap: 6px; align-items: center; }
.ord-row.head { font-size: 12px; color: var(--muted); }
.ord-row input { height: 38px; }
.ord-total { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: var(--soft); border-radius: 12px; font-size: 15px; }
.ord-total b { font-size: 20px; }
.linked-contact { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 11px; }
.c-results { display: flex; flex-direction: column; margin-top: 4px; }
.c-results button { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 7px 8px; border-radius: 8px; text-align: left; }
.c-results button:hover { background: var(--soft); }
.mini-order { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; margin-bottom: 6px; font-size: 13px; }
.mini-order:hover { background: var(--panel); }
.thread .op { font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 3px; }
.thread .op svg { width: 12px; height: 12px; }
.msg .bub .by { font-size: 10.5px; opacity: .75; margin-bottom: 2px; font-weight: 600; }
.op-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.op-row:last-child { border: 0; }
.op-stats { display: flex; gap: 18px; font-size: 12.5px; color: var(--muted); }
.op-stats b { color: var(--text); font-size: 14px; display: block; }
.online { width: 9px; height: 9px; border-radius: 50%; background: var(--green); display: inline-block; }
@media (max-width: 640px) { .ord-row { grid-template-columns: 1fr 56px 96px 30px; } .op-stats { display: none; } }

.chats > * { min-width: 0; }
.chats .list-head .row { min-width: 0; }

/* ================= Muhit almashtirgich ================= */
.ws-btn { position: relative; border: 0; background: none; padding: 0; margin-bottom: 14px; border-radius: 50%; cursor: pointer; }
.ws-btn .ava { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary); }
.ws-btn .logo { margin: 0; }
.ws-dot { position: absolute; top: -2px; right: -2px; width: 11px; height: 11px; border-radius: 50%; background: var(--red); border: 2px solid var(--bg); }
.ws-check { position: absolute; right: -5px; bottom: -4px; width: 14px; height: 14px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; border: 2px solid var(--bg); }
.ws-check svg { width: 9px !important; height: 9px !important; }
.ws-head { display: flex; align-items: center; gap: 8px; padding: 2px 6px 14px; color: var(--muted); font-size: 13px; font-weight: 600; }
.ws-head b { color: var(--text); }
.ws-mobile { display: none; }
@media (max-width: 720px) {
  .ws-mobile { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; font-weight: 700; border: 0; background: none; padding: 0; }
  .ws-mobile svg { width: 16px; height: 16px; color: var(--muted); }
}
.acc-pick { display: flex; flex-direction: column; gap: 6px; }
.acc-pick label { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; }
.acc-pick input { width: 18px; height: 18px; accent-color: var(--primary); }

/* ================= Chatdagi media ================= */
.m-list { display: flex; flex-direction: column; gap: 6px; margin: 2px 0 4px; }
.m-img { display: block; max-width: 280px; max-height: 360px; width: auto; border-radius: 12px; cursor: zoom-in; background: rgba(0,0,0,.05); }
.m-video { position: relative; }
.m-video video, .m-vid2 { display: block; max-width: 300px; max-height: 420px; border-radius: 12px; background: #000; }
.m-expand { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 8px; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 15px; }
.m-audio audio { width: 260px; max-width: 100%; height: 40px; }
.m-file { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 10px; background: rgba(0,0,0,.06); font-size: 13px; color: inherit; }
.msg.out .m-file { background: rgba(255,255,255,.18); }
.m-cap { font-size: 11.5px; font-weight: 600; opacity: .75; }
.m-heart { font-size: 34px; line-height: 1; }
.m-text { white-space: pre-wrap; }
.lightbox img, .lightbox video { display: block; max-width: 100%; max-height: calc(100dvh - 140px); margin: 0 auto; border-radius: 12px; }
@media (max-width: 720px) { .m-img, .m-video video { max-width: 220px; } }

.msg .bub { white-space: normal; }

/* ================= Buyurtma fayllari, tarix, aniqlangan ma'lumotlar ================= */
.ord-files { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.ord-file { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 12px; }
.ord-file img, .ord-file .pdf { width: 52px; height: 52px; border-radius: 9px; object-fit: cover; cursor: zoom-in; background: var(--soft); display: grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--red); flex-shrink: 0; }
.ord-file.pending { border-style: dashed; }
.ord-file .fi { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.ord-file .fi span { color: var(--muted); font-size: 12px; }
.ord-file .fa { display: flex; gap: 4px; }
.ord-pick { margin-top: 8px; padding: 10px; background: var(--soft); border-radius: 12px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; max-height: 220px; overflow: auto; }
.pick-grid button { border: 2px solid transparent; padding: 0; border-radius: 9px; overflow: hidden; aspect-ratio: 1; background: var(--bg); }
.pick-grid button:disabled { border-color: var(--green); opacity: .6; }
.pick-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ord-history { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.ord-history summary { cursor: pointer; font-weight: 600; }
.ord-history .ev { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.ord-history .ev:last-child { border: 0; }
.evdot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: var(--muted-2); }
.evdot.created { background: var(--primary); } .evdot.status { background: #7b5cf5; } .evdot.file { background: #e0a100; } .evdot.sent { background: var(--green); }
.det { display: inline-flex; align-items: center; gap: 5px; margin-top: 5px; padding: 3px 8px; border-radius: 8px; background: var(--green-soft); color: var(--green); font-size: 11.5px; font-weight: 600; }
.det.sug { background: var(--soft-2); color: var(--muted); }
.sugs { display: flex; flex-wrap: wrap; gap: 5px; grid-column: 2; margin-top: -4px; }
.sugs button { border: 1px dashed var(--muted-2); background: none; border-radius: 99px; padding: 2px 9px; font-size: 11.5px; color: var(--muted); cursor: pointer; }
.sugs button:hover { border-color: var(--primary); color: var(--primary); }
.ord-sum { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin: -4px 0 10px; }
.ord-sum b { color: var(--text); }

/* ================= Akkaunt statistikasi ================= */
.ins-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; transition: opacity .2s; }
.ins { padding: 16px; border-radius: 16px; background: var(--soft); display: flex; flex-direction: column; gap: 4px; position: relative; }
.ins.click { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.ins.click:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.ins.green { background: var(--green-soft); } .ins.green .ins-v { color: var(--green); }
.ins.red { background: var(--red-soft); } .ins.red .ins-v { color: var(--red); }
.ins-l { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; }
.ins-ic { width: 26px; height: 26px; border-radius: 8px; background: var(--bg); display: grid; place-items: center; font-weight: 800; flex-shrink: 0; }
.ins-ic svg { width: 15px; height: 15px; }
.ins-go { margin-left: auto; color: var(--muted); } .ins-go svg { width: 16px; height: 16px; }
.ins-v { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; }
.ins-s { font-size: 12px; color: var(--muted); }
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.story { display: flex; flex-direction: column; gap: 6px; color: var(--text); }
.st-img { position: relative; aspect-ratio: 9/16; border-radius: 12px; overflow: hidden; background: linear-gradient(160deg, #f9b, #a7f); display: grid; place-items: center; font-size: 26px; }
.st-img img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.st-time { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: 10.5px; padding: 2px 6px; border-radius: 6px; }
.st-stats { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.people { display: flex; flex-direction: column; max-height: 60dvh; overflow: auto; }
.person { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-radius: 10px; color: var(--text); }
.person:hover { background: var(--soft); }
.st-stats { flex-wrap: wrap; gap: 2px 8px; font-size: 11.5px; }
.st-stats span { white-space: nowrap; }

/* iOS: 16px dan kichik shriftli inputga bosilganda ekran zoom bo'lmasin */
@media (max-width: 900px), (pointer: coarse) {
  input, select, textarea, [contenteditable] { font-size: 16px !important; }
}

/* Ulashilgan post / Reels kartochkasi */
.m-post { display: block; width: 220px; max-width: 100%; border-radius: 14px; overflow: hidden; background: var(--bg); color: var(--text); text-decoration: none; }
.m-post-img { position: relative; display: block; aspect-ratio: 4 / 5; background: var(--soft); }
@supports not (aspect-ratio: 1) { .m-post-img { height: 275px; } }
.m-post-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.m-post-play { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px; border-radius: 50%; background: rgba(0,0,0,.45); display: grid; place-items: center; }
.m-post-play svg { width: 20px; height: 20px; fill: #fff; stroke: #fff; margin-left: 3px; }
.m-post-cap { display: block; padding: 8px 10px; font-size: 13px; line-height: 1.35; white-space: normal; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
