/* VitalResume Staff Application — DSGN-014
 * Desktop-first, information-dense layout
 * Blue/slate color scheme
 */

/* ─── Reset & Base ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-primary: #1e40af;
  --color-primary-hover: #1d4ed8;
  --color-primary-light: #dbeafe;
  --color-bg: #f8fafc;
  --color-sidebar: #1e293b;
  --color-sidebar-hover: #334155;
  --color-sidebar-active: #0f172a;
  --color-sidebar-text: #94a3b8;
  --color-sidebar-text-active: #f1f5f9;
  --color-text: #1e293b;
  --color-text-secondary: #64748b;
  --color-text-muted: #94a3b8;
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e1;
  --color-surface: #ffffff;
  --color-surface-alt: #f1f5f9;
  --color-success: #16a34a;
  --color-success-bg: #dcfce7;
  --color-warning: #d97706;
  --color-warning-bg: #fef3c7;
  --color-danger: #dc2626;
  --color-danger-bg: #fee2e2;
  --color-info: #2563eb;
  --color-info-bg: #dbeafe;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Consolas', monospace;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

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

/* ─── Sidebar ─── */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--color-sidebar);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.sidebar-logo span {
  color: var(--color-primary-hover);
}

.sidebar-subtitle {
  font-size: 11px;
  color: var(--color-sidebar-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 8px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text-muted);
  padding: 16px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--color-sidebar-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}

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

.nav-item.active {
  background: var(--color-primary);
  color: #fff;
}

.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active .nav-icon {
  opacity: 1;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-sidebar-text);
  font-size: 12px;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-sidebar-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-sidebar-text-active);
  font-weight: 600;
  font-size: 13px;
}

.sidebar-user-name {
  color: var(--color-sidebar-text-active);
  font-weight: 500;
  font-size: 13px;
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--color-text-muted);
}

.btn-logout {
  background: none;
  border: none;
  color: var(--color-sidebar-text);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  margin-left: auto;
}

.btn-logout:hover {
  background: var(--color-sidebar-hover);
  color: var(--color-danger);
}

/* ─── Main Content ─── */
.main-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.content-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.breadcrumb a {
  color: var(--color-text-secondary);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--color-primary);
}

.breadcrumb-separator {
  color: var(--color-text-muted);
}

.breadcrumb-current {
  color: var(--color-text);
  font-weight: 600;
}

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

.content-body {
  flex: 1;
  padding: 24px;
}

/* ─── Login Page ─── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.login-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 400px;
  max-width: 90vw;
  text-align: center;
}

.login-brand {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
}

.login-brand span {
  color: var(--color-primary);
}

.login-tagline {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 32px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--color-text-muted);
  font-size: 12px;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.login-error {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

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

/* ─── Cards & Panels ─── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

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

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

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

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

.data-table thead th {
  background: var(--color-surface-alt);
  border-bottom: 2px solid var(--color-border);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--color-text-secondary);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.data-table thead th:hover {
  color: var(--color-text);
}

.data-table tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition: background 0.1s;
}

.data-table tbody tr:hover {
  background: var(--color-surface-alt);
}

.data-table tbody tr.clickable {
  cursor: pointer;
}

.data-table td {
  padding: 10px 14px;
  vertical-align: middle;
}

.data-table .cell-name {
  font-weight: 500;
  color: var(--color-text);
}

.data-table .cell-muted {
  color: var(--color-text-secondary);
}

/* ─── Tags / Badges ─── */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  background: var(--color-primary-light);
  color: var(--color-primary);
  white-space: nowrap;
}

.tag + .tag {
  margin-left: 4px;
}

.tag-success {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.tag-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.tag-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.tag-neutral {
  background: var(--color-surface-alt);
  color: var(--color-text-secondary);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.badge-primary {
  background: var(--color-primary);
  color: #fff;
}

/* ─── Score / Progress Indicators ─── */
.score-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-bar-track {
  flex: 1;
  height: 6px;
  background: var(--color-surface-alt);
  border-radius: 3px;
  overflow: hidden;
  max-width: 100px;
}

.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.score-bar-fill.high { background: var(--color-success); }
.score-bar-fill.medium { background: var(--color-warning); }
.score-bar-fill.low { background: var(--color-danger); }

.score-bar-label {
  font-size: 12px;
  font-weight: 600;
  min-width: 36px;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-surface-alt);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-success {
  background: var(--color-success);
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  background: #15803d;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

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

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

.btn-icon {
  padding: 6px;
  width: 32px;
  height: 32px;
}

.btn-oauth {
  width: 100%;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  gap: 10px;
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius-md);
}

.btn-oauth:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-primary);
}

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

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

.form-label-optional {
  font-weight: 400;
  color: var(--color-text-muted);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(30,64,175,0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-muted);
}

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

.form-hint {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 11px;
  color: var(--color-danger);
  margin-top: 4px;
}

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

.form-inline {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.form-inline .form-group {
  margin-bottom: 0;
}

/* ─── Tag Input ─── */
.tag-input-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: text;
  min-height: 38px;
  align-items: center;
}

.tag-input-wrapper:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(30,64,175,0.1);
}

.tag-input-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.tag-input-tag button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  color: var(--color-primary);
  opacity: 0.6;
}

.tag-input-tag button:hover {
  opacity: 1;
}

.tag-input-field {
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 13px;
  background: transparent;
  flex: 1;
  min-width: 100px;
  padding: 2px 0;
}

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

.stat-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}

.stat-box-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
}

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

.stat-box-sub {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ─── Profile Detail ─── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

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

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

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

.profile-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.profile-section {
  margin-bottom: 24px;
}

.profile-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.skill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.skill-depth {
  display: flex;
  gap: 2px;
}

.skill-depth-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-border-strong);
}

.skill-depth-dot.filled {
  background: var(--color-primary);
}

.timeline-item {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

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

.timeline-marker {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary);
  margin-top: 5px;
  flex-shrink: 0;
}

.timeline-content-title {
  font-weight: 600;
  color: var(--color-text);
}

.timeline-content-sub {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.timeline-content-desc {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

/* ─── CV Generation ─── */
.cv-gen-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.cv-gen-layout.single-col {
  grid-template-columns: 1fr;
}

.progress-container {
  padding: 40px 20px;
  text-align: center;
}

.progress-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

.progress-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 4px;
}

.progress-sub {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.pdf-preview-frame {
  width: 100%;
  min-height: 600px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #525659;
}

/* ─── Template Editor ─── */
.template-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.template-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.template-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.template-card-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.template-card-meta {
  font-size: 12px;
  color: var(--color-text-secondary);
}

/* ─── RBAC Admin ─── */
.rbac-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 16px;
  align-items: flex-end;
}

.permissions-table-actions {
  display: flex;
  gap: 4px;
}

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-secondary);
}

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

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

.empty-state-desc {
  font-size: 13px;
  max-width: 360px;
  margin: 0 auto;
}

/* ─── Alerts / Toast ─── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid #bbf7d0;
}

.alert-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1px solid #fecaca;
}

.alert-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border: 1px solid #fde68a;
}

.alert-info {
  background: var(--color-info-bg);
  color: var(--color-info);
  border: 1px solid #93c5fd;
}

.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 12px 16px;
  font-size: 13px;
  min-width: 300px;
  max-width: 420px;
  pointer-events: auto;
  animation: toast-in 0.2s ease-out;
}

.toast.removing {
  animation: toast-out 0.2s ease-in forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

.toast-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.toast-success .toast-title { color: var(--color-success); }
.toast-danger .toast-title { color: var(--color-danger); }
.toast-warning .toast-title { color: var(--color-warning); }
.toast-info .toast-title { color: var(--color-info); }

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.15s ease-out;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 500px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
}

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

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

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

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

.modal-body {
  padding: 20px;
}

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

/* ─── Loading Skeleton ─── */
.skeleton {
  background: linear-gradient(90deg, var(--color-surface-alt) 25%, var(--color-border) 50%, var(--color-surface-alt) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 80%; }

/* ─── Utility ─── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--color-text-secondary); }
.font-semibold { font-weight: 600; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Enrichment Form ─── */
.enrichment-section {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.enrichment-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.enrichment-section-title {
  font-size: 13px;
  font-weight: 600;
}

.enrichment-entry {
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 8px;
}

.enrichment-entry:last-child {
  margin-bottom: 0;
}

/* ─── WYSIWYG Template Editor ─── */
.template-editor {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.te-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  min-height: 52px;
  flex-shrink: 0;
}

.te-toolbar-name {
  width: 220px;
  min-width: 140px;
  font-weight: 600;
}

.te-toolbar-group {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.te-toolbar-select {
  width: 150px;
  min-width: 120px;
}

.te-panels {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Left panel: Elements */
.te-elements-panel {
  width: 220px;
  min-width: 220px;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.te-elements-header {
  padding: 12px 14px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
}

.te-element-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
}

.te-element-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.12s;
  margin-bottom: 2px;
  user-select: none;
}

.te-element-row:hover {
  background: var(--color-surface-alt);
}

.te-element-selected {
  background: var(--color-primary-light) !important;
  box-shadow: inset 0 0 0 1.5px var(--color-primary);
}

.te-drag-handle {
  cursor: grab;
  color: var(--color-text-muted);
  font-size: 12px;
  letter-spacing: -1px;
  padding: 0 2px;
  flex-shrink: 0;
  line-height: 1;
}

.te-drag-handle:active {
  cursor: grabbing;
}

.te-element-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.te-element-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  transition: color 0.12s, background 0.12s;
}

.te-element-delete:hover {
  color: var(--color-danger);
  background: var(--color-danger-bg);
}

.te-element-dragging {
  opacity: 0.35;
}

.te-drag-ghost {
  background: var(--color-surface);
  border: 1.5px solid var(--color-primary);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-md);
  opacity: 0.92;
}

.te-drop-above {
  box-shadow: inset 0 2px 0 0 var(--color-primary);
}

.te-drop-below {
  box-shadow: inset 0 -2px 0 0 var(--color-primary);
}

.te-add-element-wrap {
  padding: 8px;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.te-add-dropdown-container {
  position: relative;
}

.te-add-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  margin-bottom: 4px;
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
}

.te-add-option {
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
}

.te-add-option:hover {
  background: var(--color-surface-alt);
}

/* Center panel: Preview */
.te-preview-panel {
  flex: 1;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-width: 0;
}

.te-preview-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.te-preview-loading {
  color: var(--color-text-muted);
  font-size: 13px;
}

.te-page-shadow {
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.06);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.te-preview-iframe {
  border: none;
  display: block;
  background: #fff;
}

/* Right panel: Properties */
.te-properties-panel {
  width: 280px;
  min-width: 280px;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  overflow-y: auto;
  padding-bottom: 24px;
}

.te-props-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
}

.te-props-deselect {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--color-text-muted);
  padding: 0 2px;
  line-height: 1;
  border-radius: var(--radius-sm);
}

.te-props-deselect:hover {
  color: var(--color-text);
  background: var(--color-surface-alt);
}

.te-property-group {
  padding: 6px 14px;
}

.te-property-group .form-label {
  margin-bottom: 4px;
}

.te-property-group .form-input,
.te-property-group .form-select,
.te-property-group .form-textarea {
  font-size: 12px;
}

.te-type-readonly {
  cursor: default;
  display: inline-block;
  margin-top: 2px;
}

.te-margins-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.te-margin-label {
  display: block;
  font-size: 10px;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

.te-margin-input {
  text-align: center;
}

.te-radio-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}

.te-radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-text);
  cursor: pointer;
}

.te-radio-label input[type="radio"] {
  margin: 0;
}

.te-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-text);
  cursor: pointer;
}

.te-checkbox-label input[type="checkbox"] {
  margin: 0;
}

.te-input-suffix-wrap {
  display: flex;
  align-items: center;
  gap: 0;
}

.te-input-suffix-wrap .form-input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  flex: 1;
}

.te-input-suffix {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  height: 34px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border-strong);
  border-left: none;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 500;
}

.te-color-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.te-color-input {
  width: 36px;
  height: 30px;
  padding: 1px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
}

.te-color-hex {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
}

.te-custom-css {
  font-family: var(--font-mono) !important;
  font-size: 11px !important;
  line-height: 1.5;
}

/* ─── Responsive (still desktop-first) ─── */
@media (max-width: 1024px) {
  .cv-gen-layout {
    grid-template-columns: 1fr;
  }
  .rbac-form-grid {
    grid-template-columns: 1fr;
  }
  .te-elements-panel {
    width: 180px;
    min-width: 180px;
  }
  .te-properties-panel {
    width: 240px;
    min-width: 240px;
  }
}

/* ─── Sortable Table Headers ─── */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { background: var(--color-hover, #f1f5f9); }
.sort-indicator { display: inline-block; width: 12px; margin-left: 4px; font-size: 0.65rem; color: var(--color-text-muted, #94a3b8); vertical-align: middle; }
.sort-indicator.sort-asc, .sort-indicator.sort-desc { color: var(--color-primary, #1e40af); }

/* ─── Search Tabs ─── */
.search-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--color-border, #e2e8f0);
}

.search-tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--color-text-muted, #64748b);
  cursor: pointer;
  transition: all 0.15s;
}

.search-tab:hover {
  color: var(--color-primary, #1e40af);
}

.search-tab.active {
  color: var(--color-primary, #1e40af);
  border-bottom-color: var(--color-primary, #1e40af);
}

/* ─── Bid Search Textarea ─── */
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}

.form-textarea:focus {
  border-color: var(--color-primary, #1e40af);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

/* ─── Bid Candidate Cards ─── */
.bid-results-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bid-candidate-card {
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 8px;
  padding: 16px;
  background: var(--color-surface, #fff);
  transition: box-shadow 0.15s;
}

.bid-candidate-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.bid-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 10px;
}

.bid-card-identity {
  flex: 1;
}

.bid-card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text, #0f172a);
  margin-bottom: 4px;
}

.bid-card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.bid-card-score {
  flex-shrink: 0;
  width: 120px;
}

.bid-card-summary {
  font-size: 14px;
  line-height: 1.55;
  color: var(--color-text-secondary, #475569);
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--color-bg, #f8fafc);
  border-radius: 6px;
  border-left: 3px solid var(--color-primary, #1e40af);
}

.bid-card-tags {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.bid-card-tag-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 13px;
}

.bid-card-tag-label {
  font-weight: 500;
  color: var(--color-text-muted, #64748b);
  margin-right: 4px;
}

.bid-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.bid-tag-strength {
  background: #dcfce7;
  color: #166534;
}

.bid-tag-gap {
  background: #fef3c7;
  color: #92400e;
}

.bid-card-actions {
  display: flex;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border, #e2e8f0);
}
