/* ============================================================
   COMPONENTS — Buttons, cards, badges, tables, forms, etc.
   ============================================================ */

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: var(--leading-normal);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* Primary */
.btn-primary {
  background: var(--brand-500);
  color: var(--text-inverse);
  border-color: var(--brand-600);
}
.btn-primary:hover {
  background: var(--brand-600);
}
.btn-primary:active {
  background: var(--brand-700);
}

/* Secondary */
.btn-secondary {
  background: var(--surface-primary);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--gray-50);
}
.btn-secondary:active {
  background: var(--gray-100);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--gray-100);
  color: var(--text-primary);
}

/* Danger */
.btn-danger {
  background: var(--danger-500);
  color: var(--text-inverse);
  border-color: var(--danger-600);
}
.btn-danger:hover {
  background: var(--danger-600);
}

/* Sizes */
.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}
.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
}

.btn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}


/* --- Cards --- */
.card {
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.card-compact {
  padding: var(--space-4) var(--space-5);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.card-title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.card-body {
  /* default flow */
}

.card-footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-4);
  margin-top: var(--space-5);
}

/* Stat card variant */
.stat-card {
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.stat-card-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-1);
}

.stat-card-value {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.stat-card-meta {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}


/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 10px;
  font-size: 11px;
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-neutral {
  background: var(--gray-100);
  color: var(--gray-700);
}

.badge-brand {
  background: #FAE8E0;
  color: var(--brand-700);
}

.badge-success {
  background: var(--success-50);
  color: var(--success-700);
}

.badge-warning {
  background: var(--warning-50);
  color: var(--warning-700);
}

.badge-danger {
  background: var(--danger-50);
  color: var(--danger-700);
}

.badge-info {
  background: var(--info-50);
  color: var(--info-700);
}

/* Dot badge (small indicator before text) */
.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.badge-success.badge-dot::before { background: var(--success-500); }
.badge-warning.badge-dot::before { background: var(--warning-500); }
.badge-danger.badge-dot::before  { background: var(--danger-500); }
.badge-info.badge-dot::before    { background: var(--info-500); }


/* --- Tables --- */
.table-wrapper {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table th {
  text-align: left;
  font-weight: var(--weight-medium);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-default);
  background: var(--gray-50);
}

.table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.table tbody tr:hover {
  background: var(--gray-25);
}

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

/* Key-value table (for detail panels) */
.kv-table {
  width: 100%;
  font-size: var(--text-sm);
  border-collapse: collapse;
}

.kv-table td {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}

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

.kv-table .kv-label {
  color: var(--text-tertiary);
  width: 40%;
  font-weight: var(--weight-normal);
}

.kv-table .kv-value {
  color: var(--text-primary);
  text-align: right;
  font-weight: var(--weight-medium);
}


/* --- Forms --- */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--surface-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--gray-400);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(200, 82, 42, 0.12);
}

.form-input::placeholder {
  color: var(--text-disabled);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}


/* --- Empty state --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-10) var(--space-6);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  color: var(--gray-300);
  margin-bottom: var(--space-4);
}

.empty-state-title {
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-state-text {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  max-width: 320px;
  margin-bottom: var(--space-5);
}


/* --- Avatars --- */
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-weight: var(--weight-semibold);
  color: var(--text-inverse);
  flex-shrink: 0;
  background: var(--brand-500);
}

.avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.avatar-sm { width: 32px; height: 32px; font-size: var(--text-xs); }
.avatar-md { width: 40px; height: 40px; font-size: var(--text-sm); }
.avatar-lg { width: 56px; height: 56px; font-size: var(--text-lg); }


/* --- Dividers --- */
.divider {
  border: none;
  border-top: 1px solid var(--border-default);
  margin: var(--space-6) 0;
}

.divider-subtle {
  border-top-color: var(--border-subtle);
}


/* --- Grid helpers --- */
.grid {
  display: grid;
  gap: var(--space-4);
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Stack helper */
.stack {
  display: flex;
  flex-direction: column;
}

.stack-2 { gap: var(--space-2); }
.stack-3 { gap: var(--space-3); }
.stack-4 { gap: var(--space-4); }
.stack-6 { gap: var(--space-6); }


/* --- Tooltips / Popovers --- */
/* Add JS-driven logic; these are the style primitives */

.popover {
  position: absolute;
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-4);
  z-index: 40;
  min-width: 200px;
}


/* --- Alert / Notice --- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
}

.alert-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-info {
  background: var(--info-50);
  color: var(--info-700);
}

.alert-success {
  background: var(--success-50);
  color: var(--success-700);
}

.alert-warning {
  background: var(--warning-50);
  color: var(--warning-700);
}

.alert-danger {
  background: var(--danger-50);
  color: var(--danger-700);
}


/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal {
  background: var(--surface-overlay);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  max-width: 480px;
  width: 100%;
  padding: var(--space-6);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-6);
}


/* ============================================================
   LEGACY SHARED CLASSES — ported from app.css
   These keep existing templates working while migration happens.
   ============================================================ */

/* --- Page header (used by many pages) --- */
.page-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}
.page-header h1 { flex: 1; min-width: 200px; }
.page-subtitle { width: 100%; color: var(--text-secondary); font-size: var(--text-base); margin-top: -4px; }
.page-meta { width: 100%; display: flex; gap: var(--space-2); align-items: center; }

.back-link {
  width: 100%;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: -4px;
  text-decoration: none;
}
.back-link:hover { color: var(--brand-500); text-decoration: none; }

/* --- Admin nav tabs (used across admin pages) --- */
.admin-content-wrap { max-width: 1180px; margin: 0 auto; }
.admin-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  min-height: 44px;
}
.admin-page-actions { display: flex; gap: var(--space-2); }

.admin-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  border-bottom: 1.5px solid var(--border-subtle);
  margin-top: 0;
  margin-bottom: 1.75rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.admin-nav::-webkit-scrollbar { display: none; }
.admin-tab {
  padding: 0.7rem 1.15rem;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1.5px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
  text-decoration: none;
}
.admin-tab:hover { color: var(--text-primary); text-decoration: none; }
.admin-tab.active { color: var(--text-primary); font-weight: 600; border-bottom-color: var(--text-primary); }
@media (max-width: 768px) {
  .admin-tab { padding: 0.6rem 0.85rem; font-size: 0.82rem; }
}

/* --- Split layout --- */
.split-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-6);
  align-items: start;
}
.split-main { min-width: 0; }
.split-side { }

/* --- Legacy card --- */
.card {
  background: var(--surface-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.card-empty {
  padding: var(--space-6) 0;
  color: var(--text-tertiary);
  text-align: center;
  font-size: var(--text-sm);
}

/* --- Legacy buttons --- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.55rem 1.25rem;
  background: var(--brand-500);
  color: var(--text-inverse);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  font-family: var(--font-sans);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-fast);
  white-space: nowrap;
}
.btn-primary:hover { background: var(--brand-600); color: var(--text-inverse); text-decoration: none; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.55rem 1.25rem;
  background: var(--surface-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  font-family: var(--font-sans);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-fast);
}
.btn-secondary:hover { background: var(--gray-50); color: var(--text-primary); text-decoration: none; }

.btn-danger {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.55rem 1.25rem;
  background: var(--danger-500);
  color: var(--text-inverse);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  font-family: var(--font-sans);
  cursor: pointer;
}
.btn-danger:hover { background: var(--danger-600); }

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  background: #FAE3D8;
  color: var(--brand-500);
  border: none;
  border-radius: var(--radius-md);
}
.btn-sm:hover { background: #F5D4C4; }

.btn-full { width: 100%; }

.btn-link {
  background: none; border: none;
  color: var(--brand-500);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  padding: var(--space-1) 0;
  cursor: pointer;
  text-decoration: none;
}
.btn-link:hover { color: var(--brand-600); }
.btn-link-danger { background: none; border: none; color: var(--danger-500); font-size: var(--text-xs); cursor: pointer; }

/* --- Legacy forms --- */
.form-card {
  background: var(--surface-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  max-width: 680px;
}
.form-stack { display: flex; flex-direction: column; gap: var(--space-4); }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}
.form-input {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  background: var(--surface-primary);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  width: 100%;
}
.form-input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(200, 82, 42, 0.12);
}
.form-input::placeholder { color: var(--text-disabled); }
textarea.form-input { resize: vertical; min-height: 80px; }
select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236B6962' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.2rem;
}
.form-row { display: flex; gap: var(--space-4); }
.form-row .form-group { flex: 1; }
.form-row.compact { align-items: flex-end; }
.form-input-sm { max-width: 120px; }
.form-input-xs { max-width: 80px; }
.form-divider { border: none; border-top: 1px solid var(--border-subtle); margin: var(--space-4) 0; }
.form-section { margin-top: var(--space-5); }
.form-section-title { margin-bottom: var(--space-1); }
.form-hint { font-size: var(--text-xs); color: var(--text-tertiary); margin-bottom: var(--space-3); }
.form-actions {
  display: flex; gap: var(--space-3); justify-content: flex-end;
  margin-top: var(--space-6); padding-top: var(--space-5);
  border-top: 1px solid var(--border-subtle);
}
.required { color: var(--danger-500); }

/* --- Legacy tables --- */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.table thead th {
  text-align: left;
  padding: var(--space-3) var(--space-3);
  font-weight: var(--weight-semibold);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-default);
  background: var(--gray-50);
}
.table tbody td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}
.table tbody tr:hover { background: var(--gray-25); }
.table tbody tr:last-child td { border-bottom: none; }

/* --- Legacy badges --- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-draft        { background: var(--gray-100); color: var(--text-tertiary); }
.badge-submitted    { background: var(--info-50); color: var(--info-700); }
.badge-reviewed     { background: var(--success-50); color: var(--success-700); }
.badge-active       { background: var(--success-50); color: var(--success-700); }
.badge-pending_approval { background: var(--warning-50); color: var(--warning-700); }
.badge-completed    { background: var(--success-50); color: var(--success-700); }
.badge-cancelled    { background: var(--danger-50); color: var(--danger-700); }
.badge-pending      { background: var(--warning-50); color: var(--warning-700); }
.badge-in_progress  { background: var(--info-50); color: var(--info-700); }
.badge-role         { background: #FAE3D8; color: var(--brand-600); }

/* --- Progress bars --- */
.progress-bar, .progress-bar-mini, .progress-bar-lg {
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar      { height: 8px; width: 100%; margin-top: var(--space-2); }
.progress-bar-mini { height: 4px; width: 80px; }
.progress-bar-lg   { height: 12px; width: 100%; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-500), #D4884A);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
  min-width: 2px;
}
.progress-label    { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: var(--space-1); display: block; }
.progress-label-lg { font-size: var(--text-sm); color: var(--text-secondary); margin-top: var(--space-2); display: block; font-weight: var(--weight-medium); }

/* --- Goals grid --- */
.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-4);
}
.goal-card {
  display: block;
  background: var(--surface-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: box-shadow var(--transition-base);
  color: var(--text-primary);
  text-decoration: none;
}
.goal-card:hover { box-shadow: var(--shadow-sm); }
.goal-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-2); }
.goal-card h3 { font-size: var(--text-md); margin-bottom: var(--space-1); }
.goal-type-tag { font-size: 11px; font-weight: var(--weight-semibold); text-transform: uppercase; color: var(--text-tertiary); letter-spacing: 0.04em; }
.goal-period { font-size: var(--text-xs); color: var(--text-tertiary); }

/* --- Detail blocks --- */
.detail-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  max-width: 720px;
}
.detail-block {
  background: var(--surface-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.detail-block h3 {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
  font-weight: var(--weight-semibold);
}
.detail-block p { font-size: var(--text-base); white-space: pre-wrap; }
.detail-block-accent {
  background: #FEF0E8;
  border-color: #FAE3D8;
}

/* --- Empty state --- */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--text-tertiary);
}
.empty-state p { margin-bottom: var(--space-4); }

/* --- Avatar legacy --- */
.avatar-sm  { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.avatar-xs  { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.avatar-placeholder {
  width: 48px; height: 48px; border-radius: 50%;
  background: #FAE3D8; color: var(--brand-500);
  display: flex; align-items: center; justify-content: center;
  font-weight: var(--weight-semibold); font-size: var(--text-lg);
}
.avatar-placeholder-lg {
  width: 56px; height: 56px; border-radius: 50%;
  background: #FAE3D8; color: var(--brand-500);
  display: flex; align-items: center; justify-content: center;
  font-weight: var(--weight-semibold); font-size: var(--text-xl);
}
.avatar-lg { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }

/* --- Flash messages --- */
.flash-container { padding: var(--space-3) var(--space-6) 0; }
.flash {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}
.flash-success { background: var(--success-50); color: var(--success-700); }
.flash-error   { background: var(--danger-50); color: var(--danger-700); }
.flash-warning { background: var(--warning-50); color: var(--warning-700); }
.flash-info    { background: var(--info-50); color: var(--info-700); }
.flash-dismiss { background: none; border: none; font-size: 1.15rem; color: inherit; opacity: 0.6; cursor: pointer; }

/* --- Text helpers --- */
.text-muted { color: var(--text-tertiary); }
.person-dept { display: block; font-size: var(--text-xs); color: var(--text-tertiary); margin: var(--space-1) 0; }

/* --- Auth pages --- */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-8);
  background:
    radial-gradient(ellipse at 20% 50%, rgba(200, 82, 42, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 30%, rgba(200, 82, 42, 0.04) 0%, transparent 50%),
    var(--gray-50);
}
.auth-card {
  background: var(--surface-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow-md);
  text-align: center;
}
.auth-card.auth-card-wide { max-width: 520px; text-align: left; }
.auth-card.auth-card-clean { box-shadow: none; border: none; background: transparent; }
.auth-brand { margin-bottom: var(--space-8); }
.brand-mark-lg { color: var(--brand-500); font-size: 2.5rem; font-weight: 700; display: block; margin-bottom: var(--space-1); }
.auth-brand h1 { font-size: var(--text-2xl); font-weight: var(--weight-semibold); }
.auth-tagline { color: var(--text-secondary); font-size: var(--text-base); margin-top: var(--space-1); }
.auth-fine-print { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: var(--space-5); }
.invite-info { margin-bottom: var(--space-6); }
.invite-info p { color: var(--text-secondary); font-size: var(--text-sm); }
.invite-info h2 { font-size: var(--text-xl); margin: var(--space-1) 0; }
.auth-brand.auth-brand-compact { margin-bottom: var(--space-6); }

/* Auth form elements */
.auth-heading { margin: 6px 0 2px; font-size: var(--text-xl); font-weight: var(--weight-semibold); }
.auth-subcopy { color: var(--text-secondary); font-size: var(--text-base); margin: 6px 0 0; }
.auth-form { display: grid; gap: var(--space-3); }
.auth-field { display: grid; gap: 6px; text-align: left; }
.auth-field label { color: var(--text-secondary); font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: 0.02em; }
.auth-input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.78rem 0.85rem;
  background: var(--surface-primary);
  font-size: var(--text-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
}
.auth-input:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(200, 82, 42, 0.12); }

.auth-btn {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  width: 100%;
  padding: 0.85rem var(--space-4);
  background: var(--surface-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  font-family: var(--font-sans);
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.auth-btn:hover { border-color: var(--gray-400); box-shadow: var(--shadow-xs); }
.auth-btn:disabled { opacity: 0.65; cursor: not-allowed; }
.auth-btn svg { flex: 0 0 auto; }
.auth-btn-primary { background: var(--brand-500); color: var(--text-inverse); border-color: var(--brand-500); }
.auth-btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: var(--text-inverse); }
.auth-btn-secondary { background: var(--surface-primary); }
.auth-method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin-top: var(--space-5); }

.auth-divider {
  display: flex; align-items: center; gap: var(--space-3);
  margin: var(--space-5) 0 var(--space-4);
  color: var(--text-tertiary);
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; font-weight: var(--weight-semibold);
}
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; background: var(--border-default); flex: 1; }

.auth-panel { border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: rgba(255,255,255,0.7); padding: var(--space-4); }
.auth-tabs { display: inline-flex; gap: 6px; padding: 3px; border-radius: var(--radius-full); background: var(--gray-100); margin-bottom: var(--space-3); }
.auth-tab { border: none; background: transparent; color: var(--text-secondary); padding: var(--space-2) var(--space-3); border-radius: var(--radius-full); font-size: var(--text-sm); font-weight: var(--weight-semibold); cursor: pointer; font-family: var(--font-sans); }
.auth-tab.active { background: var(--surface-primary); color: var(--text-primary); box-shadow: var(--shadow-xs); }
.auth-pane { display: none; }
.auth-pane.active { display: block; }
.auth-status { margin-top: var(--space-3); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); font-size: var(--text-sm); display: none; }
.auth-status.show { display: block; }
.auth-status.info { background: var(--info-50); color: var(--info-700); }
.auth-status.success { background: var(--success-50); color: var(--success-700); }
.auth-status.error { background: var(--danger-50); color: var(--danger-700); }
.auth-note { color: var(--text-tertiary); font-size: var(--text-xs); line-height: var(--leading-relaxed); }
.auth-invite-email { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); margin-top: var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-full); background: var(--gray-100); color: var(--text-secondary); font-size: var(--text-xs); font-weight: var(--weight-semibold); }
.auth-link-row { display: flex; justify-content: center; margin-top: var(--space-4); }
.btn-google { display: flex; align-items: center; justify-content: center; gap: var(--space-2); width: 100%; padding: 0.7rem var(--space-4); background: var(--surface-primary); color: var(--text-primary); border: 1px solid var(--border-strong); border-radius: var(--radius-md); font-size: var(--text-base); font-weight: var(--weight-medium); font-family: var(--font-sans); cursor: pointer; }
.btn-google:hover { border-color: var(--gray-400); box-shadow: var(--shadow-xs); }

@media (max-width: 640px) {
  .auth-card.auth-card-wide { max-width: 100%; padding: var(--space-5); }
  .auth-method-grid { grid-template-columns: 1fr; }
}

/* --- Responsive --- */
@media (max-width: 980px) {
  .split-layout { grid-template-columns: 1fr; }
}


/* --- Consistent admin page width --- */
.admin-chrome,
.admin-content-wrap,
.au-wrap,
.perm-wrap,
.cs,
.qf-wrap,
.se-wrap {
  max-width: 1280px;
  margin: 0 auto;
}
.admin-chrome {
  padding: 0;
  box-sizing: border-box;
}
.admin-chrome .admin-nav {
  overflow: visible;
}

/* Make page-wrapper match admin width */
.page-wrapper {
  max-width: 1280px;
  margin: 0 auto;
}
