* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
:root {
  --primary:#6366f1;
  --primary-dark:#4f46e5;
  --primary-light:#818cf8;
  --success:#10b981;
  --danger:#ef4444;
  --warning:#f59e0b;
  --bg:#fafafa;
  --card:#fff;
  --text:#1f2937;
  --text-light:#6b7280;
  --border:#e5e7eb;
  --radius:16px;
  --shadow:0 4px 20px rgba(0,0,0,.06);
}
body {
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Cairo",
    "Tajawal",
    sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, .95);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand {
  font-weight: 700;
  color: var(--primary);
  font-size: 18px;
}
.lang-switcher {
  display: flex;
  gap: 6px;
}
.lang-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.lang-btn:hover {
  border-color: var(--primary);
}
.lang-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 20px 40px;
}
.hero {
  text-align: center;
  padding: 60px 20px 40px;
}
.hero h1 {
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 800;
  margin-bottom: 20px;
  background:
    linear-gradient(
      135deg,
      var(--primary),
      var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--text-light);
  max-width: 700px;
  margin: 0 auto 30px;
}
.badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  background: #f0fdf4;
  color: var(--success);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 24px;
}
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 40px 0;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}
.feature {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  text-align: left;
}
.feature .icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background:
    linear-gradient(
      135deg,
      var(--primary),
      var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  margin-bottom: 12px;
}
.feature h3 {
  font-size: 16px;
  margin-bottom: 6px;
}
.feature p {
  font-size: 14px;
  color: var(--text-light);
  margin: 0;
}
.auth-card {
  max-width: 440px;
  margin: 40px auto;
  background: var(--card);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow);
}
.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.auth-tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-light);
  border-bottom: 3px solid transparent;
}
.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.auth-form {
  display: none;
}
.auth-form.active {
  display: block;
}
.form-group {
  margin-bottom: 16px;
}
.form-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
}
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
}
.form-textarea {
  min-height: 240px;
  resize: vertical;
  line-height: 1.6;
}
.phone-input-group {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.country-select {
  position: relative;
  flex-shrink: 0;
}
.country-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 15px;
  font-family: inherit;
  font-weight: 600;
  color: var(--text);
  min-width: 110px;
  height: 100%;
  transition: border-color .15s;
}
.country-btn:hover {
  border-color: var(--primary);
}
.country-btn:focus {
  outline: none;
  border-color: var(--primary);
}
.country-flag {
  font-size: 20px;
  line-height: 1;
}
.country-code {
  font-weight: 600;
  font-size: 14px;
}
.dropdown-arrow {
  font-size: 10px;
  color: var(--text-light);
  margin-left: auto;
}
.country-search,
.country-list {
  display: block;
}
.country-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .15);
  z-index: 9999;
  width: 260px;
  height: 260px;
  overflow: hidden;
  padding: 0;
  box-sizing: border-box;
  pointer-events: auto;
}
.country-search {
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  border-radius: 8px 8px 0 0;
  box-sizing: border-box;
  background: #fff;
  height: 36px;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 3;
}
.country-search:focus {
  border-bottom-color: var(--primary);
}
.country-list {
  height: calc(100% - 37px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0;
  box-sizing: border-box;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.country-list::-webkit-scrollbar {
  width: 5px;
}
.country-list::-webkit-scrollbar-track {
  background: transparent;
}
.country-list::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}
.country-list::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}
.country-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 13px;
  transition: background .15s;
  min-height: 30px;
}
.country-item:hover {
  background: #f3f4f6;
}
.country-item .flag {
  font-size: 16px;
  line-height: 1;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.country-item .name {
  flex: 1;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.country-item .code {
  color: var(--text-light);
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}
.phone-input {
  flex: 1;
  min-width: 0;
}
[dir=rtl] .dropdown-arrow {
  margin-left: 0;
  margin-right: auto;
}
.forgot-link {
  display: block;
  text-align: right;
  margin-top: 6px;
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
}
.forgot-link:hover {
  text-decoration: underline;
}
.modal-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, .6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.modal-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  position: relative;
  animation: slideUp .25s ease;
}
@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-light);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.modal-close:hover {
  background: #f3f4f6;
}
[dir=rtl] .modal-close {
  right: auto;
  left: 12px;
}
.form-help {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 6px;
}
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
}
.btn-primary:disabled {
  opacity: .6;
  cursor: not-allowed;
}
.btn-secondary {
  background: #fff;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  transform: translateY(-1px);
}
.ai-status {
  margin: 12px 0;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}
.ai-status.active {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #10b981;
}
.ai-status.inactive {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #ef4444;
}
.navbar {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.nav-tabs {
  display: flex;
  gap: 6px;
}
.nav-tab {
  padding: 10px 18px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  border-radius: 8px;
}
.nav-tab:hover {
  background: #f3f4f6;
}
.nav-tab.active {
  background: var(--primary);
  color: #fff;
}
.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-badge {
  padding: 6px 12px;
  background: #f3f4f6;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}
.page {
  display: none;
}
.page.active {
  display: block;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card h2 {
  margin-bottom: 8px;
  font-size: 22px;
}
.card .subtitle {
  color: var(--text-light);
  margin-bottom: 20px;
  font-size: 14px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-card .label {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 8px;
  font-weight: 600;
}
.stat-card .value {
  font-size: 36px;
  font-weight: 800;
  color: var(--primary);
}
.stat-card.calls .value {
  color: var(--success);
}
.stat-card.sms .value {
  color: var(--warning);
}
.task-table {
  width: 100%;
  border-collapse: collapse;
}
.task-table th {
  text-align: left;
  padding: 12px;
  background: #f9fafb;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
}
.task-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: top;
}
.task-table tr:hover {
  background: #f9fafb;
}
.channel-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.channel-badge.call {
  background: #d1fae5;
  color: #065f46;
}
.channel-badge.sms {
  background: #dbeafe;
  color: #1e40af;
}
.channel-badge.whatsapp,
.channel-badge.whatsapp_call {
  background: #dcfce7;
  color: #166534;
}
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}
.empty-state .icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
}
.alert.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.alert.success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.alert.info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}
.webhook-box {
  background: #1f2937;
  color: #f3f4f6;
  padding: 16px;
  border-radius: 10px;
  font-family: "Courier New", monospace;
  font-size: 13px;
  margin-top: 12px;
  word-break: break-all;
}
[dir=rtl] .feature {
  text-align: right;
}
[dir=rtl] .task-table th,
[dir=rtl] .task-table td {
  text-align: right;
}
@media (max-width: 640px) {
  .container {
    padding: 80px 12px 20px;
  }
  .auth-card,
  .card {
    padding: 20px;
  }
  .navbar {
    flex-direction: column;
    align-items: stretch;
  }
  .nav-tabs {
    flex-wrap: wrap;
  }
}
.ai-live {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: .3px;
}
.ai-live[hidden] {
  display: none;
}
.ai-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 7px;
  animation: ai-live-blink 1.2s ease-in-out infinite;
}
.ai-live.online {
  color: var(--success);
}
.ai-live.online .ai-live-dot {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}
.ai-live.offline {
  color: var(--danger);
}
.ai-live.offline .ai-live-dot {
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
}
@keyframes ai-live-blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: .2;
  }
}
.pricing-teaser {
  margin-top: 18px;
  font-size: 15px;
}
.pricing-teaser a {
  font-weight: 700;
  color: var(--primary,#6366f1);
}
.site-footer {
  margin: 28px auto 8px;
  max-width: 900px;
  text-align: center;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.9;
}
.site-footer a {
  color: inherit;
}
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
}
@media (max-width: 820px) {
  .top-bar {
    gap: 10px;
    padding: 10px 12px;
  }
  .brand {
    flex-shrink: 0;
    max-width: 42%;
    font-size: 15px;
    line-height: 1.25;
  }
  .lang-switcher {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 2px;
  }
  .lang-btn {
    flex-shrink: 0;
    padding: 5px 9px;
  }
}
.kb-modes-wrap {
  margin-bottom: 16px;
}
.kb-modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin: 8px 0;
}
.kb-mode {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: start;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.kb-mode:hover {
  border-color: var(--primary-light);
}
.kb-mode:focus-visible,
.kb-icon:focus-visible,
.kb-link:focus-visible,
.kb-item-toggle:focus-visible,
.kb-chip:focus-visible {
  outline: 3px solid var(--primary-light);
  outline-offset: 2px;
}
.kb-mode.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .12);
}
.kb-mode strong {
  font-size: 16px;
}
.kb-mode span {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.5;
}
.kb-badge {
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}
.kb-badge.muted {
  color: var(--text-light);
}
.kb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 14px;
}
.kb-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.kb-field.wide {
  grid-column: 1/-1;
}
.kb-field.required .kb-label::after {
  content: " *";
  color: var(--danger);
}
.kb-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.kb-err {
  font-size: 12px;
  color: var(--danger);
  min-height: 0;
}
.kb-area {
  min-height: 72px;
  resize: vertical;
  line-height: 1.5;
}
.form-input.invalid {
  border-color: var(--danger);
}
.kb-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 14px 0 8px;
}
.kb-jump {
  max-width: 260px;
}
.kb-small {
  width: auto;
  padding: 8px 14px;
  font-size: 14px;
}
.kb-status {
  font-size: 13px;
  color: var(--text-light);
}
.kb-status.saved {
  color: var(--success);
}
.kb-status.failed,
.kb-status.conflict {
  color: #b45309;
}
.kb-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 8px 0 14px;
  font-size: 13px;
}
.kb-chip {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.kb-chip.ok {
  border-color: #a7f3d0;
  background: #ecfdf5;
  color: #065f46;
}
.kb-chip.rec {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}
.kb-chip.req {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}
.kb-sections {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kb-section {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
}
.kb-section.internal {
  border-style: dashed;
  background: #fafaff;
}
.kb-section > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 700;
}
.kb-section > summary::-webkit-details-marker {
  display: none;
}
.kb-section > summary::before {
  content: "▸";
  color: var(--text-light);
  font-size: 12px;
}
.kb-section[open] > summary::before {
  content: "▾";
}
.kb-sec-title {
  flex: 1;
}
.kb-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
}
.kb-sec-badge {
  color: var(--success);
  font-weight: 800;
}
.kb-sec-body {
  padding: 0 16px 16px;
}
.kb-hint {
  font-size: 13px;
  color: var(--text-light);
  margin: 0 0 10px;
  line-height: 1.5;
}
.kb-hint.warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: 10px;
  padding: 8px 12px;
}
.kb-hint.internal {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #3730a3;
  border-radius: 10px;
  padding: 8px 12px;
}
.kb-empty {
  color: var(--text-light);
  font-size: 14px;
  margin: 8px 0;
}
.kb-muted {
  color: var(--text-light);
  font-size: 12px;
}
.kb-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px 14px;
}
.kb-check,
.kb-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}
.kb-check input,
.kb-inline input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}
.kb-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.kb-row .form-input {
  flex: 1;
  min-width: 120px;
}
.kb-price {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.kb-price .kb-price-note {
  grid-column: 1/-1;
}
.kb-hours {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kb-day {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.kb-dayname {
  min-width: 96px;
  font-weight: 600;
  font-size: 14px;
}
.kb-period {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.kb-period .form-input {
  width: auto;
  padding: 6px 8px;
}
.kb-link {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  padding: 4px;
}
.kb-icon {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 32px;
  height: 32px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
}
.kb-icon:disabled {
  opacity: .35;
  cursor: default;
}
.kb-icon.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}
.kb-sub {
  margin-top: 12px;
}
.kb-exc {
  display: grid;
  grid-template-columns: minmax(130px, 160px) auto 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.kb-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kb-rowline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)) auto;
  gap: 6px;
  align-items: center;
}
.kb-list-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.kb-search {
  max-width: 360px;
}
.kb-list-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.kb-csv-help {
  display: block;
  margin-top: 4px;
}
.kb-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 8px;
  background: #fff;
}
.kb-item.open {
  border-color: var(--primary-light);
  box-shadow: 0 2px 10px rgba(99, 102, 241, .08);
}
.kb-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}
.kb-item-toggle {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  background: none;
  border: none;
  text-align: start;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  padding: 4px;
}
.kb-item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.kb-item-price {
  margin-inline-start: auto;
  color: var(--primary);
  font-weight: 700;
  white-space: nowrap;
}
.kb-item-na {
  font-size: 12px;
  color: var(--danger);
  white-space: nowrap;
}
.kb-item-actions {
  display: flex;
  gap: 4px;
}
.kb-item .kb-grid {
  padding: 4px 12px 12px;
}
.kb-item > .kb-muted {
  padding: 0 12px 10px;
  margin: 0;
}
.kb-test {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fcfcff;
}
.kb-test h3 {
  margin: 0 0 4px;
  font-size: 16px;
}
.kb-test-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
  max-height: 360px;
  overflow: auto;
}
.kb-msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.kb-msg.customer {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
}
.kb-msg.assistant {
  align-self: flex-start;
  background: #f3f4f6;
}
.kb-msg.muted {
  color: var(--text-light);
}
.kb-modal .kb-modal-card {
  max-width: 820px;
  width: calc(100% - 24px);
  max-height: 88vh;
  overflow: auto;
}
.kb-preview {
  white-space: pre-wrap;
  word-break: break-word;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  font-size: 13px;
  line-height: 1.55;
  font-family: inherit;
  max-height: 60vh;
  overflow: auto;
}
@media (max-width: 640px) {
  .kb-exc {
    grid-template-columns: 1fr 1fr;
  }
  .kb-item-head {
    flex-wrap: wrap;
  }
  .kb-item-price {
    margin-inline-start: 0;
  }
  .kb-dayname {
    min-width: 100%;
  }
  .kb-jump {
    max-width: 100%;
    flex: 1;
  }
  .kb-section > summary {
    padding: 12px;
  }
  .kb-sec-body {
    padding: 0 12px 12px;
  }
}
[dir=rtl] .kb-section:not([open]) > summary::before {
  content: "◂";
}
.ref-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.ref-stat {
  background: var(--bg,#f8fafc);
  border: 1px solid var(--border,#e5e7eb);
  border-radius: 10px;
  padding: 10px 12px;
}
.ref-stat-label {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 4px;
}
.ref-stat-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
}
#transactions-list {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.num-section {
  border-top: 1px solid var(--border,#e5e7eb);
  padding-top: 14px;
  margin-top: 14px;
}
.num-section h3 {
  margin: 0 0 6px;
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.num-muted {
  color: var(--text-light);
  font-size: 13px;
  line-height: 1.6;
  margin: 4px 0;
}
.num-warn {
  color: #b45309;
  font-weight: 700;
  font-size: 13px;
}
.num-sub {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 10px 0;
}
.num-k {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}
.num-label {
  font-weight: 700;
  font-size: 14px;
  display: block;
  margin-bottom: 4px;
}
.num-line {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 6px 0;
  cursor: pointer;
  flex-wrap: wrap;
}
.num-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.num-small {
  width: auto !important;
  padding: 6px 12px !important;
  font-size: 13px;
}
.num-port-item {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}
.num-port-form {
  border: 1px solid var(--border,#e5e7eb);
  border-radius: 10px;
  padding: 12px;
  margin-top: 8px;
}
.num-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.num-docs {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.num-comments {
  background: var(--bg,#f8fafc);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 8px 0;
}
.num-hours {
  display: grid;
  gap: 6px;
}
.num-hours-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.num-day {
  min-width: 110px;
  font-weight: 600;
}
.num-cc-row {
  margin-bottom: 8px;
}
.sms-badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  margin-inline-start: 6px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}
.sms-layout {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 14px;
  margin-top: 10px;
}
.sms-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 560px;
  overflow-y: auto;
}
.sms-new {
  margin-bottom: 6px;
  flex-wrap: nowrap;
}
.sms-new button {
  white-space: nowrap;
}
.sms-new input {
  min-width: 0;
}
.sms-thread {
  all: unset;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--border,#e5e7eb);
  border-radius: 10px;
  cursor: pointer;
  background: var(--card-bg,#fff);
}
.sms-thread.active,
.sms-thread:hover {
  border-color: var(--primary);
}
.sms-thread-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.sms-time {
  color: var(--text-light);
  font-size: 12px;
  white-space: nowrap;
}
.sms-thread-body {
  color: var(--text-light);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sms-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.sms-unread {
  background: var(--primary);
  color: #fff;
  border-radius: 9px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 800;
  line-height: 18px;
}
.sms-tag {
  background: #fef3c7;
  color: #92400e;
  border-radius: 9px;
  padding: 0 8px;
  font-size: 11px;
  line-height: 18px;
}
.sms-chat {
  border: 1px solid var(--border,#e5e7eb);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  min-height: 300px;
  min-width: 0;
}
.sms-pick {
  margin: auto;
  text-align: center;
}
.sms-chat-head {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.sms-back {
  display: none;
}
.sms-ai-switch {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  background: #ecfdf5;
  color: #065f46;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}
.sms-ai-switch.paused {
  background: #fef3c7;
  color: #92400e;
}
.sms-msgs {
  flex: 1;
  overflow-y: auto;
  max-height: 420px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 2px;
}
.sms-msg {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
}
.sms-msg.in {
  align-self: flex-start;
  background: var(--bg,#f1f5f9);
}
.sms-msg.out {
  align-self: flex-end;
  background: #e0e7ff;
}
.sms-msg.out.team {
  background: #dcfce7;
}
.sms-msg-body {
  white-space: pre-wrap;
  word-break: break-word;
}
.sms-msg-meta {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 3px;
}
.sms-compose {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.sms-compose textarea {
  flex: 1;
  resize: vertical;
  min-height: 44px;
}
.sms-block-row {
  margin-bottom: 6px;
  flex-wrap: nowrap;
}
.sms-block-row input {
  min-width: 0;
}
@media (max-width: 720px) {
  .sms-layout {
    grid-template-columns: 1fr;
  }
  .sms-layout.has-open .sms-list {
    display: none;
  }
  .sms-layout:not(.has-open) .sms-chat {
    display: none;
  }
  .sms-back {
    display: inline-flex;
  }
  .sms-msg {
    max-width: 90%;
  }
}
.month-stats {
  margin-top: -4px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.month-stats .stat-card .value {
  font-size: 44px;
}
.month-note {
  grid-column: 1/-1;
  margin: -6px 0 0;
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
}
.acc-card {
  padding-top: 14px;
  padding-bottom: 14px;
}
.acc-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.acc-toggle {
  width: auto !important;
  white-space: nowrap;
}
.acc-select {
  flex: 1;
  min-width: 0;
  width: auto;
}
.acc-panel {
  margin-top: 10px;
}
.acc-new {
  flex-wrap: nowrap;
}
.acc-new input {
  min-width: 0;
}
.acc-new button {
  white-space: nowrap;
}
.sms-global {
  margin: 6px 0 12px;
  font-weight: 600;
}
.del-card {
  border: 1px solid #fecaca;
}
.del-card h2 {
  color: #dc2626;
}
#del-confirm:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.num-now {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.7;
}
.num-now.open {
  background: #ecfdf5;
  color: #065f46;
}
.num-now.closed {
  background: #fef3c7;
  color: #92400e;
}
.cov-tags {
  margin-top: 3px;
}
.cov-tag {
  display: inline-block;
  font-size: 11px;
  border-radius: 8px;
  padding: 0 6px;
  margin-right: 4px;
  background: #e0e7ff;
  color: #3730a3;
}
.cov-card {
  text-align: left;
}
.cov-card h3 {
  font-size: 16px;
  margin: 16px 0 6px;
}
.cov-list {
  line-height: 1.8;
  font-size: 14px;
}
.cov-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 6px;
}
.cov-table th,
.cov-table td {
  border-bottom: 1px solid var(--border,#e5e7eb);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}
.cov-table th {
  background: var(--bg,#f8fafc);
  font-weight: 700;
}
.cov-wrap {
  overflow-x: auto;
  max-height: 520px;
  overflow-y: auto;
}
.cov-no {
  color: var(--text-light);
}
.pub-name {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border,#e5e7eb);
}
.acc-list {
  display: grid;
  gap: 6px;
  margin: 8px 0 12px;
}
.acc-item {
  flex-wrap: nowrap;
  justify-content: space-between;
  border: 1px solid var(--border,#e5e7eb);
  border-radius: 10px;
  padding: 6px 10px;
}
.acc-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.acc-item input {
  flex: 1;
  min-width: 0;
}
.acc-item button {
  white-space: nowrap;
}
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
[data-theme=dark] {
  --bg:#0b1020;
  --card:#131a2e;
  --text:#e6e9f5;
  --text-light:#9aa4c4;
  --border:#28314f;
  --primary:#818cf8;
  --primary-dark:#6366f1;
  --primary-light:#a5b4fc;
  --shadow:0 6px 24px rgba(0,0,0,.45);
}
[data-theme=dark] body {
  background: var(--bg);
  color: var(--text);
}
[data-theme=dark] .top-bar {
  background: rgba(11, 16, 32, .92);
  border-color: var(--border);
}
[data-theme=dark] .lang-btn,
[data-theme=dark] .country-btn,
[data-theme=dark] .country-dropdown,
[data-theme=dark] .country-search,
[data-theme=dark] .modal-card,
[data-theme=dark] .btn-secondary,
[data-theme=dark] .kb-chip,
[data-theme=dark] .kb-icon,
[data-theme=dark] .kb-item,
[data-theme=dark] .kb-hint.warn,
[data-theme=dark] .navbar,
[data-theme=dark] .card,
[data-theme=dark] .stat-card,
[data-theme=dark] .auth-card,
[data-theme=dark] .feature {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}
[data-theme=dark] .lang-btn.active {
  background: var(--primary);
  color: #0b1020;
}
[data-theme=dark] .form-input,
[data-theme=dark] .form-textarea,
[data-theme=dark] .form-select,
[data-theme=dark] input,
[data-theme=dark] textarea,
[data-theme=dark] select {
  background: #0f1528;
  color: var(--text);
  border-color: var(--border);
}
[data-theme=dark] input::placeholder,
[data-theme=dark] textarea::placeholder {
  color: #6b7493;
}
[data-theme=dark] select option {
  background: #131a2e;
  color: var(--text);
}
[data-theme=dark] .country-item:hover,
[data-theme=dark] .modal-close:hover,
[data-theme=dark] .nav-tab:hover,
[data-theme=dark] .user-badge,
[data-theme=dark] .task-table th,
[data-theme=dark] .task-table tr:hover,
[data-theme=dark] .kb-msg.assistant,
[data-theme=dark] .kb-preview,
[data-theme=dark] .kb-test,
[data-theme=dark] .kb-section.internal {
  background: #1a2240;
  color: var(--text);
}
[data-theme=dark] .country-list::-webkit-scrollbar-thumb {
  background: #3a4468;
}
[data-theme=dark] .badge,
[data-theme=dark] .ai-status.active,
[data-theme=dark] .alert.success,
[data-theme=dark] .channel-badge.call,
[data-theme=dark] .kb-chip.ok,
[data-theme=dark] .sms-ai-switch,
[data-theme=dark] .num-now.open,
[data-theme=dark] .channel-badge.whatsapp,
[data-theme=dark] .channel-badge.whatsapp_call {
  background: rgba(16, 185, 129, .16);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, .35);
}
[data-theme=dark] .ai-status.inactive,
[data-theme=dark] .alert.error,
[data-theme=dark] .kb-chip.req {
  background: rgba(239, 68, 68, .16);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, .35);
}
[data-theme=dark] .alert.info,
[data-theme=dark] .channel-badge.sms,
[data-theme=dark] .kb-hint.internal,
[data-theme=dark] .cov-tag,
[data-theme=dark] .sms-msg.out {
  background: rgba(99, 102, 241, .2);
  color: #c7d2fe;
  border-color: rgba(99, 102, 241, .4);
}
[data-theme=dark] .sms-tag,
[data-theme=dark] .sms-ai-switch.paused,
[data-theme=dark] .num-now.closed,
[data-theme=dark] .kb-chip.rec {
  background: rgba(245, 158, 11, .16);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, .35);
}
[data-theme=dark] .sms-msg.in {
  background: #1a2240;
}
[data-theme=dark] .sms-msg.out.team {
  background: rgba(16, 185, 129, .18);
}
[data-theme=dark] .num-warn {
  color: #fbbf24;
}
[data-theme=dark] [style*="background:#fff"],
[data-theme=dark] [style*="background: #fff"],
[data-theme=dark] [style*="background:#f8fafc"],
[data-theme=dark] [style*="background:#fafafa"],
[data-theme=dark] [style*="background:#f9fafb"],
[data-theme=dark] [style*="background:#f3f4f6"] {
  background: #1a2240 !important;
  color: var(--text);
}
[data-theme=dark] [style*="background:#eff6ff"],
[data-theme=dark] [style*="background:#e0e7ff"],
[data-theme=dark] [style*="background:#dbeafe"] {
  background: rgba(99, 102, 241, .2) !important;
  color: #c7d2fe !important;
  border-color: rgba(99, 102, 241, .4) !important;
}
[data-theme=dark] [style*="background:#fef3c7"],
[data-theme=dark] [style*="background:#fffbeb"] {
  background: rgba(245, 158, 11, .16) !important;
  color: #fcd34d !important;
  border-color: rgba(245, 158, 11, .35) !important;
}
[data-theme=dark] [style*="background:#d1fae5"],
[data-theme=dark] [style*="background:#ecfdf5"],
[data-theme=dark] [style*="background:#dcfce7"],
[data-theme=dark] [style*="background:#f0fdf4"] {
  background: rgba(16, 185, 129, .16) !important;
  color: #6ee7b7 !important;
  border-color: rgba(16, 185, 129, .35) !important;
}
[data-theme=dark] [style*="background:#fee2e2"],
[data-theme=dark] [style*="background:#fef2f2"] {
  background: rgba(239, 68, 68, .16) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, .35) !important;
}
[data-theme=dark] [style*="color:#1e3a8a"],
[data-theme=dark] [style*="color:#1d4ed8"] {
  color: #a5b4fc !important;
}
[data-theme=dark] [style*="color:#92400e"] {
  color: #fcd34d !important;
}
[data-theme=dark] [style*="color:#065f46"] {
  color: #6ee7b7 !important;
}
[data-theme=dark] [style*="color:#991b1b"] {
  color: #fca5a5 !important;
}
[data-theme=dark] code {
  background: #1a2240;
  color: #c7d2fe;
}
.top-bar .theme-toggle {
  margin-inline-start: auto;
  margin-inline-end: 8px;
}
