:root {
  --brand: #1d4f91;
  --brand-dark: #163e73;
  --brand-tint: #e8eff9;
  --bg: #ffffff;
  --canvas: #f7f8fa;
  --panel: #fbfbfc;
  --border: #e1e3e8;
  --border-strong: #c9ccd3;
  --text: #1d1f25;
  --text-2: #4c505a;
  --muted: #7a7f8a;
  --row-hover: #f5f7fb;
  --selected: #eaf1fd;
  --accent: #166ee1;
  --danger: #c4314b;
  --series: #2a78d6;
  --series-soft: #cde2fb;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .08);
  --radius: 6px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.boot { padding: 40px; color: var(--muted); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ---------- top bar + table tabs (Airtable-style base header) ---------- */
.shell { display: flex; flex-direction: column; height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: 10px;
  height: 48px; padding: 0 12px 0 14px;
  background: var(--brand); color: #fff;
}
.topbar .logo { width: 26px; height: 26px; border-radius: 6px; background: #fff; display: grid; place-items: center; }
.topbar .logo img { width: 26px; height: 26px; }
.topbar .base-name { font-weight: 650; font-size: 16px; letter-spacing: .1px; }
.topbar .spacer { flex: 1; }
.topbar .user-btn {
  display: flex; align-items: center; gap: 8px; border: 0; background: rgba(255,255,255,.12);
  color: #fff; padding: 4px 10px 4px 4px; border-radius: 999px;
}
.topbar .user-btn:hover { background: rgba(255,255,255,.2); }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center;
  background: #ffc94d; color: #3d2c00; font-weight: 700; font-size: 11px; flex: none;
}
.avatar.sm { width: 20px; height: 20px; font-size: 10px; }
.tabs {
  display: flex; align-items: flex-end; gap: 2px; padding: 0 10px;
  background: var(--brand-dark); height: 36px; overflow-x: auto; flex: none;
}
.tabs button {
  border: 0; background: transparent; color: rgba(255,255,255,.85);
  padding: 7px 14px; border-radius: 6px 6px 0 0; white-space: nowrap; font-weight: 500;
}
.tabs button:hover { background: rgba(255,255,255,.1); color: #fff; }
.tabs button.active { background: var(--bg); color: var(--text); font-weight: 600; }
.tabs .count { opacity: .7; font-weight: 400; margin-left: 4px; }

/* ---------- body: view sidebar + content ---------- */
.body { flex: 1; display: flex; min-height: 0; }
.views {
  width: 230px; flex: none; border-right: 1px solid var(--border); background: var(--panel);
  padding: 10px 8px; overflow-y: auto;
}
.views h4 { margin: 10px 8px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; }
.views button {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 6px 8px; border-radius: 6px; color: var(--text-2);
}
.views button:hover { background: #eef0f4; }
.views button.active { background: var(--selected); color: var(--text); font-weight: 600; }
.views .vicon { width: 16px; text-align: center; color: var(--muted); }
.views .vcount { margin-left: auto; font-size: 11px; color: var(--muted); }
.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.toolbar {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 6px 10px; border-bottom: 1px solid var(--border); min-height: 44px;
}
.toolbar .view-title { font-weight: 650; font-size: 14px; margin-right: 8px; display: flex; align-items: center; gap: 6px; }
.tbtn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent;
  padding: 5px 9px; border-radius: 6px; color: var(--text-2); white-space: nowrap;
}
.tbtn:hover { background: #eef0f4; }
.tbtn.on { background: #e3f3e8; color: #0d5d2a; }
.tbtn.on.group { background: #efe6fd; color: #4b2a8c; }
.tbtn.on.sort { background: #fdeee0; color: #8a4300; }
.toolbar .spacer { flex: 1; }
.search {
  border: 1px solid var(--border); border-radius: 6px; padding: 5px 9px; width: 200px; background: #fff;
}
.search:focus, .input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid #9cc1f5; outline-offset: -1px; border-color: #6ea2ea;
}
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); background: #fff;
  padding: 6px 12px; border-radius: 6px; font-weight: 500; white-space: nowrap;
}
.btn:hover { background: #f4f5f7; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #105bc0; }
.btn.danger { color: var(--danger); border-color: #efc2cb; }
.btn.danger:hover { background: #fdf0f2; }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: default; }
.content-scroll { flex: 1; overflow: auto; position: relative; background: var(--bg); }
.footer-bar { border-top: 1px solid var(--border); padding: 5px 12px; font-size: 12px; color: var(--muted); background: var(--panel); }

/* ---------- grid ---------- */
table.grid { border-collapse: separate; border-spacing: 0; width: max-content; table-layout: fixed; }
.grid th, .grid td {
  height: 33px; padding: 0 9px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; vertical-align: middle; background: var(--bg);
}
.grid thead th {
  position: sticky; top: 0; z-index: 3; background: #f4f5f7; font-weight: 500; color: var(--text-2); height: 32px;
  cursor: pointer; user-select: none;
}
.grid thead th:hover { background: #eceef2; }
.grid th .ficon { color: var(--muted); margin-right: 6px; font-size: 11px; display: inline-block; width: 12px; text-align: center; }
.grid th .sorted { color: #8a4300; margin-left: 4px; }
.grid .rownum { width: 52px; color: var(--muted); text-align: center; font-size: 11.5px; position: sticky; left: 0; z-index: 2; }
.grid thead .rownum { z-index: 4; }
.grid .primary { position: sticky; left: 52px; z-index: 2; font-weight: 500; border-right: 2px solid var(--border-strong); }
.grid thead .primary { z-index: 4; }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover td { background: var(--row-hover); }
.grid tbody tr .expand { display: none; color: var(--accent); font-size: 12px; }
.grid tbody tr:hover .expand { display: inline; }
.grid tbody tr:hover .num { display: none; }
.grid tr.group-row td {
  background: #f0f2f6; font-weight: 600; cursor: pointer; height: 36px; position: sticky; left: 0;
}
.grid tr.group-row:hover td { background: #e8ebf1; }
.grid tr.group-row .gcount { color: var(--muted); font-weight: 400; margin-left: 8px; }
.grid tr.add-row td { color: var(--muted); }
.grid tr.add-row:hover td { color: var(--accent); }
.grid td.wrap { white-space: normal; }
.empty { padding: 50px 20px; text-align: center; color: var(--muted); }
.empty b { color: var(--text-2); display: block; font-size: 15px; margin-bottom: 4px; }

/* pills (single select / status) */
.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 999px; font-size: 12px;
  line-height: 19px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  background: #eceef1; color: #3c3f46;
}
.pill.clickable { cursor: pointer; }
.pill.clickable:hover { filter: brightness(.96); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.pill.flag { background: #fff1d6; color: #6b4a00; }
.pills { display: flex; gap: 4px; overflow: hidden; }
.s-needs-info { background: #ffeab6; color: #5f4100; }
.s-resume-screening { background: #cfdfff; color: #102e6b; }
.s-pre-recruitment-test { background: #d0f0fd; color: #0b4558; }
.s-initial-interview { background: #c2f5e9; color: #0a4a3c; }
.s-final-interview { background: #d1f7c4; color: #20491a; }
.s-job-offer { background: #ede2fe; color: #3d1a78; }
.s-hired { background: #138a3e; color: #fff; }
.s-rejected { background: #ffdce5; color: #7a1029; }
.s-withdrawn { background: #e5e7eb; color: #40434a; }
.p-open { background: #d1f7c4; color: #20491a; }
.p-planned { background: #cfdfff; color: #102e6b; }
.p-on-hold { background: #ffeab6; color: #5f4100; }
.p-closed { background: #e5e7eb; color: #40434a; }
.r-applicant { background: #d1f7c4; color: #20491a; }
.r-needs_info { background: #ffeab6; color: #5f4100; }
.r-follow_up { background: #cfdfff; color: #102e6b; }
.r-ignored, .r-deleted { background: #e5e7eb; color: #40434a; }
.stars { color: #f5a623; letter-spacing: 1px; }
.stars .off { color: #d6d8dd; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }

/* ---------- kanban ---------- */
.board { display: flex; gap: 10px; padding: 12px; height: 100%; align-items: flex-start; min-width: max-content; background: var(--canvas); }
.lane { width: 264px; flex: none; background: #eef0f4; border-radius: 8px; display: flex; flex-direction: column; max-height: 100%; }
.lane-head { display: flex; align-items: center; gap: 6px; padding: 9px 10px 6px; font-weight: 600; }
.lane-head .lcount { color: var(--muted); font-weight: 400; }
.lane-body { padding: 4px 8px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.lane.drop .lane-body { background: #dfe8f7; border-radius: 0 0 8px 8px; }
.card {
  background: #fff; border-radius: 7px; padding: 9px 10px; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.04);
  cursor: pointer;
}
.card:hover { box-shadow: 0 2px 6px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.06); }
.card.dragging { opacity: .5; }
.card .ct { font-weight: 600; margin-bottom: 6px; }
.card .crow { display: flex; gap: 6px; align-items: center; color: var(--text-2); font-size: 12px; margin-top: 3px; min-width: 0; }
.card .crow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .clabel { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; margin-top: 6px; }

/* ---------- popovers / menus ---------- */
.popover {
  position: fixed; z-index: 50; background: #fff; border-radius: 8px; box-shadow: var(--shadow), 0 0 0 1px rgba(0,0,0,.06);
  padding: 10px; min-width: 220px; max-width: 420px; max-height: 70vh; overflow: auto;
}
.popover h5 { margin: 4px 2px 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.popover .row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.popover label.check { display: flex; align-items: center; gap: 8px; padding: 4px 4px; border-radius: 5px; cursor: pointer; }
.popover label.check:hover { background: #f4f5f7; }
.menu button {
  display: flex; width: 100%; align-items: center; gap: 8px; border: 0; background: transparent; padding: 6px 8px;
  border-radius: 5px; text-align: left;
}
.menu button:hover { background: #f1f3f6; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.input, .popover select, .popover input[type=date] {
  border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; background: #fff; min-width: 0;
}

/* ---------- expanded record (modal) ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(20, 24, 33, .45); z-index: 40;
  display: flex; align-items: flex-start; justify-content: center; padding: 32px 16px; overflow-y: auto;
}
.record {
  background: #fff; border-radius: 10px; width: min(1080px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.25);
  display: flex; flex-direction: column; max-height: calc(100vh - 64px);
}
.record.narrow { width: min(520px, 100%); }
.record-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.record-head h2 { margin: 0; font-size: 18px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iconbtn { border: 0; background: transparent; width: 30px; height: 30px; border-radius: 6px; color: var(--text-2); font-size: 16px; }
.iconbtn:hover { background: #eef0f4; }
.record-body { display: flex; min-height: 0; flex: 1; }
.record-main { flex: 1; overflow-y: auto; padding: 18px 22px 28px; background: var(--canvas); min-width: 0; }
.record-side { width: 340px; flex: none; border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.field { margin-bottom: 16px; }
.field > label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); margin-bottom: 5px; font-weight: 500; }
.field > label .ficon { color: var(--muted); font-size: 11px; width: 12px; text-align: center; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 6px; padding: 7px 9px; background: #fff;
}
.field textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
.field .help { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.field .ro { padding: 7px 0; color: var(--text); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; margin: 6px 0 10px; }
.star-input button { border: 0; background: transparent; font-size: 18px; padding: 0 2px; color: #d6d8dd; }
.star-input button.on { color: #f5a623; }
.files { display: flex; flex-wrap: wrap; gap: 8px; }
.file-card {
  display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--border); border-radius: 7px;
  padding: 6px 8px 6px 6px; max-width: 280px;
}
.file-card .ftype {
  width: 32px; height: 38px; border-radius: 4px; background: #e9eef7; color: #1d4f91; font-size: 9px; font-weight: 700;
  display: grid; place-items: center; flex: none;
}
.file-card .ftype.pdf { background: #fde3e3; color: #a3191f; }
.file-card .ftype.img { background: #e3f5e6; color: #1b6b2a; }
.file-card .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.file-card .fsize { font-size: 11px; color: var(--muted); }
.upload-label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.email-body {
  white-space: pre-wrap; background: #fff; border: 1px solid var(--border); border-radius: 7px; padding: 10px 12px;
  max-height: 260px; overflow: auto; font-size: 12.5px; color: var(--text-2);
}
.side-tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 10px; }
.side-tabs span { padding: 10px 6px; font-weight: 600; border-bottom: 2px solid var(--text); }
.activity { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.act { display: flex; gap: 8px; font-size: 12.5px; }
.act .meta { color: var(--muted); font-size: 11px; }
.act.comment .bubble { background: #f1f4f9; border-radius: 8px; padding: 7px 10px; margin-top: 3px; white-space: pre-wrap; }
.act .sysdot { width: 20px; height: 20px; border-radius: 50%; background: #eef0f4; display: grid; place-items: center; font-size: 10px; flex: none; color: var(--muted); }
.comment-box { border-top: 1px solid var(--border); padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.comment-box textarea { width: 100%; border: 1px solid var(--border); border-radius: 6px; padding: 7px 9px; min-height: 56px; resize: vertical; }
.record-foot { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.notice { background: #fff6dd; border: 1px solid #f3dc9b; color: #5f4100; border-radius: 7px; padding: 8px 10px; margin-bottom: 14px; font-size: 12.5px; }

/* ---------- dashboard (interface page) ---------- */
.dash { background: var(--canvas); min-height: 100%; padding: 20px 24px 40px; }
.dash-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.dash-head h1 { font-size: 20px; margin: 0; flex: 1; min-width: 200px; }
.dash-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; background: #e8eaef; border-radius: 7px; padding: 2px; }
.seg button { border: 0; background: transparent; padding: 4px 10px; border-radius: 5px; color: var(--text-2); }
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.1); font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.tile, .panel {
  background: #fff; border-radius: 10px; border: 1px solid var(--border); padding: 14px 16px;
}
.tile { cursor: pointer; }
.tile:hover { border-color: var(--border-strong); }
.tile .tl { font-size: 12px; color: var(--text-2); font-weight: 500; }
.tile .tv { font-size: 30px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .ts { font-size: 11.5px; color: var(--muted); }
.panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.panel h3 { margin: 0 0 2px; font-size: 14px; }
.panel .sub { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.panel.wide { grid-column: 1 / -1; }
.hbar { display: grid; grid-template-columns: 150px 1fr 40px; align-items: center; gap: 10px; height: 28px; cursor: pointer; border-radius: 5px; padding: 0 4px; }
.hbar:hover { background: #f4f6fa; }
.hbar .lbl { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 16px; position: relative; }
.hbar .bar { height: 16px; background: var(--series); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .val { font-size: 12.5px; font-variant-numeric: tabular-nums; text-align: right; color: var(--text); }
.cols { position: relative; height: 200px; display: flex; align-items: flex-end; gap: 2px; padding: 0 0 0 28px; border-bottom: 1px solid var(--border-strong); }
.cols .gridline { position: absolute; left: 28px; right: 0; border-top: 1px dashed #e6e8ec; }
.cols .gridline span { position: absolute; left: -28px; top: -8px; font-size: 10.5px; color: var(--muted); width: 24px; text-align: right; }
.cols .col { flex: 1; display: flex; justify-content: center; align-items: flex-end; height: 100%; position: relative; cursor: default; }
.cols .col .cbar { width: 70%; max-width: 34px; background: var(--series); border-radius: 4px 4px 0 0; min-height: 0; }
.cols .col:hover .cbar { background: #1c5cab; }
.col-labels { display: flex; gap: 2px; padding-left: 28px; margin-top: 4px; }
.col-labels span { flex: 1; text-align: center; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.tip {
  position: fixed; z-index: 60; pointer-events: none; background: #1d1f25; color: #fff; font-size: 12px; padding: 6px 9px;
  border-radius: 6px; box-shadow: var(--shadow); white-space: nowrap;
}
.tip b { font-variant-numeric: tabular-nums; }
table.mini { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mini th { text-align: left; font-weight: 500; color: var(--muted); font-size: 11.5px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.mini td { padding: 7px 8px; border-bottom: 1px solid #eef0f3; }
.mini td.n, .mini th.n { text-align: right; font-variant-numeric: tabular-nums; }
.mini tbody tr { cursor: pointer; }
.mini tbody tr:hover td { background: #f6f8fb; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #1d4f91 0%, #163e73 55%, #0f2d55 100%); padding: 16px; }
.login {
  background: #fff; border-radius: 12px; padding: 28px; width: min(380px, 100%); box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.login h1 { font-size: 20px; margin: 10px 0 4px; }
.login p { color: var(--muted); margin: 0 0 18px; }
.login .btn { width: 100%; justify-content: center; padding: 9px; margin-top: 4px; }
.err { color: var(--danger); font-size: 12.5px; min-height: 18px; margin-top: 6px; }

/* ---------- toasts ---------- */
#toast-root { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #1d1f25; color: #fff; padding: 9px 14px; border-radius: 8px; box-shadow: var(--shadow); font-size: 13px; }
.toast.error { background: var(--danger); }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .views { display: none; }
  .views.mobile-open { display: block; position: fixed; top: 84px; bottom: 0; left: 0; z-index: 30; box-shadow: var(--shadow); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panels { grid-template-columns: minmax(0, 1fr); }
  .record-body { flex-direction: column; overflow-y: auto; }
  .record-main { overflow: visible; }
  .record-side { width: auto; border-left: 0; border-top: 1px solid var(--border); }
  .field-grid { grid-template-columns: 1fr; }
  .overlay { padding: 0; }
  .record { max-height: none; min-height: 100vh; border-radius: 0; }
  .search { width: 140px; }
  .dash { padding: 16px; }
  .hbar { grid-template-columns: 110px 1fr 34px; }
}
@media (min-width: 861px) { .only-mobile { display: none !important; } }
