:root {
  --bg: #fff8f1;
  --surface: #ffffff;
  --ink: #102536;
  --muted: #78695f;
  --line: #eadbcf;
  --orange: #f58220;
  --green: var(--orange);
  --green-soft: #fff1e5;
  --blue: #206a74;
  --red: #b33a3a;
  --shadow: 0 10px 30px rgba(96, 53, 22, .09);
  --orange-deep: #9f4510;
  --orange-line: #f0b17b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--green);
  color: var(--ink);
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
}

button.ghost {
  background: #fff4ea;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0;
}

.hidden {
  display: none !important;
}

.auth {
  min-height: calc(100vh - 56px);
  display: grid;
  place-content: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mark {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: var(--ink);
  font-size: 24px;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 20px;
}

h3 {
  margin: 0;
  font-size: 15px;
}

p,
label {
  color: var(--muted);
}

.card,
.metrics article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.card {
  padding: 18px;
}

form.card {
  display: grid;
  gap: 14px;
}

.compact-card {
  width: min(360px, 100%);
}

.auth-link {
  justify-self: start;
}

.settings-card {
  margin-bottom: 18px;
}

.source-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.source-card p {
  margin-top: 6px;
  font-size: 13px;
  word-break: break-word;
}

.source-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
  min-width: 240px;
}

.password-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 14px;
  align-items: end;
}

.hint {
  font-size: 13px;
}

.items-box {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfb;
}

.item-rows {
  display: grid;
  gap: 8px;
}

.item-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 110px auto;
  gap: 8px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 18px;
}

.analytics-grid > div {
  display: grid;
  gap: 10px;
}

.mini-list {
  display: grid;
  gap: 8px;
}

.mini-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fffaf5;
}

.mini-list span {
  color: var(--muted);
}

.mini-list strong {
  white-space: nowrap;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: white;
  color: var(--ink);
}

.actions,
.topbar,
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.message {
  min-height: 20px;
  color: var(--red);
}

.topbar {
  margin-bottom: 18px;
  border-left: 6px solid var(--green);
  padding-left: 14px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.summary-card {
  min-height: 96px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--ink);
  padding: 16px;
  text-align: left;
  display: grid;
  align-content: center;
  gap: 6px;
}

.summary-card span,
.summary-card small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.summary-card strong {
  font-size: 23px;
}

.monthly-reminder {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--orange-line);
  background: #fff0e3;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 18px;
}

.monthly-reminder span {
  color: var(--muted);
}

.month-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.month-card {
  display: grid;
  gap: 16px;
}

.status-pill {
  display: inline-grid;
  place-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--green-soft);
  color: var(--orange-deep);
  font-size: 12px;
  font-weight: 800;
}

.plan-numbers {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 10px;
}

.plan-numbers div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fffaf5;
}

.plan-numbers span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.plan-numbers strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.credit-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
}

.credit-list {
  display: grid;
  gap: 10px;
}

.credit-item {
  width: 100%;
  min-height: 74px;
  background: #fff4ea;
  color: var(--ink);
  border: 1px solid var(--line);
  justify-content: flex-start;
  text-align: left;
  display: grid;
  gap: 3px;
  padding: 12px;
}

.credit-item.is-active {
  background: var(--green-soft);
  border-color: var(--orange-line);
}

.credit-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  min-height: 220px;
}

.detail-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.detail-metrics div {
  background: #fffaf5;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.empty-state {
  color: var(--muted);
}

.metrics article {
  padding: 16px;
}

.metrics span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  align-items: start;
}

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

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td.amount {
  font-weight: 800;
  white-space: nowrap;
}

.delete {
  background: #f8e6e4;
  color: var(--red);
  min-height: 32px;
}

@media (max-width: 920px) {
  .grid,
  .metrics,
  .summary-grid,
  .credit-layout,
  .month-board,
  .analytics-grid,
  .plan-numbers,
  .item-row,
  .password-form {
    grid-template-columns: 1fr;
  }

  .source-card {
    align-items: stretch;
    flex-direction: column;
  }

  .source-actions {
    justify-items: stretch;
    min-width: 0;
  }
}

.auth { width: min(460px, 100%); margin-inline: auto; }
.auth .actions { flex-wrap: wrap; }
.hint { line-height: 1.5; }
button:disabled { opacity: .55; cursor: default; }
input:focus-visible, button:focus-visible, select:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.metrics strong, .plan-numbers strong, .summary-card strong { overflow-wrap: anywhere; }

/* Gemeinsame Markenfarbe wie dirk-kosmala.de; Statusfarben bleiben erhalten. */
button:not(.ghost):hover:not(:disabled){background:var(--orange-deep);color:#fff}
input:focus-visible,button:focus-visible,select:focus-visible{outline-color:var(--orange-deep)}
