:root {
  --bg: #eef2f7;
  --panel: #ffffff;
  --text: #111827;
  --muted: #64748b;
  --line: #dbe3ee;
  --accent: #2563eb;
  --accent-2: #0f766e;
  --warning: #9a3412;
  --shadow: 0 14px 38px rgba(15, 23, 42, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
.app-shell { width: min(1500px, calc(100% - 32px)); margin: 24px auto 50px; }
.hero { background: linear-gradient(135deg, #0f172a, #1e293b); color: #fff; border-radius: 22px; padding: 34px 40px; display: flex; align-items: center; justify-content: space-between; gap: 24px; box-shadow: var(--shadow); }
.hero h1 { margin: 5px 0 8px; font-size: clamp(28px, 4vw, 46px); line-height: 1.05; letter-spacing: -.035em; }
.hero p { margin: 0; color: #cbd5e1; font-size: 17px; max-width: 800px; }
.version { font-size: 12px; font-weight: 800; letter-spacing: .14em; color: #93c5fd; }
.hero-badge { flex: 0 0 112px; width: 112px; height: 112px; border-radius: 28px; display: grid; place-items: center; font-size: 40px; font-weight: 900; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); }
.panel { margin-top: 20px; padding: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 22px; }
.section-head.compact { margin-bottom: 12px; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.section-head h2 { margin: 2px 0 0; font-size: 23px; }
.eyebrow { font-size: 11px; font-weight: 900; letter-spacing: .14em; color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; gap: 8px; font-size: 14px; font-weight: 750; color: #334155; }
.field[hidden] { display: none; }
input, select { width: 100%; border: 1px solid #cbd5e1; background: #fff; color: #0f172a; border-radius: 11px; padding: 12px 13px; outline: none; transition: .15s ease; }
input:focus, select:focus { border-color: #60a5fa; box-shadow: 0 0 0 4px rgba(59,130,246,.12); }
.input-with-suffix { display: flex; align-items: stretch; }
.input-with-suffix input { border-radius: 11px 0 0 11px; }
.input-with-suffix span { display: grid; place-items: center; min-width: 62px; border: 1px solid #cbd5e1; border-left: 0; border-radius: 0 11px 11px 0; background: #f8fafc; color: var(--muted); font-size: 13px; font-weight: 800; padding: 0 10px; }
.form-actions { display: flex; align-items: center; gap: 16px; margin-top: 22px; }
.button { border: 0; border-radius: 11px; padding: 12px 18px; cursor: pointer; font-weight: 850; transition: transform .12s ease, box-shadow .12s ease, background .12s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--accent); color: #fff; box-shadow: 0 8px 20px rgba(37,99,235,.22); }
.button.ghost { background: #f1f5f9; color: #334155; }
.button.small { padding: 9px 12px; font-size: 13px; }
.hint, .schedule-note { color: var(--muted); font-size: 13px; }
.form-error { margin-top: 18px; border: 1px solid #fecaca; background: #fff1f2; color: #9f1239; padding: 12px 14px; border-radius: 11px; font-weight: 700; }
.results { opacity: .55; transition: opacity .18s ease; }
.results.ready { opacity: 1; }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 20px; }
.summary-card { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 25px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.summary-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: #94a3b8; }
.summary-card.lower::before { background: var(--accent); }
.summary-card.shorter::before { background: var(--accent-2); }
.summary-label { color: #475569; font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.summary-value { font-size: clamp(29px, 4vw, 42px); line-height: 1; font-weight: 900; letter-spacing: -.04em; margin: 14px 0 7px; }
.summary-sub { min-height: 20px; color: var(--muted); font-size: 13px; }
dl { margin: 20px 0 0; display: grid; gap: 9px; }
dl > div { display: flex; justify-content: space-between; gap: 15px; border-top: 1px solid #eef2f7; padding-top: 9px; }
dt { color: var(--muted); font-size: 13px; }
dd { margin: 0; font-weight: 850; text-align: right; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 13px 14px; border-bottom: 1px solid #e8edf4; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { background: #f8fafc; color: #475569; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tbody th { color: #475569; font-size: 13px; }
tbody td { font-variant-numeric: tabular-nums; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
.schedule-head { align-items: end; }
.schedule-select { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; font-weight: 800; }
.schedule-select select { min-width: 190px; padding: 9px 11px; }
.schedule-toolbar { min-height: 42px; display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: -4px 0 12px; color: #475569; font-size: 13px; font-weight: 750; }
.schedule-table tr.has-overpayment { background: #eff6ff; }
.schedule-table tr.has-overpayment td:nth-child(5) { color: #1d4ed8; }
.schedule-wrap { max-height: 620px; overflow: auto; }
.schedule-table thead { position: sticky; top: 0; z-index: 2; }
.schedule-note { margin: 10px 2px 0; }
footer { color: #64748b; font-size: 12px; text-align: center; padding: 24px 12px 0; }
@media (max-width: 1050px) { .form-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } .summary-grid { grid-template-columns: 1fr; } }
@media (max-width: 680px) { .app-shell { width: min(100% - 18px, 1500px); margin-top: 9px; } .hero { padding: 24px 22px; border-radius: 16px; } .hero-badge { display: none; } .panel { padding: 20px 16px; border-radius: 16px; } .form-grid { grid-template-columns: 1fr; } .section-head, .schedule-head, .form-actions, .schedule-toolbar { align-items: stretch; flex-direction: column; } .section-head .button { width: 100%; } .header-actions { width: 100%; flex-direction: column; align-items: stretch; } .schedule-select { align-items: stretch; flex-direction: column; } .schedule-select select { min-width: 0; } }

.summary-card.shorter {
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 42%);
  border-color: #b7e4c7;
}
.summary-card.shorter .summary-label,
.summary-card.shorter .summary-sub,
.summary-card.shorter dt {
  color: #166534;
}
.summary-card.shorter dd,
.summary-card.shorter .summary-value {
  color: #14532d;
}
.comparison-table thead th:nth-child(4) {
  background: #ecfdf5;
  color: #166534;
}
.comparison-table tbody td:nth-child(4) {
  background: #f0fdf4;
  color: #14532d;
  font-weight: 800;
}

/* v0.1.0.3 — kolory harmonogramu */
.schedule-table thead th:nth-child(2),
.schedule-table tbody td:nth-child(2) {
  font-weight: 800;
}

.schedule-table thead th:nth-child(3),
.schedule-table tbody td:nth-child(3) {
  color: #166534;
}

.schedule-table thead th:nth-child(4),
.schedule-table tbody td:nth-child(4) {
  color: #b91c1c;
}

.schedule-table thead th:nth-child(6),
.schedule-table tbody td:nth-child(6) {
  color: #166534;
  font-weight: 800;
}

/* v0.1.0.4 — harmonogram: scroll po 25 pozycjach + zielone tło */
.schedule-panel,
.schedule-wrap,
.schedule-table {
  background: #dce9e2;
}

.schedule-wrap {
  max-height: none;
  overflow: visible;
}

.schedule-wrap.scroll-active {
  max-height: 620px;
  overflow: auto;
}

.schedule-table tbody tr,
.schedule-table tbody td,
.schedule-table tbody th {
  background: #dce9e2;
}

.schedule-table thead th {
  background: #edf5ef;
}

/* v0.1.0.5 — tylko środek harmonogramu zielony, rama jak w v0.1.0.3 */
.schedule-panel {
  background: var(--panel);
}

.schedule-wrap {
  background: transparent;
  max-height: none;
  overflow: visible;
}

.schedule-wrap.scroll-active {
  max-height: 620px;
  overflow: auto;
}

.schedule-table {
  background: transparent;
}

.schedule-table tbody tr,
.schedule-table tbody td,
.schedule-table tbody th {
  background: #dce9e2;
}

.schedule-table thead th {
  background: #ffffff;
}

/* v0.1.0.6 — przywrócenie zaokrąglonych narożników + delikatniejsza zieleń */
.schedule-wrap {
  border-radius: 14px;
  overflow-x: auto;
  overflow-y: clip;
}

.schedule-wrap.scroll-active {
  max-height: 620px;
  overflow: auto;
  border-radius: 14px;
}

.schedule-table tbody tr,
.schedule-table tbody td,
.schedule-table tbody th {
  background: #e8f2ec;
}

/* v0.1.0.7 — jaśniejsze tło harmonogramu + kolumna miesięcy */
.schedule-table thead th:nth-child(3),
.schedule-table tbody td:nth-child(3) {
  font-weight: 800;
}

.schedule-table thead th:nth-child(4),
.schedule-table tbody td:nth-child(4) {
  color: #166534;
}

.schedule-table thead th:nth-child(5),
.schedule-table tbody td:nth-child(5) {
  color: #b91c1c;
}

.schedule-table thead th:nth-child(7),
.schedule-table tbody td:nth-child(7) {
  color: #166534;
  font-weight: 800;
}

.schedule-table tbody tr,
.schedule-table tbody td,
.schedule-table tbody th {
  background: #f1f7f3;
}

/* v0.1.0.8 — korekta wyglądu kolumn harmonogramu */
.schedule-table thead th:nth-child(2),
.schedule-table tbody td:nth-child(2) {
  font-weight: 400;
  color: #0f172a;
}

.schedule-table thead th:nth-child(3),
.schedule-table tbody td:nth-child(3) {
  font-weight: 800;
  color: #0f172a;
}

.schedule-table thead th:nth-child(5),
.schedule-table tbody td:nth-child(5) {
  color: #dc2626;
}

.schedule-table thead th:nth-child(6),
.schedule-table tbody td:nth-child(6) {
  color: #1d4ed8;
  font-weight: 800;
}

/* v0.1.0.9 — banner hero + pogrubiony nagłówek „Miesiąc” */
.hero.hero-image {
  background: transparent;
  padding: 0;
  display: block;
  overflow: hidden;
}

.hero-banner {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.schedule-table thead th:nth-child(2) {
  font-weight: 800;
  color: #0f172a;
}

.schedule-table tbody td:nth-child(2) {
  font-weight: 400;
  color: #0f172a;
}

@media (max-width: 680px) {
  .hero-banner {
    border-radius: 16px;
  }
}

/* v0.1.1.0 — szablony + wydruk harmonogramu */
.template-button {
  background: #0f766e;
  color: #fff;
  box-shadow: 0 8px 20px rgba(15,118,110,.18);
}

.template-button:hover { background: #0b665f; }

.print-button {
  background: #0f172a;
  color: #fff;
}

.print-button:hover { background: #1e293b; }

.schedule-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

body.modal-open { overflow: hidden; }
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 18px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.58); backdrop-filter: blur(4px); }
.modal-card {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 24px 70px rgba(15,23,42,.26);
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.modal-head h2 { margin: 3px 0 0; font-size: 23px; }
.modal-close { border: 0; background: #f1f5f9; color: #334155; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; font-size: 26px; line-height: 1; }
.template-load-actions, .template-save-box { display: flex; gap: 10px; align-items: end; margin-top: 14px; }
.template-save-box .field { flex: 1; }
.template-divider { height: 1px; background: #e5e7eb; margin: 22px 0; }
.button.danger { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }
.button.danger:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.template-message { min-height: 20px; margin: 14px 0 0; color: #166534; font-size: 13px; font-weight: 750; }
.template-message.error { color: #b91c1c; }
.template-help { margin: 7px 0 0; color: var(--muted); font-size: 12px; }

@media (max-width: 680px) {
  .template-load-actions, .template-save-box, .schedule-actions { align-items: stretch; flex-direction: column; }
  .template-load-actions .button, .template-save-box .button, .schedule-actions .button { width: 100%; }
}

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body { background: #fff !important; }
  .app-shell { width: 100% !important; margin: 0 !important; }
  .hero, .form-panel, .summary-grid, .comparison-panel, footer { display: none !important; }
  #results { opacity: 1 !important; }
  .schedule-panel {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  .schedule-select, .schedule-actions, .schedule-note { display: none !important; }
  .schedule-toolbar { margin: 0 0 10px !important; min-height: 0 !important; }
  .schedule-wrap, .schedule-wrap.scroll-active {
    max-height: none !important;
    overflow: visible !important;
    border-radius: 10px !important;
  }
  .schedule-table { min-width: 0 !important; font-size: 10px; }
  .schedule-table thead { position: static !important; }
  .schedule-table thead { display: table-header-group; }
  .schedule-table tr { break-inside: avoid; page-break-inside: avoid; }
  .schedule-table th, .schedule-table td { padding: 7px 8px !important; }
}

/* v0.1.1.1 — ikony interfejsu */
.title-with-icon,
.label-with-icon,
.btn-content {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.title-with-icon {
  gap: 12px;
}

.label-with-icon {
  gap: 8px;
}

.btn-content {
  gap: 9px;
  justify-content: center;
}

.ui-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.title-with-icon .ui-icon {
  width: 20px;
  height: 20px;
  flex-basis: 20px;
  color: currentColor;
}

.summary-label .ui-icon {
  width: 16px;
  height: 16px;
  flex-basis: 16px;
}

.summary-card.lower .summary-label .ui-icon {
  color: var(--accent);
}

.summary-card.shorter .summary-label .ui-icon {
  color: var(--accent-2);
}

.summary-card.baseline .summary-label .ui-icon {
  color: #475569;
}

.button .ui-icon {
  width: 17px;
  height: 17px;
  flex-basis: 17px;
}

.modal-close:hover {
  background: #e2e8f0;
}

@media (max-width: 680px) {
  .title-with-icon { align-items: flex-start; }
  .btn-content { width: 100%; }
}

@media print {
  .btn-content .ui-icon,
  .title-with-icon .ui-icon {
    display: none !important;
  }
}

/* v0.1.1.2 — globalne skalowanie interfejsu do 80% */
html {
  zoom: 0.8;
}

body {
  min-height: 100vh;
}

@media print {
  html {
    zoom: 1;
  }
}
