:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #66727d;
  --line: #e5e9ec;
  --paper: #f5f7f8;
  --card: #fff;
  --green: #10a968;
  --green-dark: #0b8f5a;
  --rail: #06251f;
  --rail-2: #0b332b;
  --rail-text: #fff;
  --rail-muted: #a7b9b4;
  --bad: #e5484d;
  --bad-bg: #fff1f1;
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 20px rgba(16, 24, 40, 0.04);
  --btn: #eef1f4;
  --soft: #e7f6ee;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.4;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.sprite { position: absolute; width: 0; height: 0; }
.ico { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mark .ico { width: 15px; height: 15px; }
.hidden { display: none !important; }
.auth {
  position: fixed; inset: 0; z-index: 40; height: 100vh; overflow: hidden;
  display: grid; grid-template-columns: minmax(220px, 1fr) minmax(480px, 540px) minmax(220px, 1fr);
  align-items: center; gap: 28px; padding: 28px 36px;
  color: #fff;
  color-scheme: light;
  background:
    radial-gradient(900px 420px at 12% 18%, rgba(16, 185, 129, 0.16), transparent 60%),
    radial-gradient(700px 380px at 88% 80%, rgba(6, 78, 59, 0.9), transparent 55%),
    linear-gradient(160deg, #031f1a 0%, #052a22 48%, #064e3b 100%);
}
.auth::before, .auth::after {
  content: ""; position: absolute; border: 1px solid rgba(16, 185, 129, 0.18); border-radius: 50%;
  pointer-events: none;
}
.auth::before { width: 520px; height: 520px; right: -120px; bottom: -180px; }
.auth::after { width: 280px; height: 180px; right: 8%; top: 12%; border-radius: 80px 80px 80px 24px; transform: rotate(-8deg); }
.auth-side { position: relative; z-index: 1; min-width: 0; }
.auth-pitch h2 { margin: 14px 0 8px; font-size: 34px; line-height: 1.15; letter-spacing: -0.03em; font-weight: 700; }
.auth-pitch h2 span { color: #10b981; }
.auth-kicker { margin: 0; font-weight: 700; font-size: 18px; }
.auth-tag, .auth-lead, .auth-trust { color: #c9d7d2; }
.auth-tag { margin: 4px 0 0; font-size: 13px; }
.auth-lead { margin: 0 0 18px; max-width: 340px; }
.auth-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.auth-checks li, .auth-trust { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.auth-checks i {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(16, 185, 129, 0.16); color: #10b981;
}
.auth-checks .ico, .auth-trust .ico { width: 14px; height: 14px; }
.auth-trust { margin: 28px 0 0; font-size: 13px; }
.auth-card {
  position: relative; z-index: 1; background: #fff; color: #17212b;
  border: 1px solid #e5e7eb; border-radius: 20px; padding: 22px 28px;
  box-shadow: 0 18px 50px rgba(3, 31, 26, 0.28);
  max-height: none; overflow: visible;
}
.auth-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.auth-head strong { display: block; font-size: 15px; }
.auth-head small { color: #66727d; font-size: 12px; }
.auth-pill { margin-left: auto; font-size: 12px; color: #0b8f5a; background: #ecfdf5; border-radius: 999px; padding: 4px 8px; font-weight: 600; }
.auth-panel h1 { margin: 0; font-size: 22px; letter-spacing: -0.03em; }
.auth-sub { margin: 4px 0 10px; color: #66727d; font-size: 13px; }
.auth-field { display: grid; gap: 4px; margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.auth-control {
  display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 8px 0 14px;
  border: 1px solid #dde4e8; border-radius: 12px; background: #fff;
  transition: border-color .18s, box-shadow .18s;
}
.auth-control:focus-within { border-color: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }
.auth-control .ico { position: static; flex: none; color: #98a2b3; width: 16px; height: 16px; }
.auth-control input {
  flex: 1; min-width: 0; width: 100%; height: 100%; border: 0; border-radius: 0;
  background: transparent; padding: 0; font-weight: 600; box-shadow: none;
  color: #17212b; -webkit-text-fill-color: #17212b; caret-color: #17212b;
}
.auth-control input::placeholder {
  color: #98a2b3; -webkit-text-fill-color: #98a2b3; opacity: 1; font-weight: 500;
}
.auth-control input:focus { outline: none; }
.auth-card label, .auth-digits input { color: #17212b; }
.auth-digits input { -webkit-text-fill-color: #17212b; caret-color: #17212b; }
.auth-check input { accent-color: #10b981; }
.auth-eye {
  position: static; flex: none; width: 32px; height: 32px; border: 0; background: transparent;
  color: #66727d; border-radius: 8px; display: grid; place-items: center;
}
.auth-eye:focus-visible { outline: 2px solid #10b981; }
.auth-help, .auth-msg { font-size: 12px; font-weight: 500; color: #66727d; min-height: 0; }
.auth-msg:empty { display: none; }
.auth-msg.bad { color: #ef4444; }
.auth-msg.ok { color: #0b8f5a; }
.auth-msg.bad::before { content: "✕ "; }
.auth-msg.ok::before { content: "✓ "; }
.auth-strength { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: #66727d; }
.auth-bars { display: flex; gap: 4px; }
.auth-bars i { width: 28px; height: 4px; border-radius: 99px; background: #e5e7eb; }
.auth-bars[data-level="1"] i:nth-child(-n+1),
.auth-bars[data-level="2"] i:nth-child(-n+2) { background: #f59e0b; }
.auth-bars[data-level="3"] i:nth-child(-n+3) { background: #10b981; }
.auth-bars[data-level="4"] i { background: #10b981; }
.auth-rules { list-style: none; margin: 2px 0 8px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
.auth-rules li { font-size: 12px; color: #66727d; font-weight: 500; }
.auth-rules li.met { color: #0b8f5a; }
.auth-rules li.met::before { content: "✓ "; }
.auth-cta {
  width: 100%; min-height: 50px; border: 0; border-radius: 12px; background: #10b981; color: #fff;
  font-weight: 700; font-size: 15px; transition: filter .18s, transform .18s;
}
.auth-cta:hover { filter: brightness(1.05); }
.auth-cta:disabled { background: #9ca3af; cursor: default; filter: none; }
.auth-cta:focus-visible { outline: 2px solid #052a22; outline-offset: 2px; }
.auth-secure { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0 0; color: #66727d; font-size: 12px; }
.auth-secure strong, .auth-secure small { display: block; font-weight: 500; }
.auth-secure .ico { color: #10b981; margin-top: 2px; }
.auth-switch { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid #e5e7eb; text-align: center; color: #66727d; font-size: 13px; }
.auth-code { margin: 0 0 8px; font-size: 13px; color: #17212b; font-weight: 600; }
.auth-code b { letter-spacing: 0.18em; color: #0b8f5a; }
.auth-digits { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 0 0 8px; }
.auth-digits input {
  width: 100%; min-width: 0; height: 48px; padding: 0; border: 1px solid #dde4e8; border-radius: 12px;
  text-align: center; font-size: 18px; font-weight: 700; background: #fff;
}
.auth-digits input:focus { outline: none; border-color: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }
.auth-plan-list { display: grid; gap: 8px; margin: 0 0 12px; }
.auth-plan {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  width: 100%; min-height: 48px; padding: 8px 14px; text-align: left;
  border: 1px solid #dde4e8; border-radius: 12px; background: #fff; color: #17212b;
}
.auth-plan strong, .auth-plan small { display: block; }
.auth-plan small { color: #66727d; font-size: 12px; font-weight: 500; }
.auth-plan.is-on { border-color: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }
.auth-plan:focus-visible { outline: 2px solid #10b981; }
.auth-switch button, .auth-link { border: 0; background: none; color: #10b981; font-weight: 700; padding: 0; }
.auth-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 2px 0 12px; font-size: 13px; }
.auth-check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.auth-terms { margin: 2px 0 10px; font-size: 13px; }
.auth-form-error { min-height: 0; margin: 0 0 8px; color: #ef4444; font-size: 13px; font-weight: 600; }
.auth-form-error:empty { display: none; }
.auth-benefits ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.auth-benefits li { display: flex; gap: 10px; align-items: center; }
.auth-benefits strong, .auth-benefits small { display: block; }
.auth-benefits small { color: #c9d7d2; font-size: 12px; }
.auth-more { margin: 28px 0 0; font-size: 22px; line-height: 1.25; font-weight: 600; letter-spacing: -0.03em; }
.auth-more span { color: #10b981; }
@media (max-width: 1100px) {
  .auth { grid-template-columns: 1fr; padding: 16px 18px; overflow: hidden; }
  .auth-side { display: none; }
  .auth-card { width: 100%; max-height: calc(100vh - 32px); }
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.app {
  display: grid;
  grid-template-columns: 250px 1fr;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  background: var(--rail);
  color: var(--rail-text);
  display: flex;
  flex-direction: column;
  padding: 16px 12px 12px;
  min-height: 0;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 14px; }
.brand-mark { margin: 0; font-weight: 700; font-size: 15px; letter-spacing: -0.02em; }
.brand-sub { margin: 2px 0 0; color: var(--rail-muted); font-size: 12px; }
.mark {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; background: var(--green); color: #fff; flex: none;
}
.mark .ico { stroke: none; fill: currentColor; }
.mark.soft { background: #e7f6ee; color: var(--green-dark); }
.mark.soft .ico, .mark.blue .ico, .mark.purple .ico, .mark.gold .ico { stroke: currentColor; fill: none; }
.mark.blue { background: #e8f1fe; color: var(--blue); }
.mark.purple { background: #f3eefe; color: var(--purple); }
.mark.gold { background: #f8f1dc; color: #a16207; }

.nav { display: flex; flex-direction: column; gap: 2px; overflow: auto; min-height: 0; }
.nav-btn {
  display: flex; align-items: center; gap: 10px;
  height: 42px; padding: 0 12px; border: 0; border-radius: 10px;
  background: transparent; color: #e7f3ee; font-weight: 600; text-align: left;
  text-decoration: none;
}
.nav-btn:hover { background: var(--rail-2); color: #fff; }
.nav-btn.active { background: var(--green); color: #fff; box-shadow: 0 6px 16px rgba(16, 169, 104, 0.28); }

.plan {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left; border: 0; border-radius: 14px;
  background: var(--rail-2); color: #fff; padding: 10px; text-decoration: none;
}
.plan.active, .account-btn.active { outline: 2px solid var(--green); outline-offset: 2px; }
.plan strong, .account-btn strong { display: block; font-size: 13px; }
.plan small, .account-btn small, .who span { display: block; color: var(--rail-muted); font-size: 12px; font-weight: 500; }
.plan .chev, .account-btn .chev { margin-left: auto; }
.account-btn .status { margin: 0; font-size: 11px; font-weight: 700; color: var(--rail-muted); }
.account-btn .status[data-state="ready"] { color: #b7ebcf; }
.account-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; margin-top: 8px;
  border: 0; background: transparent; color: #fff; padding: 8px 6px; border-radius: 12px; text-align: left;
  text-decoration: none;
}
.account { position: relative; }
.account-btn:hover { background: var(--rail-2); }
.account-menu {
  position: absolute; left: 8px; right: 8px; bottom: 64px; z-index: 6;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 14px;
  padding: 6px; box-shadow: 0 16px 40px rgba(16, 24, 40, 0.16);
}
.account-menu a, .account-menu button {
  width: 100%; display: flex; align-items: center; gap: 8px;
  background: transparent; border: 0; border-radius: 8px; padding: 9px 10px;
  text-align: left; font-weight: 600; color: var(--ink); text-decoration: none;
}
.account-menu a:hover, .account-menu button:hover { background: #f4f6f8; }
.account-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.account-menu .logout, .account-menu .logout:hover { color: var(--bad); background: transparent; }
.account-menu .logout:hover { background: var(--bad-bg); }
.license { display: flex !important; align-items: center; gap: 6px; color: #b7ebcf !important; }
.license i { width: 7px; height: 7px; border-radius: 99px; background: #3ddc84; display: inline-block; }
.avatar-btn { text-decoration: none; }
.avatar-btn:hover { background: #eef1f4; }
.avatar, .avatar-btn {
  width: 34px; height: 34px; border-radius: 99px; display: grid; place-items: center;
  background: #1d4e89; color: #fff; font-weight: 700; font-size: 12px; flex: none; border: 0;
}
.account-page { display: flex; align-items: center; gap: 14px; }
.avatar.lg { width: 52px; height: 52px; font-size: 16px; }
.page.active.subpage { flex: 1; min-height: 0; overflow: auto; }

.workspace { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--paper); }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 18px 8px; flex: none;
}
.title-block { display: flex; gap: 12px; align-items: center; min-width: 0; }
h1 { margin: 0; font-size: 26px; letter-spacing: -0.035em; line-height: 1.1; font-weight: 700; }
h2 { margin: 0; font-size: 15px; letter-spacing: -0.02em; font-weight: 700; }
.lede, .hint, .detail, .panel-head p { color: var(--muted); }
.lede { margin: 3px 0 0; font-size: 13px; }
.hint { margin: 6px 0 0; font-size: 12px; }
.top-tools { display: flex; align-items: center; gap: 8px; }
.search {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; min-width: 220px;
}
.search input { border: 0; outline: 0; width: 100%; background: transparent; padding: 0; margin: 0; box-shadow: none; }
.search.slim { width: 100%; min-width: 0; margin-top: 8px; }
kbd { font: 11px ui-sans-serif, sans-serif; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 5px; }
.icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  display: grid; place-items: center;
}
.status { margin: 0; font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 99px; background: #98a2ad; }
.status[data-state="ready"]::before { background: var(--green); }
.status[data-state="starting"]::before, .status[data-state="authenticated"]::before, .status[data-state="sending"]::before { background: #f5c451; }
.status[data-state="qr"]::before { background: var(--blue); }
.status[data-state="error"]::before { background: var(--bad); }
.detail { display: none; }

.page { display: none; }
.page.active { display: block; }
.send-page.active {
  display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 0 14px 12px; gap: 10px;
}
.subpage { padding: 8px 22px 32px; overflow: auto; }

.board {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(280px, 0.86fr); gap: 10px;
}
.panel, .card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 12px;
}
.panel { min-height: 0; min-width: 0; display: flex; flex-direction: column; }
.panel.tight { flex: none; }
.side-col { min-height: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; overflow: auto; }
.side-col .grow { flex: 1; }
.panel-head { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.panel-head > div:not(.head-actions) { min-width: 0; }
.panel-head .text-danger { margin-left: auto; white-space: nowrap; }
.head-actions {
  margin-left: auto; display: grid; gap: 6px; flex: none; align-content: start;
}
.head-actions button { min-height: 34px; white-space: nowrap; padding: 6px 12px; }
.head-actions .text-danger { margin-left: 0; }
.panel-head p { margin: 2px 0 0; font-size: 12px; }
.panel-head .count-pill, .count-pill {
  margin-left: auto; background: #e7f6ee; color: var(--green-dark); border-radius: 99px; padding: 3px 8px; font-size: 12px;
}
.seg { display: flex; gap: 4px; background: #f3f5f7; border-radius: 12px; padding: 4px; margin-top: 10px; }
.seg button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; background: transparent; border-radius: 9px; padding: 7px 8px; font-weight: 600; color: var(--muted);
}
.seg button.on, .seg button:hover { background: #e7f6ee; color: var(--green-dark); }
.import-menu {
  display: grid; gap: 4px; margin-top: 8px; max-height: 220px; overflow: auto;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 8px;
}
.import-menu button {
  height: 38px; border: 1px solid var(--line); border-radius: 9px; background: var(--card);
  color: var(--ink); text-align: left; padding: 0 10px; font-size: 13px;
}
.import-menu button:hover { background: #e7f6ee; color: var(--green-dark); }
.import-menu p { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.phone-entry { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; align-items: end; margin-top: 8px; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

label { display: block; font-weight: 600; font-size: 12px; margin-top: 8px; color: var(--ink); }
textarea, input[type="text"], input[type="number"], input[type="date"], input[type="time"], input[type="search"], input[type="email"], input[type="password"], select {
  width: 100%; margin-top: 4px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--card);
}
.auth-control input[type="text"],
.auth-control input[type="password"],
.auth-control input[type="email"] {
  width: 1px; flex: 1; min-width: 0; height: 100%; margin: 0; border: 0; border-radius: 0;
  padding: 0 8px; background: transparent; box-shadow: none; appearance: none;
}
.auth-digits input[type="text"] {
  width: 100%; min-width: 0; height: 48px; margin: 0; padding: 0; border: 1px solid #dde4e8;
  border-radius: 12px; background: #fff; text-align: center; font-size: 18px; font-weight: 700; appearance: none;
}
textarea { resize: vertical; min-height: 92px; }
select { appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2366727d' d='M1 1.2 6 6.2 11 1.2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.inline { display: flex; align-items: center; gap: 6px; margin: 0; }
.inline select { width: auto; margin: 0; }

.grid-wrap {
  margin-top: 8px; flex: 1; min-height: 120px; overflow: auto;
  border: 1px solid #b7c2cc; border-radius: 10px; background: #fff;
}
table.sheet { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 13px; }
.sheet th, .sheet td { border: 1px solid #b7c2cc; background: #fff; }
.sheet th {
  position: sticky; top: 0; z-index: 1; background: #eef2f5; color: #3e4a56;
  text-align: left; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; padding: 7px 8px;
}
.sheet td { padding: 0; height: 34px; }
.sheet tr:hover td { background: #f7fbf8; }
.sheet input, .sheet select {
  width: 100%; height: 34px; margin: 0; border: 0; border-radius: 0; background: transparent;
  box-shadow: none; padding: 0 8px; appearance: auto; background-image: none;
}
.sheet select { padding-right: 4px; }
.sheet input:focus, .sheet select:focus { outline: 2px solid var(--green); outline-offset: -2px; background: #fff; }
.sheet .row-c, .sheet .row-x { width: 36px; text-align: center; }
.sheet .row-c input { width: 16px; height: 16px; margin: 0; }
.row-x button, .sheet .row-x button {
  border: 0; background: transparent; color: #8b949e; padding: 4px 6px; border-radius: 6px;
}
.sheet .row-x button:hover { background: var(--bad-bg); color: var(--bad); }
.panel-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.foot-actions { display: flex; gap: 6px; align-items: center; }
.text-danger {
  display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; color: var(--bad); font-weight: 700; padding: 4px;
}
.columns { max-height: 90px; overflow: auto; background: #f7f8fa; border-radius: 10px; padding: 6px 8px; margin-top: 6px; }
.columns label { font-weight: 500; margin: 4px 0; }

.composer-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.toolbar, .actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.toolbar { margin-top: 8px; }
.keys { display: flex; gap: 6px; }
.keys button {
  background: #ecfdf5 !important; color: #0b8f5a !important;
  border: 1px solid #a7f3d0 !important; border-radius: 999px !important;
  padding: 6px 10px !important; font-size: 12px;
}
.actions { margin-top: 8px; }
button, .seg button { font-weight: 600; }
.workspace button, .subpage button, .panel button, .card button {
  border: 0; border-radius: 10px; padding: 8px 10px; background: var(--btn); color: var(--ink);
}
.primary { background: var(--green) !important; color: #fff !important; }
.primary:hover { background: #059669 !important; }
.ghost { background: var(--btn) !important; color: var(--ink) !important; border: 1px solid var(--line) !important; }
.danger { background: var(--bad-bg) !important; color: var(--bad) !important; }
.text-btn { background: transparent !important; color: var(--green-dark) !important; padding-left: 0 !important; }
.tiny { padding: 6px 10px !important; margin-left: auto; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.media-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.media-tiles button {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; font-size: 11px; background: #f4f6f8;
}
.media-tiles button:hover { background: #e7f6ee; }
.emoji-box {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin-top: 8px;
  padding: 8px; background: #fff; border: 1px solid #dde4e8; border-radius: 12px;
}
.emoji-box button { padding: 6px 0; background: #f5f7f8; font-size: 18px; line-height: 1; }
.emoji-box button:hover { background: #ecfdf5; }
.preview { margin-top: 10px; background: #efeae2; border: 1px solid #e5e7eb; border-radius: 16px; overflow: hidden; }
.preview-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: #fff; background: #052a22; padding: 8px 12px; }
.preview-head span, .wa-label { display: inline-flex; align-items: center; gap: 4px; }
.preview-head .ico { color: #fff; }
.bubble { margin: 12px 12px 12px auto; background: #d9fdd3; border-radius: 12px 12px 4px 12px; padding: 8px 10px 4px; max-width: 88%; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06); }
.bubble p { margin: 0; white-space: pre-wrap; font-size: 14px; line-height: 1.45; color: #17212b; }
.bubble strong { font-weight: 700; }
.bubble em { font-style: italic; }
.bubble a { color: #0b8f5a; font-weight: 600; text-decoration: underline; word-break: break-word; }
.bubble small { display: block; text-align: right; color: #667781; font-size: 11px; margin-top: 2px; }
.send-cta { width: 100%; min-height: 48px; margin-top: 10px; display: flex; justify-content: center; align-items: center; gap: 8px; padding: 12px 16px !important; font-size: 15px; box-shadow: 0 8px 16px rgba(16, 169, 104, 0.22); }
.actions button, #use-template, .choice label { min-height: 42px; }
#message { min-height: 140px; line-height: 1.55; padding: 14px; }
.sheet .row-c input { accent-color: var(--green); }
.phone-cell { display: flex; align-items: center; }
.phone-cell select { width: 92px; flex: none; border-right: 1px solid #b7c2cc; }
.phone-cell input { flex: 1; min-width: 0; }
.row-x { position: relative; width: 44px; text-align: center; }
.row-delete {
  width: 28px; height: 28px; padding: 0 !important; border-radius: 8px !important;
  background: transparent !important; color: #ef4444 !important;
  display: inline-grid; place-items: center;
}
.row-delete:hover { background: #fff1f1 !important; }
.row-menu {
  position: absolute; right: 4px; top: 32px; z-index: 3; width: 180px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.12);
}
.more { letter-spacing: 1px; }
.drop { margin-top: 8px; border: 1px dashed #b7c9c2; border-radius: 12px; padding: 10px; background: #f7fbf8; }
.drop p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.thumbs { display: flex; gap: 8px; overflow-x: auto; margin-top: 8px; }
.thumb, .add-tile {
  position: relative; width: 72px; height: 72px; flex: none; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; overflow: hidden;
  display: grid; place-items: center; font-size: 11px; padding: 4px; text-align: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; padding: 0;
  border-radius: 99px; background: #fff; color: var(--bad); font-size: 12px;
}
input:focus, textarea:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(16, 169, 104, 0.15); }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.choice label {
  margin: 0; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--btn); color: var(--ink); border-radius: 10px; padding: 8px; cursor: pointer;
}
.choice label:has(input:checked) { background: #e7f6ee; color: var(--green-dark); }
.choice input { width: auto; margin: 0; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.delay { display: flex; align-items: center; gap: 8px; }
.delay input { width: 72px; margin: 0; }
.log, .menu, .agenda { list-style: none; margin: 6px 0 0; padding: 0; }
.log { max-height: 90px; overflow: auto; }
.log li, .agenda li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.menu li { padding: 2px 0; }
.menu button { width: 100%; text-align: left; background: transparent !important; }
.menu button.active, .menu button:hover { background: var(--soft) !important; color: var(--ink) !important; }
.list-pick { display: grid; gap: 4px; margin-top: 8px; font-size: 13px; font-weight: 650; }
.list-add { display: grid; grid-template-columns: 96px 1fr 1fr auto; gap: 8px; align-items: end; margin: 8px 0; }
.people { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; max-height: 320px; overflow: auto; }
.people li { display: grid; grid-template-columns: 96px 1fr 1fr auto; gap: 6px; align-items: center; }
.people .row-delete { width: 36px; height: 36px; padding: 0; }
.log li.sent { color: var(--green-dark); }
.log li.failed { color: var(--bad); }
.banner { margin: 0 14px 8px; padding: 8px 10px; border-radius: 10px; font-weight: 600; }
.banner.bad { background: var(--bad-bg); color: #9f1239; }
.banner.warn { background: #fffaeb; color: #7a5b12; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; box-shadow: var(--shadow);
}
.stat strong { display: block; font-size: 28px; color: var(--ink); letter-spacing: -0.04em; }
.stat span { color: var(--muted); font-size: 13px; }
.stat:hover strong { color: #111; }
.layout { display: grid; grid-template-columns: 260px 1fr; gap: 12px; }
.layout .card { margin: 0; }
.card { margin-top: 12px; }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.question { background: #f6f8f7; border-radius: 12px; padding: 10px; margin-top: 10px; }
.question-head { display: flex; justify-content: space-between; align-items: center; }
.question h3 { margin: 0; font-size: 14px; }
.switch-line { display: flex; align-items: center; gap: 8px; font-weight: 700; margin: 8px 0; }
#reply-summary, #send-review { white-space: pre-line; }
.reply-rule { display: grid; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.reply-type-head { display: flex; gap: 8px; align-items: center; }
.reply-type-head input { flex: 1; font-weight: 600; }
.question > .ghost { margin-top: 8px; }
.weekdays, .month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.weekdays { margin-top: 10px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.day {
  min-height: 72px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-align: left; padding: 6px;
  display: flex; flex-direction: column; align-items: flex-start; color: #111; font-weight: 700;
}
.day .num { width: 24px; height: 24px; border-radius: 99px; display: grid; place-items: center; }
.day.outside { color: #a3abb6; }
.day.selected { background: var(--rail); color: #fff; }
.day.selected .num { background: var(--green); }
.day.has:not(.selected) .num { background: #e7f6ee; color: var(--green-dark); }
.day small { color: #111; font-size: 10px; white-space: pre-line; font-weight: 600; }
.day.selected small, .day.selected:hover small { color: #fff; }
.day:hover { background: #e7f6ee; color: #111; }
.day.selected:hover { background: var(--rail); color: #fff; }
.agenda .when, .agenda .meta { display: block; }
.agenda .meta { color: var(--muted); font-weight: 500; }
.qr-wrap { display: flex; gap: 12px; }
.qr-wrap img { width: 160px; height: 160px; background: #fff; border-radius: 12px; }
.settings-card { max-width: 560px; }
.seg button { background: transparent; color: var(--muted); }
.seg button.on, .seg button:hover { background: #e7f6ee; color: var(--green-dark); }
.panel-foot button { padding: 6px 8px; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.sheet input:focus-visible, .sheet select:focus-visible { outline-offset: -2px; }

@media (max-width: 1180px) {
  .app { height: auto; min-height: 100vh; overflow: auto; display: block; }
  .sidebar { height: auto; position: sticky; top: 0; z-index: 4; }
  .nav { display: grid; grid-template-columns: repeat(3, 1fr); }
  .workspace { overflow: visible; }
  .send-page.active { height: auto; overflow: visible; }
  .board, .stats, .layout, .phone-entry, .media-tiles, .list-add, .people li { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: stretch; }
  .search { min-width: 0; }
}
@media (max-width: 720px) {
  .nav { grid-template-columns: repeat(2, 1fr); }
  .nav-btn { height: 38px; font-size: 13px; }
}

.user-chip {
  display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 8px 0 4px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink);
}
.user-chip .chev { color: var(--muted); }
.top-user { text-align: left; }
.top-user strong, .top-user small { display: block; line-height: 1.15; }
.top-user strong { font-size: 13px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-user .status { margin: 0; font-size: 11px; font-weight: 700; color: var(--muted); }
.top-user .status[data-state="ready"] { color: var(--green-dark); }
.avatar.has-photo { color: transparent; background-size: cover; background-position: center; }

.page.active.settings-page {
  display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 14px;
  flex: 1; min-height: 0; overflow: hidden; padding: 0 18px 14px;
}
.set-nav, .set-main { min-height: 0; overflow: auto; }
.set-nav {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 8px; display: flex; flex-direction: column; gap: 2px;
}
.set-nav button {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 42px;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink);
  font-weight: 600; text-align: left; padding: 0 10px;
}
.set-nav button.on { background: var(--soft); color: var(--green-dark); }
.set-intro h2 { font-size: 22px; }
.set-intro p, .set-head p, .card > p { color: var(--muted); margin: 4px 0 0; }
.set-head, .profile-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.profile-id { display: flex; gap: 16px; align-items: center; }
.avatar.xl { width: 84px; height: 84px; font-size: 28px; }
.company-line { margin: 2px 0 0; color: var(--muted); font-weight: 600; }
.status-line { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; font-weight: 700; color: var(--green-dark); }
.status-line i { width: 8px; height: 8px; border-radius: 99px; background: var(--green); }
#wa-state[data-state="off"] { color: var(--bad); }
#wa-state[data-state="off"] i { background: var(--bad); }
#wa-state[data-state="wait"] { color: #a16207; }
#wa-state[data-state="wait"] i { background: #f4b740; }
.profile-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; min-width: 240px; }
.profile-facts li { display: flex; align-items: center; gap: 8px; }
.profile-facts small, .fact-list span { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
.profile-facts strong, .fact-list strong { font-size: 14px; }
.ok { color: var(--green-dark); }
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.set-main .set-grid input, .set-main .set-grid select, .set-main .locked-field, .phone-join { min-height: 48px; font-size: 14px; }
.set-main .primary, .set-main .ghost { min-height: 44px; padding: 0 16px; border-radius: 12px; }
.locked-field, .phone-join {
  display: flex; align-items: center; gap: 8px; margin-top: 4px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--soft); padding: 0 10px;
}
.phone-join { background: var(--card); }
.locked-field input, .phone-join input, .phone-join select {
  border: 0; margin: 0; background: transparent; box-shadow: none; height: 46px; font-size: 14px;
}
.phone-join select { width: 84px; flex: none; padding-right: 22px; }
.phone-join input[type="tel"] { width: 1px; flex: 1; min-width: 0; padding: 0 8px; }
.locked-field input { color: var(--muted); cursor: default; caret-color: transparent; }
.fact-list { list-style: none; margin: 8px 0 0; padding: 0; }
.fact-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.theme-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
button.theme-card {
  position: relative; text-align: left; border: 1px solid var(--line); border-radius: 16px;
  background: var(--card); color: var(--ink); padding: 10px; min-height: 168px;
  display: flex; flex-direction: column; align-items: stretch; gap: 10px;
}
button.theme-card.on { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.theme-copy { display: flex; flex-direction: column; gap: 2px; padding-right: 22px; }
.theme-copy strong { font-size: 14px; }
.theme-copy small, .theme-card small { color: var(--muted); font-size: 12px; font-weight: 500; }
.theme-check {
  position: absolute; top: 12px; right: 12px; width: 18px; height: 18px; border-radius: 99px;
  border: 1.5px solid var(--line); background: transparent;
}
button.theme-card.on .theme-check { border-color: var(--green); background: var(--green); }
button.theme-card.on .theme-check::after {
  content: ""; position: absolute; left: 5px; top: 2px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.swatch {
  height: 78px; border-radius: 10px; padding: 8px; display: grid; grid-template-columns: 18px 1fr; gap: 6px;
  border: 1px solid transparent;
}
.swatch i { grid-row: span 2; border-radius: 4px; }
.swatch b { height: 8px; border-radius: 99px; align-self: center; }
.swatch b:last-child { width: 70%; }
.swatch.is-light { background: #f4f7f6; border-color: #e3e9e6; }
.swatch.is-light i { background: #06251f; }
.swatch.is-light b { background: #d5e0da; }
.swatch.is-dark { background: #0c1613; border-color: #1e332c; }
.swatch.is-dark i { background: #10b981; }
.swatch.is-dark b { background: #243832; }
.swatch.is-system { background: linear-gradient(90deg, #f4f7f6 0 50%, #0c1613 50% 100%); border-color: #2c403a; }
.swatch.is-system i { background: linear-gradient(180deg, #06251f 50%, #10b981 50%); }
.swatch.is-system b { background: linear-gradient(90deg, #d5e0da 50%, #243832 50%); }
.lang-card { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.lang-card label { margin: 0; min-width: min(280px, 100%); }
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line); margin: 0;
}
.switch-row small { display: block; color: var(--muted); font-weight: 500; }
.switch-row input { width: 18px; height: 18px; margin: 0; }
.danger-card { border-color: #fecaca; }
.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  overflow: hidden;
  background: rgba(3, 31, 26, 0.45); padding: 20px;
}
.modal-card {
  width: min(480px, 100%); max-height: calc(100vh - 40px); overflow: auto;
  background: var(--card); color: var(--ink); border-radius: 16px; padding: 18px; box-shadow: var(--shadow);
}
.modal-card h2 { font-size: 18px; }
body, .panel, .card, .workspace, .search, .icon-btn, .user-chip, .set-nav {
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e7eef2;
  --muted: #9aa8b2;
  --line: #2c403a;
  --paper: #0c1613;
  --card: #14241f;
  --btn: #243832;
  --soft: #14362c;
  --bad-bg: #3a1717;
  --green-dark: #6ee7b7;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
html[data-theme="dark"] .media-tiles button,
html[data-theme="dark"] .emoji-box,
html[data-theme="dark"] .emoji-box button,
html[data-theme="dark"] .search,
html[data-theme="dark"] .icon-btn { background: var(--btn); color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] .keys button { background: #14362c !important; color: #6ee7b7 !important; border-color: #1f6b4a !important; }
html[data-theme="dark"] .mark.gold { background: #3a3014; color: #f4b740; }
html[data-theme="dark"] .mark.blue { background: #16283f; color: #93c5fd; }
html[data-theme="dark"] .mark.purple { background: #2a2140; color: #c4b5fd; }
html[data-theme="dark"] .set-nav button.on,
html[data-theme="dark"] .seg button.on,
html[data-theme="dark"] .count-pill,
html[data-theme="dark"] .mark.soft,
html[data-theme="dark"] .choice label:has(input:checked) { background: #14362c; color: #6ee7b7; }
html[data-theme="dark"] button.theme-card,
html[data-theme="dark"] button.theme-card.on { background: var(--card); color: var(--ink); }
html[data-theme="dark"] .columns,
html[data-theme="dark"] .drop,
html[data-theme="dark"] .reply-type,
html[data-theme="dark"] .thumb { background: var(--btn); color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] .stat:hover strong,
html[data-theme="dark"] .day small,
html[data-theme="dark"] .day:hover { color: var(--ink); }
html[data-theme="dark"] .day:hover,
html[data-theme="dark"] .day.has:not(.selected) .num { background: #14362c; color: #6ee7b7; }
html[data-theme="dark"] .sheet th,
html[data-theme="dark"] .sheet td,
html[data-theme="dark"] .grid-wrap { border-color: var(--line); }
html[data-theme="dark"] .danger-card { border-color: #7f1d1d; }
html[data-theme="dark"] .banner.warn { background: #3a3014; color: #f4b740; }
html[data-theme="dark"] .sheet th { background: #1b2e28; color: var(--ink); }
html[data-theme="dark"] .sheet td, html[data-theme="dark"] .grid-wrap, html[data-theme="dark"] .seg { background: var(--card); color: var(--ink); }
html[data-theme="dark"] .sheet tr:hover td { background: #1b2e28; }
html[data-theme="dark"] .locked-field { background: #1b2e28; }
html[data-theme="dark"] .day small, html[data-theme="dark"] .day:hover { color: var(--ink); }
html[data-theme="dark"] .account-menu a:hover, html[data-theme="dark"] .account-menu button:hover { background: #1b2e28; }
html[data-theme="dark"] .preview { background: #0b141a; border-color: var(--line); }
html[data-theme="dark"] .bubble { background: #005c4b; }
html[data-theme="dark"] .bubble p,
html[data-theme="dark"] .bubble small { color: #e7f6ee; }
html[data-theme="dark"] .bubble a { color: #b7f7d8; }
html[data-theme="dark"] .question,
html[data-theme="dark"] .columns,
html[data-theme="dark"] .drop { background: #1b2e28; color: var(--ink); }
html[data-theme="dark"] .day { background: var(--card); color: var(--ink); }
html[data-theme="dark"] .day.outside { color: #6b7c76; }
html[data-theme="dark"] .day:hover { background: #14362c; color: var(--ink); }
html[data-theme="dark"] .sheet input:focus,
html[data-theme="dark"] .sheet select:focus { background: #1b2e28; color: var(--ink); }
html[data-theme="dark"] .row-menu { background: var(--card); color: var(--ink); }
html[data-theme="dark"] .row-delete:hover { background: #3a1717 !important; }
html[data-theme="dark"] .thumb,
html[data-theme="dark"] .add-tile { background: var(--btn); color: var(--ink); }
html[data-theme="dark"] .thumb button { background: #1b2e28; color: var(--bad); }
html[data-theme="dark"] .seg { background: #1b2e28; }
html[data-theme="dark"] .import-menu button:hover,
html[data-theme="dark"] .media-tiles button:hover,
html[data-theme="dark"] .emoji-box button:hover { background: #14362c; color: #6ee7b7; }
html[data-theme="dark"] .crm-lists,
html[data-theme="dark"] .crm-card,
html[data-theme="dark"] .crm-empty,
html[data-theme="dark"] .crm-drawer,
html[data-theme="dark"] .crm-examples,
html[data-theme="dark"] .crm-menu,
html[data-theme="dark"] .crm-drop,
html[data-theme="dark"] .an-kpis article,
html[data-theme="dark"] .an-card,
html[data-theme="dark"] .an-empty,
html[data-theme="dark"] #page-contacts input,
html[data-theme="dark"] #page-contacts select,
html[data-theme="dark"] #page-contacts textarea,
html[data-theme="dark"] .an-bar select,
html[data-theme="dark"] .an-bar input,
html[data-theme="dark"] .an-inline select { border-color: var(--line); }
html[data-theme="dark"] .tpl-thumb { background: #0b141a; }
html[data-theme="dark"] .tpl-mini { background: #005c4b; color: #e7f6ee; }
html[data-theme="dark"] .workspace input,
html[data-theme="dark"] .workspace select,
html[data-theme="dark"] .workspace textarea,
html[data-theme="dark"] .subpage input,
html[data-theme="dark"] .subpage select,
html[data-theme="dark"] .subpage textarea {
  color: var(--ink); background-color: var(--card); border-color: var(--line);
}
html[data-theme="dark"] .sheet input,
html[data-theme="dark"] .sheet select,
html[data-theme="dark"] .phone-cell input,
html[data-theme="dark"] .search input { background-color: transparent; }

@media (max-width: 1180px) {
  .page.active.settings-page { display: block; overflow: visible; }
  .set-nav { flex-direction: row; overflow: auto; margin-bottom: 12px; }
  .set-nav button { width: auto; white-space: nowrap; }
  .profile-hero, .set-grid { display: grid; grid-template-columns: 1fr; }
  .top-user { display: none; }
}
@media (max-width: 860px) {
  .theme-grid, .lang-card { display: grid; grid-template-columns: 1fr; }
}

#page-contacts.page.active {
  flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: 0 16px 12px;
}
#page-contacts .hint { margin: 4px 0 0; font-size: 12px; line-height: 1.35; }
.crm { flex: 1; min-height: 0; display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 12px; }
.crm-lists, .crm-card, .crm-empty, .crm-drawer, .crm-examples {
  background: var(--card); border: 1px solid #dde4e8; border-radius: 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.crm-lists { display: flex; flex-direction: column; min-height: 0; padding: 14px; }
.crm-list-head, .crm-work-head, .crm-table-head, .crm-pager, .crm-head-actions, .crm-tools {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.crm-list-head h2, .crm-table-head h2, .crm-paste h3, .crm-drop h3 { margin: 0; font-size: 16px; }
.crm-work-head h2 { margin: 0; font-size: 18px; }
.crm-work-head p, .crm-table-head p { margin: 2px 0 0; font-size: 13px; }
#page-contacts .crm-head-actions button,
#page-contacts .crm-tools button,
#page-contacts .crm-pager button,
#page-contacts .crm-bulkbar button,
#page-contacts .crm-list-head .primary {
  height: 38px; min-height: 38px; padding: 0 12px; font-size: 13px; border-radius: 9px;
}
.crm h2, .crm h3 { color: var(--ink); }
.crm-list { list-style: none; margin: 8px 0; padding: 0; overflow: auto; flex: 1; display: grid; align-content: start; gap: 2px; }
.crm-list li { display: grid; grid-template-columns: 1fr auto; align-items: center; position: relative; }
.crm-row {
  display: flex !important; align-items: center; gap: 8px; width: 100%; min-height: 46px; text-align: left;
  background: transparent !important; color: var(--ink) !important; border-radius: 10px !important; padding: 4px 8px !important;
  font-size: 14px;
}
.crm-row strong, .crm-row small { display: block; line-height: 1.2; }
.crm-row small { color: var(--muted); font-weight: 600; font-size: 12px; }
.crm-row.on { background: var(--soft) !important; color: var(--green-dark) !important; }
.crm-row.on small { color: var(--green-dark); }
.crm-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--soft); color: var(--green-dark); }
.crm-ico .ico { width: 18px; height: 18px; }
.crm-more { width: 32px; height: 32px; padding: 0 !important; background: transparent !important; color: var(--muted) !important; font-size: 14px; }
.crm-none { color: var(--muted); font-size: 13px; padding: 8px; }
.crm-total { border-top: 1px solid var(--line); padding-top: 8px; display: grid; gap: 1px; }
.crm-total span, .crm-total small { color: var(--muted); font-size: 12px; }
.crm-total strong { font-size: 22px; letter-spacing: -0.03em; line-height: 1.1; }
.crm-bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 4px 0; }
.crm-bar i { display: block; height: 100%; width: 0; background: #10b981; }
.crm-work { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.crm-head-actions { flex-wrap: wrap; justify-content: flex-end; }
.crm-card { padding: 14px 16px; }
.crm-table-card { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#crm-table-wrap { min-height: 0; display: flex; flex-direction: column; flex: 1; }
.crm-seg { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--paper); margin-bottom: 10px; }
.crm-seg button { flex: 1; height: 36px; min-height: 36px; font-size: 13px; border-radius: 8px; background: transparent !important; color: var(--muted) !important; }
.crm-seg button.on { background: var(--card) !important; color: var(--ink) !important; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06); }
.crm-one { display: grid; grid-template-columns: 118px minmax(140px, 1fr) minmax(120px, 1fr) auto; gap: 8px; align-items: end; }
#crm-add { flex: none; }
#crm-add-one, #crm-add-bulk, #crm-browse, #crm-modal-save { height: 42px; min-height: 42px; padding: 0 14px; border-radius: 9px; font-size: 13px; }
#crm-add-one { min-width: 84px; }
.crm-paste { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 10px; }
.crm-examples { padding: 10px; display: grid; gap: 4px; align-content: start; }
.crm-examples code { font-size: 12px; background: var(--paper); border-radius: 8px; padding: 4px 8px; }
#page-contacts input, #page-contacts select, #page-contacts textarea {
  width: 100%; height: 42px; border: 1px solid #dde4e8; border-radius: 9px; background: var(--card); color: var(--ink);
  padding: 0 12px; font-size: 13px;
}
#page-contacts textarea { height: auto; min-height: 96px; padding: 8px 12px; }
#page-contacts label { display: grid; gap: 3px; font-size: 12px; font-weight: 650; color: var(--ink); }
#page-contacts input:focus, #page-contacts select:focus, #page-contacts textarea:focus {
  outline: 0; border-color: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}
#page-contacts input[type="checkbox"] {
  width: 18px; height: 18px; min-height: 18px; padding: 0; accent-color: #10b981; border-radius: 4px;
}
.crm-drop { border: 1px dashed #dde4e8; border-radius: 12px; padding: 14px; text-align: center; display: grid; justify-items: center; gap: 4px; }
.crm-drop.over { border-color: #10b981; background: var(--soft); }
.crm-file-meta, #crm-preview { margin-top: 8px; }
.crm-tools { flex-wrap: wrap; justify-content: flex-end; }
.crm-tools input { width: 180px; height: 38px; }
.crm-pop { position: relative; }
.crm-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; min-width: 200px;
  background: var(--card); border: 1px solid #dde4e8; border-radius: 10px; box-shadow: 0 8px 20px rgba(16, 24, 40, 0.08); padding: 6px; display: grid; gap: 2px;
}
.crm-menu button { width: 100%; text-align: left; background: transparent !important; color: var(--ink) !important; min-height: 34px; height: 34px; font-size: 13px; border-radius: 8px; }
.crm-menu button.danger, .crm-menu .danger { color: #ef4444 !important; }
.crm-menu label { margin-top: 4px; }
.crm-check { display: flex !important; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.crm-check input { width: 18px; height: 18px; }
.crm-menu-actions { display: flex; gap: 6px; margin-top: 6px; }
.crm-scroll { overflow: auto; min-height: 0; flex: 1; }
.crm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.crm-table th {
  text-align: left; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted);
  font-weight: 700; height: 40px; padding: 0 8px; position: sticky; top: 0; background: var(--card);
}
.crm-table td { height: 46px; padding: 0 8px; border-top: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.crm-table tr:hover td { background: var(--paper); }
.crm-table .is-bad { color: #ef4444; }
.crm-table .is-warn { color: #b45309; }
.crm-pager { margin-top: 8px; color: var(--muted); font-size: 12px; }
.crm-pager select { width: 68px; height: 36px; }
.crm-bulkbar {
  display: flex; align-items: center; gap: 8px; min-height: 44px; margin: 8px 0; padding: 4px 8px;
  border-radius: 10px; background: var(--soft); color: var(--ink); font-size: 13px;
}
.crm-empty { margin: auto; text-align: center; padding: 20px; display: grid; justify-items: center; gap: 6px; }
.crm-empty h2 { font-size: 16px; }
.crm-dialog { width: min(420px, 100%); }
.crm-dialog input { margin: 4px 0 8px; }
.crm-drawer {
  position: fixed; top: 12px; right: 12px; bottom: 12px; width: 380px; max-width: calc(100vw - 24px); z-index: 30;
  padding: 20px; overflow: auto; display: flex; flex-direction: column; gap: 8px;
  border-radius: 16px; box-shadow: -8px 0 24px rgba(16, 24, 40, 0.08);
}
.crm-drawer-top { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.crm-avatar {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: var(--soft); color: var(--green-dark); font-weight: 700; font-size: 16px;
}
.crm-drawer h2 { margin: 0; font-size: 16px; }
.crm-drawer-top p { margin: 0; font-size: 13px; }
.crm-drawer-status { color: var(--muted); font-size: 12px !important; }
#crm-drawer-close { width: 34px; height: 34px; min-height: 34px; padding: 0; border-radius: 8px; font-size: 12px; }
.crm-drawer dl { margin: 4px 0 0; display: grid; gap: 0; }
.crm-fact-title { margin: 12px 0 2px; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.crm-drawer dl > div { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); }
.crm-drawer dt { color: var(--muted); font-size: 12px; }
.crm-drawer dd { margin: 0; font-size: 13px; font-weight: 650; }
.crm-drawer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; padding-top: 8px; }
.crm-drawer-actions button { height: 40px; min-height: 40px; border-radius: 9px; font-size: 13px; }
.crm-drawer-actions .primary, .crm-drawer-actions .danger { grid-column: 1 / -1; height: 42px; }
.crm-submenu { display: grid; gap: 2px; margin-top: 4px; }
@media (max-width: 1100px) {
  .crm { grid-template-columns: 250px minmax(0, 1fr); }
  .crm-paste { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .crm-one { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  #crm-add-one { grid-column: 1 / -1; }
  .crm-drawer { width: min(340px, calc(100vw - 24px)); }
}
@media (max-width: 800px) {
  #page-contacts.page.active { overflow: auto; }
  .crm { grid-template-columns: 1fr; }
  .crm-lists { max-height: 240px; }
  .crm-scroll { overflow: auto; }
  .crm-drawer { width: 92vw; }
}

#page-templates.page.active {
  display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: 0 16px 12px;
}
.tpl { flex: 1; min-height: 0; display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 12px; }
.tpl-lib, .tpl-editor, .tpl-empty, .tpl-preview {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
.tpl-lib { display: flex; flex-direction: column; min-height: 0; padding: 14px; gap: 8px; }
.tpl-lib-head, .tpl-edit-head, .tpl-edit-actions, .tpl-empty-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.tpl-lib h2, .tpl-edit-head h2, .tpl-empty h2 { margin: 0; font-size: 16px; color: var(--ink); }
.tpl-lib .primary, #tpl-save { min-height: 48px; padding: 0 16px; border-radius: 12px; }
.tpl-lib input, .tpl-lib select, .tpl-form input, .tpl-form select, .tpl-form textarea {
  width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); padding: 0 12px;
}
.tpl-form textarea { min-height: 160px; padding: 12px; resize: vertical; }
.tpl-form input:focus, .tpl-form select:focus, .tpl-form textarea:focus, .tpl-lib input:focus, .tpl-lib select:focus {
  outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}
.tpl-tools label, .tpl-form label { display: grid; gap: 4px; color: var(--ink); font-size: 13px; font-weight: 650; }
.tpl-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-pills button { min-height: 34px; padding: 0 10px; border-radius: 999px; background: transparent !important; color: var(--muted) !important; }
.tpl-pills button.on { background: var(--soft) !important; color: var(--green-dark) !important; }
.tpl-list { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; display: grid; align-content: start; gap: 6px; }
.tpl-list li { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 4px; align-items: start; }
.tpl-card {
  display: grid !important; grid-template-columns: 92px minmax(0, 1fr); gap: 8px; width: 100%; text-align: left;
  background: transparent !important; color: var(--ink) !important; border: 1px solid transparent; border-radius: 12px !important; padding: 8px !important; min-height: 84px;
}
.tpl-card.on { background: var(--soft) !important; border-color: var(--green); color: var(--green-dark) !important; }
.tpl-card strong, .tpl-card small { display: block; }
.tpl-card small { color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-thumb {
  display: grid; gap: 4px; min-height: 72px; padding: 6px; border-radius: 10px; background: #efeae2; overflow: hidden;
}
.tpl-thumb img { width: 100%; height: 36px; object-fit: cover; border-radius: 6px; }
.tpl-collage { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.tpl-mini {
  display: block; background: #d9fdd3; color: #17212b; border-radius: 8px 8px 3px 8px; padding: 4px 6px; font-size: 10px; line-height: 1.3;
  max-height: 42px; overflow: hidden;
}
.tpl-play {
  position: absolute; width: 0; height: 0; border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent #fff;
  filter: drop-shadow(0 0 1px #17212b);
}
.tpl-thumb, .tpl-file, .tpl-video-preview { position: relative; }
.tpl-more { min-height: 34px; min-width: 34px; padding: 0 8px; background: transparent !important; color: var(--muted) !important; }
.tpl-menu {
  position: absolute; right: 0; top: 36px; z-index: 5; display: grid; min-width: 150px; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.tpl-menu button { justify-content: flex-start; background: transparent !important; color: var(--ink) !important; min-height: 36px; }
.tpl-menu button.danger { color: var(--bad) !important; background: var(--bad-bg) !important; }
.tpl-main { min-height: 0; display: flex; }
.tpl-empty, .tpl-editor { flex: 1; min-height: 0; }
.tpl-empty { margin: 0; display: grid; align-content: center; justify-items: center; text-align: center; gap: 8px; padding: 28px; }
.tpl-empty p, .tpl-points { color: var(--muted); max-width: 460px; }
.tpl-points { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; text-align: left; }
.tpl-editor { display: flex; flex-direction: column; padding: 14px; gap: 10px; overflow: auto; }
.tpl-editor.hidden { display: none; }
.tpl-status, #tpl-status { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.tpl-edit-actions button { min-height: 44px; padding: 0 14px; border-radius: 12px; }
.tpl-split { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr); gap: 12px; min-height: 0; }
.tpl-form { display: grid; align-content: start; gap: 8px; }
.tpl-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tpl-meta span { display: grid; gap: 2px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; }
.tpl-meta small { color: var(--muted); font-size: 12px; }
.tpl-meta strong { font-size: 13px; color: var(--ink); }
.tpl-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tpl-personal { position: relative; }
.tpl-keys {
  position: absolute; left: 0; top: 40px; z-index: 4; display: grid; min-width: 160px; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.tpl-keys button { justify-content: flex-start; background: transparent !important; color: var(--ink) !important; min-height: 36px; }
.tpl-media { display: flex; gap: 8px; overflow-x: auto; }
.tpl-file { display: grid; width: 92px; gap: 4px; font-size: 11px; color: var(--muted); }
.tpl-file img, .tpl-video-preview img { width: 92px; height: 64px; object-fit: cover; border-radius: 8px; }
.tpl-file button { min-height: 28px; padding: 0; }
.tpl-preview { padding: 12px; align-self: start; }
.tpl-phone { margin-top: 8px; }
#tpl-preview-media { display: grid; gap: 6px; padding: 12px 12px 0; }
#tpl-preview-media img { width: 100%; border-radius: 10px; max-height: 140px; object-fit: cover; }
.tpl-video-preview { display: block; position: relative; }
.tpl-none { color: var(--muted); padding: 8px; }
@media (max-width: 1100px) {
  .tpl { grid-template-columns: 260px minmax(0, 1fr); }
  .tpl-split, .tpl-meta { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  #page-templates.page.active { overflow: auto; }
  .tpl { grid-template-columns: 1fr; }
  .tpl-lib { max-height: 320px; }
  .tpl-edit-head, .tpl-edit-actions, .tpl-empty-actions { flex-wrap: wrap; }
}

#page-analytics.page.active {
  flex: 1; min-height: 0; overflow: auto; padding: 0 16px 16px;
}
.an-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-bottom: 10px; }
.an-bar label { display: grid; gap: 3px; font-size: 12px; font-weight: 650; }
.an-bar select, .an-bar input { height: 38px; border: 1px solid #dde4e8; border-radius: 9px; background: var(--card); color: var(--ink); padding: 0 10px; }
.an-bar button { height: 38px; padding: 0 12px; border-radius: 9px; font-size: 13px; }
.an-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.an-kpis article, .an-card {
  background: var(--card); border: 1px solid #dde4e8; border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.an-kpis strong { display: block; font-size: 22px; letter-spacing: -0.03em; }
.an-kpis span { display: block; font-size: 12px; color: var(--muted); }
.an-kpis small, .an-card .hint { font-size: 11px; color: var(--muted); }
.an-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.an-card h2 { margin: 0 0 4px; font-size: 16px; }
.an-wide { grid-column: 1 / -1; }
.an-big { margin: 4px 0; font-size: 28px; font-weight: 700; letter-spacing: -0.03em; }
.an-card dl { margin: 8px 0 0; display: grid; gap: 4px; }
.an-card dl div, .an-feed li { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.an-card dt { color: var(--muted); }
.an-card dd { margin: 0; font-weight: 650; }
.an-chart svg { width: 100%; height: 150px; }
.an-scroll { overflow: auto; }
.an-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.an-table th { text-align: left; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); height: 36px; }
.an-table td { height: 40px; border-top: 1px solid var(--line); white-space: nowrap; }
.an-link { background: transparent !important; color: var(--green-dark) !important; padding: 0 !important; min-height: 0 !important; height: auto !important; }
.an-pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 99px; background: var(--paper); font-size: 12px; text-transform: capitalize; }
.an-pill.is-failed, .an-pill.is-cancelled { color: #ef4444; }
.an-pill.is-sent, .an-pill.is-completed { color: var(--green-dark); }
.an-feed { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.an-feed li { display: grid; }
.an-feed span { color: var(--muted); font-size: 12px; }
.an-empty { margin-bottom: 10px; padding: 14px; border: 1px dashed #dde4e8; border-radius: 14px; background: var(--card); }
.an-empty h2 { margin: 0 0 4px; font-size: 16px; }
.an-empty p { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.an-inline { display: grid; gap: 3px; margin: 8px 0; font-size: 12px; }
.an-inline select { height: 38px; border: 1px solid #dde4e8; border-radius: 9px; background: var(--card); color: var(--ink); }
#an-rules { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
#an-failures details { font-size: 13px; margin-top: 6px; }
@media (max-width: 1100px) {
  .an-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .an-grid { grid-template-columns: 1fr; }
}
