@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg:          #0d1117;
  --bg2:         #161b22;
  --bg3:         #1c2128;
  --border:      #30363d;
  --border2:     #21262d;
  --text:        #e6edf3;
  --text2:       #8b949e;
  --text3:       #484f58;
  --accent:      #25d366;
  --accent-h:    #1da851;
  --accent-dim:  rgba(37,211,102,.08);
  --accent-bdr:  rgba(37,211,102,.25);
  --msg-in:      #1c2128;
  --msg-out:     #0d2818;
  --danger:      #f85149;
  --warn:        #d29922;
  --info:        #388bfd;
  --sidebar-bg:  #161b22;
  --sidebar-text: #8b949e;
  --sidebar-active-bg: rgba(37,211,102,.08);
  --sidebar-active-text: #25d366;
  --sidebar-hover-bg: #1c2128;
}

/* ── Light Theme (Wassenger style) ── */
body[data-theme="light"] {
  --bg:          #eef2f7;
  --bg2:         #ffffff;
  --bg3:         #f5f7fa;
  --border:      #dde3ec;
  --border2:     #e8ecf2;
  --text:        #1c2b3a;
  --text2:       #5f7185;
  --text3:       #9aafc4;
  --accent:      #25d366;
  --accent-h:    #1da851;
  --accent-dim:  rgba(37,211,102,.1);
  --accent-bdr:  rgba(37,211,102,.3);
  --msg-in:      #ffffff;
  --msg-out:     #e7fbe1;
  --danger:      #e53e3e;
  --warn:        #c17d0a;
  --info:        #1a6fcc;
  --sidebar-bg:  #15304f;
  --sidebar-text: rgba(255,255,255,.55);
  --sidebar-active-bg: rgba(255,255,255,.13);
  --sidebar-active-text: #ffffff;
  --sidebar-hover-bg: rgba(255,255,255,.07);
}

/* sidebar */
body[data-theme="light"] .sidebar { background: #15304f; border-right: none; box-shadow: 2px 0 8px rgba(0,0,0,.15); }
body[data-theme="light"] .sb-logo { background: rgba(37,211,102,.18); border-color: rgba(37,211,102,.35); }
body[data-theme="light"] .sb-logo-label { color: #fff; }
body[data-theme="light"] .sb-item { color: rgba(255,255,255,.55); }
body[data-theme="light"] .sb-item:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.9); }
body[data-theme="light"] .sb-item.active { background: rgba(255,255,255,.14); color: #fff; border-left: 3px solid #25d366; }
body[data-theme="light"] .sb-sep { background: rgba(255,255,255,.1); }
body[data-theme="light"] .sb-avatar { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.2); color: #fff; }

/* conversations panel */
body[data-theme="light"] .conv-panel { background: #fff; border-right: 1px solid var(--border); }
body[data-theme="light"] .conv-panel-head h2 { color: var(--text); }
body[data-theme="light"] .conv-search input { background: var(--bg3); border-color: var(--border); color: var(--text); }
body[data-theme="light"] .conv-search input::placeholder { color: var(--text3); }
body[data-theme="light"] .conv-item { border-bottom-color: var(--border2); }
body[data-theme="light"] .conv-item:hover { background: #f0f6ff; }
body[data-theme="light"] .conv-item.active { background: #e8f0fe; border-left: 3px solid #1a6fcc; }
body[data-theme="light"] .conv-name { color: var(--text); }
body[data-theme="light"] .conv-preview { color: var(--text2); }
body[data-theme="light"] .conv-time { color: var(--text3); }

/* chat */
body[data-theme="light"] .chat-win { background: var(--bg); }
body[data-theme="light"] .chat-header { background: #fff; border-bottom: 1px solid var(--border); box-shadow: 0 1px 4px rgba(0,0,0,.06); }
body[data-theme="light"] .chat-header-name { color: var(--text); }
body[data-theme="light"] .chat-header-sub { color: var(--text2); }
body[data-theme="light"] .hdr-btn { background: var(--bg3); border: 1px solid var(--border); color: var(--text2); }
body[data-theme="light"] .hdr-btn:hover { border-color: #1a6fcc; color: #1a6fcc; background: #eef3fc; }
body[data-theme="light"] .hdr-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
body[data-theme="light"] .messages { background: var(--bg); }
body[data-theme="light"] .msg-bubble { background: var(--msg-in); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
body[data-theme="light"] .msg-row.out .msg-bubble { background: var(--msg-out); color: #1c2b3a; }
body[data-theme="light"] .msg-row.activity .msg-bubble { background: rgba(0,0,0,.06); color: var(--text2); }
body[data-theme="light"] .msg-meta { color: var(--text3); }
body[data-theme="light"] .msg-date { color: var(--text3); background: rgba(0,0,0,.07); border-radius: 10px; padding: 2px 10px; }
body[data-theme="light"] .reply-bar { background: #fff; border-top: 1px solid var(--border); }
body[data-theme="light"] .reply-input { background: var(--bg3); border: 1px solid var(--border); color: var(--text); }
body[data-theme="light"] .reply-input:focus { border-color: #1a6fcc; background: #fff; }
body[data-theme="light"] .reply-tab { color: var(--text2); border-bottom-color: transparent; }
body[data-theme="light"] .reply-tab.active { color: #1a6fcc; border-bottom-color: #1a6fcc; }
body[data-theme="light"] .tool-btn { color: var(--text3); }
body[data-theme="light"] .tool-btn:hover { color: var(--text2); }
body[data-theme="light"] .btn-send { background: #1a6fcc; }
body[data-theme="light"] .btn-send:hover { background: #155aa3; }

/* details panel */
body[data-theme="light"] .details { background: #fff; border-left: 1px solid var(--border); }
body[data-theme="light"] .detail-section { border-bottom-color: var(--border); }
body[data-theme="light"] .detail-section-title { color: var(--text3); }
body[data-theme="light"] .detail-row label { color: var(--text2); }
body[data-theme="light"] .detail-value { color: var(--text); }
body[data-theme="light"] .contact-big-name { color: var(--text); }
body[data-theme="light"] .contact-big-phone { color: var(--text2); }
body[data-theme="light"] .note-item { background: #fffbf0; border-color: #fce8a0; color: var(--text); }

/* settings */
body[data-theme="light"] .settings-overlay { background: rgba(21,48,79,.5); }
body[data-theme="light"] .settings-sidebar { background: #15304f; border-right: none; }
body[data-theme="light"] .settings-sidebar h3 { color: rgba(255,255,255,.35); }
body[data-theme="light"] .settings-nav-item { color: rgba(255,255,255,.6); }
body[data-theme="light"] .settings-nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
body[data-theme="light"] .settings-nav-item.active { background: rgba(255,255,255,.14); color: #fff; }
body[data-theme="light"] .settings-main { background: var(--bg3); }
body[data-theme="light"] .settings-page-title { color: var(--text); }
body[data-theme="light"] .settings-page-sub { color: var(--text2); }
body[data-theme="light"] .s-card { background: #fff; border-color: var(--border); box-shadow: 0 1px 3px rgba(0,0,0,.06); }
body[data-theme="light"] .s-card-title { color: var(--text); }
body[data-theme="light"] .s-label { color: var(--text2); }
body[data-theme="light"] .s-hint { color: var(--text3); }
body[data-theme="light"] .s-inp { background: var(--bg3); border-color: var(--border); color: var(--text); }
body[data-theme="light"] .s-inp:focus { border-color: #1a6fcc; background: #fff; outline: none; }
body[data-theme="light"] .s-btn { background: #1a6fcc; border-color: #1a6fcc; color: #fff; }
body[data-theme="light"] .s-btn:hover { background: #155aa3; }
body[data-theme="light"] .qr-status-card { background: var(--bg3); border-color: var(--border); }
body[data-theme="light"] .tpl-card { background: #fff; border-color: var(--border); box-shadow: 0 1px 3px rgba(0,0,0,.05); }
body[data-theme="light"] .tpl-card-name { color: var(--text); }
body[data-theme="light"] .tpl-card-content { color: var(--text2); }
body[data-theme="light"] .rule-card { background: #fff; border-color: var(--border); box-shadow: 0 1px 3px rgba(0,0,0,.05); }
body[data-theme="light"] .rule-name { color: var(--text); }

/* modal */
body[data-theme="light"] .modal-bg { background: rgba(21,48,79,.45); }
body[data-theme="light"] .modal { background: #fff; border-color: var(--border); box-shadow: 0 8px 32px rgba(0,0,0,.15); }

/* contacts table */
body[data-theme="light"] .ct-th { background: var(--bg3); color: var(--text3); border-bottom: 2px solid var(--border); }
body[data-theme="light"] .ct-td { border-bottom-color: var(--border2); color: var(--text); }
body[data-theme="light"] .ct-row:hover td { background: #f0f6ff; }

/* filter chips */
body[data-theme="light"] .filter-chip { border-color: var(--border); color: var(--text2); background: #fff; }
body[data-theme="light"] .filter-chip:hover, body[data-theme="light"] .filter-chip.active { border-color: #1a6fcc; color: #1a6fcc; background: #eef3fc; }

/* misc */
body[data-theme="light"] .conv-avatar { background: #e8f0fe; color: #1a6fcc; }
body[data-theme="light"] .send-card { background: #fff; border-color: var(--border); box-shadow: 0 1px 3px rgba(0,0,0,.06); }
body[data-theme="light"] .s-select { background: var(--bg3); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body { background: var(--bg); color: var(--text); font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; line-height: 1.5; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── Utility ── */
.hidden      { display: none !important; }
.truncate    { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2       { gap: 8px; }
.gap-1       { gap: 4px; }
.flex-1      { flex: 1; min-width: 0; }
.text-accent { color: var(--accent); }
.text-muted  { color: var(--text2); }
.text-dim    { color: var(--text3); }
.font-600    { font-weight: 600; }
.w-full      { width: 100%; }
.spin        { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Layout ── */
#root { height: 100vh; display: flex; flex-direction: column; }

/* ── Auth ── */
.auth-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--bg); }
.auth-box { width: 100%; max-width: 360px; }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .logo-icon { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; background: var(--accent-dim); border: 1px solid var(--accent-bdr); border-radius: 14px; margin-bottom: 10px; }
.auth-logo h1 { font-size: 20px; font-weight: 700; }
.auth-logo p { color: var(--text2); font-size: 12px; margin-top: 2px; }
.auth-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.auth-tabs { display: flex; border-bottom: 1px solid var(--border); }
.auth-tab { flex: 1; padding: 12px; text-align: center; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text2); border-bottom: 2px solid transparent; transition: all .15s; }
.auth-tab.active { color: var(--accent); border-color: var(--accent); }
.auth-form { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.auth-form .inp { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 13px; color: var(--text); width: 100%; font-size: 13px; outline: none; transition: border-color .15s; font-family: inherit; }
.auth-form .inp:focus { border-color: var(--accent); }
.auth-form .btn-primary { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 11px; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s; font-family: inherit; }
.auth-form .btn-primary:hover { background: var(--accent-h); }
.auth-error { color: var(--danger); font-size: 12px; padding: 0 4px; }

/* ── Onboarding ── */
.ob-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; }
.ob-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 36px; width: 100%; max-width: 440px; text-align: center; }
.ob-card h2 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.ob-card p { color: var(--text2); font-size: 13px; margin-bottom: 24px; }
.ob-steps { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 28px; }
.ob-step { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; border: 2px solid var(--border); color: var(--text3); }
.ob-step.done { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.ob-step.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.ob-step-line { width: 40px; height: 2px; background: var(--border); }
.ob-step-line.done { background: var(--accent); }
.ob-spinner { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px; }
.ob-spinner svg { color: var(--accent); }
.ob-qr-wrap { display: inline-block; background: white; border-radius: 12px; padding: 12px; margin: 8px 0 12px; }
.ob-qr-wrap img { display: block; width: 200px; height: 200px; }
.ob-qr-hint { font-size: 12px; color: var(--text2); }
.ob-success { padding: 20px 0; }
.ob-success .check { font-size: 48px; margin-bottom: 8px; }
.ob-success h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.ob-success p { color: var(--text2); font-size: 12px; margin-bottom: 18px; }

/* ── App shell ── */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
.sidebar { width: 58px; background: var(--sidebar-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; padding: 10px 0; gap: 4px; flex-shrink: 0; transition: width .2s; }
.sidebar.expanded { width: 220px; align-items: stretch; padding: 10px 6px; }

.sb-logo { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-dim); border: 1px solid var(--accent-bdr); display: flex; align-items: center; justify-content: center; cursor: pointer; margin-bottom: 8px; flex-shrink: 0; }
.sidebar.expanded .sb-logo { width: 100%; border-radius: 8px; padding: 8px 10px; justify-content: flex-start; gap: 10px; }
.sb-logo-label { font-size: 13px; font-weight: 700; display: none; }
.sidebar.expanded .sb-logo-label { display: block; }

.sb-item { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--sidebar-text); transition: all .15s; position: relative; flex-shrink: 0; border: none; background: none; font-size: 18px; }
.sb-item:hover { background: var(--sidebar-hover-bg); color: var(--text); }
.sb-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); }
.sidebar.expanded .sb-item { width: 100%; justify-content: flex-start; padding: 0 10px; gap: 10px; font-size: 16px; height: 38px; }
.sb-item-label { font-size: 13px; font-weight: 500; display: none; }
.sidebar.expanded .sb-item-label { display: block; }

.sb-badge { position: absolute; top: 4px; right: 4px; background: var(--danger); color: white; border-radius: 10px; font-size: 10px; font-weight: 700; padding: 1px 4px; min-width: 16px; text-align: center; line-height: 14px; }
.sidebar.expanded .sb-badge { position: static; margin-left: auto; }

.sb-sep { width: 32px; height: 1px; background: var(--border); margin: 4px 0; }
.sidebar.expanded .sb-sep { width: 100%; }

.sb-bottom { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; }
.sidebar.expanded .sb-bottom { align-items: stretch; }

.sb-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--bg3); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--accent); cursor: pointer; border: 1px solid var(--accent-bdr); }

/* ── Panel container ── */
.panel-area { flex: 1; display: flex; min-width: 0; }

/* ── Conversations panel ── */
.conv-panel { width: 300px; flex-shrink: 0; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--bg2); }
.conv-panel-head { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.conv-panel-head h2 { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.conv-search { position: relative; }
.conv-search input { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 8px 32px; color: var(--text); font-size: 12px; outline: none; font-family: inherit; transition: border-color .15s; }
.conv-search input:focus { border-color: var(--accent); }
.conv-search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 13px; pointer-events: none; }
.conv-filters { padding: 8px 14px; display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); }
.conv-filters::-webkit-scrollbar { display: none; }
.filter-chip { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 500; border: 1px solid var(--border); color: var(--text2); cursor: pointer; white-space: nowrap; transition: all .15s; background: none; font-family: inherit; }
.filter-chip:hover, .filter-chip.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

.conv-list { flex: 1; overflow-y: auto; }
.conv-item { padding: 12px 14px; border-bottom: 1px solid var(--border2); cursor: pointer; transition: background .1s; display: flex; gap: 10px; align-items: flex-start; }
.conv-item:hover { background: rgba(255,255,255,.02); }
.conv-item.active { background: var(--accent-dim); border-left: 2px solid var(--accent); }
.conv-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--bg3); display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; color: var(--accent); flex-shrink: 0; border: 1px solid var(--border); }
.conv-body { flex: 1; min-width: 0; }
.conv-row1 { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 2px; }
.conv-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: 10px; color: var(--text3); flex-shrink: 0; }
.conv-preview { font-size: 12px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-row3 { display: flex; align-items: center; gap: 4px; margin-top: 3px; }
.chip { font-size: 10px; padding: 1px 6px; border-radius: 10px; font-weight: 500; }
.chip-open     { background: rgba(37,211,102,.15); color: #25d366; }
.chip-pending  { background: rgba(210,153,34,.15); color: #d29922; }
.chip-resolved { background: rgba(56,139,253,.15); color: #388bfd; }
.chip-unread   { background: var(--danger); color: #fff; min-width: 16px; text-align: center; }
.chip-bot      { background: rgba(37,211,102,.1); color: var(--accent); }

/* ── Chat window ── */
.chat-win { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }

.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text3); }
.chat-empty-icon { font-size: 52px; margin-bottom: 12px; opacity: .4; }
.chat-empty h3 { font-size: 15px; font-weight: 500; margin-bottom: 4px; }

.chat-header { height: 58px; padding: 0 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-shrink: 0; background: var(--bg2); }
.chat-header-info { flex: 1; min-width: 0; }
.chat-header-name { font-size: 14px; font-weight: 700; }
.chat-header-sub { font-size: 11px; color: var(--text2); }
.chat-header-actions { display: flex; gap: 6px; }
.hdr-btn { padding: 6px 12px; border-radius: 7px; font-size: 12px; font-weight: 500; cursor: pointer; border: 1px solid var(--border); background: none; color: var(--text2); font-family: inherit; transition: all .15s; display: flex; align-items: center; gap: 5px; }
.hdr-btn:hover { border-color: var(--text2); color: var(--text); }
.hdr-btn.primary { border-color: var(--accent); color: var(--accent); }
.hdr-btn.primary:hover { background: var(--accent); color: #fff; }
.hdr-btn.danger { border-color: var(--danger); color: var(--danger); }
.hdr-btn.danger:hover { background: var(--danger); color: #fff; }

.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.msg-date { text-align: center; font-size: 11px; color: var(--text3); margin: 10px 0 6px; display: flex; align-items: center; gap: 8px; }
.msg-date::before, .msg-date::after { content: ''; flex: 1; height: 1px; background: var(--border2); }
.msg-row { display: flex; gap: 8px; margin: 1px 0; max-width: 100%; }
.msg-row.out { flex-direction: row-reverse; }
.msg-row.activity { justify-content: center; }
.msg-bubble { padding: 8px 12px; border-radius: 10px; max-width: 60%; font-size: 13px; line-height: 1.5; word-break: break-word; }
.msg-row.in  .msg-bubble { background: var(--msg-in); border: 1px solid var(--border2); border-bottom-left-radius: 3px; }
.msg-row.out .msg-bubble { background: var(--msg-out); border: 1px solid rgba(37,211,102,.2); border-bottom-right-radius: 3px; color: #d4edda; }
.msg-row.activity .msg-bubble { background: rgba(255,255,255,.04); border: 1px solid var(--border2); border-radius: 20px; font-size: 11px; color: var(--text3); padding: 3px 12px; max-width: 80%; text-align: center; }
.msg-meta { font-size: 10px; color: var(--text3); margin-top: 3px; }
.msg-row.out .msg-meta { text-align: right; }

.reply-bar { flex-shrink: 0; border-top: 1px solid var(--border); background: var(--bg2); }
.reply-tabs { display: flex; padding: 0 16px; gap: 0; border-bottom: 1px solid var(--border); }
.reply-tab { padding: 9px 14px; font-size: 12px; font-weight: 500; color: var(--text2); cursor: pointer; border-bottom: 2px solid transparent; transition: all .15s; }
.reply-tab.active { color: var(--accent); border-color: var(--accent); }
.reply-inner { padding: 10px 12px 8px; }
.reply-input { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 13px; color: var(--text); font-size: 13px; resize: none; outline: none; font-family: inherit; min-height: 72px; max-height: 140px; line-height: 1.5; transition: border-color .15s; }
.reply-input:focus { border-color: var(--accent); }
.reply-toolbar { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.reply-tools { flex: 1; display: flex; gap: 2px; }
.tool-btn { background: none; border: none; cursor: pointer; color: var(--text2); font-size: 15px; padding: 5px 7px; border-radius: 6px; transition: all .15s; display: flex; align-items: center; }
.tool-btn:hover { background: var(--bg3); color: var(--text); }
.btn-send { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 8px 18px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: background .15s; display: flex; align-items: center; gap: 6px; }
.btn-send:hover { background: var(--accent-h); }
.btn-send:disabled { opacity: .5; cursor: default; }

/* ── Details panel ── */
.details { width: 280px; flex-shrink: 0; border-left: 1px solid var(--border); display: flex; flex-direction: column; background: var(--bg2); overflow-y: auto; }
.detail-section { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.detail-section-title { font-size: 10px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .7px; margin-bottom: 10px; }
.contact-big-avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--bg3); border: 2px solid var(--accent-bdr); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; color: var(--accent); margin: 0 auto 8px; }
.contact-big-name { text-align: center; font-size: 15px; font-weight: 700; }
.contact-big-phone { text-align: center; font-size: 12px; color: var(--text2); margin-top: 2px; }
.detail-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 12px; }
.detail-row label { color: var(--text2); }
.detail-row value, .detail-value { font-weight: 500; color: var(--text); }

/* Toggle */
.toggle-wrap { display: flex; align-items: center; gap: 8px; }
.toggle { width: 40px; height: 22px; border-radius: 11px; background: var(--bg3); border: 1px solid var(--border); position: relative; cursor: pointer; transition: background .2s; }
.toggle.on { background: var(--accent); border-color: var(--accent); }
.toggle-dot { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: left .2s; }
.toggle.on .toggle-dot { left: 20px; }

/* Note input */
.note-add { display: flex; flex-direction: column; gap: 6px; }
.note-input { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; color: var(--text); font-size: 12px; resize: none; outline: none; font-family: inherit; min-height: 56px; width: 100%; transition: border-color .15s; }
.note-input:focus { border-color: var(--accent); }
.btn-sm { background: var(--bg3); border: 1px solid var(--border); color: var(--text2); border-radius: 6px; padding: 5px 10px; font-size: 12px; cursor: pointer; font-family: inherit; transition: all .15s; }
.btn-sm:hover { border-color: var(--text2); color: var(--text); }
.note-item { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; margin-bottom: 6px; font-size: 12px; color: var(--text2); line-height: 1.5; }
.note-item time { display: block; font-size: 10px; color: var(--text3); margin-top: 4px; }

/* ── Settings overlay ── */
.settings-overlay { position: fixed; inset: 0; background: var(--bg); z-index: 200; display: flex; }
.settings-sidebar { width: 200px; background: var(--bg2); border-right: 1px solid var(--border); padding: 16px 8px; flex-shrink: 0; display: flex; flex-direction: column; gap: 2px; }
.settings-sidebar h3 { font-size: 11px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; padding: 8px 10px 4px; }
.settings-nav-item { padding: 9px 12px; border-radius: 8px; font-size: 13px; cursor: pointer; color: var(--text2); display: flex; align-items: center; gap: 8px; transition: all .15s; border: none; background: none; width: 100%; text-align: left; font-family: inherit; }
.settings-nav-item:hover { background: var(--bg3); color: var(--text); }
.settings-nav-item.active { background: var(--accent-dim); color: var(--accent); }

.settings-main { flex: 1; overflow-y: auto; padding: 32px; }
.settings-close { margin-bottom: 20px; background: none; border: 1px solid var(--border); color: var(--text2); padding: 7px 14px; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 12px; display: flex; align-items: center; gap: 6px; }
.settings-close:hover { color: var(--text); border-color: var(--text2); }
.settings-page-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.settings-page-sub { color: var(--text2); font-size: 13px; margin-bottom: 24px; }

.s-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; margin-bottom: 14px; }
.s-card-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.s-row { margin-bottom: 14px; }
.s-row:last-child { margin-bottom: 0; }
.s-label { font-size: 12px; color: var(--text2); margin-bottom: 5px; }
.s-inp { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 13px; color: var(--text); width: 100%; font-size: 13px; outline: none; font-family: inherit; transition: border-color .15s; }
.s-inp:focus { border-color: var(--accent); }
.s-textarea { min-height: 110px; resize: vertical; }
.s-select { appearance: none; cursor: pointer; }
.s-hint { font-size: 11px; color: var(--text3); margin-top: 4px; }
.s-btn { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 10px 20px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: background .15s; }
.s-btn:hover { background: var(--accent-h); }

/* QR card */
.qr-status-card { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; }
.qr-status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-green { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.dot-red   { background: var(--danger); }
.dot-yellow { background: var(--warn); animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.qr-img-wrap { background: white; border-radius: 10px; padding: 10px; display: inline-block; }
.qr-img-wrap img { width: 180px; height: 180px; display: block; }

/* Templates grid */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.tpl-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.tpl-card-name { font-size: 13px; font-weight: 600; }
.tpl-card-content { font-size: 12px; color: var(--text2); white-space: pre-wrap; flex: 1; }
.tpl-card-actions { display: flex; gap: 6px; }
.tpl-btn { flex: 1; background: none; border: 1px solid var(--border); color: var(--text2); border-radius: 6px; padding: 5px 8px; font-size: 11px; cursor: pointer; font-family: inherit; transition: all .15s; }
.tpl-btn:hover { border-color: var(--accent); color: var(--accent); }
.tpl-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* Automation rules */
.rule-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 12px; }
.rule-enabled { flex-shrink: 0; }
.rule-info { flex: 1; min-width: 0; }
.rule-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.rule-desc { font-size: 11px; color: var(--text2); }

/* Send page */
.send-wrap { max-width: 520px; }
.send-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
.send-result { margin-top: 10px; padding: 10px 14px; border-radius: 8px; font-size: 13px; text-align: center; }
.send-ok   { background: rgba(37,211,102,.1); border: 1px solid var(--accent-bdr); color: var(--accent); }
.send-err  { background: rgba(248,81,73,.1); border: 1px solid rgba(248,81,73,.3); color: var(--danger); }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 300; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 22px; width: 100%; max-width: 420px; }
.modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.btn-cancel { flex: 1; background: none; border: 1px solid var(--border); color: var(--text2); border-radius: 8px; padding: 10px; font-size: 13px; cursor: pointer; font-family: inherit; transition: all .15s; }
.btn-cancel:hover { border-color: var(--text2); color: var(--text); }
.btn-confirm { flex: 1; background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 10px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: background .15s; }
.btn-confirm:hover { background: var(--accent-h); }

/* Misc */
.wa-logo { display: inline-block; }

/* ── Landing Page ── */
.landing { min-height: 100vh; background: #fff; color: #1a1a2e; font-family: 'Inter', sans-serif; overflow-y: auto; }
.land-nav { display: flex; align-items: center; justify-content: space-between; padding: 16px 40px; border-bottom: 1px solid #e8eaf0; background: #fff; position: sticky; top: 0; z-index: 100; }
.land-nav-logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; color: #1a1a2e; }
.land-nav-logo .dot { color: #25d366; }
.land-nav-actions { display: flex; align-items: center; gap: 10px; }
.land-btn-ghost { background: none; border: 1px solid #d1d5db; border-radius: 8px; padding: 8px 18px; font-size: 13px; font-weight: 500; cursor: pointer; color: #374151; font-family: inherit; transition: all .15s; }
.land-btn-ghost:hover { border-color: #25d366; color: #25d366; }
.land-btn-primary { background: #25d366; border: none; border-radius: 8px; padding: 9px 20px; font-size: 13px; font-weight: 600; cursor: pointer; color: #fff; font-family: inherit; transition: background .15s; }
.land-btn-primary:hover { background: #1da851; }

.land-hero { text-align: center; padding: 60px 24px 0; max-width: 900px; margin: 0 auto; }
.land-hero h1 { font-size: 38px; font-weight: 800; line-height: 1.2; color: #1a1a2e; margin-bottom: 16px; }
.land-hero h1 span { color: #25d366; }
.land-hero > p { font-size: 16px; color: #6b7280; max-width: 580px; margin: 0 auto 32px; line-height: 1.6; }

.land-tabs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 40px; }
.land-tab { background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 20px; padding: 8px 18px; font-size: 13px; font-weight: 500; cursor: pointer; color: #6b7280; font-family: inherit; transition: all .15s; }
.land-tab:hover { border-color: #25d366; color: #25d366; background: #f0fdf4; }
.land-tab.active { background: #25d366; border-color: #25d366; color: #fff; }

.land-feat-line { font-size: 15px; font-weight: 600; color: #25d366; margin-bottom: 28px; max-width: 680px; margin-left: auto; margin-right: auto; }

.land-preview-wrap { background: linear-gradient(180deg, #f0fdf4 0%, #f8faff 100%); border-radius: 20px 20px 0 0; padding: 28px 28px 0; margin: 0 -24px; overflow: hidden; }
.land-preview { background: #1a1f2e; border-radius: 12px 12px 0 0; overflow: hidden; box-shadow: 0 -4px 40px rgba(0,0,0,.25); min-height: 340px; display: flex; }

/* Chat mockup inside preview */
.mock-sidebar { width: 240px; background: #161b22; border-right: 1px solid #30363d; flex-shrink: 0; display: flex; flex-direction: column; }
.mock-sb-head { padding: 12px 14px; border-bottom: 1px solid #30363d; }
.mock-sb-title { font-size: 13px; font-weight: 700; color: #e6edf3; margin-bottom: 8px; }
.mock-sb-search { background: #0d1117; border: 1px solid #30363d; border-radius: 6px; padding: 6px 10px; font-size: 11px; color: #8b949e; }
.mock-conv { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 1px solid #21262d; cursor: default; }
.mock-conv.active { background: rgba(37,211,102,.08); }
.mock-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.mock-conv-body { flex: 1; min-width: 0; }
.mock-conv-name { font-size: 12px; font-weight: 600; color: #e6edf3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mock-conv-prev { font-size: 10px; color: #8b949e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }

.mock-chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.mock-chat-head { padding: 12px 16px; border-bottom: 1px solid #30363d; display: flex; align-items: center; gap: 10px; }
.mock-chat-name { font-size: 13px; font-weight: 600; color: #e6edf3; }
.mock-chat-sub { font-size: 11px; color: #8b949e; }
.mock-msgs { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.mock-msg-in { align-self: flex-start; background: #1c2128; border-radius: 0 10px 10px 10px; padding: 8px 12px; max-width: 65%; font-size: 11px; color: #e6edf3; line-height: 1.4; }
.mock-msg-out { align-self: flex-end; background: #0d2818; border-radius: 10px 10px 0 10px; padding: 8px 12px; max-width: 65%; font-size: 11px; color: #e6edf3; line-height: 1.4; }
.mock-msg-bot { align-self: flex-end; background: #1a3a1a; border: 1px solid rgba(37,211,102,.2); border-radius: 10px 10px 0 10px; padding: 8px 12px; max-width: 70%; font-size: 11px; color: #e6edf3; line-height: 1.4; }
.mock-input { padding: 10px 14px; border-top: 1px solid #30363d; background: #161b22; display: flex; gap: 8px; align-items: center; }
.mock-input-box { flex: 1; background: #0d1117; border: 1px solid #30363d; border-radius: 8px; padding: 7px 10px; font-size: 11px; color: #8b949e; }

.mock-details { width: 200px; background: #161b22; border-left: 1px solid #30363d; flex-shrink: 0; padding: 16px 12px; }
.mock-det-title { font-size: 11px; font-weight: 700; color: #8b949e; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.mock-det-row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 10px; }
.mock-det-label { color: #8b949e; }
.mock-det-value { color: #e6edf3; font-weight: 500; }
.mock-badge { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 9px; font-weight: 700; }
.mock-badge-green { background: rgba(37,211,102,.15); color: #25d366; }
.mock-badge-blue { background: rgba(56,139,253,.15); color: #388bfd; }

.land-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; max-width: 900px; margin: 60px auto 0; padding: 0 24px; }
.land-feat-card { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 14px; padding: 24px; text-align: left; }
.land-feat-icon { font-size: 28px; margin-bottom: 12px; }
.land-feat-title { font-size: 15px; font-weight: 700; color: #1a1a2e; margin-bottom: 6px; }
.land-feat-desc { font-size: 13px; color: #6b7280; line-height: 1.5; }

.land-cta-section { text-align: center; padding: 60px 24px; }
.land-cta-btn { background: #25d366; color: #fff; border: none; border-radius: 10px; padding: 16px 36px; font-size: 16px; font-weight: 700; cursor: pointer; font-family: inherit; transition: all .2s; box-shadow: 0 4px 20px rgba(37,211,102,.35); }
.land-cta-btn:hover { background: #1da851; transform: translateY(-1px); box-shadow: 0 6px 28px rgba(37,211,102,.45); }
.land-footer { text-align: center; padding: 20px; border-top: 1px solid #e5e7eb; font-size: 12px; color: #9ca3af; }

@media (max-width: 640px) {
  .land-hero h1 { font-size: 26px; }
  .land-nav { padding: 14px 20px; }
  .land-features { grid-template-columns: 1fr; }
  .mock-details { display: none; }
  .mock-sidebar { width: 200px; }
}

/* ── Contacts Table ── */
.ct-th { padding: 10px 16px; font-size: 11px; font-weight: 600; color: var(--text3); text-align: left; letter-spacing: .4px; border-bottom: 1px solid var(--border); background: var(--bg2); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.ct-td { padding: 12px 16px; font-size: 13px; color: var(--text); border-bottom: 1px solid var(--border2); vertical-align: middle; }
.ct-row { cursor: pointer; transition: background .1s; }
.ct-row:hover td { background: var(--bg3); }
