/* ==========================================================================
   ClayHR Sales Agent — platform UI
   Modern, clean dashboard styling (no framework, system font stack).
   ========================================================================== */
:root {
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-50: #eef2ff;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --border: #e6e8ef;
  --text: #111827;
  --muted: #6b7280;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #2563eb;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --shadow: 0 4px 16px rgba(16,24,40,.08);
  --sidebar-w: 256px;
  --sidebar-mini: 76px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Modern thin scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: #c8ccd8 transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #c8ccd8; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #aab0c0; background-clip: content-box; }
*::-webkit-scrollbar-corner { background: transparent; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 8px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand .dot { width: 28px; height: 28px; border-radius: 9px; background: linear-gradient(135deg, var(--primary), #7c6cff); display: inline-block; flex-shrink: 0; }
.brand-logo { width: 38px; height: 38px; border-radius: 9px; object-fit: contain; flex-shrink: 0; }
/* ClayHR brand wordmark — two-tone blue (Clay dark, HR lighter), Pulse accent */
.brand-text { font-family: 'Sora', -apple-system, sans-serif; font-weight: 700; font-size: 18px; letter-spacing: -.01em; white-space: nowrap; }
.cw-clay { color: #1e5a8c; }
.cw-hr { color: #3f8ed0; }
.cw-pulse { color: #3f8ed0; font-weight: 700; }
.collapse-btn { width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 50%; background: #fff; color: var(--muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .15s; }
.collapse-btn:hover { background: var(--bg); color: var(--text); }
.collapse-btn svg { transition: transform .2s; }
.sidebar-collapsed .collapse-btn svg { transform: rotate(180deg); }
.nav { padding: 8px 12px; flex: 1; overflow-y: auto; }
.nav .nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #9aa1b1; padding: 16px 12px 6px; font-weight: 600; }
.nav .nav-label-row { display: flex; align-items: center; justify-content: space-between; }
.nav .nav-add { width: 22px; height: 22px; border: none; border-radius: 6px; background: var(--bg); color: var(--muted);
  display: flex; align-items: center; justify-content: center; font-size: 16px; line-height: 1; cursor: pointer; padding: 0; }
.nav .nav-add:hover { background: var(--primary-50); color: var(--primary); text-decoration: none; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px;
  color: #374151; font-weight: 500; margin-bottom: 2px; font-size: 14px;
}
.nav a:hover { background: var(--bg); text-decoration: none; }
.nav a.active { background: var(--primary-50); color: var(--primary-600); font-weight: 600; }
.nav a .ico { width: 20px; display: flex; align-items: center; justify-content: center; opacity: .9; flex-shrink: 0; }
.nav a .ico svg { width: 18px; height: 18px; }
.nav .ico-letter { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, var(--primary), #7c6cff);
  color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; opacity: 1; }
.nav .ico-avatar { width: 22px; height: 22px; border-radius: 6px; overflow: hidden; opacity: 1; flex-shrink: 0; }
.nav .ico-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nav .nav-agent-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .dot-status { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.nav .dot-status.on { background: #22c55e; }
.nav .dot-status.off { background: #cbd0db; }
.nav .nav-empty { padding: 8px 12px; color: #9aa1b1; font-size: 13px; }

.user-card {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; margin: 8px;
  border-radius: 12px; background: var(--bg); font-size: 13px;
}
.user-card img, .avatar-mini { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-mini { background: linear-gradient(135deg, var(--primary), #7c6cff); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center; }
.avatar-mini.sm { width: 28px; height: 28px; font-size: 12px; }
.user-card-info { flex: 1; min-width: 0; }
.user-card .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card .user-sub { color: var(--muted); font-size: 12px; }
.logout-icon { width: 34px; height: 34px; border: 1px solid var(--border); background: #fff; border-radius: 9px; color: var(--muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .15s; }
.logout-icon:hover { color: var(--danger); border-color: #fca5a5; background: #fff5f5; }

.content { flex: 1; min-width: 0; }
.topbar {
  height: 68px; background: var(--bg);
  display: flex; align-items: center; justify-content: space-between; padding: 0 40px;
  position: sticky; top: 0; z-index: 10;
  width: 100%; max-width: 1280px; margin: 0 auto;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar .crumb { font-weight: 700; font-size: 20px; letter-spacing: -.01em; }
.topbar .crumb span { color: var(--muted); font-weight: 500; font-size: 18px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }

/* Collapsible sidebar — collapses to a slim icon rail (does not disappear) */
.sidebar { transition: width .18s ease; }
.sidebar-collapsed .sidebar { width: var(--sidebar-mini); }

/* hide text/secondary bits in mini mode */
.sidebar-collapsed .brand-text,
.sidebar-collapsed .nav-text,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .nav-add,
.sidebar-collapsed .nav-agent-name,
.sidebar-collapsed .nav-group .caret,
.sidebar-collapsed .nav-sub,
.sidebar-collapsed .user-card-info,
.sidebar-collapsed .logout-icon { display: none; }

/* center the remaining icons */
.sidebar-collapsed .brand { display: none; }
.sidebar-collapsed .sidebar-top { justify-content: center; padding: 16px 0 8px; }
.sidebar-collapsed .nav a,
.sidebar-collapsed .nav-group > summary { justify-content: center; gap: 0; padding: 10px 0; }
.sidebar-collapsed .nav-group > summary .dot-status { position: absolute; margin: 0; transform: translate(12px, -12px); }
.sidebar-collapsed .nav-group > summary { position: relative; }
.sidebar-collapsed .user-card { justify-content: center; padding: 12px 0; }

/* Collapsible agent group in the sidebar */
.nav-group { margin-bottom: 1px; }
.nav-group > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px; color: #374151; font-weight: 500; font-size: 14px;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::marker { content: ""; }
.nav-group > summary:hover { background: var(--bg); }
.nav-group[open] > summary { color: var(--text); }
.nav-group .caret { margin-left: 2px; display: flex; align-items: center; color: #9aa1b1; transition: transform .2s; }
.nav-group[open] .caret { transform: rotate(180deg); }
.nav-sub { margin: 2px 0 8px 16px; padding-left: 6px; }
.nav-sub a { position: relative; padding: 8px 12px; font-size: 13px; color: #6b7280; margin-bottom: 1px; border-radius: 8px; }
.nav-sub a svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .8; }
.nav-sub a:hover { background: var(--bg); }
.nav-sub a.active { background: var(--primary-50); color: var(--primary-600); font-weight: 600; }
.nav-sub a.active svg { opacity: 1; }
.nav-sub a.active::before { content: ""; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }

.page { padding: 32px 40px 48px; max-width: 1280px; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 16px; }
.page-head h1 { font-size: 22px; }
.page-head p { margin: 4px 0 0; }

/* ---------- Tabs (agent sub-nav) ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tabs a {
  padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--primary-600); border-bottom-color: var(--primary); font-weight: 600; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 24px; margin-bottom: 20px; }
.card h2 { font-size: 16px; margin-bottom: 4px; }
.card .hint { color: var(--muted); margin: 0 0 16px; font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
input[type=text], input[type=url], input[type=email], input[type=number],
input[type=password], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
textarea { min-height: 100px; resize: vertical; }
input[type=color] { width: 52px; height: 40px; padding: 3px; border-radius: 9px; cursor: pointer; }
input[type=file] { font-size: 13px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 160px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.checkbox input { width: auto; }
input.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 13px; color: var(--muted); background: var(--bg); }
.field-hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin: 4px 0 24px; }
.input-group { display: flex; gap: 8px; }
.input-group input { flex: 1; }

/* Two-column setting rows (label/hint left, control right) */
.setting-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.setting-row:first-of-type { padding-top: 8px; }
.setting-row:last-child { border-bottom: none; padding-bottom: 4px; }
.setting-row .label-col { flex: 1; max-width: 50%; }
.setting-row .label-col label { display: block; font-weight: 600; font-size: 14px; }
.setting-row .label-col .hint { font-size: 13px; color: var(--muted); margin: 3px 0 0; }
.setting-row .control-col { flex: 1; max-width: 360px; }
.setting-row .control-col > * { width: 100%; }
.toggle-field { display: flex; align-items: center; gap: 10px; }
.toggle-field .switch { width: 44px; flex: none; }
.toggle-field #status-label { font-size: 14px; font-weight: 500; color: var(--text); }

/* Full-width stacked setting (for long fields like instructions) */
.setting-stacked { border-top: 1px solid var(--border); padding-top: 18px; margin-top: 4px; }
.setting-stacked > label { display: block; font-weight: 600; font-size: 14px; }
.setting-stacked > .hint { font-size: 13px; color: var(--muted); margin: 3px 0 10px; }

@media (max-width: 680px) {
  .setting-row { flex-direction: column; gap: 10px; }
  .setting-row .label-col, .setting-row .control-col { max-width: 100%; }
}

/* Card header with icon */
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.card-ico { flex-shrink: 0; width: 38px; height: 38px; border-radius: 10px; background: var(--primary-50); color: var(--primary);
  display: flex; align-items: center; justify-content: center; }
.card-head h2 { font-size: 16px; }
.card-sub { color: var(--muted); font-size: 13px; margin: 2px 0 0; }

/* Danger zone (horizontal) */
.danger-zone { border-color: #fecaca; background: #fff7f7; }
.danger-row { display: flex; align-items: center; gap: 14px; }
.danger-ico { flex-shrink: 0; width: 38px; height: 38px; border-radius: 10px; background: #fee2e2; color: var(--danger);
  display: flex; align-items: center; justify-content: center; }
.danger-text { flex: 1; }
.danger-text h2 { font-size: 15px; color: #b91c1c; margin-bottom: 2px; }
.danger-text p { margin: 0; font-size: 13px; color: #9b5757; }
.btn.danger-outline { background: #fff; color: var(--danger); border-color: #fca5a5; }
.btn.danger-outline:hover { background: #fee2e2; }
@media (max-width: 620px) { .danger-row { flex-direction: column; align-items: flex-start; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; background: var(--primary); color: #fff;
  border: 1px solid var(--primary); padding: 9px 16px; border-radius: 9px; font-size: 14px;
  font-weight: 600; cursor: pointer; transition: background .15s; text-decoration: none;
}
.btn:hover { background: var(--primary-600); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--bg); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.danger:hover { filter: brightness(.93); }
.btn.sm { padding: 6px 10px; font-size: 13px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
.empty-row td { color: var(--muted); text-align: center; padding: 28px; }

/* ---------- Badges / tags ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--muted); }
.badge.green { background: #dcfce7; color: #15803d; }
.badge.amber { background: #fef3c7; color: #b45309; }
.badge.blue  { background: #dbeafe; color: #1d4ed8; }
.badge.red   { background: #fee2e2; color: #b91c1c; }
.badge.grey  { background: #eef0f4; color: #4b5563; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tag { display: inline-flex; align-items: center; gap: 8px; background: var(--bg); padding: 6px 12px; border-radius: 999px; font-size: 13px; }
.tag form { display: inline; margin: 0; }
.tag button { border: none; background: none; color: var(--danger); cursor: pointer; font-size: 15px; line-height: 1; padding: 0; }

/* ---------- Toggle switch ---------- */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: #cbd0db; border-radius: 24px; transition: .2s; }
.slider:before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(20px); }
.tool-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 0 14px; }
.tool-config { padding: 4px 0 18px; }
.cfg-field { margin-bottom: 16px; }
.cfg-field > label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.cfg-field input[type=number] { max-width: 130px; }
.cfg-field select { max-width: 220px; }
.cfg-field .field-hint { margin-top: 5px; }
.tool-divider { border: none; border-top: 1px solid var(--border); margin: 6px 0; }

/* ---------- Knowledge page ---------- */
.kb-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 14px; margin-bottom: 20px; }
.kb-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.kb-stat .n { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.kb-stat .l { color: var(--muted); font-size: 12px; margin-top: 2px; }

.kb-tabs { display: inline-flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 11px; margin: 14px 0 20px; }
.kb-tab { display: inline-flex; align-items: center; gap: 7px; border: none; background: none; cursor: pointer;
  padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--muted); }
.kb-tab svg { width: 16px; height: 16px; }
.kb-tab:hover { color: var(--text); }
.kb-tab.active { background: var(--surface); color: var(--primary-600); box-shadow: var(--shadow-sm); font-weight: 600; }
.kb-panel { display: none; }
.kb-panel.active { display: block; animation: kbfade .15s ease; }
@keyframes kbfade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  border: 2px dashed var(--border); border-radius: 12px; padding: 36px 20px; cursor: pointer; text-align: center;
  color: var(--muted); transition: border-color .15s, background .15s; }
.dropzone:hover { border-color: var(--primary); background: var(--primary-50); }
.dropzone input[type=file] { display: none; }
.dropzone svg { width: 30px; height: 30px; color: var(--primary); }
.dropzone span { font-weight: 600; color: var(--text); }
.dropzone small { font-size: 12px; }

.kb-title { font-weight: 600; }
.pulse-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  margin-right: 5px; vertical-align: middle; animation: clayhrPulse2 1s infinite ease-in-out; }
@keyframes clayhrPulse2 { 0%,100% { opacity: .35; } 50% { opacity: 1; } }

/* ---------- Users page ---------- */
.card h2 .hicon { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  border-radius: 8px; background: var(--primary-50); color: var(--primary); margin-right: 6px; vertical-align: -6px; }

.invite-card { position: relative; overflow: hidden; }
.invite-art { position: absolute; top: 18px; right: 22px; width: 84px; height: 84px; color: var(--primary); opacity: .12; }
.invite-form { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-top: 6px; }
.invite-form .field { flex: 1; min-width: 180px; margin-bottom: 0; }
.invite-form .btn { white-space: nowrap; }

.role-pill { font-weight: 600; }
.role-pill.role-superadmin { color: #6d28d9; }
.role-pill.role-admin { color: #2563eb; }
.role-pill.role-member { color: #16a34a; }

.users-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.users-toolbar h2 { margin: 0; }
.toolbar-controls { display: flex; gap: 10px; align-items: center; }
.search-box { position: relative; display: flex; align-items: center; }
.search-box svg { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search-box input { padding-left: 36px; width: 260px; max-width: 60vw; }
.role-filter { width: auto; min-width: 130px; }

.users-table td { padding: 14px; }
.user-cell { display: flex; align-items: center; gap: 12px; }
.uavatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), #7c6cff); color: #fff; font-weight: 700; font-size: 14px; overflow: hidden; }
.uavatar img { width: 100%; height: 100%; object-fit: cover; }
.uname { font-weight: 600; }
.uemail { color: var(--muted); font-size: 13px; }
.you-pill { display: inline-block; font-size: 11px; font-weight: 600; color: var(--primary-600); background: var(--primary-50); padding: 1px 7px; border-radius: 999px; margin-left: 4px; vertical-align: 1px; }

.role-badge { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; text-transform: capitalize; }
.role-badge.role-superadmin { background: #ede9fe; color: #6d28d9; }
.role-badge.role-admin { background: #dbeafe; color: #1d4ed8; }
.role-badge.role-member { background: #dcfce7; color: #15803d; }

.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }
.status-pill .sdot { width: 7px; height: 7px; border-radius: 50%; }
.status-pill.on { color: #15803d; } .status-pill.on .sdot { background: #22c55e; }
.status-pill.off { color: var(--muted); } .status-pill.off .sdot { background: #cbd0db; }

.row-menu-wrap { position: relative; display: inline-block; }
.row-menu-btn { border: 1px solid var(--border); background: #fff; width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.row-menu-btn:hover { background: var(--bg); color: var(--text); }
.row-menu-pop { position: absolute; top: 38px; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 11px;
  box-shadow: 0 12px 30px rgba(16,24,40,.16); min-width: 180px; padding: 6px; display: none; z-index: 20; text-align: left; }
.row-menu-pop.open { display: block; }
.row-menu-pop .rm-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 6px 10px 4px; }
.row-menu-pop form { margin: 0; }
.row-menu-pop button { width: 100%; text-align: left; background: none; border: none; padding: 8px 10px; border-radius: 7px; font-size: 14px; cursor: pointer; color: var(--text); }
.row-menu-pop button:hover { background: var(--bg); }
.row-menu-pop .danger-item { color: var(--danger); }
.row-menu-pop .rm-sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* ---------- List pages (tickets / leads) ---------- */
.head-with-ico { display: flex; align-items: flex-start; gap: 14px; }
.page-ico { flex-shrink: 0; width: 44px; height: 44px; border-radius: 12px; background: var(--primary-50); color: var(--primary);
  display: flex; align-items: center; justify-content: center; }

.list-toolbar { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.list-toolbar .search-box { flex: none; width: 280px; max-width: 60vw; }
.list-toolbar .search-box input { width: 100%; padding-left: 36px; }
/* push the filter group to the right edge (search stays on the left) */
.list-toolbar select.role-filter:first-of-type { margin-left: auto; }

.list-table { width: 100%; }
.list-table th { padding: 12px 18px; }
.list-table td { padding: 16px 18px; vertical-align: middle; }
.li-title { font-weight: 600; }
.li-desc { color: var(--muted); font-size: 13px; margin: 3px 0; max-width: 460px; }
.li-meta { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #9aa1b1; background: var(--bg); padding: 2px 8px; border-radius: 6px; }

.contact-cell { display: flex; align-items: center; gap: 10px; }
.cavatar { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), #7c6cff); color: #fff; font-weight: 700; font-size: 13px; }
.cavatar.empty { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }

.prio-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.prio-badge .pdot { width: 6px; height: 6px; border-radius: 50%; }
.prio-badge.grey { background: #eef0f4; color: #4b5563; } .prio-badge.grey .pdot { background: #9ca3af; }
.prio-badge.amber { background: #fef3c7; color: #b45309; } .prio-badge.amber .pdot { background: #f59e0b; }
.prio-badge.red { background: #fee2e2; color: #b91c1c; } .prio-badge.red .pdot { background: #ef4444; }
.prio-badge.blue { background: #dbeafe; color: #1d4ed8; } .prio-badge.blue .pdot { background: #3b82f6; }
.prio-badge.green { background: #dcfce7; color: #15803d; } .prio-badge.green .pdot { background: #22c55e; }

/* status dropdown (pill + caret) */
.status-dd { position: relative; display: inline-block; }
.status-trigger { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; border: none; font-weight: 600; }
.status-menu { position: absolute; top: 34px; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 30px rgba(16,24,40,.16); min-width: 150px; padding: 6px; display: none; z-index: 20; }
.status-menu.open { display: block; }
.status-menu form { margin: 0; }
.status-menu button { width: 100%; text-align: left; background: none; border: none; padding: 8px 10px; border-radius: 7px; font-size: 14px; cursor: pointer; color: var(--text); }
.status-menu button:hover { background: var(--bg); }
.status-menu button.current { color: var(--primary-600); font-weight: 600; }

.list-footer { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-top: 1px solid var(--border); font-size: 13px; }
.pager { display: flex; align-items: center; gap: 8px; }
.pg-btn { width: 32px; height: 32px; border: 1px solid var(--border); background: #fff; border-radius: 8px; cursor: pointer; color: var(--text); }
.pg-btn:hover:not(:disabled) { background: var(--bg); }
.pg-btn:disabled { opacity: .4; cursor: default; }
.pg-num { min-width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--primary); color: var(--primary-600); border-radius: 8px; font-weight: 600; }
.pg-btn.active { border-color: var(--primary); color: var(--primary-600); font-weight: 600; }
.footer-right { display: flex; align-items: center; gap: 10px; }
.row-actions { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.page-link { display: inline-flex; align-items: center; gap: 5px; }
.page-link svg { opacity: .6; }

/* ---------- Domains page ---------- */
.add-row { display: flex; gap: 12px; align-items: center; margin-top: 6px; }
.search-box.prefixed { flex: 1; position: relative; display: flex; align-items: center; }
.search-box.prefixed svg { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }
.search-box.prefixed input { width: 100%; padding-left: 38px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.count-chip { background: var(--bg); color: var(--muted); font-weight: 600; font-size: 12px; padding: 6px 13px; border-radius: 999px; }
.ok-badge { display: inline-flex; align-items: center; gap: 5px; background: #dcfce7; color: #15803d; font-weight: 600; font-size: 12px; padding: 4px 10px; border-radius: 999px; }
.info-callout { display: flex; gap: 12px; background: var(--primary-50); border: 1px solid #e0e3f5; border-radius: var(--radius); padding: 16px 18px; max-width: 1280px; }
.info-callout > svg { color: var(--primary); flex-shrink: 0; }
.info-callout strong { color: var(--primary-600); display: block; margin-bottom: 3px; }
.info-callout p { margin: 0; font-size: 13px; color: #4b5563; }

/* ---------- Widget page ---------- */
.upload-btn { cursor: pointer; }
.color-field { display: flex; align-items: center; gap: 8px; }
.color-field input[type=color] { width: 44px; height: 40px; flex-shrink: 0; padding: 3px; }
.color-field input[type=text] { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.char-count { text-align: right; font-size: 11px; color: var(--muted); margin-top: 4px; }

.widget-layout { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; }
@media (max-width: 900px) { .widget-layout { grid-template-columns: 1fr; } }
.widget-form .row { gap: 14px; }

.widget-preview { position: sticky; top: 84px; }
.wp-label { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.wp-panel { background: #fff; border-radius: 16px; box-shadow: 0 12px 32px rgba(16,24,40,.16); overflow: hidden; }
.wp-header { color: #fff; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.wp-avatar { width: 32px; height: 32px; border-radius: 50%; background: #fff; flex-shrink: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.wp-avatar img { width: 100%; height: 100%; object-fit: cover; }
.wp-head-main { flex: 1; min-width: 0; }
.wp-title { font-size: 14px; font-weight: 700; }
.wp-sub { font-size: 11px; opacity: .85; }
.wp-min { opacity: .8; }
.wp-body { background: #f6f7f9; padding: 16px 14px; min-height: 150px; }
.wp-bubble { background: #fff; border: 1px solid #eceef2; border-radius: 14px; border-bottom-left-radius: 4px; padding: 9px 12px; font-size: 13px; color: #1f2937; display: inline-block; max-width: 90%; }
.wp-chips { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin-top: 10px; }
.wp-chip { background: #fff; border: 1px solid; border-radius: 14px; padding: 6px 11px; font-size: 12px; max-width: 90%; }
.wp-inputbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-top: 1px solid #eceef2; font-size: 13px; color: #9ca3af; }
.wp-send { width: 28px; height: 28px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.wp-brand { text-align: center; font-size: 10px; color: #9ca3af; padding: 6px; }
.wp-launcher { width: 48px; height: 48px; border-radius: 50%; margin: 14px 0 0 auto; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 20px rgba(0,0,0,.18); }

/* ---------- Embed page ---------- */
.card-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.howto-link { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--primary-600); flex-shrink: 0; }

.code-block { position: relative; background: #0f1117; border-radius: 12px; overflow: hidden; }
.code-copy { position: absolute; top: 12px; right: 12px; display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.08); color: #e2e8f0; border: 1px solid rgba(255,255,255,.14); padding: 6px 11px;
  border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; }
.code-copy:hover { background: rgba(255,255,255,.16); }
.code-lines { counter-reset: line; list-style: none; margin: 0; padding: 18px 0; }
.code-lines li { counter-increment: line; display: flex; padding: 0 18px; white-space: pre;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; line-height: 1.75; color: #c9d1d9; }
.code-lines li::before { content: counter(line); width: 22px; margin-right: 18px; text-align: right; color: #4b5468; flex-shrink: 0; }
.tok-tag { color: #f47067; } .tok-attr { color: #6cb6ff; } .tok-str { color: #96d0ff; }
.tok-kw { color: #f47067; } .tok-punc { color: #768390; }

/* ---------- Conversation transcript ---------- */
.transcript { display: flex; flex-direction: column; gap: 14px; }
.t-msg { max-width: 78%; }
.t-user { align-self: flex-end; text-align: right; }
.t-assistant { align-self: flex-start; }
.t-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.t-bubble { display: inline-block; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5;
  white-space: pre-wrap; word-wrap: break-word; text-align: left; }
.t-user .t-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 5px; }
.t-assistant .t-bubble { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 5px; }

/* ---------- Avatar (widget page) ---------- */
.avatar-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.avatar-preview { width: 72px; height: 72px; border-radius: 50%; background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-preview svg { width: 34px; height: 34px; }
.avatar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.avatar-upload { display: flex; align-items: center; gap: 10px; }

/* ---------- Code block ---------- */
pre.code { background: #0f1117; color: #e2e8f0; padding: 18px; border-radius: 10px; overflow-x: auto; font-size: 13px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; line-height: 1.6; }

/* ---------- Flash / alert ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; }
.alert.success { background: #dcfce7; color: #15803d; }
.alert.error { background: #fee2e2; color: #b91c1c; }

/* ---------- Login (split hero + card) ---------- */
.auth-body { margin: 0; background: #eef2fb; display: flex; flex-direction: column; min-height: 100vh; }
.auth-split { flex: 1; display: grid; grid-template-columns: 1.05fr 1fr; }

.auth-hero { position: relative; padding: 44px 56px; display: flex; flex-direction: column;
  background: linear-gradient(165deg, #dfe8fc 0%, #eaf0fc 50%, #eef2fb 100%); overflow: hidden; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 56px; }
.auth-brand img { width: 48px; height: 48px; border-radius: 11px; object-fit: contain; }
.brand-wordmark { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 27px; letter-spacing: -.01em; }
.auth-hero-body { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 460px; }
.auth-h1 { font-family: 'Sora', sans-serif; font-weight: 800; font-size: 38px; line-height: 1.18; color: #1e293b; margin: 0 0 14px; letter-spacing: -.02em; }
.auth-hero-sub { color: #64748b; font-size: 16px; line-height: 1.6; margin: 0 0 8px; max-width: 380px; }
.auth-illus { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 200px; position: relative; margin-bottom: 36px; }
.auth-illus-img { max-width: 100%; max-height: 320px; }
.auth-illus-fb { display: none; flex-direction: column; align-items: center; gap: 14px; }
.auth-illus-fb .ai-bubble { background: #2563eb; color: #fff; padding: 12px 16px; border-radius: 16px; border-bottom-left-radius: 4px; font-size: 14px; box-shadow: 0 8px 20px rgba(37,99,235,.25); }
.auth-illus-fb .ai-typing { background: #fff; color: #2563eb; display: inline-flex; gap: 5px; align-self: flex-end; border-bottom-left-radius: 16px; border-bottom-right-radius: 4px; }
.auth-illus-fb .ai-typing span { width: 7px; height: 7px; border-radius: 50%; background: #93b4f5; display: inline-block; animation: clayhrBounce 1.3s infinite ease-in-out both; }
.auth-illus-fb .ai-typing span:nth-child(2) { animation-delay: .18s; } .auth-illus-fb .ai-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes clayhrBounce { 0%,70%,100% { transform: translateY(0); opacity: .4; } 35% { transform: translateY(-5px); opacity: 1; } }
.auth-illus-fb .ai-logo { width: 88px; height: 88px; border-radius: 24px; margin-top: 10px; box-shadow: 0 12px 30px rgba(37,99,235,.2); }
.auth-features { display: flex; gap: 26px; flex-wrap: wrap; }
.feat { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: #475569; line-height: 1.25; }
.feat-ico { width: 38px; height: 38px; flex-shrink: 0; border-radius: 10px; background: #dbeafe; color: #2563eb; display: flex; align-items: center; justify-content: center; }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { background: #fff; border-radius: 22px; box-shadow: 0 24px 60px rgba(30,58,138,.14); padding: 40px; width: 420px; max-width: 100%; }
.auth-card-logo { width: 56px; height: 56px; border-radius: 15px; object-fit: contain; display: block; margin: 0 auto 16px; }
.auth-card h2 { text-align: center; font-family: 'Sora', sans-serif; font-weight: 800; font-size: 24px; letter-spacing: -.02em; }
.auth-card-sub { text-align: center; color: var(--muted); margin: 4px 0 24px; }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; padding: 14px; border: 1.5px solid var(--border); border-radius: 12px; background: #fff; font-weight: 700; font-size: 15px; color: var(--text); box-shadow: 0 1px 2px rgba(16,24,40,.04); transition: border-color .15s, box-shadow .15s, transform .12s; }
.google-btn:hover { border-color: #c7cad6; box-shadow: 0 6px 16px rgba(16,24,40,.08); transform: translateY(-1px); text-decoration: none; }
.auth-invite { text-align: center; color: var(--muted); font-size: 13px; line-height: 1.5; margin: 20px 0 0; }
.auth-or { display: flex; align-items: center; color: #94a3b8; font-size: 13px; margin: 20px 0; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-or span { padding: 0 12px; }
.auth-label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.auth-input { position: relative; display: flex; align-items: center; margin-bottom: 14px; }
.auth-input .lead { position: absolute; left: 12px; color: #94a3b8; pointer-events: none; }
.auth-input input { width: 100%; padding: 11px 40px 11px 38px; border: 1px solid var(--border); border-radius: 11px; font-size: 14px; }
.auth-input .eye { position: absolute; right: 8px; background: none; border: none; color: #94a3b8; cursor: pointer; padding: 4px; display: flex; }
.auth-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; margin: 4px 0 18px; }
.auth-row .checkbox { font-weight: 500; color: var(--muted); }
.auth-signin { width: 100%; justify-content: center; padding: 12px; font-size: 15px; border-radius: 11px; }
.auth-secure { display: flex; align-items: center; justify-content: center; gap: 6px; color: #94a3b8; font-size: 12px; margin: 16px 0 0; }
.auth-footer { text-align: center; color: #94a3b8; font-size: 13px; padding: 16px; }

@media (max-width: 880px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
}

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); display: flex; align-items: center; gap: 16px; transition: box-shadow .15s, transform .15s; }
.stat:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.stat-ico { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-ico svg { width: 24px; height: 24px; }
.stat .n { font-size: 28px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.stat .l { color: var(--text); font-size: 13px; font-weight: 500; margin-top: 2px; }

/* ---------- Bar chart ---------- */
.chart { display: flex; align-items: flex-end; gap: 14px; height: 180px; padding-top: 10px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.chart-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.chart-bar { width: 60%; max-width: 46px; min-height: 4px; border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #6366f1, #4f46e5); transition: height .4s ease; }
.chart-bar:hover { background: linear-gradient(180deg, #818cf8, #4338ca); }
.chart-val { font-size: 12px; font-weight: 600; margin-top: 6px; color: var(--text); }
.chart-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Two-column ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- Agent cards ---------- */
.agent-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px; transition: box-shadow .15s, transform .15s, border-color .15s; }
.agent-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: #d7d9e6; text-decoration: none; }
.agent-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.agent-avatar { width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(135deg, var(--primary), #7c6cff);
  color: #fff; font-weight: 700; font-size: 18px; display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.agent-avatar img { width: 100%; height: 100%; object-fit: cover; }
.agent-card h2 { font-size: 16px; color: var(--text); margin-bottom: 10px; }
.agent-meta { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.agent-meta span { display: inline-flex; align-items: center; gap: 5px; }
.mini-ico { width: 14px; height: 14px; }
.agent-key { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 11px; color: #9ca3af;
  background: var(--bg); padding: 6px 10px; border-radius: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Modal ---------- */
.modal { border: none; border-radius: 16px; padding: 28px; width: 440px; max-width: calc(100vw - 32px);
  box-shadow: 0 24px 60px rgba(16,24,40,.24); }
.modal::backdrop { background: rgba(17,24,39,.45); backdrop-filter: blur(2px); }

@media (max-width: 820px) {
  .sidebar { position: fixed; left: -100%; }
  .page { padding: 20px; }
}
