:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-2: #eef3ef;
  --line: #d7ddd7;
  --text: #17211b;
  --muted: #637168;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #b7791f;
  --danger: #b42318;
  --focus: #2563eb;
  --shadow: 0 10px 24px rgba(23, 33, 27, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

button,
input,
select,
.upload-button {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 0 12px;
}

button:hover {
  border-color: var(--accent);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

button.primary:hover {
  background: var(--accent-strong);
}

button.ghost {
  background: transparent;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  padding: 8px 10px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

label.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  color: var(--text);
}

label.check input {
  width: 18px;
  min-height: 18px;
}

.upload-button {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 8px 10px;
  font-size: 15px;
  font-weight: 400;
}

.upload-button:hover {
  border-color: var(--accent);
}

.upload-button input {
  display: none;
}

.loading {
  display: grid;
  min-height: 100vh;
  place-items: center;
  color: var(--muted);
}

.login-page {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(280px, 420px) 1fr;
}

.login-panel {
  display: grid;
  align-content: center;
  gap: 20px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 40px;
}

.login-brand {
  display: grid;
  gap: 8px;
}

.login-brand strong {
  font-size: 30px;
}

.login-brand span {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-aside {
  display: grid;
  align-content: end;
  padding: 40px;
  background:
    linear-gradient(120deg, rgba(15, 118, 110, 0.12), rgba(183, 121, 31, 0.10)),
    var(--surface-2);
}

.login-aside dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  max-width: 760px;
}

.login-aside div {
  border-top: 3px solid var(--accent);
  padding-top: 10px;
}

.login-aside dt {
  font-weight: 800;
}

.login-aside dd {
  margin: 4px 0 0;
  color: var(--muted);
}

.app-shell {
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}

.sidebar {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 20px;
  background: #18231d;
  color: #ffffff;
  padding: 18px;
}

.brand {
  display: grid;
  gap: 2px;
}

.brand strong {
  font-size: 23px;
}

.brand span {
  color: #c9d5cc;
  font-size: 13px;
}

.nav {
  display: grid;
  align-content: start;
  gap: 6px;
}

.nav button {
  width: 100%;
  justify-content: flex-start;
  border-color: transparent;
  background: transparent;
  color: #e9f0eb;
  text-align: left;
  padding: 9px 10px;
}

.nav button.active {
  background: #26362d;
  border-color: #405044;
}

.user-box {
  display: grid;
  gap: 10px;
  color: #d8e3dc;
}

.main {
  min-width: 0;
  max-width: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 12px 22px;
}

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

.toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar.is-hidden {
  display: none;
}

.toolbar label {
  min-width: min(180px, 100%);
}

.content {
  min-width: 0;
  max-width: 100%;
  display: grid;
  gap: 18px;
  padding: 22px;
}

.band {
  min-width: 0;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.band-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.band-header label {
  min-width: 220px;
}

.band-header h2 {
  margin: 0;
  font-size: 17px;
}

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

.form-grid .wide {
  grid-column: span 2;
}

.form-message {
  display: grid;
  align-items: center;
  min-height: 38px;
  color: var(--accent-strong);
  font-weight: 700;
}

.notice {
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 8px;
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent-strong);
  padding: 11px 14px;
  font-weight: 700;
}

.notice.error {
  border-color: rgba(180, 35, 24, 0.24);
  background: rgba(180, 35, 24, 0.08);
  color: var(--danger);
}

.table-wrap {
  max-width: 100%;
  overflow-x: visible;
}

table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
}

th {
  color: var(--muted);
  font-size: 12px;
  background: #f8faf8;
}

td strong {
  display: block;
}

td span {
  color: var(--muted);
  font-size: 13px;
}

.action-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.action-stack button,
.action-stack .upload-button {
  min-height: 32px;
  padding: 5px 8px;
  white-space: normal;
}

.status {
  display: inline-grid;
  place-items: center;
  min-width: 0;
  max-width: 100%;
  min-height: 26px;
  border-radius: 999px;
  padding: 2px 9px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 800;
}

.documents-table th:nth-child(1) {
  width: 11%;
}

.documents-table th:nth-child(2) {
  width: 19%;
}

.documents-table th:nth-child(3) {
  width: 10%;
}

.documents-table th:nth-child(4) {
  width: 16%;
}

.documents-table th:nth-child(5) {
  width: 13%;
}

.documents-table th:nth-child(6) {
  width: 10%;
}

.documents-table th:nth-child(7) {
  width: 9%;
}

.documents-table th:nth-child(8) {
  width: 12%;
}

.status.published,
.status.approved {
  border-color: rgba(15, 118, 110, 0.3);
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent-strong);
}

.status.in_review {
  border-color: rgba(183, 121, 31, 0.3);
  background: rgba(183, 121, 31, 0.1);
  color: var(--warn);
}

.status.archived {
  color: var(--muted);
}

.empty {
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
}

.error {
  min-height: 24px;
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 900px) {
  .login-page,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .login-aside {
    display: none;
  }

  .sidebar {
    grid-template-rows: auto auto;
    gap: 14px;
  }

  .nav {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }

  .user-box {
    display: none;
  }

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

@media (max-width: 1100px) {
  .table-wrap {
    padding: 12px;
  }

  .responsive-table,
  .responsive-table thead,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table tbody {
    display: grid;
    gap: 12px;
  }

  .responsive-table tr {
    display: grid;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 12px;
  }

  .responsive-table td {
    display: grid;
    grid-template-columns: minmax(92px, 0.32fr) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    border-bottom: 0;
    padding: 0;
  }

  .responsive-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .responsive-table td[data-label="Aktionen"] {
    grid-template-columns: 1fr;
  }

  .responsive-table td[data-label="Aktionen"]::before {
    margin-bottom: 2px;
  }

  .action-stack {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  }
}

@media (max-width: 620px) {
  .login-panel,
  .content,
  .topbar {
    padding: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

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

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar label {
    width: 100%;
  }

  .form-grid .wide {
    grid-column: span 1;
  }

  .table-wrap {
    padding: 10px;
  }

  .responsive-table tr {
    padding: 10px;
  }

  .responsive-table td {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .action-stack {
    grid-template-columns: 1fr 1fr;
  }
}
