/* ═══════════════════════════════════════════════════
   CESNA CRM — Aurora Design System
   ═══════════════════════════════════════════════════ */

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

/* ── CSS Variables ── */
:root {
  --brand-50: #eef2ff; --brand-100: #e0e7ff; --brand-200: #c7d2fe;
  --brand-300: #a5b4fc; --brand-400: #818cf8; --brand-500: #6366f1;
  --brand-600: #4f46e5; --brand-700: #4338ca; --brand-800: #3730a3; --brand-900: #312e81;

  --bg-page: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 50%, #f0fdf4 100%);
  --bg-surface: rgba(255,255,255,0.75);
  --bg-card: #ffffff;
  --border-light: rgba(255,255,255,0.4);
  --border-card: #e5e7eb;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
}

.dark {
  --bg-page: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #0f1729 100%);
  --bg-surface: rgba(30,30,50,0.65);
  --bg-card: rgba(30,30,50,0.5);
  --border-light: rgba(255,255,255,0.08);
  --border-card: rgba(255,255,255,0.06);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
}

/* ── Base ── */
* { font-family: 'Inter', sans-serif; box-sizing: border-box; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,0.4); }

/* ── Glass Surface ── */
.glass {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
}

/* ── Sidebar ── */
.sidebar {
  width: 16rem;
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  margin: 0.75rem;
  border-radius: 1rem;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  padding: 0 0.5rem;
}

.sidebar-brand-icon {
  width: 2.5rem; height: 2.5rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, var(--brand-500), #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

.sidebar-brand-name { font-weight: 700; font-size: 1.125rem; letter-spacing: -0.025em; }
.sidebar-brand-sub { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; }

/* Nav items */
.sidebar nav { flex: 1; display: flex; flex-direction: column; gap: 0.25rem; }

.sidebar nav button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  border-radius: 0.75rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}
.sidebar nav button:hover { background: rgba(99,102,241,0.08); color: var(--text-primary); }
.sidebar nav button.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  box-shadow: 0 4px 15px rgba(99,102,241,0.3);
}

/* ── Stat Cards ── */
.stat-card {
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.08));
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: 1rem;
  padding: 1.25rem;
  transition: all 0.3s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(99,102,241,0.15);
  border-color: rgba(99,102,241,0.3);
}
.dark .stat-card {
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.12));
  border-color: rgba(99,102,241,0.2);
}

.stat-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.stat-icon {
  width: 2.5rem; height: 2.5rem;
  border-radius: 0.75rem;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 1.25rem; height: 1.25rem; color: white; }
.stat-icon.indigo { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.stat-icon.emerald { background: linear-gradient(135deg, #10b981, #059669); }
.stat-icon.amber { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-icon.rose { background: linear-gradient(135deg, #f43f5e, #e11d48); }

.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.25rem; }
.badge { display: inline-flex; align-items: center; padding: 0.125rem 0.625rem; border-radius: 1.25rem; font-size: 0.75rem; font-weight: 500; }
.badge-green { background: rgba(16,185,129,0.1); color: #059669; }
.dark .badge-green { background: rgba(16,185,129,0.15); color: #34d399; }

/* ── Filter Bar ── */
.filter-bar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1rem; margin-bottom: 1.5rem; border-radius: 1rem;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
}

.aurora-input,
.filter-bar select,
.filter-bar input[type="date"],
.filter-bar input[type="text"],
.filter-bar input[type="number"] {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 0.625rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: all 0.2s;
  color-scheme: light;
}
.dark .aurora-input,
.dark .filter-bar select,
.dark .filter-bar input[type="date"],
.dark .filter-bar input[type="text"],
.dark .filter-bar input[type="number"],
.dark .form-input { color-scheme: dark; }
.aurora-input:focus,
.filter-bar select:focus,
.filter-bar input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

/* ── Buttons ── */
.btn-primary {
  padding: 0.5rem 1.25rem;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white; border: none; border-radius: 0.75rem;
  font-size: 0.875rem; font-weight: 500; cursor: pointer;
  transition: all 0.2s;
}
.btn-primary:hover { box-shadow: 0 4px 15px rgba(99,102,241,0.35); filter: brightness(1.05); }

.btn-secondary {
  padding: 0.5rem 1.25rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-card);
  border-radius: 0.75rem;
  font-size: 0.875rem; font-weight: 500; cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: rgba(99,102,241,0.05); color: var(--text-primary); }

.btn-success {
  padding: 0.5rem 1.25rem;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white; border: none; border-radius: 0.75rem;
  font-size: 0.875rem; font-weight: 500; cursor: pointer;
  transition: all 0.2s;
}
.btn-success:hover { box-shadow: 0 4px 15px rgba(16,185,129,0.35); }

/* ── Chart Cards ── */
.chart-card {
  background: var(--bg-card);
  border-radius: 1rem;
  border: 1px solid var(--border-card);
  padding: 1.25rem;
  transition: all 0.3s ease;
}
.chart-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.06); }
.dark .chart-card { background: var(--bg-card); border-color: var(--border-card); }
.dark .chart-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.3); }

.chart-card h2 {
  font-size: 0.9375rem; font-weight: 600; color: var(--text-primary);
  margin-bottom: 0.75rem; text-align: center;
}

/* ── Content Cards ── */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 1rem;
  padding: 1.5rem;
}
.dark .content-card { background: var(--bg-card); border-color: var(--border-card); }

/* ── Section Titles ── */
.section-title {
  font-size: 1.5rem; font-weight: 700;
  color: var(--text-primary); margin-bottom: 1rem;
}

/* ── Form Inputs ── */
.form-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 0.625rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: all 0.2s;
}
.form-input:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }

/* ── Catalog Product Creation ── */
.catalog-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.catalog-titlebar .section-title { margin-bottom: 0; }
.catalog-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  min-height: 44px;
}
.catalog-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.catalog-modal.hidden { display: none; }
.catalog-modal-content {
  width: min(820px, 100%);
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 1.25rem;
  padding: 1.5rem;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.22);
}
.catalog-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.catalog-modal-header h2 {
  color: var(--text-primary);
  font-size: 1.25rem;
  line-height: 1.35;
  font-weight: 700;
}
.catalog-modal-header p {
  margin-top: 0.25rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}
.catalog-modal-close {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-card);
  border-radius: 0.75rem;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
}
.catalog-modal-close:hover { background: rgba(99,102,241,0.08); color: var(--text-primary); }
.catalog-form-grid,
.catalog-prices-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.catalog-field-wide { grid-column: 1 / -1; }
.catalog-form-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.catalog-form-field span {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
}
.catalog-form-field b { color: #ef4444; }
.catalog-form-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-card);
}
.catalog-form-section h3 {
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
.catalog-form-status {
  min-height: 1.25rem;
  margin-top: 1rem;
  color: #dc2626;
  font-size: 0.875rem;
}
.catalog-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.catalog-modal-actions button { min-height: 44px; }
.catalog-modal-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

/* ── DataTables Override ── */
table.dataTable { table-layout: fixed; width: 100% !important; }
.dataTables_wrapper { font-size: 0.8125rem; color: var(--text-secondary); }
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--border-card); border-radius: 0.5rem;
  padding: 0.375rem 0.75rem; background: var(--bg-card); color: var(--text-primary);
}
.dataTables_wrapper .dataTables_filter input:focus {
  outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
table.dataTable thead th {
  background: rgba(99,102,241,0.05); color: var(--text-primary);
  font-weight: 600; font-size: 0.8125rem;
  border-bottom: 2px solid rgba(99,102,241,0.15) !important;
}
table.dataTable tbody td { color: var(--text-primary); border-bottom: 1px solid var(--border-card) !important; }
table.dataTable tbody tr:hover { background: rgba(99,102,241,0.04) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
  color: white !important; border-color: transparent !important; border-radius: 0.5rem !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: rgba(99,102,241,0.1) !important; border-color: transparent !important; color: var(--brand-600) !important;
}

/* ── Orders Table ── */
#ordersTable { table-layout: fixed !important; }
#ordersTable th:nth-child(1), #ordersTable td:nth-child(1) { width: 50px !important; }
#ordersTable tbody tr { height: 75px !important; max-height: 75px !important; }
#ordersTable tbody td:nth-child(2),
#ordersTable tbody td:nth-child(3),
#ordersTable tbody td:nth-child(4),
#ordersTable tbody td:nth-child(9) { cursor: pointer; }
#ordersTable th:nth-child(4), #ordersTable td:nth-child(4) { width: 200px !important; max-width: 200px !important; }
#ordersTable th, #ordersTable td {
  height: 48px !important; line-height: 48px !important;
  padding: 0 8px !important; white-space: nowrap !important;
  overflow: hidden !important; text-overflow: ellipsis !important; vertical-align: middle !important;
}

tr.shown { background-color: rgba(99,102,241,0.04); }
.child-row { padding: 0.5rem 1rem; background: var(--bg-card); border-bottom: 1px solid var(--border-card); font-size: 0.875rem; }

/* ── Map ── */
#map { height: 500px; }

/* ── Promotions ── */
#promoProducts { min-height: 10rem; }
.promo-highlight {
  background: rgba(99,102,241,0.1); color: var(--brand-600);
  font-weight: 600; border-radius: 4px; padding: 0 6px;
}
.promo-old { color: var(--text-muted); text-decoration: line-through; margin-left: 6px; }
.amount-edited { color: #dc2626 !important; font-weight: 700; }
.btn-edit-amount {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; margin-left: 6px; border-radius: 6px;
  border: 1px solid var(--border-card); background: var(--bg-card); cursor: pointer;
}
.btn-edit-amount:hover { background: rgba(99,102,241,0.05); }

/* ── Theme toggle button ── */
/* Clients 360 */
.clients360-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
  gap: 1.25rem;
  align-items: start;
}
.clients360-table-card { min-width: 0; }
#clients360Table tbody tr { cursor: pointer; }
#clients360Table tbody tr.clients360-row-active,
#clients360Table tbody tr.clients360-row-active:hover {
  background: rgba(99,102,241,0.1) !important;
}
.clients360-detail {
  position: sticky;
  top: 0;
}
.clients360-empty {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}
.clients360-empty h2 {
  color: var(--text-primary);
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.clients360-empty p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}
.clients360-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.clients360-title {
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
}
.clients360-subtitle {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  margin-top: 0.25rem;
}
.clients360-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}
.clients360-kpi {
  border: 1px solid var(--border-card);
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: rgba(99,102,241,0.04);
}
.clients360-kpi span {
  display: block;
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.clients360-kpi strong {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 700;
}
.clients360-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.clients360-list-item,
.clients360-timeline-item {
  border: 1px solid var(--border-card);
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-card);
}
.clients360-list-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}
.clients360-section-heading {
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 700;
  margin-top: 1rem;
}
.clients360-muted {
  color: var(--text-muted);
  font-size: 0.75rem;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border-radius: 999px;
  padding: 0.1875rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 700;
}
.status-active {
  color: #047857;
  background: rgba(16,185,129,0.12);
}
.status-warming {
  color: #b45309;
  background: rgba(245,158,11,0.16);
}
.status-sleeping {
  color: #be123c;
  background: rgba(244,63,94,0.12);
}
.status-no_orders,
.status-unknown {
  color: var(--text-secondary);
  background: rgba(100,116,139,0.12);
}

/* Contacts TP performance card */
.contacts-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(380px, 0.9fr);
  gap: 1.25rem;
  align-items: start;
}
.contacts-table-card { min-width: 0; }
#contactsTable tbody tr { cursor: pointer; }
#contactsTable tbody tr.contacts-row-active,
#contactsTable tbody tr.contacts-row-active:hover {
  background: rgba(99,102,241,0.1) !important;
}
.tp-open-btn {
  min-height: 32px;
  padding: 0.375rem 0.75rem;
  border: 1px solid rgba(99,102,241,0.28);
  border-radius: 0.5rem;
  background: rgba(99,102,241,0.08);
  color: var(--brand-600);
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.tp-open-btn:hover,
.tp-open-btn:focus {
  outline: none;
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: #ffffff;
}
.tp-detail-view {
  background: rgba(255,255,255,0.82);
  border: 1px solid var(--border-light);
  border-radius: 1rem;
  overflow: hidden;
  min-height: calc(100vh - 7rem);
  box-shadow: 0 18px 48px rgba(15,23,42,0.08);
}
.dark .tp-detail-view {
  background: rgba(30,30,50,0.42);
}
.tp-detail-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-card);
}
.tp-detail-title-row {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
}
.tp-back-btn {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-card);
  border-radius: 0.5rem;
  background: transparent;
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 800;
  cursor: pointer;
}
.tp-back-btn:hover,
.tp-back-btn:focus {
  outline: none;
  background: rgba(99,102,241,0.08);
  border-color: rgba(99,102,241,0.3);
}
.tp-detail-topbar h1 {
  color: var(--text-primary);
  font-size: 1.25rem;
  line-height: 1.2;
  font-weight: 800;
}
.tp-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.5rem;
}
.tp-detail-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  padding: 0.1875rem 0.625rem;
  border-radius: 999px;
  background: rgba(99,102,241,0.08);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
}
.tp-detail-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem;
  align-items: start;
}
.tp-detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}
.tp-next-offer,
.tp-profile-card,
.tp-detail-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 0.75rem;
}
.tp-next-offer {
  padding: 1rem;
  color: #ffffff;
  background: linear-gradient(135deg, #ef4444, #f97316);
  border-color: rgba(239,68,68,0.35);
}
.tp-next-offer.success {
  background: linear-gradient(135deg, #059669, #10b981);
}
.tp-next-offer.attention {
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
}
.tp-next-offer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.tp-next-offer-head span {
  font-size: 0.8125rem;
  font-weight: 800;
}
.tp-next-offer-head b {
  font-size: 1.5rem;
  line-height: 1;
}
.tp-next-offer strong {
  display: block;
  font-size: 0.9375rem;
  line-height: 1.25;
  font-weight: 800;
}
.tp-next-offer p {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  line-height: 1.4;
  opacity: 0.9;
}
.tp-profile-card {
  padding: 1rem;
}
.tp-avatar {
  width: 4.5rem;
  height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #6366f1, #10b981);
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}
.tp-profile-card h2 {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 800;
}
.tp-profile-card p {
  color: var(--text-secondary);
  font-size: 0.75rem;
  margin-top: 0.25rem;
}
.tp-quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.375rem;
  margin: 0.875rem 0;
}
.tp-quick-actions span {
  min-height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: rgba(99,102,241,0.08);
  color: var(--brand-600);
  font-size: 0.6875rem;
  font-weight: 800;
}
.tp-profile-card dl {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}
.tp-profile-card dl div {
  padding-top: 0.625rem;
  border-top: 1px solid var(--border-card);
}
.tp-profile-card dt,
.tp-side-metric span {
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tp-profile-card dd,
.tp-side-metric strong {
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 800;
  margin-top: 0.1875rem;
  overflow-wrap: anywhere;
}
.tp-side-metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.75rem 0;
}
.tp-detail-main {
  min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 0.75rem;
  overflow: hidden;
}
.tp-detail-tabs {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 3.25rem;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border-card);
  overflow-x: auto;
}
.tp-detail-tabs button {
  min-height: 3.25rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.tp-detail-tabs button.active {
  color: var(--brand-600);
  border-bottom-color: #ef4444;
}
.tp-tab-pane.hidden {
  display: none;
}
.tp-tab-pane.active {
  display: block;
}
.tp-detail-panel {
  margin: 1rem;
  padding: 1rem;
  box-shadow: 0 10px 28px rgba(15,23,42,0.04);
}
.tp-panel-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.tp-panel-title h2 {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 800;
}
.tp-panel-title span {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
}
.tp-activity-chart.wide {
  min-height: 110px;
  margin-top: 1rem;
}
.tp-detail-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tp-chart-canvas {
  position: relative;
  width: 100%;
  height: 220px;
  margin-top: 1rem;
}
.tp-chart-canvas.large {
  height: 280px;
}
.tp-chart-canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}
.tp-communication-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.tp-communication-card {
  min-height: 5.25rem;
  border: 1px solid var(--border-card);
  border-radius: 0.75rem;
  padding: 0.875rem;
  background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(16,185,129,0.04));
}
.tp-communication-card span {
  display: block;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.375rem;
}
.tp-communication-card strong {
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.tp-criteria-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text-primary);
  font-size: 0.8125rem;
}
.tp-criteria-table th,
.tp-criteria-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-card);
  text-align: left;
}
.tp-criteria-table th {
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tp-card {
  position: sticky;
  top: 0;
  max-height: calc(100vh - 2rem);
  overflow: auto;
}
.tp-card-empty {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}
.tp-card-empty h2,
.tp-card-header h2 {
  color: var(--text-primary);
  font-size: 1.125rem;
  font-weight: 800;
  line-height: 1.25;
}
.tp-card-empty p,
.tp-card-header p,
.tp-muted {
  color: var(--text-secondary);
  font-size: 0.875rem;
}
.tp-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.875rem;
}
.tp-contact-line {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--border-card);
}
.tp-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}
.tp-kpi {
  min-height: 78px;
  border: 1px solid var(--border-card);
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(16,185,129,0.04));
}
.tp-kpi span,
.tp-section-head span,
.tp-plan-summary,
.tp-list-row span,
.tp-plan-row span,
.tp-activity-day small {
  color: var(--text-muted);
  font-size: 0.75rem;
}
.tp-kpi span {
  display: block;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.tp-kpi strong {
  color: var(--text-primary);
  font-size: 1.125rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.tp-section {
  padding-top: 1rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border-card);
}
.tp-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.tp-section-head h3 {
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-weight: 800;
}
.tp-progress {
  position: relative;
  height: 0.625rem;
  border-radius: 999px;
  background: rgba(100,116,139,0.16);
  overflow: hidden;
}
.tp-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #10b981, #6366f1);
}
.tp-progress i {
  position: absolute;
  top: -0.25rem;
  width: 2px;
  height: 1.125rem;
  border-radius: 999px;
  background: #f59e0b;
}
.tp-plan-summary {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.tp-plan-list,
.tp-list,
.tp-recommendations {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.tp-plan-list { margin-top: 0.75rem; }
.tp-plan-row,
.tp-list-row,
.tp-recommendation {
  border: 1px solid var(--border-card);
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-card);
}
.tp-plan-row,
.tp-list-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}
.tp-plan-row strong,
.tp-list-row strong,
.tp-recommendation strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 800;
}
.tp-list-row b,
.tp-plan-meter b {
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 800;
  white-space: nowrap;
}
.tp-plan-meter {
  min-width: 112px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.5rem;
}
.tp-plan-meter .tp-progress {
  height: 0.5rem;
}
.tp-activity-chart {
  display: grid;
  grid-template-columns: repeat(14, minmax(18px, 1fr));
  align-items: end;
  gap: 0.375rem;
  min-height: 86px;
}
.tp-activity-day {
  display: grid;
  grid-template-rows: 58px auto;
  align-items: end;
  justify-items: center;
  gap: 0.375rem;
}
.tp-activity-day span {
  width: 100%;
  min-height: 8px;
  border-radius: 0.375rem 0.375rem 0 0;
  background: linear-gradient(180deg, #6366f1, #10b981);
}
.tp-activity-day small {
  font-size: 0.625rem;
  line-height: 1;
}
.tp-recommendation span {
  display: block;
  color: var(--text-secondary);
  font-size: 0.75rem;
  margin-top: 0.25rem;
}
.tp-recommendation.warning {
  background: rgba(245,158,11,0.09);
  border-color: rgba(245,158,11,0.28);
}
.tp-recommendation.attention {
  background: rgba(99,102,241,0.08);
  border-color: rgba(99,102,241,0.22);
}
.tp-recommendation.success {
  background: rgba(16,185,129,0.09);
  border-color: rgba(16,185,129,0.24);
}

.theme-toggle {
  width: 2.5rem; height: 2.5rem; border-radius: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-surface); backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  cursor: pointer; transition: transform 0.15s; color: var(--text-secondary);
}
.theme-toggle:hover { transform: scale(1.05); }
.theme-toggle svg { width: 1.25rem; height: 1.25rem; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .clients360-layout,
  .contacts-layout {
    grid-template-columns: 1fr;
  }
  .tp-detail-grid {
    grid-template-columns: 1fr;
  }
  .tp-detail-split {
    grid-template-columns: 1fr;
  }
  .tp-detail-topbar {
    flex-direction: column;
  }
  .clients360-detail,
  .tp-card {
    position: static;
    max-height: none;
  }
  .sidebar {
    position: fixed;
    left: -16rem;
    top: 0; bottom: 0;
    z-index: 900;
    margin: 0;
    border-radius: 0;
    width: 16rem;
    height: 100vh;
    overflow-y: auto;
    transition: left 0.3s ease;
  }
  .catalog-titlebar {
    align-items: stretch;
    flex-direction: column;
  }
  .catalog-add-btn { justify-content: center; }
}
@media (max-width: 640px) {
  .catalog-modal { padding: 0.75rem; }
  .catalog-modal-content {
    max-height: calc(100vh - 1.5rem);
    padding: 1rem;
    border-radius: 1rem;
  }
  .catalog-form-grid,
  .catalog-prices-grid {
    grid-template-columns: 1fr;
  }
}
