:root {
  color-scheme: light;
  --ink: #183247;
  --muted: #607487;
  --line: #d8e1e8;
  --surface: #ffffff;
  --canvas: #f3f6f8;
  --brand: #14547b;
  --brand-dark: #0d3d5b;
  --accent: #d9edf7;
  --danger: #8b2635;
  --danger-bg: #fff0f1;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, select { font: inherit; }
a { color: inherit; }
.login-card { width: min(100% - 2rem, 440px); margin: 8vh auto; padding: 2rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 16px 40px #19364a12; }
h1 { margin: .25rem 0 .75rem; font-size: clamp(1.8rem, 5vw, 2.4rem); letter-spacing: -.035em; }
.muted { color: var(--muted); line-height: 1.6; }
.eyebrow { color: var(--brand); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
form { display: grid; gap: .65rem; margin-top: 1.6rem; }
label { margin-top: .45rem; font-size: .9rem; font-weight: 700; }
input { width: 100%; min-height: 46px; padding: .7rem .8rem; border: 1px solid #aebfcb; border-radius: 8px; background: white; color: var(--ink); }
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; min-height: 1.15rem; padding: 0; accent-color: var(--brand); flex: 0 0 auto; }
select { width: 100%; min-height: 46px; padding: .7rem .8rem; border: 1px solid #aebfcb; border-radius: 8px; background: white; color: var(--ink); }
input:focus { outline: 3px solid #b7d9ec; border-color: var(--brand); }
.button { border: 0; border-radius: 8px; padding: .7rem 1rem; font-weight: 700; cursor: pointer; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; margin: .45rem 0; }
.button-row .button { margin-top: 0; }
.button-row .button--danger { margin-inline-start: .85rem; }
.wide-field { min-width: 16rem; }
.criteria-label { min-width: 18rem; }
.policy-select { min-width: 180px; width: 100%; }
.policy-cell { min-width: 200px; }
.policy-cell .policy-current { display: block; margin-top: .35rem; font-weight: 650; line-height: 1.35; }
.label-nowrap { white-space: nowrap; }
.fill-in { display: inline; padding: .05rem .4rem; border-radius: 4px; color: #6b4200; background: #fff0c2; font-weight: 800; }
.button--primary { margin-top: .7rem; color: white; background: var(--brand); }
.button--primary:hover { background: var(--brand-dark); }
.button--quiet { color: var(--brand-dark); background: #e8f0f5; }
.button--quiet:hover { background: #d9e7ef; }
.button--danger { color: white; background: #a62935; }
.button--danger:hover { background: #811f29; }
.notice { margin: 1rem 0; padding: .85rem 1rem; border-radius: 8px; line-height: 1.5; }
.notice--error { color: var(--danger); background: var(--danger-bg); border: 1px solid #f1c5ca; }
.notice--warning { color: #775411; background: #fff5d8; border: 1px solid #f2dc9f; }
.notice--ok { color: #205b38; background: #e8f5ec; border: 1px solid #a9d7b5; }
.notify-health-ok { color: #205b38; background: #e8f5ec; border: 1px solid #a9d7b5; }
.notify-health-ok strong { font-weight: 800; }
.panel-section { margin: 1.5rem 0; padding: 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.panel-section h2 { margin-top: 0; }
.entity-list { display: grid; gap: 1rem; margin-top: 1rem; }
.entity-card { display: block; margin: .9rem 0; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.panel-section .entity-card { background: #fbfdff; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.card-heading h3 { margin: 0; }
.card-heading p { margin: .25rem 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(190px,1fr)); gap: .9rem 1rem; align-items: end; margin: 1rem 0; }
.form-grid label, .inline-form label, .danger-zone label { display: grid; gap: .35rem; color: var(--ink); font-weight: 650; }
.form-grid.compact { grid-template-columns: repeat(auto-fit,minmax(135px,1fr)); }
.form-grid input[type="checkbox"], .check-field input[type="checkbox"] { width: 20px; min-height: 20px; accent-color: var(--brand); }
.check-field { display: flex !important; align-items: center; gap: .65rem !important; }
.empty-state { padding: 1rem; color: var(--muted); background: #f4f8fa; border-radius: 8px; }
.inline-form { display: flex; align-items: end; gap: .8rem; margin: 1rem 0; }
.inline-form label { flex: 1; }
.danger-zone { display: flex; align-items: end; gap: .8rem; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid #f0c5c9; }
.danger-zone label { flex: 1; color: var(--danger); }
.policy-row { display: grid; grid-template-columns: minmax(220px,1fr) minmax(180px,320px); align-items: center; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.policy-row span { display: grid; gap: .3rem; }
.policy-row small { color: var(--muted); font-weight: 400; line-height: 1.45; }
.policy-row.check-field { display: flex !important; justify-content: space-between; }
.features { margin-top: 1rem; padding: .8rem; background: #f4f8fa; border-radius: 8px; }
.features summary, details > summary { cursor: pointer; font-weight: 700; }
.feature-row { display: grid; grid-template-columns: 1fr minmax(100px,160px) auto; align-items: center; gap: .6rem; padding: .5rem 0; }
.feature-row input[type="number"] { min-height: 38px; }
.layout { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem clamp(1rem, 4vw, 2.5rem); color: white; background: var(--brand-dark); }
.brand { color: white; font-size: 1.35rem; font-weight: 850; text-decoration: none; letter-spacing: -.04em; }
.identity { display: flex; align-items: center; gap: .8rem; font-size: .9rem; }
.role-badge { padding: .3rem .55rem; border-radius: 999px; background: #ffffff20; font-size: .8rem; }
.topbar .button--quiet { color: white; background: #ffffff1f; }
.topbar .button--quiet:hover { background: #ffffff33; }
.content-grid { width: min(100%, 1480px); margin: 0 auto; padding: 1.5rem clamp(1rem, 4vw, 2.5rem); flex: 1; display: grid; gap: 1.5rem; }
.sidebar { align-self: start; padding: 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.sidebar nav { display: grid; gap: .35rem; }
.menu-link { display: block; width: 100%; padding: .7rem .75rem; border: 0; border-radius: 7px; background: transparent; text-align: left; color: var(--ink); cursor: pointer; }
.menu-link:hover, .menu-link--active { background: var(--accent); color: var(--brand-dark); }
.workspace { min-width: 0; }
.workspace > h1 { margin-top: .2rem; }
.placeholder-grid { display: grid; gap: 1rem; margin-top: 1.5rem; }
.placeholder-card { padding: 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.placeholder-card h2 { margin: 0 0 .5rem; font-size: 1.05rem; }
.placeholder-card p { margin: 0 0 1rem; color: var(--muted); }
.tag { display: inline-block; padding: .3rem .55rem; border-radius: 999px; background: #eaf2f6; color: var(--brand-dark); font-size: .75rem; font-weight: 700; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; padding: 1rem clamp(1rem, 4vw, 2.5rem); color: var(--muted); background: white; border-top: 1px solid var(--line); font-size: .78rem; }
.loading, .narrow { width: min(100% - 2rem, 640px); margin: 10vh auto; }
@media (min-width: 760px) {
  .content-grid { grid-template-columns: 240px minmax(0, 1fr); align-items: start; }
  .sidebar { position: sticky; top: 1rem; }
  .placeholder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .topbar { align-items: flex-start; }
  .identity { flex-wrap: wrap; justify-content: flex-end; gap: .35rem .55rem; font-size: .78rem; }
  .identity > span:first-child { flex-basis: 100%; text-align: right; overflow-wrap: anywhere; }
  .role-badge { font-size: .72rem; }
  .login-card { padding: 1.4rem; }
  .footer { flex-direction: column; }
  .inline-form, .danger-zone { align-items: stretch; flex-direction: column; }
  .policy-row { grid-template-columns: 1fr; }
  .feature-row { grid-template-columns: 1fr minmax(80px,120px); }
}

input::placeholder { color: #8795a1; font-weight: 400; opacity: 1; }
.button--warning { color: #6b4200; background: #fff0c2; }
.button--warning:hover { background: #f6dfa0; }
.warning-text { color: #8a5000; font-weight: 700; }
.catch-all-status { margin: .7rem 0; font-weight: 700; }
.limit-note { margin: .2rem 0; font-size: .84rem; }
.target-row { display: grid; grid-template-columns: minmax(0, 1fr) 42px; gap: .5rem; align-items: center; }
.target-remove { padding: .55rem; font-size: 1.25rem; line-height: 1; }

.sidebar nav { gap: .45rem; }
.sidebar nav .menu-link { display: grid; gap: .3rem; }
.sidebar nav small { color: var(--muted); font-size: .78rem; font-weight: 450; line-height: 1.35; }
.subnav { display: grid; gap: .25rem; margin-top: 1.2rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.subnav-link--active { box-shadow: inset 3px 0 var(--brand); font-weight: 800; }
.criterion-choice { display: flex !important; align-items: flex-start; gap: .75rem !important; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.criterion-choice input[type="checkbox"] { flex: 0 0 20px; width: 20px; min-height: 20px; margin-top: .15rem; accent-color: var(--brand); }
.criterion-choice span { display: grid; gap: .25rem; }
.criterion-choice small { color: var(--muted); font-weight: 400; }
.criterion-choice small:empty { display: none; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .9rem; }
th, td { padding: .75rem .65rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .77rem; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
.row-overdue { color: var(--danger); background: var(--danger-bg); }
.status-overdue { color: var(--danger); font-weight: 800; }
.status-ok { color: #27623f; font-weight: 750; }
.text-button { border: 0; padding: 0; color: var(--brand); background: transparent; text-align: left; text-decoration: underline; cursor: pointer; }
.detail-grid { display: grid; grid-template-columns: minmax(120px, 190px) minmax(0, 1fr); gap: .45rem 1rem; }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; overflow-wrap: anywhere; }
fieldset { margin: 1rem 0; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 8px; }
legend { padding: 0 .35rem; font-weight: 750; }
.log-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.point-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.point-row form { display: flex; flex-direction: row; align-items: center; gap: .5rem; margin: 0; }
.point-row label { margin: 0; }
.point-row .button { flex: 0 0 auto; align-self: center; height: auto; margin-top: 0; }
.point-row .button--danger { margin-inline-start: .85rem; }
.point-row input { width: auto; min-width: 8rem; }
tr.shift-active td { background: #e8f5ec; }
.step-card { margin: .6rem 0; padding: .75rem; border: 1px solid var(--line); border-radius: 8px; }
.log-row small, .subtle-note { color: var(--muted); font-size: .78rem; }
.draft-field { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.draft-field p { margin: .3rem 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.draft-field small { color: var(--muted); }
.submission-details { min-width: 190px; }
.submission-details summary { margin: .45rem 0; color: var(--brand); cursor: pointer; font-size: .82rem; font-weight: 700; }
.submission-details form { min-width: 280px; }
textarea { width: 100%; min-height: 100px; padding: .7rem .8rem; border: 1px solid #aebfcb; border-radius: 8px; font: inherit; }
textarea.notify-text { line-height: 1.4; min-height: calc(8 * 1.4em + 1.4rem); max-height: calc(40 * 1.4em + 1.4rem); field-sizing: content; overflow-y: auto; }
textarea:focus { outline: 3px solid #b7d9ec; border-color: var(--brand); }
code { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  th, td { padding: .6rem .45rem; }
  .detail-grid { grid-template-columns: 1fr; gap: .2rem; }
  .detail-grid dd { margin-bottom: .65rem; }
  .draft-field { align-items: stretch; flex-direction: column; }
}
.input-suffix { display: flex; align-items: center; }
.input-suffix input { border-radius: 8px 0 0 8px; }
.input-suffix > span { min-height: 46px; display: flex; align-items: center; padding: 0 .8rem; border: 1px solid #aebfcb; border-left: 0; border-radius: 0 8px 8px 0; background: #f3f6f8; color: var(--muted); white-space: nowrap; }
.policy-label { display: grid; gap: .2rem; }
.policy-label code { color: #4d5f6d; font-size: .76rem; font-weight: 500; }
.notice-text { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.policy-value { color: var(--ink); text-align: right; }
.topbar-main { display: flex; align-items: center; gap: .8rem; }
.mobile-menu-toggle, .logout-button { display: none; }
@media (max-width: 640px) {
  .topbar { display: grid; gap: .45rem; padding: .65rem 1rem; }
  .topbar-main { justify-content: space-between; }
  .mobile-menu-toggle, .logout-button { display: inline-flex; align-items: center; color: white; }
  .desktop-logout { display: none; }
  .identity { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: .2rem .55rem; font-size: .78rem; }
  .identity > span:first-child { flex-basis: 100%; text-align: left; overflow-wrap: anywhere; font-size: .78rem; }
  .identity > span:nth-child(2) { font-size: .72rem; }
  .role-badge { font-size: .72rem; }
  .sidebar--collapsed { display: none; }
  .content-grid { padding-top: .8rem; }
  .inline-form, .danger-zone { align-items: stretch; flex-direction: column; }
  .policy-row { grid-template-columns: 1fr auto; }
}

/* Nota pod terminem ustawowym w tabeli reguł (zrzut 26, 0.10.0). */
.rule-note { display: block; margin-top: 0.25rem; }
