:root {
  --ink: #172033;
  --muted: #667085;
  --soft: #f6f8fb;
  --line: #e6eaf0;
  --panel: #ffffff;
  --navy: #0b1736;
  --navy-2: #15274f;
  --blue: #2f6fed;
  --blue-soft: #eef4ff;
  --green: #138a5b;
  --green-soft: #eaf8f1;
  --amber: #b56b00;
  --amber-soft: #fff5df;
  --danger: #b42318;
  --shadow: 0 16px 38px rgba(16, 24, 40, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--soft);
  font-size: 16px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid rgba(47, 111, 237, 0.35);
  outline-offset: 2px;
}
.skip-link {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--navy);
}
.skip-link:focus { top: 12px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, var(--navy), #091128 78%);
  color: #fff;
  padding: 26px 18px 22px;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #fff;
  color: var(--navy);
  font-weight: 800;
  font-size: 20px;
}
.brand strong { display: block; font-size: 18px; }
.brand span { display: block; color: #aebbd7; font-size: 14px; margin-top: 2px; }
.nav-list { display: grid; gap: 7px; }
.nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: #c8d2e7;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  text-align: left;
  transition: .18s ease;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.is-active { background: rgba(255,255,255,.11); color: #fff; font-weight: 700; }
.nav-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .7; }
.sidebar-footer { margin-top: auto; padding: 16px 8px 0; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar-footer p { color: #aebbd7; font-size: 14px; line-height: 1.55; }
.mode-chip {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  font-size: 14px;
  color: #e8edf8;
}
.link-button { padding: 8px 10px; border: 1px solid rgba(255,255,255,.18); border-radius: 8px; background: #142342; color: #fff; text-decoration: underline; font-size: 14px; }
.main-content { min-width: 0; padding: 30px clamp(22px, 3.4vw, 54px) 48px; }
.topbar { display: flex; justify-content: space-between; gap: 24px; align-items: center; margin-bottom: 28px; }
.topbar h1 { margin: 3px 0 0; font-size: clamp(24px, 3vw, 36px); line-height: 1.2; letter-spacing: -0.025em; }
.eyebrow, .section-label { color: var(--muted); font-size: 14px; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
.eyebrow { margin: 0; }
.topbar-status { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--green); white-space: nowrap; }
.status-light { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(19,138,91,.1); }
.topbar-status[data-persistence="pending"] { color: #8a5b00; }
.topbar-status[data-persistence="pending"] .status-light { background: #d78b00; box-shadow: 0 0 0 5px rgba(215,139,0,.12); }
.topbar-status[data-persistence="error"] { color: #b42318; }
.topbar-status[data-persistence="error"] .status-light { background: #d92d20; box-shadow: 0 0 0 5px rgba(217,45,32,.12); }
.mobile-menu { display: none; border: 0; background: #fff; border-radius: 10px; padding: 9px 11px; box-shadow: var(--shadow); }
.view { animation: appear .2s ease; }
.view[hidden] { display: none !important; }
@keyframes appear { from { opacity: .25; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.goal-hero {
  border-radius: 24px;
  padding: clamp(22px, 3vw, 34px);
  background: linear-gradient(135deg, #ffffff 0%, #f2f6ff 100%);
  border: 1px solid #dfe7f6;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 28px;
  box-shadow: var(--shadow);
}
.goal-value-row { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin: 6px 0 16px; }
.goal-value { font-size: clamp(34px, 5vw, 54px); letter-spacing: -0.04em; line-height: 1; }
.progress-badge { background: var(--green-soft); color: var(--green); padding: 5px 10px; border-radius: 999px; font-weight: 800; font-size: 14px; }
.progress-track { width: 100%; height: 9px; border-radius: 999px; background: #e8edf5; overflow: hidden; }
.progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), #5a8cf0); transition: width .25s ease; }
.goal-summary { color: var(--muted); margin: 11px 0 0; }
.forecast-card { border-left: 1px solid var(--line); padding-left: 26px; display: flex; flex-direction: column; justify-content: center; }
.forecast-card span { color: var(--muted); font-size: 14px; }
.forecast-card strong { font-size: 26px; margin-top: 4px; }
.forecast-card p { margin: 8px 0 1px; font-weight: 700; }
.forecast-card p span { color: var(--green); font-size: inherit; }
.forecast-card small { color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 16px; }
.metric-card, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.metric-card { padding: 19px; min-height: 132px; }
.metric-card span { display: block; color: var(--muted); font-size: 14px; }
.metric-card strong { display: block; margin: 8px 0 8px; font-size: clamp(20px, 2.2vw, 27px); letter-spacing: -.02em; }
.metric-card small { color: var(--muted); line-height: 1.4; }
.work-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 16px; margin-top: 16px; }
.panel { padding: 24px; }
.panel-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.panel-header.compact { margin-bottom: 14px; }
.panel h2 { margin: 4px 0 0; font-size: 21px; letter-spacing: -.02em; }
.time-used { color: var(--muted); font-size: 14px; white-space: nowrap; }
.time-options { display: flex; flex-wrap: wrap; gap: 9px; margin: 20px 0 16px; }
.time-option { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 10px 14px; border-radius: 10px; font-weight: 700; }
.time-option:hover { border-color: #b8c6e4; }
.time-option.is-selected { background: var(--navy); border-color: var(--navy); color: #fff; }
.recommendation-box { background: var(--blue-soft); color: #244477; border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 12px; }
.task-list { display: grid; gap: 10px; }
.task-card { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 12px; align-items: start; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.task-card.is-done { opacity: .62; background: #f9fafb; }
.task-index { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); font-weight: 800; }
.task-copy { min-width: 0; }
.task-copy strong { display: block; font-size: 15px; }
.task-copy p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.task-meta { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 7px; }
.task-meta span { font-size: 14px; background: #f3f5f8; border-radius: 999px; padding: 4px 7px; color: #4f5d73; }
.task-actions { grid-column: 2; display: flex; flex-wrap: wrap; gap: 7px; min-width: 0; }
.task-button { border: 1px solid var(--line); background: #fff; padding: 8px 10px; border-radius: 9px; color: var(--navy); font-weight: 700; font-size: 14px; }
.task-button.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.empty-state { padding: 20px; border: 1px dashed #c9d2df; border-radius: 12px; color: var(--muted); text-align: center; }
.ai-actions { display: grid; gap: 12px; }
.ai-action { display: grid; grid-template-columns: 10px 1fr; gap: 11px; align-items: start; }
.ai-action-dot { margin-top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.ai-action strong { display: block; font-size: 14px; }
.ai-action p { margin: 3px 0 0; color: var(--muted); font-size: 14px; }
.insight-panel { margin-top: 16px; display: grid; grid-template-columns: 42px 1fr; gap: 14px; align-items: start; background: linear-gradient(135deg, #0b1736, #172a57); color: #fff; border: none; }
.insight-panel .section-label { color: #9fb0d4; }
.insight-panel p { color: #d8dfef; margin-bottom: 0; }
.insight-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: rgba(255,255,255,.11); font-weight: 900; }
.page-intro { max-width: 760px; margin: 4px 0 24px; }
.page-intro h2 { font-size: clamp(26px, 3.5vw, 38px); line-height: 1.18; margin: 7px 0 10px; letter-spacing: -.03em; }
.page-intro p { color: var(--muted); font-size: 16px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.detail-card { min-height: 166px; }
.detail-number { display: block; font-size: 30px; margin: 10px 0; }
.detail-card p { color: var(--muted); margin: 0; }
.scenario-panel { margin-top: 14px; }
.scenario-list { margin-top: 18px; display: grid; gap: 8px; }
.scenario-list > div { display: flex; justify-content: space-between; gap: 14px; padding: 12px 14px; border-radius: 11px; background: #f7f8fa; }
.scenario-list > div span { color: var(--muted); }
.scenario-list .is-recommended { background: var(--green-soft); color: #075e3c; }
.scenario-list .is-recommended span { color: #2c7457; }
.audit-summary { margin-bottom: 14px; }
.audit-score { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.audit-score strong { font-size: 34px; }
.audit-score span { color: var(--muted); }
.audit-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.audit-item { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 17px; display: flex; gap: 12px; }
.audit-status { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 9px; display: grid; place-items: center; font-weight: 900; }
.audit-status.confirmed { color: var(--green); background: var(--green-soft); }
.audit-status.missing { color: var(--amber); background: var(--amber-soft); }
.audit-item strong { display: block; }
.audit-item p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.team-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.team-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.avatar { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); font-weight: 900; margin-bottom: 12px; }
.team-card h3 { margin: 0; font-size: 17px; }
.team-card p { margin: 4px 0 13px; color: var(--muted); font-size: 14px; }
.team-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.team-tags span { background: #f3f5f8; border-radius: 999px; padding: 5px 8px; font-size: 14px; }
.report-grid { display: grid; grid-template-columns: 1.6fr repeat(3, minmax(150px, .7fr)); gap: 14px; }
.report-main { min-height: 190px; }
.report-main h2 { font-size: 24px; margin: 8px 0 10px; }
.report-main p, .report-card p, .next-week p { color: var(--muted); }
.report-card span { color: var(--muted); font-size: 14px; }
.report-card strong { display: block; font-size: 22px; margin: 10px 0 4px; }
.report-card p { font-size: 14px; margin: 0; }
.next-week { margin-top: 14px; }
.onboarding { position: fixed; inset: 0; z-index: 80; background: rgba(5, 12, 28, .62); display: grid; place-items: center; padding: 20px; }
.onboarding[hidden] { display: none; }
.onboarding-card { width: min(620px, 100%); background: #fff; border-radius: 24px; padding: clamp(24px, 4vw, 38px); box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.onboarding-card h2 { font-size: clamp(28px, 4vw, 38px); line-height: 1.18; margin: 7px 0 10px; }
.onboarding-card > p { color: var(--muted); }
.onboarding-card label { display: block; font-weight: 800; font-size: 14px; margin: 16px 0 7px; }
.onboarding-card input { width: 100%; border: 1px solid #cfd6e2; border-radius: 12px; padding: 12px 13px; color: var(--ink); background: #fff; }
.money-input { display: flex; align-items: center; border: 1px solid #cfd6e2; border-radius: 12px; overflow: hidden; }
.money-input input { border: 0; border-radius: 0; }
.money-input span { color: var(--muted); padding: 0 14px; font-weight: 800; }
.onboarding-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.primary-button, .secondary-button { border-radius: 11px; padding: 11px 15px; font-weight: 800; }
.primary-button { border: 1px solid var(--blue); background: var(--blue); color: #fff; }
.secondary-button { border: 1px solid var(--line); background: #fff; color: var(--ink); }


/* Przy stałym sidebarze efektywna szerokość raportu jest mniejsza od viewportu.
   Dwie kolumny chronią krótkie podsumowania przed łamaniem słów na laptopach. */
@media (min-width: 621px) and (max-width: 1480px) {
  .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-main { grid-column: 1 / -1; }
}

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .report-grid { grid-template-columns: repeat(2, 1fr); }
  .report-main { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; width: min(82vw, 290px); transform: translateX(-104%); transition: transform .22s ease; box-shadow: 20px 0 60px rgba(0,0,0,.2); }
  .sidebar.is-open { transform: translateX(0); }
  .main-content { padding: 20px 18px 40px; }
  .mobile-menu { display: inline-block; }
  .topbar { align-items: flex-start; }
  .topbar-status { display: none; }
  .goal-hero, .work-layout { grid-template-columns: 1fr; }
  .forecast-card { border-left: 0; border-top: 1px solid var(--line); padding: 20px 0 0; }
  .team-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .topbar h1 { font-size: 25px; }
  .metric-grid, .audit-list, .team-grid, .report-grid { grid-template-columns: 1fr; }
  .goal-hero, .panel { padding: 18px; }
  .metric-card { min-height: auto; }
  .panel-header { display: block; }
  .time-used { display: block; margin-top: 6px; }
  .task-card { grid-template-columns: 34px 1fr; }
  .task-actions { grid-column: 2; }
  .scenario-list > div { display: grid; }
  .onboarding-actions { flex-direction: column-reverse; }
  .onboarding-actions button { width: 100%; }
}


/* Najwęższe wspierane telefony (320 px): wszystkie treści i sterowniki
   kurczą się w obrębie panelu zamiast poszerzać cały dokument. */
@media (max-width: 360px) {
  .main-content {
    padding-left: 12px;
    padding-right: 12px;
  }

  .view,
  .view > *,
  .panel,
  .panel-header > *,
  .goal-hero,
  .task-card,
  .task-copy,
  .task-actions,
  .day-loop-status,
  .day-loop-status > div,
  .priority-now,
  .priority-now > *,
  .owner-plan-source,
  .ai-mandate-panel,
  .ai-mandate-grid,
  .ai-mandate-row,
  .ai-mandate-copy {
    min-width: 0;
    max-width: 100%;
  }

  .time-used,
  .safe-badge,
  .prepared-chip,
  .task-button,
  .day-loop-next,
  .priority-now__cta,
  .ai-mandate-row select {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .time-used,
  .task-meta span,
  .owner-plan-source,
  .priority-now__reason,
  .ai-mandate-copy,
  .ai-mandate-note {
    overflow-wrap: anywhere;
  }
}


/* sidebar-legal-v1 */
.sidebar-legal{display:flex;flex-wrap:wrap;gap:6px 10px;margin-top:14px;padding-top:13px;border-top:1px solid rgba(255,255,255,.1)}
.sidebar-legal a{padding:0 8px;border-radius:8px;background:#132653;color:#fff;font-size:14px;text-decoration:none}
.sidebar-legal a:hover,.sidebar-legal a:focus-visible{color:#fff;text-decoration:underline}


/* P0 #646: czytelność i cele dotykowe */
small {
  font-size: 14px;
}

button,
a[href],
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  min-height: 44px;
}

button,
a[href] {
  min-width: 44px;
}

a[href] {
  display: inline-flex;
  align-items: center;
}

.constraint-box label:has(input[type="checkbox"]),
.constraint-box label:has(input[type="radio"]) {
  display: flex;
  align-items: center;
  min-height: 44px;
}
