:root {
  --ink: #202320;
  --ink-soft: #343934;
  --muted: #747a73;
  --paper: #f5f2ec;
  --panel: #fff;
  --line: #e4dfd6;
  --accent: #bd8f57;
  --accent-dark: #8b6236;
  --accent-soft: #f5e9da;
  --green: #2f704e;
  --green-soft: #e3f0e8;
  --red: #a34040;
  --shadow: 0 22px 70px rgba(25,29,25,.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
html { min-height: 100%; }
body { min-height: 100vh; margin: 0; background: var(--paper); }
button, input, textarea { font: inherit; }
[hidden] { display: none !important; }
a { color: inherit; }
.eyebrow { margin: 0 0 8px; color: var(--accent-dark); font-size: .72rem; font-weight: 820; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow.light { color: #e2b982; }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 17px; border-radius: 11px; font-weight: 760; text-decoration: none; cursor: pointer; transition: .18s; }
.primary-button { border: 0; background: var(--ink); color: white; box-shadow: 0 10px 26px rgba(32,35,32,.16); }
.primary-button:hover { transform: translateY(-1px); background: #111311; }
.primary-button:disabled { opacity: .55; cursor: wait; transform: none; }
.secondary-button { border: 1px solid var(--line); background: white; color: var(--ink); }
.secondary-button:hover { border-color: var(--accent); background: #fcf7f0; }

.portal-header { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 82px; padding: 14px clamp(18px, 4vw, 58px); border-bottom: 1px solid var(--line); background: rgba(248,246,241,.92); backdrop-filter: blur(18px); }
.portal-brand img { width: 205px; height: auto; }
.portal-header-actions { display: flex; align-items: center; gap: 12px; }
.header-phone { display: grid; justify-items: end; text-decoration: none; }
.header-phone span { color: var(--muted); font-size: .65rem; }
.header-phone strong { font-size: .88rem; }
.back-to-site { padding-left: 13px; border-left: 1px solid var(--line); color: var(--muted); font-size: .77rem; text-decoration: none; }
.account-button { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 5px 11px 5px 6px; border: 1px solid var(--line); border-radius: 999px; background: white; font-size: .74rem; font-weight: 730; cursor: pointer; }
.account-avatar { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; background: var(--accent); color: var(--ink); font-size: .68rem; font-weight: 850; }

.loading-screen { display: grid; place-items: center; align-content: center; min-height: calc(100vh - 82px); color: var(--muted); text-align: center; }
.loader { width: 44px; height: 44px; border: 3px solid #ddd7ce; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.portal-auth { display: grid; grid-template-columns: 1.15fr .85fr; min-height: calc(100vh - 82px); }
.auth-visual { position: relative; display: flex; align-items: flex-end; overflow: hidden; padding: clamp(38px, 7vw, 95px); background: #222622; color: white; }
.auth-visual::before { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, rgba(23,26,23,.88), rgba(23,26,23,.26)), url('/assets/projects/waschtisch-doppelbecken.webp') center/cover; filter: saturate(.7); }
.auth-visual > div { position: relative; z-index: 1; max-width: 660px; }
.auth-visual h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(3rem, 6vw, 6rem); font-weight: 500; line-height: .98; }
.auth-visual p:last-child { max-width: 540px; margin-top: 22px; color: rgba(255,255,255,.72); font-size: 1.02rem; line-height: 1.65; }
.auth-panel { display: grid; place-items: center; padding: 40px; background: #f8f5ef; }
.auth-card { width: min(100%, 460px); padding: 35px; border: 1px solid var(--line); border-radius: 20px; background: white; box-shadow: var(--shadow); }
.auth-card h2 { margin: 0; font-family: Georgia, serif; font-size: 2.6rem; font-weight: 500; }
.auth-card > p:not(.eyebrow) { color: var(--muted); line-height: 1.55; }
.auth-card form { display: grid; gap: 15px; margin-top: 24px; }
.auth-card label, .account-card label { display: grid; gap: 7px; color: var(--ink-soft); font-size: .8rem; font-weight: 740; }
input, textarea { width: 100%; border: 1px solid #d7d1c7; border-radius: 11px; background: white; color: var(--ink); outline: 0; transition: border-color .18s, box-shadow .18s; }
input { min-height: 48px; padding: 11px 13px; }
textarea { padding: 12px 13px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(189,143,87,.13); }
.auth-hint { display: grid; gap: 5px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.auth-hint strong { font-size: .78rem; }
.auth-hint span { color: var(--muted); font-size: .7rem; line-height: 1.5; }
.form-error { padding: 11px 13px; border: 1px solid rgba(163,64,64,.22); border-radius: 10px; background: #f9e9e7; color: var(--red); font-size: .78rem; font-weight: 680; }

.invalid-screen { display: grid; place-items: center; min-height: calc(100vh - 82px); padding: 30px; }
.invalid-card { width: min(100%, 680px); padding: clamp(30px, 6vw, 64px); border: 1px solid var(--line); border-radius: 24px; background: white; box-shadow: var(--shadow); text-align: center; }
.invalid-icon { display: grid; place-items: center; width: 68px; height: 68px; margin: 0 auto 20px; border-radius: 50%; background: #f9e9e7; color: var(--red); font-size: 1.8rem; font-weight: 800; }
.invalid-card h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(2.3rem, 5vw, 4rem); font-weight: 500; }
.invalid-card > p:not(.eyebrow) { max-width: 520px; margin: 18px auto 25px; color: var(--muted); line-height: 1.6; }
.invalid-card > div:last-child { display: flex; justify-content: center; gap: 9px; }

.portal-workspace { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: calc(100vh - 82px); }
.portal-workspace:not(:has(.project-sidebar:not([hidden]))) { grid-template-columns: 1fr; }
.project-sidebar { position: sticky; top: 82px; align-self: start; display: flex; flex-direction: column; min-height: calc(100vh - 82px); padding: 28px 18px 20px; border-right: 1px solid var(--line); background: #eeebe5; }
.sidebar-title { padding: 0 8px; }
.sidebar-title h2 { margin: 0; font-family: Georgia, serif; font-size: 1.7rem; font-weight: 500; }
.project-list { display: grid; gap: 8px; margin-top: 24px; }
.project-list-item { display: grid; gap: 5px; width: 100%; padding: 13px; border: 1px solid transparent; border-radius: 12px; background: transparent; text-align: left; cursor: pointer; }
.project-list-item:hover { background: rgba(255,255,255,.55); }
.project-list-item.is-active { border-color: var(--line); background: white; box-shadow: 0 8px 20px rgba(32,35,32,.05); }
.project-list-item strong { font-size: .76rem; }
.project-list-item span { color: var(--muted); font-size: .66rem; }
.project-list-item small { width: fit-content; padding: 3px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); font-size: .6rem; font-weight: 740; }
.logout-link { margin-top: auto; padding: 10px; border: 0; background: transparent; color: var(--muted); text-decoration: underline; cursor: pointer; }
.project-content { min-width: 0; padding: clamp(22px, 4vw, 54px); }
.project-content > * { width: min(100%, 1260px); margin-right: auto; margin-left: auto; }
.project-hero { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .45fr); gap: 18px; margin-bottom: 18px; }
.project-hero-copy { padding: clamp(27px, 5vw, 54px); border-radius: 24px; background: linear-gradient(125deg, #202420, #343a34); color: white; box-shadow: var(--shadow); }
.hero-meta { display: flex; flex-wrap: wrap; gap: 12px; color: rgba(255,255,255,.55); font-size: .7rem; font-weight: 700; }
.hero-meta span:first-child { color: #e5bb84; letter-spacing: .08em; }
.project-hero h1 { max-width: 760px; margin: 18px 0 10px; font-family: Georgia, serif; font-size: clamp(2.5rem, 5vw, 5rem); font-weight: 500; line-height: 1; }
.project-hero-copy > p { max-width: 700px; color: rgba(255,255,255,.67); line-height: 1.55; }
.status-summary { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-top: 35px; }
.status-summary span { display: block; color: rgba(255,255,255,.48); font-size: .66rem; font-weight: 760; letter-spacing: .08em; text-transform: uppercase; }
.status-summary strong { display: block; margin-top: 5px; color: #f1d2aa; font-size: 1.02rem; }
.progress-number { color: rgba(255,255,255,.4); font-family: Georgia, serif; font-size: 2rem; }
.progress-track { height: 7px; margin-top: 13px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.1); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #efd1a8); transition: width .45s ease; }
.service-card { display: grid; align-content: center; justify-items: start; padding: 27px; border: 1px solid var(--line); border-radius: 24px; background: white; box-shadow: 0 10px 35px rgba(32,35,32,.06); }
.service-avatar { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 16px; border-radius: 50%; background: var(--accent); font-weight: 880; }
.service-card small, .service-card strong { display: block; }
.service-card small { color: var(--muted); font-size: .68rem; }
.service-card strong { margin-top: 3px; font-size: 1rem; }
.service-card p { color: var(--muted); font-size: .76rem; line-height: 1.55; }
.service-card a { display: inline-flex; min-height: 38px; align-items: center; padding: 8px 12px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-dark); font-size: .72rem; font-weight: 780; text-decoration: none; }
.account-invite { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; padding: 16px 18px; border: 1px solid rgba(189,143,87,.35); border-radius: 16px; background: #fffaf3; }
.account-invite > div:first-child { display: flex; align-items: center; gap: 13px; }
.invite-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-dark); }
.account-invite strong { display: block; font-size: .8rem; }
.account-invite p { margin: 3px 0 0; color: var(--muted); font-size: .7rem; }
.invite-actions { display: flex; gap: 8px; white-space: nowrap; }
.invite-actions .primary-button, .invite-actions .secondary-button { min-height: 39px; font-size: .7rem; }
.portal-tabs { display: flex; gap: 4px; margin-top: 28px; border-bottom: 1px solid var(--line); }
.portal-tabs button { position: relative; min-height: 48px; padding: 10px 16px; border: 0; background: transparent; color: var(--muted); font-size: .77rem; font-weight: 760; cursor: pointer; }
.portal-tabs button.is-active { color: var(--ink); }
.portal-tabs button.is-active::after { content: ""; position: absolute; right: 14px; bottom: -1px; left: 14px; height: 2px; background: var(--accent); }
.portal-tabs b { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 5px; padding: 0 5px; border-radius: 999px; background: var(--red); color: white; font-size: .6rem; }
.portal-panel { padding-top: 18px; }
.content-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 16px; }
.portal-card { padding: clamp(19px, 3vw, 28px); border: 1px solid var(--line); border-radius: 19px; background: white; box-shadow: 0 8px 30px rgba(32,35,32,.04); }
.card-head { display: flex; align-items: start; justify-content: space-between; gap: 15px; margin-bottom: 22px; }
.card-head h2 { margin: 0; font-family: Georgia, serif; font-size: 1.8rem; font-weight: 500; }
.customer-timeline { position: relative; display: grid; padding-left: 18px; }
.customer-timeline::before { content: ""; position: absolute; top: 8px; bottom: 18px; left: 5px; width: 1px; background: var(--line); }
.customer-timeline-item { position: relative; padding: 0 0 22px 18px; }
.customer-timeline-item::before { content: ""; position: absolute; top: 5px; left: -17px; width: 9px; height: 9px; border: 2px solid white; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.customer-timeline-item:first-child::before { background: var(--green); box-shadow: 0 0 0 5px var(--green-soft); }
.customer-timeline-item strong { display: block; font-size: .8rem; }
.customer-timeline-item p { margin: 4px 0; color: var(--muted); font-size: .72rem; line-height: 1.45; }
.customer-timeline-item time { color: #9a9e98; font-size: .63rem; }
.customer-detail-list { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 20px; margin: 0; }
.customer-detail-list div { min-width: 0; }
.customer-detail-list dt { color: var(--muted); font-size: .62rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.customer-detail-list dd { margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; font-size: .77rem; font-weight: 660; line-height: 1.45; }
.customer-detail-list .wide { grid-column: 1 / -1; }
.next-step-card { display: grid; grid-template-columns: 50px 1fr; gap: 14px; align-items: center; margin-top: 16px; padding: 18px 21px; border-radius: 17px; background: var(--accent-soft); }
.next-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--ink); color: white; }
.next-step-card span { display: block; color: var(--accent-dark); font-size: .65rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.next-step-card strong { display: block; margin-top: 3px; }
.next-step-card p { margin: 4px 0 0; color: var(--muted); font-size: .69rem; }
.message-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; }
.chat-card { min-height: 650px; }
.response-note { padding: 6px 9px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: .63rem; font-weight: 760; }
.customer-chat { display: flex; flex-direction: column; gap: 12px; min-height: 370px; max-height: 520px; overflow-y: auto; padding: 5px 3px 22px; }
.message { display: grid; max-width: 74%; }
.message.customer { align-self: flex-end; justify-items: end; }
.message.admin { align-self: flex-start; }
.message.system { align-self: center; max-width: 88%; text-align: center; }
.message-bubble { padding: 11px 14px; border-radius: 15px; background: #f1eee8; font-size: .78rem; line-height: 1.55; white-space: pre-wrap; }
.message.customer .message-bubble { background: var(--ink); color: white; border-bottom-right-radius: 4px; }
.message.admin .message-bubble { border-bottom-left-radius: 4px; }
.message.system .message-bubble { padding: 8px 12px; background: #faf7f1; color: var(--muted); font-size: .68rem; }
.message-meta { margin-top: 5px; color: var(--muted); font-size: .62rem; }
.message-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.message-files a { padding: 5px 8px; border-radius: 8px; background: rgba(255,255,255,.15); color: inherit; font-size: .64rem; text-decoration: none; }
.message.admin .message-files a { border: 1px solid var(--line); background: white; }
.customer-compose { padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: #faf8f4; }
.customer-compose textarea { border: 0; background: transparent; box-shadow: none; }
.compose-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; padding-top: 9px; border-top: 1px solid var(--line); }
.attach-button { display: inline-flex; align-items: center; min-height: 38px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; background: white; font-size: .69rem; font-weight: 740; cursor: pointer; }
.customer-compose-files { display: flex; flex-wrap: wrap; gap: 6px; }
.compose-file { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 8px; background: white; font-size: .64rem; }
.compose-file button { border: 0; background: transparent; color: var(--red); cursor: pointer; }
.contact-aside { display: grid; align-content: start; gap: 12px; }
.contact-box, .security-box { padding: 21px; border: 1px solid var(--line); border-radius: 17px; background: white; }
.contact-box h3 { margin: 0; font-family: Georgia, serif; font-size: 1.8rem; font-weight: 500; }
.contact-box p, .security-box p { color: var(--muted); font-size: .73rem; line-height: 1.55; }
.contact-box a { display: block; color: var(--accent-dark); font-size: 1.2rem; font-weight: 800; text-decoration: none; }
.contact-box small { color: var(--muted); font-size: .64rem; }
.security-box { background: #f9f6f0; }
.security-box strong { font-size: .76rem; }
.document-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.document-card { display: grid; grid-template-columns: 43px 1fr auto; gap: 10px; align-items: center; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; }
.document-card:hover { border-color: var(--accent); background: #fcf8f2; }
.document-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-dark); font-size: .64rem; font-weight: 820; }
.document-card strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .72rem; }
.document-card small { color: var(--muted); font-size: .63rem; }
.empty-documents { grid-column: 1 / -1; padding: 40px; color: var(--muted); text-align: center; }

.account-dialog { width: min(580px, calc(100vw - 28px)); max-width: none; padding: 0; border: 0; border-radius: 20px; box-shadow: var(--shadow); }
.account-dialog::backdrop { background: rgba(18,21,18,.62); backdrop-filter: blur(6px); }
.account-card { display: grid; gap: 14px; padding: 25px; background: white; }
.account-card > header { display: flex; align-items: start; justify-content: space-between; gap: 15px; }
.account-card h2 { margin: 0; font-family: Georgia, serif; font-size: 2.1rem; font-weight: 500; }
.account-card > p { margin: 0 0 5px; color: var(--muted); font-size: .76rem; line-height: 1.55; }
.account-card small { color: var(--muted); font-size: .64rem; font-weight: 500; }
.account-card footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.dialog-close { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: white; color: var(--muted); font-size: 1.35rem; cursor: pointer; }
.portal-toast { position: fixed; z-index: 80; right: 20px; bottom: 20px; max-width: 390px; padding: 13px 16px; border-left: 4px solid var(--green); border-radius: 10px; background: var(--ink); color: white; box-shadow: 0 16px 45px rgba(0,0,0,.25); font-size: .78rem; }
.portal-toast.error { border-left-color: var(--red); }

@media (max-width: 1080px) {
  .project-hero { grid-template-columns: 1fr; }
  .service-card { grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; }
  .service-avatar { margin: 0; }
  .service-card p { margin: 4px 0; }
  .content-grid { grid-template-columns: 1fr; }
  .message-layout { grid-template-columns: 1fr; }
  .contact-aside { grid-template-columns: 1fr 1fr; }
  .document-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .portal-auth { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-panel { min-height: calc(100vh - 82px); }
  .portal-workspace { grid-template-columns: 1fr; }
  .project-sidebar { position: static; min-height: 0; padding: 15px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-title { display: none; }
  .project-list { display: flex; overflow-x: auto; margin: 0; }
  .project-list-item { min-width: 200px; }
  .logout-link { margin: 8px 0 0; }
  .account-invite { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 650px) {
  .portal-header { min-height: 70px; padding: 11px 15px; }
  .portal-brand img { width: 165px; }
  .header-phone { display: none; }
  .back-to-site { font-size: 0; }
  .back-to-site::after { content: "←"; font-size: 1.2rem; }
  .account-button span:last-child { display: none; }
  .project-content { padding: 14px; }
  .project-hero-copy { padding: 25px 21px; border-radius: 19px; }
  .project-hero h1 { font-size: 2.55rem; }
  .service-card { grid-template-columns: auto 1fr; padding: 19px; border-radius: 18px; }
  .service-card > a { grid-column: 1 / -1; width: 100%; justify-content: center; }
  .invite-actions { width: 100%; }
  .invite-actions button { flex: 1; }
  .portal-tabs { overflow-x: auto; }
  .portal-tabs button { flex: 1; white-space: nowrap; }
  .portal-card { padding: 18px; border-radius: 16px; }
  .customer-detail-list { grid-template-columns: 1fr; }
  .customer-detail-list .wide { grid-column: auto; }
  .message { max-width: 88%; }
  .contact-aside { grid-template-columns: 1fr; }
  .document-grid { grid-template-columns: 1fr; }
  .compose-footer { align-items: stretch; flex-direction: column; }
  .compose-footer .primary-button { width: 100%; }
  .invalid-card > div:last-child { flex-direction: column; }
  .auth-panel { padding: 18px; }
  .auth-card { padding: 25px 20px; }
}

.feature-disabled-note {
  margin: 0 0 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(185, 138, 80, .28);
  border-radius: 14px;
  background: #faf6ef;
  color: #585b56;
  line-height: 1.55;
}
