/* Angebotsheld - hand-written design system (no framework, no build step).
 *
 * Direction: modern, calm, professional. Warm neutrals, soft shadows,
 * rounded corners, restrained type scale. Fonts stay on the system stack on
 * purpose: spec.md §3 forbids third-party requests (DSGVO), so no webfont
 * may be loaded.
 *
 * Breakpoints: <=640px phone (stacked), >=900px desk (wide, two columns).
 */

:root {
  --paper: #f5f4f2;
  --surface: #ffffff;
  --ink: #1f2328;
  --muted: #646c76;
  --line: #e5e2dc;

  --accent: #0e7a4d;
  --accent-dark: #0a5f3c;
  --accent-soft: #e7f4ed;
  --signal: #b45309;
  --signal-soft: #fdf1e0;
  --danger: #be3425;
  --danger-soft: #fdecea;

  --status-draft-bg: #eceae6;
  --status-draft-text: #5f6570;
  --status-sent-bg: #e5edfb;
  --status-sent-text: #1d4ed8;
  --status-opened-bg: var(--signal-soft);
  --status-opened-text: var(--signal);
  --status-accepted-bg: var(--accent-soft);
  --status-accepted-text: var(--accent-dark);
  --status-declined-bg: var(--danger-soft);
  --status-declined-text: var(--danger);
  --status-question-bg: #f0e9fb;
  --status-question-text: #6d28d9;
  --status-withdrawn-bg: #eceae6;
  --status-withdrawn-text: var(--muted);

  --radius: 12px;
  --radius-sm: 8px;
  --gap: 1rem;
  --content: 720px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 6px 20px rgba(16, 24, 40, 0.09);
  --ring: 0 0 0 3px rgba(14, 122, 77, 0.18);
  --font-ui: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
}

a {
  color: var(--accent-dark);
}

h1,
h2,
h3 {
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0 0 0.6rem;
}

h1 {
  font-size: 1.45rem;
}

h2 {
  font-size: 1.15rem;
}

h3 {
  font-size: 1rem;
}

.container {
  max-width: var(--content);
  margin: 0 auto;
  padding: 1.5rem var(--gap) 0;
}

/* Small uppercase label used above numbers and section starts. */
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 0.15rem;
}

/* ---- Header / Nav ---- */

.site-header {
  background: var(--surface);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

.nav {
  max-width: var(--content);
  margin: 0 auto;
  padding: 0.7rem var(--gap);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--ink);
}

.nav-brand::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--accent);
}

.nav-toggle {
  display: none;
  min-height: 44px;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}

.nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
}

.nav-links a:hover {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: var(--status-accepted-bg);
  color: var(--status-accepted-text);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.credits-badge {
  background: var(--accent);
  color: #fff;
}

/* ---- Flash messages ---- */

.flashes {
  list-style: none;
  margin: 0 0 var(--gap) 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.flash {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--status-sent-text);
  background: var(--status-sent-bg);
  color: var(--status-sent-text);
  font-weight: 500;
}

.flash-success {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-left-color: var(--accent);
}

.flash-error {
  background: var(--danger-soft);
  color: var(--danger);
  border-left-color: var(--danger);
}

/* ---- Cards ---- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.1rem;
  margin-bottom: var(--gap);
}

.card > :last-child {
  margin-bottom: 0;
}

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

/* ---- Buttons ---- */

.btn {
  display: inline-block;
  min-height: 46px;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.08s ease,
    border-color 0.08s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--muted);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* ---- Forms ---- */

.form {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  max-width: 560px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
}

.field-checkbox input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

label {
  font-weight: 600;
}

.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="file"],
textarea,
select {
  min-height: 46px;
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  width: 100%;
}

.input:focus,
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

textarea {
  min-height: 120px;
}

.field-error {
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ---- Status badges (spec.md D1/D2) ---- */

.badge-draft {
  background: var(--status-draft-bg);
  color: var(--status-draft-text);
}

.badge-sent {
  background: var(--status-sent-bg);
  color: var(--status-sent-text);
}

.badge-opened {
  background: var(--status-opened-bg);
  color: var(--status-opened-text);
}

.badge-accepted {
  background: var(--status-accepted-bg);
  color: var(--status-accepted-text);
}

.badge-declined {
  background: var(--status-declined-bg);
  color: var(--status-declined-text);
}

.badge-question {
  background: var(--status-question-bg);
  color: var(--status-question-text);
}

.badge-withdrawn {
  background: var(--status-withdrawn-bg);
  color: var(--status-withdrawn-text);
}

/* ---- Dashboard ---- */

.kpi {
  background: linear-gradient(135deg, #1f2328 0%, #333b47 100%);
  color: #fff;
  border-radius: 16px;
  padding: 1.2rem 1.3rem;
  margin-bottom: 1.4rem;
  box-shadow: var(--shadow-md);
}

.kpi .eyebrow {
  color: #aab2bd;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin: 0;
  line-height: 1.1;
}

.kpi-note {
  color: #aab2bd;
  margin: 0.2rem 0 0;
  font-size: 0.92rem;
}

.quote-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: var(--gap);
}

/* Each quote row: a coloured spine on the left carries the urgency. */
.quote-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 0.9rem 1rem;
  text-decoration: none;
  color: inherit;
  transition: transform 0.08s ease, box-shadow 0.08s ease, border-color 0.08s ease;
}

.quote-row:hover {
  border-color: var(--muted);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.quote-row--warn {
  border-left-color: var(--signal);
}

.quote-row--good {
  border-left-color: var(--accent);
}

.quote-row--bad {
  border-left-color: var(--danger);
}

.quote-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.quote-customer {
  color: var(--muted);
}

.quote-amount {
  font-weight: 700;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.quote-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  border-top: 1px solid var(--line);
  padding-top: 0.55rem;
  margin-top: 0.2rem;
}

/* The sentence that carries the product's whole promise. */
.quote-hint {
  font-weight: 600;
}

.quote-hint--warn {
  color: var(--signal);
}

.quote-hint--good {
  color: var(--accent-dark);
}

.quote-hint--bad {
  color: var(--danger);
}

.quote-next {
  color: var(--muted);
  font-size: 0.92rem;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1.2rem;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

/* ---- Choice cards (neues Angebot) ---- */

.choice-grid {
  display: grid;
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.choice-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.3rem;
  text-decoration: none;
  color: inherit;
  transition: transform 0.08s ease, box-shadow 0.08s ease, border-color 0.08s ease;
}

.choice-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--muted);
}

.choice-card h2 {
  margin: 0;
}

.choice-card p {
  margin: 0;
  color: var(--muted);
}

/* The primary path: most businesses already have their offer as a PDF. */
.choice-card--primary {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm);
}

.choice-card--primary:hover {
  border-color: var(--accent-dark);
  box-shadow: 0 0 0 1px var(--accent-dark), var(--shadow-md);
}

.choice-card--primary .eyebrow {
  color: var(--accent-dark);
}

.choice-go {
  margin-top: auto;
  font-weight: 700;
  color: var(--accent-dark);
}

.choice-go--btn {
  display: inline-block;
  align-self: flex-start;
  margin-top: 0.6rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
}

/* ---- Positions table (Schnelleingabe) ---- */

.items-table {
  width: 100%;
  border-collapse: collapse;
}

.items-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  padding: 0 0.4rem 0.4rem;
  border-bottom: 1px solid var(--line);
}

.items-table td {
  padding: 0.3rem 0.4rem;
}

.items-table .input {
  min-height: 44px;
}

.items-col-qty {
  width: 7rem;
}

.items-col-unit {
  width: 7rem;
}

.items-col-price {
  width: 11rem;
}

.item-label {
  display: none;
}

.sum-preview {
  margin-top: 0.7rem;
  padding: 0.7rem 0.9rem;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums;
}

/* ---- Pricing (Preise) ---- */

.pricing-cards {
  display: grid;
  gap: var(--gap);
  margin-bottom: 1.4rem;
}

.pricing-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
}

.pricing-price {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.ledger-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding: 0.3rem 0.4rem;
}

.ledger-table td {
  padding: 0.45rem 0.4rem;
  border-bottom: 1px solid var(--line);
}

/* ---- Profile / logo ---- */

.logo-preview {
  max-width: 200px;
  max-height: 120px;
  display: block;
  margin-bottom: var(--gap);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.4rem;
  background: var(--surface);
}

.logo-placeholder {
  font-weight: 800;
  font-size: 1.1rem;
  margin-bottom: var(--gap);
}

/* ---- Footer ---- */

.site-footer {
  max-width: var(--content);
  margin: 2.5rem auto 1.5rem;
  padding: 1rem var(--gap) 0;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 1.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer a {
  color: var(--muted);
}

/* ---- Phone ---- */

@media (max-width: 640px) {
  h1 {
    font-size: 1.35rem;
  }

  .nav-toggle {
    display: inline-block;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding-top: 0.6rem;
  }

  .nav-links.open {
    display: flex;
  }

  .btn {
    width: 100%;
  }

  .kpi-value {
    font-size: 1.8rem;
  }

  .quote-row {
    grid-template-columns: 1fr;
  }

  .quote-amount {
    text-align: left;
  }
}

/* Stacked position rows: a table with four inputs cannot fit a phone,
 * and horizontal scrolling hides the price column (review finding). */
@media (max-width: 720px) {
  .items-table,
  .items-table tbody,
  .items-table tr,
  .items-table td {
    display: block;
    width: 100%;
  }

  .items-table thead {
    display: none;
  }

  .items-table tr {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    padding: 0.6rem;
    margin-bottom: 0.8rem;
  }

  .items-table td {
    display: grid;
    grid-template-columns: 8rem 1fr;
    align-items: center;
    gap: 0.6rem;
    padding: 0.25rem 0;
  }

  .item-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
  }
}

/* ---- Desk: the craftsman writes quotes in the office, not on a ladder ---- */

@media (min-width: 900px) {
  :root {
    --content: 1020px;
  }

  h1 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
  }

  .container {
    padding-top: 2rem;
  }

  .kpi {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 2rem;
    padding: 1.4rem 1.6rem;
  }

  .kpi-value {
    font-size: 2.4rem;
  }

  .kpi-note {
    margin: 0;
  }

  /* Header fields side by side; the long text areas stay full width. */
  .form--wide {
    max-width: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.1rem 1.5rem;
    align-items: start;
  }

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

  .choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.4rem;
  }

  .pricing-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .quote-row {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto;
    align-items: center;
  }

  .quote-row .quote-meta {
    grid-column: 1 / -1;
  }
}
