:root { color-scheme: light dark; --muted: #6b7280; --border: #d1d5db; --accent: #2563eb; --danger: #dc2626; }
* { box-sizing: border-box; }
body { font-family: system-ui, sans-serif; max-width: 900px; margin: 0 auto; padding: 1.5rem 1rem; line-height: 1.4; }
a { color: var(--accent); }
h1 { margin: 0; font-size: 1.6rem; }
h1 a { color: inherit; text-decoration: none; }
h2 { font-size: 1.3rem; margin: 0 0 1rem; }

/* Header */
.site-header { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.site-nav { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem 1rem; font-size: .95rem; }
.site-nav > * { white-space: nowrap; }
.site-nav .user strong { overflow-wrap: anywhere; white-space: normal; }
.site-nav a { text-decoration: none; }
.site-nav a:hover { text-decoration: underline; }
.site-nav .user { color: var(--muted); }
.site-nav .user strong { color: CanvasText; font-weight: 600; }
.inline-form { display: inline; margin: 0; }

/* Flash messages */
.flashes { list-style: none; padding: 0; margin: 0 0 1rem; }
.flashes li { padding: .6rem .9rem; border-radius: 6px; border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); display: block; }

/* Controls */
input[type=search], input[type=text], input[type=password] { padding: .6rem .8rem; font: inherit; font-size: 1rem; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: inherit; }
/* Custom arrow (instead of the browser's) so it sits like the Industries ▾ */
select { appearance: none; -webkit-appearance: none; padding: .6rem 1.9rem .6rem .8rem; font: inherit; font-size: 1rem; border: 1px solid var(--border); border-radius: 6px; color: inherit; cursor: pointer;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0h10L5 6z' fill='%236b7280'/%3E%3C/svg%3E") no-repeat right .8rem center; }
button { padding: .6rem 1.2rem; font: inherit; font-size: 1rem; border: 0; border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; }
.link-button { background: none; color: var(--accent); padding: 0; font-size: inherit; }
.link-button:hover { text-decoration: underline; }
.danger { color: var(--danger); }

/* Search form */
.search-form { display: flex; gap: .5rem; margin-bottom: 1rem; }
.search-form input[type=search] { flex: 1; min-width: 0; }

/* Results */
.summary-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .5rem; }
.summary { color: var(--muted); }
.results { list-style: none; padding: 0; margin: 0; }
.results li { padding: .8rem 0; border-bottom: 1px solid var(--border); display: flex; gap: 1rem; align-items: baseline; }
.job { flex: 1; min-width: 0; }
.date { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.role { font-weight: 600; color: var(--accent); text-decoration: none; }
.role:hover { text-decoration: underline; }
.meta { color: var(--muted); font-size: .9rem; margin-top: .2rem; }
.meta a { color: inherit; text-decoration: none; }
.meta a:hover { text-decoration: underline; }
.company { font-weight: 500; }
.filters { margin: -.5rem 0 1rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .4rem .2rem .7rem; border: 1px solid var(--border); border-radius: 999px; font-size: .9rem; }
.chip a { color: var(--muted); text-decoration: none; padding: 0 .3rem; font-size: 1.1rem; line-height: 1; }
.chip a:hover { color: inherit; }
.clear-all { font-size: .9rem; color: var(--muted); align-self: center; margin-left: .3rem; }
.pager { display: flex; justify-content: space-between; }
.pager-top { padding: .4rem 0; border-bottom: 1px solid var(--border); font-size: .95rem; }
.pager-bottom { margin-top: 1rem; }

/* Popovers (Industries dropdown, Save search) */
.popover { position: relative; }
.popover > summary { list-style: none; cursor: pointer; }
.popover > summary::-webkit-details-marker { display: none; }
.popover .panel { position: absolute; z-index: 10; top: calc(100% + 4px); right: 0; background: Canvas; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgb(0 0 0 / .15); }

/* Industries dropdown */
.dropdown > summary { padding: .6rem .8rem; border: 1px solid var(--border); border-radius: 6px; white-space: nowrap; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; }
.dropdown > summary::after { content: " ▾"; color: var(--muted); }
.dropdown[open] > summary { border-color: var(--accent); }
.dropdown .panel { width: min(26rem, 90vw); max-height: 60vh; overflow-y: auto; padding: .5rem 0; }
.dropdown .panel label { display: flex; gap: .5rem; align-items: baseline; padding: .25rem .9rem; cursor: pointer; }
.dropdown .panel label:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.dropdown .primary { font-weight: 500; }
.dropdown .sub { padding-left: 2.2rem; font-size: .92rem; }
.dropdown .count { margin-left: auto; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.panel-actions { position: sticky; top: -.5rem; display: flex; justify-content: space-between; align-items: center; padding: .4rem .9rem .6rem; margin-top: -.5rem; background: Canvas; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
.panel-actions button { padding: .35rem .9rem; font-size: .9rem; }

/* Save search */
.save-search { white-space: nowrap; font-size: .95rem; }
.save-search > summary, .save-search > a { color: var(--accent); text-decoration: none; }
.save-search > summary:hover, .save-search > a:hover { text-decoration: underline; }
.save-search .panel { width: min(22rem, 90vw); padding: .8rem; display: flex; flex-direction: column; gap: .5rem; white-space: normal; }
.save-search .panel label { font-size: .9rem; color: var(--muted); }
.save-search .panel .row { display: flex; gap: .5rem; }
.save-search .panel input { flex: 1; min-width: 0; padding: .45rem .6rem; font-size: 1rem; }
.save-search .panel button { padding: .45rem .9rem; font-size: .95rem; }

/* Login / sign up */
.auth { max-width: 22rem; margin: 2rem auto; }
.auth form { display: flex; flex-direction: column; gap: .9rem; }
.auth label { display: flex; flex-direction: column; gap: .3rem; font-size: .95rem; }
.auth .hint { color: var(--muted); font-size: .85rem; }
.auth .alt { color: var(--muted); margin-top: 1.2rem; font-size: .95rem; }
.error { color: var(--danger); padding: .6rem .9rem; border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); border-radius: 6px; background: color-mix(in srgb, var(--danger) 8%, transparent); margin: 0; }

/* Saved searches */
.saved-list { list-style: none; padding: 0; margin: 0; }
.saved-list li { padding: .8rem 0; border-bottom: 1px solid var(--border); display: flex; gap: 1rem; align-items: baseline; }
.saved-list .name { font-weight: 600; text-decoration: none; }
.saved-list .name:hover { text-decoration: underline; }
.saved-list .actions { display: flex; gap: 1rem; align-items: baseline; font-size: .9rem; }
.empty { color: var(--muted); }

/* ---- Phones and narrow windows ---- */
@media (max-width: 640px) {
  body { padding: 1rem .9rem; }
  h1 { font-size: 1.4rem; }
  .signed-in-label { display: none; }

  /* Row 1: search box + Search button. Row 2: the two filters, half each. */
  .search-form { flex-wrap: wrap; position: relative; }
  .search-form input[type=search] { flex: 1 1 60%; }
  .search-form > button { flex: none; order: 1; }
  .search-form .dropdown { flex: 1 1 40%; min-width: 0; order: 2; position: static; }
  .search-form select { flex: 1 1 40%; min-width: 0; order: 3; }
  .dropdown > summary { max-width: none; }
  /* Popovers span the full width instead of hanging off one edge. */
  .dropdown .panel { left: 0; right: 0; width: auto; max-height: 65vh; }
  .summary-row { position: relative; flex-wrap: wrap; gap: .3rem 1rem; }
  .save-search { position: static; }
  .save-search .panel { left: 0; right: 0; width: auto; }

  .saved-list li { flex-wrap: wrap; gap: .4rem 1rem; }
  .saved-list .actions { flex-basis: 100%; justify-content: space-between; }
}

/* ---- Touch screens: bigger tap targets ---- */
@media (pointer: coarse) {
  .dropdown .panel label { padding: .55rem .9rem; }
  .dropdown .sub { padding-left: 2.2rem; }
  input[type=checkbox] { width: 1.15rem; height: 1.15rem; }
  .chip { padding: .3rem .3rem .3rem .8rem; }
  .chip a { padding: .1rem .45rem; }
  .pager a, .clear-all { display: inline-block; padding: .45rem 0; }
  .meta a { padding: .15rem 0; }
}
