/* ============================================================
   FloraGlobal CRM — hi-fi prototype design system
   Faithful to repo tokens: Manrope · #0f6d4b · card-first · Apple/M3
   ============================================================ */

:root {
  /* surfaces */
  --bg: #f6f8f7;
  --bg-2: #eef2f1;
  --card: #ffffff;
  --text: #16201b;
  --ink: #16201b;
  --muted: #5f6b65;
  --faint: #8a948f;

  /* brand */
  --primary: #0f6d4b;
  --primary-2: #2f8f67;
  --primary-grad-a: #19a77b;
  --primary-grad-b: #0f6d4b;
  --primary-surface: rgba(15, 109, 75, 0.07);
  --primary-surface-strong: rgba(15, 109, 75, 0.12);
  --primary-border: rgba(15, 109, 75, 0.18);

  /* status */
  --info: #2563eb;        --info-surface: rgba(37, 99, 235, 0.10);
  --warning: #8a5a12;     --warning-surface: rgba(181, 154, 74, 0.16);
  --warning-border: rgba(181, 154, 74, 0.22);
  --error: #b42318;       --error-surface: rgba(180, 35, 24, 0.09);
  --slate: #5a6b78;       --slate-surface: rgba(90, 107, 120, 0.12);

  /* lines & shadow */
  --border: rgba(18, 28, 36, 0.09);
  --border-soft: rgba(18, 28, 36, 0.06);
  --shadow-sm: 0 1px 2px rgba(18, 28, 36, 0.04), 0 8px 24px rgba(18, 28, 36, 0.06);
  --shadow-md: 0 2px 6px rgba(18, 28, 36, 0.06), 0 16px 40px rgba(18, 28, 36, 0.10);
  --shadow-pop: 0 12px 36px rgba(18, 28, 36, 0.16);

  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-card: 16px;
  --r-pill: 999px;

  --sidebar-w: 268px;
  --topbar-h: 60px;
  --font: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
button { font-family: inherit; }
::selection { background: var(--primary-surface-strong); }

.demo-disclaimer {
  position: fixed;
  z-index: 600;
  inset: 0 0 auto;
  min-height: 31px;
  padding: 7px 40px;
  border-bottom: 1px solid var(--primary-border);
  background: #edf6f2;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.demo-disclaimer a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 760px) {
  .demo-disclaimer {
    padding: 7px 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    justify-content: space-between;
    gap: 8px;
  }
  .demo-disclaimer span { overflow: hidden; text-overflow: ellipsis; }
  .demo-disclaimer a { flex: 0 0 auto; }
}

/* ================= APP SHELL ================= */
.app { display: flex; height: calc(100vh - 31px); width: 100%; margin-top: 31px; }

.sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px 14px;
  gap: 1px;
  overflow-y: auto;
  overflow-x: hidden;
}
.logo { display: flex; align-items: center; gap: 11px; padding: 4px 8px 15px; margin-bottom: 7px; border-bottom: 1px solid var(--border-soft); }
.logo-mark {
  width: 38px; height: 38px; flex: 0 0 auto;
  border-radius: 11px;
  background: linear-gradient(150deg, var(--primary-grad-a), var(--primary-grad-b));
  display: grid; place-items: center;
  box-shadow: 0 6px 16px rgba(15, 109, 75, 0.28);
}
.logo-mark svg { width: 24px; height: 24px; }
.logo-text { font-weight: 800; font-size: 16px; letter-spacing: -0.01em; line-height: 1.1; white-space: nowrap; }
.logo-text small { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin-top: 1px; }

.nav-section {
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--faint); padding: 15px 10px 6px;
}
.nav-section:first-of-type { padding-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 10px;
  color: var(--muted); font-weight: 600; font-size: 13.5px;
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: background .14s, color .14s;
  position: relative;
}
.nav-item > span:not(.ico):not(.count) { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-item .ico { flex: 0 0 auto; display: inline-grid; place-items: center; color: var(--faint); transition: color .14s; }
.nav-item svg { width: 18px; height: 18px; flex: 0 0 auto; stroke-width: 2; }
.nav-item:hover { background: var(--primary-surface); color: var(--text); }
.nav-item:hover .ico { color: var(--primary); }
.nav-item.active { background: var(--primary-surface-strong); color: var(--primary); font-weight: 700; }
.nav-item.active .ico { color: var(--primary); }
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px;
  background: var(--primary); border-radius: 0 3px 3px 0;
}
.nav-item .count {
  margin-left: auto; flex: 0 0 auto; font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--primary-surface-strong); color: var(--primary);
  padding: 1px 8px; border-radius: var(--r-pill); min-width: 20px; text-align: center;
}
.nav-item .count.warn { background: var(--warning-surface); color: var(--warning); }
.nav-item .count.err { background: var(--error-surface); color: var(--error); }

/* ================= CONTENT ================= */
.content { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar {
  height: var(--topbar-h); flex: 0 0 auto;
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 20;
}
.cmd {
  display: flex; align-items: center; gap: 10px;
  width: min(440px, 42vw);
  padding: 9px 14px; border-radius: var(--r-pill);
  background: var(--bg); border: 1px solid var(--border);
  color: var(--faint); font-size: 13.5px; cursor: text;
  transition: border-color .14s, background .14s;
}
.cmd:hover { border-color: var(--primary-border); background: #fff; }
.cmd svg { width: 16px; height: 16px; }
.cmd .kbd { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; background: #fff; }
.topbar .grow { flex: 1; }
.topbar-btn {
  width: 40px; height: 40px; border-radius: var(--r-pill);
  display: grid; place-items: center; background: var(--bg); border: 1px solid var(--border);
  color: var(--muted); cursor: pointer; position: relative;
}
.topbar-btn svg { width: 18px; height: 18px; }
.topbar-btn .dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--error); border: 1.5px solid #fff; }
.user {
  display: flex; align-items: center; gap: 9px; padding: 5px 12px 5px 5px;
  border-radius: var(--r-pill); background: var(--bg); border: 1px solid var(--border); cursor: pointer;
}
.user .ava { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(150deg, var(--primary-grad-a), var(--primary-grad-b)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.user .uname { font-weight: 700; font-size: 13px; }
.user .urole { font-size: 11px; color: var(--faint); }

.scroll { flex: 1; overflow-y: auto; }
.crumbs { display: flex; align-items: center; gap: 7px; padding: 16px 32px 0; font-size: 12.5px; color: var(--faint); font-weight: 600; }
.crumbs a { color: var(--faint); text-decoration: none; }
.crumbs a:hover { color: var(--primary); }
.crumbs .sep { opacity: .5; }
.crumb { color: var(--muted); font-weight: 700; font-size: 13px; }
.crumb:hover { color: var(--primary); }
.page { max-width: 1240px; margin: 0 auto; padding: 16px 32px 56px; }

/* ================= PAGE HEAD ================= */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--primary); margin-bottom: 5px; }
.page-head > div:first-child { min-width: 0; }
.page-title { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin: 0; line-height: 1.1; white-space: nowrap; }
.page-sub { color: var(--muted); margin: 5px 0 0; font-size: 14px; }
.page-head .grow { flex: 1; }
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* Stacked head — actions ride a top row so the title owns the full width on one line */
.head-actions .btn.icon { color: var(--muted); }
.head-actions .btn.icon:hover { color: var(--primary); }
.head-actions .btn.icon.act-danger { color: var(--error); }
.head-actions .btn.icon.act-danger:hover { color: var(--error); border-color: rgba(180,35,24,.45); background: var(--error-surface); }
/* back-to-list crumb above the title */
.page-head .crumb { display: inline-block; margin-bottom: 5px; }

/* ================= BUTTONS ================= */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  height: 40px; padding: 0 18px; border-radius: var(--r-pill);
  font-weight: 700; font-size: 14px; border: 1px solid transparent; cursor: pointer;
  white-space: nowrap; transition: transform .12s, box-shadow .12s, background .12s;
}
.btn svg { width: 17px; height: 17px; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(160deg, var(--primary-grad-a), var(--primary-grad-b)); color: #fff; box-shadow: 0 1px 2px rgba(18,28,36,.06), 0 8px 18px rgba(15,109,75,.24); }
.btn-primary:hover { box-shadow: 0 2px 4px rgba(18,28,36,.08), 0 12px 24px rgba(15,109,75,.30); }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary-border); color: var(--primary); }
.btn-quiet { background: transparent; color: var(--muted); }
.btn-quiet:hover { background: var(--bg-2); color: var(--text); }
.btn.sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn.icon { width: 40px; padding: 0; }
.btn.icon.sm { width: 34px; }

/* ================= CARDS ================= */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-card); box-shadow: var(--shadow-sm);
  padding: 20px;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-title { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.card-head .grow { flex: 1; }
.section-link { font-size: 13px; font-weight: 700; color: var(--primary); cursor: pointer; text-decoration: none; }
.section-link:hover { text-decoration: underline; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }

/* ================= KPI ================= */
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-sm); padding: 16px 18px; }
.kpi.clickable { cursor: pointer; transition: box-shadow .15s, transform .15s, border-color .15s; }
.kpi.clickable:hover { box-shadow: var(--shadow-md); border-color: var(--primary-border); transform: translateY(-1px); }
.kpi-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.kpi-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--primary-surface); color: var(--primary); display: grid; place-items: center; }
.kpi-ico svg { width: 18px; height: 18px; }
.kpi-ico.warn { background: var(--warning-surface); color: var(--warning); }
.kpi-ico.info { background: var(--info-surface); color: var(--info); }
.kpi-ico.err { background: var(--error-surface); color: var(--error); }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi-val { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.kpi-val .cur { font-size: 17px; font-weight: 700; color: var(--muted); }
.kpi-sub { font-size: 12.5px; color: var(--faint); margin-top: 6px; display: flex; align-items: center; gap: 5px; }
.trend { font-weight: 700; display: inline-flex; align-items: center; gap: 2px; }
.trend.up { color: var(--primary); }
.trend.down { color: var(--error); }

/* ================= BADGES ================= */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; line-height: 1;
  padding: 5px 10px; border-radius: var(--r-pill); white-space: nowrap;
}
.badge .d { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.b-work { background: var(--info-surface); color: var(--info); }
.badge.b-await { background: var(--warning-surface); color: var(--warning); }
.badge.b-paid { background: var(--primary-surface-strong); color: var(--primary); }
.badge.b-ship { background: var(--slate-surface); color: var(--slate); }
.badge.b-cancel { background: rgba(0,0,0,.05); color: var(--faint); }
.badge.b-over { background: var(--error-surface); color: var(--error); }

/* filter chips / segmented */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.seg { display: inline-flex; background: var(--bg-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: none; background: transparent; font-weight: 700; font-size: 13px; color: var(--muted); padding: 7px 14px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: #fff; color: var(--primary); box-shadow: var(--shadow-sm); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--muted);
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-pill);
  padding: 6px 13px; cursor: pointer; transition: all .12s;
}
.chip:hover { border-color: var(--primary-border); color: var(--text); }
.chip.on { background: var(--primary-surface-strong); border-color: var(--primary-border); color: var(--primary); font-weight: 700; }
.chip .d { width: 7px; height: 7px; border-radius: 50%; }
.field {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 0 12px; height: 40px; color: var(--faint); font-size: 13.5px; min-width: 0;
}
.field svg { width: 16px; height: 16px; }
.field input { border: none; outline: none; font: inherit; color: var(--text); background: transparent; width: 100%; }
.field.select { cursor: pointer; gap: 10px; font-weight: 600; color: var(--text); }
.field.select .chev { margin-left: auto; }

/* ================= DEAL CARDS (card-first list) ================= */
.deal-list { display: flex; flex-direction: column; gap: 12px; }
.deal-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--shadow-sm); padding: 16px 18px;
  display: grid; grid-template-columns: 44px 1.7fr 1fr 1fr auto; align-items: center; gap: 16px;
  cursor: pointer; transition: box-shadow .14s, border-color .14s, transform .14s;
}
.deal-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary-border); transform: translateY(-1px); }
.deal-ava { width: 44px; height: 44px; border-radius: 12px; background: var(--primary-surface); color: var(--primary); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.deal-main .dnum { font-size: 12px; font-weight: 700; color: var(--faint); }
.deal-main .dname { font-size: 15.5px; font-weight: 800; letter-spacing: -0.01em; }
.deal-main .dmeta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.deal-col .l { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.deal-col .v { font-size: 14px; font-weight: 700; margin-top: 3px; }
.deal-col .v.sum { font-size: 16px; }
.deal-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.deal-right .when { font-size: 12px; color: var(--faint); }

/* table-ish header for lists */
.list-head { display: grid; grid-template-columns: 44px 1.7fr 1fr 1fr auto; gap: 16px; padding: 4px 18px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }

/* ================= KANBAN ================= */
.kanban { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; align-items: start; }
.kcol { background: var(--bg-2); border-radius: var(--r-card); padding: 12px; }
.kcol-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding: 0 4px; }
.kcol-head .t { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 13.5px; }
.kcol-head .t .d { width: 8px; height: 8px; border-radius: 50%; }
.kcol-head .n { font-size: 12px; font-weight: 700; color: var(--muted); background: #fff; border-radius: var(--r-pill); padding: 1px 9px; }
.kc { background: #fff; border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px; box-shadow: var(--shadow-sm); margin-bottom: 10px; cursor: pointer; transition: box-shadow .14s, transform .14s; }
.kc:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kc .kc-name { font-weight: 800; font-size: 14px; }
.kc .kc-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.kc .kc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.kc .kc-sum { font-weight: 800; font-size: 14px; }

/* ================= TIMELINE ================= */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tev { position: relative; padding-bottom: 18px; }
.tev:last-child { padding-bottom: 0; }
.tev::before { content: ''; position: absolute; left: -24px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--border); box-sizing: border-box; }
.tev.done::before { background: var(--primary); border-color: var(--primary); }
.tev.now::before { background: #fff; border-color: var(--warning); box-shadow: 0 0 0 4px var(--warning-surface); }
.tev .tt { font-size: 13.5px; font-weight: 700; }
.tev .tm { font-size: 12px; color: var(--faint); margin-top: 1px; }
.tev .tx { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* line items */
.li-row { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.li-row:last-of-type { border-bottom: none; }
.li-name { font-weight: 600; }
.li-qty { color: var(--muted); font-variant-numeric: tabular-nums; }
.li-sum { font-weight: 700; font-variant-numeric: tabular-nums; }
.li-total { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; margin-top: 4px; border-top: 2px solid var(--border); font-size: 16px; font-weight: 800; }

/* client master-detail */
.md { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.md-list { display: flex; flex-direction: column; gap: 4px; max-height: 62vh; overflow-y: auto; padding-right: 4px; }
.md-item { display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: var(--r-md); cursor: pointer; border: 1px solid transparent; }
.md-item:hover { background: var(--primary-surface); }
.md-item.active { background: var(--primary-surface-strong); border-color: var(--primary-border); }
.md-item .ava { width: 36px; height: 36px; border-radius: 10px; background: var(--bg-2); color: var(--muted); display: grid; place-items: center; font-weight: 800; font-size: 12px; flex: 0 0 auto; }
.md-item.active .ava { background: #fff; color: var(--primary); }
.md-item > div { min-width: 0; }
.md-item .nm { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.md-item .mt { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* misc */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.tnum { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt6 { margin-top: 6px; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt20 { margin-top: 20px; } .mt24 { margin-top: 24px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
/* repeatable contact rows (supplier editor) */
.rep-row { display: flex; gap: 10px; align-items: flex-end; }
.rep-row > .grid { flex: 1; min-width: 0; }
.rep-row .rep-rm { flex: 0 0 auto; color: var(--muted); }
.rep-row .rep-rm:hover { border-color: rgba(180,35,24,.4); color: var(--error); }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* simple chart placeholder built from bars */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 130px; padding-top: 8px; }
.bars .bar { flex: 1; background: linear-gradient(180deg, var(--primary-grad-a), var(--primary-grad-b)); border-radius: 6px 6px 0 0; opacity: .88; min-width: 0; transition: opacity .14s; }
.bars .bar:hover { opacity: 1; }
.bars .bar.muted { background: var(--bg-2); }
.barx { display: flex; gap: 8px; margin-top: 8px; }
.barx span { flex: 1; text-align: center; font-size: 11px; color: var(--faint); }

/* funnel mini */
.funnel { display: flex; flex-direction: column; gap: 7px; }
.funnel .fr { display: flex; align-items: center; gap: 12px; }
.funnel .fr .fl { width: 110px; font-size: 13px; color: var(--muted); font-weight: 600; }
.funnel .fr .fbar { height: 26px; border-radius: 7px; background: var(--primary-surface-strong); display: flex; align-items: center; padding: 0 10px; font-size: 12px; font-weight: 800; color: var(--primary); }

/* queue rows */
.q-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border-soft); cursor: pointer; border-radius: 8px; }
.q-row:last-child { border-bottom: none; }
.q-row:hover { background: var(--primary-surface); }
.q-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; }
.q-ico svg { width: 16px; height: 16px; }
.q-row .q-ico { width: 32px; height: 32px; }
.q-row > div { flex: 1 1 auto; min-width: 0; }
.q-row .qt { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-row .qm { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-row .grow { display: none; }
.q-row .badge { margin-left: 12px; flex: 0 0 auto; }

/* command palette */
.scrim { position: fixed; inset: 0; background: rgba(16,24,20,0.32); backdrop-filter: blur(3px); display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; z-index: 100; }
.scrim.open { display: flex; }
.palette { width: min(580px, 92vw); background: #fff; border-radius: 18px; box-shadow: var(--shadow-pop); overflow: hidden; border: 1px solid var(--border); }
.palette-in { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.palette-in svg { width: 19px; height: 19px; color: var(--faint); }
.palette-in input { flex: 1; border: none; outline: none; font: inherit; font-size: 17px; color: var(--text); }
.presults { max-height: 340px; overflow-y: auto; padding: 8px; }
.pgrouplabel { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 10px 12px 4px; }
.pres { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.pres.sel, .pres:hover { background: var(--primary-surface); }
.pres .pico { width: 30px; height: 30px; border-radius: 8px; background: var(--bg-2); color: var(--muted); display: grid; place-items: center; }
.pres .pico svg { width: 16px; height: 16px; }
.pres.sel .pico { background: #fff; color: var(--primary); }
.pres .pname { font-weight: 700; font-size: 14px; }
.pres .pmeta { margin-left: auto; font-size: 12px; color: var(--faint); }
.pfoot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--faint); }
.pfoot b { color: var(--muted); font-weight: 700; }

/* ================= DEAL LIST CARD (rich quick-view) ================= */
.dcard { background: #fff; border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-sm); padding: 15px 18px; cursor: pointer; display: flex; flex-direction: column; gap: 12px; transition: box-shadow .14s, border-color .14s, transform .14s; }
.dcard:hover { box-shadow: var(--shadow-md); border-color: var(--primary-border); transform: translateY(-1px); }
.dcard-head { display: flex; align-items: center; gap: 12px; }
.dcard-id { flex: 1; min-width: 0; }
.dcard-id .dname { font-size: 15.5px; font-weight: 800; letter-spacing: -0.01em; display: flex; align-items: baseline; gap: 8px; }
.dcard-id .dname .dnum { color: var(--faint); font-weight: 700; font-size: 12.5px; }
.dcard-id .dmeta { font-size: 12.5px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dcard-id .dmeta .mgr { display: inline-flex; align-items: center; gap: 5px; }
.dcard-id .dmeta .mgr i { width: 16px; height: 16px; border-radius: 50%; background: var(--primary-surface-strong); color: var(--primary); display: grid; place-items: center; font-size: 8px; font-weight: 800; font-style: normal; }
.dcard-badges { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.badge.b-shipx { background: var(--slate-surface); color: var(--slate); }

.dcard-items { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--border-soft); border-radius: 10px; padding: 9px 12px; position: relative; }
.dcard-items .icl-row { flex: 1; min-width: 0; }
.dcard-items .l { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); flex: 0 0 auto; }
.dcard-items .t { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dcard-items .more { margin-left: auto; font-size: 11.5px; color: var(--primary); font-weight: 700; flex: 0 0 auto; white-space: nowrap; }
.dcard-items .tip { position: absolute; left: 0; top: calc(100% + 8px); z-index: 30; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 12px 14px; min-width: 280px; opacity: 0; visibility: hidden; transform: translateY(-4px); transition: all .14s; }
.dcard-items:hover .tip { opacity: 1; visibility: visible; transform: none; }
.dcard-items .tip .tl { display: flex; justify-content: space-between; gap: 16px; padding: 5px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.dcard-items .tip .tl:last-child { border-bottom: none; }
.dcard-items .tip .tl .q { color: var(--muted); font-variant-numeric: tabular-nums; }

.dcard-foot { display: flex; align-items: center; gap: 20px; }
.dc-money { display: flex; gap: 22px; flex: 0 0 auto; }
.dc-money .m .l { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
.dc-money .m .v { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 1px; white-space: nowrap; }
.dc-money .m .v.att { color: var(--warning); }
.dc-money .m .v.ok { color: var(--primary); }
.dc-prog { flex: 1; min-width: 60px; }
.dc-prog .track { height: 7px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.dc-prog .track > i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary-grad-a), var(--primary-grad-b)); border-radius: 99px; }
.dc-prog .pl-label { font-size: 11px; color: var(--faint); margin-top: 4px; text-align: right; }

/* ================= TABS (Cloudflare-style underline) ================= */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { padding: 11px 16px; font-weight: 700; font-size: 14px; color: var(--muted); border: none; background: none; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }
.tabs button .muted, .tabs button .tcount { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px; background: var(--bg-2); color: var(--muted); font-size: 11px; font-weight: 800; line-height: 1; vertical-align: middle; }
.tabs button.on .muted, .tabs button.on .tcount { background: var(--primary-surface-strong); color: var(--primary); }
.tabpane { display: none; }
.tabpane.on { display: block; }

/* ================= SECTION HEAD ================= */
.sec-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.sec-head .st { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.sec-head .sd { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.sec-head .grow { flex: 1; }

/* ================= PAYMENT LINK CARD ================= */
.pl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pl { border: 1px solid var(--border); border-radius: var(--r-md); background: #fff; padding: 14px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 12px; }
.pl-head { display: flex; align-items: flex-start; gap: 10px; }
.pl-head .pl-id { font-weight: 800; font-size: 14px; }
.pl-head .pl-date { font-size: 11.5px; color: var(--faint); margin-top: 1px; }
.pl-head .grow { flex: 1; }
.pl-body { display: flex; gap: 14px; align-items: center; }
.pl-qr { width: 72px; height: 72px; border-radius: 10px; border: 1px solid var(--border); background-image: conic-gradient(from 0deg, var(--bg-2) 0 25%, #fff 0 50%, var(--bg-2) 0 75%, #fff 0 100%); background-size: 12px 12px; display: grid; place-items: end center; flex: 0 0 auto; position: relative; overflow: hidden; }
.pl-qr span { position: absolute; bottom: 0; left: 0; right: 0; font-family: ui-monospace, monospace; font-size: 8px; font-weight: 700; text-align: center; background: rgba(255,255,255,.86); color: var(--muted); padding: 1px; }
.pl-info { min-width: 0; }
.pl-info .pl-sum { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.pl-info .pl-url { font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-info .pl-tags { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.mini { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--bg-2); color: var(--muted); white-space: nowrap; }
.mini.prov { background: var(--info-surface); color: var(--info); }
.pl-actions { display: flex; gap: 7px; flex-wrap: wrap; border-top: 1px solid var(--border-soft); padding-top: 12px; }

/* ================= DEAL ITEM CARD (positions) ================= */
.ditem { border: 1px solid var(--border); border-radius: var(--r-md); background: #fff; padding: 14px; box-shadow: var(--shadow-sm); }
.ditem-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.ditem-head .di-name { font-weight: 800; font-size: 14px; }
.ditem-head .grow { flex: 1; }
.ditem-rows { display: grid; grid-template-columns: 1fr; }
.ditem-rows .r { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 7px 0; border-bottom: 1px solid var(--border-soft); }
.ditem-rows .r:last-child { border-bottom: none; }
.ditem-rows .r .rl { color: var(--muted); white-space: nowrap; }
.ditem-rows .r .rv { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ditem-rows .r .rv.mono { font-family: ui-monospace, monospace; font-weight: 600; }

/* compact positions list — deal «Обзор»: имя + приход слева, кол-во/цена и действия в одну
   строку. Действия — иконки (карандаш/корзина) вместо отдельной строки кнопок «Изменить/Удалить»,
   что убирает лишний ряд и экономит высоту, когда позиций несколько. */
.pos-list { display: grid; gap: 8px; }
.pos-row { display: flex; align-items: center; gap: 14px; min-width: 0; border: 1px solid var(--border); border-radius: var(--r-md); padding: 9px 10px 9px 13px; }
.pos-row .pos-main { flex: 1; min-width: 0; }
.pos-row .pos-name { font-weight: 800; font-size: 14px; letter-spacing: -0.01em; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-row .pos-src { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-row .pos-src.faint { color: var(--faint); }
.pos-row .pos-qty { flex: 0 0 auto; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos-row .pos-price { flex: 0 0 auto; font-weight: 800; font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.pos-row .pos-acts { flex: 0 0 auto; display: flex; gap: 2px; }
.pos-row .pos-acts .btn.icon { color: var(--faint); }
.pos-row .pos-acts .btn.icon:hover { color: var(--primary); background: var(--primary-surface); border-color: transparent; }
.pos-row .pos-acts .btn.icon.act-danger:hover { color: var(--error); background: var(--error-surface); }
@media (max-width: 560px) {
  .pos-row { flex-wrap: wrap; gap: 8px 12px; }
  .pos-row .pos-main { flex: 1 1 100%; }
  .pos-row .pos-price { margin-left: auto; }
}

/* payment summary bar */
.pay-sum { display: flex; flex-direction: column; gap: 4px; }
.pay-sum .track { height: 9px; background: var(--bg-2); border-radius: 99px; overflow: hidden; margin: 6px 0; }
.pay-sum .track > i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary-grad-a), var(--primary-grad-b)); border-radius: 99px; }
.pay-sum .pr { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.pay-sum .pr .pl2 { color: var(--muted); white-space: nowrap; }
.pay-sum .pr .pv { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ================= MODULE COMPONENTS ================= */
/* stock meter */
.meter { height: 7px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary-grad-a), var(--primary-grad-b)); }
.meter.low > i { background: linear-gradient(90deg, #e0a32e, var(--warning)); }
.meter.out > i { background: var(--error); }

/* product tile (inventory) */
.tile-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tile { background: #fff; border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-sm); overflow: hidden; cursor: pointer; transition: box-shadow .14s, transform .14s, border-color .14s; }
.tile:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--primary-border); }
.tile .thumb { height: 120px; background-image: repeating-linear-gradient(45deg, var(--bg-2) 0 10px, #fff 10px 20px); display: grid; place-items: center; color: var(--faint); font-family: ui-monospace, monospace; font-size: 11px; border-bottom: 1px solid var(--border); position: relative; }
.tile .thumb .code { position: absolute; top: 8px; left: 8px; font-size: 10px; font-weight: 700; background: rgba(255,255,255,.9); border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; color: var(--muted); }
.tile .thumb .stk { position: absolute; top: 8px; right: 8px; }
.tile .thumb .qe { position: absolute; bottom: 8px; right: 8px; width: 28px; height: 28px; border-radius: 8px; background: rgba(255,255,255,.92); border: 1px solid var(--border); display: grid; place-items: center; font-size: 13px; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity .12s; z-index: 2; }
.tile:hover .thumb .qe { opacity: 1; }
.tile .thumb .qe:hover { color: var(--primary); border-color: var(--primary-border); }
.tile .thumb .qe.mg { right: 42px; }
.tile .tbody { padding: 12px 14px; }
.tile .tname { font-weight: 800; font-size: 14px; line-height: 1.25; }
.tile .tdims { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 10px; }
.tile .tfoot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.tile .tprice { font-weight: 800; font-size: 15px; }
.tile .tstock { font-size: 12px; font-weight: 700; color: var(--muted); }
.tile .meter { margin-top: 8px; }

/* generic list card (purchases / suppliers / preorders / deliveries) */
.lcard { background: #fff; border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-sm); padding: 15px 18px; display: flex; align-items: center; gap: 16px; cursor: pointer; transition: box-shadow .14s, border-color .14s, transform .14s; }
.lcard:hover { box-shadow: var(--shadow-md); border-color: var(--primary-border); transform: translateY(-1px); }
.lcard .lico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: 0 0 auto; background: var(--primary-surface); color: var(--primary); font-weight: 800; }
.lcard .lico svg { width: 20px; height: 20px; }
.lcard .lmain { flex: 1; min-width: 0; }
.lcard .lt { font-weight: 800; font-size: 15px; display: flex; align-items: baseline; gap: 8px; }
.lcard .lt .lnum { font-size: 12px; font-weight: 700; color: var(--faint); }
.lcard .lm { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.lcard .lcol { flex: 0 0 auto; text-align: right; }
.lcard .lcol .l { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
.lcard .lcol .v { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 1px; white-space: nowrap; }

/* inbox (tickets) */
.inbox { display: flex; flex-direction: column; gap: 0; }
.inbox-item { display: flex; align-items: flex-start; gap: 14px; padding: 15px 18px; border-bottom: 1px solid var(--border-soft); cursor: pointer; transition: background .12s; }
.inbox-item:hover { background: var(--primary-surface); }
.inbox-item.unread { background: rgba(15,109,75,0.035); }
.inbox-item .chan { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 auto; }
.inbox-item .chan svg { width: 18px; height: 18px; }
.inbox-item .imain { flex: 1; min-width: 0; }
.inbox-item .itop { display: flex; align-items: center; gap: 8px; }
.inbox-item .iname { font-weight: 800; font-size: 14px; }
.inbox-item .isub { font-size: 12px; color: var(--faint); margin-left: auto; white-space: nowrap; }
.inbox-item .itext { font-size: 13px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-item .itags { display: flex; gap: 6px; margin-top: 7px; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex: 0 0 auto; margin-top: 6px; }
.tk-new { font-size: 10px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; color: #fff; background: var(--primary); border-radius: 99px; padding: 1px 7px; flex: 0 0 auto; }
.chat-li.unread .iname { font-weight: 800; }

/* toggle switch */
.switch { display: inline-grid; width: 42px; height: 25px; border-radius: 99px; background: var(--bg-2); border: 1px solid var(--border); position: relative; cursor: pointer; flex: 0 0 auto; vertical-align: middle; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.switch.on { background: var(--primary); border-color: var(--primary); }
.switch.on::after { transform: translateX(17px); }

/* purchase edit footer */
.pe-foot { display: flex; align-items: center; gap: 16px; padding: 16px 20px; }
.pe-saved-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 4px var(--primary-surface-strong); flex: 0 0 auto; }
.pe-saved-t { font-weight: 700; font-size: 14px; color: var(--text); }
.pe-saved-s { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.pe-period-chip { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--bg-2); border-radius: var(--r-pill); padding: 6px 13px; white-space: nowrap; }

/* purchase management combined card (activity + site publish) */
.pm-card { padding: 0; }
.pm-row { display: flex; align-items: center; gap: 16px; padding: 16px 20px; }
.pm-row + .pm-row { border-top: 1px solid var(--border-soft); }
.pm-info { flex: 1; min-width: 0; }
.pm-t { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.pm-d { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.pm-row .badge, .pm-row .btn, .pm-row .switch { flex: 0 0 auto; }

/* settings rows */
.set-row { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border-soft); }
.set-row:last-child { border-bottom: none; }
.set-row .si { flex: 1; }
.set-row .si .st2 { font-weight: 700; font-size: 14px; }
.set-row .si .sd2 { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* form field (profile/settings) */
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld label { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.fld .inp { height: 42px; border: 1px solid var(--border); border-radius: var(--r-md); padding: 0 13px; font: inherit; font-size: 14px; background: #fff; display: flex; align-items: center; color: var(--text); }
.fld .inp.ph { color: var(--faint); }

/* search results */
.sr-group { margin-bottom: 22px; }
.sr-label { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }

/* ================= REWORK / DETAIL COMPONENTS ================= */
/* order-content chips (deals "Состав") */
.icl-row { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.icl { display: inline-flex; align-items: center; gap: 7px; background: var(--bg); border: 1px solid var(--border-soft); border-radius: 9px; padding: 5px 10px; font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; }
.icl b { font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.icl.more { color: var(--muted); font-weight: 700; background: transparent; border-style: dashed; }

/* meta with dot separators */
.metaline { display: flex; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--muted); }
.metaline > span:not(:first-child)::before { content: '·'; margin: 0 7px; color: var(--faint); }
.metaline .mgr { display: inline-flex; align-items: center; gap: 5px; }
.metaline .mgr i { width: 16px; height: 16px; border-radius: 50%; background: var(--primary-surface-strong); color: var(--primary); display: grid; place-items: center; font-size: 8px; font-weight: 800; font-style: normal; }

/* status bar (inventory item / deal facts) */
.statbar { display: flex; gap: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-sm); overflow: hidden; }
.statbar .si { flex: 1; padding: 14px 18px; border-right: 1px solid var(--border-soft); }
.statbar .si:last-child { border-right: none; }
.statbar .si .l { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.statbar .si .v { font-size: 20px; font-weight: 800; margin-top: 4px; }
.statbar .si .v.ok { color: var(--primary); }
.statbar .si .v.warn { color: var(--warning); }

/* generic modal */
.modal-scrim { position: fixed; inset: 0; background: rgba(16,24,20,0.34); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 100; padding: 24px; }
.modal-scrim.open { display: flex; }
.mcard { width: min(560px, 96vw); max-height: 90vh; overflow-y: auto; background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-pop); border: 1px solid var(--border); }
.mcard-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.mcard-head h3 { margin: 0; font-size: 17px; font-weight: 800; }
.mcard-head .x { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg); display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.mcard-body { padding: 20px 22px; }
.mcard-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); }
.msummary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; background: var(--bg); border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 18px; }
.msummary .mi .l { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }
.msummary .mi .v { font-weight: 800; font-size: 14px; margin-top: 2px; }
.minput { height: 42px; border: 1px solid var(--border); border-radius: var(--r-md); padding: 0 13px; font: inherit; font-size: 14px; background: #fff; width: 100%; display: flex; align-items: center; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; gap: 8px; }
.minput > :first-child { overflow: hidden; text-overflow: ellipsis; }
.minput.ro { background: var(--bg-2); color: var(--muted); }

/* carrier dropdown menu */
.dd { position: relative; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-pop); padding: 6px; min-width: 180px; display: none; z-index: 30; }
.dd.open .dd-menu { display: block; }
.dd-menu button { width: 100%; text-align: left; border: none; background: none; padding: 9px 12px; border-radius: 8px; font: inherit; font-weight: 600; font-size: 14px; color: var(--text); cursor: pointer; display: flex; align-items: center; gap: 9px; }
.dd-menu button:hover { background: var(--primary-surface); }
.dd-menu button:disabled { color: var(--faint); cursor: not-allowed; }
.dd-menu button .tag { margin-left: auto; font-size: 10px; color: var(--faint); }

/* media thumbs grid */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.media-grid .ph { aspect-ratio: 1; border-radius: var(--r-md); border: 1px dashed var(--border); background-image: repeating-linear-gradient(45deg, var(--bg-2) 0 9px, #fff 9px 18px); display: grid; place-items: center; color: var(--faint); font-family: ui-monospace, monospace; font-size: 10px; }
.media-grid .add { aspect-ratio: 1; border-radius: var(--r-md); border: 1px dashed var(--primary-border); background: var(--primary-surface); display: grid; place-items: center; color: var(--primary); cursor: pointer; }
.media-grid .add svg { width: 22px; height: 22px; }

/* event log rows (reposting) */
.evrow { display: grid; grid-template-columns: 140px 1.4fr 120px 1.6fr; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--border-soft); font-size: 13px; align-items: center; }
.evrow.head { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); font-weight: 700; border-bottom: 2px solid var(--border); }
.evrow:last-child { border-bottom: none; }
.evrow .ch { font-weight: 700; }
.evrow .ch span { display: block; font-weight: 500; font-size: 11.5px; color: var(--faint); }
.src-card { cursor: pointer; transition: box-shadow .14s, border-color .14s, transform .14s; }
.src-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary-border); transform: translateY(-2px); }

/* chat (ticket conversation) */
.chat-wrap { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: stretch; }
.chat-list { display: flex; flex-direction: column; height: 600px; max-height: none; overflow: hidden; }
.chat-list .inbox { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.chat-list .inbox, .chat-body { scrollbar-width: thin; scrollbar-color: rgba(15,109,75,.30) transparent; }
.chat-list .inbox::-webkit-scrollbar, .chat-body::-webkit-scrollbar { width: 8px; }
.chat-list .inbox::-webkit-scrollbar-track, .chat-body::-webkit-scrollbar-track { background: transparent; }
.chat-list .inbox::-webkit-scrollbar-thumb, .chat-body::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(15,109,75,.26); border: 2px solid transparent; background-clip: padding-box; }
.chat-list .inbox::-webkit-scrollbar-thumb:hover, .chat-body::-webkit-scrollbar-thumb:hover { background: rgba(15,109,75,.46); background-clip: padding-box; }
.chat-panel { display: flex; flex-direction: column; height: 600px; overflow: visible; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.chat-head .grow { flex: 1; }
.chat-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; background: var(--bg); }
.bubble { max-width: 76%; padding: 11px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.45; box-shadow: var(--shadow-sm); }
.bubble .bmeta { font-size: 11px; color: var(--faint); margin-top: 5px; }
.bubble.in { align-self: flex-start; background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.bubble.out { align-self: flex-end; background: var(--primary-surface-strong); border: 1px solid var(--primary-border); border-bottom-right-radius: 5px; }
.bubble.note { align-self: center; background: var(--warning-surface); border: 1px solid var(--warning-border); font-size: 12.5px; color: var(--warning); max-width: 90%; text-align: center; }
.chat-compose { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); position: relative; }
.chat-compose .ci { flex: 1; height: 44px; border: 1px solid var(--border); border-radius: var(--r-pill); padding: 0 16px; display: flex; align-items: center; color: var(--faint); background: var(--bg); }
.day-sep { align-self: center; font-size: 11px; font-weight: 700; color: var(--faint); background: #fff; border: 1px solid var(--border); border-radius: 99px; padding: 3px 12px; }

/* autocomplete dropdown */
.field { position: relative; }
.ac-pop { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-pop); padding: 6px; z-index: 40; display: none; max-height: 280px; overflow-y: auto; }
.ac-pop.open { display: block; }
.ac-it { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.ac-it:hover, .ac-it.sel { background: var(--primary-surface); }
.ac-it .ai { width: 26px; height: 26px; border-radius: 7px; background: var(--bg-2); color: var(--muted); display: grid; place-items: center; font-size: 11px; font-weight: 800; flex: 0 0 auto; }
.ac-it .an { font-weight: 700; }
.ac-it .am { margin-left: auto; font-size: 12px; color: var(--faint); }
.ac-empty { padding: 12px; text-align: center; color: var(--faint); font-size: 13px; }

/* toast */
.toast-host { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 500; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: #fff; font-size: 13.5px; font-weight: 600; padding: 11px 18px; border-radius: var(--r-pill); box-shadow: var(--shadow-pop); display: flex; align-items: center; gap: 9px; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: none; }
.toast .tdot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; }

/* online indicator */
.online { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--primary); }
.online .od { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 0 rgba(15,109,75,.5); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(15,109,75,.45); } 70% { box-shadow: 0 0 0 6px rgba(15,109,75,0); } 100% { box-shadow: 0 0 0 0 rgba(15,109,75,0); } }

/* steps indicator */
.steps { display: flex; align-items: center; gap: 0; margin-bottom: 22px; }
.steps .step { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 700; color: var(--faint); }
.steps .step .sn { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; font-size: 12px; }
.steps .step.on { color: var(--primary); }
.steps .step.on .sn { border-color: var(--primary); background: var(--primary-surface); color: var(--primary); }
.steps .step.done .sn { border-color: var(--primary); background: var(--primary); color: #fff; }
.steps .bar { flex: 1; height: 2px; background: var(--border); margin: 0 12px; min-width: 24px; }
.steps .bar.done { background: var(--primary); }

/* radio option list (tariffs / pickup points) */
.opt { display: flex; align-items: center; gap: 12px; padding: 13px 15px; border: 1px solid var(--border); border-radius: var(--r-md); cursor: pointer; transition: border-color .12s, background .12s; }
.opt:hover { border-color: var(--primary-border); }
.opt.on { border-color: var(--primary); background: var(--primary-surface); }
.opt .radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); flex: 0 0 auto; display: grid; place-items: center; }
.opt.on .radio { border-color: var(--primary); }
.opt.on .radio::after { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.opt .om { flex: 1; min-width: 0; }
.opt .ot { font-weight: 700; font-size: 14px; }
.opt .od2 { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.opt .op { font-weight: 800; font-size: 15px; white-space: nowrap; }

/* offer document */
.doc-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.doc { background: #fff; border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-md); padding: 40px; }
.doc-top { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 22px; border-bottom: 2px solid var(--text); margin-bottom: 24px; }
.doc-logo { display: flex; align-items: center; gap: 11px; }
.doc-logo .lm { width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(150deg, var(--primary-grad-a), var(--primary-grad-b)); }
.doc-logo .lt { font-weight: 800; font-size: 18px; }
.doc-logo .ls { font-size: 12px; color: var(--muted); }
.doc-meta { text-align: right; font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.doc h2 { font-size: 22px; font-weight: 800; margin: 0 0 6px; }
.doc-table { width: 100%; border-collapse: collapse; margin: 18px 0; }
.doc-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); padding: 8px 10px; border-bottom: 1px solid var(--border); }
.doc-table td { padding: 11px 10px; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.doc-table td.num, .doc-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.doc-total { display: flex; justify-content: flex-end; gap: 40px; font-size: 18px; font-weight: 800; padding-top: 8px; }
.doc-note { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }

/* permissions matrix */
.pmx { width: 100%; }
.pmx .prow { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 8px; align-items: center; padding: 10px 8px; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.pmx .prow.head { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); font-weight: 700; border-bottom: 2px solid var(--border); }
.pmx .prow:last-child { border-bottom: none; }
.pmx .prow .pc { text-align: center; }
.pmx .yes { color: var(--primary); font-weight: 800; }
.pmx .no { color: var(--faint); }
.pmx .ro { color: var(--muted); font-size: 11px; font-weight: 700; }

/* ===== service states (errors / empty / loading) ===== */
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); font-size: 13.5px; font-weight: 600; border: 1px solid; }
.notice .ni { flex: 0 0 auto; margin-top: 1px; }
.notice .ni svg { width: 17px; height: 17px; }
.notice.err { background: var(--error-surface); border-color: rgba(180,35,24,.2); color: var(--error); }
.notice.warn { background: var(--warning-surface); border-color: var(--warning-border); color: var(--warning); }
.notice.info { background: var(--info-surface); border-color: rgba(37,99,235,.2); color: var(--info); }
.notice.ok { background: var(--primary-surface-strong); border-color: var(--primary-border); color: var(--primary); }
.empty-state { display: grid; place-items: center; text-align: center; gap: 12px; padding: 48px 24px; }
.empty-state .ei { width: 56px; height: 56px; border-radius: 16px; background: var(--primary-surface); color: var(--primary); display: grid; place-items: center; }
.empty-state .ei svg { width: 26px; height: 26px; }
.empty-state .et { font-weight: 800; font-size: 16px; }
.empty-state .ed { color: var(--muted); font-size: 13.5px; max-width: 340px; }
.skel { background: linear-gradient(90deg, var(--bg-2) 25%, #f3f6f5 37%, var(--bg-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.skel-line { height: 12px; margin: 8px 0; }
.toast.err .tdot { background: #f87171; }

/* scroll cap for long movement / event lists */
.cap-scroll { max-height: 320px; overflow-y: auto; padding-right: 6px; }
.cap-scroll-sm { max-height: 220px; overflow-y: auto; padding-right: 6px; }

/* chat message actions + closed composer */
.bubble.out { position: relative; }
.bubble .bact { position: absolute; top: -10px; right: 8px; display: none; gap: 4px; }
.bubble.out:hover .bact { display: flex; }
.bubble .bact button { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); background: #fff; color: var(--muted); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow-sm); }
.bubble .bact button svg { width: 13px; height: 13px; }
.bubble .bact button:hover { color: var(--primary); border-color: var(--primary-border); }
.bubble .edited { font-size: 10.5px; color: var(--faint); margin-left: 6px; }
.bubble-edit { display: flex; flex-direction: column; gap: 8px; width: 264px; max-width: 100%; }
.bubble-edit-input { width: 100%; resize: none; border: 1px solid var(--primary-border); border-radius: 9px; padding: 8px 10px; font: inherit; font-size: 13.5px; line-height: 1.45; color: var(--ink); background: #fff; outline: none; overflow: hidden; }
.bubble-edit-input:focus { border-color: var(--primary); }
.bubble-edit-actions { display: flex; justify-content: flex-end; gap: 8px; }
.be-save, .be-cancel { border: none; border-radius: 8px; padding: 6px 13px; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.be-save { background: var(--primary); color: #fff; }
.be-save:hover { filter: brightness(.95); }
.be-cancel { background: #fff; border: 1px solid var(--border); color: var(--muted); }
.be-cancel:hover { color: var(--ink); border-color: var(--muted); }
.chat-closed { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; color: var(--muted); font-size: 13px; font-weight: 600; background: var(--bg-2); border-top: 1px solid var(--border); }
.chat-closed svg { width: 16px; height: 16px; }

/* tickets refinement: filters, search, guest header, receipts, attachments */
.tk-filters { flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 760px; }
.chat-search { display: flex; align-items: center; gap: 9px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--card); flex: 0 0 auto; }
.chat-search svg { width: 17px; height: 17px; color: var(--faint); flex: 0 0 auto; }
.chat-search input { flex: 1; min-width: 0; height: 34px; border: 1px solid var(--border); border-radius: var(--r-pill); padding: 0 14px; font: inherit; font-size: 13px; outline: none; background: var(--bg); color: var(--ink); }
.chat-search input:focus { border-color: var(--primary-border); background: #fff; }
.chat-search input::placeholder { color: var(--faint); }
.tk-headline { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; }
.tk-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-guest { background: var(--bg-2); color: var(--muted); }
.tk-sub { margin-top: 1px; }
.tk-del { flex: 0 0 auto; color: var(--muted); }
.tk-del:hover { color: var(--error); border-color: var(--error-border, color-mix(in oklab, var(--error) 30%, var(--border))); }

/* read receipts */
.brecv { display: inline-flex; align-items: center; margin-left: 5px; vertical-align: middle; }
.brecv svg { width: 15px; height: 15px; stroke-width: 2.4; color: var(--faint); }
.brecv.read svg { color: var(--primary); }

/* sent file bubble */
.bubble.file-bubble { padding: 8px; min-width: 268px; }
.att-file { display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 10px; border-radius: 10px; background: #fff; border: 1px solid var(--primary-border); color: inherit; font: inherit; text-align: left; }
.att-ico { width: 38px; height: 38px; border-radius: 9px; background: var(--primary-surface); color: var(--primary); display: grid; place-items: center; flex: 0 0 auto; }
.att-ico svg { width: 18px; height: 18px; }
.att-meta { flex: 1; min-width: 0; }
.att-name { font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-sz { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.att-dl { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); flex: 0 0 auto; }
.att-dl:hover { background: var(--primary-surface); color: var(--primary); }
.att-dl svg { width: 17px; height: 17px; }
.bubble.file-bubble .bmeta { padding: 0 4px; display: flex; align-items: center; gap: 6px; }
.bubble.file-bubble .edited { margin-left: 0; }

/* pending attachment tray above composer */
.chat-attach-tray { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--border); }
.att-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--primary-border); background: var(--primary-surface); border-radius: 11px; max-width: 320px; }
.att-chip-ico { width: 30px; height: 30px; border-radius: 8px; background: #fff; color: var(--primary); display: grid; place-items: center; flex: 0 0 auto; }
.att-chip-ico svg { width: 15px; height: 15px; }
.att-chip-meta { min-width: 0; }
.att-chip-name { font-size: 12.5px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-chip-sz { font-size: 11px; color: var(--primary); margin-top: 1px; }
.att-chip-x { width: 24px; height: 24px; border-radius: 7px; border: none; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; flex: 0 0 auto; }
.att-chip-x:hover { background: #fff; color: var(--error); }
.att-chip-x svg { width: 14px; height: 14px; }

/* circular composer action buttons */
.tk-compose-btn { width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 1px solid var(--border); background: #fff; color: var(--muted); display: grid; place-items: center; flex: 0 0 auto; }
.tk-compose-btn:hover { color: var(--primary); border-color: var(--primary-border); background: var(--primary-surface); }
.tk-compose-btn svg { width: 19px; height: 19px; }

/* compact status filter dropdown */
.tk-filter-dd { position: relative; }
.tk-filter-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px 0 13px; border-radius: var(--r-pill); border: 1px solid var(--border); background: #fff; font: inherit; font-size: 13.5px; font-weight: 700; color: var(--ink); cursor: pointer; transition: border-color .12s, background .12s; }
.tk-filter-btn:hover { border-color: var(--primary-border); background: var(--primary-surface); }
.tk-filter-ico { display: inline-grid; place-items: center; color: var(--muted); }
.tk-filter-ico svg { width: 16px; height: 16px; }
.tk-filter-label { white-space: nowrap; }
.tk-filter-cnt { font-size: 11px; font-weight: 800; color: var(--primary); background: var(--primary-surface); border: 1px solid var(--primary-border); border-radius: 99px; padding: 0 6px; line-height: 16px; min-width: 18px; text-align: center; }
.tk-filter-caret { display: inline-grid; place-items: center; color: var(--muted); transition: transform .15s; }
.tk-filter-caret svg { width: 16px; height: 16px; }
.tk-filter-btn[aria-expanded="true"] .tk-filter-caret { transform: rotate(180deg); }
.tk-filter-menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 188px; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 14px 36px rgba(20,40,30,.14); padding: 6px; z-index: 50; display: flex; flex-direction: column; gap: 2px; }
.tk-filter-menu[hidden] { display: none; }
.tk-filter-opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border: none; background: transparent; border-radius: 9px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink); cursor: pointer; text-align: left; }
.tk-filter-opt:hover { background: var(--bg-2); }
.tk-filter-opt.is-current { background: var(--primary-surface); color: var(--primary); font-weight: 800; }
.tk-filter-check { display: inline-grid; place-items: center; color: var(--primary); opacity: 0; flex: 0 0 auto; }
.tk-filter-check svg { width: 16px; height: 16px; stroke-width: 2.4; }
.tk-filter-opt.is-current .tk-filter-check { opacity: 1; }

/* quick replies popover */
.tk-quick-pop { position: absolute; bottom: calc(100% + 10px); left: 0; width: 320px; max-width: calc(100vw - 48px); background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 16px 40px rgba(20,40,30,.16); padding: 8px; z-index: 50; display: flex; flex-direction: column; gap: 2px; }
.tk-quick-pop[hidden] { display: none; }
.tk-quick-title { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); padding: 6px 10px 4px; }
.tk-quick-item { display: block; width: 100%; text-align: left; border: none; background: transparent; border-radius: 10px; padding: 9px 11px; font: inherit; font-size: 13px; line-height: 1.4; color: var(--ink); cursor: pointer; }
.tk-quick-item:hover { background: var(--primary-surface); color: var(--primary-strong, var(--primary)); }
.tk-quick-item b { display: block; font-weight: 700; font-size: 12px; color: var(--muted); margin-bottom: 1px; }
.tk-quick-item:hover b { color: var(--primary); }

/* image message bubble + image attachment preview */
.ph-stripe { background-color: var(--bg-2); background-image: repeating-linear-gradient(135deg, rgba(15,109,75,.06) 0 10px, transparent 10px 20px); position: relative; display: grid; place-items: center; }
.ph-stripe::after { content: attr(data-ph); font-family: ui-monospace, monospace; font-size: 11px; letter-spacing: .03em; color: var(--faint); }
.bubble.img-bubble { padding: 6px; max-width: 300px; }
.att-img { display: block; padding: 0; border: 0; border-radius: 11px; overflow: hidden; background: transparent; }
.att-img .ph-stripe { width: 264px; max-width: 100%; height: 178px; border-radius: 11px; }
.att-img-cap { display: flex; align-items: center; gap: 8px; padding: 7px 6px 2px; }
.att-img-cap .att-name { font-size: 12.5px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-img-cap .att-dl { width: 28px; height: 28px; }
.bubble.img-bubble .bmeta { padding: 0 6px 2px; display: flex; align-items: center; gap: 6px; }

/* link preview card */
.bubble.link-bubble { max-width: 340px; }
.att-link { display: flex; align-items: stretch; gap: 0; width: 100%; margin-top: 8px; padding: 0; border: 1px solid var(--primary-border); border-radius: 11px; overflow: hidden; background: #fff; color: inherit; font: inherit; text-align: left; }
.att-link-ico { width: 46px; background: var(--primary-surface); color: var(--primary); display: grid; place-items: center; flex: 0 0 auto; }
.att-link-ico svg { width: 19px; height: 19px; }
.att-link-meta { flex: 1; min-width: 0; padding: 9px 11px; }
.att-link-title { display: block; font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-link-url { display: block; font-size: 11.5px; color: var(--primary); font-family: ui-monospace, monospace; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-link-go { display: grid; place-items: center; padding: 0 12px; color: var(--muted); flex: 0 0 auto; }
.att-link-go svg { width: 16px; height: 16px; }
.att-link:hover .att-link-go { color: var(--primary); }

/* image thumbnail in pending tray */
.att-chip.att-chip-img { padding: 7px 10px 7px 7px; }
.att-thumb { width: 42px; height: 42px; border-radius: 8px; flex: 0 0 auto; }
.att-thumb.ph-stripe::after { font-size: 9px; }

/* summary list rows */
.lrow { display: grid; align-items: center; gap: 12px; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.lrow:last-child { border-bottom: none; }
.tiny { font-size: 12px; }
.mono { font-family: ui-monospace, monospace; }

/* global icon alignment — all injected [data-i] icons centered on text middle */
[data-i] { display: inline-flex; align-items: center; justify-content: center; line-height: 0; flex: 0 0 auto; vertical-align: middle; }
[data-i] > svg { display: block; width: 1em; height: 1em; }
.btn [data-i] > svg { width: 17px; height: 17px; }
.btn.sm [data-i] > svg { width: 15px; height: 15px; }
.nav-item [data-i] > svg, .nav-item .ico > svg { width: 18px; height: 18px; }
.kpi-ico [data-i] > svg, .q-ico [data-i] > svg, .lico [data-i] > svg { width: 18px; height: 18px; }
.badge [data-i] > svg, .mini [data-i] > svg { width: 13px; height: 13px; }
.topbar-btn [data-i] > svg { width: 18px; height: 18px; }
.notice .ni > svg { width: 17px; height: 17px; }

/* clickable affordance — pointer cursor on all interactive elements */
[data-go], [data-open], [data-open-cmd], [data-tab], [data-tab-link], [data-transfer], [data-merge], [data-catadd], [data-delpur], [data-refund], [data-qe], [data-radio], [data-mt], [data-app], [data-pv], [data-pv-go],
.crumbs a, .section-link, .nav-item, .chip, .seg button, .switch, .md-item, .chat-li, .kc, .tile, .dcard, .lcard, .deal-card, .q-row, .src-card, .pg-card, .opt, .tab, .nav-tab { cursor: pointer; }
.crumbs a { text-decoration: none; }

/* views */
.view { display: none; }
.view.active { display: block; }

/* mobile */
.mobbar { display: none; }
.menu-btn { display: none; }
@media (max-width: 920px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; flex-basis: 280px; width: 280px; z-index: 60; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-pop); }
  .sidebar.open { transform: none; }
  .menu-btn { display: grid; }
  .cmd { width: auto; flex: 1; }
  .cmd .kbd { display: none; }
  .user .uname, .user .urole, .user .col { display: none; }
  .user { padding: 4px; }
  .page { padding: 12px 16px 100px; }
  .crumbs { padding: 12px 16px 0; }
  .g4 { grid-template-columns: 1fr 1fr; }
  .g3, .g2 { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .md { grid-template-columns: 1fr; }
  .deal-card { grid-template-columns: 40px 1fr auto; }
  .deal-card .deal-col { display: none; }
  [data-view="pay"] .deal-card, [data-view="payments"] .deal-card { grid-template-columns: 40px 1fr auto !important; }
  .list-head { display: none; }
  /* stacked single-column for chat + offer doc */
  .chat-wrap { grid-template-columns: 1fr !important; }
  .doc-wrap { grid-template-columns: 1fr !important; }
  .doc { padding: 22px !important; }
  /* statbar 2x2 */
  .statbar { flex-wrap: wrap; }
  .statbar .si { flex: 1 1 50%; border-right: none; border-bottom: 1px solid var(--border-soft); }
  /* summary data tables scroll horizontally instead of breaking */
  [data-view="summary"] .card.flush { overflow-x: auto; }
  [data-view="summary"] .lrow, [data-view="summary"] .list-head { min-width: 460px; }
  .mobbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.92); backdrop-filter: blur(20px); border-top: 1px solid var(--border); padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); z-index: 50; }
  .mobbar .mt { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); cursor: pointer; }
  .mobbar .mt svg { width: 22px; height: 22px; }
  .mobbar .mt.active { color: var(--primary); }
  .sidebar-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 55; display: none; }
  .sidebar-scrim.open { display: block; }
  .pl-grid { grid-template-columns: 1fr !important; }
  .ditem-rows { grid-template-columns: 1fr; }
  .dcard-foot { flex-direction: column; align-items: stretch; gap: 10px; }
  .dc-money { justify-content: space-between; }
  .dcard-items .more { display: none; }
  .tabpane .grid { grid-template-columns: 1fr !important; }
  .tile-grid { grid-template-columns: 1fr 1fr; }
  .lcard { flex-wrap: wrap; }
  .lcard .lcol { text-align: left; }
}

/* ================= КП / OFFER TAB ================= */
.offer-gen { text-align: right; }
.offer-gen label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }
.offer-date {
  height: 40px; border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 0 12px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--text);
  background: #fff; font-variant-numeric: tabular-nums;
}
.offer-date:focus { outline: none; border-color: var(--primary-border); }

.offer-strip {
  display: flex; align-items: center; gap: 16px;
  background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: var(--r-md); padding: 16px 18px; margin-top: 16px;
}
.offer-strip .os-main { flex: 1; }
.os-cap { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
.os-ver { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; line-height: 1; }
.os-meta { font-size: 12.5px; color: var(--muted); margin-top: 9px; }
.offer-strip .os-count { text-align: right; padding-left: 20px; border-left: 1px solid var(--border); align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.os-num { font-size: 26px; font-weight: 800; line-height: 1; margin-top: 4px; }

.offer-link { display: flex; align-items: flex-start; gap: 16px; }
.offer-link .ol-info { min-width: 0; }
.offer-url { font-size: 13px; color: var(--text); margin-top: 7px; word-break: break-all; }
.offer-link .head-actions { flex-wrap: wrap; justify-content: flex-end; }

.offer-vers { align-items: stretch; }
.offer-ver {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm);
  padding: 16px; display: flex; flex-direction: column;
}
.offer-ver.is-current { border-color: var(--primary-border); box-shadow: 0 0 0 1px var(--primary-border), var(--shadow-sm); }
.ov-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ov-name { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.ov-created { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.offer-ver .ditem-rows { display: grid; gap: 8px; }
.offer-ver .ditem-rows .r { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.ov-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); margin: 14px 0 8px; }
.ov-actions { display: flex; align-items: center; gap: 8px; margin-top: auto; }

@media (max-width: 760px) {
  .offer-gen { text-align: left; }
  .offer-strip { flex-direction: column; align-items: stretch; gap: 12px; }
  .offer-strip .os-count { text-align: left; padding-left: 0; border-left: none; border-top: 1px solid var(--border); padding-top: 12px; }
  .offer-link { flex-direction: column; }
  .offer-link .head-actions { justify-content: stretch; }
  .offer-link .head-actions .btn { flex: 1; }
}

/* ================= EDGE-STATE PREVIEW ================= */
.state-toggle { display: inline-flex; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 3px; gap: 2px; }
.state-toggle button { border: none; background: none; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 6px 13px; border-radius: var(--r-pill); cursor: pointer; white-space: nowrap; }
.state-toggle button.on { background: #fff; color: var(--primary); box-shadow: var(--shadow-sm); }

.preview-note { display: none; align-items: center; gap: 9px; background: var(--warning-surface); border: 1px solid var(--warning-border); color: var(--warning); border-radius: var(--r-md); padding: 10px 14px; font-size: 13px; font-weight: 600; margin-bottom: 18px; }
.preview-note svg { width: 16px; height: 16px; flex: 0 0 auto; }

/* state-driven show/hide (default state = rich) */
[data-dealstate="fresh"] .preview-note { display: flex; }
[data-dealstate="rich"]  [data-when="fresh"] { display: none !important; }
[data-dealstate="fresh"] [data-when="rich"]  { display: none !important; }

/* КП empty state */
.kp-empty-body { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 42px 24px 38px; }
.kp-empty-ill { width: 64px; height: 64px; border-radius: 18px; background: var(--primary-surface); color: var(--primary); display: grid; place-items: center; margin-bottom: 18px; }
.kp-empty-ill svg { width: 28px; height: 28px; }
.kp-empty-title { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.kp-empty-text { font-size: 13.5px; color: var(--muted); max-width: 460px; margin-top: 8px; line-height: 1.5; text-wrap: pretty; }
.kp-empty-actions { margin-top: 20px; }
.kp-empty-hint { font-size: 12.5px; color: var(--faint); margin-top: 14px; }

/* inline empty state inside a card */
.card-empty { text-align: center; color: var(--muted); font-weight: 700; font-size: 14px; padding: 28px 0; }

/* editable key/value rows (client contacts in deal) */
.kv-edit { border: 1px solid var(--border-soft); border-radius: var(--r-md); overflow: hidden; }
.kv { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-bottom: 1px solid var(--border-soft); }
.kv:last-child { border-bottom: none; }
.kv .kvl { font-size: 12.5px; color: var(--muted); width: 64px; flex: 0 0 auto; }
.kv .kvv { flex: 1; font-size: 13.5px; font-weight: 700; text-align: right; }
.kv .kvb { flex: 0 0 auto; border: none; background: none; cursor: pointer; color: var(--primary); font: inherit; font-size: 12.5px; font-weight: 700; padding: 4px; border-radius: 7px; display: inline-grid; place-items: center; }
.kv .kvb:hover { background: var(--primary-surface); }
.kv .kvb svg { width: 15px; height: 15px; }
.kv .kvb.add { padding: 4px 9px; }

/* delivery setup constructor (fresh deal) */
.setup-form { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px; }
.setup-cap { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin-bottom: 12px; }
.setup-seg { display: flex; margin-top: 2px; }
.setup-seg button { flex: 1; text-align: center; }
.setup-form .field.select { background: #fff; }

/* ================= DELIVERY CREATE (CDEK / Яндекс) ================= */
/* Two-column wizard: form stack (left) + sticky summary (right). */
.dlv-grid { display: grid; grid-template-columns: 1.45fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 1080px) { .dlv-grid { grid-template-columns: 1fr; } }

/* ungrouped section directly on the page background */
.dlv-sec { margin: 6px 2px 0; }
.dlv-sec + .dlv-sec { margin-top: 18px; }
/* top-level ungrouped sections align their content with the card text (cards have 20px padding) */
.dlv-grid > .stack > .dlv-sec { margin-left: 0; margin-right: 0; padding-left: 21px; padding-right: 21px; }
.dlv-lbl { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 12px; }
.dlv-hint { font-size: 12.5px; color: var(--muted); margin: 7px 0 0; line-height: 1.45; text-wrap: pretty; }

/* descriptor row (selected delivery format) */
.dlv-desc { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--border); border-radius: var(--r-md); padding: 13px 16px; background: #fff; margin-top: 12px; }
.dlv-desc .dl { font-size: 13px; color: var(--muted); }
.dlv-desc .dv { font-weight: 800; font-size: 14px; text-align: right; }

/* textarea (final address / courier comment) */
.dlv-area { border: 1px solid var(--border); border-radius: var(--r-md); padding: 11px 13px; font: inherit; font-size: 14px; background: #fff; color: var(--text); width: 100%; min-height: 84px; resize: vertical; }
.dlv-area::placeholder { color: var(--faint); }
.dlv-area:focus { outline: none; border-color: var(--primary-border); }

/* pickup-point toolbar (search + list/map toggle + status pill) */
.dlv-pvz-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dlv-iconbtn { width: 40px; height: 40px; flex: 0 0 auto; border: 1px solid var(--border); border-radius: var(--r-md); background: #fff; color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: all .12s; }
.dlv-iconbtn:hover { border-color: var(--primary-border); }
.dlv-iconbtn.on { border-color: var(--primary); color: var(--primary); background: var(--primary-surface); }
.dlv-iconbtn svg { width: 17px; height: 17px; }

/* payment check-cards + receiver summary (two columns) */
.dlv-pay { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 720px) { .dlv-pay { grid-template-columns: 1fr; } }
.dlv-check { display: flex; gap: 11px; border: 1px solid var(--border); border-radius: var(--r-md); padding: 13px 14px; cursor: pointer; align-items: flex-start; transition: border-color .12s, background .12s; }
.dlv-check + .dlv-check { margin-top: 12px; }
.dlv-pay > .dlv-check + .dlv-check { margin-top: 0; }
.dlv-check:hover { border-color: var(--primary-border); }
.dlv-check.on { border-color: var(--primary); background: var(--primary-surface); }
.dlv-check input { margin: 1px 0 0; width: 17px; height: 17px; accent-color: var(--primary); flex: 0 0 auto; cursor: pointer; }
.dlv-check .ct { font-size: 13.5px; line-height: 1.45; }
.dlv-check .ct b { font-weight: 800; }
.dlv-check .ct .cm { color: var(--muted); }
.dlv-state { display: inline-block; margin-left: 6px; font-size: 10.5px; font-weight: 800; padding: 1px 8px; border-radius: var(--r-pill); background: var(--bg-2); color: var(--faint); vertical-align: middle; }
.dlv-check.on .dlv-state { background: var(--primary-surface-strong); color: var(--primary); }

/* receiver summary panel (Сводка для получателя) */
.dlv-sum { background: var(--bg); border-radius: var(--r-md); padding: 2px 16px; }
.dlv-sum .sr { display: flex; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.dlv-sum .sr:last-child { border-bottom: none; }
.dlv-sum .srl { font-size: 13px; color: var(--muted); }
.dlv-sum .srv { font-weight: 800; font-size: 13.5px; text-align: right; font-variant-numeric: tabular-nums; }
.dlv-sum .sr.total .srl, .dlv-sum .sr.total .srv { font-size: 15px; font-weight: 800; }

/* sticky side summary */
.dlv-side { position: sticky; top: 14px; }
.dlv-side-sum { background: var(--bg); border-radius: var(--r-md); padding: 2px 16px; margin: 14px 0; }
.dlv-side-sum .sr { display: flex; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.dlv-side-sum .sr:last-child { border-bottom: none; }
.dlv-side-sum .srl { font-size: 13px; color: var(--muted); white-space: nowrap; }
.dlv-side-sum .srv { font-weight: 800; font-size: 13.5px; text-align: right; }
.dlv-side-sum .srv .sub { display: block; font-weight: 600; color: var(--muted); font-size: 12.5px; margin-top: 3px; }

/* metrics — vertical key/value list (label left, value right; never cramped) */
.dlv-metrics { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: #fff; }
.dlv-metrics .mc { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 11px 14px; border-bottom: 1px solid var(--border-soft); }
.dlv-metrics .mc:last-child { border-bottom: none; }
.dlv-metrics .mcl { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); white-space: nowrap; flex: 0 0 auto; }
.dlv-metrics .mcv { font-weight: 800; font-size: 13.5px; line-height: 1.3; text-align: right; min-width: 0; }

/* manual position row (no deal selected) */
.dlv-posrow { display: grid; grid-template-columns: 1.7fr 1fr 0.9fr auto; gap: 10px; align-items: end; }
.dlv-posrow + .dlv-posrow { margin-top: 10px; }
@media (max-width: 640px) { .dlv-posrow { grid-template-columns: 1fr 1fr; } }
.dlv-rm { width: 40px; height: 40px; border: 1px solid var(--border); border-radius: var(--r-md); background: #fff; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.dlv-rm:hover { border-color: rgba(180,35,24,.4); color: var(--error); }
.dlv-rm svg { width: 16px; height: 16px; }

/* pickup-point map placeholder (list/map toggle) */
.dlv-map { position: relative; height: 230px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background:
  repeating-linear-gradient(0deg, rgba(18,28,36,.045) 0 1px, transparent 1px 30px),
  repeating-linear-gradient(90deg, rgba(18,28,36,.045) 0 1px, transparent 1px 30px),
  radial-gradient(circle at 30% 30%, rgba(15,109,75,.06), transparent 60%),
  var(--bg); }
.dlv-map .mroad { position: absolute; background: rgba(18,28,36,.07); }
.dlv-map .mp { position: absolute; width: 16px; height: 16px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--primary); border: 2px solid #fff; box-shadow: var(--shadow-sm); cursor: pointer; }
.dlv-map .mp::after { content: ''; position: absolute; left: 4px; top: 4px; width: 4px; height: 4px; border-radius: 50%; background: #fff; }
.dlv-map .mp.alt { background: var(--slate); }
.dlv-map .mcap { position: absolute; left: 12px; bottom: 11px; background: rgba(255,255,255,.92); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 5px 12px; font-size: 12px; font-weight: 700; color: var(--muted); }

/* ================= MANUAL PAYMENTS (Ручные оплаты) ================= */
/* Calmer hierarchy: only the client name is emphasised; method/срок/amount stay quiet.
   Per-row column labels are hidden on desktop — the .list-head already names the columns. */
.manual-payment-card { align-items: center; }
.manual-payment-card .mp-id { font-size: 14px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.manual-payment-card .deal-main .dname { font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em; }
.manual-payment-card .manual-client-link { color: var(--text); cursor: pointer; transition: color .12s; }
.manual-payment-card .manual-client-link:hover { color: var(--primary); }
.manual-payment-card .deal-main .dmeta { margin-top: 3px; }
.manual-payment-card .mp-amount { font-size: 13px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.manual-payment-card .deal-col .l { display: none; }
.manual-payment-card .deal-col .v { font-size: 13.5px; font-weight: 500; color: var(--muted); margin-top: 0; }
.manual-payment-card .deal-col { min-width: 0; }
.manual-payment-card .mp-items { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.manual-payment-card .mp-items .mp-pname { color: var(--text); }
.manual-payment-card .mp-items .mp-pqty { color: var(--faint); }
.manual-payment-card .mp-items .mp-pmore { color: var(--muted); font-weight: 700; }
.manual-payment-card .deal-right { flex-direction: row; align-items: center; justify-content: flex-end; gap: 10px; }
.manual-payment-card .mp-status-badges { display: flex; align-items: center; gap: 6px; }
[data-view="pay"] .list-head > span:last-child, [data-view="payments"] .list-head > span:last-child { text-align: right; }

/* per-row ⋯ actions menu (native <details> dropdown) */
.manual-payment-actions { position: relative; flex: 0 0 auto; }
.manual-payment-actions > summary { list-style: none; cursor: pointer; }
.manual-payment-actions > summary::-webkit-details-marker { display: none; }
.manual-payment-actions[open] > summary { background: var(--primary-surface); color: var(--primary); }
.manual-payment-actions > div { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; display: flex; flex-direction: column; align-items: stretch; gap: 2px; min-width: 210px; background: #fff; border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-pop); padding: 6px; }
.manual-payment-actions > div .btn { justify-content: flex-start; width: 100%; }
.manual-payment-actions > div .btn:hover { background: var(--primary-surface); }

/* create-link screen: keep the readiness statbar compact (short text, not giant KPI blocks) */
.mp-create-stat { box-shadow: none; }
.mp-create-stat .si { padding: 10px 14px; }
.mp-create-stat .si .l { font-size: 10.5px; }
.mp-create-stat .si .v { font-size: 13.5px; font-weight: 700; margin-top: 2px; line-height: 1.25; }
.mp-context { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-md); padding: 13px 15px; }
.mp-ctx-l { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.mp-ctx-v { font-weight: 800; font-size: 14px; margin-top: 4px; }

/* keep the blinking caret / value clear of the native number spinner */
.field input[type="number"] { padding-right: 6px; }

/* ================= CLIENTS (master-detail) ================= */
.clients-master-card .cl-main { min-width: 0; flex: 1; }
.cl-item .cl-row1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cl-item .cl-row1 .nm { font-weight: 700; font-size: 14px; }
.cl-item .cl-id { font-size: 12.5px; color: var(--faint); font-weight: 700; }
.cl-item .mt { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.badge.sm { font-size: 10.5px; padding: 1px 8px; }
.cl-pager { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.cl-page { min-width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.cl-page:hover { background: var(--bg-2); }
.cl-page.on { background: var(--primary); color: #fff; }

/* in-card empty states */
.cl-empty { display: grid; place-items: center; text-align: center; gap: 8px; padding: 30px 20px; }
.cl-empty-ico { width: 52px; height: 52px; border-radius: 14px; background: var(--bg-2); color: var(--muted); display: grid; place-items: center; }
.cl-empty-ico svg { width: 24px; height: 24px; }
.cl-empty-t { font-weight: 800; font-size: 15px; }
.cl-empty-d { font-size: 13px; color: var(--muted); max-width: 380px; line-height: 1.45; text-wrap: pretty; }

/* client deals rows */
.cl-deal { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); }
.cl-deal-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--bg-2); color: var(--muted); display: grid; place-items: center; flex: 0 0 auto; }
.cl-deal-ico svg { width: 18px; height: 18px; }
.cl-deal-main { flex: 1; min-width: 0; }
.cl-deal-t { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cl-deal-sum { text-align: right; flex: 0 0 auto; }
.cl-deal-sum .kpi-label { font-size: 10px; }

/* inventory tiles: reserve line + action buttons (prod parity) */
.tile .tres { font-size: 12px; color: var(--muted); margin-top: 8px; }
.tile .tactions { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.tile .tactions .btn-primary { flex: 1; }
/* keep action row aligned across tiles regardless of the optional «В резерве» line */
.tile { display: flex; flex-direction: column; }
.tile .tbody { display: flex; flex-direction: column; flex: 1 1 auto; }
.tile .tactions { margin-top: auto; padding-top: 12px; }

/* merge-cards modal (V2): plain radios + preview stat tiles */
.opt.plain { border: none; background: none; padding: 6px 0; }
.opt.plain:hover { border-color: transparent; }
.opt.plain .ot { font-weight: 700; font-size: 14px; }
.mg-stats { gap: 10px; }
.mg-stat { border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; }
.mg-stat .l { font-size: 12px; color: var(--muted); }
.mg-stat .v { font-weight: 800; font-size: 18px; margin-top: 4px; }

/* ================= REPOST SOURCE (normalized) ================= */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.breadcrumb .sep { color: var(--faint); }
.breadcrumb [data-go] { cursor: pointer; }
.breadcrumb [data-go]:hover { color: var(--text); }
.breadcrumb .cur { color: var(--text); font-weight: 600; }
.copyfield { display: flex; align-items: center; gap: 4px; }
.copyfield input { flex: 1; min-width: 0; border: none; background: none; }
/* last posts */
.rs-post { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); }
.rs-thumb { width: 44px; height: 44px; border-radius: 10px; background: var(--bg-2); color: var(--faint); display: grid; place-items: center; flex: 0 0 auto; }
.rs-thumb svg { width: 18px; height: 18px; }
.rs-pmain { flex: 1; min-width: 0; }
.rs-pt { font-weight: 700; font-size: 13.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rs-pm { font-size: 12px; color: var(--muted); margin-top: 4px; }
/* publication action rows (normalized from strung "Заменить фото N" links) */
.rs-pub { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); flex-wrap: wrap; }
.rs-pub-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--bg-2); color: var(--muted); display: grid; place-items: center; flex: 0 0 auto; }
.rs-pub-ico svg { width: 17px; height: 17px; }
.rs-pub-main { flex: 0 0 auto; min-width: 120px; }
.rs-pub-t { font-weight: 800; font-size: 14px; }
.rs-pub-s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.rs-photos { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.rs-photos .rs-photo { font-weight: 600; }

/* ================= DEALS — filter header ================= */
.deals-filters { display: flex; flex-direction: column; gap: 14px; margin: 6px 0 24px; }
.deals-filters-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.deals-filters-row .chip { padding: 8px 15px; }
.deals-filters .seg button { padding: 8px 16px; }
.deals-search { width: 340px; max-width: 100%; }
@media (max-width: 760px) { .deals-search { width: 100%; } }

/* deals — filter dropdowns (status / delivery / sort) on one row */
.df-dd { position: relative; }
.df-dd .dd-trigger { font-family: inherit; gap: 7px; padding: 8px 13px; }
.df-dd .dd-trigger svg { width: 15px; height: 15px; color: var(--muted); }
.df-dd .dd-trigger.on svg { color: var(--primary); }
.df-dd .dd-trigger .chev { font-size: 11px; color: var(--muted); transition: transform .15s; }
.df-dd.open .dd-trigger .chev { transform: rotate(180deg); }
.df-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.df-sort-ico { font-size: 14px; color: var(--muted); line-height: 1; }
.df-dd .dd-menu { left: auto; right: 0; min-width: 210px; }
.df-dd .dd-menu button { display: flex; align-items: center; gap: 9px; }
.df-dd .dd-menu button .dd-check { width: 13px; flex: 0 0 13px; color: var(--primary); opacity: 0; }
.df-dd .dd-menu button.is-active { color: var(--primary); }
.df-dd .dd-menu button.is-active .dd-check { opacity: 1; }
.df-dd-sort .dd-menu { min-width: 220px; }
.deals-count { text-align: right; font-size: 13px; color: var(--muted); }
.deals-empty { display: none; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 54px 20px; color: var(--muted); }
.deals-empty svg { width: 30px; height: 30px; color: var(--faint); margin-bottom: 4px; }
.deals-empty .de-t { font-weight: 800; font-size: 15px; color: var(--text); }
.deals-empty .de-s { font-size: 13px; max-width: 320px; }

/* deals kanban cards (prod parity) */
.kc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kc-count { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--bg-2); border-radius: var(--r-pill); padding: 2px 8px; flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.kc-count svg { width: 13px; height: 13px; }
.kc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.kc-sum { font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.kc-empty { color: var(--faint); font-size: 13px; padding: 6px 2px; }

/* keep currency values from wrapping the ₽ */
.pay-total-box .v, .pay-hero-total .v, .offer-doc-total span:last-child { white-space: nowrap; }

/* thicker, full-width payment progress on deal cards */
.dcard .dc-prog .track { height: 7px; }
.dcard-del { color: var(--muted); }
.dcard-del:hover { color: var(--error); }

/* ================= ADDED: topbar logout, dashboard filter, interface picker, text inputs ================= */
.logout-btn { color: var(--muted); }
.logout-btn:hover { color: var(--error); border-color: var(--primary-border); background: var(--error-surface); }

/* dashboard period / status filter bar */
.dash-filter { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.dash-filter .ff { flex: 1; min-width: 180px; }
.dash-filter .ff label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.dash-filter .field.select { height: 46px; }

/* interface version picker (profile / settings) */
.iface { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.iface .opt { border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; cursor: pointer; background: #fff; transition: border-color .12s, background .12s; }
.iface .opt:hover { border-color: var(--primary-border); }
.iface .opt.on { border-color: var(--primary); background: var(--primary-surface); }
.iface .opt b { display: block; font-size: 14px; font-weight: 800; }
.iface .opt span { font-size: 12px; color: var(--muted); }

/* text inputs (profile, forms) */
.tinp { width: 100%; height: 42px; border: 1px solid var(--border); border-radius: var(--r-md); padding: 0 13px; font: inherit; font-size: 14px; background: #fff; color: var(--text); box-sizing: border-box; }
.tinp:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-surface); }
.tinp::placeholder { color: var(--faint); }

@media (max-width: 920px) {
  .dash-filter .ff { flex-basis: 100%; }
  .dash-filter > .btn { width: 100%; }
  .iface { grid-template-columns: 1fr; }
  .view[data-view="dashboard"] .grid { grid-template-columns: 1fr !important; }
  .view[data-view="profile"] > .grid { grid-template-columns: 1fr !important; }
}

/* tickets: unread badge sits on the avatar corner (no row shift) */
.chat-li .chan { position: relative; }
.chat-li .unread-dot { position: absolute; top: -3px; right: -3px; width: 11px; height: 11px; margin: 0; border: 2px solid var(--card); }

/* merge modal: empty preview placeholder (before compute) */
.mg-empty { text-align: center; font-weight: 700; color: var(--muted); padding: 22px; border: 1px dashed var(--border); border-radius: var(--r-md); margin-top: 12px; }

/* chat-head status changer — faithful port of prod .deal-status-changer (ui-v2/components.css) */
.deal-status-changer { position: relative; display: inline-flex; }
.deal-status-changer-trigger { appearance: none; -webkit-appearance: none; border: 0; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; line-height: 1; max-width: 100%; transition: box-shadow .14s, background-color .14s; }
.deal-status-changer-trigger:hover { box-shadow: inset 0 0 0 1px var(--primary-border); }
.deal-status-changer-trigger:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.deal-status-changer-trigger[aria-expanded="true"] { box-shadow: inset 0 0 0 1px var(--primary-border), var(--shadow-sm); }
.deal-status-changer-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deal-status-changer-caret { display: inline-flex; margin-left: 1px; margin-right: -2px; opacity: 0.7; }
.deal-status-changer-caret svg { width: 12px; height: 12px; }
.deal-status-changer-trigger[aria-expanded="true"] .deal-status-changer-caret { transform: rotate(180deg); }
.deal-status-changer-menu { position: absolute; z-index: 60; top: calc(100% + 4px); right: 0; min-width: 184px; max-width: min(260px, 86vw); display: flex; flex-direction: column; gap: 2px; padding: 4px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-pop); }
.deal-status-changer-menu[hidden] { display: none; }
.deal-status-changer-menu.is-up { top: auto; bottom: calc(100% + 4px); }
.deal-status-changer[data-context="detail"] .deal-status-changer-menu { left: 0; right: auto; }
.deal-status-changer-option { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 3px 6px; border: none; border-radius: 8px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: background-color .12s; }
.deal-status-changer-option:hover, .deal-status-changer-option:focus-visible { background: var(--bg-2); outline: none; }
.deal-status-changer-option.is-current { background: var(--primary-surface); }
.deal-status-changer-option .badge { pointer-events: none; }
.deal-status-changer-check { display: inline-flex; flex: 0 0 auto; color: var(--primary); }
.deal-status-changer-check svg { width: 15px; height: 15px; }
.deal-status-changer-option:not(.is-current) .deal-status-changer-check { display: none; }
@media (max-width: 920px) { .deal-status-changer-menu { max-height: calc(100dvh - 150px); overflow-y: auto; } }

@media (max-width: 920px) {
  .chat-list { height: auto; max-height: 320px; }
  .chat-panel { height: 560px; }
}
