:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #666b73;
  --line: #d9dde4;
  --panel: #ffffff;
  --page: #f4f5f7;
  --navy: #080d35;
  --gold: #c59b2d;
  --gold-soft: #fff4cd;
  --red: #9f2330;
  --green: #1f7a4d;
  --blue: #245aa5;
  --radius: 8px;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
}

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

button,
a {
  touch-action: manipulation;
}

[hidden] {
  display: none !important;
}

.public-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1.1fr) minmax(280px, 0.9fr);
  background:
    linear-gradient(90deg, rgba(8, 13, 53, 0.94), rgba(8, 13, 53, 0.76)),
    url("/static/state-logo.webp") center left 12% / min(520px, 70vw) no-repeat,
    #080d35;
}

.public-copy {
  padding: clamp(28px, 7vw, 88px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #fff;
  min-height: 84vh;
}

.public-info {
  align-self: end;
  margin: 0 clamp(18px, 5vw, 64px) clamp(18px, 5vw, 64px) 0;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  max-width: 420px;
}

.brand-seal {
  width: 132px;
  height: 132px;
  object-fit: contain;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.public-copy h1 {
  margin-bottom: 14px;
  font-size: 48px;
  line-height: 1.04;
}

.lead {
  max-width: 560px;
  font-size: 19px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.86);
}

.primary-link,
.primary-button,
.ghost-link,
.link-button {
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}

.primary-link,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  background: var(--gold);
  color: #121212;
  font-weight: 700;
}

.primary-link {
  width: fit-content;
  margin-top: 16px;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.26);
}

.app-shell {
  min-height: 100vh;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
}

.brand-row,
.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
}

.user-row {
  color: rgba(255, 255, 255, 0.82);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.stats-grid article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 92px;
}

.stats-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stats-grid strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(420px, 1fr) minmax(300px, 420px);
  gap: 14px;
  align-items: start;
}

.submit-panel,
.queue-panel,
.detail-panel,
.log-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.submit-panel,
.detail-panel {
  padding: 18px;
}

.queue-panel {
  overflow: hidden;
}

.section-title h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.request-form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: #30333a;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px 11px;
  color: var(--ink);
}

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

.queue-header {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-weight: 700;
}

.check-row input {
  width: 16px;
  height: 16px;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 292px);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

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

th {
  position: sticky;
  top: 0;
  background: #f8f9fb;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  z-index: 1;
}

tr:hover td {
  background: #fbfaf4;
}

.link-button {
  padding: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 700;
}

.status-badge,
.priority-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f7f7f7;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}

.status-eingereicht {
  color: #6f4b00;
  background: var(--gold-soft);
  border-color: #ecd27f;
}

.status-in_bearbeitung {
  color: var(--blue);
  background: #eaf1ff;
  border-color: #bed1ef;
}

.status-rueckfrage,
.status-rueckfragen_offen {
  color: #7b3d00;
  background: #fff1e4;
  border-color: #efc493;
}

.status-angenommen,
.status-erledigt {
  color: var(--green);
  background: #e8f5ef;
  border-color: #b9dccb;
}

.status-abgelehnt {
  color: var(--red);
  background: #fae8eb;
  border-color: #efbbc3;
}

.priority-kritisch,
.priority-hoch {
  color: var(--red);
  background: #fff0f2;
  border-color: #efbbc3;
}

.detail-panel {
  min-height: 360px;
  max-height: calc(100vh - 156px);
  overflow: auto;
}

.empty-state {
  min-height: 280px;
  display: grid;
  align-content: center;
  color: var(--muted);
}

.detail-head {
  display: grid;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.detail-head h2 {
  margin-bottom: 0;
  font-size: 22px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-block {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.detail-block h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.detail-text {
  white-space: pre-wrap;
  line-height: 1.5;
}

.admin-actions,
.comment-form {
  display: grid;
  gap: 10px;
}

.secondary-button,
.danger-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  font-weight: 700;
}

.danger-button {
  color: var(--red);
  border-color: #efbbc3;
}

.comment-list,
.history-list,
.attachment-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.comment-list li,
.history-list li,
.attachment-list li {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfbfc;
}

.meta-line {
  color: var(--muted);
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #171717;
  color: #fff;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.18);
}

.log-panel {
  margin-top: 14px;
  overflow: hidden;
}

.log-table-wrap {
  max-height: 420px;
}

.log-panel table {
  min-width: 980px;
}

@media (max-width: 1360px) {
  .workspace {
    grid-template-columns: minmax(280px, 360px) minmax(420px, 1fr);
  }

  .detail-panel {
    grid-column: 1 / -1;
    max-height: none;
  }
}

@media (max-width: 840px) {
  .public-shell {
    grid-template-columns: 1fr;
    background:
      linear-gradient(180deg, rgba(8, 13, 53, 0.96), rgba(8, 13, 53, 0.84)),
      url("/static/state-logo.webp") center top 38px / 260px no-repeat,
      #080d35;
  }

  .public-copy {
    min-height: 70vh;
    padding-top: 250px;
  }

  .public-copy h1 {
    font-size: 36px;
  }

  .public-info {
    margin: 0 18px 18px;
  }

  .app-shell {
    padding: 10px;
  }

  .topbar,
  .user-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats-grid,
  .workspace {
    grid-template-columns: 1fr;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    max-height: none;
  }
}
