/* career-ops portal — Catppuccin Mocha-ish dark theme, no external deps */

:root {
  --bg:        #1e1e2e;  /* base */
  --bg-alt:    #181825;  /* mantle */
  --surface:   #313244;  /* surface0 */
  --surface2:  #45475a;  /* surface1 */
  --overlay:   #6c7086;  /* overlay0 */
  --text:      #cdd6f4;
  --subtext:   #a6adc8;
  --muted:     #7f849c;
  --cyan:      #89dceb;  /* sky/accent */
  --mauve:     #cba6f7;
  --green:     #a6e3a1;
  --yellow:    #f9e2af;
  --peach:     #fab387;
  --red:       #f38ba8;
  --blue:      #89b4fa;
  --teal:      #94e2d5;
  --border:    #45475a;
  --radius:    10px;
  --shadow:    0 8px 30px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--cyan); }
a.link { text-decoration: none; }
a.link:hover { text-decoration: underline; }

.mono { font-family: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace; }
.muted { color: var(--muted); }

/* ---------- login ---------- */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 50% -10%, #2a2a40 0%, var(--bg) 60%);
}
.login-card {
  width: 340px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}
.login-title { margin: 0; font-size: 24px; color: var(--mauve); letter-spacing: 0.5px; }
.login-sub { margin: 4px 0 24px; color: var(--subtext); font-size: 13px; }
.login-card label { display: block; margin-bottom: 6px; color: var(--subtext); font-size: 12px; }
.login-card input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}
.login-card input:focus { outline: none; border-color: var(--cyan); }
.login-card button {
  width: 100%;
  padding: 10px;
  background: var(--mauve);
  color: var(--bg-alt);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}
.login-card button:hover { background: var(--cyan); }
.login-card button:disabled { opacity: 0.6; cursor: default; }
.error { color: var(--red); font-size: 13px; margin: 4px 0 0; }

/* ---------- topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-size: 18px; font-weight: 700; color: var(--mauve); letter-spacing: 0.5px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.health { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--surface); color: var(--subtext); }
.health-ok { color: var(--green); }
.health-bad { color: var(--red); }

.btn-ghost {
  background: transparent;
  color: var(--subtext);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
}
.btn-ghost:hover { color: var(--text); border-color: var(--overlay); }

/* ---------- layout ---------- */

.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: 24px;
}

.panel {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.panel h2 { margin: 0 0 16px; font-size: 15px; color: var(--cyan); font-weight: 600; }
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.panel-head h2 { margin: 0; }

/* ---------- forms ---------- */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; flex: 1; }
.field label { font-size: 12px; color: var(--subtext); }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row .field { min-width: 200px; }
.field-submit { flex: 0 0 auto; justify-content: flex-end; }

input, select {
  padding: 9px 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}
input:focus, select:focus { outline: none; border-color: var(--cyan); }
input::placeholder { color: var(--overlay); }

#add-btn, button[type="submit"] {
  padding: 9px 18px;
  background: var(--mauve);
  color: var(--bg-alt);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
#add-btn:hover { background: var(--cyan); }
#add-btn:disabled { opacity: 0.6; cursor: default; }

.form-msg { margin: 8px 0 0; font-size: 13px; }
.form-msg.ok { color: var(--green); }
.form-msg.err { color: var(--red); }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left;
  padding: 8px 10px;
  color: var(--subtext);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--surface);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface); }
td.empty { text-align: center; color: var(--muted); padding: 18px; }

.truncate {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notes { max-width: 240px; color: var(--subtext); }

/* ---------- status badges ---------- */

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
/* job statuses */
.badge-queued   { color: var(--yellow); background: rgba(249,226,175,0.12); border-color: rgba(249,226,175,0.3); }
.badge-running  { color: var(--blue);   background: rgba(137,180,250,0.12); border-color: rgba(137,180,250,0.3); }
.badge-done     { color: var(--green);  background: rgba(166,227,161,0.12); border-color: rgba(166,227,161,0.3); }
.badge-failed   { color: var(--red);    background: rgba(243,139,168,0.12); border-color: rgba(243,139,168,0.3); }
.badge-sending  { color: var(--peach);  background: rgba(250,179,135,0.14); border-color: rgba(250,179,135,0.4); }

.send-pending {
  display: flex; flex-direction: column; gap: 10px;
  margin: 14px 0; padding: 12px 14px;
  background: rgba(250,179,135,0.10); border: 1px solid rgba(250,179,135,0.35);
  border-radius: 8px; color: var(--peach); font-size: 13px;
}
.btn-cancel-send {
  align-self: flex-start; padding: 7px 16px;
  background: var(--red); color: var(--bg-alt);
  border: none; border-radius: 8px; font-weight: 600; cursor: pointer;
}
.btn-cancel-send:disabled { opacity: 0.6; cursor: default; }

.status-editor {
  display: flex; align-items: center; gap: 8px;
  margin: 14px 0; flex-wrap: wrap;
}
.status-editor-label { color: var(--subtext); font-size: 13px; }
.status-select {
  padding: 6px 10px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
}
.btn-status-save {
  padding: 6px 14px; background: var(--mauve); color: var(--bg-alt);
  border: none; border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 13px;
}
.btn-status-save:hover { background: var(--cyan); }
.btn-status-save:disabled { opacity: 0.7; cursor: default; }
/* career states */
.badge-evaluated { color: var(--teal);  background: rgba(148,226,213,0.12); border-color: rgba(148,226,213,0.3); }
.badge-applied   { color: var(--blue);  background: rgba(137,180,250,0.12); border-color: rgba(137,180,250,0.3); }
.badge-responded { color: var(--cyan);  background: rgba(137,220,235,0.12); border-color: rgba(137,220,235,0.3); }
.badge-interview { color: var(--mauve); background: rgba(203,166,247,0.12); border-color: rgba(203,166,247,0.3); }
.badge-offer     { color: var(--green); background: rgba(166,227,161,0.16); border-color: rgba(166,227,161,0.4); }
.badge-rejected  { color: var(--red);   background: rgba(243,139,168,0.12); border-color: rgba(243,139,168,0.3); }
.badge-discarded { color: var(--muted); background: rgba(127,132,156,0.14); border-color: rgba(127,132,156,0.3); }
.badge-skip      { color: var(--peach); background: rgba(250,179,135,0.12); border-color: rgba(250,179,135,0.3); }

/* ---------- filters ---------- */

.filters { display: flex; gap: 16px; flex-wrap: wrap; }
.filter { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--subtext); }
.filter select, .filter input { padding: 6px 9px; font-size: 13px; }
.filter input[type="number"] { width: 80px; }

/* ---------- job detail drawer ---------- */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 40;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(520px, 92vw);
  height: 100vh;
  background: var(--bg-alt);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 50;
  display: flex;
  flex-direction: column;
}
/* The `hidden` attribute must win over the display rules above. */
.drawer[hidden],
.drawer-overlay[hidden] {
  display: none !important;
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.drawer-head h3 { margin: 0; font-size: 15px; color: var(--cyan); }
.drawer-body { padding: 20px; overflow-y: auto; flex: 1; }

.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin-bottom: 16px; }
.kv { display: flex; gap: 8px; margin-bottom: 8px; align-items: baseline; }
.kv-k { color: var(--subtext); font-size: 12px; min-width: 96px; }
.kv-v { color: var(--text); word-break: break-word; }

.section-h { margin: 20px 0 10px; font-size: 13px; color: var(--mauve); border-bottom: 1px solid var(--surface); padding-bottom: 6px; }

.job-error {
  background: rgba(243,139,168,0.1);
  border: 1px solid rgba(243,139,168,0.3);
  color: var(--red);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 12px 0;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  white-space: pre-wrap;
}

.docs { list-style: none; margin: 0 0 8px; padding: 0; }
.docs li { margin-bottom: 6px; }
.docs li:last-child { margin-bottom: 0; }

.report-md {
  max-height: 40vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--subtext);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 10px 0 0;
}

.report-frame {
  width: 100%;
  height: 55vh;
  margin: 10px 0 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.qa { margin-bottom: 14px; border-left: 2px solid var(--surface2); padding-left: 12px; }
.qa-q { color: var(--subtext); font-size: 12px; margin-bottom: 4px; }
.qa-a { color: var(--text); white-space: pre-wrap; }

/* ---------- timeline ---------- */

.timeline { list-style: none; margin: 0; padding: 0; }
.evt { padding: 8px 0 8px 14px; border-left: 2px solid var(--surface2); position: relative; }
.evt::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--overlay);
}
.evt-info::before  { background: var(--blue); }
.evt-warn::before  { background: var(--yellow); }
.evt-error::before { background: var(--red); }
.evt-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.evt-step { font-weight: 600; font-size: 12px; color: var(--text); }
.evt-time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.evt-msg { font-size: 12px; color: var(--subtext); margin-top: 2px; }
.evt-error .evt-step { color: var(--red); }
.evt-warn .evt-step { color: var(--yellow); }
