*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, sans-serif; background: #f1f5f9; color: #1e293b; min-height: 100vh; }

/* ── Login ── */
#login-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.login-card { background: #fff; border-radius: 12px; padding: 40px 36px; box-shadow: 0 4px 24px rgba(0,0,0,.10); width: 100%; max-width: 380px; }
.login-card h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-card p  { font-size: 13px; color: #64748b; margin-bottom: 24px; }

/* ── Shell ── */
#app { display: none; }
header { background: #0e1c2f; color: #fff; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; height: 56px; position: sticky; top: 0; z-index: 50; }
header h1 { font-size: 16px; font-weight: 700; letter-spacing: .02em; }

/* ── Nav tabs ── */
.nav-tabs { display: flex; gap: 4px; background: #f1f5f9; border-radius: 10px; padding: 4px; margin-bottom: 28px; }
.nav-tab { flex: 1; padding: 8px 14px; border: none; background: transparent; border-radius: 7px; font-size: 13px; font-weight: 600; color: #64748b; cursor: pointer; transition: all .15s; text-align: center; }
.nav-tab.active { background: #fff; color: #0e1c2f; box-shadow: 0 1px 4px rgba(0,0,0,.10); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.main { max-width: 1100px; margin: 0 auto; padding: 28px 24px; }

/* ── Dashboard cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.07); }
.stat-label { font-size: 11px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 800; color: #0e1c2f; }
.stat-sub   { font-size: 11px; color: #64748b; margin-top: 3px; }
.stat-card.amber .stat-value { color: #d38319; }
.stat-card.green .stat-value { color: #16a34a; }
.stat-card.red   .stat-value { color: #dc2626; }

/* ── Pipeline ── */
.pipeline { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 1px 4px rgba(0,0,0,.07); margin-bottom: 28px; }
.pipeline h3 { font-size: 13px; font-weight: 700; color: #0e1c2f; margin-bottom: 16px; }
.pipeline-bar { display: flex; height: 28px; border-radius: 8px; overflow: hidden; gap: 2px; }
.pipe-seg { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; transition: flex .4s; min-width: 0; overflow: hidden; }
.pipe-open      { background: #d38319; }
.pipe-paused    { background: #94a3b8; }
.pipe-filled    { background: #16a34a; }
.pipe-cancelled { background: #ef4444; }
.pipeline-legend { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #64748b; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ── Banner ── */
.banner { padding: 12px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; margin-bottom: 20px; display: none; }
.banner.success { background: #dcfce7; color: #166534; display: block; }
.banner.error   { background: #fee2e2; color: #991b1b; display: block; }

/* ── Cards ── */
.card { background: #fff; border-radius: 12px; padding: 28px; box-shadow: 0 1px 4px rgba(0,0,0,.07); margin-bottom: 28px; }
.card h2 { font-size: 15px; font-weight: 700; margin-bottom: 8px; color: #0e1c2f; }
.card-desc { font-size: 12px; color: #94a3b8; margin-bottom: 20px; }

/* ── Section dividers ── */
.section-label {
  font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: #94a3b8; padding: 10px 0 8px; border-top: 1px solid #f1f5f9; margin-top: 6px;
  display: flex; align-items: center; gap: 8px;
}
.section-label::after { content: ''; flex: 1; height: 1px; background: #f1f5f9; }
.section-label.first { border-top: none; margin-top: 0; padding-top: 0; }

/* ── Forms ── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }
.form-row.single { grid-template-columns: 1fr; }
label { display: block; font-size: 11px; font-weight: 700; color: #475569; margin-bottom: 5px; letter-spacing: .04em; text-transform: uppercase; }
.label-internal { color: #94a3b8; }
input, textarea, select {
  width: 100%; padding: 9px 12px; border: 1.5px solid #e2e8f0;
  border-radius: 8px; font-size: 14px; color: #1e293b; background: #f8fafc;
  transition: border-color .15s; font-family: inherit;
}
input.internal, select.internal, textarea.internal { background: #fafafa; border-color: #e2e8f0; }
input:focus, textarea:focus, select:focus { outline: none; border-color: #d38319; background: #fff; }
textarea { resize: vertical; min-height: 160px; font-family: 'Courier New', monospace; font-size: 13px; line-height: 1.6; }
textarea.short { min-height: 80px; font-family: inherit; font-size: 14px; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: opacity .15s; }
.btn:hover { opacity: .85; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-amber  { background: #d38319; color: #fff; }
.btn-navy   { background: #0e1c2f; color: #fff; }
.btn-danger { background: #fee2e2; color: #991b1b; }
.btn-ghost  { background: transparent; color: #64748b; border: 1.5px solid #e2e8f0; }
.btn-sm     { padding: 6px 12px; font-size: 12px; }

/* ── Roles list ── */
.roles-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.roles-header h2 { font-size: 15px; font-weight: 700; color: #0e1c2f; }
.roles-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-btn { padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; border: 1.5px solid #e2e8f0; background: #fff; cursor: pointer; color: #64748b; transition: all .15s; }
.filter-btn.active { background: #0e1c2f; color: #fff; border-color: #0e1c2f; }
.roles-list { display: flex; flex-direction: column; gap: 10px; }
.role-item { background: #fff; border-radius: 10px; padding: 16px 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06); display: flex; align-items: flex-start; gap: 16px; border-left: 4px solid #e2e8f0; transition: border-color .15s; }
.role-item[data-status="Open"]      { border-left-color: #d38319; }
.role-item[data-status="Paused"]    { border-left-color: #94a3b8; }
.role-item[data-status="Filled"]    { border-left-color: #16a34a; }
.role-item[data-status="Cancelled"] { border-left-color: #ef4444; opacity: .65; }
.role-info { flex: 1; min-width: 0; }
.role-name { font-size: 14px; font-weight: 700; color: #0e1c2f; margin-bottom: 4px; }
.role-meta { font-size: 12px; color: #64748b; display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }
.role-ats  { font-size: 11px; color: #94a3b8; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.role-id   { font-family: monospace; font-size: 10px; color: #cbd5e1; }
.role-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: flex-start; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px; letter-spacing: .04em; text-transform: uppercase; }
.badge-open      { background: #fef3c7; color: #92400e; }
.badge-paused    { background: #f1f5f9; color: #64748b; }
.badge-filled    { background: #dcfce7; color: #166534; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-high      { background: #fee2e2; color: #991b1b; }
.badge-medium    { background: #fef3c7; color: #92400e; }
.badge-low       { background: #f1f5f9; color: #64748b; }

/* ── Overlay ── */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.overlay-box { background: #fff; border-radius: 14px; width: 100%; max-width: 780px; max-height: 92vh; overflow-y: auto; padding: 28px; }
.overlay-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.overlay-header h2 { font-size: 16px; font-weight: 700; }
.overlay-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #94a3b8; line-height: 1; }

.empty-state { text-align: center; padding: 48px 24px; color: #94a3b8; font-size: 14px; }
.loading-bar { text-align: center; padding: 40px; color: #94a3b8; font-size: 14px; }
.spinner-inline { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 700px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row, .form-row.three { grid-template-columns: 1fr; }
  header { padding: 0 16px; }
  .main  { padding: 16px; }
  .role-actions { flex-direction: column; }
}