:root {
  --brand-red: #db1f3e;
  --brand-dark-red: #ad153d;
  --brand-darker-red: #8a0029;
  --brand-green: #38af4f;
  --brand-black: #383838;
  --brand-orange: #fa8231;
  --brand-yellow: #fed330;
  --brand-blue: #2d98da;
  --brand-purple: #8854d0;
  --white: #ffffff;
  --almost-white: #f8f8f8;
  --lighter-grey: #cfcfcf;
  --light-grey: #999999;
  --mid-grey: #787878;
  --dark-grey: #525252;
  --surface-muted: #f3f3f3;
  --border: #e4e4e4;
  --text: var(--brand-black);
  --text-muted: #696969;
  --shadow-sm: 0 1px 2px rgba(56, 56, 56, 0.08);
  --shadow-md: 0 12px 32px rgba(56, 56, 56, 0.1);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --content-width: 1160px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--almost-white);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--almost-white);
  color: var(--text);
}

a {
  color: var(--brand-dark-red);
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid rgba(45, 152, 218, 0.5);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  background: var(--brand-black);
  color: var(--white);
  transform: translateY(-160%);
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.portal-header {
  position: relative;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.portal-header::before {
  display: block;
  height: 5px;
  background: linear-gradient(
    90deg,
    var(--brand-red) 0 32%,
    var(--brand-dark-red) 32% 70%,
    var(--brand-black) 70% 100%
  );
  content: "";
}

.portal-header__inner,
.portal-nav__inner,
.portal-main,
.portal-footer__inner {
  width: min(100% - 36px, var(--content-width));
  margin: 0 auto;
}

.portal-header__inner {
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 24px;
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: var(--brand-black);
  text-decoration: none;
}

.portal-brand__logo {
  display: block;
  width: 138px;
  height: auto;
  flex: 0 0 auto;
}

.portal-brand__context {
  padding-left: 13px;
  border-left: 1px solid var(--lighter-grey);
  color: var(--mid-grey);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portal-user {
  display: flex;
  min-width: 0;
  margin-left: auto;
  align-items: center;
  gap: 16px;
}

.portal-user__identity {
  display: flex;
  min-width: 0;
  flex-direction: column;
  text-align: right;
}

.portal-user__label {
  color: var(--mid-grey);
  font-size: 11px;
}

.portal-user__company {
  max-width: 360px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-logout {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--lighter-grey);
  border-radius: var(--radius-sm);
  color: var(--dark-grey);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.portal-logout:hover {
  border-color: var(--brand-dark-red);
  background: #fff7f8;
  color: var(--brand-dark-red);
}

.portal-logout svg {
  width: 16px;
  height: 16px;
}

.portal-nav {
  border-top: 1px solid #eeeeee;
  background: var(--white);
}

.portal-nav__inner {
  display: flex;
  overflow-x: auto;
  gap: 2px;
  scrollbar-width: none;
}

.portal-nav__inner::-webkit-scrollbar {
  display: none;
}

.nav {
  position: relative;
  display: inline-flex;
  min-height: 48px;
  flex: 0 0 auto;
  align-items: center;
  padding: 0 15px;
  color: var(--dark-grey);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav::after {
  position: absolute;
  right: 15px;
  bottom: 0;
  left: 15px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: transparent;
  content: "";
}

.nav:hover {
  background: var(--almost-white);
  color: var(--brand-dark-red);
}

.nav.aktiv {
  color: var(--brand-dark-red);
}

.nav.aktiv::after {
  background: var(--brand-red);
}

.portal-main {
  min-height: calc(100vh - 210px);
  padding-top: 34px;
  padding-bottom: 72px;
}

.portal-footer {
  border-top: 1px solid var(--border);
  background: var(--white);
}

.portal-footer__inner {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--mid-grey);
  font-size: 12px;
}

.portal-footer__trust {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.portal-footer__trust svg {
  width: 15px;
  height: 15px;
  color: var(--brand-green);
}

h1 {
  margin: 0 0 8px;
  color: var(--brand-black);
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

h2 {
  margin: 30px 0 13px;
  color: var(--brand-black);
  font-size: 18px;
  line-height: 1.25;
}

.lead {
  max-width: 760px;
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 15px;
}

.dashboard-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 300px;
  overflow: hidden;
  align-items: center;
  padding: clamp(34px, 6vw, 68px);
  border-radius: var(--radius-lg);
  background: var(--brand-black);
  color: var(--white);
  box-shadow: var(--shadow-md);
}

.dashboard-hero::before {
  position: absolute;
  z-index: -2;
  top: -180px;
  right: -120px;
  width: 500px;
  height: 500px;
  border: 70px solid var(--brand-dark-red);
  border-radius: 48% 52% 44% 56%;
  content: "";
  opacity: 0.92;
  transform: rotate(18deg);
}

.dashboard-hero::after {
  position: absolute;
  z-index: -1;
  right: 18%;
  bottom: -130px;
  width: 340px;
  height: 240px;
  border-radius: 50%;
  background: var(--brand-red);
  content: "";
  opacity: 0.92;
  transform: rotate(-12deg);
}

.dashboard-hero__content {
  max-width: 690px;
}

.dashboard-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: #ffd7dd;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dashboard-hero__eyebrow::before {
  width: 28px;
  height: 3px;
  border-radius: 3px;
  background: var(--brand-red);
  content: "";
}

.dashboard-hero h1 {
  max-width: 620px;
  margin-bottom: 14px;
  color: var(--white);
  font-size: clamp(32px, 5vw, 52px);
}

.dashboard-hero p {
  max-width: 600px;
  margin: 0;
  color: #eeeeee;
  font-size: clamp(15px, 2vw, 18px);
}

.dashboard-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  margin-top: 28px;
}

.dashboard-section {
  margin-top: 42px;
}

.dashboard-section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

.dashboard-section__head h2 {
  margin: 0;
  font-size: 22px;
}

.dashboard-section__head p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.kacheln {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.kachel {
  position: relative;
  display: flex;
  min-height: 190px;
  grid-column: span 4;
  overflow: hidden;
  flex-direction: column;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.kachel::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: var(--card-accent, var(--brand-dark-red));
  content: "";
  opacity: 0;
  transition: opacity 0.15s ease;
}

.kachel:hover {
  border-color: color-mix(in srgb, var(--card-accent, var(--brand-dark-red)) 38%, var(--border));
  box-shadow: 0 12px 26px rgba(56, 56, 56, 0.1);
  transform: translateY(-2px);
}

.kachel:hover::before {
  opacity: 1;
}

.kachel--wide {
  grid-column: span 6;
}

.kachel--support {
  --card-accent: var(--brand-red);
}

.kachel--documents {
  --card-accent: var(--brand-blue);
}

.kachel--projects {
  --card-accent: var(--brand-purple);
}

.kachel--systems {
  --card-accent: var(--brand-green);
}

.kachel__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.kicon {
  display: inline-flex;
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  background: color-mix(in srgb, var(--card-accent, var(--brand-dark-red)) 11%, white);
  color: var(--card-accent, var(--brand-dark-red));
}

.kicon svg {
  width: 23px;
  height: 23px;
  stroke-width: 1.8;
}

.kzahl {
  color: var(--card-accent, var(--brand-dark-red));
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.ktitel {
  margin-top: auto;
  padding-top: 28px;
  font-size: 17px;
  font-weight: 800;
}

.ksub {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 13px;
}

.kachel__arrow {
  position: absolute;
  right: 20px;
  bottom: 20px;
  color: var(--lighter-grey);
  transition: color 0.15s ease, transform 0.15s ease;
}

.kachel__arrow svg {
  width: 18px;
  height: 18px;
}

.kachel:hover .kachel__arrow {
  color: var(--card-accent, var(--brand-dark-red));
  transform: translateX(3px);
}

.recent-tickets {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.recent-ticket {
  display: grid;
  min-height: 66px;
  grid-template-columns: 150px minmax(220px, 1fr) auto 150px 20px;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s ease;
}

.recent-ticket:last-child {
  border-bottom: 0;
}

.recent-ticket:hover {
  background: var(--almost-white);
}

.recent-ticket__number {
  color: var(--brand-dark-red);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.recent-ticket__title {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-ticket time {
  color: var(--light-grey);
  font-size: 10px;
  text-align: right;
}

.recent-ticket__arrow {
  display: inline-flex;
  color: var(--lighter-grey);
}

.recent-ticket__arrow svg {
  width: 17px;
  height: 17px;
}

.btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid var(--brand-dark-red);
  border-radius: var(--radius-sm);
  background: var(--brand-dark-red);
  color: var(--white);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.btn svg {
  width: 17px;
  height: 17px;
}

.btn:hover {
  border-color: var(--brand-darker-red);
  background: var(--brand-darker-red);
}

.btn:active {
  transform: translateY(1px);
}

.btn.sekundaer {
  border-color: var(--lighter-grey);
  background: var(--white);
  color: var(--brand-dark-red);
}

.btn.sekundaer:hover {
  border-color: var(--brand-dark-red);
  background: #fff7f8;
}

/* SEPM-334: Annahme-Button der Angebots-Bestaetigung (Ablehnung nutzt die
   ohnehin rote Standardfarbe von .btn). */
.btn.positiv {
  border-color: var(--brand-green);
  background: var(--brand-green);
}

.btn.positiv:hover {
  border-color: #2c8a3e;
  background: #2c8a3e;
}

.bestaetigungscode {
  margin: 4px 0 18px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.35em;
  text-align: center;
  color: var(--brand-dark-red);
}

.dashboard-hero .btn {
  min-height: 46px;
  padding-right: 19px;
  padding-left: 19px;
  border-color: var(--brand-red);
  background: var(--brand-red);
}

.dashboard-hero .btn:hover {
  border-color: var(--brand-dark-red);
  background: var(--brand-dark-red);
}

.dashboard-hero .btn.sekundaer {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  backdrop-filter: blur(4px);
}

.dashboard-hero .btn.sekundaer:hover {
  border-color: var(--white);
  background: rgba(255, 255, 255, 0.15);
}

.karte {
  overflow-x: auto;
  margin-bottom: 16px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.karte h2:first-child {
  margin-top: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--mid-grey);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: var(--almost-white);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.st-offen {
  background: #f0f0f0;
  color: var(--dark-grey);
}

.st-bearbeitung {
  background: #fff1e7;
  color: #9a4408;
}

.st-erledigt {
  background: #eaf8ed;
  color: #237a34;
}

.st-info {
  background: #eaf5fc;
  color: #17628f;
}

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

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.page-heading .lead {
  margin-bottom: 0;
}

.page-eyebrow {
  margin-bottom: 7px;
  color: var(--brand-dark-red);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ticket-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.ticket-summary a {
  display: flex;
  min-height: 82px;
  align-items: center;
  gap: 13px;
  padding: 15px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.ticket-summary a:hover {
  border-color: var(--brand-dark-red);
  transform: translateY(-1px);
}

.ticket-summary span {
  min-width: 38px;
  color: var(--brand-dark-red);
  font-size: 27px;
  font-weight: 800;
  line-height: 1;
}

.ticket-summary small {
  color: var(--dark-grey);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.ticket-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(300px, 0.85fr);
  gap: 22px;
  align-items: start;
}

.ticket-list-column {
  min-width: 0;
}

.ticket-toolbar {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(180px, auto) auto;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.ticket-toolbar input,
.ticket-toolbar select {
  min-height: 40px;
}

.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ticket-item {
  display: flex;
  min-width: 0;
  justify-content: space-between;
  gap: 22px;
  padding: 19px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.ticket-item:hover {
  border-color: rgba(173, 21, 61, 0.45);
  box-shadow: 0 9px 24px rgba(56, 56, 56, 0.09);
  transform: translateY(-1px);
}

.ticket-item__body {
  min-width: 0;
  flex: 1;
}

.ticket-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-bottom: 7px;
  color: var(--mid-grey);
  font-size: 11px;
  font-weight: 700;
}

.ticket-item__meta span:first-child {
  color: var(--brand-dark-red);
  letter-spacing: 0.045em;
}

.ticket-item h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

.ticket-item p {
  display: -webkit-box;
  overflow: hidden;
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ticket-item__updated {
  margin-top: 11px;
  color: var(--light-grey);
  font-size: 11px;
}

.ticket-item__state {
  display: flex;
  min-width: 135px;
  flex: 0 0 auto;
  align-items: flex-end;
  flex-direction: column;
  gap: 8px;
}

.ticket-item__arrow {
  display: inline-flex;
  margin-top: auto;
  color: var(--lighter-grey);
  transition: color 0.15s ease, transform 0.15s ease;
}

.ticket-item__arrow svg {
  width: 18px;
  height: 18px;
}

.ticket-item:hover .ticket-item__arrow {
  color: var(--brand-dark-red);
  transform: translateX(3px);
}

.priority {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--mid-grey);
  font-size: 11px;
  font-weight: 800;
}

.priority::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--light-grey);
  content: "";
}

.priority--hoch::before {
  background: var(--brand-red);
}

.priority--normal::before {
  background: var(--brand-blue);
}

.priority--niedrig::before {
  background: var(--brand-green);
}

.ticket-create {
  position: sticky;
  top: 20px;
  margin: 0;
}

.ticket-create h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.ticket-create > p,
.ticket-reply > p {
  margin: 0 0 17px;
  color: var(--text-muted);
  font-size: 13px;
}

.ticket-create__submit {
  width: 100%;
  margin-top: 18px;
}

.empty-state {
  display: flex;
  min-height: 280px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 42px 24px;
  border: 1px dashed var(--lighter-grey);
  border-radius: var(--radius-md);
  background: var(--white);
  text-align: center;
}

.empty-state h1,
.empty-state h2 {
  margin: 16px 0 5px;
}

.empty-state p {
  max-width: 440px;
  margin: 0 0 20px;
  color: var(--text-muted);
}

.back-link {
  display: inline-flex;
  margin-bottom: 18px;
  align-items: center;
  color: var(--brand-dark-red);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.ticket-detail-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.ticket-detail-head h1 {
  max-width: 780px;
}

.ticket-detail-head__badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.ticket-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.75fr);
  gap: 22px;
  align-items: start;
}

.ticket-solution {
  margin-bottom: 18px;
  padding: 18px 20px;
  border: 1px solid #bde5c5;
  border-radius: var(--radius-md);
  background: #f0faf2;
}

.ticket-solution strong {
  color: #237a34;
  font-size: 13px;
}

.ticket-solution p {
  margin: 6px 0 0;
  white-space: pre-wrap;
}

.conversation {
  margin-bottom: 18px;
}

.conversation > h2 {
  margin-top: 0;
}

.conversation-entry {
  position: relative;
  margin-bottom: 11px;
  padding: 17px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.conversation-entry--customer {
  margin-left: 44px;
  border-left: 4px solid var(--brand-dark-red);
  background: #fffafb;
}

.conversation-entry--support {
  margin-right: 44px;
  border-left: 4px solid var(--brand-blue);
}

.conversation-entry__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 8px;
}

.conversation-entry__head strong {
  font-size: 13px;
}

.conversation-entry__head time {
  color: var(--light-grey);
  font-size: 11px;
  white-space: nowrap;
}

.conversation-entry__text {
  color: var(--dark-grey);
  font-size: 14px;
  white-space: pre-wrap;
}

.ticket-reply {
  margin-bottom: 0;
}

.ticket-reply h2 {
  margin-top: 0;
}

.ticket-reply .btn {
  margin-top: 15px;
}

.ticket-sidebar {
  position: sticky;
  top: 20px;
}

.ticket-sidebar .karte {
  margin-bottom: 14px;
}

.ticket-sidebar h2 {
  margin-top: 0;
}

.detail-list {
  margin: 0;
}

.detail-list > div {
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.detail-list > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.detail-list dt {
  color: var(--mid-grey);
  font-size: 11px;
  font-weight: 700;
}

.detail-list dd {
  overflow-wrap: anywhere;
  margin: 0;
  font-size: 12px;
  font-weight: 700;
}

.status-history {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.status-history::before {
  position: absolute;
  top: 7px;
  bottom: 12px;
  left: 5px;
  width: 2px;
  background: var(--border);
  content: "";
}

.status-history li {
  position: relative;
  display: flex;
  gap: 12px;
  padding-bottom: 15px;
}

.status-history li:last-child {
  padding-bottom: 0;
}

.status-history__dot {
  position: relative;
  z-index: 1;
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  margin-top: 3px;
  border: 3px solid var(--brand-dark-red);
  border-radius: 50%;
  background: var(--white);
}

.status-history strong,
.status-history time {
  display: block;
}

.status-history strong {
  font-size: 12px;
}

.status-history time {
  margin-top: 2px;
  color: var(--light-grey);
  font-size: 10px;
}

.document-list {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.document-item {
  display: grid;
  min-height: 104px;
  grid-template-columns: 48px minmax(220px, 1fr) minmax(130px, auto) auto;
  align-items: center;
  gap: 17px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.document-item:last-child {
  border-bottom: 0;
}

.document-item__icon {
  display: inline-flex;
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  background: #eaf5fc;
  color: var(--brand-blue);
}

.document-item__icon svg {
  width: 23px;
  height: 23px;
}

.document-item__body {
  min-width: 0;
}

.document-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--mid-grey);
  font-size: 10px;
  font-weight: 700;
}

.document-item__meta span:first-child {
  color: var(--brand-dark-red);
  letter-spacing: 0.04em;
}

.document-item h2 {
  overflow: hidden;
  margin: 4px 0 0;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-item p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.document-item__amount {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 7px;
  text-align: right;
}

.document-item__amount strong {
  font-size: 16px;
}

.document-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.document-actions form {
  display: inline-flex;
  margin: 0;
}

input,
textarea,
select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--lighter-grey);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand-dark-red);
  box-shadow: 0 0 0 3px rgba(173, 21, 61, 0.11);
  outline: none;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

label {
  display: block;
  margin: 14px 0 6px;
  color: var(--dark-grey);
  font-size: 12px;
  font-weight: 800;
}

.leer {
  padding: 10px 0;
  color: var(--text-muted);
  font-size: 14px;
}

.hinweis,
.fehler {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.hinweis {
  border: 1px solid #f2d984;
  background: #fff9df;
  color: #6f5700;
}

.fehler {
  border: 1px solid #f6b6c0;
  background: #fff1f3;
  color: var(--brand-darker-red);
}

.auth-page {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(330px, 0.9fr) minmax(440px, 1.1fr);
  background: var(--white);
}

.auth-brand {
  position: relative;
  isolation: isolate;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(34px, 5vw, 72px);
  background: var(--brand-black);
  color: var(--white);
}

.auth-brand::before {
  position: absolute;
  z-index: -2;
  top: -170px;
  left: -190px;
  width: 530px;
  height: 530px;
  border: 84px solid var(--brand-dark-red);
  border-radius: 42%;
  content: "";
  transform: rotate(28deg);
}

.auth-brand::after {
  position: absolute;
  z-index: -1;
  right: -190px;
  bottom: -160px;
  width: 470px;
  height: 390px;
  border-radius: 46%;
  background: var(--brand-red);
  content: "";
  transform: rotate(-22deg);
}

.auth-brand .portal-brand {
  color: var(--white);
}

.auth-brand .portal-brand__context {
  border-left-color: rgba(255, 255, 255, 0.45);
  color: #eeeeee;
}

.auth-brand .portal-brand__logo {
  width: 170px;
}

.auth-brand__content {
  max-width: 520px;
  margin: auto 0;
  padding: 70px 0;
}

.auth-brand__eyebrow {
  margin-bottom: 13px;
  color: #ffd1d9;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-brand h1 {
  max-width: 510px;
  margin-bottom: 18px;
  color: var(--white);
  font-size: clamp(34px, 5vw, 58px);
}

.auth-brand p {
  max-width: 480px;
  margin: 0;
  color: #eeeeee;
  font-size: 17px;
}

.auth-brand__footer {
  color: #d0d0d0;
  font-size: 12px;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px;
  background: var(--almost-white);
}

.auth-card {
  width: min(100%, 440px);
  padding: clamp(28px, 5vw, 46px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-md);
}

.auth-card__eyebrow {
  margin-bottom: 8px;
  color: var(--brand-dark-red);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.auth-card h1 {
  margin-bottom: 8px;
  font-size: 30px;
}

.auth-card .sub {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 14px;
}

.auth-card button {
  width: 100%;
  min-height: 46px;
  margin-top: 22px;
  border: 1px solid var(--brand-dark-red);
  border-radius: var(--radius-sm);
  background: var(--brand-dark-red);
  color: var(--white);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.auth-card button:hover {
  border-color: var(--brand-darker-red);
  background: var(--brand-darker-red);
}

.auth-help {
  margin: 22px 0 0;
  color: var(--mid-grey);
  font-size: 12px;
  text-align: center;
}

.auth-secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 18px;
  color: var(--mid-grey);
  font-size: 11px;
}

.auth-secure svg {
  width: 14px;
  height: 14px;
  color: var(--brand-green);
}

@media (max-width: 900px) {
  .kachel,
  .kachel--wide {
    grid-column: span 6;
  }

  .auth-page {
    grid-template-columns: 1fr;
  }

  .ticket-layout,
  .ticket-detail-grid {
    grid-template-columns: 1fr;
  }

  .ticket-create,
  .ticket-sidebar {
    position: static;
  }

  .document-item {
    grid-template-columns: 48px minmax(0, 1fr) auto;
  }

  .document-actions {
    grid-column: 2 / -1;
  }

  .auth-brand {
    min-height: 300px;
    padding: 28px;
  }

  .auth-brand__content {
    padding: 52px 0 20px;
  }

  .auth-brand h1 {
    font-size: clamp(30px, 7vw, 44px);
  }
}

@media (max-width: 680px) {
  .portal-header__inner,
  .portal-nav__inner,
  .portal-main,
  .portal-footer__inner {
    width: min(100% - 24px, var(--content-width));
  }

  .portal-header__inner {
    min-height: 68px;
  }

  .portal-user__identity {
    display: none;
  }

  .portal-logout {
    width: 38px;
    padding: 8px;
    justify-content: center;
  }

  .portal-logout span {
    display: none;
  }

  .portal-main {
    padding-top: 22px;
  }

  .dashboard-hero {
    min-height: 330px;
    padding: 30px 24px;
    border-radius: var(--radius-md);
  }

  .dashboard-hero::before {
    right: -260px;
  }

  .dashboard-hero::after {
    right: -80px;
  }

  .dashboard-section__head {
    align-items: flex-start;
    flex-direction: column;
  }

  .recent-ticket {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 12px;
    padding: 14px 15px;
  }

  .recent-ticket__number,
  .recent-ticket__title {
    grid-column: 1;
  }

  .recent-ticket .badge,
  .recent-ticket__arrow {
    grid-column: 2;
    grid-row: 1;
  }

  .recent-ticket__arrow {
    display: none;
  }

  .recent-ticket time {
    grid-column: 2;
    grid-row: 2;
  }

  .page-heading,
  .ticket-detail-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .ticket-summary {
    grid-template-columns: 1fr;
  }

  .ticket-summary a {
    min-height: 66px;
  }

  .ticket-toolbar {
    grid-template-columns: 1fr;
  }

  .ticket-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .ticket-item__state {
    width: 100%;
    min-width: 0;
    align-items: center;
    flex-direction: row;
  }

  .ticket-item__arrow {
    margin-top: 0;
    margin-left: auto;
  }

  .conversation-entry--customer {
    margin-left: 18px;
  }

  .conversation-entry--support {
    margin-right: 18px;
  }

  .conversation-entry__head {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .document-item {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
    padding: 16px 14px;
  }

  .document-item__icon {
    width: 42px;
    height: 42px;
  }

  .document-item__amount {
    grid-column: 2;
    align-items: flex-start;
    text-align: left;
  }

  .document-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .document-actions .btn,
  .document-actions form {
    flex: 1;
  }

  .document-actions form .btn {
    width: 100%;
  }

  .kachel,
  .kachel--wide {
    min-height: 168px;
    grid-column: 1 / -1;
  }

  .karte {
    margin-right: -12px;
    margin-left: -12px;
    padding: 17px 16px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .portal-footer__inner {
    min-height: 80px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
  }

  .auth-panel {
    padding: 22px 14px 34px;
  }

  .auth-card {
    padding: 28px 22px;
    border-radius: var(--radius-md);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Hinweis auf die Vorabversion ─────────────────────────────────────────
   Ein Streifen unter der Kopfzeile, auf jeder angemeldeten Seite. Bewusst in
   Gelb statt in der Markenfarbe: Rot ist im Portal die Farbe der Marke und
   zugleich die von Fehlern — ein roter Streifen ueber jedem Angebot laese sich
   als Stoerung lesen. Gelb sagt "beachten", nicht "es ist etwas kaputt". */
.portal-beta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 24px;
  background: #fff8e1;
  border-bottom: 1px solid var(--brand-yellow);
  font-size: 0.875rem;
  color: var(--text);
}
.portal-beta__marke {
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: #7a5b00;
}
.portal-beta__text { color: var(--text-muted); }
