/* ============================================================
   greylo.de Kundenbereich – Design v2 „Hafenbüro"
   Die Hauptseite ist die verspielte Wasseroberfläche,
   das Portal der ruhige Arbeitsplatz darunter.
   Signatur: dunkle Tiefwasser-Sidebar + Schwimmbahn-Ticketverlauf.
   Nutzt die Farbvariablen aus /assets/style.css.
   ============================================================ */

.portal-body { background: #F2F7FA; cursor: auto !important; }
html[data-theme="dark"] .portal-body { background: #0A141F; }
.portal-body * { cursor: auto; }
.portal-body a, .portal-body button, .portal-body label[for] { cursor: pointer; }

.portal-shell { display: flex; min-height: 100vh; }

/* ============ Tiefwasser-Sidebar ============ */
.portal-side {
  width: 252px; flex-shrink: 0;
  background: linear-gradient(178deg, #0F2436 0%, #12314B 70%, #0E3D5E 100%);
  color: #C9DCEA;
  display: flex; flex-direction: column;
  padding: 1.3rem 1rem 1.1rem;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
/* Wortmarke im dunklen Rail immer hell */
.portal-side .logo-word { fill: #EAF4F8; }
.portal-logo { display: block; margin: 0 0 0.15rem 0.2rem; }
.portal-untertitel {
  font-family: 'IBM Plex Mono', monospace; font-size: 0.68rem;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--aqua-light, #7FD6EC); margin: 0 0 1.5rem 0.35rem;
}

.portal-nav { display: flex; flex-direction: column; flex: 1; gap: 0.15rem; }
.pn-gruppe {
  font-family: 'IBM Plex Mono', monospace; font-size: 0.62rem;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: #5E7E97; margin: 1.1rem 0 0.35rem 0.75rem;
}
.pn-gruppe:first-child { margin-top: 0; }

.portal-nav a {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.55rem 0.75rem; border-radius: 10px;
  text-decoration: none; color: #C9DCEA;
  font-weight: 500; font-size: 0.92rem;
  position: relative;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.portal-nav a:hover { background: rgba(55, 182, 217, 0.12); color: #fff; transform: translateX(3px); }
.portal-nav a:focus-visible { outline: 2px solid var(--aqua); outline-offset: 2px; }
.portal-nav a.aktiv {
  background: rgba(55, 182, 217, 0.16);
  color: #fff; font-weight: 600;
}
/* Signatur: Wellen-Kante an der aktiven Seite */
.portal-nav a.aktiv::before {
  content: ''; position: absolute; left: -1rem; top: 15%;
  width: 4px; height: 70%; border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, var(--aqua-light, #7FD6EC), var(--aqua));
  box-shadow: 0 0 10px rgba(55, 182, 217, 0.5);
}
.pn-icon { font-size: 1rem; width: 1.3rem; text-align: center; }

.portal-side-fuss {
  border-top: 1px solid rgba(255,255,255,0.12);
  margin-top: 1rem; padding-top: 0.9rem;
  display: flex; flex-direction: column; gap: 0.35rem;
}
.portal-badge {
  font-size: 0.83rem; color: #C9DCEA;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.portal-logout {
  font-size: 0.83rem; color: #FFB4A6; text-decoration: none; font-weight: 600;
}
.portal-logout:hover { color: #fff; text-decoration: underline; }

/* ============ Hauptbereich ============ */
.portal-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.portal-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.7rem;
  background: rgba(251, 253, 254, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #DCE9F1;
  position: sticky; top: 0; z-index: 20;
}
html[data-theme="dark"] .portal-topbar { background: rgba(10, 20, 31, 0.85); border-bottom-color: #1E3450; }
.portal-topbar h1 {
  font-size: 1.25rem; margin: 0;
  font-family: 'Space Grotesk', sans-serif; letter-spacing: -0.01em;
}
html[data-theme="dark"] .portal-topbar h1 { color: var(--ink); }

.theme-toggle {
  background: none; border: 1.5px solid #C7DCE7;
  border-radius: 999px; cursor: pointer;
  width: 38px; height: 38px; font-size: 1rem;
  display: grid; place-items: center; flex-shrink: 0;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), border-color 0.25s;
}
html[data-theme="dark"] .theme-toggle { border-color: #2A4562; }
.theme-toggle:hover { transform: rotate(22deg) scale(1.1); border-color: var(--aqua); }

.portal-inhalt { padding: 1.7rem; max-width: 1020px; width: 100%; }
.portal-fussleiste {
  margin-top: auto; padding: 1rem 1.7rem;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem;
  font-size: 0.8rem; color: var(--ink-soft);
}
.portal-fussleiste a { color: var(--ink-soft); }

/* ============ Karten & Raster ============ */
.p-karte {
  background: var(--paper);
  border: 1px solid #E2EDF4;
  border-radius: 16px;
  padding: 1.4rem 1.5rem;
  box-shadow: 0 2px 10px rgba(15, 36, 54, 0.05);
  margin-bottom: 1.2rem;
}
html[data-theme="dark"] .p-karte { background: #10202F; border-color: #1E3450; }
.p-karte h2 {
  font-size: 1.02rem; margin-bottom: 0.9rem;
  font-family: 'Space Grotesk', sans-serif;
  display: flex; align-items: center; gap: 0.45rem;
}
.p-karte h2 .pk-icon { font-size: 1.1rem; }

.p-raster { display: grid; gap: 1.2rem; grid-template-columns: 1fr; }
@media (min-width: 720px) {
  .p-raster.zwei { grid-template-columns: 1fr 1fr; }
  .p-raster.drei { grid-template-columns: repeat(3, 1fr); }
}

/* ============ Begrüßungs-Band (Dashboard) ============ */
.p-hero {
  background: linear-gradient(120deg, #0F2436, #0E6BA8);
  color: #fff; border-radius: 16px;
  padding: 1.5rem 1.6rem; margin-bottom: 1.4rem;
  position: relative; overflow: hidden;
}
.p-hero::after {
  content: ''; position: absolute; right: -30px; bottom: -46px;
  width: 190px; height: 190px; border-radius: 50%;
  background: radial-gradient(circle, rgba(55,182,217,0.4), transparent 68%);
}
.p-hero h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.35rem; margin: 0 0 0.25rem;
}
.p-hero p { color: #C9DCEA; font-size: 0.92rem; margin: 0; }

/* ============ Tabellen ============ */
.p-tabelle { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.p-tabelle th {
  text-align: left; padding: 0.5rem 0.7rem;
  font-family: 'IBM Plex Mono', monospace; font-size: 0.68rem;
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--deep);
  border-bottom: 2px solid #E2EDF4;
}
html[data-theme="dark"] .p-tabelle th { border-bottom-color: #1E3450; color: var(--aqua-light, #7FD6EC); }
.p-tabelle td { padding: 0.68rem 0.7rem; border-bottom: 1px solid #EDF4F8; vertical-align: middle; }
html[data-theme="dark"] .p-tabelle td { border-bottom-color: #1A2E42; }
.p-tabelle tr:last-child td { border-bottom: none; }
.p-tabelle tr:hover td { background: rgba(55, 182, 217, 0.05); }

/* ============ Leer-Zustände ============ */
.p-leer {
  text-align: center; color: var(--ink-soft); padding: 2.2rem 1.2rem;
  border: 2px dashed #C7DCE7; border-radius: 16px;
  background: rgba(234, 244, 248, 0.35);
}
html[data-theme="dark"] .p-leer { border-color: #2A4562; background: rgba(19, 37, 58, 0.4); }
.p-leer .gross { font-size: 2.1rem; display: block; margin-bottom: 0.45rem; }

/* ============ Badges ============ */
.p-badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.16rem 0.62rem; border-radius: 999px;
  font-size: 0.76rem; font-weight: 600; line-height: 1.5;
  border: 1px solid transparent;
}
.p-badge.blau  { background: rgba(55,182,217,0.13); color: var(--deep); border-color: rgba(55,182,217,0.35); }
.p-badge.gruen { background: #E2F6E9; color: #1B6B3A; border-color: #B5E4C6; }
.p-badge.gelb  { background: #FFF3D6; color: #8A6100; border-color: #F0DBA1; }
.p-badge.grau  { background: #EDF2F6; color: var(--ink-soft); border-color: #D9E4EC; }
.p-badge.rot   { background: #FCE9E5; color: #A5372A; border-color: #F0C0B6; }
html[data-theme="dark"] .p-badge.blau  { color: var(--aqua-light, #7FD6EC); }
html[data-theme="dark"] .p-badge.gruen { background: #12331F; color: #8FE0AC; border-color: #1F5B36; }
html[data-theme="dark"] .p-badge.gelb  { background: #3A2E0E; color: #F5D58A; border-color: #6B5518; }
html[data-theme="dark"] .p-badge.grau  { background: #1A2E42; color: #A9BFCE; border-color: #2A4562; }
html[data-theme="dark"] .p-badge.rot   { background: #3A1712; color: #F5A99A; border-color: #6B2A1F; }

/* Status-Punkt in Badges (Tickets) */
.p-badge .punkt { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ============ Kacheln: Schnellaktionen & Zähler ============ */
.p-aktion {
  display: flex; align-items: center; gap: 0.9rem;
  background: var(--paper);
  border: 1px solid #E2EDF4; border-radius: 16px;
  padding: 1.05rem 1.15rem;
  text-decoration: none; color: var(--ink);
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1), border-color 0.2s, box-shadow 0.2s;
}
html[data-theme="dark"] .p-aktion { background: #10202F; border-color: #1E3450; color: var(--ink); }
.p-aktion:hover { transform: translateY(-4px); border-color: var(--aqua); box-shadow: 0 10px 24px rgba(14,107,168,0.14); }
.p-aktion .pa-icon {
  width: 44px; height: 44px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 1.35rem;
  background: linear-gradient(135deg, #EAF4F8, #FBFDFE);
  border: 1px solid #DCE9F1; border-radius: 12px;
}
html[data-theme="dark"] .p-aktion .pa-icon { background: linear-gradient(135deg, #0F2033, #1A3049); border-color: #1E3450; }
.p-aktion b { display: block; font-size: 0.95rem; }
.p-aktion span span { font-size: 0.8rem; color: var(--ink-soft); }

.p-zaehler { text-align: center; }
.p-zaehler b {
  display: block; font-family: 'Space Grotesk', sans-serif;
  font-size: 1.9rem; line-height: 1.1;
}
.p-zaehler span { font-size: 0.83rem; color: var(--ink-soft); }

/* ============ Fortschritt (Projekte) ============ */
.p-fortschritt { background: #E2EDF4; border-radius: 999px; height: 9px; overflow: hidden; }
html[data-theme="dark"] .p-fortschritt { background: #0A141F; }
.p-fortschritt i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--aqua), var(--deep));
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ============ Schwimmbahn-Ticketverlauf (Signatur) ============ */
.bahn {
  position: relative;
  padding-left: 1.6rem;
  margin: 0.4rem 0 1.2rem;
}
/* Die Bahnenlinie: gestrichelt wie am Beckenboden */
.bahn::before {
  content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px;
  width: 3px; border-radius: 3px;
  background: repeating-linear-gradient(180deg,
    var(--aqua) 0 14px, transparent 14px 24px);
  opacity: 0.55;
}
.chat-reihe { position: relative; margin-bottom: 1rem; max-width: 620px; }
.chat-reihe::before {
  content: ''; position: absolute; left: -1.6rem; top: 14px;
  width: 13px; height: 13px; border-radius: 50%;
  border: 3px solid var(--paper);
  box-shadow: 0 0 0 1px #DCE9F1;
}
html[data-theme="dark"] .chat-reihe::before { border-color: #0A141F; box-shadow: 0 0 0 1px #1E3450; }
.chat-reihe.support::before { background: var(--aqua); }
.chat-reihe.kunde::before   { background: var(--coral); }
.chat-reihe.kunde { margin-left: auto; }

.chat-kopf {
  display: flex; justify-content: space-between; gap: 1rem;
  font-size: 0.8rem; margin-bottom: 0.3rem; padding: 0 0.2rem;
}
.chat-kopf b { color: var(--ink); }
.chat-kopf time { color: var(--ink-soft); white-space: nowrap; }

.chat-blase {
  border-radius: 14px; padding: 0.85rem 1rem;
  font-size: 0.93rem; line-height: 1.55;
  border: 1px solid;
}
.chat-reihe.support .chat-blase {
  background: rgba(55, 182, 217, 0.08);
  border-color: rgba(55, 182, 217, 0.3);
  border-top-left-radius: 4px;
}
.chat-reihe.kunde .chat-blase {
  background: rgba(242, 112, 91, 0.07);
  border-color: rgba(242, 112, 91, 0.28);
  border-top-right-radius: 4px;
}
html[data-theme="dark"] .chat-reihe.support .chat-blase { background: rgba(55,182,217,0.1); }
html[data-theme="dark"] .chat-reihe.kunde .chat-blase   { background: rgba(242,112,91,0.1); }
.chat-blase p { margin: 0 0 0.6rem; color: var(--ink); }
.chat-blase p:last-child { margin-bottom: 0; }
.chat-blase ul, .chat-blase ol { padding-left: 1.2rem; margin: 0.4rem 0; color: var(--ink); }
.chat-blase blockquote {
  border-left: 3px solid #C7DCE7; padding-left: 0.7rem;
  color: var(--ink-soft); margin: 0.5rem 0;
}
.chat-blase a { color: var(--deep); }
html[data-theme="dark"] .chat-blase a { color: var(--aqua-light, #7FD6EC); }

/* ============ Formulare ============ */
.portal-inhalt form label { display: block; font-weight: 600; font-size: 0.88rem; margin: 0.9rem 0 0.3rem; }
.portal-inhalt form input[type=text], .portal-inhalt form input[type=email],
.portal-inhalt form input[type=password], .portal-inhalt form input[type=number],
.portal-inhalt form input[type=date], .portal-inhalt form input[type=url],
.portal-inhalt form input[type=file], .portal-inhalt form select, .portal-inhalt form textarea,
.login-karte input {
  width: 100%; border: 1.5px solid #C7DCE7; border-radius: 11px;
  padding: 0.62rem 0.85rem; font: inherit; background: var(--paper); color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}
html[data-theme="dark"] .portal-inhalt form input, html[data-theme="dark"] .portal-inhalt form select,
html[data-theme="dark"] .portal-inhalt form textarea, html[data-theme="dark"] .login-karte input {
  background: #0A141F; border-color: #2A4562;
}
.portal-inhalt form input:focus, .portal-inhalt form select:focus,
.portal-inhalt form textarea:focus, .login-karte input:focus {
  outline: none; border-color: var(--aqua); box-shadow: 0 0 0 3px rgba(55,182,217,0.18);
}

.p-btn {
  display: inline-block; border: none; cursor: pointer; font: inherit; font-weight: 600;
  background: var(--coral); color: #fff; padding: 0.62rem 1.3rem; border-radius: 999px;
  margin-top: 1rem; font-size: 0.92rem;
  transition: transform 0.15s, box-shadow 0.15s;
}
.p-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(242,112,91,0.35); }
.p-btn:focus-visible { outline: 3px solid var(--aqua); outline-offset: 2px; }
.p-btn.klein { padding: 0.32rem 0.85rem; font-size: 0.82rem; margin-top: 0; }
.p-btn.blau { background: var(--deep); }
.p-btn.blau:hover { box-shadow: 0 6px 16px rgba(14,107,168,0.35); }
.p-btn.grau { background: #8AA2B5; }

/* ============ Sonstiges ============ */
.p-geheim { font-family: 'IBM Plex Mono', monospace; font-size: 0.86em; background: #EDF4F8; padding: 0.18rem 0.5rem; border-radius: 6px; }
html[data-theme="dark"] .p-geheim { background: #0A141F; }

.p-artikel h2 { margin: 1.2rem 0 0.5rem; font-size: 1.12rem; display: block; }
.p-artikel h3 { margin: 1rem 0 0.4rem; font-size: 1rem; }
.p-artikel p, .p-artikel li { color: var(--ink-soft); font-size: 0.95rem; }
.p-artikel ul { padding-left: 1.2rem; margin: 0.4rem 0; }
.p-artikel code { background: #EDF4F8; padding: 0.1rem 0.4rem; border-radius: 5px; font-size: 0.87em; }
html[data-theme="dark"] .p-artikel code { background: #0A141F; }

.alert { border-radius: 12px; padding: 0.85rem 1rem; margin-bottom: 1rem; font-size: 0.92rem; }
.alert-ok  { background: #E2F6E9; color: #1B6B3A; border: 1px solid #9ADBB2; }
.alert-err { background: #FCE9E5; color: #A5372A; border: 1px solid #F0B4A9; }
html[data-theme="dark"] .alert-ok  { background: #12331F; color: #8FE0AC; border-color: #1F5B36; }
html[data-theme="dark"] .alert-err { background: #3A1712; color: #F5A99A; border-color: #6B2A1F; }

/* ============ Login ============ */
.login-buehne {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(160deg, #0F2436 0%, #123A5C 55%, #0E6BA8 100%);
  padding: 1.5rem;
}
.login-karte {
  background: var(--paper); border-radius: 20px; padding: 2rem;
  width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
html[data-theme="dark"] .login-karte { background: #10202F; }
.login-karte .portal-untertitel { color: var(--deep); margin-left: 0; }
.login-karte label { display: block; font-weight: 600; font-size: 0.88rem; margin: 0.9rem 0 0.3rem; }

/* ============ Mobil ============ */
@media (max-width: 880px) {
  .portal-shell { flex-direction: column; }
  .portal-side {
    width: 100%; height: auto; position: static; overflow: visible;
    padding: 0.8rem 1rem;
  }
  .portal-untertitel { display: none; }
  .portal-logo { margin-bottom: 0.5rem; }
  .portal-nav {
    flex-direction: row; flex-wrap: nowrap; overflow-x: auto;
    gap: 0.35rem; padding-bottom: 0.3rem;
    -webkit-overflow-scrolling: touch;
  }
  .pn-gruppe { display: none; }
  .portal-nav a { flex-shrink: 0; padding: 0.45rem 0.75rem; font-size: 0.85rem; }
  .portal-nav a.aktiv::before { display: none; }
  .portal-side-fuss {
    border-top: none; margin-top: 0.4rem; padding-top: 0;
    flex-direction: row; align-items: center; justify-content: space-between;
  }
  .portal-inhalt { padding: 1.1rem; }
  .p-tabelle { display: block; overflow-x: auto; white-space: nowrap; }
  .chat-reihe { max-width: 100%; }
}

/* ============ Reduced Motion ============ */
@media (prefers-reduced-motion: reduce) {
  .portal-body *, .portal-body *::before, .portal-body *::after {
    animation: none !important; transition: none !important;
  }
}
