/* HR System shared styles */
:root {
  --bg: #f4f6fa; --card: #ffffff; --text: #1f2937; --muted: #6b7280; --border: #e5e7eb;
  --primary: #3b5bdb; --primary-dark: #2f4ac0; --danger: #dc2626; --success: #16a34a; --warn: #d97706;
  --radius: 10px; --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 12px; font-weight: 600; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }

/* Cards & layout */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi .v { font-size: 26px; font-weight: 700; color: var(--primary); }
.kpi .l { font-size: 12px; color: var(--muted); }

/* Forms */
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
label .req { color: var(--danger); }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font: inherit; color: var(--text); background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c7d2fe; border-color: var(--primary); }
textarea { min-height: 80px; resize: vertical; }
input[type=checkbox] { width: auto; margin-right: 6px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; font-weight: 400; color: var(--text); text-transform: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.help { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: #fff; color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f3f4f6; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }
.btn.success { color: var(--success); border-color: #bbf7d0; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; padding: 0; font: inherit; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafafa; white-space: nowrap; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f5f7ff; }
td.actions { white-space: nowrap; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #e5e7eb; color: #374151; }
.b-OPEN, .b-ACTIVE, .b-HIRED, .b-PASS, .b-PASSED, .b-SENT, .b-ACCEPTED { background: #dcfce7; color: #166534; }
.b-NEW, .b-SCHEDULED, .b-PROBATION { background: #dbeafe; color: #1e40af; }
.b-SCREENING, .b-INTERVIEW, .b-HOLD, .b-PENDING, .b-RESIGNING, .b-DRAFT { background: #fef3c7; color: #92400e; }
.b-OFFERED { background: #ede9fe; color: #5b21b6; }
.b-REJECTED, .b-FAIL, .b-FAILED, .b-CANCELLED, .b-TERMINATED, .b-DECLINED { background: #fee2e2; color: #991b1b; }
.b-CLOSED, .b-RESIGNED, .b-WITHDRAWN { background: #e5e7eb; color: #4b5563; }

/* App shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #1e293b; color: #cbd5e1; padding: 18px 12px; flex-shrink: 0; }
.sidebar .brand { color: #fff; font-weight: 700; font-size: 16px; padding: 4px 10px 16px; }
.sidebar .brand small { display: block; color: #94a3b8; font-weight: 400; font-size: 11px; }
.nav a { display: block; padding: 9px 12px; border-radius: 8px; color: #cbd5e1; margin-bottom: 2px; }
.nav a:hover { background: #334155; text-decoration: none; }
.nav a.active { background: var(--primary); color: #fff; }
.sidebar .user { margin-top: 24px; padding: 10px 12px; border-top: 1px solid #334155; font-size: 12px; }
.main { flex: 1; padding: 22px 26px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; padding: 10px; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .sidebar .user { display: none; }
  .main { padding: 14px; }
}

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { background: none; border: none; padding: 8px 14px; font: inherit; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* Detail grid */
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; font-size: 13px; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; word-break: break-word; }

/* Funnel */
.funnel .bar { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 12px; }
.funnel .bar span:first-child { width: 90px; color: var(--muted); }
.funnel .bar i { display: block; height: 14px; background: var(--primary); border-radius: 4px; min-width: 2px; }

/* Checklist */
.checklist label { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--text); text-transform: none; font-size: 13px; padding: 5px 0; border-bottom: 1px dashed var(--border); margin: 0; }
.checklist label.done { color: var(--muted); text-decoration: line-through; }

/* Modal */
#modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50; }
#modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
#modal.wide { max-width: 860px; }
#modal header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 600; }
#modal-body { padding: 8px 18px 18px; }
#modal footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.preview { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: #fafafa; max-height: 300px; overflow: auto; }

/* Toast & busy */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; z-index: 60; max-width: 90vw; }
#toast.err { background: var(--danger); } #toast.ok { background: var(--success); }
#busy { position: fixed; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--primary), #93c5fd, var(--primary)); background-size: 200% 100%; animation: slide 1s linear infinite; z-index: 70; }
@keyframes slide { from { background-position: 0 0; } to { background-position: 200% 0; } }

/* Login & public page */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login { width: 100%; max-width: 380px; }
.public { max-width: 820px; margin: 0 auto; padding: 24px 16px 60px; }
.public .hero { padding: 26px 0 10px; }
.public .hero h1 { font-size: 26px; }
.notice { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-size: 12px; color: var(--muted); max-height: 160px; overflow: auto; }
.stars button { background: none; border: none; font-size: 22px; cursor: pointer; color: #d1d5db; padding: 0 2px; }
.stars button.on { color: #f59e0b; }
