/* =========================================================================
   PeopleOS — design system (light + dark)
   Soft lavender surfaces · indigo accents · rounded floating cards
   ========================================================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --frame: #56539a;               /* purple surround behind the app frame */
  --brand: #5d5fef;               /* primary indigo */
  --brand-600: #4b4de0;
  --brand-50: #eeeefc;            /* icon-chip / hover lavender */
  --brand-100: #e2e3fb;
  --surface: #ffffff;
  --surface-2: #f7f7fc;
  --bg: #f4f4fb;                  /* content area */
  --sidebar: #ffffff;
  --border: #ecebf5;
  --border-2: #f1f0f8;
  --text: #23223c;
  --text-2: #8b89a6;
  --text-3: #b4b2c8;
  --green: #22c55e;
  --green-bg: #dcfce7;
  --amber: #f59e0b;
  --amber-bg: #fef3c7;
  --red: #ef4444;
  --red-bg: #fee2e2;
  --blue: #3b82f6;
  --blue-bg: #dbeafe;
  --orange: #f97316;
  --purple: #8b5cf6;
  --mint: #7ed3b2;
  --shadow: 0 6px 24px rgba(40, 38, 80, 0.06);
  --shadow-sm: 0 2px 8px rgba(40, 38, 80, 0.05);
  --shadow-pop: 0 24px 60px rgba(30, 27, 75, 0.28);
  --r-card: 18px;
  --r-lg: 22px;
  --r-btn: 11px;
  --sidebar-w: 232px;
}

:root[data-theme="dark"] {
  --frame: #0d0c16;
  --brand: #7c7dff;
  --brand-600: #6a6bf5;
  --brand-50: #23233a;
  --brand-100: #2c2c47;
  --surface: #1d1c2b;
  --surface-2: #191826;
  --bg: #14131f;
  --sidebar: #1a1928;
  --border: #2b2940;
  --border-2: #252336;
  --text: #eceaf6;
  --text-2: #9a98b6;
  --text-3: #6a6883;
  --green-bg: #14381f;
  --amber-bg: #3a2c0a;
  --red-bg: #3a1a1a;
  --blue-bg: #14294a;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-pop: 0 24px 60px rgba(0, 0, 0, 0.55);
}

body {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* --- App shell -------------------------------------------------------- */
.app {
  display: flex;
  height: 100vh;
  background: var(--bg);
  overflow: hidden;
}

/* --- Sidebar ---------------------------------------------------------- */
.sidebar { width: var(--sidebar-w); background: var(--sidebar); display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto; border-right: 1px solid var(--border); padding: 8px; }
.sidebar-logo { padding: 16px 14px 18px; display: flex; align-items: center; gap: 11px; }
.logo-icon { width: 38px; height: 38px; background: linear-gradient(135deg, var(--brand), #8a5cf6); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 18px; box-shadow: var(--shadow-sm); }
.logo-text { font-weight: 800; font-size: 16px; color: var(--text); letter-spacing: -0.3px; }
.logo-sub { font-size: 10px; color: var(--text-2); }
.nav-section { padding: 8px 0; }
.nav-label { font-size: 10px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.8px; padding: 8px 14px 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; margin: 2px 4px; cursor: pointer; color: var(--text-2); font-size: 13px; font-weight: 600; border-radius: 12px; transition: all 0.16s; }
.nav-item:hover { background: var(--brand-50); color: var(--brand); }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: 0 8px 18px rgba(93, 95, 239, 0.35); }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }
.nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.nav-item.active .nav-badge { background: rgba(255,255,255,0.25); }

.side-promo { margin: auto 8px 8px; background: linear-gradient(160deg, #6466f1, #8b5cf6); border-radius: 18px; padding: 18px 16px; color: #fff; }
.side-promo h4 { font-size: 14px; font-weight: 700; line-height: 1.25; margin-bottom: 6px; }
.side-promo p { font-size: 11px; opacity: 0.85; margin-bottom: 12px; line-height: 1.4; }
.side-promo a { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,0.18); backdrop-filter: blur(4px); padding: 7px 12px; border-radius: 9px; font-size: 12px; font-weight: 700; }
.side-promo a:hover { background: rgba(255,255,255,0.28); }

/* --- Main + global appbar -------------------------------------------- */
.main { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.appbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 26px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); }
.appbar-search { flex: 0 1 320px; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 9px 14px; color: var(--text-3); }
.appbar-search input { border: none; background: none; outline: none; flex: 1; font-size: 13px; color: var(--text); font-family: inherit; }
.appbar-right { display: flex; align-items: center; gap: 10px; }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 15px; color: var(--text-2); transition: all 0.15s; }
.icon-btn:hover { background: var(--brand-50); color: var(--brand); border-color: var(--brand-100); }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; background: var(--red); border-radius: 50%; border: 2px solid var(--surface); }
.theme-toggle { width: auto; gap: 8px; padding: 0 14px; font-size: 12px; font-weight: 600; }
.user-chip { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 5px 12px 5px 6px; }
.user-chip:hover { border-color: var(--brand-100); }
.user-name { font-size: 12px; font-weight: 700; color: var(--text); }
.user-mail { font-size: 10px; color: var(--text-2); }
.avatar-sm { width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), #8b5cf6); display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; font-weight: 700; flex-shrink: 0; }

/* --- Page head (per-view title bar) ---------------------------------- */
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 6px 26px 0; background: transparent; }
.topbar-left h1 { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; }
.topbar-left p { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.notif-btn { display: none; } /* superseded by global appbar */

.content { padding: 20px 26px 26px; flex: 1; }

/* --- Buttons ---------------------------------------------------------- */
.btn { padding: 9px 16px; border-radius: var(--r-btn); border: none; cursor: pointer; font-size: 12px; font-weight: 700; transition: all 0.15s; display: inline-flex; align-items: center; gap: 6px; font-family: inherit; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 18px rgba(93,95,239,0.28); }
.btn-primary:hover { background: var(--brand-600); }
.btn-outline { background: var(--surface); color: var(--text-2); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--brand-50); color: var(--brand); border-color: var(--brand-100); }
.btn-danger { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #fff; }

/* --- Page tabs -------------------------------------------------------- */
.page-tabs { display: flex; gap: 6px; padding: 8px 26px 0; }
.tab { padding: 9px 16px; cursor: pointer; font-size: 13px; color: var(--text-2); border-radius: 10px; font-weight: 600; transition: all 0.15s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); background: var(--brand-50); font-weight: 700; }

/* --- Cards ------------------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-sm); }
.card-header { padding: 18px 20px 14px; display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 14px; font-weight: 700; color: var(--text); letter-spacing: -0.2px; }
.card-body { padding: 0 20px 20px; }

/* --- Stat cards ------------------------------------------------------- */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 18px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 20px; box-shadow: var(--shadow-sm); transition: transform 0.15s, box-shadow 0.15s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 10px; letter-spacing: 0; text-transform: none; }
.stat-icon { float: right; width: 42px; height: 42px; margin-top: -4px; background: var(--brand-50); border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; opacity: 1; }
.stat-value { font-size: 30px; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 10px; letter-spacing: -1px; }
.stat-change { font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; gap: 3px; padding: 3px 9px; border-radius: 999px; }
.stat-change.up { color: var(--green); background: var(--green-bg); }
.stat-change.down { color: var(--red); background: var(--red-bg); }
.stat-change.neutral { color: var(--text-2); background: var(--surface-2); }

/* --- Grids ------------------------------------------------------------ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.col-span-2 { grid-column: span 2; }
.mb-16 { margin-bottom: 18px; }

/* --- Progress --------------------------------------------------------- */
.progress-row { display: flex; align-items: center; gap: 12px; margin-bottom: 13px; }
.progress-label { font-size: 12px; color: var(--text-2); min-width: 120px; font-weight: 600; }
.progress-bar-wrap { flex: 1; background: var(--surface-2); border-radius: 999px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; background: var(--brand); transition: width 0.5s ease; }
.progress-value { font-size: 12px; font-weight: 700; color: var(--text); min-width: 48px; text-align: right; }

/* --- Growth ring ------------------------------------------------------ */
.growth-ring-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.growth-ring { position: relative; width: 130px; height: 130px; }
.growth-ring svg { transform: rotate(-90deg); }
.growth-ring-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.growth-score-big { font-size: 32px; font-weight: 800; color: var(--text); line-height: 1; }
.growth-grade { font-size: 12px; font-weight: 700; color: var(--green); }

/* --- Badges ----------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 11px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-green { background: var(--green-bg); color: #15803d; }
.badge-amber { background: var(--amber-bg); color: #b45309; }
.badge-red { background: var(--red-bg); color: #b91c1c; }
.badge-blue { background: var(--blue-bg); color: #1d4ed8; }
.badge-purple { background: #ede9fe; color: #6d28d9; }
.badge-gray { background: var(--surface-2); color: var(--text-2); }

/* --- Table ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; padding: 0 8px 8px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
thead tr { background: transparent; }
th { padding: 12px 14px; text-align: left; font-size: 11px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.4px; }
td { padding: 13px 14px; border-top: 1px solid var(--border-2); font-size: 12.5px; color: var(--text); }
tbody tr { transition: background 0.12s; }
tbody tr:hover td { background: var(--brand-50); }
tbody tr:hover td:first-child { border-radius: 10px 0 0 10px; }
tbody tr:hover td:last-child { border-radius: 0 10px 10px 0; }

.avatar { width: 34px; height: 34px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0; }
.employee-cell { display: flex; align-items: center; gap: 11px; }

/* --- AI card ---------------------------------------------------------- */
.ai-card { background: linear-gradient(135deg, var(--brand-50) 0%, #f0fdf6 100%); border: 1px solid var(--brand-100); border-radius: var(--r-card); padding: 22px; }
:root[data-theme="dark"] .ai-card { background: linear-gradient(135deg, #23233a 0%, #1a2b24 100%); }
.ai-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.ai-icon { font-size: 24px; }
.ai-header h3 { font-size: 14px; font-weight: 800; color: var(--text); }
.ai-header p { font-size: 11px; color: var(--text-2); }

/* --- Funnel ----------------------------------------------------------- */
.funnel-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 9px; }
.funnel-label { font-size: 12px; color: var(--text-2); min-width: 90px; font-weight: 600; }
.funnel-vis { height: 24px; border-radius: 8px; background: var(--brand); min-width: 24px; display: flex; align-items: center; padding: 0 10px; }
.funnel-count { font-size: 11px; color: #fff; font-weight: 700; }
.funnel-num { font-size: 12px; color: var(--text-2); min-width: 30px; font-weight: 600; }

/* --- Risk rows -------------------------------------------------------- */
.risk-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.risk-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.risk-info { flex: 1; }
.risk-name { font-size: 12px; font-weight: 700; color: var(--text); }
.risk-reason { font-size: 11px; color: var(--text-2); }
.risk-score { font-size: 11px; font-weight: 700; }

/* --- Timeline --------------------------------------------------------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 8px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; margin-bottom: 18px; }
.tl-dot { position: absolute; left: -18px; top: 2px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); }
.tl-dot.done { background: var(--green); }
.tl-dot.active { background: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); }
.tl-dot.pending { background: var(--border); }
.tl-title { font-size: 12px; font-weight: 700; color: var(--text); }
.tl-sub { font-size: 11px; color: var(--text-2); }

/* --- Dimension rows --------------------------------------------------- */
.dim-row { display: flex; align-items: center; gap: 12px; margin-bottom: 11px; }
.dim-icon { font-size: 16px; width: 22px; text-align: center; }
.dim-label { font-size: 12px; color: var(--text-2); min-width: 130px; font-weight: 600; }
.dim-bar-wrap { flex: 1; background: var(--surface-2); border-radius: 999px; height: 10px; overflow: hidden; }
.dim-bar { height: 100%; border-radius: 999px; }
.dim-score { font-size: 12px; font-weight: 700; color: var(--text); min-width: 34px; text-align: right; }
.dim-weight { font-size: 10px; color: var(--text-3); min-width: 34px; text-align: right; font-weight: 600; }

/* --- Kanban ----------------------------------------------------------- */
.kanban-cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kanban-col { background: var(--surface-2); border-radius: 14px; padding: 14px; min-height: 120px; }
.kanban-col-header { font-size: 11px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 12px; display: flex; justify-content: space-between; }
.kanban-col-count { background: var(--surface); border-radius: 999px; padding: 1px 8px; font-size: 10px; color: var(--text-2); }
.candidate-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 9px; cursor: grab; transition: all 0.15s; box-shadow: var(--shadow-sm); }
.candidate-card:hover { border-color: var(--brand-100); box-shadow: var(--shadow); }
.candidate-card.dragging { opacity: 0.5; }
.candidate-name { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.candidate-meta { font-size: 11px; color: var(--text-2); margin-bottom: 8px; }
.candidate-footer { display: flex; align-items: center; justify-content: space-between; }
.ai-tier-a { background: var(--green-bg); color: #15803d; font-size: 10px; padding: 2px 7px; border-radius: 6px; font-weight: 700; }
.ai-tier-b { background: var(--amber-bg); color: #b45309; font-size: 10px; padding: 2px 7px; border-radius: 6px; font-weight: 700; }
.ai-tier-c { background: var(--surface-2); color: var(--text-2); font-size: 10px; padding: 2px 7px; border-radius: 6px; font-weight: 700; }
.kanban-col.drop-target { outline: 2px dashed var(--brand); outline-offset: -2px; }

/* --- Forms ------------------------------------------------------------ */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  font-size: 13px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
label { font-size: 11px; font-weight: 700; color: var(--text-2); display: block; margin-bottom: 6px; }
.grade-pill { width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; color: #fff; }
.section-title { font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 14px; text-transform: uppercase; letter-spacing: 0.4px; }
.muted { color: var(--text-2); }

/* --- Flash ------------------------------------------------------------ */
.flash { margin: 14px 26px -4px; padding: 13px 16px; border-radius: 12px; font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; box-shadow: var(--shadow-sm); }
.flash-success { background: var(--green-bg); color: #15803d; }
.flash-error { background: var(--red-bg); color: #b91c1c; }
.flash-x { cursor: pointer; font-size: 18px; line-height: 1; opacity: 0.6; margin-left: 12px; }
.flash-x:hover { opacity: 1; }

/* --- Modal ------------------------------------------------------------ */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(20, 18, 45, 0.45); backdrop-filter: blur(3px); z-index: 100; align-items: flex-start; justify-content: center; padding: 48px 16px; overflow-y: auto; }
.modal-overlay.open { display: flex; }
.modal { display: none; background: var(--surface); border-radius: var(--r-lg); width: 100%; max-width: 540px; box-shadow: var(--shadow-pop); }
.modal.open { display: block; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; font-weight: 800; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-3); line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.form-row { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row input, .form-row select, .form-row textarea { width: 100%; }
.form-row.full { grid-column: 1 / -1; }

/* --- Login ------------------------------------------------------------ */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #4b4de0 0%, #8b5cf6 100%); padding: 20px; }
.login-card { background: var(--surface); border-radius: 24px; padding: 40px; width: 400px; box-shadow: var(--shadow-pop); }
.login-logo { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.login-card h2 { font-size: 22px; font-weight: 800; margin-bottom: 4px; letter-spacing: -0.5px; }
.login-card .muted { font-size: 13px; margin-bottom: 26px; }
.login-card .field { margin-bottom: 16px; }
.login-card input { width: 100%; padding: 12px 14px; }
.login-error { background: var(--red-bg); color: #b91c1c; padding: 11px 14px; border-radius: 12px; font-size: 12px; margin-bottom: 16px; }
.login-hint { margin-top: 20px; font-size: 11px; color: var(--text-3); text-align: center; line-height: 1.5; }

/* --- Responsive ------------------------------------------------------- */
@media (max-width: 1100px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kanban-cols { grid-template-columns: repeat(2, 1fr); }
  .appbar-search { flex-basis: 200px; }
  .user-mail { display: none; }
}
@media (max-width: 720px) {
  .app { margin: 0; border-radius: 0; height: 100vh; }
  .sidebar { position: fixed; z-index: 50; height: 100%; transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: none; }
}
