:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #617080;
  --line: #d8dee5;
  --surface: #ffffff;
  --soft: #f4f7f9;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #a16207;
  --danger: #b42318;
  --good: #157f3b;
  --shadow: 0 18px 45px rgba(23, 32, 42, 0.10);
}

* {
  box-sizing: border-box;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: #eef3f5;
}

body.is-logged-out .app-header,
body.is-logged-out .app-shell {
  display: none;
}

body.is-logged-in .login-screen {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-panel h1 {
  font-size: 30px;
}

.login-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.auth-pending-panel p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.5;
}

.auth-pending-email {
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--accent-strong) !important;
  word-break: break-word;
}

.version-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.app-version {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

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

.password-control {
  position: relative;
  display: block;
}

.password-control input {
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  display: inline-grid;
  place-items: center;
  width: 32px;
  min-height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--accent-strong);
  cursor: pointer;
  transform: translateY(-50%);
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.password-toggle:hover {
  border-color: var(--accent);
  background: #e7f5f2;
}

.app-header {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(18px, 4vw, 48px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.app-nav {
  display: inline-grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  min-width: min(520px, 100%);
  border: 1px solid var(--line);
  background: var(--surface);
}

.view-button {
  min-height: 40px;
  border: 0;
  border-right: 1px solid var(--line);
  background: white;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.view-button:last-child {
  border-right: 0;
}

.view-button.is-active {
  background: #e7f5f2;
  color: var(--accent-strong);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(26px, 3vw, 38px);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
}

h3 {
  margin-bottom: 10px;
  font-size: 30px;
}

h4 {
  margin-bottom: 12px;
  font-size: 16px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-button,
.secondary-button,
.danger-button,
.dev-button,
.icon-button,
.tab {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.primary-button {
  min-height: 42px;
  padding: 0 18px;
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.secondary-button,
.danger-button,
.dev-button {
  min-height: 42px;
  padding: 0 14px;
  font-weight: 700;
}

.header-actions .primary-button,
.header-actions .secondary-button,
.header-actions .danger-button,
.header-actions .dev-button {
  min-height: 36px;
  padding: 0 10px;
  font-size: 13px;
}

.secondary-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.danger-button {
  color: var(--danger);
}

.danger-button:hover {
  border-color: var(--danger);
  background: #fff1f0;
}

.dev-button {
  border-color: #7c3aed;
  color: #5b21b6;
  background: #f5f3ff;
}

.dev-button:hover,
.dev-button.is-active {
  background: #ede9fe;
}

.dev-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

[hidden] {
  display: none !important;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.icon-button {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  font-size: 22px;
}

.header-actions .icon-button {
  width: 36px;
  height: 36px;
  font-size: 18px;
}

.app-shell {
  padding: 22px clamp(18px, 4vw, 48px) 40px;
}

.process-panel {
  width: min(1180px, 100%);
  display: grid;
  gap: 14px;
  margin: 0 auto 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.process-header,
.process-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.process-header h2 {
  font-size: 20px;
}

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

.process-step {
  position: relative;
  display: grid;
  gap: 8px;
  min-width: 0;
  padding-top: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.process-step::before,
.process-step::after {
  content: "";
  position: absolute;
  top: 6px;
  height: 3px;
  background: var(--line);
}

.process-step::before {
  left: 0;
  right: 50%;
}

.process-step::after {
  left: 50%;
  right: 0;
}

.process-step:first-child::before,
.process-step:last-child::after {
  display: none;
}

.process-marker {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 1;
  width: 15px;
  height: 15px;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: white;
  transform: translateX(-50%);
}

.process-step-label {
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.process-step.is-complete,
.process-step.is-current {
  color: var(--accent-strong);
}

.process-step.is-complete::before,
.process-step.is-complete::after,
.process-step.is-current::before {
  background: var(--accent);
}

.process-step.is-complete .process-marker {
  border-color: var(--accent);
  background: var(--accent);
}

.process-step.is-current .process-marker {
  border-color: var(--accent);
  background: #e7f5f2;
  box-shadow: 0 0 0 5px rgba(15, 118, 110, 0.12);
}

.process-summary {
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--soft);
}

.process-summary strong {
  flex: 0 0 auto;
  color: var(--ink);
}

.process-summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  text-align: right;
}

.app-view {
  display: none;
}

.app-view.is-active {
  display: grid;
}

.input-panel,
.preview-panel,
.inventory-panel {
  min-width: 0;
}

.input-panel {
  width: min(1180px, 100%);
  align-self: start;
  margin: 0 auto;
  grid-template-columns: minmax(0, 860px) minmax(240px, 300px);
  align-items: start;
  gap: 16px;
}

.input-card,
.object-sidebar {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.input-card {
  min-width: 0;
}

.object-sidebar {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 36px);
  padding: 14px;
  overflow: hidden;
}

.object-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.object-sidebar-header h3 {
  margin: 0;
  font-size: 18px;
}

.quick-object-list {
  display: grid;
  gap: 8px;
  overflow-y: auto;
  padding-right: 2px;
}

.quick-object-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 6px;
}

.quick-object-item {
  display: grid;
  gap: 7px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.quick-object-item:hover,
.quick-object-item.is-active {
  border-color: var(--accent);
  background: #f0faf8;
}

.quick-object-item strong,
.quick-object-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-object-item small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.quick-object-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.quick-object-remove {
  width: 36px;
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  align-self: start;
  border: 1px solid var(--line);
  background: white;
  color: var(--danger);
  cursor: pointer;
  font-weight: 800;
}

.quick-object-remove svg,
.inventory-remove svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.quick-object-remove:hover {
  border-color: var(--danger);
  background: #fff1f0;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}

.tab {
  min-height: 48px;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-weight: 700;
}

.tab:last-child {
  border-right: 0;
}

.tab.is-active {
  color: var(--accent-strong);
  background: #e7f5f2;
}

form {
  padding: 18px;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

label,
fieldset {
  display: grid;
  gap: 7px;
  margin-bottom: 15px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

label.is-required,
label.is-status-required {
  position: relative;
}

label.is-required::after,
label.is-status-required::after {
  justify-self: start;
  padding: 2px 7px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

label.is-required::after {
  content: "Pflichtfeld";
}

label.is-status-required::after {
  content: "Pflicht ab In Prüfung";
}

.status-guide {
  display: grid;
  gap: 10px;
  margin: 2px 0 15px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--soft);
}

.status-guide h4 {
  margin: 0;
  font-size: 14px;
}

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

.status-guide-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.status-guide-item p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.14);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: #edf2f5;
  color: #536273;
  cursor: not-allowed;
}

button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.lock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--soft);
}

.lock-row div {
  display: grid;
  gap: 4px;
}

.lock-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.financing-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.financing-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.financing-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.financing-item:hover,
.financing-item.is-active {
  border-color: var(--accent);
  background: #f0faf8;
}

.financing-item span {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tab-panel.is-locked {
  border-top: 4px solid var(--accent);
}

.document-list {
  border: 1px solid var(--line);
  padding: 14px;
}

.document-list legend {
  padding: 0 8px;
}

.document-list label {
  grid-template-columns: minmax(150px, 1fr) minmax(130px, 180px);
  align-items: center;
  margin-bottom: 10px;
  font-weight: 600;
}

.document-list select {
  padding: 8px 10px;
}

.attachment-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: -6px 0 15px;
  list-style: none;
}

.attachment-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: var(--soft);
  font-size: 13px;
}

.attachment-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-list button {
  min-height: 28px;
  border: 1px solid var(--line);
  background: white;
  color: var(--danger);
  cursor: pointer;
  font-weight: 700;
}

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

.note-composer {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.note-composer .secondary-button {
  justify-self: start;
}

.note-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0 0 15px;
  list-style: none;
}

.note-list li {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--soft);
  font-size: 13px;
}

.note-list strong {
  color: var(--accent-strong);
  font-size: 12px;
}

.note-list span {
  line-height: 1.4;
  white-space: pre-wrap;
}

.preview-panel {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: white;
  color: var(--warn);
  font-size: 13px;
  font-weight: 700;
}

.change-pill,
.user-pill,
.object-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid #f3cf75;
  background: #fff8e6;
  color: #8a5a00;
  font-size: 12px;
  font-weight: 800;
}

.header-actions .change-pill {
  min-height: 32px;
}

.user-pill {
  min-height: 32px;
  border-color: var(--line);
  background: var(--soft);
  color: var(--ink);
}

.user-menu {
  position: relative;
}

.user-menu .user-pill {
  cursor: pointer;
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  min-width: 210px;
  display: grid;
  padding: 6px;
  border: 1px solid var(--line);
  background: white;
  box-shadow: 0 16px 36px rgba(23, 32, 42, 0.18);
}

.user-dropdown button {
  min-height: 34px;
  border: 0;
  background: white;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  font-weight: 700;
  padding: 0 10px;
}

.user-dropdown button:hover {
  background: var(--soft);
  color: var(--accent-strong);
}

.header-actions .primary-button.has-changes {
  box-shadow: 0 0 0 3px rgba(161, 98, 7, 0.16);
}

.object-status {
  border-color: var(--line);
  background: var(--soft);
  color: var(--accent-strong);
}

.object-status.is-status-entwurf {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #475569;
}

.object-status.is-status-in-pruefung {
  border-color: #f3cf75;
  background: #fff8e6;
  color: #8a5a00;
}

.object-status.is-status-bankbereit {
  border-color: #9bd8b2;
  background: #ecfdf3;
  color: var(--good);
}

.object-status.is-status-versendet {
  border-color: #b8c3d1;
  background: #eef2f6;
  color: #334155;
}

select.deal-status-select {
  font-weight: 800;
}

select.deal-status-select:disabled {
  opacity: 1;
}

select.deal-status-select.is-status-entwurf,
select.deal-status-select.is-status-entwurf:disabled {
  border-color: #cbd5e1;
  background-color: #f8fafc;
  color: #475569;
  -webkit-text-fill-color: #475569;
}

select.deal-status-select.is-status-in-pruefung,
select.deal-status-select.is-status-in-pruefung:disabled {
  border-color: #f3cf75;
  background-color: #fff8e6;
  color: #8a5a00;
  -webkit-text-fill-color: #8a5a00;
}

select.deal-status-select.is-status-bankbereit,
select.deal-status-select.is-status-bankbereit:disabled {
  border-color: #9bd8b2;
  background-color: #ecfdf3;
  color: var(--good);
  -webkit-text-fill-color: var(--good);
}

select.deal-status-select.is-status-versendet,
select.deal-status-select.is-status-versendet:disabled {
  border-color: #b8c3d1;
  background-color: #eef2f6;
  color: #334155;
  -webkit-text-fill-color: #334155;
}

.status-pill.is-ready {
  color: var(--good);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
}

.metric-card {
  min-height: 100px;
  display: grid;
  align-content: space-between;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.metric-card span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-card strong {
  font-size: 24px;
  letter-spacing: 0;
}

.metric-card.compact {
  min-height: 82px;
  padding: 14px;
}

.metric-card.compact strong {
  font-size: 20px;
}

.mode-switch {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(76px, 1fr));
  border: 1px solid var(--line);
  background: white;
}

.mode-button {
  min-height: 34px;
  border: 0;
  border-right: 1px solid var(--line);
  background: white;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.mode-button:last-child {
  border-right: 0;
}

.mode-button.is-active {
  background: #e7f5f2;
  color: var(--accent-strong);
}

.info-dot {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--accent-strong);
  cursor: help;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.info-wrap {
  position: relative;
  display: inline-grid;
  place-items: center;
}

.tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  z-index: 10;
  width: min(280px, 70vw);
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 14px 34px rgba(23, 32, 42, 0.24);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 10px;
  height: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  transform: translate(-50%, -5px) rotate(45deg);
}

.info-wrap:hover .tooltip,
.info-wrap:focus-within .tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

.mappe-document {
  display: grid;
  gap: 18px;
  padding: clamp(22px, 4vw, 42px);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.mappe-document section {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.mappe-document section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.document-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.valuation-grid {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--soft);
}

.valuation-grid dl {
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 12px;
}

.valuation-grid dt {
  font-weight: 700;
}

.valuation-grid dd {
  font-size: 18px;
}

dl {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 1.1fr;
  gap: 10px 14px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  margin: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

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

.bar-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  background: var(--soft);
  border: 1px solid var(--line);
}

.check-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.check-item {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--line);
  background: var(--soft);
}

.check-item span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.check-item strong,
.check-item b {
  font-size: 13px;
}

.check-item small {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.35;
}

.check-item.is-good {
  border-left-color: var(--good);
}

.check-item.is-warn {
  border-left-color: var(--warn);
}

.check-item.is-bad {
  border-left-color: var(--danger);
}

.check-item.is-bad b {
  color: var(--danger);
}

.amortization-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
}

.amortization-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  background: white;
}

.amortization-table th,
.amortization-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-size: 13px;
}

.amortization-table th:first-child,
.amortization-table td:first-child {
  text-align: left;
}

.amortization-table th {
  background: var(--soft);
  color: var(--muted);
  font-weight: 800;
}

.amortization-table tr:last-child td {
  border-bottom: 0;
}

.document-progress {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  background: #dfe7eb;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 160ms ease;
}

#documentChecklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

#documentChecklist li {
  padding: 9px 10px;
  background: var(--soft);
  border-left: 4px solid var(--line);
  font-size: 13px;
  font-weight: 700;
}

#documentChecklist li.is-done {
  border-left-color: var(--good);
}

#documentChecklist li.is-missing {
  border-left-color: var(--danger);
  color: var(--danger);
}

.inventory-panel {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 16px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.inventory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.inventory-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 4px;
}

.inventory-toolbar h3 {
  margin: 0;
  font-size: 20px;
}

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

.inventory-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 70px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.inventory-item:hover,
.inventory-item.is-active {
  border-color: var(--accent);
  background: #f0faf8;
}

.inventory-item span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.inventory-item span:last-child {
  text-align: right;
}

.inventory-item strong,
.inventory-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-item small,
.empty-state {
  color: var(--muted);
}

.inventory-remove {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  background: white;
  color: var(--danger);
  cursor: pointer;
  font-size: 16px;
  font-weight: 800;
}

.inventory-remove:hover {
  border-color: var(--danger);
  background: #fff1f0;
}

.empty-state {
  margin: 0;
  padding: 14px;
  border: 1px dashed var(--line);
  background: var(--soft);
}

.app-view:not(.is-active) {
  display: none;
}

.account-panel {
  width: min(980px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 16px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.account-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
}

.account-grid article {
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--soft);
}

.account-grid h3 {
  margin-bottom: 12px;
  font-size: 18px;
}

.profile-form {
  display: grid;
  gap: 12px;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.form-message.is-error {
  color: var(--danger);
}

.form-message.is-success {
  color: var(--accent-strong);
}

.setting-row {
  grid-template-columns: 18px 1fr;
  align-items: center;
  margin-bottom: 10px;
}

.setting-row input {
  width: 16px;
  height: 16px;
}

.account-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-weight: 700;
}

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

.feature-list {
  padding-left: 0;
  list-style: none;
}

.feature-list li {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.feature-list strong {
  color: var(--ink);
}

.feature-list span,
.account-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
}

.admin-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: white;
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
}

.admin-table th {
  background: var(--soft);
  color: var(--muted);
  font-weight: 800;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.role-admin-list {
  display: grid;
  gap: 14px;
}

.role-admin-list article {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--soft);
}

.role-admin-list h3 {
  margin: 0;
  font-size: 18px;
}

.role-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 8px 12px;
}

@media (max-width: 980px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .input-panel {
    grid-template-columns: 1fr;
  }

  .object-sidebar {
    position: static;
    max-height: 360px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .portfolio-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .account-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  body {
    background: var(--surface);
  }

  .login-screen {
    align-items: start;
    padding: 16px;
  }

  .login-panel {
    width: 100%;
    padding: 18px;
    box-shadow: none;
  }

  .app-header,
  .preview-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-header {
    gap: 14px;
    padding: 16px;
  }

  .app-header h1 {
    font-size: 24px;
  }

  .header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .header-actions > button,
  .header-actions .user-menu,
  .header-actions .dev-actions,
  .header-actions .change-pill {
    width: 100%;
  }

  .header-actions .user-menu,
  .header-actions .dev-actions {
    grid-column: 1 / -1;
  }

  .user-menu {
    display: grid;
    gap: 8px;
  }

  .user-pill,
  .app-version {
    justify-content: center;
  }

  .app-shell {
    padding: 14px;
  }

  .process-panel {
    padding: 14px;
  }

  .process-header,
  .process-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .process-summary span {
    text-align: left;
  }

  .process-step-label {
    white-space: normal;
  }

  .app-nav {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .view-button {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .view-button:last-child {
    border-bottom: 0;
  }

  .inventory-header,
  .inventory-toolbar,
  .financing-item,
  .inventory-item {
    grid-template-columns: 1fr;
    align-items: flex-start;
    flex-direction: column;
  }

  .inventory-item span:last-child {
    text-align: left;
  }

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

  .quick-object-remove,
  .inventory-remove {
    width: 100%;
    min-height: 36px;
  }

  .field-grid,
  .document-grid,
  .valuation-grid dl,
  .check-list,
  #documentChecklist,
  .portfolio-grid,
  .account-grid,
  .role-feature-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  dl {
    grid-template-columns: 1fr;
  }

  .account-panel {
    width: 100%;
  }

  .account-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media print {
  body {
    background: white;
  }

  .app-header,
  .input-panel,
  .metric-grid,
  .inventory-panel,
  .process-panel,
  .preview-toolbar {
    display: none;
  }

  .app-shell {
    display: block;
    padding: 0;
  }

  .mappe-document {
    border: 0;
    box-shadow: none;
  }
}
