:root{
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e6e8ef;

  --accent: #e11d48;        /* czerwony akcent */
  --accent-weak: rgba(225,29,72,.12);
  --accent-weak2: rgba(225,29,72,.06);

  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
  --radius: 16px;
  --c-saldo:   #f5b301; /* złoto */
  --c-wydatki: #ef4444; /* czerwony */
  --c-wplaty:  #22c55e; /* zielony */
  --c-gielda:  #6366f1; /* indigo / rynek */
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar{
  display:flex;
  gap:12px;
  justify-content:space-between;
  align-items:center;
  padding:16px 18px;
  border-bottom:1px solid var(--line);
  background: rgba(255,255,255,.75);
  position: sticky;
  top:0;
  backdrop-filter: blur(10px);
}

.title{
  display:flex;
  align-items:center;
  gap:10px;
}
.label{
  color: var(--muted);
  font-weight:600;
}

#startDate{
  padding:10px 12px;
  border-radius: 12px;
  border:1px solid var(--line);
  background: white;
  color: var(--text);
}

.actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

/* Buttons */
.btn{
  padding:10px 12px;
  border-radius: 12px;
  border:1px solid var(--line);
  background: white;
  color: var(--text);
  cursor:pointer;
  transition: transform .04s ease, box-shadow .12s ease, border-color .12s ease;
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
}
.btn:hover{
  border-color: rgba(225,29,72,.35);
  box-shadow: 0 6px 18px rgba(15,23,42,.08);
}
.btn:active{ transform: translateY(1px); }
.btn.small{ padding:8px 10px; font-size: 13px; }

.btn.primary{
  border-color: rgba(225,29,72,.35);
  background: linear-gradient(180deg, rgba(225,29,72,.14), rgba(225,29,72,.06));
}
.btn.danger{
  border-color: rgba(225,29,72,.35);
  color: var(--accent);
  background: rgba(225,29,72,.06);
}
.btn.danger:hover{
  background: rgba(225,29,72,.10);
}

/* Card */
.card{
  background: var(--card);
  border:1px solid var(--line);
  border-radius: var(--radius);
  overflow:hidden;
  box-shadow: var(--shadow);
}

.cardHeader{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px 14px;
  border-bottom:1px solid var(--line);
}

.cardHeader h2{
  margin:0;
  font-size: 15px;
  letter-spacing: .2px;
}

/* Collapsible header */
.collapseBtn{
  display:flex;
  align-items:center;
  gap:10px;
  width:100%;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
}
.collapseBtn:focus{ outline: none; }
.chev{
  width: 26px;
  height: 26px;
  border-radius: 10px;
  border:1px solid var(--line);
  display:grid;
  place-items:center;
  color: var(--accent);
  background: rgba(225,29,72,.06);
}
.card.collapsed .chev{
  transform: rotate(-90deg);
}

.hint{
  margin: 10px 14px 14px;
  color: var(--muted);
  font-size: 12px;
}

/* Table */
.t{
  width:100%;
  border-collapse: collapse;
}
.t thead th{
  padding:10px 12px;
  text-align:left;
  font-weight:800;
  font-size: 13px;
  color: var(--muted);
  background: #fafafa;
  border-bottom: 1px solid var(--line);
}
.t td{
  padding:10px 12px;
  border-bottom:1px solid var(--line);
  font-size: 13px;
}
.t .num{ text-align:right; }
.key{ font-weight:700; }

.t tbody tr:hover td{
  background: rgba(15,23,42,.02);
}

/* Total row */
.totalRow td{
  background: var(--accent-weak2) !important;
  font-weight: 900;
  border-top: 2px solid rgba(225,29,72,.22);
}

/* Inputs */
.money, .text{
  width: 100%;
  padding:8px 10px;
  border-radius: 12px;
  border:1px solid var(--line);
  background: white;
  color: var(--text);
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.money{
  text-align:right;
  font-variant-numeric: tabular-nums;
}
.money:focus, .text:focus{
  border-color: rgba(225,29,72,.45);
  box-shadow: 0 0 0 4px rgba(225,29,72,.12);
}

/* Collapsible body animation */
.collapsible{
  overflow: hidden;
  max-height: 2000px;
  transition: max-height .25s ease, opacity .2s ease;
  opacity: 1;
}
.card.collapsed .collapsible{
  max-height: 0;
  opacity: 0;
}

/* Responsive */
@media (max-width: 1200px){
  .grid{ grid-template-columns: 1fr; }
}

.headerRight{
  display:flex;
  align-items:center;
  gap:10px;
}

.rollupBadge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid var(--line);
  font-size:12px;
  color:#344054;
  background:#fff;
}

.rollupList{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top:12px;
}

.rollupRow{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
}

.rollupRow input{
  width:18px;
  height:18px;
}

.rollupName{
  flex:1;
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius: 999px;
  border:1px solid var(--line);
  background: rgba(225,29,72,.06);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
}
.pill span{
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.pill.strong{
  background: rgba(225,29,72,.10);
  border-color: rgba(225,29,72,.18);
}

.footerRow td{
  padding: 12px;
  background: #fafafa;
}

.btn.full{
  width: 100%;
  justify-content: center;
}

.iconBtn{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border:1px solid var(--line);
  background: white;
  cursor: pointer;
  font-weight: 900;
  color: var(--accent);
  display: grid;
  place-items: center;
  transition: background .12s ease, border-color .12s ease, transform .04s ease;
}
.iconBtn:hover{
  border-color: rgba(225,29,72,.35);
  background: rgba(225,29,72,.06);
}
.iconBtn:active{ transform: translateY(1px); }

.iconBtn.danger{
  color: var(--accent);
  background: rgba(225,29,72,.06);
  border-color: rgba(225,29,72,.20);
}

/* pewniak na overlay */
.t td { position: relative; }
.t input { position: relative; z-index: 1; pointer-events: auto; }
.rowActions { position: relative; z-index: 2; pointer-events: auto; }

/* jeśli gdzieś przypadkiem masz pointer-events:none, to to ratuje */
.collapsible { pointer-events: auto; }

/* ===== Pill colors ===== */
.card.saldo   .pill{
  background: rgba(245,179,1,.12);
  border-color: rgba(245,179,1,.35);
}
.card.saldo   .pill span{ color: var(--c-saldo); }

.card.wydatki .pill{
  background: rgba(239,68,68,.12);
  border-color: rgba(239,68,68,.35);
}
.card.wydatki .pill span{ color: var(--c-wydatki); }

.card.wplaty  .pill{
  background: rgba(34,197,94,.12);
  border-color: rgba(34,197,94,.35);
}
.card.wplaty  .pill span{ color: var(--c-wplaty); }

.card.gielda  .pill{
  background: rgba(99,102,241,.12);
  border-color: rgba(99,102,241,.35);
}
.card.gielda  .pill span{ color: var(--c-gielda); }

.card.saldo td.num{
  color: var(--c-saldo);
  font-weight: 700;
}

.card.wydatki td.num{
  color: var(--c-wydatki);
}

.card.wplaty td.num{
  color: var(--c-wplaty);
}

.card.gielda td.num{
  color: var(--c-gielda);
}

.negative{
  color: #dc2626 !important;
}

.hidden{ display:none !important; }

:root{
  --accent: #ef4444;
  --accent2: #fb7185;
  --ink: #0f172a;
  --muted: #64748b;
  --card: #ffffff;
  --bg: #f6f7fb;
  --border: #e6e8f0;
  --shadow: 0 12px 40px rgba(15, 23, 42, .08);
}

body{ background: var(--bg); }

/* HERO */
.hero{
  max-width: 1180px;
  margin: 24px auto 10px;
  padding: 0 18px;
}

.brand{
  display:flex;
  align-items:center;
  gap:14px;
}

.brandMark{
  width:46px;
  height:46px;
  border-radius: 14px;
  display:grid;
  place-items:center;
  font-weight: 900;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 12px 30px rgba(239,68,68,.25);
}

.brandTitle{
  margin:0;
  font-size: 28px;
  letter-spacing: .5px;
  color: var(--ink);
}

.brandSubtitle{
  margin:2px 0 0;
  color: var(--muted);
}

/* AUTH CARD */
.authCard{
  max-width: 1180px;
  margin: 10px auto 18px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.authTop{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 14px;
}

.authTitle{ margin:0; font-size: 18px; color: var(--ink); }
.authHint{ margin:6px 0 0; color: var(--muted); }

.authBody{ margin-top: 14px; }

.pillTabs{
  display:flex;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px;
  width: fit-content;
  background: white;
}

.pillTab{
  border: 0;
  background: white;
  color: var(--ink);
  font-weight: 800;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
}

.pillTab.active{
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  box-shadow: 0 12px 30px rgba(239,68,68,.18);
}

.authForm{ margin-top: 16px; max-width: 520px; }
.field{ display:block; margin: 10px 0; }
.field span{ display:block; font-weight: 800; color: var(--ink); margin-bottom: 6px; }

.input{
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
  background: white;
}

.input:focus{
  border-color: rgba(239,68,68,.45);
  box-shadow: 0 0 0 5px rgba(239,68,68,.12);
}

.authMsg{ margin:10px 2px 0; color: var(--muted); }
.authMsg.error{ color: #b91c1c; }
.authMsg.ok{ color: #166534; }

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 18px 40px;
}

.appHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 18px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(16,24,40,0.06);
  border: 1px solid #eef0f6;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 260px;
}

.logoPicker {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: #ffe8eb;
  border: 1px solid #ffd0d8;
  display: grid;
  place-items: center;
  cursor: pointer;
  overflow: hidden;
}

.brandLogo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none; /* pokażemy po uploadzie */
}

.brandLogoFallback {
  font-weight: 800;
  color: #e11d48;
}

.brandText .brandName {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.3px;
  line-height: 1.1;
}

.brandText .brandTagline {
  margin-top: 2px;
  font-size: 14px;
  color: #667085;
}

.headerTools {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.dateBox .label {
  font-size: 12px;
  color: #667085;
  margin-bottom: 6px;
}

.dateBox input[type="date"],
.dateBox input[type="month"] {
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid #e6e8f0;
  background: #fff;
}

.dateHint{
  margin-top:6px;
  font-size:12px;
  color:#667085;
  max-width: 220px;
}

@media (max-width: 820px) {
  .appHeader {
    flex-direction: column;
    align-items: stretch;
  }
  .headerTools {
    justify-content: space-between;
  }
}

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 18px 40px;
}

.cardsGrid {
  display: grid;
  gap: 18px;
  align-items: start;
}

/* Desktop: 4 kolumny */
@media (min-width: 1200px) {
  .cardsGrid {
    grid-template-columns: repeat(4, minmax(260px, 1fr));
  }
}

/* Tablet: 2 kolumny */
@media (min-width: 760px) and (max-width: 1199px) {
  .cardsGrid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}

/* Mobile: 1 kolumna */
@media (max-width: 759px) {
  .cardsGrid {
    grid-template-columns: 1fr;
  }
}

/* ===============================
   CARDS GRID – TWARDY UKŁAD
   =============================== */

.cardsGrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* MAX 4 NA RZĄD */
  gap: 18px;
  align-items: start;
  width: 100%;
}

/* Tablet – 2 kolumny */
@media (max-width: 1199px) {
  .cardsGrid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile – 1 kolumna */
@media (max-width: 759px) {
  .cardsGrid {
    grid-template-columns: 1fr;
  }
}

.logoBox{
  width: 46px;
  height: 46px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border, #e6e8f0);
  background: #fff;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.brandLogo{
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* ===== HERO / LANDING (DIVU-like) ===== */

.landing{
  position: relative;
  overflow: hidden;
  background: #fff;
}

/* delikatny overlay żeby tekst był czytelny */
.landing::after{
  content:"";
  position:absolute;
  inset:0;
  background: linear-gradient(
    180deg,
    rgba(255,255,255,.92) 0%,
    rgba(255,255,255,.85) 35%,
    rgba(246,247,251,1) 100%
  );
}

/* kontent hero */
.heroInner{
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 18px 26px;
  min-height: 460px; /* PROPORCJA – tu jest klucz */
  display: grid;
  align-items: center;
}

.heroGrid{
  display: grid;
  grid-template-columns: 1fr 420px; /* lewo: brand, prawo: login */
  gap: 28px;
  align-items: center;
}

/* Brand block */
.heroBrand{
  text-align: left;            /* przestaje wyglądać jak plakat na środku */
  max-width: 640px;
}

.heroLogo{
  width: 64px;
  height: 64px;
  object-fit: contain;
  display: block;
  margin-bottom: 16px;
}

.heroTitle{
  margin: 0;
  font-size: clamp(34px, 4vw, 52px);
  letter-spacing: .3px;
}

.heroTagline{
  margin: 8px 0 0;
  color: rgba(15,23,42,.75);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: 12px;
}

.heroSub{
  margin: 14px 0 0;
  font-size: clamp(18px, 2.2vw, 26px);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(15,23,42,.70);
}

/* Auth card in hero */
.authCardHero{
  margin: 0;
  max-width: 420px;
  width: 100%;
  justify-self: end;
  border-radius: 22px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(230,232,240,.9);
  box-shadow: 0 18px 60px rgba(15,23,42,.12);
}

/* Responsywność */
@media (max-width: 980px){
  .heroInner{ min-height: unset; padding: 26px 14px 18px; }
  .heroGrid{ grid-template-columns: 1fr; }
  .heroBrand{ text-align: center; margin: 0 auto; }
  .heroLogo{ margin: 0 auto 14px; }
  .authCardHero{ justify-self: center; max-width: 520px; }
}

.how{
  background: var(--bg);
  padding: 18px 18px 40px;
}

.howInner{
  max-width: 1120px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.howTitle{
  margin: 2px 0 14px;
  font-size: 20px;
  letter-spacing: .2px;
}

.howGrid{
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.howCard{
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(15,23,42,.02), rgba(255,255,255,1));
}

.howCard h4{
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--ink);
}

.howCard p{
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

@media (max-width: 900px){
  .how{ padding: 14px 14px 34px; }
  .howGrid{ grid-template-columns: 1fr; }
}

/* ===== Feedback section ===== */

.feedback{
  background: #ffffff;
  padding: 40px 18px;
}

.feedbackInner{
  max-width: 820px;
  margin: 0 auto;
  text-align: center;
}

.feedbackTitle{
  margin: 0;
  font-size: 22px;
  color: var(--ink);
}

.feedbackText{
  margin: 12px auto 22px;
  max-width: 620px;
  color: var(--muted);
  line-height: 1.6;
}

.feedbackBtn{
  display: inline-flex;
  padding: 12px 26px;
  border-radius: 999px;
  background: #ef4444; /* bez gradientu */
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(239,68,68,.20);
  transition: background .15s ease, box-shadow .15s ease;
}

.feedbackBtn:hover{
  background: #dc2626; /* ciemniejsza czerwień */
  box-shadow: 0 8px 18px rgba(239,68,68,.24);
}

/* ===== Footer ===== */

.siteFooter{
  background: #fafafa; /* inny odcień bieli niż tło strony */
  border-top: 1px solid rgba(239,68,68,.35); /* czerwonawa ramka */
  padding: 26px 18px;
}

.footerInner{
  max-width: 1120px;
  margin: 0 auto;
  text-align: center;
  font-size: 13px;
  color: #475569; /* spokojny grafit */
}

.footerCopy{
  margin: 0 0 6px;
}

.footerLinks{
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.footerLinks a{
  color: #1f2937;
  text-decoration: none;
}

.footerLinks a:hover{
  color: #ef4444;
  text-decoration: underline;
}

html, body { height: 100%; }

body{
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* wrapper na całą zawartość strony (landing + app) */
#page{
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* =========================
Modale + banner
========================= */
.toolbar{
display:flex;
gap:10px;
flex-wrap:wrap;
align-items:center;
}

.banner{
margin: 0 18px 16px;
padding: 12px 14px;
border-radius: 16px;
border: 1px solid rgba(239,68,68,.25);
background: rgba(239,68,68,.06);
display:flex;
gap:12px;
align-items:center;
justify-content: space-between;
}

.bannerText{
display:flex;
gap:10px;
align-items: baseline;
flex-wrap: wrap;
}

.bannerText strong{ color: #b91c1c; }
.bannerActions{ display:flex; gap:10px; align-items:center; }
.bannerMsg{ color: rgba(15,23,42,.75); font-size: 13px; margin-left: 6px; }

.modalOverlay{
position: fixed;
inset: 0;
background: rgba(15,23,42,.55);
display: grid;
place-items: center;
z-index: 9999;
padding: 22px;
}

.modal{
width: min(680px, 100%);
background: #fff;
border-radius: 18px;
border: 1px solid rgba(230,232,240,.9);
box-shadow: 0 18px 60px rgba(15,23,42,.25);
overflow: hidden;
}

.modalHeader{
padding: 14px 14px;
border-bottom: 1px solid rgba(230,232,240,.9);
display:flex;
align-items:center;
justify-content: space-between;
gap: 10px;
}

.modalHeader h3{
margin:0;
font-size: 16px;
}

.modalBody{ padding: 14px; }
.modalFooter{
padding: 14px;
border-top: 1px solid rgba(230,232,240,.9);
display:flex;
gap: 10px;
justify-content: flex-end;
flex-wrap: wrap;
}

.modalClose{
width: 36px;
height: 36px;
border-radius: 12px;
border: 1px solid rgba(230,232,240,.9);
background: #fff;
cursor: pointer;
font-weight: 900;
}

.modalClose:hover{ background: rgba(239,68,68,.06); }

/* ===== Charts MVP ===== */
.card.charts{
  margin-top: 18px;
}

.chartsGrid{
  display:grid;
  gap:12px;
  padding:12px;
}

@media (min-width: 820px) {
  .chartsGrid{
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.chartBox h3{
  margin:0 0 8px;
  font-size:14px;
}

.chartCanvas{
  width:100%;
  height:220px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
}

.pillDot{
  width:10px;
  height:10px;
  border-radius:999px;
  display:inline-block;
  flex-shrink:0;
}
