/* Ginny CRM - Stylesheet */

:root {
  --primary: #2563eb;
  --primary-light: #dbeafe;
  --primary-dark: #1e40af;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --info: #0891b2;
  --info-light: #cffafe;
  --purple: #9333ea;
  --purple-light: #f3e8ff;

  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  --sidebar-w: 240px;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* Layout */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header .logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-header .logo .icon {
  width: 32px; height: 32px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.sidebar-header .subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg);
  color: var(--text);
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}

.nav-item .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

/* Main content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 24px 32px;
  min-height: 100vh;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { opacity: 0.9; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: 0.9; }

.btn-secondary { background: var(--surface); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); color: var(--text); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
}

.card-body { padding: 16px 20px; }

/* Dashboard stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
}

.stat-card.blue::before { background: var(--primary); }
.stat-card.green::before { background: var(--success); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.red::before { background: var(--danger); }
.stat-card.purple::before { background: var(--purple); }
.stat-card.cyan::before { background: var(--info); }

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.stat-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 24px;
  opacity: 0.2;
}

/* Tables */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  background: var(--bg);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table tbody tr:hover {
  background: var(--bg);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { color: var(--success); background: var(--success-light); }
.badge-warning { color: #92400e; background: var(--warning-light); }
.badge-danger { color: var(--danger); background: var(--danger-light); }
.badge-info { color: var(--info); background: var(--info-light); }
.badge-default { color: var(--text-secondary); background: var(--bg); }
.badge-purple { color: var(--purple); background: var(--purple-light); }

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.form-label .required { color: var(--danger); }

.form-label .hint {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 6px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

textarea.form-control {
  min-height: 80px;
  resize: vertical;
}

select.form-control {
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-box.large { max-width: 800px; }
.modal-box.xlarge { max-width: 1000px; }

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0 4px;
  line-height: 1;
}

.modal-close:hover { color: var(--text); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  z-index: 2000;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  box-shadow: var(--shadow-lg);
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--danger); color: white; }
.toast-warning { background: var(--warning); color: white; }
.toast-info { background: var(--info); color: white; }

/* Search bar */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.search-bar input, .search-bar select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface);
}

.search-bar input { flex: 1; min-width: 200px; }
.search-bar input:focus, .search-bar select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.3;
}

.empty-state .title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.empty-state .desc {
  font-size: 13px;
}

/* Customer 360 view */
.customer-360 {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
}

.customer-profile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.customer-profile .avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

.customer-profile .name {
  font-size: 18px;
  font-weight: 700;
}

.customer-profile .code {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.customer-profile .info-item {
  display: flex;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.customer-profile .info-item:last-child { border-bottom: none; }
.customer-profile .info-label { color: var(--text-muted); min-width: 70px; }
.customer-profile .info-value { color: var(--text); font-weight: 500; }

.customer-tabs {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tab-header {
  display: flex;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab-btn {
  padding: 12px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all var(--transition);
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.tab-content { padding: 16px 20px; }

/* Alert boxes */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.alert-warning { background: var(--warning-light); color: #92400e; border-left: 3px solid var(--warning); }
.alert-danger { background: var(--danger-light); color: #991b1b; border-left: 3px solid var(--danger); }
.alert-info { background: var(--info-light); color: #155e75; border-left: 3px solid var(--info); }
.alert-success { background: var(--success-light); color: #166534; border-left: 3px solid var(--success); }

/* Timeline */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 16px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
}

.timeline-date {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.timeline-content {
  font-size: 13px;
  margin-top: 2px;
}

/* Guard config table */
.guard-config-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.guard-config-table th, .guard-config-table td {
  padding: 6px 8px;
  border: 1px solid var(--border);
}

.guard-config-table th {
  background: var(--bg);
  font-size: 12px;
  font-weight: 600;
}

.guard-config-table input {
  width: 100%;
  border: none;
  padding: 4px 6px;
  font-size: 13px;
  background: transparent;
}

.guard-config-table input:focus {
  outline: 1px solid var(--primary);
  border-radius: 3px;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 16px; }
  .customer-360 { grid-template-columns: 1fr; }
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
}

/* Utility */
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-lg { font-size: 16px; }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.cursor-pointer { cursor: pointer; }

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 101;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 18px;
}

@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .main-content { padding-top: 56px; }
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.loading-overlay .spinner {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

/* ===== Daily Assistant ===== */
.assistant-modal { max-width: 720px; }
.assistant-greeting { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.assistant-date { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }

.assistant-overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.assistant-overview-item {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  border: 1px solid var(--border);
}

.assistant-overview-item .count { font-size: 24px; font-weight: 700; color: var(--text); }
.assistant-overview-item .label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.assistant-overview-item.alert .count { color: var(--danger); }
.assistant-overview-item.warning .count { color: var(--warning); }

.wizard-steps { display: flex; gap: 4px; margin-bottom: 20px; }
.wizard-step-indicator { flex: 1; height: 4px; border-radius: 2px; background: var(--border); transition: background var(--transition); }
.wizard-step-indicator.active { background: var(--primary); }
.wizard-step-indicator.done { background: var(--success); }

.wizard-question { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.wizard-hint { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }

.select-list { max-height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.select-list-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background var(--transition); }
.select-list-item:hover { background: var(--bg); }
.select-list-item:last-child { border-bottom: none; }
.select-list-item.selected { background: var(--primary-light); }
.select-list-item input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }

/* Todo list */
.todo-list { list-style: none; padding: 0; margin: 0; }
.todo-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); transition: background var(--transition); }
.todo-item:hover { background: var(--bg); }
.todo-item:last-child { border-bottom: none; }
.todo-checkbox { width: 20px; height: 20px; margin-top: 1px; cursor: pointer; accent-color: var(--primary); flex-shrink: 0; }
.todo-text { flex: 1; font-size: 13px; line-height: 1.5; }
.todo-item.done .todo-text { text-decoration: line-through; color: var(--text-muted); }
.todo-category { font-size: 11px; padding: 2px 6px; border-radius: 3px; font-weight: 600; white-space: nowrap; }
.todo-cat-visit { color: var(--purple); background: var(--purple-light); }
.todo-cat-billing { color: #92400e; background: var(--warning-light); }
.todo-cat-complaint { color: var(--danger); background: var(--danger-light); }
.todo-cat-message { color: var(--info); background: var(--info-light); }
.todo-cat-other { color: var(--text-secondary); background: var(--bg); }

/* Message templates */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.template-card { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; text-align: center; transition: all var(--transition); }
.template-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.template-card.active { border-color: var(--primary); background: var(--primary-light); }
.template-card .icon { font-size: 28px; margin-bottom: 8px; }
.template-card .name { font-size: 13px; font-weight: 600; }
.template-card .desc { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.message-output { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; font-size: 13px; line-height: 1.8; white-space: pre-wrap; max-height: 400px; overflow-y: auto; }

/* Risk badges */
.risk-high { color: var(--danger); background: var(--danger-light); }
.risk-medium { color: #92400e; background: var(--warning-light); }
.risk-low { color: var(--success); background: var(--success-light); }

/* Progress bar */
.progress-bar { width: 100%; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.3s ease; }

/* Quick actions */
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-action { display: flex; align-items: center; gap: 6px; padding: 8px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-secondary); transition: all var(--transition); }
.quick-action:hover { background: var(--primary); color: white; border-color: var(--primary); }
.quick-action .icon { font-size: 16px; }

/* Mini stats */
.stats-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-mini { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.stat-mini .value { font-size: 22px; font-weight: 700; }
.stat-mini .label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* AR table risk */
.ar-overdue { color: var(--danger); font-weight: 600; }
.ar-warning { color: #92400e; font-weight: 600; }
.ar-normal { color: var(--success); }

/* Close rate circle */
.close-rate-circle { width: 80px; height: 80px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; border: 4px solid; }

/* Responsive */
@media (max-width: 768px) {
  .assistant-overview { grid-template-columns: repeat(2, 1fr); }
  .template-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   CustomerPicker - 客户选择器 (可搜索/可新增)
   ============================================================ */
.customer-picker {
  position: relative;
  width: 100%;
}

.cp-input-wrap {
  position: relative;
}

.cp-input-wrap .cp-search {
  padding-right: 32px;
}

.cp-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 6px;
  border-radius: 4px;
}

.cp-clear:hover {
  background: var(--bg);
  color: var(--danger);
}

.cp-selected-tag {
  padding: 8px 12px;
  background: var(--primary-light);
  border: 1px solid var(--primary);
  border-radius: 6px;
  margin-top: 4px;
}

.cp-tag-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.cp-tag-code {
  background: var(--primary);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.cp-tag-name {
  color: var(--text-primary);
  font-weight: 500;
  flex: 1;
}

.cp-tag-remove {
  background: transparent;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: var(--primary);
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
}

.cp-tag-remove:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--danger);
}

.cp-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  margin-top: 4px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  max-height: 360px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cp-results {
  flex: 1;
  overflow-y: auto;
  max-height: 300px;
}

.cp-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

.cp-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.cp-item:last-child {
  border-bottom: none;
}

.cp-item:hover,
.cp-item.is-active {
  background: var(--primary-light);
}

.cp-item-main {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.cp-item-code {
  background: var(--bg);
  color: var(--text-secondary);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-family: 'SF Mono', Monaco, monospace;
  font-weight: 600;
}

.cp-item-name {
  color: var(--text-primary);
  font-weight: 500;
}

.cp-item-sub {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-secondary);
  padding-left: 4px;
}

.cp-status {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
}

.cp-status-Active,
.cp-status-ACTIVE {
  background: var(--success-light);
  color: var(--success);
}

.cp-status-Expired,
.cp-status-EXPIRED,
.cp-status-Inactive {
  background: var(--warning-light);
  color: var(--warning);
}

.cp-create-new {
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  background: var(--success-light);
  color: var(--success);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.12s;
}

.cp-create-new:hover {
  background: var(--success);
  color: white;
}

.cp-create-new span {
  font-weight: 600;
}
