/* Kundenportal – app-spezifische Layout-Styles (Farben via design-tokens.css) */

/* ===== Login gate ===== */
.gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: var(--color-bg);
}

.card {
  width: min(100%, 420px);
}

.card .brand-logo-wrap {
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  border-radius: var(--radius-md);
  background: var(--color-white);
}

.card .brand-logo {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
}

.card h1 {
  font-size: 1.4rem;
  margin: 0;
  text-transform: uppercase;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.subtitle {
  color: var(--muted);
  margin: 0.25rem 0 1.25rem;
}

/* ===== Forms ===== */
.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ===== App shell ===== */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--color-white);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  color: var(--color-anthracite);
}

.topbar-brand.brand-logo-wrap {
  background: transparent;
  padding: 0;
  border-radius: 0;
}

.topbar .brand-logo {
  max-height: 36px;
  width: auto;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  background: var(--color-white);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 53px;
  z-index: 9;
}

.tab {
  font-weight: 700;
  padding: 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
  text-transform: uppercase;
  font-size: var(--font-size-sm);
}

.tab:hover {
  color: var(--color-anthracite);
  border-color: var(--color-grey-blue);
}

.tab.active {
  background: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
}

.content {
  padding: 1rem;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ===== Choice groups ===== */
.field-group {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.9rem;
  margin: 0;
}

.field-group legend {
  font-weight: 700;
  padding: 0 0.4rem;
}

.choice-row {
  display: grid;
  gap: 0.5rem;
}

.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
}

.choice input {
  width: auto;
  accent-color: var(--color-primary);
}

.choice:has(input:checked) {
  border-color: var(--color-primary);
  background: rgba(230, 51, 42, 0.06);
}

/* ===== Upload ===== */
.upload {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.upload-label {
  text-align: center;
}

.preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.5rem;
}

.preview img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.preview-item {
  position: relative;
}

.preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(28, 43, 57, 0.75);
  color: var(--color-white);
  border: none;
  border-radius: 999px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}

.preview-files {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9rem;
}

.preview-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
}

/* ===== Optional details ===== */
.optional {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.9rem;
}

.optional summary {
  cursor: pointer;
  font-weight: 700;
  padding: 0.4rem 0;
}

.optional-grid {
  display: grid;
  gap: 0.8rem;
  padding: 0.6rem 0;
}

/* ===== Ticket list ===== */
.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.ticket-card {
  background: var(--color-white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.ticket-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ticket-number {
  font-weight: 700;
}

.ticket-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.35rem 0;
}

.ticket-desc {
  margin: 0.5rem 0;
  white-space: pre-wrap;
}

.ticket-attachments-title {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.9rem;
}

.ticket-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.ticket-edit {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.ticket-edit-form .button-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ticket-attachment-gallery,
.attachment-gallery-host {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.media-preview-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
}

.media-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}

.media-preview-body {
  min-height: 120px;
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-inline-image {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  cursor: zoom-in;
  display: block;
  margin: 0 auto;
}

.media-inline-frame {
  width: 100%;
  height: 280px;
  border: 0;
  background: var(--color-white);
}

.media-inline-video {
  max-width: 100%;
  max-height: 220px;
}

.media-file-card {
  padding: 1rem;
  text-align: center;
}

.media-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 0.65rem;
  border-top: 1px solid var(--line);
}

.media-lightbox {
  border-radius: var(--radius-md);
}

.media-lightbox-head {
  border-bottom: 1px solid var(--line);
}

.media-lightbox-frame {
  background: var(--color-white);
}

.span-2 {
  grid-column: 1 / -1;
}

@media (min-width: 520px) {
  .choice-row {
    grid-template-columns: 1fr 1fr;
  }
  .optional-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .tab,
  .btn-block {
    width: 100%;
  }
}
