/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 9px 16px;
  font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--color-surface); border-color: var(--color-border); color: var(--color-text); }
.btn-secondary:hover { background: var(--color-bg); }
.btn-ghost { background: none; border-color: transparent; color: var(--color-text-muted); }
.btn-ghost:hover { background: var(--color-bg); color: var(--color-text); }
.btn-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; }
.btn-icon.danger { color: var(--color-danger); border-color: var(--color-danger-soft); }
.btn-icon.danger:hover { background: var(--color-danger-soft); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.card-body { padding: var(--space-5); }
.card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
}

/* ---------- KPI tiles ---------- */
.kpi-tile { padding: var(--space-5); display: flex; flex-direction: column; gap: 6px; }
.kpi-tile-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--accent-text);
  display: flex; align-items: center; justify-content: center;
}
.kpi-icon svg { width: 18px; height: 18px; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.kpi-label { color: var(--color-text-muted); font-size: 12.5px; }
.kpi-delta { font-size: 12px; font-weight: 600; }
.kpi-delta.up { color: var(--color-success); }
.kpi-delta.down { color: var(--color-danger); }

/* ---------- Filter bar ---------- */
.filter-bar {
  display: flex; align-items: center; gap: var(--space-3);
  margin-bottom: var(--space-4); flex-wrap: wrap;
}
.search-input {
  display: flex; align-items: center; gap: 8px;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); padding: 0 10px; height: 36px;
  min-width: 220px; flex: 1; max-width: 320px;
}
.search-input svg { width: 15px; height: 15px; color: var(--color-text-faint); flex-shrink: 0; }
.search-input input { border: none; outline: none; flex: 1; background: transparent; height: 100%; }
.select-field, .input-field {
  height: 36px; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  padding: 0 10px; background: var(--color-surface); color: var(--color-text);
}

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.data-table thead th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--color-text-muted); font-weight: 600;
  padding: 12px var(--space-4); border-bottom: 1px solid var(--color-border);
  background: #fafbfc; white-space: nowrap;
}
.data-table tbody td {
  padding: 13px var(--space-4); border-bottom: 1px solid var(--color-border);
  font-size: 13.5px; vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafbfd; }
.cell-primary { font-weight: 600; }
.cell-sub { color: var(--color-text-muted); font-size: 12px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.empty-state { text-align: center; padding: var(--space-7) var(--space-4); color: var(--color-text-muted); }
.empty-state .empty-icon { margin: 0 auto var(--space-3); width: 44px; height: 44px; opacity: 0.5; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--color-success-soft); color: var(--color-success); }
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.badge-info { background: var(--color-info-soft); color: var(--color-info); }
.badge-neutral { background: var(--color-neutral-soft); color: #4b5563; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 18, 30, 0.5);
  display: none; align-items: flex-start; justify-content: center;
  padding: var(--space-6) var(--space-4); overflow-y: auto; z-index: 100;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--color-surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 560px;
  margin: auto 0;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--color-border);
}
.modal-close { background: none; border: none; cursor: pointer; color: var(--color-text-muted); padding: 4px; }
.modal-body { padding: var(--space-5); max-height: 65vh; overflow-y: auto; }
.modal-footer {
  padding: var(--space-4) var(--space-5); border-top: 1px solid var(--color-border);
  display: flex; justify-content: flex-end; gap: var(--space-2);
}

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-4); }
.field label { font-size: 12.5px; font-weight: 600; color: var(--color-text); }
.field .hint { font-size: 11.5px; color: var(--color-text-muted); }
.field input, .field select, .field textarea {
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  padding: 9px 11px; font-size: 13.5px; color: var(--color-text); background: var(--color-surface);
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { resize: vertical; min-height: 80px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }

/* ---------- Permission matrix ---------- */
.rights-matrix { width: 100%; border-collapse: collapse; }
.rights-matrix th, .rights-matrix td {
  padding: 9px 12px; border-bottom: 1px solid var(--color-border); font-size: 13px; text-align: center;
}
.rights-matrix th { text-align: left; font-size: 12px; color: var(--color-text-muted); font-weight: 600; }
.rights-matrix td:first-child, .rights-matrix th:first-child { text-align: left; font-weight: 600; color: var(--color-text); }
.rights-matrix input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* ---------- Portal chooser cards ---------- */
.portal-card {
  background: var(--color-surface); border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-5); text-align: center;
  box-shadow: var(--shadow-lg); transition: transform 0.15s ease;
  display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
}
.portal-card:hover { transform: translateY(-4px); }
.portal-card .portal-icon {
  width: 56px; height: 56px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.portal-card.master .portal-icon { background: #4338ca; }
.portal-card.employer .portal-icon { background: #0f766e; }

/* ---------- Report cards ---------- */
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-4); }
.report-card { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.chart-placeholder {
  height: 120px; border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--accent-soft), transparent);
  display: flex; align-items: flex-end; gap: 6px; padding: var(--space-3);
}
.chart-placeholder .bar { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; opacity: 0.75; }

/* ---------- Onboarding progress + checklist ---------- */
.progress-track {
  width: 100%; height: 6px; border-radius: 999px; background: var(--color-border); overflow: hidden;
}
.progress-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.2s ease; }
.progress-label { font-size: 11.5px; color: var(--color-text-muted); white-space: nowrap; }
.task-list { display: flex; flex-direction: column; gap: 2px; }
.task-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px var(--space-2); border-bottom: 1px solid var(--color-border);
}
.task-item:last-child { border-bottom: none; }
.task-item input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.task-item-title { flex: 1; font-size: 13.5px; }
.task-item.done .task-item-title { color: var(--color-text-muted); text-decoration: line-through; }
.task-item-due { font-size: 11.5px; color: var(--color-text-muted); white-space: nowrap; }
.task-add-row { display: flex; gap: var(--space-2); margin-top: var(--space-3); }
.task-add-row input { flex: 1; }

/* ---------- Onboarding workflow: tabs, entry cards, banners ---------- */
.tab-nav {
  display: flex; gap: 4px; border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-4); overflow-x: auto; flex-wrap: nowrap;
}
.tab-btn {
  background: none; border: none; padding: 10px 14px; font-size: 13px; font-weight: 600;
  color: var(--color-text-muted); cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn .tab-flag-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--color-danger); margin-left: 5px; vertical-align: middle;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.banner {
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: var(--space-4); line-height: 1.5;
}
.banner-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.banner-info { background: var(--color-info-soft); color: var(--color-info); }
.banner-success { background: var(--color-success-soft); color: var(--color-success); }

.entry-card {
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4); margin-bottom: var(--space-3);
  display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3);
}
.entry-card-title { font-weight: 600; font-size: 13.5px; }
.entry-card-sub { color: var(--color-text-muted); font-size: 12px; margin-top: 2px; }
.entry-card-actions { display: flex; gap: 6px; flex-shrink: 0; }

.verify-row {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  padding: 8px 0; border-bottom: 1px solid var(--color-border);
}
.verify-row:last-child { border-bottom: none; }
.verify-row label { display: flex; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.verify-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--color-success); cursor: pointer; }
.verify-row a { flex: 1; }

.readonly-field { font-size: 13px; padding: 6px 0; }
.readonly-field .rf-label { color: var(--color-text-muted); font-size: 11.5px; }

/* ---------- Misc ---------- */
.divider { height: 1px; background: var(--color-border); margin: var(--space-4) 0; }
.toast {
  position: fixed; bottom: var(--space-5); right: var(--space-5);
  background: #171a2b; color: #fff; padding: 12px 18px; border-radius: var(--radius-sm);
  font-size: 13px; box-shadow: var(--shadow-lg); z-index: 200;
  opacity: 0; transform: translateY(8px); transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ---------- Platform (Skreenit staff) impersonation banner ---------- */
.platform-impersonation-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 10px var(--space-5);
  background: var(--color-warning-soft);
  color: var(--color-warning);
  font-size: 13px;
  font-weight: 500;
  border-bottom: 1px solid var(--color-warning);
}
.platform-impersonation-banner button {
  background: var(--color-warning);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
