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

body {
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
  color: var(--text-primary, #1a1a1a);
  background: var(--bg-primary, #ffffff);
}

.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-secondary, #f5f5f5);
}

.auth-card {
  background: var(--bg-primary, #fff);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 400px;
}

.auth-card h1 {
  margin-bottom: 0.5rem;
  color: var(--text-primary, #1a1a1a);
}

.auth-card p {
  margin-bottom: 1.5rem;
  color: var(--text-secondary, #666);
}

.form-field {
  margin-bottom: 1rem;
}

.form-field label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 500;
  color: var(--text-primary, #1a1a1a);
}

.form-field input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 4px;
  font-size: 1rem;
}

.btn-primary {
  background: var(--accent-primary, #007bff);
  color: #fff;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  width: 100%;
}

.btn-primary:hover {
  background: var(--accent-hover, #0056b3);
}

.btn-secondary {
  background: var(--bg-tertiary, #f0f0f0);
  color: var(--text-primary, #1a1a1a);
  border: 1px solid var(--border-color, #ddd);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
}

.auth-message {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
}

.auth-message.info {
  background: #e3f2fd;
  color: #1976d2;
}

.auth-message.error {
  background: #ffebee;
  color: #c62828;
}

.auth-message.warning {
  background: #fff3e0;
  color: #f57c00;
}

.auth-message.success {
  background: #e8f5e9;
  color: #2e7d32;
}

.app-header {
  background: var(--bg-primary, #fff);
  border-bottom: 1px solid var(--border-color, #ddd);
  padding: 1rem 2rem;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.header-content h1 {
  font-size: 1.5rem;
  color: var(--text-primary, #1a1a1a);
}

.main-nav {
  display: flex;
  gap: 0.5rem;
}

.nav-btn {
  background: transparent;
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-secondary, #666);
  border-bottom: 2px solid transparent;
}

.nav-btn.active {
  color: var(--accent-primary, #007bff);
  border-bottom-color: var(--accent-primary, #007bff);
}

.header-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.btn-icon {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
}

.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.loading, .error {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary, #666);
}

.error {
  color: var(--error-color, #c62828);
}

@media (max-width: 820px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
  }

  .main-nav {
    width: 100%;
    justify-content: center;
  }

  .main-content {
    padding: 1rem;
  }
}

/* #4: Responsive wrapping/truncation for long emails and names at 390px */
@media (max-width: 390px) {
  .detail-value {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-all;
    max-width: 100%;
  }
  
  .client-header h3 {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
  }
}

/* #2: Notes display styles */
.notes-section {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
}

.notes-list {
  margin-top: 0.5rem;
}

.note-item {
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  background: #f9fafb;
  border-radius: 4px;
}

.note-text {
  margin-bottom: 0.25rem;
  color: #374151;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.note-meta {
  font-size: 0.75rem;
  color: #6b7280;
}

/* CE Tracker Styles */
.ce-profile-section,
.ce-clocks-section,
.ce-credits-section {
  margin-bottom: 1.5rem;
}

.card {
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border-color, #ddd);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.view-header {
  margin-bottom: 1.5rem;
}

.view-header h2 {
  font-size: 1.75rem;
  color: var(--text-primary, #1a1a1a);
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.profile-grid label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: var(--text-secondary, #666);
  font-size: 0.9rem;
}

.profile-grid input[type="date"] {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 4px;
  font-size: 1rem;
}

.clocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.ce-clock {
  position: relative;
}

.ce-clock h4 {
  margin-bottom: 0.75rem;
  color: var(--text-primary, #1a1a1a);
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: var(--bg-tertiary, #f0f0f0);
  border-radius: 6px;
  overflow: hidden;
  margin: 0.5rem 0;
}

.progress-fill {
  height: 100%;
  background: var(--accent-primary, #007bff);
  transition: width 0.3s ease;
}

.ce-categories {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.alert {
  padding: 0.5rem;
  border-radius: 4px;
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.alert.warning {
  background: #fff3e0;
  color: #f57c00;
  border: 1px solid #ffb74d;
}

.alert.info {
  background: #e3f2fd;
  color: #1976d2;
  border: 1px solid #90caf9;
}

.alerts-section {
  background: #fff3e0;
  border: 2px solid #ffb74d;
}

.alerts-section h3 {
  color: #f57c00;
  margin-bottom: 0.5rem;
}

.alerts-section ul {
  list-style: none;
  padding: 0;
}

.alerts-section li {
  padding: 0.25rem 0;
  color: #f57c00;
}

.verify-status {
  background: #f5f5f5;
  border: 1px dashed var(--border-color, #ddd);
}

.credits-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.credits-header h3 {
  margin: 0;
}

.credits-header > div {
  display: flex;
  gap: 0.5rem;
}

.table-scroll {
  overflow-x: auto;
  margin: 1rem 0;
}

.credits-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.credits-table th {
  background: var(--bg-tertiary, #f0f0f0);
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary, #1a1a1a);
  border-bottom: 2px solid var(--border-color, #ddd);
}

.credits-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color, #ddd);
}

.credits-table tbody tr:hover {
  background: var(--bg-secondary, #f5f5f5);
}

.no-data {
  text-align: center;
  color: var(--text-secondary, #666);
  font-style: italic;
  padding: 2rem !important;
}

.btn-edit,
.btn-delete {
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--border-color, #ddd);
  background: var(--bg-primary, #fff);
  color: var(--text-primary, #1a1a1a);
  cursor: pointer;
  font-size: 0.85rem;
  margin-right: 0.25rem;
}

.btn-delete {
  background: #ffebee;
  color: #c62828;
  border-color: #ef9a9a;
}

.btn-edit:hover {
  background: var(--bg-tertiary, #f0f0f0);
}

.btn-delete:hover {
  background: #f44336;
  color: #fff;
}

.modal {
  border: none;
  border-radius: 8px;
  padding: 0;
  max-width: 600px;
  width: 90%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.modal::backdrop {
  background: rgba(0,0,0,0.5);
}

.modal-content {
  padding: 1.5rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color, #ddd);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary, #666);
}

.modal-close:hover {
  color: var(--text-primary, #1a1a1a);
}

.modal form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-weight: 500;
}

.modal input,
.modal select,
.modal textarea {
  padding: 0.5rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 4px;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
}

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

.required {
  color: #c62828;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn-cancel {
  background: var(--bg-tertiary, #f0f0f0);
  color: var(--text-primary, #1a1a1a);
  border: 1px solid var(--border-color, #ddd);
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

.error-message {
  padding: 1rem;
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
  border-radius: 4px;
}

/* Responsive: Tablet (820px) */
@media (max-width: 820px) {
  .clocks-grid {
    grid-template-columns: 1fr;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .credits-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .credits-table {
    font-size: 0.85rem;
  }

  .credits-table th,
  .credits-table td {
    padding: 0.5rem;
  }
}

/* Responsive: Mobile (390px) */
@media (max-width: 390px) {
  .card {
    padding: 1rem;
  }

  .view-header h2 {
    font-size: 1.5rem;
  }

  .clocks-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .credits-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .credits-header > div {
    width: 100%;
    flex-direction: column;
  }

  .credits-header button {
    width: 100%;
  }

  .credits-table {
    font-size: 0.8rem;
  }

  .credits-table th,
  .credits-table td {
    padding: 0.4rem;
  }

  /* Stack table cells on very small screens */
  .credits-table thead {
    display: none;
  }

  .credits-table tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 4px;
    padding: 0.5rem;
  }

  .credits-table td {
    display: block;
    text-align: right;
    padding: 0.5rem;
    border-bottom: none;
  }

  .credits-table td::before {
    content: attr(data-label);
    float: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
  }

  .modal {
    width: 95%;
  }

  .modal-content {
    padding: 1rem;
  }
}

/* ========================================
   Interactive Forms Section
   ======================================== */
.interactive-forms-section {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--bg-secondary, #f5f5f5);
  border-radius: 8px;
}

.interactive-forms-section h3 {
  margin-bottom: 1rem;
  color: var(--text-primary, #1a1a1a);
}

.interactive-forms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.interactive-form-card {
  background: var(--bg-primary, #fff);
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.interactive-form-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.interactive-form-card .form-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.interactive-form-card h4 {
  margin-bottom: 0.5rem;
  color: var(--text-primary, #1a1a1a);
}

.interactive-form-card p {
  margin-bottom: 1rem;
  color: var(--text-secondary, #666);
  font-size: 0.9rem;
}

.interactive-form-card .btn-primary {
  width: 100%;
  padding: 0.75rem;
}

/* Responsive adjustments for interactive forms */
@media (max-width: 820px) {
  .interactive-forms-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 390px) {
  .interactive-forms-section {
    padding: 1rem;
  }
  
  .interactive-form-card {
    padding: 1rem;
  }
}

/* Lane D: Needs Analysis gate messages and notifications */
.na-gate-message {
  padding: 2rem;
  text-align: center;
  background: var(--background-secondary);
  border-radius: 8px;
  margin: 2rem auto;
  max-width: 600px;
}

.na-gate-message p {
  margin: 0 0 1.5rem 0;
  color: var(--text-primary);
}

.na-error {
  padding: 1rem;
  margin: 1rem 0;
  background: #fee;
  border-left: 4px solid #c33;
  color: #600;
  border-radius: 4px;
}

.na-success {
  padding: 1rem;
  margin: 1rem 0;
  background: #efe;
  border-left: 4px solid #3c3;
  color: #060;
  border-radius: 4px;
}

/* Client selector section */
.client-selector-section {
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--surface-secondary, #f8f9fa);
  border-radius: 8px;
  border: 1px solid var(--border-color, #e0e0e0);
}

.client-selector-section label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary, #2c3e50);
}

.client-dropdown {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 4px;
  background: white;
  cursor: pointer;
}

.client-dropdown:focus {
  outline: none;
  border-color: var(--primary-color, #007bff);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* B11 fix: KYC form responsive - prevent horizontal scroll at 390/820 */
.wfg-form {
  max-width: 100%;
  overflow-x: hidden;
}

.wfg-form .form-section {
  max-width: 100%;
}

.wfg-form .form-row {
  max-width: 100%;
  flex-wrap: wrap;
}

.wfg-form .form-group {
  min-width: 0;
  flex: 1 1 auto;
}

.wfg-form input,
.wfg-form select,
.wfg-form textarea {
  max-width: 100%;
  min-width: 0;
}

@media (max-width: 820px) {
  .wfg-form .form-row {
    flex-direction: column;
  }
  
  .wfg-form .form-group {
    width: 100%;
  }
}

/* === AWAKENING NAV (additive): two more nav entries (Bookings, Profile) must wrap instead of overflowing, and phone tap targets are >= 44px === */
.main-nav { flex-wrap: wrap; }
@media (max-width: 820px) { .nav-btn, .btn-icon, #btn-signout { min-height: 44px; min-width: 44px; } }
/* === end AWAKENING NAV === */

/* === LEGAL FOOTER === */
.app-footer {
  margin-top: auto;
  padding: 1rem 2rem;
  border-top: 1px solid var(--border, #e0e0e0);
  background: var(--bg-secondary, #f9f9f9);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-secondary, #666);
}

.footer-link {
  color: var(--link, #0066cc);
  text-decoration: underline;
}

.footer-link:hover {
  color: var(--link-hover, #004499);
}

.footer-note {
  color: var(--ink-secondary, #555);   /* Architect 11-18: tertiary grey was 4.24:1 on grove (v1-22) */
  font-style: italic;
}

/* Language-specific visibility */
.footer-links [lang="en"] { display: none; }
.footer-links [lang="fr"] { display: none; }
html[lang="en"] .footer-links [lang="en"] { display: inline; }
html[lang="fr"] .footer-links [lang="fr"] { display: inline; }

@media (max-width: 820px) {
  .app-footer {
    padding: 0.75rem 1rem;
  }
  
  .footer-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}
/* === end LEGAL FOOTER === */
