/* ═══════════════════════════════════════════════
   Auth UI — Modal, Header buttons
   ═══════════════════════════════════════════════ */

/* --- Header auth area --- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-auth {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-email {
  font-size: 13px;
  color: var(--text-2);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-header {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-header--login {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--line);
}
.btn-header--login:hover {
  border-color: var(--text-3);
}

.btn-header--signup {
  background: var(--text);
  color: var(--surface);
}
.btn-header--signup:hover {
  opacity: 0.85;
}

.btn-header--plan {
  background: transparent;
  color: var(--text-2);
  border: 1.5px solid var(--line);
}
.btn-header--plan:hover {
  border-color: var(--text-3);
}

.btn-header--logout {
  background: transparent;
  color: var(--text-3);
  font-weight: 500;
}
.btn-header--logout:hover {
  color: var(--text);
}

/* --- Modal overlay --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 36px 32px 28px;
  width: 100%;
  max-width: 400px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-3);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.modal-close:hover {
  color: var(--text);
}

.modal-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 24px;
  color: var(--text);
}

/* --- Auth form fields --- */
.auth-field {
  margin-bottom: 16px;
}

.auth-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}

.auth-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}
.auth-input:focus {
  outline: none;
  border-color: var(--text-3);
}

.auth-error {
  background: var(--block-surface);
  color: var(--block-bg);
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.auth-error[hidden] {
  display: none;
}

.btn-auth-submit {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--text);
  color: var(--surface);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.btn-auth-submit:hover {
  opacity: 0.85;
}
.btn-auth-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 16px 0;
  color: #9ca3af;
  font-size: 13px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}
.auth-divider span {
  padding: 0 12px;
}

.btn-linkedin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: #0A66C2;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-linkedin:hover {
  background: #004182;
}
.btn-linkedin svg {
  flex-shrink: 0;
}

.auth-toggle {
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
  margin-top: 20px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--text);
  font-weight: 600;
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.btn-link:hover {
  color: var(--text-2);
}

/* ═══════════════════════════════════════════════
   Plan Panel
   ═══════════════════════════════════════════════ */

.plan-panel {
  margin-bottom: 20px;
}
.plan-panel[hidden] { display: none; }

.plan-panel-inner {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 24px 28px;
  box-shadow: var(--shadow-form);
}

.plan-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.plan-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-3);
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}
.plan-close:hover { color: var(--text); }

.plan-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.plan-badge--free { background: var(--bg-warm); color: var(--text-2); border: 1px solid var(--line); }
.plan-badge--base { background: #dbeafe; color: #1e40af; }
.plan-badge--pro { background: #f3e8ff; color: #7c3aed; }
.plan-badge--enterprise { background: #fef3c7; color: #92400e; }

/* Usage bar */
.plan-usage { margin-bottom: 20px; }

.plan-usage-text {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
  margin-bottom: 8px;
}
.plan-usage-pct { font-weight: 700; }

.plan-bar {
  height: 8px;
  background: var(--bg-warm);
  border-radius: 999px;
  overflow: hidden;
}
.plan-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* Actions */
.plan-actions { margin-top: 4px; }

.plan-cta-text {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 14px;
}

.plan-cards-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

/* Mini pricing cards */
.pricing-mini {
  padding: 18px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
  text-align: center;
}
.pricing-mini--highlight {
  border-color: #7c3aed;
  background: #faf5ff;
}

.pricing-mini-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.pricing-mini-price {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}
.pricing-mini-price span {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-3);
}
.pricing-mini-desc {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 14px;
  line-height: 1.4;
}

.btn-upgrade {
  display: inline-block;
  padding: 10px 24px;
  border: none;
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-upgrade:hover { opacity: 0.85; }
.btn-upgrade:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-manage {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 18px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s;
}
.btn-manage:hover { border-color: var(--text-3); }

.plan-loading {
  text-align: center;
  padding: 20px;
  color: var(--text-3);
  font-size: 14px;
}

/* --- Responsive --- */
@media (max-width: 480px) {
  .modal-card {
    padding: 28px 20px 24px;
  }
  .header-email {
    display: none;
  }
  .plan-cards-row {
    grid-template-columns: 1fr;
  }
  .plan-panel-inner {
    padding: 20px;
  }
}

/* ─── History Panel ─── */
.history-panel {
  position: fixed;
  top: 64px;
  right: 16px;
  left: 16px;
  max-width: 800px;
  margin: 0 auto;
  max-height: 70vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  z-index: 900;
}
.history-inner { padding: 20px 24px; }
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.history-header h3 { font-size: 18px; font-weight: 700; margin: 0; }
.history-header div { display: flex; align-items: center; gap: 12px; }
.btn-export {
  font-size: 13px;
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}
.btn-export:hover { text-decoration: underline; }
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.history-table th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid #e5e7eb;
  color: #6b7280;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.history-table td {
  padding: 10px 10px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
}
.history-row:hover { background: #f9fafb; }
.history-date { white-space: nowrap; color: #6b7280; }
.history-summary { color: #374151; max-width: 300px; }
.history-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}
.badge--pass { background: #dcfce7; color: #166534; }
.badge--warn { background: #fef9c3; color: #854d0e; }
.badge--fail { background: #fee2e2; color: #991b1b; }
.history-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  font-size: 13px;
  color: #6b7280;
}
.btn-page {
  padding: 6px 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}
.btn-page:hover { background: #f3f4f6; }
.history-locked {
  text-align: center;
  padding: 32px 16px;
  color: #6b7280;
}
.history-locked svg { margin-bottom: 8px; color: #9ca3af; }
.history-locked p { margin: 8px 0 16px; }
.history-loading {
  text-align: center;
  padding: 32px;
  color: #9ca3af;
}
/* ─── Team Section ─── */
.team-section {
  margin: 16px 0;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.team-heading {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 8px;
}
.team-role {
  font-weight: 400;
  color: #6b7280;
  font-size: 12px;
}
.team-stats {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #4b5563;
  margin-bottom: 10px;
}
.team-invite-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.team-invite-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
}
.btn-invite {
  padding: 6px 14px;
  background: #6d28d9;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-invite:hover { background: #5b21b6; }
.team-members-list { margin: 10px 0; }
.team-member-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}
.team-member-email { flex: 1; color: #374151; }
.team-member-role { color: #9ca3af; font-size: 12px; }
.team-member-pending { opacity: .6; font-style: italic; }
.team-pending-label { font-size: 12px; color: #9ca3af; margin-top: 8px; font-weight: 600; }
.btn-remove-member {
  background: none; border: none; color: #ef4444; font-size: 16px; cursor: pointer; padding: 0 4px; line-height: 1;
}
.btn-remove-member:hover { color: #dc2626; }

/* Team create form */
.team-name-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
  box-sizing: border-box;
}
.team-mode-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.team-mode-option {
  cursor: pointer;
}
.team-mode-card {
  padding: 10px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.team-mode-card strong {
  display: block;
  font-size: 13px;
  color: #1f2937;
  margin-bottom: 2px;
}
.team-mode-card span {
  font-size: 12px;
  color: #6b7280;
}
.team-mode-option.selected .team-mode-card {
  border-color: #6d28d9;
  background: #f5f3ff;
}
.btn-delete-team {
  margin-top: 12px;
  padding: 6px 14px;
  background: none;
  color: #ef4444;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.btn-delete-team:hover {
  background: #fef2f2;
  border-color: #ef4444;
}
.team-create-actions {
  display: flex;
  gap: 8px;
}
.btn-manage--secondary {
  background: #f3f4f6 !important;
  color: #4b5563 !important;
  border: 1px solid #d1d5db !important;
}
.btn-manage--secondary:hover {
  background: #e5e7eb !important;
}
.team-error {
  color: #ef4444;
  font-size: 12px;
  margin-top: 8px;
}
.team-mode-badge {
  background: #ede9fe;
  color: #6d28d9;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

/* Jurisdiction picker */
.jur-picker-section {
  margin: 16px 0;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.jur-picker-heading {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 4px;
}
.jur-picker-count {
  font-weight: 400;
  color: #6b7280;
  font-size: 12px;
}
.jur-picker-hint {
  font-size: 12px;
  color: #6b7280;
  margin: 0 0 10px;
}
.jur-picker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
}
.jur-picker-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.jur-picker-item:hover { background: #f1f5f9; }
.jur-picker-item.selected {
  border-color: #6d28d9;
  background: #f5f3ff;
}
.jur-picker-item.always-on {
  opacity: 0.6;
  cursor: default;
}
.jur-picker-item input[type="checkbox"] {
  accent-color: #6d28d9;
}
.jur-picker-item input[type="checkbox"]:disabled {
  cursor: default;
}
#btn-save-jurisdictions {
  font-size: 13px;
}
.jur-save-status {
  font-size: 12px;
  color: #6b7280;
  margin-left: 8px;
}

.btn-header--history {
  color: #6d28d9;
  border-color: #6d28d9;
}
