* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: linear-gradient(145deg, #0f1419 0%, #1a2332 50%, #0d1117 100%);
  color: #e6edf3;
  min-height: 100vh;
  padding: 1.5rem;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

button {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.container {
  max-width: 560px;
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 0.25rem 0;
  letter-spacing: -0.02em;
}

.subtitle {
  color: #8b949e;
  font-size: 0.95rem;
  margin: 0 0 0.75rem 0;
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1rem;
  margin-top: 0.5rem;
  width: 100%;
}

.usd-pln {
  font-size: 0.9rem;
  color: #7ee787;
  background: rgba(126, 231, 135, 0.1);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  display: inline-block;
}

.nbp-note {
  font-size: 0.8rem;
  color: #6e7681;
  margin-left: 0.25rem;
}

.currency-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  flex: 1;
}

.currency-selector label {
  color: #8b949e;
  font-weight: 500;
  white-space: nowrap;
}

.currency-selector select {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #e6edf3;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.currency-selector select option {
  background: #1a1f26;
  color: #e6edf3;
}

.currency-selector select option:checked {
  background: #7ee787;
  color: #0d1117;
}

.currency-selector select:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.currency-selector select:focus {
  outline: none;
  border-color: #7ee787;
}

.live-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7ee787;
  background: rgba(126, 231, 135, 0.15);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.5rem;
  vertical-align: middle;
  animation: live-pulse 2s ease-in-out infinite;
}

.live-badge.hidden {
  display: none;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.ws-status {
  font-size: 0.8rem;
  color: #8b949e;
}

.ws-status.hidden {
  display: none;
}

.ws-status.connected {
  color: #7ee787;
}

.ws-status.error {
  color: #f85149;
}

.portfolio-total {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.portfolio-total h2 {
  font-size: 0.9rem;
  font-weight: 500;
  color: #8b949e;
  margin: 0 0 0.5rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.total-value {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
  color: #fff;
}

.total-delta {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  min-height: 1.4em;
}

.total-delta.up {
  color: #3fb950;
}

.total-delta.down {
  color: #f85149;
}

/* Podsumowanie wpłat i wypłat */
.transactions-summary-section {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.transactions-summary-section h2 {
  font-size: 0.9rem;
  font-weight: 500;
  color: #8b949e;
  margin: 0 0 1rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.transactions-summary-filters {
  margin-bottom: 1.5rem;
}

.date-range-inputs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  align-items: flex-end;
}

.date-range-inputs label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.date-range-inputs input[type="date"] {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #e6edf3;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  width: 100%;
}

.date-range-inputs input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
}

.summary-reset-btn {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #8b949e;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  user-select: none;
  width: 100%;
  height: fit-content;
}

.summary-reset-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #79c0ff;
  color: #79c0ff;
}

.transactions-summary-display {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.summary-stat {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}

.summary-stat-label {
  display: block;
  font-size: 0.85rem;
  color: #8b949e;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: #e6edf3;
}

.summary-stat-value.deposits {
  color: #3fb950;
}

.summary-stat-value.withdrawals {
  color: #f85149;
}

.summary-stat.total {
  grid-column: 1 / -1;
  background: rgba(255, 255, 255, 0.06);
}

.tax-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tax-section h3 {
  font-size: 0.9rem;
  font-weight: 500;
  color: #8b949e;
  margin: 0 0 1rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tax-info {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tax-status,
.tax-amount {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
}

.tax-label {
  font-size: 0.9rem;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tax-message {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e6edf3;
}

.tax-message.has-tax {
  color: #f85149;
}

.tax-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: #f85149;
}

.total-delta.unchanged {
  color: #8b949e;
}

.last-update {
  font-size: 0.8rem;
  color: #6e7681;
  margin: 0;
}

.active-signals-section {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.active-signals-hidden {
  display: none;
}

.active-signals-section h2 {
  font-size: 0.9rem;
  font-weight: 500;
  color: #8b949e;
  margin: 0 0 1rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#active-signals {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.signals-empty {
  color: #6e7681;
  font-size: 0.95rem;
  margin: 0;
  padding: 1rem 0;
  text-align: center;
}

.signal-card {
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid;
  border-radius: 8px;
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.signal-card.signal-up {
  border-left-color: #3fb950;
  background: rgba(63, 185, 80, 0.08);
}

.signal-card.signal-down {
  border-left-color: #f85149;
  background: rgba(248, 81, 73, 0.08);
}

.signal-symbol {
  font-weight: 700;
  font-size: 1rem;
  color: #e6edf3;
  min-width: 3rem;
}

.signal-name {
  color: #8b949e;
  font-size: 0.85rem;
}

.signal-price {
  color: #e6edf3;
  font-weight: 600;
}

.signal-active {
  color: #ffc933;
  font-weight: 700;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.holding-scenarios {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.scenarios-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.scenario-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border-left: 2px solid;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  position: relative;
}

.scenario-display-mode {
  cursor: pointer;
  transition: background 0.15s;
}

.scenario-display-mode:hover {
  background: rgba(255, 255, 255, 0.05);
}

.scenario-display {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.scenario-name {
  font-weight: 500;
  color: #c9d1d9;
  flex: 0 0 auto;
}

.scenario-price {
  color: #8b949e;
  font-size: 0.8rem;
  flex: 0 0 auto;
}

.scenario-value {
  font-weight: 600;
  color: #e6edf3;
  flex: 1;
  text-align: right !important;
}

.scenario-pct {
  font-weight: 600;
  flex: 0 0 auto;
  text-align: right !important;
  min-width: 60px;
}

.scenario-edit-mode {
  display: none;
  gap: 0.5rem;
  align-items: center;
  flex: 1;
}

.scenario-edit-mode input {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 4px;
  color: #c9d1d9;
  font-size: 0.85rem;
  padding: 0.4rem;
  font-family: inherit;
}

.scenario-edit-mode input:focus {
  border-color: #79c0ff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(121, 192, 255, 0.1);
}

.scenario-edit-name {
  flex: 1;
  min-width: 120px;
}

.scenario-edit-price {
  width: 100px;
}

.scenario-row.scenario-row-up {
  border-left-color: #3fb950;
}

.scenario-row.scenario-row-down {
  border-left-color: #f85149;
}

.scenario-row.scenario-active {
  background: rgba(255, 193, 51, 0.1);
  border-left-color: #ffc933;
  animation: pulse-border 1.5s ease-in-out infinite;
}

@keyframes pulse-border {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.scenario-save-btn,
.scenario-cancel-btn {
  padding: 0.3rem 0.6rem;
  border: 1px solid #30363d;
  border-radius: 4px;
  background: transparent;
  color: #c9d1d9;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  transition: all 0.2s;
  white-space: nowrap;
}

.scenario-save-btn {
  background: rgba(63, 185, 80, 0.15);
  border-color: #3fb950;
  color: #3fb950;
}

.scenario-save-btn:hover {
  background: rgba(63, 185, 80, 0.25);
}

.scenario-cancel-btn {
  background: rgba(248, 81, 73, 0.15);
  border-color: #f85149;
  color: #f85149;
}

.scenario-cancel-btn:hover {
  background: rgba(248, 81, 73, 0.25);
}

.scenario-remove-btn {
  background: transparent;
  border: none;
  color: #f85149;
  font-size: 1.1rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  transition: color 0.2s;
  flex-shrink: 0;
  margin-left: auto;
}

.scenario-remove-btn:hover {
  color: #ff6b61;
}

.scenario-row.scenario-row-up .scenario-value {
  color: #3fb950;
}

.scenario-row.scenario-row-down .scenario-value {
  color: #f85149;
}

.scenario-row.scenario-row-up .scenario-pct {
  color: #3fb950;
}

.scenario-row.scenario-row-down .scenario-pct {
  color: #f85149;
}

.scenario-badge-active {
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255, 193, 51, 0.2);
  color: #ffc933;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  white-space: nowrap;
  animation: pulse 1s ease-in-out infinite;
}

.scenario-add-btn {
  background: transparent;
  border: 1px dashed rgba(126, 231, 135, 0.3);
  color: #7ee787;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  margin-top: 0.5rem;
}

.scenario-add-btn:hover {
  border-color: #7ee787;
  background: rgba(126, 231, 135, 0.08);
}


.holdings h2 {
  font-size: 0.9rem;
  font-weight: 500;
  color: #8b949e;
  margin: 0 0 1rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#holdings-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.holding-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 0.2s, background 0.2s;
}

.holding-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.holding-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.holding-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}

.holding-symbol {
  font-weight: 600;
  font-size: 1.05rem;
}

.holding-details {
  font-size: 0.85rem;
  color: #8b949e;
}

.holding-delta-pct {
  font-weight: 600;
  white-space: nowrap;
}

.holding-delta-pct.up {
  color: #3fb950;
}

.holding-delta-pct.down {
  color: #f85149;
}

.holding-delta-pct.unchanged {
  color: #8b949e;
}

.holding-value-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}

.holding-value {
  font-weight: 600;
  font-size: 1.1rem;
  color: #7ee787;
}

.holding-value.loading {
  color: #6e7681;
}

.holding-price-delta-pct {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.holding-price-delta-pct.up {
  color: #3fb950;
}

.holding-price-delta-pct.down {
  color: #f85149;
}

.holding-price-delta-pct.unchanged {
  color: #8b949e;
}

/* Posiadane aktywa */
.holdings {
  margin-bottom: 0.75rem;
}

/* Dodaj aktywo – sekcja collapsible */
.add-holding-section {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 0.75rem;
}

.add-holding-section h2 {
  margin: 0;
  font-size: 1.05rem;
  color: #c9d1d9;
}

.add-holding-section h2[role="button"] {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  user-select: none;
  transition: color 0.2s;
}

.add-holding-section h2[role="button"]:hover {
  color: #79c0ff;
}

.add-holding-section h2[role="button"]::after {
  content: '▼';
  font-size: 0.8rem;
  transition: transform 0.3s ease;
  transform: rotate(0deg);
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.add-holding-collapsed h2[role="button"]::after {
  transform: rotate(-90deg);
}

.add-holding-collapsed .add-holding {
  display: none;
}

/* Edytor */
.add-holding {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.add-holding h3 {
  font-size: 0.9rem;
  font-weight: 500;
  color: #8b949e;
  margin: 0 0 0.75rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
}

.add-form input[type="text"],
.add-form input[type="number"] {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #e6edf3;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  min-width: 0;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.add-form input[type="text"] {
  flex: 1;
  min-width: 120px;
}

.add-form input[type="number"] {
  flex: 1;
  min-width: 100px;
}

.add-form input::placeholder {
  color: #6e7681;
}

.add-form input:focus {
  outline: none;
  border-color: #7ee787;
  box-shadow: 0 0 0 2px rgba(126, 231, 135, 0.2);
}

.add-form button {
  background: #7ee787;
  color: #0d1117;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.add-form button:hover {
  background: #6bdb74;
}

.add-form button:active {
  transform: scale(0.98);
}

.holding-card-editor {
  /* Dziedziczy flex-direction: column z .holding-card */
}

.holding-card-editor .holding-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.holding-card-editor .holding-info {
  flex: 1;
  min-width: 0;
}

.holding-card-editor .holding-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

.holding-card-editor .holding-scenarios {
  width: 100%;
}

.holding-edit {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.holding-edit-label {
  font-size: 0.8rem;
  color: #6e7681;
  flex: 0 0 auto;
}

.holding-amount-display {
  color: #c9d1d9;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  transition: background 0.15s;
}

.holding-amount-display:hover {
  background: rgba(121, 192, 255, 0.15);
}

.holding-amount-edit {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.holding-amount-edit input {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 4px;
  color: #c9d1d9;
  padding: 0.3rem 0.5rem;
  font-size: 0.9rem;
  font-family: inherit;
  width: 135px;
}

.holding-amount-edit input:focus {
  border-color: #79c0ff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(121, 192, 255, 0.1);
}

.holding-amount-input,
.holding-target-ath-input,
.holding-target-growth-input,
.holding-target-floor-input,
.holding-target-down-mid-input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #e6edf3;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.holding-amount-input {
  min-width: 100px;
  flex: 0 1 auto;
}

.holding-target-ath-input,
.holding-target-growth-input,
.holding-target-floor-input,
.holding-target-down-mid-input {
  width: 100%;
}

.holding-amount-input:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.holding-amount-input:focus,
.holding-target-ath-input:focus,
.holding-target-growth-input:focus,
.holding-target-floor-input:focus,
.holding-target-down-mid-input:focus {
  outline: none;
  border-color: #7ee787;
}

.holding-edit.editing {
  background: rgba(121, 192, 255, 0.08);
  padding: 0.75rem;
  border: 1px solid #30363d;
  border-radius: 4px;
  gap: 0.5rem;
}

.holding-edit.editing .holding-amount-input {
  background: #0d1117;
  border: 1px solid #30363d;
  color: #c9d1d9;
  cursor: text;
  flex: 0 0 auto;
  width: 120px;
}

.holding-edit.editing .holding-amount-input:hover {
  background: #0d1117;
  border-color: #30363d;
}

.holding-save-btn,
.holding-cancel-btn {
  padding: 0.35rem 0.75rem;
  border: 1px solid #30363d;
  border-radius: 4px;
  background: transparent;
  color: #c9d1d9;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  transition: all 0.2s;
  white-space: nowrap;
}

.holding-save-btn {
  background: rgba(63, 185, 80, 0.15);
  border-color: #3fb950;
  color: #3fb950;
}

.holding-save-btn:hover {
  background: rgba(63, 185, 80, 0.25);
}

.holding-cancel-btn {
  background: rgba(248, 81, 73, 0.15);
  border-color: #f85149;
  color: #f85149;
}

.holding-cancel-btn:hover {
  background: rgba(248, 81, 73, 0.25);
}

.btn-remove {
  background: transparent;
  border: 1px solid rgba(248, 81, 73, 0.4);
  color: #f85149;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-remove:hover {
  background: rgba(248, 81, 73, 0.15);
  border-color: #f85149;
}

.holdings-empty {
  color: #6e7681;
  font-size: 0.95rem;
  margin: 0;
  padding: 1rem 0;
}

/* Edytor – widok mobilny (tylko body.page-editor), większe litery i elementy */
@media (max-width: 768px) {
  body.page-editor {
    padding: 0.5rem;
    font-size: 1.0625rem;
  }

  body.page-editor .container {
    max-width: 100%;
  }

  body.page-editor header {
    margin-bottom: 1.25rem;
  }

  body.page-editor h1 {
    font-size: 1.75rem;
    line-height: 1.35;
    margin-bottom: 0.25rem;
  }

  body.page-editor .subtitle {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }

  body.page-editor .header-meta {
    flex-direction: column;
    gap: 0.9rem;
    margin-top: 0.85rem;
  }

  body.page-editor .currency-selector {
    width: 100%;
    flex: 1;
  }

  body.page-editor .currency-selector select {
    flex: 1;
  }

  body.page-editor .usd-pln {
    font-size: 1.1rem;
    padding: 0.6rem 1rem;
  }

  body.page-editor .nbp-note {
    font-size: 0.95rem;
    display: block;
    margin-left: 0;
    margin-top: 0.3rem;
  }

  body.page-editor .currency-selector {
    font-size: 1rem;
    gap: 0.65rem;
  }

  body.page-editor .currency-selector label {
    font-size: 1.05rem;
  }

  body.page-editor .currency-selector select {
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
  }

  body.page-editor .ws-status {
    font-size: 1rem;
  }

  body.page-editor .live-badge {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
  }

  body.page-editor .portfolio-total {
    padding: 1.5rem 1.25rem;
    margin-bottom: 1.5rem;
  }

  body.page-editor .portfolio-total h2 {
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
  }

  body.page-editor .total-value {
    font-size: 2.75rem;
    margin-bottom: 0.4rem;
  }

  body.page-editor .total-delta {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    min-height: 1.6em;
  }

  body.page-editor .last-update {
    font-size: 0.95rem;
  }

  body.page-editor .transactions-summary-section {
    padding: 1.5rem 1.25rem;
    margin-bottom: 1.5rem;
  }

  body.page-editor .transactions-summary-section h2 {
    font-size: 0.95rem;
    margin-bottom: 1.2rem;
  }

  body.page-editor .date-range-inputs {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }

  body.page-editor .date-range-inputs label {
    width: 100%;
  }

  body.page-editor .date-range-inputs input[type="date"],
  body.page-editor .summary-reset-btn {
    width: 100%;
    padding: 0.7rem 0.9rem;
    font-size: 1rem;
  }

  body.page-editor .transactions-summary-display {
    gap: 1.2rem;
  }

  body.page-editor .summary-stat {
    padding: 1.2rem 1rem;
  }

  body.page-editor .summary-stat-value {
    font-size: 1.8rem;
  }

  body.page-editor .tax-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
  }

  body.page-editor .tax-section h3 {
    font-size: 0.95rem;
    margin-bottom: 1rem;
  }

  body.page-editor .tax-status,
  body.page-editor .tax-amount {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 1rem;
  }

  body.page-editor .tax-message,
  body.page-editor .tax-value {
    font-size: 1.2rem;
  }

  body.page-editor .active-signals-section {
    padding: 1.5rem 1.25rem;
    margin-bottom: 1.5rem;
  }

  body.page-editor .active-signals-section h2 {
    font-size: 0.95rem;
    margin-bottom: 0.9rem;
  }

  body.page-editor .signal-card {
    padding: 1rem 1.2rem;
    font-size: 1rem;
    gap: 0.9rem;
    flex-wrap: wrap;
  }

  body.page-editor .signal-symbol {
    flex: 0 0 auto;
  }

  body.page-editor .signal-name {
    flex: 1;
    min-width: 100px;
  }

  body.page-editor .signal-price {
    flex: 1;
    min-width: 120px;
  }

  body.page-editor .signal-active {
    flex-basis: 100%;
    margin-top: 0.5rem;
  }

  body.page-editor .signal-symbol {
    font-size: 1.1rem;
  }

  body.page-editor .holding-scenarios {
    margin-top: 1rem;
    padding-top: 1rem;
  }

  body.page-editor .scenarios-header {
    font-size: 0.9rem;
    margin-bottom: 0.65rem;
  }

  body.page-editor .scenario-row {
    padding: 0.75rem 0.9rem;
    font-size: 0.95rem;
    gap: 0.65rem;
    margin-bottom: 0.65rem;
    display: grid;
    grid-template-columns: 1.4fr 0.6fr;
    grid-template-rows: auto auto auto;
    align-items: start;
  }

  body.page-editor .scenario-name-input {
    padding: 0.5rem 0.65rem;
    font-size: 0.95rem;
    grid-column: 1;
    grid-row: 1;
    width: 100%;
  }

  body.page-editor .scenario-price-input {
    padding: 0.5rem 0.65rem;
    font-size: 0.95rem;
    grid-column: 1;
    grid-row: 2;
    width: 100%;
  }

  body.page-editor .scenario-value {
    font-size: 1.3rem;
    font-weight: 600;
    text-align: right;
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    color: #c9d1d9;
  }

  body.page-editor .scenario-pct {
    font-size: 1rem;
    text-align: right;
    grid-column: 2;
    grid-row: 2;
    align-self: start;
  }

  body.page-editor .scenario-badge-active {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  body.page-editor .scenario-remove-btn {
    padding: 0.4rem 0.5rem;
    grid-column: 1 / -1;
    grid-row: 4;
    align-self: start;
    margin-top: 0.5rem;
  }

  body.page-editor .scenario-add-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    margin-top: 0.65rem;
  }

  body.page-editor .holdings h2 {
    font-size: 0.95rem;
    margin-bottom: 0.85rem;
  }

  body.page-editor #holdings-list {
    gap: 1.15rem;
  }

  body.page-editor .holding-card-editor {
    padding: 1.4rem 1.2rem;
    gap: 1.1rem;
    flex-direction: column;
    align-items: stretch;
  }

  body.page-editor .holding-header {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    justify-content: space-between;
    align-items: flex-start;
  }

  body.page-editor .holding-card-editor .holding-info {
    min-width: 0;
  }

  body.page-editor .holding-symbol {
    font-size: 1.35rem;
  }

  body.page-editor .holding-details {
    font-size: 1.1rem;
  }

  body.page-editor .holding-value {
    font-size: 1.45rem;
  }

  body.page-editor .holding-price-delta-pct {
    font-size: 0.9rem;
  }

  body.page-editor .holding-targets {
    font-size: 0.9rem;
    margin-top: 0.7rem;
    gap: 0.35rem;
  }

  body.page-editor .holding-card-editor .holding-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 0.5rem;
    padding-top: 0;
    border-top: none;
    order: unset;
    flex-shrink: 0;
  }

  body.page-editor .holding-edit {
    margin-top: 0.9rem;
    gap: 0.7rem;
    flex-direction: column;
    align-items: stretch;
  }

  body.page-editor .holding-edit-label {
    font-size: 1rem;
  }

  body.page-editor .holding-amount-display {
    font-size: 1.05rem;
    padding: 0.4rem 0.6rem;
  }

  body.page-editor .holding-amount-edit {
    gap: 0.6rem;
  }

  body.page-editor .holding-amount-edit input {
    font-size: 1.05rem;
    padding: 0.5rem 0.7rem;
    width: 169px;
  }

  body.page-editor .holding-amount-input,
  body.page-editor .holding-target-ath-input,
  body.page-editor .holding-target-growth-input,
  body.page-editor .holding-target-floor-input,
  body.page-editor .holding-target-down-mid-input {
    font-size: 1.125rem;
    padding: 0.6rem 0.75rem;
    width: 100%;
    min-height: 48px;
  }

  body.page-editor .btn-remove {
    font-size: 1.05rem;
    padding: 0.6rem 1.1rem;
    min-height: 48px;
    min-width: 88px;
  }

  body.page-editor .add-holding-section {
    padding: 1.2rem 1rem;
    margin-bottom: 0.75rem;
  }

  body.page-editor .add-holding-section h2 {
    font-size: 1.1rem;
  }

  body.page-editor .add-holding {
    margin-top: 0;
    padding-top: 0;
  }

  body.page-editor .add-holding h3 {
    font-size: 1.05rem;
    margin-bottom: 0.85rem;
  }

  body.page-editor .add-form {
    flex-direction: column;
    align-items: stretch;
    gap: 0.9rem;
  }

  body.page-editor .add-form input[type="text"],
  body.page-editor .add-form input[type="number"] {
    width: 100%;
    max-width: none;
    font-size: 1.125rem;
    padding: 0.7rem 1rem;
    min-height: 48px;
  }

  body.page-editor .add-form button {
    font-size: 1.1rem;
    padding: 0.75rem 1.35rem;
    min-height: 52px;
  }

  body.page-editor .holdings-empty {
    font-size: 1.15rem;
    padding: 1.35rem 0;
  }

  body.page-editor .error-msg {
    font-size: 1.05rem;
    padding: 0.9rem 1.1rem;
  }

  body.page-editor footer {
    font-size: 0.95rem;
    margin-top: 1.75rem;
  }

  body.page-editor footer a {
    display: inline-block;
    padding: 0.3rem 0;
  }
}

  body.page-editor .transaction-inputs {
    flex-direction: column;
  }

  body.page-editor .transaction-inputs input,
  body.page-editor .transaction-inputs select {
    width: 100%;
  }

  body.page-editor .transaction-item {
    padding: 0.85rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  body.page-editor .transaction-amount {
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
  }

  body.page-editor .transaction-amount .amount {
    min-width: auto;
    text-align: right;
  }

  body.page-editor .transactions-summary-box {
    grid-template-columns: 1fr;
  }

  body.page-editor .summary-item.total {
    grid-column: 1;
  }

  body.page-editor .transaction-add-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  body.page-editor .transaction-add-buttons {
    width: 100%;
    flex-direction: column;
  }

  body.page-editor .import-csv-label,
  body.page-editor .clear-transactions-btn {
    width: 100%;
    justify-content: center;
    padding: 0.6rem;
    font-size: 0.95rem;
  }

/* Edytor – małe telefony (≤480px), jeszcze większe elementy */
@media (max-width: 480px) {
  body.page-editor {
    font-size: 1.1rem;
    padding: 0.5rem;
  }

  body.page-editor h1 {
    font-size: 1.9rem;
  }

  body.page-editor .subtitle {
    font-size: 1.05rem;
  }

  body.page-editor .portfolio-scenarios {
    padding: 1.5rem 1.25rem;
    margin-bottom: 1.5rem;
  }

  body.page-editor .portfolio-scenarios h2 {
    font-size: 1rem;
    margin-bottom: 1rem;
  }

  body.page-editor .scenarios-grid {
    grid-template-columns: 1fr;
    gap: 1.1rem;
  }

  body.page-editor .scenario-card {
    padding: 1.3rem;
  }

  body.page-editor .scenario-title {
    font-size: 0.95rem;
    margin-bottom: 0.7rem;
  }

  body.page-editor .scenario-value {
    font-size: 1.75rem;
    margin-bottom: 0.7rem;
  }

  body.page-editor .scenario-delta {
    font-size: 0.9rem;
  }

  body.page-editor .holding-targets-row {
    grid-template-columns: 1fr 1fr;
  }

  body.page-editor .holding-targets {
    font-size: 0.85rem;
    margin-top: 0.8rem;
    gap: 0.3rem;
  }

  body.page-editor .target-row {
    gap: 0.4rem;
  }

  body.page-editor .usd-pln {
    font-size: 1.15rem;
    padding: 0.65rem 1.1rem;
  }

  body.page-editor .nbp-note {
    font-size: 1rem;
  }

  body.page-editor .currency-selector {
    font-size: 1.05rem;
  }

  body.page-editor .currency-selector select {
    padding: 0.55rem 0.8rem;
    font-size: 1.05rem;
  }

  body.page-editor .total-value {
    font-size: 3rem;
  }

  body.page-editor .total-delta {
    font-size: 1.3rem;
  }

  body.page-editor .last-update {
    font-size: 1rem;
  }

  body.page-editor .holdings h2,
  body.page-editor .portfolio-total h2,
  body.page-editor .transactions-summary-section h2,
  body.page-editor .active-signals-section h2 {
    font-size: 1rem;
  }

  body.page-editor .transactions-summary-section {
    padding: 1.5rem 1.25rem;
    margin-bottom: 1.5rem;
  }

  body.page-editor .transactions-summary-display {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  body.page-editor .summary-stat {
    padding: 0.75rem 0.6rem;
  }

  body.page-editor .summary-stat-label {
    font-size: 0.75rem;
    margin-bottom: 0.3rem;
  }

  body.page-editor .summary-stat-value {
    font-size: 1.3rem;
  }

  body.page-editor .summary-stat.total {
    margin-top: 0.5rem;
  }

  body.page-editor .active-signals-section {
    padding: 1.5rem 1.25rem;
    margin-bottom: 1.5rem;
  }

  body.page-editor #active-signals {
    gap: 1.2rem;
  }

  body.page-editor .signal-card {
    padding: 1.4rem;
    font-size: 1.05rem;
    gap: 1rem;
    flex-wrap: wrap;
  }

  body.page-editor .signal-symbol {
    flex: 0 0 auto;
  }

  body.page-editor .signal-name {
    flex: 1;
    min-width: 100px;
  }

  body.page-editor .signal-price {
    flex: 1;
    min-width: 120px;
  }

  body.page-editor .signal-active {
    flex-basis: 100%;
    margin-top: 0.6rem;
  }

  body.page-editor .signal-symbol {
    font-size: 1.3rem;
    min-width: 4.5rem;
  }

  body.page-editor .signal-name {
    font-size: 1rem;
  }

  body.page-editor .signal-active {
    font-size: 1rem;
  }

  /* Holding card na mobile - zmiana na 2-kolumnowy layout */
  body.page-editor .holding-card-editor {
    flex-direction: column;
    padding: 1rem 1rem;
    gap: 1rem;
  }

  body.page-editor .holding-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    width: 100%;
  }

  body.page-editor .holding-info {
    display: flex;
    flex-direction: row;
    gap: 0.8rem;
    align-items: center;
    flex-wrap: wrap;
  }

  body.page-editor .holding-symbol {
    font-size: 1.15rem;
    font-weight: 600;
  }

  body.page-editor .holding-details {
    font-size: 0.9rem;
    color: #8b949e;
  }

  body.page-editor .holding-edit {
    display: flex;
    align-items: center;
    gap: 0.4rem;
  }

  body.page-editor .holding-edit-label {
    font-size: 0.8rem;
    flex-shrink: 0;
  }

  body.page-editor .holding-amount-display {
    font-size: 0.95rem;
    padding: 0.25rem 0.4rem;
  }

  body.page-editor .holding-amount-edit {
    gap: 0.3rem;
  }

  body.page-editor .holding-amount-edit input {
    font-size: 0.9rem;
    padding: 0.3rem 0.5rem;
    width: 118px;
  }

  body.page-editor .holding-save-btn,
  body.page-editor .holding-cancel-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
  }

  body.page-editor .holding-amount-input {
    flex: 1;
    min-width: 60px;
    padding: 0.35rem;
    font-size: 0.9rem;
  }

  body.page-editor .holding-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 0.4rem;
    padding-top: 0 !important;
    border-top: none !important;
    order: unset !important;
    flex-shrink: 0;
  }

  body.page-editor .holding-value-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
  }

  body.page-editor .holding-value {
    font-size: 1.15rem;
    font-weight: 600;
    color: #c9d1d9;
  }

  body.page-editor .holding-price-delta-pct {
    font-size: 0.8rem;
    font-weight: 600;
  }

  body.page-editor .btn-remove {
    padding: 0.4rem 0.8rem;
    margin-top: 0.3rem;
    font-size: 0.85rem;
  }

  body.page-editor .holding-scenarios {
    margin-top: 1.2rem;
    padding-top: 1.2rem;
  }

  body.page-editor .scenarios-header {
    font-size: 1rem;
    margin-bottom: 0.8rem;
  }

  body.page-editor .scenario-add-btn {
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    margin-top: 0.8rem;
  }

  body.page-editor .holding-symbol {
    font-size: 1.45rem;
  }

  body.page-editor .holding-details {
    font-size: 1.15rem;
  }

  body.page-editor .holding-value {
    font-size: 1.55rem;
  }

  body.page-editor .holding-price-delta-pct {
    font-size: 0.95rem;
  }

  body.page-editor .holding-targets {
    font-size: 0.95rem;
  }

  body.page-editor .holding-amount-input,
  body.page-editor .holding-target-ath-input,
  body.page-editor .holding-target-growth-input,
  body.page-editor .holding-target-floor-input,
  body.page-editor .holding-target-down-mid-input {
    font-size: 1.2rem;
    min-height: 52px;
    padding: 0.7rem 0.85rem;
  }

  body.page-editor .holding-edit-label {
    font-size: 1.05rem;
  }

  body.page-editor .btn-remove {
    font-size: 1.1rem;
    min-height: 52px;
    min-width: 96px;
    padding: 0.65rem 1.2rem;
  }

  body.page-editor .add-holding h3 {
    font-size: 1.1rem;
  }

  body.page-editor .add-form input[type="text"],
  body.page-editor .add-form input[type="number"] {
    font-size: 1.2rem;
    min-height: 52px;
    padding: 0.75rem 1.1rem;
  }

  body.page-editor .add-form button {
    font-size: 1.15rem;
    min-height: 54px;
    padding: 0.8rem 1.4rem;
  }

  body.page-editor .holdings-empty {
    font-size: 1.2rem;
  }

  body.page-editor .error-msg {
    font-size: 1.1rem;
    padding: 1rem 1.2rem;
  }

  body.page-editor footer {
    font-size: 1rem;
  }
}

/* Straty z lat poprzednich */
.previous-losses-section {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 0.75rem;
}

.previous-losses-section h2 {
  margin: 0;
  font-size: 1.05rem;
  color: #c9d1d9;
}

.previous-losses-section h2[role="button"] {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  user-select: none;
  transition: color 0.2s;
}

.previous-losses-section h2[role="button"]:hover {
  color: #79c0ff;
}

.previous-losses-section h2[role="button"]::after {
  content: '▼';
  font-size: 0.8rem;
  transition: transform 0.3s ease;
  transform: rotate(0deg);
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.previous-losses-collapsed h2[role="button"]::after {
  transform: rotate(-90deg);
}

.previous-losses-collapsed .previous-losses-content {
  display: none;
}

.previous-losses-content {
  margin-top: 1rem;
}

.losses-add {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #21262d;
}

.losses-add h3 {
  font-size: 0.95rem;
  color: #8b949e;
  margin: 0 0 0.75rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.losses-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.losses-inputs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.losses-inputs input,
.losses-inputs select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #e6edf3;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  flex: 1;
  min-width: 100px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  font-family: inherit;
}

.losses-inputs select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e6edf3' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.losses-inputs input::placeholder {
  color: #6e7681;
}

.losses-inputs select option {
  background: #1a1f26;
  color: #e6edf3;
}

.losses-form button {
  background: #7ee787;
  color: #0d1117;
  border: none;
  border-radius: 6px;
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}

.losses-form button:hover {
  background: #6bdb74;
}

.losses-list {
  margin-top: 1rem;
}

.losses-list-empty {
  color: #6e7681;
  font-size: 0.95rem;
  padding: 1rem 0;
}

.loss-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: #161b22;
  border-bottom: 1px solid #21262d;
}

.loss-item:last-child {
  border-bottom: none;
}

.loss-item-details {
  display: flex;
  gap: 1.5rem;
  flex: 1;
}

.loss-item-amount {
  font-weight: 600;
  color: #f85149;
}

.loss-item-year {
  color: #8b949e;
  font-size: 0.9rem;
}

.loss-remove-btn {
  background: transparent;
  border: none;
  color: #f85149;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.25rem 0.5rem;
  transition: all 0.2s;
  font-family: inherit;
}

.loss-remove-btn:hover {
  color: #ffaaaa;
}

/* Transactions section – wpłaty i wypłaty */
.transactions {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 0.75rem;
}

.transactions h2 {
  margin: 0 0 1rem 0;
  font-size: 1.05rem;
  color: #c9d1d9;
}

.transactions h2[role="button"] {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  user-select: none;
  transition: color 0.2s;
}

.transactions h2[role="button"]:hover {
  color: #79c0ff;
}

.transactions h2[role="button"]::after {
  content: '▼';
  font-size: 0.8rem;
  transition: transform 0.3s ease;
  transform: rotate(0deg);
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.transactions-collapsed h2[role="button"]::after {
  transform: rotate(-90deg);
}

.transactions-collapsed #transactions-list,
.transactions-collapsed #transactions-summary,
.transactions-collapsed .transaction-add,
.transactions-collapsed .transaction-search {
  display: none;
}

.transaction-add {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #21262d;
}

.transaction-add-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.transaction-add h3 {
  font-size: 0.95rem;
  color: #8b949e;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.import-csv-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  background: transparent;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #79c0ff;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  text-transform: capitalize;
}

.import-csv-label:hover {
  background: rgba(121, 192, 255, 0.1);
  border-color: #79c0ff;
}

.transaction-add-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.clear-transactions-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  background: transparent;
  border: 1px solid #f85149;
  border-radius: 6px;
  color: #f85149;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  font-family: inherit;
}

.clear-transactions-btn:hover {
  background: rgba(248, 81, 73, 0.1);
  border-color: #f85149;
}

.clear-transactions-btn:active {
  background: rgba(248, 81, 73, 0.2);
}

.transaction-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.transaction-type {
  display: flex;
  gap: 1rem;
}

.transaction-type label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: #c9d1d9;
  font-size: 0.95rem;
}

.transaction-type input[type="radio"] {
  cursor: pointer;
  accent-color: #7ee787;
}

.transaction-inputs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.transaction-inputs input,
.transaction-inputs select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #e6edf3;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  flex: 1;
  min-width: 100px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.transaction-inputs input[type="datetime-local"] {
  background: rgba(255, 255, 255, 0.06);
  color: #e6edf3;
}

.transaction-inputs input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

.transaction-inputs select option {
  background: #1a1f26;
  color: #e6edf3;
}

.transaction-inputs select option:checked {
  background: #7ee787;
  color: #0d1117;
}

.transaction-inputs input::placeholder {
  color: #6e7681;
}

.transaction-form button {
  background: #7ee787;
  color: #0d1117;
  border: none;
  border-radius: 6px;
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.transaction-form button:hover {
  background: #6bdb74;
}

.transaction-search {
  margin-bottom: 1rem;
}

#transaction-search {
  width: 100%;
  padding: 0.75rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #c9d1d9;
  font-size: 1rem;
  font-family: inherit;
  box-sizing: border-box;
}

#transaction-search::placeholder {
  color: #6e7681;
}

#transaction-search:focus {
  border-color: #79c0ff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(121, 192, 255, 0.1);
}

#transactions-list {
  margin-bottom: 1rem;
}

.transactions-empty {
  color: #6e7681;
  font-size: 0.95rem;
  text-align: center;
  padding: 1rem;
  margin: 0;
}

.transaction-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid #21262d;
  transition: background 0.15s;
}

.transaction-item:last-child {
  border-bottom: none;
}

/* Tryb edycji - zmień layout na kolumnowy */
.transaction-item.editing {
  flex-direction: column;
  align-items: stretch;
}

.transaction-item.transaction-deposit {
  background: rgba(63, 185, 80, 0.05);
}

.transaction-item.transaction-withdrawal {
  background: rgba(248, 81, 73, 0.05);
}

.transaction-info {
  display: flex;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.transaction-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.transaction-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.transaction-timestamp {
  color: #c9d1d9;
  font-size: 0.9rem;
  font-weight: 600;
}

.transaction-description {
  color: #8b949e;
  font-size: 0.85rem;
}

.transaction-amount {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1rem;
}

.transaction-amount .amount {
  color: #c9d1d9;
  font-weight: 600;
  font-size: 0.95rem;
  min-width: 120px;
  text-align: right;
}

.transaction-item.transaction-deposit .amount {
  color: #3fb950;
}

.transaction-item.transaction-withdrawal .amount {
  color: #f85149;
}

.transaction-remove-btn {
  background: transparent;
  border: none;
  color: #f85149;
  font-size: 1.1rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.transaction-remove-btn:hover {
  color: #ff6b61;
}

/* Tryb edycji transakcji */
.edit-field {
  cursor: pointer;
  position: relative;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  transition: background 0.15s;
}

.edit-field:hover {
  background: rgba(121, 192, 255, 0.15);
}

.transaction-edit-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem;
  background: rgba(121, 192, 255, 0.08);
  border: 1px solid #30363d;
  border-radius: 4px;
  align-items: flex-start;
}

.transaction-edit-mode input,
.transaction-edit-mode select {
  padding: 0.4rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 4px;
  color: #c9d1d9;
  font-size: 0.9rem;
  font-family: inherit;
}

.transaction-edit-mode input::placeholder {
  color: #6e7681;
}

.transaction-edit-mode input:focus,
.transaction-edit-mode select:focus {
  border-color: #79c0ff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(121, 192, 255, 0.1);
}

/* Linia 1: Data i Kwota (48% każda z gapem) */
.transaction-edit-mode .edit-datetime {
  flex: 0 1 calc(50% - 0.25rem);
}

.transaction-edit-mode .edit-amount {
  flex: 0 1 calc(50% - 0.25rem);
}

/* Linia 2: Waluta i Opis (48% każda z gapem) */
.transaction-edit-mode .edit-currency {
  flex: 0 1 calc(50% - 0.25rem);
}

.transaction-edit-mode .edit-description {
  flex: 0 1 calc(50% - 0.25rem);
}

/* Linia 3: Guziki */
.transaction-save-btn {
  flex: 0 1 calc(50% - 0.25rem);
  padding: 0.4rem 0.8rem;
  border: 1px solid #3fb950;
  border-radius: 4px;
  background: rgba(63, 185, 80, 0.15);
  color: #3fb950;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  transition: all 0.2s;
}

.transaction-save-btn:hover {
  background: rgba(63, 185, 80, 0.25);
}

.transaction-cancel-btn {
  flex: 0 1 calc(50% - 0.25rem);
  padding: 0.4rem 0.8rem;
  border: 1px solid #f85149;
  border-radius: 4px;
  background: rgba(248, 81, 73, 0.15);
  color: #f85149;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  transition: all 0.2s;
}

.transaction-cancel-btn:hover {
  background: rgba(248, 81, 73, 0.25);
}

.transactions-summary-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.summary-item.total {
  grid-column: 1 / -1;
  border-top: 1px solid #21262d;
  padding-top: 1rem;
}

.summary-label {
  color: #8b949e;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.summary-value {
  color: #c9d1d9;
  font-size: 1.1rem;
  font-weight: 600;
}

.summary-value.deposit {
  color: #3fb950;
}

.summary-value.withdrawal {
  color: #f85149;
}

/* Tools section – JSON export/import + history */
.tools-section {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.tools-section h2 {
  margin: 0 0 1rem 0;
  font-size: 1.05rem;
  color: #c9d1d9;
}

.tools-section h2[role="button"] {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  user-select: none;
  transition: color 0.2s;
  margin: 0;
}

.tools-section h2[role="button"]:hover {
  color: #79c0ff;
}

.tools-section h2[role="button"]::after {
  content: '▼';
  font-size: 0.8rem;
  transition: transform 0.3s ease;
  transform: rotate(0deg);
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.tools-section-collapsed h2[role="button"]::after {
  transform: rotate(-90deg);
}

.tools-section-collapsed .tools-toolbar,
.tools-section-collapsed #history-list {
  display: none;
}

.tools-toolbar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.tools-btn {
  background: transparent;
  border: 1px solid #30363d;
  color: #79c0ff;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}

.tools-btn:hover {
  border-color: #79c0ff;
  background: rgba(121, 192, 255, 0.1);
}

.tools-btn-save {
  background: transparent;
  border: 1px solid #238636;
  color: #3fb950;
}

.tools-btn-save:hover {
  border-color: #3fb950;
  background: rgba(63, 185, 80, 0.1);
}

.tools-import-label {
  cursor: pointer;
}

#history-list {
  background: #010409;
  border: 1px solid #30363d;
  border-radius: 6px;
  max-height: 400px;
  overflow-y: auto;
}

.history-list-empty {
  padding: 1.5rem;
  text-align: center;
  color: #6e7681;
  font-size: 0.95rem;
  margin: 0;
}

.history-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid #21262d;
  transition: background 0.15s ease;
}

.history-entry:last-child {
  border-bottom: none;
}

.history-entry:hover {
  background: rgba(121, 192, 255, 0.05);
}

.history-entry-label {
  color: #c9d1d9;
  font-size: 0.95rem;
  flex: 1;
  word-break: break-word;
}

.history-entry-actions {
  display: flex;
  gap: 0.5rem;
  white-space: nowrap;
}

.history-restore-btn,
.history-delete-btn {
  background: transparent;
  border: 1px solid #30363d;
  color: #79c0ff;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  font-family: inherit;
}

.history-restore-btn:hover {
  border-color: #79c0ff;
  background: rgba(121, 192, 255, 0.1);
}

.history-delete-btn {
  color: #f85149;
  border-color: #da3633;
  padding: 0.4rem 0.6rem;
  min-width: 36px;
  text-align: center;
}

.history-delete-btn:hover {
  background: rgba(248, 81, 73, 0.1);
  border-color: #f85149;
}

@media (max-width: 768px) {
  .tools-section {
    padding: 1.2rem 1rem;
    margin-bottom: 1.5rem;
  }

  .tools-toolbar {
    gap: 0.5rem;
  }

  .tools-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  .history-entry {
    padding: 0.8rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .history-entry-actions {
    align-self: flex-end;
  }

  .history-entry-label {
    font-size: 0.9rem;
  }

  /* Tryb edycji transakcji na mobile - wszystko w jednej kolumnie */
  .transaction-edit-mode .edit-datetime,
  .transaction-edit-mode .edit-amount,
  .transaction-edit-mode .edit-currency,
  .transaction-edit-mode .edit-description,
  .transaction-save-btn,
  .transaction-cancel-btn {
    flex: 0 1 100%;
  }
}

footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: #6e7681;
}

footer p {
  margin: 0;
}

footer a {
  color: #7ee787;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

.error-msg {
  background: rgba(248, 81, 73, 0.15);
  border: 1px solid rgba(248, 81, 73, 0.3);
  color: #f85149;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.error-msg.hidden {
  display: none;
}
