:root {
  color-scheme: dark;
  --ink: #f2efe7;
  --muted: #aeb5c3;
  --line: #3b3542;
  --panel: #151821;
  --panel-strong: #1c1b24;
  --panel-soft: #11131a;
  --page: #090b10;
  --navy: #080d35;
  --gold: #d6aa33;
  --gold-soft: #33280f;
  --red: #e05d67;
  --green: #5ec28f;
  --blue: #78aaff;
  --input: #0f1219;
  --input-line: #48414f;
  --hover: #211d25;
  --radius: 8px;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(214, 170, 51, 0.08), transparent 34vw),
    linear-gradient(180deg, #0c0e14 0%, var(--page) 48%, #06070a 100%);
  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(7, 8, 13, 0.96), rgba(8, 13, 53, 0.84)),
    url("/static/state-logo.webp") center left 12% / min(520px, 70vw) no-repeat,
    #07080d;
}

.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(214, 170, 51, 0.34);
  border-radius: var(--radius);
  background: rgba(15, 18, 25, 0.9);
  color: var(--ink);
  max-width: 420px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
}

.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: #11100c;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(214, 170, 51, 0.16);
}

.primary-link:hover,
.primary-button:hover {
  background: #e4bd4b;
}

.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(214, 170, 51, 0.34);
  background: rgba(255, 255, 255, 0.04);
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #090c17 0%, #11152b 62%, #1f1620 100%);
  color: #fff;
  border-radius: var(--radius);
  border: 1px solid rgba(214, 170, 51, 0.22);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.25);
}

.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: linear-gradient(180deg, var(--panel-strong), 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;
  color: #f7d671;
}

.calendar-panel {
  margin-bottom: 14px;
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
}

.calendar-panel.is-collapsed .calendar-head {
  border-bottom: 0;
}

.calendar-head button,
.calendar-head a {
  cursor: pointer;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.calendar-toolbar strong {
  min-width: 160px;
  text-align: center;
  color: #f7d671;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #161922;
  color: var(--ink);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.icon-button:hover {
  border-color: rgba(214, 170, 51, 0.52);
  background: #1e222d;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(300px, 380px);
  gap: 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(96px, 1fr));
  border-right: 1px solid var(--line);
}

.calendar-weekday,
.calendar-day {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.calendar-weekday {
  padding: 10px;
  background: #12151d;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.calendar-day {
  min-height: 118px;
  padding: 8px;
  background: rgba(17, 19, 26, 0.82);
}

.calendar-day.is-other-month {
  color: #6f7582;
  background: rgba(11, 13, 18, 0.74);
}

.calendar-day.is-today {
  box-shadow: inset 0 0 0 1px rgba(214, 170, 51, 0.58);
}

.calendar-day-number {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.calendar-event {
  display: block;
  width: 100%;
  margin: 0 0 5px;
  padding: 6px 7px;
  border: 1px solid rgba(120, 170, 255, 0.34);
  border-radius: 7px;
  background: #111f38;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  font-size: 12px;
  line-height: 1.25;
}

.calendar-event.is-required {
  border-color: rgba(224, 93, 103, 0.56);
  background: #35151b;
}

.calendar-event-time {
  display: block;
  color: #f7d671;
  font-size: 11px;
  font-weight: 800;
}

.calendar-side {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 18px;
}

.calendar-detail {
  display: grid;
  gap: 8px;
}

.calendar-detail h3 {
  margin-bottom: 0;
}

.calendar-meta-grid {
  display: grid;
  gap: 7px;
}

.calendar-form {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

legend {
  padding: 0 5px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

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

.check-grid label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  color: var(--ink);
  font-weight: 700;
}

.check-grid input {
  width: 15px;
  height: 15px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.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: linear-gradient(180deg, var(--panel-strong), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
}

.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: #d9dde7;
  font-size: 13px;
  font-weight: 700;
}

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

input::placeholder,
textarea::placeholder {
  color: #808896;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(214, 170, 51, 0.7);
  outline: 2px solid rgba(214, 170, 51, 0.18);
  outline-offset: 0;
}

option {
  background: var(--input);
  color: var(--ink);
}

input[type="file"]::file-selector-button {
  margin-right: 10px;
  border: 1px solid rgba(214, 170, 51, 0.38);
  border-radius: 6px;
  background: #1b1a20;
  color: var(--ink);
  font-weight: 700;
}

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: #12151d;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  z-index: 1;
}

tr:hover td {
  background: var(--hover);
}

.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: #181a21;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}

.status-eingereicht {
  color: #ffe39a;
  background: var(--gold-soft);
  border-color: rgba(236, 210, 127, 0.48);
}

.status-in_bearbeitung {
  color: var(--blue);
  background: #111f38;
  border-color: rgba(120, 170, 255, 0.42);
}

.status-rueckfrage,
.status-rueckfragen_offen {
  color: #ffbd7a;
  background: #351f14;
  border-color: rgba(239, 196, 147, 0.42);
}

.status-angenommen,
.status-erledigt {
  color: var(--green);
  background: #13261d;
  border-color: rgba(94, 194, 143, 0.38);
}

.status-abgelehnt {
  color: var(--red);
  background: #35151b;
  border-color: rgba(224, 93, 103, 0.42);
}

.priority-kritisch,
.priority-hoch {
  color: var(--red);
  background: #35151b;
  border-color: rgba(224, 93, 103, 0.42);
}

.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: #161922;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.secondary-button:hover {
  border-color: rgba(214, 170, 51, 0.52);
  background: #1e222d;
}

.danger-button {
  color: var(--red);
  border-color: rgba(224, 93, 103, 0.42);
  background: #221217;
}

.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: var(--panel-soft);
}

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

.toast {
  position: fixed;
  right: 18px;
  bottom: 64px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #11131a;
  color: #fff;
  border: 1px solid rgba(214, 170, 51, 0.28);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.34);
}

.made-by {
  position: fixed;
  right: 12px;
  bottom: 10px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: calc(100vw - 24px);
  padding: 7px 9px;
  border: 1px solid rgba(197, 155, 45, 0.74);
  border-radius: 999px;
  background: rgba(8, 13, 53, 0.94);
  color: #e8ebf2;
  font-size: 10px;
  line-height: 12px;
  text-decoration: none;
  text-transform: none;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.made-by:hover {
  border-color: #e3bd53;
  color: #fff;
}

.made-by img {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  object-fit: cover;
}

.made-by strong {
  max-width: 180px;
  overflow: hidden;
  color: #f0c75c;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.made-by-version {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border: 1px solid rgba(240, 199, 92, 0.52);
  border-radius: 999px;
  background: rgba(197, 155, 45, 0.2);
  color: #ffe39a;
  font-weight: 900;
  letter-spacing: 0;
  white-space: nowrap;
}

.made-by-separator {
  width: 1px;
  height: 20px;
  background: rgba(240, 199, 92, 0.38);
}

.made-by-profile {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.made-by-profile:hover strong {
  color: #fff2bd;
}

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

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

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

@media (max-width: 1360px) {
  .calendar-layout {
    grid-template-columns: 1fr;
  }

  .calendar-grid {
    border-right: 0;
  }

  .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(7, 8, 13, 0.96), rgba(8, 13, 53, 0.82)),
      url("/static/state-logo.webp") center top 38px / 260px no-repeat,
      #07080d;
  }

  .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;
  }

  .calendar-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .calendar-grid {
    grid-template-columns: repeat(7, minmax(72px, 1fr));
    overflow-x: auto;
  }

  .calendar-day {
    min-height: 96px;
    padding: 6px;
  }

  .calendar-event {
    padding: 5px;
    font-size: 11px;
  }

  .form-grid-2 {
    grid-template-columns: 1fr;
  }

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

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

  .made-by {
    right: 8px;
    bottom: 8px;
    gap: 6px;
    padding: 6px 8px;
  }

  .made-by strong {
    max-width: 110px;
  }
}
