/* Zugzwang Immo – customer portal styles. Reuses site vars and .btn classes. */

.zp-main { padding-block: 2rem 4rem; }

.zp {
  max-width: 52rem;
  margin: 0 auto;
  color: var(--ink);
  line-height: 1.5;
}
.zp *, .zp *::before, .zp *::after { box-sizing: border-box; }

.zp [hidden] { display: none !important; }

.zp-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Focus */
.zp a:focus-visible,
.zp button:focus-visible,
.zp input:focus-visible,
.zp textarea:focus-visible,
.zp summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.zp a { color: var(--accent-dark); }
.zp .btn { min-height: 44px; }
.zp a.btn { text-decoration: none; }

/* Typography */
.zp-h1 {
  font-size: clamp(1.5rem, 4.5vw, 2.1rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
  overflow-wrap: anywhere;
}
.zp-h2 { font-size: 1.2rem; line-height: 1.25; margin: 0 0 .75rem; }
.zp-h3 { font-size: 1.02rem; line-height: 1.3; margin: 0 0 .5rem; }
.zp-muted { color: var(--muted); }
.zp-small { font-size: .9rem; }
.zp-intro { color: var(--muted); max-width: 40rem; margin: 0 0 1.5rem; }
.zp p { margin: 0 0 .75rem; }
.zp p:last-child { margin-bottom: 0; }
.zp-help-line { margin-top: 1.5rem; text-align: center; }

/* Nav */
.zp-nav {
  display: flex;
  gap: .25rem;
  margin: 0 0 1.5rem;
  border-bottom: 1px solid var(--line);
}
.zp-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 .9rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-weight: 500;
}
.zp-nav a:hover { color: var(--ink); }
.zp-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* Notices */
.zp-notices:empty { display: none; }
.zp-notice {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: #eef6f0;
  border: 1px solid #b9d9c3;
  border-radius: var(--r);
  padding: .5rem .5rem .5rem 1rem;
  margin: 0 0 1rem;
}
.zp-notice p { flex: 1; margin: 0; }
.zp-notice-x {
  min-width: 44px; min-height: 44px;
  background: none; border: 0;
  font-size: 1.4rem; line-height: 1;
  color: var(--muted); cursor: pointer;
  border-radius: var(--r);
}
.zp-notice-x:hover { color: var(--ink); background: rgba(0,0,0,.04); }

/* Cards */
.zp-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.25rem;
  margin: 0 0 1.25rem;
}
@media (min-width: 640px) {
  .zp-card { padding: 1.75rem; }
}

.zp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin: 0 0 1rem;
}
.zp-head .zp-h1 { margin: 0; }

.zp-back { margin: 0 0 1rem; }
.zp-back a {
  display: inline-flex; align-items: center; min-height: 44px;
  color: var(--muted); text-decoration: none;
}
.zp-back a:hover { color: var(--ink); text-decoration: underline; }

/* Loading / errors */
.zp-loading {
  display: flex; align-items: center; gap: .6rem;
  color: var(--muted);
  padding: 1rem 0;
}
.zp-spinner {
  width: 1.1rem; height: 1.1rem;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: zp-spin .8s linear infinite;
}
@keyframes zp-spin { to { transform: rotate(360deg); } }
.zp-error { border-color: #e5b8a8; background: #fdf6f3; }
.zp-error .btn { margin-top: .5rem; }
.zp-err { color: #a3260b; font-size: .9rem; margin: .35rem 0 0; }
.zp-ok { color: #1f7a3d; }

/* Empty state */
.zp-empty { text-align: left; padding-block: 2rem; }
.zp-empty .btn { margin-top: .5rem; }

/* Rows: input + button */
.zp-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: stretch;
}
.zp-row .zp-input { flex: 1 1 14rem; min-width: 0; }
.zp-row .btn { flex: 0 0 auto; }

/* Inputs */
.zp-input {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: .7rem .85rem;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.zp-input:hover { border-color: #c4c1b9; }
.zp-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(200,64,28,.15); outline: none; }
.zp-input[aria-invalid="true"] { border-color: #a3260b; }
.zp-input[readonly] { background: var(--bg); }
.zp-textarea { resize: vertical; min-height: 6rem; line-height: 1.45; }
.zp-link-input { font-size: .9rem; }

/* Form */
.zp-fs { border: 0; margin: 0; padding: 0; min-width: 0; }
.zp-fs:disabled { opacity: .75; }
.zp-field { margin: 0 0 1.35rem; border: 0; padding: 0; min-width: 0; }
.zp-fieldset { margin-bottom: 1.5rem; }
.zp-label {
  display: block;
  font-weight: 600;
  margin: 0 0 .4rem;
  padding: 0;
}
.zp-req { color: var(--accent); }
.zp-help { color: var(--muted); font-size: .88rem; margin: .35rem 0 0; }
.zp-grid2 { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
@media (min-width: 640px) {
  .zp-grid2 { grid-template-columns: 1fr 1fr; }
}

/* Radio cards */
.zp-radio-grid { display: grid; grid-template-columns: 1fr; gap: .6rem; }
@media (min-width: 640px) {
  .zp-radio-grid { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
}
.zp-radio {
  position: relative;
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  min-height: 48px;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--paper);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.zp-radio:hover { border-color: #c4c1b9; }
.zp-radio input {
  flex: 0 0 auto;
  width: 1.15rem; height: 1.15rem;
  margin: .15rem 0 0;
  accent-color: var(--accent);
}
.zp-radio:has(input:checked) { border-color: var(--accent); background: #fcf3ef; box-shadow: inset 0 0 0 1px var(--accent); }
.zp-radio:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.zp-radio-body { display: flex; flex-direction: column; gap: .15rem; }
.zp-radio-t { font-weight: 600; }
.zp-radio-s { color: var(--muted); font-size: .88rem; }

/* Drop zone */
.zp-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  text-align: center;
  padding: 1.5rem 1rem;
  border: 2px dashed var(--line);
  border-radius: var(--r);
  background: var(--bg);
  transition: border-color .15s ease, background-color .15s ease;
}
.zp-drop.is-over { border-color: var(--accent); background: #fcf3ef; }
.zp-drop.is-invalid { border-color: #a3260b; }
.zp-drop-icon {
  width: 2.25rem; height: 1.75rem;
  border: 2px solid var(--muted);
  border-radius: 4px;
  position: relative;
  opacity: .7;
}
.zp-drop-icon::after {
  content: "";
  position: absolute;
  left: 22%; bottom: 18%;
  width: 56%; height: 40%;
  background: linear-gradient(135deg, transparent 49%, var(--muted) 50%);
  clip-path: polygon(0 100%, 40% 20%, 60% 60%, 75% 40%, 100% 100%);
}
.zp-file-notes { list-style: none; margin: .5rem 0 0; padding: 0; color: #8a5a00; font-size: .88rem; }
.zp-file-notes:empty { display: none; }
.zp-files {
  list-style: none;
  margin: .75rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: .5rem;
}
@media (min-width: 640px) {
  .zp-files { grid-template-columns: 1fr 1fr; }
}
.zp-files:empty { display: none; }
.zp-file {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .4rem .4rem .4rem .4rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--paper);
  min-width: 0;
}
.zp-file-thumb {
  flex: 0 0 auto;
  width: 56px; height: 42px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg);
}
.zp-fileicon {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .68rem; font-weight: 700; letter-spacing: .04em;
  color: var(--muted);
  border: 1px solid var(--line);
}
.zp-file-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .9rem;
}
.zp-file-rm {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 .75rem;
  background: none;
  border: 0;
  border-radius: var(--r);
  color: var(--muted);
  font: inherit;
  font-size: .88rem;
  cursor: pointer;
  text-decoration: underline;
}
.zp-file-rm:hover { color: var(--accent-dark); background: rgba(0,0,0,.03); }

/* Consent */
.zp-check { display: flex; gap: .75rem; align-items: flex-start; }
.zp-check input {
  flex: 0 0 auto;
  width: 1.3rem; height: 1.3rem;
  margin: .15rem 0 0;
  accent-color: var(--accent);
}
.zp-check label { font-size: .95rem; cursor: pointer; }
.zp-form-err {
  background: #fdf6f3;
  border: 1px solid #e5b8a8;
  border-radius: var(--r);
  padding: .75rem 1rem;
  margin: 0 0 1rem;
  color: #a3260b;
}
.zp-progress { margin: .75rem 0 0; color: var(--muted); font-size: .9rem; text-align: center; min-height: 1.4em; }

/* Order list */
.zp-list { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: .6rem; }
.zp-order {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem 1.15rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--ink);
  text-decoration: none;
  min-height: 44px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.zp .zp-order { color: var(--ink); }
.zp-order:hover { border-color: #c4c1b9; box-shadow: 0 2px 8px rgba(17,18,20,.05); }
.zp-order-main { display: flex; flex-direction: column; gap: .15rem; min-width: 0; flex: 1 1 14rem; }
.zp-order-title { font-weight: 600; overflow-wrap: anywhere; }
.zp-order-meta { color: var(--muted); font-size: .88rem; }
.zp-order-side { display: flex; align-items: center; gap: .75rem; }
.zp-order-open { color: var(--accent-dark); font-weight: 500; font-size: .92rem; white-space: nowrap; }

/* Pills */
.zp-pill {
  display: inline-flex;
  align-items: center;
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.4;
  background: #efeeea;
  color: #3c3e43;
  border: 1px solid #e2e0da;
  white-space: nowrap;
}
.zp-pill--ready { background: #e7f3eb; color: #1f7a3d; border-color: #c4e2cf; }
.zp-pill--due { background: #fdf3df; color: #8a5a00; border-color: #f1ddb0; }
.zp-pill--off { background: #f2f1ee; color: var(--muted); }
.zp-pill--paid { background: #e7f3eb; color: #1f7a3d; border-color: #c4e2cf; white-space: normal; }
.zp-pill--sm { font-size: .76rem; padding: .1rem .5rem; }
.zp-redo-open { background: #fdf3df; color: #8a5a00; border-color: #f1ddb0; }
.zp-redo-done { background: #e7f3eb; color: #1f7a3d; border-color: #c4e2cf; }
.zp-redo-declined { background: #fbeeea; color: #a3260b; border-color: #efcbbf; white-space: normal; }
.zp-badges { margin-top: 1rem; }

/* Status + steps */
.zp-order-h { margin-bottom: 1rem; }
.zp-status-top { margin: 0 0 1rem; }
.zp-steps {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  counter-reset: none;
}
.zp-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .35rem;
  min-width: 0;
  padding: 0 .15rem;
}
.zp-step::before {
  content: "";
  position: absolute;
  top: .9rem;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--line);
  z-index: 0;
}
.zp-step:first-child::before { display: none; }
.zp-step.is-done::before, .zp-step.is-current::before { background: var(--accent); }
.zp-step-dot {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem; height: 1.8rem;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--line);
  color: var(--muted);
  font-size: .8rem;
  font-weight: 700;
}
.zp-step.is-done .zp-step-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.zp-step.is-current .zp-step-dot { border-color: var(--accent); color: var(--accent-dark); box-shadow: 0 0 0 4px rgba(200,64,28,.12); }
.zp-step.is-current.is-done .zp-step-dot { color: #fff; }
.zp-step-l {
  font-size: .76rem;
  line-height: 1.2;
  color: var(--muted);
  overflow-wrap: anywhere;
  hyphens: auto;
}
.zp-step.is-current .zp-step-l { color: var(--ink); font-weight: 600; }
@media (min-width: 640px) {
  .zp-step-l { font-size: .88rem; }
}

.zp-readyby {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .9rem 1rem;
  background: var(--bg);
  border-radius: var(--r);
  margin: 0 0 1rem;
}
.zp-readyby-h { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.zp-readyby-t { font-size: 1.1rem; }
.zp-readyby--after { flex-direction: row; font-weight: 500; }
.zp-readyby--after:empty { display: none; }

.zp-pay {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.zp-pay .btn { margin: .25rem 0 .9rem; }
.zp-notify { margin-top: 1rem; }

/* Confirmation / link */
.zp-conf { border-color: #c4e2cf; background: #f6fbf7; }
.zp-linkblock { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid #d6e9dc; }
.zp-linkblock .zp-row { margin-bottom: .75rem; }
.zp-linkdetails { padding: 0; }
.zp-linkdetails summary {
  display: flex; align-items: center;
  min-height: 48px;
  padding: .5rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: .95rem;
  list-style-position: inside;
}
.zp-linkdetails[open] { padding-bottom: 1.25rem; }
.zp-linkdetails > :not(summary) { margin-left: 1.25rem; margin-right: 1.25rem; }
.zp .btn.is-copied { border-color: #1f7a3d; color: #1f7a3d; }

/* Download */
.zp-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0 .75rem; }

/* Photo grid */
.zp-grid {
  list-style: none;
  margin: .75rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}
@media (min-width: 640px) { .zp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 960px) { .zp-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.zp-photo { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.zp-photo-img {
  aspect-ratio: 4 / 3;
  background: var(--bg);
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--line);
}
.zp-photo-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.zp-photo-n { font-size: .85rem; font-weight: 600; margin: 0; }
.zp-photo-ctrl { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; }
.zp-redo-btn { width: 100%; }
.zp-redo-form {
  width: 100%;
  margin-top: .25rem;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg);
}
.zp-redo-form .zp-textarea { min-height: 5rem; }
.zp-redo-form .zp-actions { margin-bottom: 0; }
@media (max-width: 639px) {
  .zp-photo:has(.zp-redo-form) { grid-column: 1 / -1; }
}

/* Messages */
.zp-thread {
  list-style: none;
  margin: 0 0 1rem;
  padding: .25rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  max-height: 28rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.zp-msg {
  max-width: 85%;
  padding: .6rem .85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.zp-msg--studio { align-self: flex-start; background: var(--bg); border-bottom-left-radius: 4px; }
.zp-msg--you {
  align-self: flex-end;
  background: #fbefea;
  border-color: #efcfc3;
  border-bottom-right-radius: 4px;
}
.zp-msg-meta { font-size: .78rem; color: var(--muted); margin: 0 0 .2rem; }
.zp-msg-meta strong { color: var(--ink); font-weight: 600; }
.zp-msg-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.zp-msg-empty { padding: .75rem; text-align: center; }
.zp-composer { border-top: 1px solid var(--line); padding-top: 1rem; }
.zp-composer-actions { display: flex; justify-content: flex-end; margin-top: .5rem; }

/* Details */
.zp-facts { margin: 0; display: grid; gap: 0; }
.zp-fact {
  display: grid;
  grid-template-columns: minmax(6.5rem, 34%) 1fr;
  gap: .75rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--line);
}
.zp-fact:last-child { border-bottom: 0; }
.zp-fact dt { color: var(--muted); font-size: .9rem; }
.zp-fact dd { margin: 0; overflow-wrap: anywhere; }

/* Account */
.zp-acct { padding: 1rem 1.25rem; background: transparent; }
.zp-acct .zp-h3 { font-size: .98rem; }
.zp-acct-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.zp-acct-row p { margin: 0; overflow-wrap: anywhere; }
.zp-acct--muted { border-style: dashed; }

/* Link box */
.zp-linkbox .zp-h3 label { cursor: pointer; }
.zp-notfound { border-color: #f1ddb0; background: #fffaf0; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .zp *, .zp *::before, .zp *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .zp-spinner { animation: none; border-top-color: var(--line); }
}
