/* ==========================================================================
   Mandantenportal buchhaltungsservice-lueneburg.de · Gestaltung wie die Startseite
   (DM Sans, Weinrot #B50B3E, Dunkelblau #0B0033, runde Karten). Eigenständig, ohne externe Ressourcen.
   ========================================================================== */

@font-face { font-family: 'DM Sans'; src: url('../fonts/dm-sans-v17-latin-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('../fonts/dm-sans-v17-latin-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('../fonts/dm-sans-v17-latin-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --primary: #B50B3E;
  --primary-dark: #960932;
  --primary-wash: rgba(181, 11, 62, 0.08);
  --headline: #0B0033;
  --text: #47484B;
  --soft: #475569;
  --slate-50: #f8f9fb;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --white: #ffffff;
  --ok: #15803d;
  --ok-wash: #e7f6ec;
  --warn: #9a3412;
  --warn-wash: #fdeee4;
  --error: #b42318;
  --radius: 0.85rem;
  --radius-lg: 1.5rem;
  --shadow: 0 15px 35px rgba(11, 0, 51, 0.06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.portal {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  line-height: 1.55;
  background: radial-gradient(circle at top right, #fffcfd 0%, var(--slate-50) 60%);
  -webkit-font-smoothing: antialiased;
}
.portal [hidden] { display: none !important; }
.portal h1, .portal h2, .portal h3 { color: var(--headline); font-weight: 700; line-height: 1.2; margin: 0 0 0.5em; }
.portal a { color: var(--primary); }
.portal p { margin: 0 0 1em; }

.skip-link { position: absolute; left: -9999px; top: 0; background: var(--headline); color: #fff; padding: 0.6rem 1rem; z-index: 1000; }
.skip-link:focus { left: 1rem; top: 1rem; }

.container { max-width: 880px; margin: 0 auto; padding: 0 1rem; }

/* ---------- Kopf und Fuß ---------- */
.portal-header { background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--slate-100); }
.portal-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 72px; }
.portal-header .logo-link { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; }
.portal-header .logo-link img { height: 34px; width: auto; display: block; }
.portal-header .logo-sub { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.2em; color: var(--primary); }
.portal-user { display: flex; align-items: center; gap: 0.9rem; font-size: 0.9rem; color: var(--soft); }
.portal-user strong { color: var(--headline); }

.portal-main { flex: 1; padding: 2.5rem 0 4rem; }
.portal-footer { border-top: 1px solid var(--slate-200); background: var(--white); font-size: 0.85rem; color: var(--soft); }
.portal-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem; padding-top: 1.2rem; padding-bottom: 1.2rem; }
.portal-footer a { color: inherit; }

/* ---------- Karten ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-bottom: 1.5rem;
}
.card-narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.eyebrow { display: block; color: var(--primary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.25em; font-size: 0.72rem; margin-bottom: 0.8rem; }
.card h1 { font-size: clamp(1.7rem, 4.5vw, 2.3rem); }
.card h2 { font-size: 1.3rem; }
.lead { font-size: 1.08rem; color: var(--text); }
.hint { font-size: 0.93rem; color: var(--soft); }
.hint:last-child { margin-bottom: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem 1rem; margin-bottom: 1rem; }
.card-head h2 { margin: 0; }

.notice { background: var(--ok-wash); color: var(--ok); border-radius: var(--radius); padding: 0.85rem 1.1rem; margin-bottom: 1.5rem; font-weight: 500; }
.form-error { color: var(--error); font-weight: 500; margin: 0 0 1rem; }

/* ---------- Formulare und Knöpfe ---------- */
.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1.1rem; }
.field span { font-weight: 700; color: var(--headline); font-size: 0.92rem; }
.field input, .field textarea {
  font: inherit; color: var(--headline);
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius);
  background: var(--white);
  width: 100%;
}
.field textarea { resize: vertical; min-height: 9rem; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: transparent; }
.code-input { font-size: 1.6rem !important; letter-spacing: 0.3em; text-align: center; max-width: 14rem; font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font: 700 1rem/1 'DM Sans', system-ui, sans-serif;
  padding: 0.95rem 1.6rem;
  border-radius: 0.75rem;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, background 0.15s;
}
.btn:focus-visible { outline: 3px solid var(--headline); outline-offset: 2px; }
.btn-primary { background: var(--primary); color: #fff !important; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--headline) !important; border-color: var(--slate-200); }
.btn-ghost:hover { border-color: var(--slate-300); background: var(--slate-50); }
.btn-small { padding: 0.6rem 1rem; font-size: 0.9rem; }
.btn:disabled { opacity: 0.6; cursor: wait; transform: none; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); text-decoration: underline; cursor: pointer; }

/* ---------- Begrüßung ---------- */
.welcome { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; }
.welcome h1 { margin-bottom: 0.2em; }
.welcome p { margin: 0; }
.facts { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-size: 0.92rem; color: var(--soft); }
.facts strong { color: var(--headline); }
.facts { align-items: center; }
.client-switch select {
  font: 700 0.95rem/1.2 'DM Sans', system-ui, sans-serif; color: var(--headline);
  padding: 0.5rem 2.2rem 0.5rem 0.8rem; border: 1px solid var(--slate-300); border-radius: 0.6rem; background: var(--white);
  max-width: 100%; cursor: pointer;
}
.client-switch select:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Kacheln (Frage stellen, Agenda-Unternehmensportal) ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.tiles-single { grid-template-columns: 1fr; }
.tile {
  margin: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 0.8rem;
  font: inherit; color: inherit; text-align: left; text-decoration: none; cursor: pointer; width: 100%;
  transition: transform 0.15s, box-shadow 0.15s;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 20px 40px rgba(11, 0, 51, 0.1); }
.tile:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.tile-icon { width: 60px; height: 60px; border-radius: 1rem; display: grid; place-items: center; background: var(--primary-wash); color: var(--primary); }
.tile-logo { height: 60px; width: auto; display: block; }
.tile-title { font-size: 1.15rem; font-weight: 700; color: var(--headline); line-height: 1.2; }
.tile-text { font-size: 0.95rem; color: var(--soft); }
.tile-go { margin-top: auto; font-weight: 700; color: var(--primary); }

/* ---------- Listen ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--slate-100); }
.list li:first-child { border-top: 0; }
.row { display: flex; align-items: center; gap: 0.75rem 1rem; flex-wrap: wrap; padding: 0.95rem 0; }
.row-main { flex: 1 1 14rem; min-width: 0; display: flex; flex-direction: column; }
.row-main strong { color: var(--headline); overflow-wrap: anywhere; }
.row-meta { font-size: 0.88rem; color: var(--soft); }
.row-amount { font-weight: 700; color: var(--headline); font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-actions { display: flex; gap: 0.5rem; }
button.row { width: 100%; background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; border-radius: var(--radius); padding-left: 0.5rem; padding-right: 0.5rem; margin: 0 -0.5rem; width: calc(100% + 1rem); }
button.row:hover { background: var(--slate-50); }
button.row:focus-visible { outline: 2px solid var(--primary); }
.empty { color: var(--soft); margin: 0; }
.invoice-older { margin: 1.2rem 0 0; padding-top: 1rem; border-top: 1px solid var(--slate-100); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); margin-right: 0.4rem; vertical-align: middle; }

.badge { display: inline-block; border-radius: 999px; padding: 0.22rem 0.75rem; font-size: 0.8rem; font-weight: 700; white-space: nowrap; background: var(--slate-100); color: var(--headline); }
.badge-paid, .badge-closed { background: var(--ok-wash); color: var(--ok); }
.badge-overdue { background: var(--warn-wash); color: var(--warn); }
.badge-waiting { background: var(--primary-wash); color: var(--primary); }
.badge-voided { background: var(--slate-100); color: var(--soft); text-decoration: line-through; }

/* ---------- Gespräch einer Anfrage ---------- */
.thread { list-style: none; margin: 1.2rem 0; padding: 0; display: flex; flex-direction: column; gap: 0.9rem; }
.msg { max-width: 88%; padding: 0.9rem 1.1rem; border-radius: 1.1rem; background: var(--slate-100); }
.msg-customer { align-self: flex-end; background: var(--headline); color: #fff; }
.msg-customer a { color: #fff; }
.msg-meta { display: block; font-size: 0.8rem; opacity: 0.75; margin-bottom: 0.3rem; }
.msg-body p { margin: 0 0 0.6em; overflow-wrap: anywhere; }
.msg-body p:last-child { margin: 0; }
.msg-body blockquote { margin: 0 0 0.6em; padding-left: 0.8rem; border-left: 3px solid var(--slate-300); }

@media (max-width: 560px) {
  .card { padding: 1.4rem 1.15rem; border-radius: 1.1rem; }
  .portal-main { padding: 1.5rem 0 5rem; }
  .portal-header .logo-sub { display: none; }
  .portal-user span { display: none; }
  .msg { max-width: 100%; }
  .tiles { grid-template-columns: 1fr; gap: 1rem; }
  .portal-footer .container { padding-bottom: 5rem; }   /* Platz für den Chat-Knopf */
}
