/* Job Leads: left sidebar shell on the Berries Cloud v2 design system (tokens.css).
   Pico CSS stays for the page content. Its variables are mapped to the design tokens below. */

/* ---------- Pico variables -> design tokens (both themes follow the tokens) ---------- */
html:root[data-mode] {
  --pico-font-family: var(--font);
  --pico-font-size: 14px;
  --pico-line-height: 1.5;
  --pico-background-color: var(--bg);
  --pico-color: var(--ink);
  --pico-muted-color: var(--ink-2);
  --pico-muted-border-color: var(--line);
  --pico-primary: var(--link);
  --pico-primary-hover: var(--action);
  --pico-primary-underline: transparent;
  --pico-primary-background: var(--action);
  --pico-primary-hover-background: var(--action-hover);
  --pico-primary-border: var(--action);
  --pico-primary-hover-border: var(--action-hover);
  --pico-primary-inverse: var(--on-brand);
  --pico-primary-focus: var(--selected-bg);
  --pico-secondary: var(--ink-2);
  --pico-secondary-background: var(--neutral-bg);
  --pico-secondary-inverse: var(--neutral);
  --pico-contrast: var(--ink);
  --pico-contrast-background: var(--ink);
  --pico-contrast-inverse: var(--bg);
  --pico-h1-color: var(--ink);
  --pico-h2-color: var(--ink);
  --pico-h3-color: var(--ink);
  --pico-h4-color: var(--ink);
  --pico-card-background-color: var(--surface);
  --pico-card-border-color: var(--line);
  --pico-card-sectioning-background-color: var(--surface-alt);
  --pico-form-element-background-color: var(--surface);
  --pico-form-element-border-color: var(--line-strong);
  --pico-form-element-color: var(--ink);
  --pico-form-element-placeholder-color: var(--ink-3);
  --pico-form-element-active-background-color: var(--surface);
  --pico-form-element-active-border-color: var(--brand-indigo);
  --pico-form-element-focus-color: var(--brand-indigo);
  --pico-form-element-disabled-background-color: var(--surface-alt);
  --pico-table-border-color: var(--line-2);
  --pico-table-row-stripped-background-color: transparent;
  --pico-code-background-color: var(--surface-sunken);
  --pico-code-color: var(--ink);
  --pico-border-radius: var(--r-md);
  --pico-block-spacing-vertical: 0;
  --pico-block-spacing-horizontal: 0;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--bg); background-image: var(--page-glow); background-attachment: fixed; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { letter-spacing: -0.01em; }
h1 { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: var(--fs-xl); font-weight: 800; }
h3 { font-size: var(--fs-lg); font-weight: 700; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ms { font-family: "Material Symbols Outlined"; font-weight: 400; font-size: 20px; line-height: 1; font-variation-settings: "opsz" 20, "wght" 400; display: inline-block; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Shell: sidebar left, main right ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
html[data-side="collapsed"] .app { grid-template-columns: 72px minmax(0, 1fr); }

.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-line, var(--line)); z-index: 30; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: var(--fs-lg); letter-spacing: -0.01em; min-width: 0; }
.brand-mark { width: 28px; height: 28px; border-radius: var(--r-md); display: grid; place-items: center; flex: none; color: #fff; background: linear-gradient(135deg, var(--brand-indigo-2), var(--brand-berry)); }
.brand-mark .ms { font-size: 18px; font-variation-settings: "FILL" 1, "opsz" 20, "wght" 500; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-md); border: 0; margin: 0; padding: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--line-2); color: var(--ink); }

.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-label { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 14px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--r-md); color: var(--ink); text-decoration: none; font-weight: 500; font-size: var(--fs-md); }
.nav a .ms { color: var(--ink-2); }
.nav a:hover { background: var(--line-2); }
.nav a[aria-current="page"] { background: var(--selected-bg); color: var(--selected-ink); font-weight: 700; }
.nav a[aria-current="page"] .ms { color: var(--selected-ink); font-variation-settings: "FILL" 1, "opsz" 20, "wght" 500; }

.side-foot { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.side-foot .hint { font-size: var(--fs-xs); color: var(--ink-2); padding: 4px 12px; margin: 0; }

html[data-side="collapsed"] .nav a span:not(.ms),
html[data-side="collapsed"] .nav-label,
html[data-side="collapsed"] .brand-name,
html[data-side="collapsed"] .side-foot .hint { display: none; }
html[data-side="collapsed"] .nav a { justify-content: center; }
html[data-side="collapsed"] .side-head { flex-direction: column; padding-bottom: 8px; }

/* ---------- Main ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.utility { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 12px 32px 0; min-height: 48px; }
.utility form { margin: 0; }
#side-open, #side-scrim { display: none; }
.content { padding: 8px 32px 48px; width: 100%; max-width: 1600px; }
.content > h1:first-child, .content > h3:first-child { margin-top: 0; }

/* ---------- Content restyle (Pico elements) ---------- */
button, [role="button"], input[type="submit"] { font-weight: 700; font-size: var(--fs-base); }
button:not(.icon-btn):not(.star):not(.small):not(.select), [role="button"] { height: 36px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; }
button.small { height: 30px; padding: 0 12px; font-size: var(--fs-sm); }
button.outline, [role="button"].outline, button.secondary.outline { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: 0 1px 1px rgba(22,26,46,.04); }
button.outline:hover, [role="button"].outline:hover { border-color: var(--ink-3); background: var(--surface); color: var(--ink); }
button.contrast { background: transparent; color: var(--fail); border-color: var(--line); }
button.contrast:hover { background: var(--fail-bg); border-color: var(--fail); color: var(--fail); }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { border-radius: var(--r-md); font-size: var(--fs-md); }
html input:not([type="checkbox"]):not([type="radio"]), html select { height: 38px; padding-block: 0; padding-inline: 12px; line-height: 1.2; }
html select { padding-inline-end: 36px; }
html select:not([multiple]) { background-position: right 12px center; }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px var(--selected-bg); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--action); }

table { font-size: var(--fs-base); }
th { font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); background: var(--surface-alt); padding: 12px 16px; white-space: nowrap; }
td { padding: 12px 16px; }
tbody tr:hover td { background: var(--surface-alt); }
td form, td button { margin: 0; }
td.nowrap { white-space: nowrap; }
tr.detail > td { background: var(--surface-alt); }
details { border-bottom: 0; }
pre.email { white-space: pre-wrap; font-family: inherit; font-size: var(--fs-base); padding: 12px; border-radius: var(--r-md); }
.muted { color: var(--ink-2); }
.md { font-size: var(--fs-base); }
.filters { display: flex; gap: 8px 12px; flex-wrap: wrap; align-items: center; margin: 0 0 16px; }
html .filters > * { margin: 0; width: auto; }
html .filters > input:not([type="checkbox"]):not([type="hidden"]):not([type="number"]) { flex: 1 1 220px; max-width: 360px; }
html .filters > label { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
html .filters input[type="checkbox"], html .filters input[type="radio"] { margin: 0; width: 18px; height: 18px; }
html .filters > button { height: 38px; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 900px) { .grid2, .split { grid-template-columns: 1fr; } }

/* Status pills (.badge keeps its old class names: ok, bad, warn, dir, rec) */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 10px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; color: var(--neutral); background: var(--neutral-bg); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); background: var(--ok-bg); }
.badge.bad { color: var(--fail); background: var(--fail-bg); }
.badge.warn { color: var(--warn); background: var(--warn-bg); }
.badge.dir { color: var(--info); background: var(--info-bg); }
.badge.rec { color: var(--brand-berry-ink); background: var(--brand-berry-soft); }

a.tag { display: inline-block; margin: 0 4px 4px 0; padding: 0 8px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; border: 1px solid var(--line); background: var(--surface); text-decoration: none; }
a.tag:hover { background: var(--selected-bg); color: var(--selected-ink); }
a.chip { padding: 2px 10px; border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: 600; text-decoration: none; border: 1px solid var(--line); color: var(--ink-2); }
a.chip.include { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
a.chip.exclude { background: var(--fail-bg); border-color: var(--fail); color: var(--fail); text-decoration: line-through; }
button.select { height: auto; padding: 0 6px; font-size: var(--fs-xs); margin: 0 4px 0 0; }
button.star { background: none; border: none; padding: 0 4px; margin: 0; font-size: 1.2rem; line-height: 1; color: var(--ink-3); cursor: pointer; box-shadow: none; }
button.star.on { color: #f5a623; }
details.flag { display: inline-block; margin: 0 4px 4px 0; vertical-align: top; }
details.flag summary { list-style: none; } details.flag summary::after { display: none; }
details.flag[open] { display: block; font-size: var(--fs-sm); }

/* Flash message: info banner */
article.flash { display: flex; gap: 12px; padding: 14px 16px; margin: 0 0 16px; border-radius: var(--r-lg); background: var(--info-bg); color: var(--ink); box-shadow: none; border: 0; }
article.flash::before { content: "info"; font-family: "Material Symbols Outlined"; font-size: 20px; line-height: 1.5; color: var(--info); }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; padding: 32px 28px; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-pop); text-align: center; }
.login-card .brand { justify-content: center; margin-bottom: 20px; }
.login-card form { margin: 0; }
.login-card input { margin-bottom: 12px; }
.login-card button { width: 100%; }
.login-or { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--ink-3); font-size: var(--fs-sm); }
.login-or::before, .login-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.login-ms { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 10px 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); color: inherit; font-weight: 600; text-decoration: none; }
.login-ms:hover { background: var(--surface-alt); }
.login-error { color: var(--fail); font-weight: 600; font-size: var(--fs-sm); margin: 0 0 12px; }

/* ---------- Narrow screens: sidebar becomes a drawer ---------- */
@media (max-width: 860px) {
  .app, html[data-side="collapsed"] .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 248px; transform: translateX(-100%); transition: transform .15s ease; box-shadow: var(--shadow-pop); }
  html[data-side="collapsed"] .nav a span:not(.ms), html[data-side="collapsed"] .nav-label, html[data-side="collapsed"] .brand-name, html[data-side="collapsed"] .side-foot .hint { display: revert; }
  html[data-side="collapsed"] .nav a { justify-content: flex-start; }
  html[data-side="collapsed"] .side-head { flex-direction: row; }
  #side-collapse { display: none; }
  .app.drawer-open .side { transform: none; }
  .app.drawer-open #side-scrim { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(10, 12, 20, .45); }
  #side-open { display: inline-grid; margin-right: auto; }
  .utility, .content { padding-inline: 16px; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }

/* ---------- Cards, page head (company page, outreach) ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-card); margin: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 20px 24px 0; }
.card-head h3 { margin: 0; font-size: var(--fs-lg); font-weight: 700; }
.card-body { padding: 12px 24px 24px; }
.card-body p { margin: 0; font-size: var(--fs-md); line-height: 1.6; }
.card-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--line-2); background: var(--surface-alt); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card-foot form { margin: 0; }
.card-foot button { margin: 0; }
pre.email { margin: 0; padding: 16px; background: var(--surface-sunken); border: 1px solid var(--line-2); border-radius: var(--r-md); font-size: var(--fs-md); line-height: 1.6; color: var(--ink); }
.outreach { margin-bottom: 16px; align-items: start; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; padding: 12px 0 20px; }
.page-head h1 { margin: 0; line-height: 1.2; }
.page-head p { margin: 6px 0 0; font-size: var(--fs-md); }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.head-actions form { margin: 0; }
html .head-actions button, html .head-actions [role="button"] { margin: 0; height: 36px; white-space: nowrap; }
.hint-line { margin: -8px 0 12px; font-size: var(--fs-sm); }
.apollo { margin-bottom: 24px; font-size: var(--fs-base); }

/* ---------- User menu (top right) ---------- */
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 0; border: 0; background: none; color: inherit; }
.user-menu summary::-webkit-details-marker, .user-menu summary::marker { display: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; display: inline-grid; place-items: center; background: var(--surface-sunken); border: 1px solid var(--line); font-size: var(--fs-sm); font-weight: 600; }
.avatar .ms { font-size: 20px; }
.user-name { font-weight: 600; font-size: var(--fs-sm); }
.user-pop { position: absolute; right: 0; top: 40px; z-index: 40; min-width: 220px; display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: var(--r-lg, var(--r-md)); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-pop); }
.user-pop form { margin: 8px 0 0; }
.user-pop button { width: 100%; }
@media (max-width: 860px) { .user-name { display: none; } }

/* Postings that disappeared from the board are gray */
tr.gone td, tr.gone a { color: var(--ink-3); }
tr.gone td { opacity: .65; }

/* ---------- Tabs (Settings) ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 20px; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--ink-2); font-weight: 600; text-decoration: none; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--selected-ink); border-bottom-color: var(--action); }
.tabs a[aria-current="page"] .ms { font-variation-settings: "FILL" 1, "opsz" 20, "wght" 500; }

/* ---------- Button group: joined small buttons (one form, a formaction per button) ---------- */
.btn-group { display: inline-flex; margin: 0; }
html .btn-group > button, html .btn-group > a { height: 30px; padding: 0 12px; margin: 0; font-size: var(--fs-sm); border-radius: 0; display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
.btn-group > :not(:first-child) { margin-left: -1px; }
html .btn-group > :first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
html .btn-group > :last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.btn-group > :hover, .btn-group > :focus-visible { position: relative; z-index: 1; }
html .head-actions .btn-group > button, html .head-actions .btn-group > a { height: 36px; padding: 0 16px; font-size: var(--fs-base); }

/* ---------- Prompts and logs (Settings) ---------- */
.prompt { margin-bottom: 24px; scroll-margin-top: 16px; }
.prompt textarea { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: var(--fs-sm); line-height: 1.5; margin: 0; }
.prompt .error { color: var(--fail); font-weight: 600; margin: 8px 0 0; }
.prompt details pre { white-space: pre-wrap; font-size: var(--fs-sm); max-height: 400px; overflow: auto; }
table.logs td { vertical-align: top; padding: 6px 12px; }
table.logs .msg { white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: var(--fs-sm); }
.stats { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 0 0 24px; }
.stats div { display: flex; flex-direction: column; }
.stats strong { font-size: var(--fs-lg); }
html .filters .btn-group > button, html .filters > [role="button"] { height: 38px; padding: 0 16px; font-size: var(--fs-base); }
