/* ══════════════════════════════════
   RESET & BASE
══════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0a2626;
  --bg2:       #0d3030;
  --card:      #112e2e;
  --card2:     #0f3535;
  --border:    rgba(255,255,255,0.07);
  --yellow:    #f5c318;
  --yellow2:   #e6b010;
  --green:     #4dd9ac;
  --red:       #ff6b6b;
  --text:      #ffffff;
  --text2:     rgba(255,255,255,0.55);
  --text3:     rgba(255,255,255,0.35);
  --radius:    18px;
  --safe-top:  env(safe-area-inset-top, 44px);
  --safe-bot:  env(safe-area-inset-bottom, 20px);
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════
   VIEW SYSTEM
══════════════════════════════════ */
.view {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--bg);
  z-index: 10;
}
.view.active { display: flex; }
.view.slide-up {
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.view.slide-up.open { transform: translateY(0); }

/* ══════════════════════════════════
   LOGIN SCREEN
══════════════════════════════════ */
#view-login {
  justify-content: space-between;
  overflow: hidden;
}

.login-bg-art {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  height: 60%;
}
.login-bg-art svg { width: 100%; height: 100%; }

.login-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 8px;
  padding-top: calc(var(--safe-top) + 60px);
  padding-bottom: 140px;
}

.login-greeting {
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.5px;
}
.login-name {
  font-size: 15px;
  color: var(--text2);
  margin-bottom: 32px;
}

.btn-login {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--yellow);
  color: #1a1a00;
  border: none;
  padding: 16px 48px;
  border-radius: 50px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: -0.2px;
  transition: transform 0.1s, opacity 0.1s;
}
.btn-login:active { transform: scale(0.96); opacity: 0.9; }

.login-help {
  font-size: 13px;
  color: var(--yellow);
  margin-top: 12px;
  opacity: 0.8;
}

/* ══════════════════════════════════
   APP SHELL
══════════════════════════════════ */
#view-app {
  flex-direction: column;
  overflow: hidden;
}
#view-app.active {
  display: flex;
}

.tab-content {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: calc(var(--safe-top) + 8px);
  padding-bottom: calc(80px + var(--safe-bot));
}
.tab-content.active { display: flex; }

/* ══════════════════════════════════
   SCREEN HEADER
══════════════════════════════════ */
.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 8px;
}
.screen-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.btn-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.1);
  border: none;
  color: var(--text);
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
}

/* ══════════════════════════════════
   ACTION GRID (4 buttons)
══════════════════════════════════ */
.action-grid {
  display: flex;
  justify-content: space-around;
  padding: 16px 12px 8px;
}
.action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.action-item span {
  font-size: 12px;
  color: var(--text2);
  font-weight: 500;
}
.action-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}
.action-btn:active { transform: scale(0.9); }
.action-btn.primary { background: var(--yellow); color: #1a1a00; }
.action-btn.dark { background: var(--card2); color: var(--text); border: 1px solid var(--border); }
.action-btn.sm { width: 48px; height: 48px; }

/* ══════════════════════════════════
   SECTION HEADERS
══════════════════════════════════ */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px 8px;
}
.section-title { font-size: 13px; color: var(--text2); font-weight: 500; }
.section-total { font-size: 13px; color: var(--text2); }

/* ══════════════════════════════════
   ACCOUNTS CARD
══════════════════════════════════ */
.accounts-card {
  margin: 0 16px;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.account-row {
  display: flex;
  align-items: center;
  padding: 15px 16px;
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.account-row:not(:last-child)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 56px;
  right: 0;
  height: 1px;
  background: var(--border);
}
.account-row:active { background: rgba(255,255,255,0.04); }

.account-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.account-info { flex: 1; }
.account-name { font-size: 15px; font-weight: 600; }
.account-sub { font-size: 12px; color: var(--text2); margin-top: 2px; }
.account-balance {
  font-size: 16px;
  font-weight: 600;
  text-align: right;
}
.account-balance.positive { color: var(--green); }
.account-balance.negative { color: var(--red); }

/* ══════════════════════════════════
   ADD PRODUCT BUTTON
══════════════════════════════════ */
.btn-add-product {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 16px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--yellow);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ══════════════════════════════════
   BOTTOM NAVIGATION
══════════════════════════════════ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  height: calc(60px + var(--safe-bot));
  padding-bottom: var(--safe-bot);
  background: rgba(10, 38, 38, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  z-index: 100;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text3);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.nav-item.active { color: var(--yellow); }
.nav-item svg { transition: stroke 0.2s; }

/* ══════════════════════════════════
   ACCOUNT DETAIL VIEW
══════════════════════════════════ */
#view-account-detail {
  z-index: 200;
  background: var(--bg);
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.detail-header {
  position: relative;
  background: linear-gradient(180deg, #0d3535 0%, #0a2c2c 100%);
  padding: calc(var(--safe-top) + 12px) 20px 20px;
  overflow: hidden;
  flex-shrink: 0;
}

.detail-close {
  display: block;
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  margin: 0 auto 12px;
  -webkit-tap-highlight-color: transparent;
}

.detail-name-bal {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.detail-name { font-size: 18px; font-weight: 700; }
.detail-balance {
  font-size: 22px;
  font-weight: 700;
  color: var(--yellow);
}

.detail-chart-wrap {
  height: 80px;
  margin-top: 8px;
  opacity: 0.4;
}
.detail-chart-wrap canvas { width: 100% !important; height: 80px !important; }

/* Credit card bar */
.cc-bar-section {
  padding: 16px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cc-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 8px;
}
.cc-progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
}
.cc-progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width 0.5s ease;
}
.cc-bar-values {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  margin-top: 6px;
}

/* Detail action row */
.detail-actions {
  display: flex;
  justify-content: center;
  gap: 40px;
  padding: 20px;
  flex-shrink: 0;
}

/* Pending card */
.pending-card {
  margin: 0 16px 8px;
  padding: 14px 16px;
  background: var(--card);
  border-radius: 14px;
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.pending-title { font-size: 14px; font-weight: 600; }
.pending-sub { font-size: 12px; color: var(--text2); margin-top: 2px; }
.pending-amount { font-size: 16px; font-weight: 600; color: var(--text2); }

/* Transactions list */
.detail-transactions {
  padding: 8px 0 40px;
  flex: 1;
}

.tx-date-group { padding: 0 20px; }
.tx-date-label {
  font-size: 13px;
  color: var(--text2);
  padding: 12px 0 6px;
  border-bottom: 1px solid var(--border);
}
.tx-row {
  display: flex;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  cursor: pointer;
}
.tx-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--card2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}
.tx-info { flex: 1; }
.tx-desc { font-size: 14px; font-weight: 500; }
.tx-sub { font-size: 12px; color: var(--text2); margin-top: 2px; }
.tx-amount { font-size: 15px; font-weight: 600; }
.tx-amount.income { color: var(--green); }
.tx-amount.expense { color: var(--text); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text2);
}
.empty-state svg { margin-bottom: 16px; opacity: 0.4; }
.empty-state p { font-size: 15px; }

/* ══════════════════════════════════
   CHARTS (Verlauf)
══════════════════════════════════ */
.chart-section { padding: 8px 16px; }
.chart-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
}
.chart-label {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 12px;
  font-weight: 500;
}

/* ══════════════════════════════════
   ALL TRANSACTIONS (Zahlungen tab)
══════════════════════════════════ */
.all-transactions {
  padding: 0 16px;
  flex: 1;
  overflow-y: auto;
}

/* ══════════════════════════════════
   SETTINGS
══════════════════════════════════ */
.settings-list { padding: 8px 16px; }
.settings-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.settings-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.settings-item:last-child { border-bottom: none; }
.settings-item:active { background: rgba(255,255,255,0.04); }
.settings-item span { flex: 1; font-size: 15px; }
.settings-item svg:first-child { color: var(--text2); flex-shrink: 0; }
.chevron { color: var(--text3); flex-shrink: 0; }
.version-info {
  text-align: center;
  font-size: 12px;
  color: var(--text3);
  padding: 24px;
}

/* ══════════════════════════════════
   MODALS
══════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal-sheet {
  background: var(--bg2);
  border-radius: 24px 24px 0 0;
  padding: 12px 24px calc(24px + var(--safe-bot));
  width: 100%;
  max-width: 500px;
  animation: slideUp 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-handle {
  width: 36px; height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  margin: 0 auto 20px;
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text2);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.form-input, .form-select {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  padding: 13px 14px;
  outline: none;
  -webkit-appearance: none;
  font-family: inherit;
}
.form-input:focus, .form-select:focus {
  border-color: var(--yellow);
}
.form-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.4)' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

.btn-confirm {
  width: 100%;
  background: var(--yellow);
  color: #1a1a00;
  border: none;
  border-radius: 14px;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity 0.15s, transform 0.1s;
  font-family: inherit;
}
.btn-confirm:active { opacity: 0.85; transform: scale(0.98); }
.btn-cancel {
  width: 100%;
  background: none;
  border: none;
  color: var(--text2);
  padding: 14px;
  font-size: 15px;
  cursor: pointer;
  margin-top: 4px;
  font-family: inherit;
}

/* ══════════════════════════════════
   TOAST
══════════════════════════════════ */
.toast {
  position: fixed;
  bottom: calc(80px + var(--safe-bot) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(30,70,70,0.95);
  backdrop-filter: blur(10px);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 999;
  white-space: nowrap;
  border: 1px solid var(--border);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ══════════════════════════════════
   TRANSACTION DETAIL VIEW
══════════════════════════════════ */
#view-tx-detail {
  z-index: 300;
  background: var(--bg);
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.tx-detail-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  flex-shrink: 0;
}
.tx-detail-back {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
}
.tx-detail-title {
  font-size: 16px;
  font-weight: 700;
}
.tx-detail-edit-btn {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.tx-detail-edit-btn.active {
  background: var(--yellow);
  color: #1a1a00;
}

/* Hero */
.tx-detail-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px 28px;
  background: linear-gradient(180deg, #0d3535 0%, var(--bg) 100%);
  flex-shrink: 0;
}
.tx-detail-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--card2);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 16px;
}
.tx-detail-amount {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 8px;
}
.tx-detail-amount.income { color: var(--green); }
.tx-detail-amount.expense { color: var(--text); }
.tx-detail-meta {
  font-size: 14px;
  color: var(--text2);
  display: flex;
  gap: 6px;
}
.tx-detail-meta strong { color: var(--text); }
.tx-detail-account {
  font-size: 13px;
  color: var(--text2);
  margin-top: 4px;
}

/* Booking btn */
.tx-detail-booking-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px 0 20px;
  font-size: 12px;
  color: var(--text2);
  cursor: pointer;
  flex-shrink: 0;
}

/* Detail rows */
.tx-detail-rows {
  padding: 0 0 48px;
  flex: 1;
}
.tx-detail-section-label {
  font-size: 12px;
  color: var(--text3);
  padding: 14px 20px 6px;
  border-top: 1px solid var(--border);
  letter-spacing: 0.3px;
}
.tx-detail-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
}
.tx-detail-row-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--card2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
  color: var(--green);
}
.tx-detail-row span { flex: 1; font-size: 15px; }
.tx-detail-row .chevron { color: var(--text3); }
.tx-detail-add-tag {
  padding: 14px 20px;
  font-size: 15px;
  color: var(--yellow);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.tx-date-main { font-size: 15px; font-weight: 600; }
.tx-date-sub { font-size: 12px; color: var(--text2); margin-top: 2px; }
.tx-desc-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  flex: 1;
}
.tx-detail-row.edit-field {
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
}
#tx-edit-actions {
  padding: 16px 16px 48px;
}

