:root {
  --header: #25234b;
  --heading: #252b48;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --chart-bar: #0f766e;
  --chart-muted: #b9deda;
  --brand-accent: #5eead4;
  --header-muted: #d1d5f1;
  --header-link: #e7e9ff;
  --hover-border: #a5b4fc;
  --focus: #c7d2fe;
  --control-line: #cfd6e6;
  --control-text: #4e5a73;
  --ink: #252b40;
  --muted: #626b82;
  --line: #dfe4ef;
  --line-soft: #edf0f7;
  --paper: #f7f8fc;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 14px system-ui, sans-serif; }
a { color: var(--accent); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin: 0; color: var(--heading); font-size: 22px; line-height: 1.3; letter-spacing: -.5px; }
h2 { margin: 0; color: var(--heading); font-size: 16px; line-height: 1.4; }
h3 { margin: 0; color: var(--heading); font-size: 14px; line-height: 1.4; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 54px; padding: 10px max(calc((100vw - 1400px) / 2), 20px);
  background: var(--header); color: white;
}
.brand { display: inline-flex; align-items: center; gap: 8px; color: white; font-size: 22px; font-weight: 800; letter-spacing: -1px; text-decoration: none; }
.brand-accent { color: var(--brand-accent); }
.brand-edition { border: 1px solid #ffffff2b; border-radius: 4px; padding: 3px 5px; background: #ffffff12; color: var(--header-link); font-size: 10px; font-weight: 600; line-height: 1; letter-spacing: .4px; }
.account { display: flex; align-items: center; gap: 14px; font-size: 12px; }
.account > span { max-width: 260px; overflow: hidden; text-overflow: ellipsis; color: var(--header-muted); }
.account form { margin: 0; }
.header-link, .text-button { color: var(--header-link); font: 600 12px system-ui, sans-serif; text-decoration: none; white-space: nowrap; }
.header-link:hover { text-decoration: underline; }
.text-button { border: 0; padding: 6px 0; background: none; cursor: pointer; }
.topbar :focus-visible { outline-color: var(--brand-accent); }

main { max-width: 1440px; margin: 0 auto; padding: 16px 20px 32px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.subtle { margin: 0; color: var(--muted); font-size: 13px; }
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 32px; border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 11px; background: white; color: var(--heading);
  font: 600 12px/1.3 system-ui, sans-serif; white-space: nowrap; text-decoration: none; cursor: pointer;
}
.button:hover { border-color: var(--hover-border); }
.button.primary { border-color: var(--accent); background: var(--accent); color: white; }
.button.primary:hover { background: var(--accent-hover); }
.button.quiet { color: var(--control-text); }
.button.refresh { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
.button:disabled { opacity: .55; cursor: not-allowed; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px; }
.stat-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 64px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px;
  background: white; color: inherit; text-decoration: none;
}
.stat-card:hover { border-color: var(--hover-border); }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.stat-card strong { color: var(--heading); font-size: 26px; line-height: 1; }
.panel { margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chart-panel { padding: 12px 16px; }
.range-tabs { display: flex; flex-shrink: 0; gap: 3px; padding: 2px; border-radius: 6px; background: var(--accent-soft); }
.range-tabs button { min-height: 28px; border: 0; border-radius: 4px; padding: 6px 9px; background: transparent; color: var(--muted); font: 600 11px system-ui, sans-serif; white-space: nowrap; cursor: pointer; }
.range-tabs button.active { background: var(--accent); color: white; }
.chart { display: flex; position: relative; margin-top: 12px; }
.bar-wrap { display: flex; align-items: end; position: relative; flex: 1; height: 100%; min-width: 0; }
.bar { width: 100%; max-width: 24px; margin: 0 auto; border-radius: 3px 3px 0 0; background: var(--chart-muted); }
.bar.active { background: var(--chart-bar); }
.bar-label { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 10px; white-space: nowrap; }

.jobs-panel { padding: 12px 16px; }
.count-pill { flex-shrink: 0; padding: 4px 8px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 600; }
.job-list { margin-top: 8px; }
.job-row { display: flex; align-items: flex-start; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.job-row:last-child { padding-bottom: 0; }
.job-main { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.job-title-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.company { color: var(--muted); font-size: 12px; }
.job-meta { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.job-meta span { padding: 0 3px; color: var(--muted); }
.salary { margin-top: 4px; color: var(--accent); font-size: 12px; font-weight: 600; }
.job-notes { margin: 6px 0; color: var(--control-text); font-size: 12px; line-height: 1.5; }
.job-links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.job-links a { font-size: 12px; font-weight: 600; text-decoration: none; }
.job-links a:hover { text-decoration: underline; }
.job-actions { display: flex; align-items: center; flex-shrink: 0; gap: 8px; }
.worksheet { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--accent-soft); }
.worksheet h2 { font-size: 14px; }
.empty { padding: 24px 16px; color: var(--muted); font-size: 13px; text-align: center; }

.history-list { padding: 0 16px; }
.history-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.history-row:first-child { border-top: 0; }
.history-row h3 { margin-bottom: 3px; }

dialog { width: min(400px, calc(100% - 32px)); border: 0; border-radius: 10px; padding: 20px; box-shadow: 0 16px 60px #25234b35; color: var(--ink); }
dialog::backdrop { background: #25234b99; }
dialog h2 { margin: 0; font-size: 18px; }
dialog form > label, .login-card label { display: block; margin: 14px 0; color: var(--control-text); font-size: 13px; font-weight: 600; }
input, textarea { width: 100%; margin-top: 6px; border: 1px solid var(--control-line); border-radius: 6px; padding: 9px 10px; background: white; color: var(--ink); font: 14px system-ui, sans-serif; }
input:focus, textarea:focus, select:focus-visible { outline: 2px solid var(--focus); border-color: var(--accent); }
textarea { resize: vertical; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.login-wrap { max-width: 380px; margin: 32px auto; }
.login-wrap > .subtle { margin-top: 8px; }
.login-card { margin-top: 16px; border: 1px solid var(--line); border-radius: 8px; padding: 20px; background: white; }
.login-card label:first-of-type { margin-top: 0; }
.full { width: 100%; margin-top: 4px; padding: 10px; }
.sample-hint { margin: 10px 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.error { border-radius: 6px; padding: 9px 11px; background: #fff0ed; color: #9e4b3d; font-size: 13px; }

@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .brand { font-size: 20px; }
  .account { gap: 10px; }
  .account > span { display: none; }
  .button { min-height: 36px; }
  main { padding: 12px 12px 24px; }
  .stats { gap: 8px; }
  .stat-card { display: block; min-height: 78px; padding: 10px; }
  .stat-label { display: block; min-height: 30px; font-size: 11px; }
  .stat-card strong { display: block; margin-top: 4px; font-size: 24px; }
  .chart-panel, .jobs-panel { padding: 12px; }
  .chart-panel .panel-head { flex-wrap: wrap; gap: 8px; }
  .range-tabs { margin-left: auto; }
  .range-tabs button { min-height: 32px; }
  .job-row, .history-row { flex-wrap: wrap; gap: 8px; }
  .job-main { flex-basis: 100%; }
  .job-actions { width: 100%; }
  .job-actions .button { flex: 1; }
  .worksheet { flex-wrap: wrap; padding: 10px 12px; }
  .history-list { padding: 0 12px; }
}
