:root {
  --bg: #f7f4ef;
  --bg-soft: #ede9e1;
  --surface: #fffdf8;
  --surface-muted: #fbf8f1;
  --text: #162840;
  --muted: #6b7060;
  --line: rgba(22, 40, 64, 0.12);
  --line-strong: rgba(22, 40, 64, 0.2);
  --navy: #162840;
  --navy-mid: #1d3350;
  --action: #b84a16;
  --action-hover: #96360d;
  --action-soft: rgba(184, 74, 22, 0.12);
  --forest: #2d5a3d;
  --forest-soft: rgba(45, 90, 61, 0.12);
  --amber-soft: rgba(200, 116, 48, 0.14);
  --danger: #9f1d1d;
  --danger-soft: rgba(159, 29, 29, 0.1);
  --radius: 8px;
  --shadow: 0 16px 40px rgba(22, 40, 64, 0.11);
  color-scheme: light;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--navy);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(22, 40, 64, 0.06), transparent 280px),
    var(--bg);
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

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

:focus-visible {
  outline: 3px solid rgba(184, 74, 22, 0.36);
  outline-offset: 3px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
  padding: 0.75rem clamp(1rem, 3vw, 2rem);
  color: white;
  background: rgba(22, 40, 64, 0.98);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: white;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  color: #ff9d63;
  background: var(--navy-mid);
  font-weight: 850;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.15;
}

.brand small {
  margin-top: 0.12rem;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 650;
}

.topnav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.topnav a,
.link-button {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  color: white;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.48rem 0.7rem;
  font-size: 0.9rem;
  font-weight: 720;
  text-decoration: none;
  cursor: pointer;
}

.topnav form {
  margin: 0;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
  padding: clamp(1.4rem, 3vw, 2.4rem) 0 4rem;
}

.auth-panel {
  width: min(520px, 100%);
  margin: clamp(2rem, 8vh, 5rem) auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: clamp(1.25rem, 4vw, 2rem);
  box-shadow: var(--shadow);
}

.hero-band,
.panel,
.side-panel,
.project-card,
.timeline-body,
.stats > div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(22, 40, 64, 0.07);
}

.hero-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.3rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  color: white;
  background:
    linear-gradient(135deg, rgba(22, 40, 64, 0.98), rgba(29, 51, 80, 0.94)),
    var(--navy);
  border-color: rgba(255, 255, 255, 0.1);
}

.hero-band h1,
.hero-band p {
  color: inherit;
}

.hero-band p {
  max-width: 720px;
  margin: 0.55rem 0 0;
  color: rgba(255, 255, 255, 0.78);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.15;
}

h3 {
  margin-bottom: 0.45rem;
  font-size: 1.08rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--action);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-band .eyebrow {
  color: #ffb481;
}

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

code {
  border-radius: 6px;
  background: var(--bg-soft);
  padding: 0.12rem 0.28rem;
}

.notice {
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem 0.95rem;
  font-weight: 680;
}

.notice-success {
  color: var(--forest);
  background: var(--forest-soft);
  border-color: rgba(45, 90, 61, 0.2);
}

.notice-error {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(159, 29, 29, 0.22);
}

.button,
.text-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: var(--radius);
  font-weight: 800;
  line-height: 1.1;
  text-decoration: none;
}

.button {
  border: 1px solid rgba(184, 74, 22, 0.18);
  color: white;
  background: var(--action);
  padding: 0.75rem 1rem;
  cursor: pointer;
}

.button:hover,
.button:focus-visible {
  background: var(--action-hover);
}

.button-secondary {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line-strong);
}

.button-secondary:hover,
.button-secondary:focus-visible {
  color: var(--text);
  background: var(--bg-soft);
}

.button-danger {
  color: white;
  background: var(--danger);
  border-color: rgba(159, 29, 29, 0.26);
}

.button-danger:hover,
.button-danger:focus-visible {
  background: #7f1717;
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.text-link {
  color: var(--action);
  padding: 0.35rem 0;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.actions,
.quick-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.quick-actions {
  margin-bottom: 1.4rem;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.6rem 0 0.8rem;
}

.section-head.compact {
  margin-top: 0;
}

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

.project-card,
.panel,
.side-panel {
  padding: clamp(1rem, 2.5vw, 1.35rem);
}

.project-card {
  display: grid;
  gap: 0.6rem;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.badge,
.mini-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0.25rem 0.58rem;
  font-size: 0.78rem;
  font-weight: 820;
}

.badge {
  color: var(--navy);
  background: var(--bg-soft);
}

.mini-badge {
  color: var(--action-hover);
  background: var(--action-soft);
}

.status-konzept {
  background: var(--bg-soft);
}

.status-in-arbeit {
  color: var(--action-hover);
  background: var(--amber-soft);
}

.status-review {
  color: #214d83;
  background: rgba(56, 116, 179, 0.14);
}

.status-abgeschlossen {
  color: var(--forest);
  background: var(--forest-soft);
}

.status-interessent {
  color: #214d83;
  background: rgba(56, 116, 179, 0.14);
}

.status-kunde {
  color: var(--forest);
  background: var(--forest-soft);
}

.status-inaktiv {
  color: var(--muted);
  background: var(--bg-soft);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.8fr);
  gap: 1rem;
  align-items: start;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 1rem;
  align-items: start;
}

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

.timeline {
  position: relative;
  display: grid;
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 0.75rem;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  margin-top: 1rem;
  border: 3px solid var(--surface);
  border-radius: 999px;
  background: var(--action);
  box-shadow: 0 0 0 1px rgba(184, 74, 22, 0.24);
}

.timeline-body {
  padding: 1rem;
}

.timeline-body p {
  margin-bottom: 0;
}

.compact-list {
  margin-top: 0.75rem;
}

.side-panel {
  position: sticky;
  top: 92px;
}

.link-list {
  display: grid;
  gap: 0.55rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.link-list li {
  display: grid;
  gap: 0.12rem;
  border-top: 1px solid var(--line);
  padding-top: 0.55rem;
}

.link-list a {
  color: var(--action);
  font-weight: 800;
}

.link-list small {
  color: var(--muted);
}

.inline-delete {
  margin: 0.15rem 0 0;
}

.link-button-light {
  min-height: 0;
  border: 0;
  color: var(--danger);
  background: transparent;
  padding: 0;
  font-weight: 800;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.nav-badge,
.inline-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  font-size: 0.76rem;
  font-weight: 850;
}

.nav-badge {
  margin-left: 0.25rem;
  color: var(--navy);
  background: #ffb481;
}

.inline-badge {
  width: fit-content;
  color: var(--action-hover);
  background: var(--action-soft);
}

.form {
  display: grid;
  gap: 0.9rem;
}

.form-inline {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.form-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

label {
  display: grid;
  gap: 0.32rem;
  font-weight: 760;
}

label span {
  color: var(--text);
  font-size: 0.9rem;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-muted);
  padding: 0.68rem 0.75rem;
}

input[readonly] {
  color: var(--navy);
  background: white;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.check input {
  width: 18px;
  min-height: 18px;
}

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

.stats-wide {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.stats > div {
  display: grid;
  gap: 0.1rem;
  padding: 1rem;
}

.stats strong {
  color: var(--action);
  font-size: 2rem;
  line-height: 1;
}

.stats span {
  color: var(--muted);
  font-weight: 720;
}

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

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.72rem 0.65rem;
  text-align: left;
  vertical-align: middle;
}

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

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.row-actions a {
  color: var(--action);
  font-weight: 800;
}

.filters label {
  min-width: min(240px, 100%);
}

.quick-link-grid {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.activity-list,
.meta-list {
  display: grid;
  gap: 0.72rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-list li,
.meta-list li {
  display: grid;
  gap: 0.15rem;
  border-top: 1px solid var(--line);
  padding-top: 0.72rem;
}

.activity-list li:first-child,
.meta-list li:first-child {
  border-top: 0;
  padding-top: 0;
}

.activity-list span,
.activity-list small,
.meta-list span {
  color: var(--muted);
}

.meta-list li {
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  align-items: center;
}

.meta-list strong {
  font-weight: 800;
}

.credential-box {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(180px, 0.8fr) minmax(180px, 0.8fr) auto;
  gap: 0.85rem;
  align-items: end;
  margin-bottom: 1rem;
  border-color: rgba(45, 90, 61, 0.22);
  background: linear-gradient(180deg, rgba(45, 90, 61, 0.08), transparent 70%), var(--surface);
}

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

.danger-zone {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.compact-action {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.notes-grid {
  margin-top: 1rem;
}

.note-list span {
  color: var(--text);
}

.note-list li {
  align-content: start;
}

.message-panel {
  margin-top: 1rem;
}

.message-thread {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}

.message-item {
  width: min(720px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 0.85rem;
}

.message-admin,
.message-own {
  margin-left: auto;
  border-color: rgba(45, 90, 61, 0.22);
  background: linear-gradient(180deg, rgba(45, 90, 61, 0.08), transparent 80%), var(--surface);
}

.message-customer,
.message-other {
  margin-right: auto;
}

.message-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.message-item p {
  margin-bottom: 0;
}

.message-form {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

small {
  color: var(--muted);
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3vw, 2rem);
  color: rgba(255, 255, 255, 0.72);
  background: var(--navy);
  font-size: 0.88rem;
}

@media (max-width: 820px) {
  .topbar,
  .hero-band,
  .section-head,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .topnav {
    justify-content: flex-start;
  }

  .project-grid,
  .content-grid,
  .admin-grid,
  .form-split,
  .stats,
  .stats-wide,
  .credential-box {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: static;
  }

  .form-inline {
    align-items: stretch;
  }

  .form-inline label,
  .form-inline .button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1120px);
  }

  .brand {
    align-items: flex-start;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .topnav a,
  .link-button {
    min-height: 36px;
    padding-inline: 0.58rem;
    font-size: 0.84rem;
  }

  .hero-band,
  .panel,
  .side-panel,
  .project-card,
  .timeline-body {
    padding: 1rem;
  }

  .quick-actions .button,
  .actions .button {
    width: 100%;
  }
}
