:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #efede7;
  --text: #16181d;
  --muted: #646a75;
  --line: #e2dfd7;
  --accent: #0b6bcb;
  --accent-ink: #ffffff;
  --accent-soft: #e3effb;
  --star: #b7791f;
  --star-soft: #fbf1df;
  --ok: #1f7a4d;
  --ok-soft: #e2f3ea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 20, 30, .04), 0 6px 20px rgba(20, 20, 30, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1e222b;
    --text: #e9ebef;
    --muted: #9aa1ad;
    --line: #272c36;
    --accent: #54a8f5;
    --accent-ink: #0b1220;
    --accent-soft: #15283d;
    --star: #f0b54a;
    --star-soft: #2c2412;
    --ok: #4cc58a;
    --ok-soft: #13291f;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
}
code, .mono { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: .88em; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* Header */
.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand h1 { margin: 0; font-size: 1.45rem; font-weight: 700; letter-spacing: -.01em; }
.brand p { margin: 0; font-size: .92rem; }
.brand__mark {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, #02569b, #13b9fd);
  -webkit-mask: none;
  position: relative;
}
.brand__mark::after {
  content: ""; position: absolute; inset: 9px;
  background: #fff;
  clip-path: polygon(55% 0, 100% 0, 45% 55%, 100% 100%, 55% 100%, 0 55%);
  opacity: .95;
}
.updated { font-size: .88rem; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.dot--stale { background: var(--star); box-shadow: 0 0 0 4px var(--star-soft); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 24px 0 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat span { font-size: .85rem; color: var(--muted); }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* Toolbar */
.toolbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 12px 0; margin-bottom: 8px;
  background: var(--bg);
}
.search { flex: 1 1 260px; }
.search input {
  width: 100%; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-size: .95rem;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.chips { display: flex; gap: 4px; background: var(--surface-2); padding: 3px; border-radius: 10px; overflow-x: auto; }
.chip {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .88rem;
  padding: 6px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.chip.is-on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.chip:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Sections */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.section-head h2 { margin: 0; font-size: 1.15rem; font-weight: 700; }
.summary {
  background: var(--accent-soft); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 14px;
  font-size: .95rem;
}
.day { margin-bottom: 8px; }
.day > summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 4px; border-top: 1px solid var(--line); font-weight: 600;
}
.day > summary::-webkit-details-marker { display: none; }
.day > summary::after { content: "＋"; color: var(--muted); font-weight: 400; }
.day[open] > summary::after { content: "－"; }
.day .count { color: var(--muted); font-weight: 400; font-size: .88rem; margin-inline-start: 8px; }

.list { display: grid; gap: 12px; }

/* Job card */
.job {
  display: flex; gap: 16px; justify-content: space-between; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.job.is-top { border-color: color-mix(in srgb, var(--star) 45%, var(--line)); }
.job.is-applied { opacity: .7; }
.job.is-applied .job__mark { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.job__main { min-width: 0; flex: 1; }
.job__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-start; }
.job__title { margin: 0; font-size: 1.05rem; font-weight: 600; text-align: right; }
.job__company { margin: 2px 0 8px; font-weight: 500; color: var(--muted); text-align: right; }
.job__meta { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.job__meta li {
  font-size: .8rem; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted);
}
.job__meta li.mode-remote { background: var(--ok-soft); color: var(--ok); }
.job__why { margin: 0; font-size: .93rem; }
.badge { font-size: .75rem; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.badge--top { background: var(--star-soft); color: var(--star); }
.job__actions { display: flex; flex-direction: column; gap: 6px; flex: none; }
.btn {
  font: inherit; font-size: .88rem; text-align: center; text-decoration: none; cursor: pointer;
  padding: 7px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  white-space: nowrap;
}
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn--ghost { border-color: transparent; color: var(--muted); }
@media (max-width: 640px) {
  .job { flex-direction: column; }
  .job__actions { flex-direction: row; width: 100%; }
  .job__actions .btn { flex: 1; }
}

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-block: 32px; font-size: .85rem; border-top: 1px solid var(--line); margin-top: 40px; }
