:root {
  --bg: #0c1119;
  --surface: #121c2a;
  --surface-2: #1a293b;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f4f7fb;
  --muted: #a7b3c3;
  --yellow: #ffd928;
  --blue: #70aeff;
  --green: #71db9e;
  --red: #ff8f84;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(
      800px 600px at 10% -10%,
      rgba(77, 156, 255, 0.15),
      transparent 56%
    ),
    var(--bg);
}
.portal-login-shell {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 18px;
}
.portal-login-card {
  width: min(100%, 440px);
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(145deg, #172437, #0f1723);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}
.portal-brand {
  color: #fff;
  text-decoration: none;
  font-weight: 950;
  letter-spacing: -0.06em;
  font-size: 1.25rem;
}
.portal-brand span {
  color: var(--yellow);
}
.portal-eyebrow {
  color: var(--yellow);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 28px 0 8px;
}
.portal-login-card h1 {
  font-size: 2rem;
  letter-spacing: -0.055em;
  margin: 0;
}
.portal-login-card > p:not(.portal-eyebrow) {
  color: var(--muted);
  line-height: 1.6;
}
.portal-login-card form,
.portal-form {
  display: grid;
  gap: 13px;
  margin: 24px 0;
}
.portal-login-card label,
.portal-form label {
  display: grid;
  gap: 7px;
  color: #dbe4ed;
  font-size: 0.82rem;
  font-weight: 750;
}
.portal-login-card input,
.portal-form input,
.portal-form select,
.portal-form textarea,
.portal-select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #0a111b;
  color: var(--text);
  font: inherit;
}
.portal-login-card input:focus,
.portal-form input:focus,
.portal-form select:focus,
.portal-form textarea:focus,
.portal-select:focus {
  outline: 3px solid rgba(255, 217, 40, 0.18);
  border-color: var(--yellow);
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}
.portal-login-card button,
.portal-primary {
  border: 0;
  border-radius: 12px;
  min-height: 46px;
  background: var(--yellow);
  color: #11140f;
  font: 900 0.9rem inherit;
  padding: 10px 15px;
  cursor: pointer;
}
.portal-login-card a:not(.portal-brand) {
  color: var(--muted);
  font-size: 0.82rem;
}
.portal-notice {
  margin: 18px 0;
  padding: 11px;
  border-radius: 10px;
  background: rgba(255, 143, 132, 0.14);
  color: #ffd0cc;
}
.portal-top {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 70px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 12px max(18px, calc((100vw - 1440px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(12, 17, 25, 0.86);
  backdrop-filter: blur(16px);
}
.portal-nav {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
}
.portal-nav button {
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  padding: 9px 11px;
  font-size: 0.82rem;
  cursor: pointer;
}
.portal-nav button:hover,
.portal-nav button.active {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}
.portal-nav button.active {
  color: var(--yellow);
}
.portal-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  font-weight: 720;
}
.portal-user form {
  margin: 0;
}
.portal-user button,
.portal-menu {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  cursor: pointer;
}
.portal-menu {
  display: none;
}
.portal-content {
  max-width: 1320px;
  margin: 0 auto;
  padding: 31px 22px;
}
.portal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}
.portal-head h1 {
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  letter-spacing: -0.06em;
  margin: 0;
}
.portal-head p {
  color: var(--muted);
  margin: 7px 0 0;
}
.portal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.portal-secondary {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 13px;
  font-weight: 740;
  cursor: pointer;
}
.portal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.portal-metric {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: linear-gradient(
    145deg,
    rgba(26, 41, 59, 0.98),
    rgba(17, 27, 40, 0.95)
  );
  min-height: 124px;
}
.portal-metric:after {
  content: "";
  position: absolute;
  right: -34px;
  bottom: -40px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255, 217, 40, 0.09);
  filter: blur(5px);
}
.portal-metric small {
  color: var(--muted);
  font-weight: 750;
}
.portal-metric strong {
  display: block;
  font-size: 2.1rem;
  letter-spacing: -0.065em;
  margin-top: 15px;
}
.portal-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px;
  margin-top: 18px;
}
.portal-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(18, 28, 42, 0.82);
}
.portal-card h2 {
  font-size: 1rem;
  letter-spacing: -0.025em;
  margin: 0 0 14px;
}
.portal-card p {
  color: var(--muted);
  line-height: 1.55;
}
.portal-list {
  display: grid;
  gap: 7px;
}
.portal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  padding: 11px;
  text-align: left;
}
.portal-row.clickable {
  cursor: pointer;
}
.portal-row.clickable:hover {
  background: rgba(255, 255, 255, 0.075);
}
.portal-row strong {
  display: block;
  font-size: 0.85rem;
}
.portal-row small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  margin-top: 3px;
}
.portal-empty,
.portal-loading {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 13px;
  color: var(--muted);
  text-align: center;
}
.portal-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(18, 28, 42, 0.8);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 650px;
}
th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 0.83rem;
  text-align: left;
}
th {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
tr:last-child td {
  border-bottom: 0;
}
.portal-row-button {
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 0;
  text-align: left;
  cursor: pointer;
}
.portal-row-button:hover {
  color: var(--yellow);
  text-decoration: underline;
}
.portal-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(112, 174, 255, 0.14);
  color: #c6dfff;
  font-size: 0.7rem;
  font-weight: 850;
  white-space: nowrap;
}
.portal-pill.pending,
.portal-pill.new,
.portal-pill.requested {
  background: rgba(255, 217, 40, 0.12);
  color: #f6e89a;
}
.portal-pill.approved,
.portal-pill.completed,
.portal-pill.closed,
.portal-pill.done {
  background: rgba(113, 219, 158, 0.13);
  color: #b9f0ce;
}
.portal-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
}
.portal-message-log {
  display: grid;
  gap: 10px;
  max-height: 480px;
  overflow: auto;
  padding: 2px;
}
.portal-message {
  max-width: 84%;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.portal-message.customer {
  justify-self: end;
  background: rgba(255, 217, 40, 0.16);
}
.portal-message small {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  margin-top: 5px;
}
.portal-info {
  display: grid;
  gap: 9px;
}
.portal-info div {
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}
.portal-info small {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
}
.portal-info strong {
  display: block;
  margin-top: 3px;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}
.portal-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.portal-form-grid .full {
  grid-column: 1/-1;
}
.portal-form textarea {
  min-height: 110px;
  resize: vertical;
}
.portal-form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 13px;
}
.portal-error {
  min-height: 18px;
  color: #ffc1bc;
  font-size: 0.78rem;
  margin: 0;
}
.portal-modal-root:empty {
  display: none;
}
.portal-modal-root {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 15px;
  background: rgba(4, 7, 11, 0.72);
}
.portal-modal {
  width: min(680px, 100%);
  max-height: calc(100svh - 30px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #111b29;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
}
.portal-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.portal-modal-head h2 {
  font-size: 1.25rem;
  margin: 0;
  letter-spacing: -0.04em;
}
.portal-modal-close {
  border: 0;
  border-radius: 9px;
  width: 34px;
  height: 34px;
  background: var(--surface-2);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
}
.portal-toast {
  position: fixed;
  z-index: 50;
  right: 18px;
  bottom: 18px;
  width: min(370px, calc(100vw - 36px));
  display: grid;
  gap: 7px;
}
.portal-toast div {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #19283a;
  font-size: 0.84rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}
.portal-toast div.error {
  color: #ffd0cc;
  border-color: rgba(255, 143, 132, 0.6);
}
@media (max-width: 980px) {
  .portal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .portal-detail {
    grid-template-columns: 1fr;
  }
  .portal-top {
    gap: 10px;
  }
  .portal-nav {
    position: fixed;
    top: 70px;
    left: 10px;
    right: 10px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #111b29;
    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.35);
  }
  .portal-nav.open {
    display: flex;
  }
  .portal-nav button {
    text-align: left;
  }
  .portal-menu {
    display: block;
  }
  .portal-user {
    margin-left: auto;
  }
  .portal-user > span {
    display: none;
  }
}
@media (max-width: 580px) {
  .portal-content {
    padding: 22px 13px;
  }
  .portal-grid,
  .portal-grid-2 {
    grid-template-columns: 1fr;
  }
  .portal-head {
    display: block;
  }
  .portal-actions {
    margin-top: 13px;
  }
  .portal-login-card {
    padding: 27px 22px;
  }
  .portal-top {
    padding: 11px 13px;
  }
  .portal-brand {
    font-size: 1.1rem;
  }
  .portal-detail {
    gap: 14px;
  }
  .portal-modal {
    padding: 16px;
  }
  .portal-form-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  .portal-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }
  .portal-table-wrap table {
    display: block;
    min-width: 0;
  }
  .portal-table-wrap thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .portal-table-wrap tbody {
    display: grid;
    gap: 10px;
  }
  .portal-table-wrap tr {
    display: grid;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(18, 28, 42, 0.8);
  }
  .portal-table-wrap td {
    display: block;
    min-width: 0;
    padding: 9px 12px;
    border: 0;
    overflow-wrap: anywhere;
  }
  .portal-table-wrap td + td {
    border-top: 1px solid var(--line);
  }
  .portal-table-wrap td:first-child {
    background: rgba(255, 255, 255, 0.035);
  }
  .portal-table-wrap td[colspan] {
    text-align: center;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}

/* Erweiterungen für den geschützten Kundenbereich */
[data-portal-auth-form][aria-busy="true"] {
  cursor: progress;
}

[data-portal-auth-form][aria-busy="true"] button[type="submit"],
[data-portal-auth-form][aria-busy="true"] button:not([type]),
[data-portal-auth-form][aria-busy="true"] input[type="submit"] {
  opacity: 0.78;
}

.portal-auth-password,
.portal-password-field {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.portal-auth-password input,
.portal-password-field input {
  padding-right: 94px;
}

.portal-password-toggle,
.portal-password-field button {
  position: absolute;
  right: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--yellow);
  min-height: 34px;
  padding: 6px 8px;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 800;
  cursor: pointer;
}

.portal-password-toggle:hover,
.portal-password-field button:hover {
  background: rgba(255, 217, 40, 0.1);
}

.portal-form[aria-busy="true"] {
  cursor: progress;
}

.portal-form[aria-busy="true"] button[type="submit"],
.portal-form[aria-busy="true"] button:not([type]),
.portal-form[aria-busy="true"] input[type="submit"] {
  opacity: 0.78;
}

.portal-form input[readonly] {
  color: var(--muted);
  cursor: not-allowed;
}

.portal-nav-backdrop {
  display: none;
}

.portal-message-log--full {
  max-height: min(65svh, 720px);
}

.portal-milestones {
  margin-top: 18px;
}

.portal-milestone {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
}

.portal-milestone strong,
.portal-milestone small {
  display: block;
}

.portal-milestone p {
  margin: 5px 0;
}

.portal-milestone small {
  color: var(--muted);
  font-size: 0.72rem;
}

.portal-invoice-grid {
  align-items: stretch;
}

.portal-invoice {
  display: grid;
  gap: 17px;
}

.portal-invoice-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.portal-invoice-head h2 {
  margin: 3px 0 9px;
}

.portal-invoice-head small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portal-invoice-amount {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  letter-spacing: -0.05em;
  text-align: right;
}

.portal-security-card {
  align-content: start;
}

.portal-security-divider {
  height: 1px;
  margin: 24px 0;
  background: var(--line);
}

.portal-pill.overdue {
  background: rgba(255, 143, 132, 0.13);
  color: #ffc1bc;
}

button:disabled,
button[aria-disabled="true"] {
  cursor: not-allowed;
}

@media (max-width: 980px) {
  .portal-nav {
    z-index: 2;
  }

  .portal-nav button {
    min-height: 44px;
  }

  .portal-nav-backdrop {
    position: fixed;
    z-index: 9;
    inset: 70px 0 0;
    display: block;
    width: 100%;
    border: 0;
    background: rgba(4, 7, 11, 0.58);
    cursor: default;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .portal-nav-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
  }

  body.portal-nav-open {
    overflow: hidden;
  }
}

@media (max-width: 580px) {
  .portal-milestone,
  .portal-invoice-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .portal-invoice-amount {
    text-align: left;
  }

  .portal-password-toggle,
  .portal-password-field button {
    min-height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-nav-backdrop {
    transition: none;
  }
}
