:root {
  --bg: #f6f7f9; --card: #fff; --text: #1d2329; --muted: #5b6672; --line: #dde2e7;
  --accent: #1f5fae; --accent-soft: #e8f0fb; --ok: #1d7a46; --ok-soft: #e6f4ec;
  --warn: #9a5b00; --warn-soft: #fdf1dc; --bad: #b42318; --bad-soft: #fdeceb;
  --radius: 8px; color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
       background: var(--bg); color: var(--text); }
a { color: var(--accent); }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
small { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* nagłówek */
.top { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 10px 16px;
       background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.top nav { display: flex; gap: 4px; }
.top nav a { padding: 6px 10px; border-radius: var(--radius); text-decoration: none; color: var(--text); }
.top nav a[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.logout { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.who { color: var(--muted); font-size: 13px; }

/* elementy */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
button, .button { font: inherit; padding: 7px 12px; border-radius: var(--radius); border: 1px solid var(--line);
                  background: var(--card); color: var(--text); cursor: pointer; text-decoration: none; display: inline-block; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--radius);
                          background: #fff; color: var(--text); width: 100%; }
textarea.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
label { display: block; margin: 10px 0; font-weight: 600; }
label input, label select, label textarea { margin-top: 4px; font-weight: 400; }
label.check { display: inline-flex; gap: 6px; align-items: center; font-weight: 400; margin: 4px 14px 4px 0; }
label.check input { width: auto; margin: 0; }
.label { font-weight: 600; margin: 14px 0 4px; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }
.error { background: var(--bad-soft); color: var(--bad); padding: 10px 14px; border-radius: var(--radius); }
.ok { background: var(--ok-soft); color: var(--ok); padding: 10px 14px; border-radius: var(--radius); }
.badge { font-size: 12px; padding: 1px 6px; border-radius: 10px; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.empty { color: var(--muted); padding: 30px 0; text-align: center; }

/* logowanie */
.login { max-width: 360px; margin: 10vh auto; }
.login h1 { margin-top: 0; font-size: 22px; }
.login button { width: 100%; margin-top: 8px; }

/* zakładki i filtry */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.count { font-size: 12px; background: var(--line); color: var(--text); border-radius: 10px; padding: 0 7px; }
.filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filters input[type=search] { flex: 1 1 260px; }
.filters select { flex: 0 1 220px; }

/* lista */
table.notices { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.notices th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.notices td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.notices td.title a { font-weight: 600; text-decoration: none; display: block; }
.notices td.title small { display: block; margin-top: 2px; }
.notices td.deadline { white-space: nowrap; }
.notices td.deadline small { display: block; }
.soon { color: var(--bad); }
.past { color: var(--muted); text-decoration: line-through; }
.notices td.why { max-width: 260px; }
.score { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; padding: 0 6px; }
tr.state-checked td { opacity: .6; }
tr.state-not_for_us td { opacity: .5; }
.act { display: flex; gap: 4px; flex-wrap: wrap; }
.act button { font-size: 12px; padding: 4px 8px; white-space: nowrap; }
.act .interested.on { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.act .not_for_us.on { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.act .checked.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.pager { display: flex; gap: 16px; justify-content: center; padding: 14px; }

/* szczegóły */
.detail h1 { font-size: 20px; margin-top: 0; }
.detail dl { display: grid; grid-template-columns: 200px 1fr; gap: 6px 16px; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; }
.status { font-weight: 600; }
.status-match { color: var(--ok); } .status-review { color: var(--warn); } .status-rejected { color: var(--muted); }
.description { white-space: pre-line; color: var(--muted); }
.history li, .reasons li { margin: 4px 0; }

/* profil */
.profile { max-width: 760px; }
fieldset { border: 0; border-top: 1px solid var(--line); padding: 10px 0; margin: 0 0 10px; }
legend { font-weight: 700; font-size: 16px; padding-right: 8px; }
.row { display: flex; gap: 16px; } .row label { flex: 1; }
.suggestions { display: flex; flex-direction: column; gap: 2px; }
.suggestion { text-align: left; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.suggestion:hover { background: var(--accent-soft); }

/* źródła i administracja */
h1.page { font-size: 20px; margin: 4px 0 12px; }
h2 { font-size: 16px; margin: 22px 0 8px; }
.pill { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warning { background: var(--warn-soft); color: var(--warn); }
.pill.error { background: var(--bad-soft); color: var(--bad); }
.pill.new, .pill.off { background: var(--line); color: var(--muted); }
.sources td.why { max-width: 420px; font-size: 13px; color: var(--muted); word-break: break-word; }
.act form { display: inline; }
.add-source { margin-top: 20px; }
.danger-zone { margin-top: 20px; }
.danger-zone button { color: var(--bad); border-color: var(--bad); }

/* telefon: tabela → karty */
@media (max-width: 760px) {
  main { padding: 10px; }
  .notices thead { display: none; }
  .notices, .notices tbody, .notices tr, .notices td { display: block; width: 100%; }
  .notices tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .notices td { border: 0; padding: 4px 12px; }
  .notices td.deadline small { display: inline; }
  .detail dl { grid-template-columns: 1fr; }
  .detail dt { margin-top: 8px; }
  .row { flex-direction: column; gap: 0; }
}
