/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --bg:          #f6f8fa;
  --bg-card:     #ffffff;
  --bg-hover:    #eef1f5;
  --border:      #d0d7de;
  --primary:     #0969da;
  --primary-dim: #218bff;
  --success:     #1a7f37;
  --warning:     #9a6700;
  --danger:      #cf222e;
  --muted:       #57606a;
  --text:        #1f2328;
  --text-dim:    #32383f;
  --radius:      8px;
  --radius-lg:   12px;
  --shadow:      0 1px 3px rgba(0,0,0,.08), 0 3px 12px rgba(0,0,0,.06);
  --transition:  .18s ease;
  --font:        'Inter', system-ui, -apple-system, sans-serif;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4 { font-weight: 600; line-height: 1.25; color: var(--text); }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }
.muted { color: var(--muted); font-size: .875rem; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }

/* ── Layout ─────────────────────────────────────────────────── */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.container-sm { max-width: 560px; }
.container-md { max-width: 780px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ── Card ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: border-color var(--transition), transform var(--transition);
}
.card:hover { border-color: var(--primary-dim); }
.card-sm { padding: 1rem; }

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(246,248,250,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: 60px;
  display: flex;
  align-items: center;
}
.navbar-inner { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.navbar-brand { font-size: 1.3rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: .5rem; }
.navbar-brand span { color: var(--primary); }
.navbar-nav { display: flex; align-items: center; gap: 1.5rem; list-style: none; }
.navbar-nav a { color: var(--text-dim); font-size: .9rem; transition: color var(--transition); }
.navbar-nav a:hover, .navbar-nav a.active { color: var(--text); text-decoration: none; }
.navbar-actions { display: flex; align-items: center; gap: .75rem; }

/* ── Hamburger ──────────────────────────────────────────────── */
.btn-hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius);
  flex-shrink: 0;
  color: var(--text, #e6edf3);
  font-size: 1.5rem;
  line-height: 1;
  transition: background .18s ease, color .18s ease;
}
.btn-hamburger:hover { background: rgba(0,0,0,.06); }
.btn-hamburger.open { color: var(--primary, #58a6ff); }

@media (max-width: 899px) {
  .navbar-actions { display: none; }
}

/* ── Sidebar layout (mobile-first) ─────────────────────────── */
.app-layout { display: block; min-height: calc(100vh - 60px); }

.sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  position: fixed;
  top: 60px;
  left: 0;
  width: 260px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  z-index: 90;
  transform: translateX(-100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.sidebar.open {
  transform: translateX(0);
  box-shadow: 4px 0 24px rgba(0,0,0,.12);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: 60px;
  background: rgba(0,0,0,.3);
  z-index: 89;
}
.sidebar-overlay.visible { display: block; }

.sidebar-menu { list-style: none; }
.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.5rem;
  color: var(--muted);
  font-size: .9rem;
  transition: background var(--transition), color var(--transition);
}
.sidebar-menu li a:hover {
  background: var(--bg-hover);
  color: var(--text);
  text-decoration: none;
}
.sidebar-menu li a.active {
  background: rgba(9,105,218,.08);
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.sidebar-menu li a .icon { width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-section {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  padding: 1rem 1.5rem .4rem;
}

.main-content { padding: 1.25rem 1rem; overflow-y: auto; }

@media (min-width: 900px) {
  .btn-hamburger { display: none; }
  .sidebar-overlay { display: none !important; }
  .app-layout { display: grid; grid-template-columns: 220px 1fr; }
  .sidebar {
    position: sticky;
    width: auto;
    height: calc(100vh - 60px);
    transform: none !important;
    box-shadow: none !important;
    z-index: auto;
  }
  .main-content { padding: 2rem 2.5rem; }
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
  line-height: 1.4;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }

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

.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg-hover); border-color: var(--text-dim); color: var(--text); }

.btn-success { background: #d1fae5; color: var(--success); border-color: #a7f3d0; }
.btn-success:hover { background: #a7f3d0; }
.btn-danger  { background: #fee2e2; color: var(--danger);  border-color: #fca5a5; }
.btn-danger:hover  { background: #fca5a5; }
.btn-ghost   { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-sm { padding: .35rem .7rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.label { font-size: .875rem; font-weight: 500; color: var(--text-dim); }
.input, .select, .textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .9rem;
  padding: .55rem .85rem;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: var(--font);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(88,166,255,.12);
}
.input::placeholder { color: var(--muted); }
.textarea { resize: vertical; min-height: 100px; }
.select { appearance: none; cursor: pointer; }

.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

.form-hint { font-size: .8rem; color: var(--muted); }
.form-error { font-size: .8rem; color: var(--danger); }

/* ── Score bars ─────────────────────────────────────────────── */
.score-bar-wrap { display: flex; flex-direction: column; gap: .3rem; }
.score-bar-label { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); }
.score-bar-track { height: 6px; background: var(--bg-hover); border-radius: 99px; overflow: hidden; }
.score-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary-dim), var(--primary));
  transition: width .6s ease;
}
.score-bar-fill.high   { background: linear-gradient(90deg, #6ee7b7, var(--success)); }
.score-bar-fill.medium { background: linear-gradient(90deg, #fcd34d, var(--warning)); }
.score-bar-fill.low    { background: linear-gradient(90deg, #fca5a5, var(--danger)); }

/* ── Badge / Tag ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .55rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 500;
  white-space: nowrap;
}
.badge-blue    { background: rgba(9,105,218,.1);   color: var(--primary); }
.badge-green   { background: rgba(26,127,55,.1);   color: var(--success); }
.badge-yellow  { background: rgba(154,103,0,.1);   color: var(--warning); }
.badge-red     { background: rgba(207,34,46,.1);   color: var(--danger); }
.badge-gray    { background: var(--bg-hover);       color: var(--muted); }

.skill-tag {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: rgba(9,105,218,.08);
  border: 1px solid rgba(9,105,218,.2);
  color: var(--primary);
  border-radius: 6px;
  padding: .2rem .5rem;
  font-size: .78rem;
}
.skill-tag.removable { cursor: pointer; }
.skill-tag.removable:hover { background: rgba(248,81,73,.15); border-color: var(--danger); color: var(--danger); }

.tags-wrap { display: flex; flex-wrap: wrap; gap: .4rem; }

/* ── Table ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  padding: .6rem .75rem;
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: .75rem .75rem;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  vertical-align: middle;
}
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--bg-hover); }

/* ── Kanban ─────────────────────────────────────────────────── */
.kanban { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem; align-items: flex-start; }
.kanban-col {
  min-width: 240px;
  max-width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  flex-shrink: 0;
}
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
}
.kanban-col-title { font-weight: 600; font-size: .85rem; }
.kanban-count { background: var(--bg-hover); color: var(--muted); border-radius: 99px;
  padding: .1rem .45rem; font-size: .75rem; font-weight: 600; }
.kanban-cards { display: flex; flex-direction: column; gap: .5rem; min-height: 60px; }
.kanban-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem;
  cursor: grab;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.kanban-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.kanban-card.dragging { opacity: .5; cursor: grabbing; }
.kanban-card-name { font-weight: 500; font-size: .9rem; margin-bottom: .25rem; }
.kanban-card-meta { font-size: .78rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .3rem; }

/* ── Score circle ────────────────────────────────────────────── */
.score-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  font-weight: 700;
  flex-shrink: 0;
}
.score-circle.high   { background: rgba(26,127,55,.1);   color: var(--success); border: 2px solid rgba(26,127,55,.3); }
.score-circle.medium { background: rgba(154,103,0,.1);  color: var(--warning); border: 2px solid rgba(154,103,0,.3); }
.score-circle.low    { background: rgba(207,34,46,.1);  color: var(--danger);  border: 2px solid rgba(207,34,46,.3); }

/* ── Freelancer card ─────────────────────────────────────────── */
.freelancer-card { display: flex; gap: 1rem; align-items: flex-start; }
.freelancer-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}
.freelancer-info { flex: 1; min-width: 0; }
.freelancer-name { font-weight: 600; font-size: .95rem; }
.freelancer-titre { font-size: .85rem; color: var(--muted); }
.freelancer-meta { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .35rem; }

/* ── Alert / Toast ───────────────────────────────────────────── */
.alert { border-radius: var(--radius); padding: .75rem 1rem; font-size: .9rem; border: 1px solid; }
.alert-success { background: rgba(63,185,80,.1);   border-color: rgba(63,185,80,.3);  color: var(--success); }
.alert-danger  { background: rgba(248,81,73,.1);   border-color: rgba(248,81,73,.3);  color: var(--danger); }
.alert-warning { background: rgba(210,153,34,.1);  border-color: rgba(210,153,34,.3); color: var(--warning); }
.alert-info    { background: rgba(88,166,255,.1);  border-color: rgba(88,166,255,.3); color: var(--primary); }

.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 999; display: flex; flex-direction: column; gap: .5rem; }
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  min-width: 260px;
  box-shadow: var(--shadow);
  animation: slideIn .2s ease;
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .875rem;
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Stat cards ──────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem 1.5rem; }
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1; color: var(--text); }
.stat-label { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.stat-icon  { font-size: 1.5rem; margin-bottom: .5rem; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: .35rem; }
.pagination .page-btn {
  padding: .3rem .65rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: .875rem;
  cursor: pointer;
  transition: background var(--transition);
}
.pagination .page-btn:hover { background: var(--bg-hover); color: var(--text); }
.pagination .page-btn.active { background: var(--primary-dim); border-color: var(--primary-dim); color: #fff; }
.pagination .page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Loading ─────────────────────────────────────────────────── */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Section headers ─────────────────────────────────────────── */
.page-header { margin-bottom: 2rem; }
.page-header h1 { margin-bottom: .35rem; }
.page-header .muted { font-size: .9rem; }
.section-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.25rem; flex-wrap: wrap; gap: .75rem; }

/* ── Progress steps (onboarding) ─────────────────────────────── */
.steps { display: flex; align-items: center; gap: 0; margin-bottom: 2.5rem; }
.step {
  display: flex;
  align-items: center;
  flex: 1;
}
.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 600;
  flex-shrink: 0;
  background: var(--bg);
  transition: all var(--transition);
}
.step.done .step-dot    { background: var(--primary-dim); border-color: var(--primary-dim); color: #fff; }
.step.active .step-dot  { border-color: var(--primary); color: var(--primary); }
.step-line { flex: 1; height: 2px; background: var(--border); }
.step.done + .step .step-line { background: var(--primary-dim); }
.step-label { font-size: .75rem; color: var(--muted); margin-top: .35rem; text-align: center; white-space: nowrap; }
.step-wrap { display: flex; flex-direction: column; align-items: center; }

/* ── Range slider ────────────────────────────────────────────── */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: var(--bg-hover);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(88,166,255,.2);
}

/* ── Auth pages ──────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(9,105,218,.08) 0%, transparent 60%), var(--bg);
  padding: 2rem 1rem;
}
.auth-card { width: 100%; max-width: 440px; }
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo-text { font-size: 2rem; font-weight: 800; color: var(--text); }
.auth-logo-text span { color: var(--primary); }
.auth-divider { display: flex; align-items: center; gap: 1rem; margin: 1rem 0; }
.auth-divider hr { flex: 1; border: none; border-top: 1px solid var(--border); }
.auth-divider span { font-size: .8rem; color: var(--muted); }

/* ── Responsive helpers ──────────────────────────────────────── */
.hidden { display: none !important; }
.d-flex { display: flex; }
.mt-1 { margin-top: .5rem; }  .mt-2 { margin-top: 1rem; }  .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }.mb-2 { margin-bottom: 1rem; }.mb-3 { margin-bottom: 1.5rem; }
.ml-auto { margin-left: auto; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.w-full { width: 100%; }
