* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f4f6fa;
  color: #111827;
  font-size: 14px;
}
.topbar {
  background: #fff; border-bottom: 1px solid #e5e7eb;
  padding: 14px 24px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, #0a66c2, #1e88e5);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px;
}
.brand-name { font-weight: 700; font-size: 16px; }
.brand-sub { font-size: 11px; color: #6b7280; }
.tabs { display: flex; gap: 4px; }
.tab {
  border: 0; background: transparent; padding: 8px 14px; border-radius: 8px;
  cursor: pointer; color: #4b5563; font-weight: 500;
}
.tab:hover { background: #f3f4f6; }
.tab.active { background: #0a66c2; color: #fff; }

main { padding: 24px; max-width: 1280px; margin: 0 auto; }

.view.hidden { display: none; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 16px; margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 14px; font-weight: 600; color: #111827; }
.stat .stat-label { font-size: 11px; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; }
.stat .stat-value { font-size: 28px; font-weight: 700; color: #0a66c2; margin-top: 4px; }

.t { width: 100%; border-collapse: collapse; }
.t th, .t td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #f3f4f6; font-size: 13px; }
.t th { font-weight: 600; color: #6b7280; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.t tr:hover { background: #f9fafb; }
.t .actions-cell { text-align: right; }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar { display: grid; grid-template-columns: 120px 1fr 40px; align-items: center; gap: 10px; }
.bar-label { font-size: 12px; color: #4b5563; }
.bar-track { background: #f3f4f6; border-radius: 6px; height: 10px; overflow: hidden; }
.bar-fill { background: #0a66c2; height: 100%; }
.bar-count { font-size: 12px; color: #4b5563; text-align: right; }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.toolbar input, .toolbar select { padding: 8px 12px; border-radius: 8px; border: 1px solid #d1d5db; background: #fff; font-size: 13px; }
.toolbar input { flex: 1; }

.status-pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 500; text-transform: capitalize;
}
.status-saved { background: #e5e7eb; color: #4b5563; }
.status-applied { background: #dbeafe; color: #1e40af; }
.status-screening { background: #fef3c7; color: #92400e; }
.status-interview { background: #fde68a; color: #78350f; }
.status-offer { background: #d1fae5; color: #065f46; }
.status-rejected { background: #fee2e2; color: #991b1b; }
.status-withdrawn { background: #f3f4f6; color: #6b7280; }

.btn { padding: 8px 14px; border-radius: 8px; border: 1px solid #d1d5db; background: #fff; cursor: pointer; font-size: 13px; font-weight: 500; }
.btn:hover { background: #f3f4f6; }
.btn.primary { background: #0a66c2; color: #fff; border-color: #0a66c2; }
.btn.primary:hover { background: #084e95; }
.btn.danger { color: #b91c1c; }
.btn.danger:hover { background: #fee2e2; }
.btn.small { padding: 4px 10px; font-size: 12px; }

.kanban { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.kcol { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px; min-height: 200px; }
.kcol h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: #6b7280; display: flex; justify-content: space-between; }
.kcol h3 .n { background: #f3f4f6; color: #4b5563; padding: 0 6px; border-radius: 6px; }
.kitem {
  background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 10px; margin-bottom: 8px; cursor: pointer;
}
.kitem:hover { background: #f3f4f6; }
.kitem .kt { font-weight: 600; font-size: 13px; }
.kitem .kc { font-size: 11px; color: #6b7280; margin-top: 2px; }

#resume-name { width: 100%; padding: 8px 12px; border-radius: 8px; border: 1px solid #d1d5db; margin-bottom: 8px; font-size: 13px; }
#resume-content { width: 100%; padding: 12px; border-radius: 8px; border: 1px solid #d1d5db; font-family: ui-monospace, monospace; font-size: 12px; resize: vertical; }
.actions { margin-top: 10px; display: flex; gap: 8px; }
.row-between { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.hint { font-size: 12px; color: #6b7280; }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f3f4f6; font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv code { background: #f3f4f6; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.steps { margin: 0; padding-left: 20px; line-height: 1.8; }
.steps code { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: 12px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal.hidden { display: none; }
.modal-card { background: #fff; border-radius: 12px; max-width: 800px; width: 100%; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid #e5e7eb; display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { margin: 0; font-size: 16px; }
.modal-header .x { background: transparent; border: 0; font-size: 24px; cursor: pointer; color: #6b7280; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-body .field { margin-bottom: 14px; }
.modal-body label { display: block; font-size: 11px; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.modal-body .val { font-size: 13px; color: #111827; }
.modal-body textarea { width: 100%; padding: 10px; border-radius: 8px; border: 1px solid #d1d5db; font-family: ui-monospace, monospace; font-size: 12px; }
.modal-body pre { background: #f9fafb; padding: 12px; border-radius: 8px; border: 1px solid #e5e7eb; white-space: pre-wrap; font-size: 12px; max-height: 240px; overflow-y: auto; }

.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.field label { display: block; font-size: 11px; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 8px 10px; border-radius: 6px; border: 1px solid #d1d5db; background: #fff; font-size: 13px; box-sizing: border-box; }

.outcome-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.outcome-submitted { background: #d1fae5; color: #065f46; }
.outcome-ready_to_submit { background: #dbeafe; color: #1e40af; }
.outcome-halted_unknown { background: #fef3c7; color: #92400e; }
.outcome-no_easy_apply { background: #f3f4f6; color: #6b7280; }
.outcome-rate_limited { background: #fee2e2; color: #991b1b; }
.outcome-error { background: #fee2e2; color: #991b1b; }
.outcome-ended { background: #e5e7eb; color: #4b5563; }

/* ---------- Login (VPS mode) ---------- */
.account { display: flex; align-items: center; gap: 10px; font-size: 12px; color: #6b7280; }
.login {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(244, 246, 250, 0.96);
  display: grid; place-items: center; padding: 16px;
}
.login.hidden { display: none; }
.login-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 14px;
  padding: 28px; width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}
.login-card h2 { margin: 0; font-size: 18px; }
.login-card p { margin: 0; color: #4b5563; font-size: 13px; line-height: 1.5; }
.login-card input { padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; }
.login-error { color: #dc2626; font-size: 12px; min-height: 16px; }
.btn.hidden { display: none; }

/* ---------- SaaS additions ---------- */
.banner { border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; font-size: 14px; background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.banner.hidden { display: none; }
.banner a, .banner button { margin-left: 8px; }
.tab.hidden { display: none; }
.days { display: flex; flex-wrap: wrap; gap: 12px; padding: 6px 0; }
.days label { display: flex; align-items: center; gap: 4px; font-size: 13px; color: #374151; text-transform: none; letter-spacing: 0; }
.paygrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.paybox { border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.paybox h3 { margin: 0; font-size: 15px; }
.paybox.hidden { display: none; }
.qr { max-width: 220px; width: 100%; border-radius: 8px; border: 1px solid #e5e7eb; }
.qr:not([src]), .qr[src=""] { display: none; }
.src-pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #f3f4f6; color: #4b5563; white-space: nowrap; }
.src-pill.ai { background: #ede9fe; color: #5b21b6; }
.src-pill.review { background: #fef3c7; color: #92400e; }
.login-card a { color: #0a66c2; }
.tabs { flex-wrap: wrap; }
@media (max-width: 720px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 10px; padding: 12px 16px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; max-width: 100%; }
  main { padding: 16px; }
  .t { display: block; overflow-x: auto; }
}
