@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

:root {
  --bg:          #ffffff;
  --bg-subtle:   #f7f7f7;
  --bg-hover:    #f0f0f0;
  --ink:         #111111;
  --ink-soft:    #444444;
  --ink-muted:   #888888;
  --rule:        #e0e0e0;
  --rule-soft:   #eeeeee;
  --accent:      #111111;
  --green:       #1f6e1f;
  --green-soft:  #edf5ed;
  --amber:       #7a5500;
  --amber-soft:  #fdf6e3;
  --red:         #b00020;
  --red-soft:    #fdecea;
  --blue:        #1a56a0;
  --blue-soft:   #e8f0fb;
  --sans: 'Roboto', Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* --- Masthead --- */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.masthead-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--ink);
}
.brand-sub {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 2px;
  font-weight: 400;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* --- Buttons --- */

button {
  font-family: var(--sans);
  cursor: pointer;
  border: none;
  background: none;
}

.btn-primary, .btn-secondary {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
}
.btn-primary:hover { background: #333; border-color: #333; }
.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
}
.btn-secondary:hover { border-color: var(--ink); background: var(--bg-hover); }
.btn-secondary:disabled { opacity: 0.4; cursor: wait; }

/* --- Filter bar --- */

.filter-bar {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
}
.filter {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 400;
  padding: 14px 14px;
  color: var(--ink-muted);
  border-bottom: 2px solid transparent;
  transition: all 0.12s;
}
.filter:hover { color: var(--ink); }
.filter.active {
  color: var(--ink);
  font-weight: 500;
  border-bottom-color: var(--ink);
}
.spacer { flex: 1; }
.meta-text {
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 400;
}

/* --- Container --- */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px;
}

/* --- Job list --- */

.job-card {
  border-bottom: 1px solid var(--rule-soft);
  padding: 20px 12px;
  cursor: pointer;
  transition: background 0.12s;
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 20px;
  align-items: start;
  border-radius: 4px;
}
.job-card:hover { background: var(--bg-subtle); }
.job-card:first-child { border-top: 1px solid var(--rule-soft); }

.score-block {
  text-align: center;
  padding-top: 2px;
}
.score-number {
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.score-label {
  font-size: 10px;
  color: var(--ink-muted);
  font-weight: 400;
  margin-top: 2px;
}
.score-high .score-number { color: var(--green); font-weight: 500; }
.score-mid .score-number { color: var(--amber); }
.score-low .score-number { color: var(--ink-muted); }

.job-title {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 4px;
  color: var(--ink);
}
.job-meta {
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 6px;
}
.job-meta strong {
  color: var(--ink-soft);
  font-weight: 500;
}
.job-reasoning {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  max-width: 680px;
  font-weight: 300;
}

.status-pill {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 4px;
  white-space: nowrap;
}
.status-new        { background: var(--bg-subtle); color: var(--ink-soft); }
.status-interesting{ background: var(--green-soft); color: var(--green); }
.status-applied    { background: var(--blue-soft); color: var(--blue); }
.status-rejected   { background: var(--red-soft); color: var(--red); }
.status-archived   { background: var(--bg-subtle); color: var(--ink-muted); }

/* --- Empty state --- */

.empty-state {
  text-align: center;
  padding: 80px 32px;
  color: var(--ink-muted);
  font-size: 15px;
  font-weight: 300;
}

/* --- Modal --- */

.modal {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.4);
}
.modal-content {
  position: relative;
  background: var(--bg);
  max-width: 760px;
  width: 100%;
  padding: 40px 48px 48px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 24px;
  color: var(--ink-muted);
  line-height: 1;
  padding: 4px 8px;
  border-radius: 4px;
}
.modal-close:hover { background: var(--bg-hover); color: var(--ink); }

.modal h2 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 6px;
  padding-right: 40px;
}
.modal .job-meta { margin-bottom: 16px; }

.modal-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--rule-soft);
}
.modal-section h3 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 10px;
}

.modal-description {
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-soft);
  font-weight: 300;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 8px;
}

.reasoning-block {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
  border-left: 3px solid var(--rule);
  padding-left: 14px;
  font-weight: 300;
}

.actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.actions-row .ai-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
  border-radius: 6px;
  transition: all 0.15s;
}
.actions-row .ai-btn:hover { background: #333; border-color: #333; }
.actions-row .ai-btn:disabled { opacity: 0.4; cursor: wait; }

.status-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.status-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 400;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-soft);
  border-radius: 6px;
  transition: all 0.15s;
}
.status-btn:hover { border-color: var(--ink); color: var(--ink); background: var(--bg-hover); }
.status-btn.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.generated-text {
  background: var(--bg-subtle);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 20px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  margin-top: 10px;
  max-height: 500px;
  overflow-y: auto;
  font-weight: 300;
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.copy-btn {
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  border-radius: 6px;
  transition: all 0.12s;
}
.copy-btn:hover { border-color: var(--ink); color: var(--ink); background: var(--bg-hover); }

.loading {
  font-size: 13px;
  font-weight: 300;
  color: var(--ink-muted);
  padding: 14px;
}

a.btn-apply {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  padding: 10px 24px;
  border-radius: 999px;
  margin-top: 12px;
  letter-spacing: 0.2px;
  transition: background 0.15s, transform 0.1s;
}
a.btn-apply:hover { background: #333; transform: translateY(-1px); }

/* --- Login --- */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: var(--bg-subtle);
}
.login-card {
  max-width: 360px;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 40px 36px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.login-card h1 {
  font-size: 22px;
  font-weight: 600;
}
.login-card .subtitle {
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-muted);
  margin-bottom: 28px;
  margin-top: 4px;
}
.login-card label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--ink-muted);
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}
.login-card input {
  width: 100%;
  font-family: var(--sans);
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--bg);
  margin-bottom: 16px;
}
.login-card input:focus { outline: none; border-color: var(--ink); }
.login-card button {
  width: 100%;
  padding: 11px;
  background: var(--ink);
  color: #fff;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
}
.login-card button:hover { background: #333; }
.login-card .error {
  font-size: 12px;
  color: var(--red);
  margin-top: 10px;
  min-height: 16px;
}

/* --- Mobile --- */

@media (max-width: 700px) {
  .masthead-inner { padding: 16px 20px; flex-direction: column; align-items: stretch; }
  .filter-bar { padding: 0 16px; overflow-x: auto; flex-wrap: nowrap; }
  .container { padding: 20px 16px; }
  .job-card { grid-template-columns: 44px 1fr; gap: 14px; padding: 16px 8px; }
  .job-card .status-pill { grid-column: 2; justify-self: start; }
  .job-title { font-size: 15px; }
  .modal-content { padding: 28px 22px 32px; border-radius: 6px; }
  .modal h2 { font-size: 19px; }
}
