/* ============================================
   ADMIN DASHBOARD
   ============================================ */
.admin-screen {
  display: none;
  min-height: 100vh;
  background: var(--bg-base);
}

.admin-screen.active { display: block; }

/* Login gate */
.login-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(201, 169, 97, 0.08), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(201, 169, 97, 0.06), transparent 40%),
    var(--bg-base);
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 48px 40px;
  background: var(--bg-card);
  border: 1px solid var(--gold-line);
  border-radius: var(--radius-lg);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-circle {
  width: 64px;
  height: 64px;
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  color: var(--gold);
  font-size: 22px;
  letter-spacing: -0.02em;
}

.login-logo-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 20px;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.login-logo-sub {
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.login-title {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 8px;
}

.login-desc {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 32px;
}

.login-field {
  margin-bottom: 20px;
}

.login-field input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 15px;
  transition: all 0.2s ease;
}

.login-field input:focus {
  outline: none;
  border-color: var(--gold);
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: var(--gold);
  color: var(--bg-base);
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius);
  transition: all 0.2s ease;
}

.login-btn:hover {
  background: var(--gold-light);
}

.login-error {
  margin-top: 16px;
  padding: 10px;
  background: rgba(217, 123, 123, 0.12);
  border: 1px solid rgba(217, 123, 123, 0.3);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  display: none;
}

.login-error.show { display: block; }

.login-back {
  display: block;
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
}

.login-back:hover { color: var(--gold); }

/* Admin main */
.admin-header {
  padding: 20px 32px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-brand-mark {
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 14px;
}

.admin-brand-text b {
  display: block;
  font-family: var(--serif);
  font-weight: 500;
  color: var(--text-primary);
  font-size: 15px;
}

.admin-brand-text span {
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.admin-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.admin-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.admin-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.admin-btn.primary {
  background: var(--gold);
  color: var(--bg-base);
  border-color: var(--gold);
  font-weight: 500;
}

.admin-btn.primary:hover {
  background: var(--gold-light);
  color: var(--bg-base);
}

.admin-btn.danger {
  color: var(--danger);
  border-color: rgba(217, 123, 123, 0.3);
}

.admin-btn.danger:hover {
  background: rgba(217, 123, 123, 0.1);
  border-color: var(--danger);
  color: var(--danger);
}

.admin-body {
  padding: 32px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Stats cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  padding: 24px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s ease;
}

.stat-card:hover { border-color: var(--gold-line); }

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.stat-value {
  font-family: var(--serif);
  font-size: 32px;
  color: var(--gold);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.stat-value small {
  font-size: 14px;
  color: var(--text-muted);
  margin-left: 4px;
}

/* Toolbar */
.admin-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
  align-items: center;
}

.search-box {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
}

.search-box input:focus {
  outline: none;
  border-color: var(--gold);
}

.search-box::before {
  content: '⌕';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold);
  font-size: 16px;
}

.filter-select {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  min-width: 140px;
}

.filter-select:focus {
  outline: none;
  border-color: var(--gold);
}

.toolbar-info {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: auto;
}

.toolbar-info span { color: var(--gold); font-weight: 500; }

/* Table */
.table-shell {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

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

.admin-table thead {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--gold-line);
}

.admin-table th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 500;
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-table th.checkbox-col { width: 40px; padding-right: 0; }
.admin-table th.actions-col { text-align: right; width: 160px; }

.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: top;
}

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

.admin-table tbody tr {
  transition: background 0.15s ease;
}

.admin-table tbody tr:hover {
  background: rgba(201, 169, 97, 0.03);
}

.admin-table tbody tr.selected {
  background: rgba(201, 169, 97, 0.06);
}

.admin-table td.company-cell {
  color: var(--text-primary);
  font-weight: 500;
  min-width: 140px;
}

.admin-table td.company-cell small {
  display: block;
  color: var(--text-muted);
  font-weight: 400;
  font-size: 11px;
  margin-top: 2px;
}

.admin-table td.date-cell {
  color: var(--text-muted);
  white-space: nowrap;
  font-size: 12px;
}

.row-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--gold);
  cursor: pointer;
}

/* Status badges */
.status-select {
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
  min-width: 100px;
}

.status-select.status-pending { border-color: rgba(224, 184, 114, 0.4); color: var(--warning); }
.status-select.status-contacted { border-color: rgba(122, 167, 217, 0.4); color: var(--info); }
.status-select.status-consulting { border-color: rgba(201, 169, 97, 0.5); color: var(--gold); }
.status-select.status-completed { border-color: rgba(127, 183, 126, 0.4); color: var(--success); }
.status-select.status-hold { border-color: rgba(140, 138, 130, 0.4); color: var(--text-muted); }

/* Score badge */
.score-badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  color: var(--gold);
  font-family: var(--serif);
  font-weight: 500;
  font-size: 12px;
  min-width: 44px;
  text-align: center;
}

/* Row actions */
.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.icon-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 14px;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.icon-btn.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(217, 123, 123, 0.08);
}

.empty-row {
  padding: 60px 20px !important;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.empty-row .icon {
  display: block;
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.4;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop.show { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--gold-line);
  border-radius: var(--radius-lg);
  max-width: 720px;
  width: 100%;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
}

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

.modal-head h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 20px;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 20px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--bg-input);
  color: var(--gold);
}

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

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.detail-item {
  padding: 14px 16px;
  background: var(--bg-input);
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
}

.detail-item.full { grid-column: 1 / -1; }

.detail-label {
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.detail-value {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.6;
  word-break: break-all;
}

.detail-value.large {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--gold);
  font-weight: 500;
}

.detail-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

.detail-section h4 {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--gold);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.memo-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  line-height: 1.6;
}

.memo-textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.needs-list {
  display: grid;
  gap: 8px;
}

.needs-list-item {
  padding: 10px 14px;
  background: var(--bg-input);
  border-left: 2px solid var(--gold);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

.modal-foot {
  padding: 20px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-elevated);
}

/* Confirm dialog */
.confirm-modal {
  max-width: 440px;
  text-align: center;
}

.confirm-modal .modal-body {
  padding: 32px;
}

.confirm-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(217, 123, 123, 0.15);
  border: 1px solid rgba(217, 123, 123, 0.3);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto 20px;
}

.confirm-title {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.confirm-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 8px;
}

.confirm-desc b {
  color: var(--gold);
  font-weight: 500;
}

.confirm-warn {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Setup notice */
.setup-notice {
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.setup-notice h4 {
  font-family: var(--serif);
  color: var(--warning);
  margin-bottom: 8px;
  font-size: 16px;
}

.setup-notice p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.setup-notice code {
  padding: 2px 6px;
  background: var(--bg-input);
  border-radius: 3px;
  color: var(--gold);
  font-size: 12px;
  font-family: 'SF Mono', Monaco, monospace;
}

/* Toast (admin) */
.admin-toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  z-index: 2000;
  transform: translateX(400px);
  transition: transform 0.3s ease;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  max-width: 320px;
}

.admin-toast.show { transform: translateX(0); }
.admin-toast.error { border-color: var(--danger); }
.admin-toast.success { border-color: var(--success); }

/* Responsive */
@media (max-width: 900px) {
  .admin-body { padding: 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-toolbar { flex-direction: column; align-items: stretch; }
  .admin-table th, .admin-table td { padding: 10px 8px; font-size: 12px; }
  .table-shell { overflow-x: auto; }
  .admin-table { min-width: 900px; }
  .detail-grid { grid-template-columns: 1fr; }
  .admin-header { padding: 16px 20px; flex-wrap: wrap; gap: 12px; }
}
