@import url("https://fonts.googleapis.com/css2?family=Lexend:wght@300;400;500&family=Roboto:wght@300;400;500&display=swap");

:root {
  --ink: #111111;
  --ink-soft: #4a4a4a;
  --ink-muted: #949494;
  --gold: #c9a962;
  --gold-soft: #dec98a;
  --gold-dark: #9e8a3e;
  --cream: #f8f8f7;
  --canvas: #ffffff;
  --panel: #ffffff;
  --line: rgba(17, 17, 17, 0.09);
  --shadow: 0 18px 40px rgba(158, 138, 62, 0.08);
  --radius: 24px;
  --radius-sm: 16px;
  --success: #2f7d60;
  --danger: #9b3e2e;
  --warning: #9f6f1d;
  --font-ui: "Lexend", sans-serif;
  --font-body: "Roboto", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top right, rgba(201, 169, 98, 0.16), transparent 18%),
    linear-gradient(180deg, #ffffff 0%, #faf9f5 48%, #f8f8f7 100%);
  color: var(--ink);
  padding-top: 72px;
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

code,
pre {
  font-family: "Consolas", "Courier New", monospace;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
}

.privat-nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 2rem;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(17, 17, 17, 0.08);
}

.privat-nav-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}

.nav-logo img {
  height: 36px;
  width: auto;
  display: block;
}

.sidebar {
  padding: 2rem 1.4rem;
  border-right: 1px solid rgba(17, 17, 17, 0.06);
  background: linear-gradient(180deg, #fbfaf7 0%, #f8f8f7 100%);
  color: var(--ink);
  position: sticky;
  top: 0;
  height: calc(100vh - 72px);
  overflow: auto;
}

.brand-block {
  padding: 1rem;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(201, 169, 98, 0.1), rgba(255, 255, 255, 0.9));
  border: 1px solid rgba(201, 169, 98, 0.18);
  margin-bottom: 1.5rem;
}

.brand-block h1 {
  margin: 0.2rem 0 0.7rem;
  font-family: var(--font-ui);
  font-size: 2rem;
  line-height: 1.05;
}

.brand-mark {
  width: 124px;
  height: auto;
  display: block;
  margin-bottom: 0.75rem;
}

.eyebrow,
.card-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.72rem;
}

.eyebrow {
  color: var(--gold-dark);
}

.card-label {
  color: var(--ink-muted);
}

.sidebar .card-label,
.sidebar .muted,
.sidebar .setup-list,
.sidebar .user-email {
  color: var(--ink-soft);
}

.muted {
  color: var(--ink-muted);
}

.main-nav {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1.5rem;
}

.main-nav-link,
.subnav-link,
.ghost-button,
.primary-button {
  border-radius: 999px;
  border: 1px solid transparent;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.main-nav-link {
  text-align: left;
  padding: 0.95rem 1rem;
  background: #ffffff;
  color: var(--ink-soft);
  border-color: rgba(17, 17, 17, 0.08);
}

.main-nav-link.active,
.main-nav-link:hover {
  background: rgba(201, 169, 98, 0.08);
  color: var(--gold-dark);
  border-color: rgba(201, 169, 98, 0.25);
}

.sidebar-card {
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(17, 17, 17, 0.06);
  margin-bottom: 1rem;
}

.setup-list {
  margin: 0.75rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.55rem;
}

.user-email {
  margin: 0.6rem 0 1rem;
  word-break: break-word;
}

.content {
  padding: 2rem 2rem 3rem;
}

.topbar,
.finance-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.topbar h2,
.hero-panel h3,
.panel h3,
.finance-header h3,
.feature-card h4 {
  font-family: var(--font-ui);
}

.topbar h2,
.finance-header h3 {
  margin: 0.2rem 0 0;
  font-size: 2rem;
}

.topbar-actions,
.hero-actions,
.form-actions,
.finance-filters,
.import-intro {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  flex-wrap: wrap;
}

.connection-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  background: rgba(201, 169, 98, 0.12);
  color: var(--warning);
  font-size: 0.92rem;
}

.connection-badge.connected {
  background: rgba(47, 125, 96, 0.12);
  color: var(--success);
}

.stack {
  display: grid;
  gap: 1.2rem;
}

.notice {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-sm);
  background: rgba(47, 125, 96, 0.1);
  color: var(--success);
  border: 1px solid rgba(47, 125, 96, 0.14);
}

.notice.error {
  background: rgba(155, 62, 46, 0.1);
  border-color: rgba(155, 62, 46, 0.14);
  color: var(--danger);
}

.panel,
.hero-panel,
.summary-card,
.feature-card {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(17, 17, 17, 0.06);
  box-shadow: var(--shadow);
}

.panel,
.hero-panel {
  border-radius: var(--radius);
  padding: 1.4rem;
}

.hero-panel {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  background:
    radial-gradient(circle at right top, rgba(201, 169, 98, 0.16), transparent 32%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 248, 247, 0.98));
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.summary-card {
  border-radius: var(--radius-sm);
  padding: 1.1rem;
}

.summary-card p {
  margin: 0;
}

.summary-card strong {
  display: block;
  margin-top: 0.5rem;
  font-family: var(--font-ui);
  font-size: 1.65rem;
}

.summary-card small {
  display: block;
  margin-top: 0.55rem;
  color: var(--ink-muted);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.feature-card {
  border-radius: var(--radius-sm);
  padding: 1.1rem;
}

.feature-card h4 {
  margin: 0 0 0.55rem;
}

.subnav {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.subnav-link {
  padding: 0.8rem 1rem;
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(17, 17, 17, 0.08);
  color: var(--ink-soft);
}

.subnav-link.active,
.subnav-link:hover {
  background: linear-gradient(180deg, rgba(201, 169, 98, 0.16), rgba(201, 169, 98, 0.08));
  color: var(--gold-dark);
  border-color: rgba(201, 169, 98, 0.24);
}

.primary-button,
.ghost-button {
  padding: 0.85rem 1.1rem;
}

.primary-button {
  background: linear-gradient(135deg, #dec68b 0%, #c9a962 32%, #b7984c 72%, #ad8f3d 100%);
  color: #fffdf7;
  border-color: rgba(173, 143, 61, 0.5);
}

.primary-button:hover,
.ghost-button:hover,
.main-nav-link:hover,
.subnav-link:hover {
  transform: translateY(-1px);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(17, 17, 17, 0.12);
  color: var(--ink);
}

.sidebar .ghost-button {
  background: rgba(255, 255, 255, 0.96);
  color: var(--gold-dark);
  border-color: rgba(201, 169, 98, 0.18);
}

.full-width {
  width: 100%;
}

.auth-screen {
  display: none;
}

body.auth-mode .app-shell {
  display: none;
}

body.auth-mode .auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 72px);
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  padding: 2.4rem 2.2rem 2rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(201, 169, 98, 0.22);
  box-shadow: var(--shadow);
  text-align: center;
}

.auth-logo {
  width: 132px;
  height: auto;
  margin: 0 auto 1.4rem;
  display: block;
}

.auth-card h1 {
  margin: 0.35rem 0 0.8rem;
  font-family: var(--font-ui);
  font-size: 2rem;
  line-height: 1.1;
}

.auth-intro {
  margin: 0 0 1.4rem;
  line-height: 1.55;
}

.auth-status {
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(201, 169, 98, 0.1);
  color: var(--gold-dark);
  font-size: 0.95rem;
}

.auth-form {
  text-align: left;
  margin-top: 0.4rem;
}

.auth-error {
  margin: 1rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(155, 62, 46, 0.1);
  border: 1px solid rgba(155, 62, 46, 0.16);
  color: var(--danger);
  font-size: 0.95rem;
}

.auth-back {
  display: inline-block;
  margin-top: 1.5rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.auth-back:hover {
  color: var(--gold-dark);
}

.primary-button:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.auth-form,
.transaction-form {
  display: grid;
  gap: 1rem;
}

.transaction-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.transaction-form .wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 0.45rem;
}

label span {
  font-size: 0.92rem;
  color: var(--ink-soft);
}

input,
select,
textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(17, 17, 17, 0.12);
  background: rgba(255, 255, 255, 0.92);
  padding: 0.9rem 1rem;
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(178, 142, 79, 0.68);
  box-shadow: 0 0 0 4px rgba(178, 142, 79, 0.12);
}

.table-wrapper {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 0.9rem 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
}

tbody tr:hover {
  background: rgba(201, 169, 98, 0.06);
}

.amount-expense {
  color: var(--danger);
  font-weight: 700;
}

.amount-income {
  color: var(--success);
  font-weight: 700;
}

.category-summary {
  display: grid;
  gap: 0.8rem;
}

.category-row {
  display: grid;
  grid-template-columns: 220px 1fr 120px;
  gap: 0.8rem;
  align-items: center;
}

.category-bar-track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: rgba(29, 42, 38, 0.08);
  overflow: hidden;
}

.category-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(178, 142, 79, 0.95), rgba(215, 193, 153, 0.95));
}

.money {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.file-picker {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(29, 42, 38, 0.14);
  padding: 0.85rem 1rem;
}

.file-picker input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.code-block {
  margin: 0;
  padding: 1rem;
  border-radius: 18px;
  overflow: auto;
  background: #1e2a27;
  color: #f6f3eb;
}

.preview-card {
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(29, 42, 38, 0.08);
}

.preview-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.preview-grid {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.preview-row {
  display: grid;
  grid-template-columns: 110px 150px 1.3fr 180px 180px 1fr;
  gap: 0.65rem;
  align-items: center;
  padding: 0.85rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(17, 17, 17, 0.06);
}

.preview-row input,
.preview-row select {
  padding: 0.75rem 0.8rem;
  border-radius: 14px;
}

.empty-state {
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(29, 42, 38, 0.18);
  color: var(--ink-muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(201, 169, 98, 0.12);
  color: var(--warning);
  font-size: 0.82rem;
  margin-right: 0.35rem;
  margin-bottom: 0.25rem;
}

.pill.ok {
  background: rgba(47, 125, 96, 0.12);
  color: var(--success);
}

.account-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.42rem 0.75rem;
  border-radius: 999px;
  background: rgba(201, 169, 98, 0.08);
  border: 1px solid rgba(201, 169, 98, 0.16);
  color: var(--gold-dark);
  font-size: 0.82rem;
}

.account-summary-card[data-account-kind="salary"] {
  border-top: 3px solid var(--gold-dark);
}

.account-summary-card[data-account-kind="spending"] {
  border-top: 3px solid rgba(201, 169, 98, 0.55);
}

.account-summary-card[data-account-kind="savings"] {
  border-top: 3px solid #6fae7a;
}

.account-summary-rows {
  margin-top: 0.7rem;
  display: grid;
  gap: 0.35rem;
}

.account-summary-rows div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem;
}

.account-summary-rows span {
  color: var(--ink-muted);
  font-size: 0.85rem;
}

.account-summary-rows strong {
  margin-top: 0;
  font-size: 1.05rem;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .privat-nav {
    padding: 0.8rem 1rem;
  }

  .summary-grid,
  .preview-meta,
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .content {
    padding: 1rem;
  }

  .topbar,
  .finance-header,
  .hero-panel {
    flex-direction: column;
  }

  .privat-nav-copy {
    display: none;
  }

  .summary-grid,
  .preview-meta,
  .feature-grid,
  .transaction-form {
    grid-template-columns: 1fr;
  }

  .category-row,
  .preview-row {
    grid-template-columns: 1fr;
  }
}

/* Einladungen (Tool-Invite-Links) */
.invite-form {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.invite-form .wide {
  grid-column: 1 / -1;
}

.invite-form .form-actions {
  grid-column: 1 / -1;
}

.invite-status-line {
  margin-top: 0.8rem;
  font-size: 0.9rem;
  color: var(--ink-muted);
  min-height: 1em;
}

.invite-status-line.error {
  color: var(--danger);
}

.invite-card {
  display: grid;
  gap: 0.9rem;
}

.invite-card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.invite-card-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  text-align: right;
}

.invite-link-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.invite-link-row input {
  flex: 1;
  min-width: 220px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.invite-card-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.invite-result {
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
  display: grid;
  gap: 0.35rem;
}

.invite-result-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
}

.invite-result-row strong {
  color: var(--gold-dark);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .invite-form {
    grid-template-columns: 1fr;
  }
  .invite-card-status {
    align-items: flex-start;
    text-align: left;
  }
}
