:root {
  --ink: #15233b;
  --ink-soft: #3a4a63;
  --muted: #6b7686;
  --line: #e4e7ec;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --primary: #1f3a8a;
  --primary-700: #16306f;
  --accent: #0f766e;
  --danger: #b42318;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.04);
  --font-display: "Sora", system-ui, sans-serif;
  --font-body: "Public Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}
h1, h2, h3, strong, .strong { font-family: var(--font-display); }
h1 { font-size: 1.4rem; margin: 0; font-weight: 700; }
h3 { font-size: .98rem; margin: 0 0 .6rem; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.danger { color: var(--danger); }
.link { color: var(--primary); text-decoration: none; font-weight: 600; }
.link:hover { text-decoration: underline; }
.spacer { flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-body); font-size: .85rem; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  padding: .5rem .8rem; border-radius: 8px; cursor: pointer; transition: .15s;
}
.btn:hover { border-color: #c9cfd8; background: #fbfcfd; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-700); border-color: var(--primary-700); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--block { width: 100%; padding: .65rem; font-size: .95rem; }
.icon-btn {
  border: none; background: transparent; cursor: pointer; font-size: 1rem;
  padding: .25rem .4rem; border-radius: 6px; color: var(--ink-soft);
}
.icon-btn:hover { background: #eef1f5; }
.icon-btn.danger { color: var(--danger); }
.badge {
  background: #eef2ff; color: var(--primary); font-size: .72rem; font-weight: 600;
  padding: .15rem .5rem; border-radius: 999px;
}

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(1200px 500px at 50% -10%, #eaf0ff 0%, var(--bg) 60%);
  padding: 1rem;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; padding: 2rem;
  box-shadow: 0 10px 40px rgba(21,35,59,.08);
}
.brand { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.5rem; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--primary); color: #fff; font-family: var(--font-display); font-weight: 700;
}
.brand-mark.sm { width: 30px; height: 30px; border-radius: 8px; font-size: .8rem; }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: .9rem; }
.field > span { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .3rem; }
input, select, textarea {
  width: 100%; font-family: var(--font-body); font-size: .9rem; color: var(--ink);
  padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #c7d2fe; border-color: var(--primary); }

/* ---------- Topbar / tabs ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1.2rem; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: .6rem; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.who { display: flex; align-items: center; gap: .5rem; }
.tabs { display: flex; gap: .25rem; padding: 0 1.2rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.tab {
  border: none; background: none; font-family: var(--font-display); font-weight: 600;
  font-size: .9rem; color: var(--muted); padding: .8rem 1rem; cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.container { max-width: 1200px; margin: 0 auto; padding: 1.2rem; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.toolbar select, .toolbar input { width: auto; min-width: 140px; }
.toolbar #f-search { min-width: 220px; flex: 1 1 220px; }

/* ---------- Table ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow); }
.data-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.data-table thead th {
  position: sticky; top: 0; background: #f8fafc; text-align: left; font-weight: 600;
  color: var(--ink-soft); padding: .6rem .7rem; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.data-table td { padding: .55rem .7rem; border-bottom: 1px solid #f0f2f5; vertical-align: top; }
.data-table tbody tr:hover { background: #fafbfc; }
.actions { white-space: nowrap; text-align: right; }
.cell-select { width: auto; min-width: 120px; padding: .3rem .4rem; font-size: .8rem; font-weight: 600; border-radius: 6px; }
.status-placed { color: #15803d; } .status-unplaced { color: #b91c1c; }
.status-internship { color: #b45309; } .status-higher_studies { color: #1d4ed8; }
.status-entrepreneur { color: #7c3aed; } .status-backlog { color: #c2410c; }
.status-not_reachable { color: #475569; }

/* ---------- Cards / charts ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; box-shadow: var(--shadow); }
.stat-k { font-size: .75rem; color: var(--muted); font-weight: 600; }
.stat-v { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; margin-top: .2rem; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.chart-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); min-height: 260px; }
.chart-box--wide { grid-column: 1 / -1; }
.chart-box canvas { max-height: 280px; }

/* ---------- Admin ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .8rem; }
.inline-form input, .inline-form select { width: auto; min-width: 130px; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; background: #f1f4f9; border: 1px solid var(--line); border-radius: 999px; padding: .25rem .7rem; font-size: .82rem; font-weight: 600; }
.chip-x { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 1rem; line-height: 1; }
.chip-x:hover { color: var(--danger); }
.user-list { display: flex; flex-direction: column; gap: .5rem; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 8px; }
.user-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.user-actions select { width: auto; min-width: 120px; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(16,24,40,.45); display: grid; place-items: center; z-index: 50; padding: 1rem; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 460px; max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal--wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 1.2rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }

/* ---------- Toasts ---------- */
.toast-host { position: fixed; bottom: 1.2rem; right: 1.2rem; display: flex; flex-direction: column; gap: .5rem; z-index: 100; }
.toast { background: var(--ink); color: #fff; padding: .6rem .9rem; border-radius: 8px; font-size: .85rem; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: .25s; }
.toast--show { opacity: 1; transform: none; }
.toast--success { background: #15803d; } .toast--error { background: var(--danger); } .toast--info { background: var(--ink-soft); }

/* ---------- Footer ---------- */
.footer { text-align: center; padding: 1.5rem; }

[hidden] { display: none !important; }

/* Simplified home layout */
.home-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.scope { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.scope-label { font-family: var(--font-display); font-weight: 600; color: var(--ink); }
.sc-select { width: auto; min-width: 120px; padding: .4rem .55rem; }
.home-actions { display: flex; align-items: center; gap: .5rem; }
.home-actions #f-search { width: auto; min-width: 200px; }
.count-line { margin: .25rem 0 .75rem; }
.back { display: inline-block; background: none; border: none; cursor: pointer; padding: 0; margin-bottom: .75rem; font-size: .9rem; }

/* "More" dropdown */
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(16,24,40,.12); padding: .35rem; min-width: 180px; z-index: 30; display: flex; flex-direction: column; }
.menu-pop button { text-align: left; background: none; border: none; padding: .55rem .7rem; border-radius: 7px; cursor: pointer; font: inherit; color: var(--ink-soft); }
.menu-pop button:hover { background: #f1f4f9; color: var(--ink); }

.success { color: #15803d; }
.bulk-errs { margin: .5rem 0 0; padding-left: 1.1rem; color: var(--danger); }
.bulk-errs li { margin: .1rem 0; }
#bk-report { margin-top: .5rem; }

@media (max-width: 720px) {
  .home-head { flex-direction: column; align-items: stretch; }
  .home-actions { flex-wrap: wrap; }
  .home-actions #f-search { flex: 1 1 100%; }
}

@media (max-width: 720px) {
  .charts { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar-right .who { display: none; }
}
