* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  background: #ececec;
  color: #1f1f1f;
}

.top-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 0;
}

.logo-box,
.top-fill {
  background: #1f256e;
  color: #ffffff;
  height: 28px;
}

.logo-box {
  min-width: 160px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-weight: 700;
  letter-spacing: 2px;
}

.top-fill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px 0 14px;
  font-weight: 700;
  letter-spacing: 2px;
}

.top-fill-brand-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.top-fill-brand-wrap .top-fill-brand {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-fill-brand {
  flex: 1;
  min-width: 0;
}

.header-admin-btn {
  flex-shrink: 0;
  height: 22px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 2px;
  cursor: pointer;
}

.header-admin-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.sidebar-back-btn {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 0;
  text-align: left;
  font: inherit;
  color: #1f256e;
  text-decoration: underline;
  background: none;
  border: none;
  cursor: pointer;
}

.sidebar-back-btn:hover {
  color: #000080;
}

.sidebar-objekt-toggle-btn {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 0;
  text-align: left;
  font: inherit;
  color: #1f256e;
  text-decoration: underline;
  background: none;
  border: none;
  cursor: pointer;
}

.sidebar-objekt-toggle-btn:hover {
  color: #000080;
}

.sidebar-objekt-picker {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid #c5c5c5;
}

.sidebar-obj-hint {
  font-size: 11px;
  margin: 0 0 6px;
  min-height: 14px;
  line-height: 1.3;
}

.sidebar-obj-picker-list {
  max-height: 220px;
  overflow: auto;
}

.sidebar-obj-option {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin: 6px 0;
  font-size: 12px;
  cursor: pointer;
  line-height: 1.3;
}

.sidebar-obj-option input {
  margin: 2px 0 0;
  flex-shrink: 0;
}

.sidebar-obj-apply-btn {
  margin-top: 10px;
  width: 100%;
}

.sidebar-obj-empty {
  font-size: 11px;
  color: #555;
  margin: 0;
  line-height: 1.35;
}

.admin-status-row {
  display: block;
  padding: 8px 0 0 22px;
  font-size: 12px;
  width: 235px;
  line-height: 1.2;
}

.admin-status-row span {
  display: block;
}

#logoutLink {
  display: inline-block;
  margin-top: 2px;
  color: #0000ee;
  text-decoration: underline;
}

#changeOwnPasswordLink {
  display: block;
  margin-top: 2px;
  color: #0000ee;
  text-decoration: underline;
}

.layout {
  display: flex;
  min-height: calc(100vh - 40px);
}

.admin-layout {
  min-height: auto;
}

.sidebar {
  width: 170px;
  padding: 10px;
}

.admin-sidebar {
  align-self: flex-start;
  height: calc(100vh - 96px);
  border-right: 1px solid #b7b7b7;
  background: #ececec;
}

.sidebar-link {
  display: block;
  color: #1f256e;
  text-decoration: underline;
  margin: 4px 0;
}

.sidebar-link + .sidebar-link {
  margin-top: 10px;
}

.content {
  flex: 1;
  padding: 42px 10px 0 22px;
}

.login-box {
  width: 360px;
  border: 1px solid #9b9b9b;
  background: #ececec;
}

.login-title {
  background: #7f98b4;
  color: #ffffff;
  text-align: center;
  font-weight: 700;
  border-bottom: 1px solid #9b9b9b;
}

.row {
  display: grid;
  grid-template-columns: 160px 1fr;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
}

.row input {
  height: 18px;
  border: 1px solid #c8c8c8;
  background: #f7f7f7;
  font-size: 12px;
  padding: 0 3px;
}

.remember {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px 4px;
}

.remember input {
  margin: 0;
}

.link-like-btn {
  margin: 0 4px 2px;
  padding: 0;
  height: auto;
  border: none;
  background: none;
  color: #1f256e;
  text-decoration: underline;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.link-like-btn:hover {
  color: #000080;
  background: none;
}

.actions {
  display: flex;
  justify-content: flex-end;
  padding: 2px 4px 4px;
}

button {
  height: 20px;
  border: 1px solid #9a9a9a;
  background: linear-gradient(#f2f2f2, #dddddd);
  font-size: 12px;
  padding: 0 6px;
  cursor: pointer;
}

button:hover {
  background: linear-gradient(#f9f9f9, #dcdcdc);
}

.er-module {
  width: 100%;
  max-width: 100%;
  border: 1px solid #9b9b9b;
  background: #ececec;
}

.er-title {
  background: #7f98b4;
  color: #ffffff;
  text-align: center;
  font-weight: 700;
  border-bottom: 1px solid #9b9b9b;
  padding: 3px 6px;
}

.er-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 12px;
  padding: 8px;
  border-bottom: 1px solid #c9c9c9;
}

.er-grid label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  min-width: 0;
}

.er-grid input,
.er-toolbar input {
  width: 100%;
  min-width: 0;
  height: 22px;
  border: 1px solid #bdbdbd;
  background: #f7f7f7;
  font-size: 12px;
  padding: 0 4px;
  box-sizing: border-box;
}

.er-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  grid-column: 1 / -1;
}

.er-cloud-hint {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  color: #666666;
}

.er-toolbar,
.er-mail-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid #cfcfcf;
}

/* display:flex auf .er-toolbar würde sonst das HTML-Attribut hidden ignorieren */
.er-toolbar[hidden],
.er-mail-flow[hidden] {
  display: none !important;
}

.er-toolbar label {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 140px;
  min-width: 0;
}

.er-toolbar label input {
  flex: 1;
  min-width: 0;
}

.er-mail-step-label {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.er-mail-tanks {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.er-mail-tank-checkboxes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 4px 0;
}

.er-mail-tank-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
}

.er-mail-tanks-empty {
  font-size: 12px;
  color: #666;
}

.er-mail-tank-bulk {
  display: flex;
  gap: 6px;
}

.er-mail-tank-bulk button {
  height: 20px;
  font-size: 11px;
  padding: 0 8px;
}

.er-hint {
  min-height: 18px;
  padding: 4px 8px;
  color: #1f1f1f;
}

.er-table-wrap {
  max-height: 460px;
  overflow: auto;
  border-top: 1px solid #cfcfcf;
}

.er-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.er-table th,
.er-table td {
  border: 1px solid #d3d3d3;
  padding: 3px 4px;
  text-align: left;
  vertical-align: middle;
}

.er-table th {
  background: #f0f0f0;
}

.er-table td:last-child {
  white-space: nowrap;
}

.ha-risk-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.ha-risk-level-1 {
  background: #2e7d32;
  color: #ffffff;
}

.ha-risk-level-2 {
  background: #f6d32d;
  color: #1f1f1f;
}

.ha-risk-level-3 {
  background: #c62828;
  color: #ffffff;
}

.ha-risk-level-4 {
  background: #111111;
  color: #ffffff;
}

.ha-inline-input {
  width: 100%;
  min-width: 70px;
  height: 22px;
  border: 1px solid #bdbdbd;
  background: #ffffff;
  font-size: 12px;
  padding: 0 4px;
  box-sizing: border-box;
}

.ha-inline-input:disabled {
  background: #ececec;
  color: #666666;
  border-color: #cfcfcf;
}

.er-worker-id-input {
  width: 100%;
  max-width: 76px;
  box-sizing: border-box;
  margin: 0;
  font: inherit;
  padding: 2px 4px;
  border: 1px solid #bdbdbd;
  border-radius: 2px;
  background: #fff;
}

.er-measure-note-input {
  width: 100%;
  min-width: 180px;
  box-sizing: border-box;
  margin: 0;
  font: inherit;
  padding: 2px 4px;
  border: 1px solid #bdbdbd;
  border-radius: 2px;
  background: #fff;
}

.er-status-open {
  color: #a06400;
  font-weight: 700;
}

.er-status-active {
  color: #005da8;
  font-weight: 700;
}

.er-status-closed {
  color: #1c5e1c;
  font-weight: 700;
}

.er-freimessung-open {
  color: #8b1d1d;
  font-weight: 700;
}

.er-freimessung-done {
  color: #1c5e1c;
  font-weight: 700;
}

.admin-panel-benutzer {
  width: 100%;
  max-width: 100%;
}

.admin-benutzer-module {
  margin-right: clamp(0px, 2vw, 16px);
}

.admin-benutzer-section + .admin-benutzer-section {
  border-top: 1px solid #c9c9c9;
}

.admin-user-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 20px;
  padding: 8px 12px;
  align-items: start;
}

@media (max-width: 720px) {
  .admin-user-form-grid {
    grid-template-columns: 1fr;
  }
}

.admin-user-form-grid .admin-user-password-note {
  grid-column: 1 / -1;
}

.admin-user-may-admin-row {
  grid-column: 1 / -1;
  align-items: start;
}

.admin-user-may-admin-check {
  flex: 1;
  min-width: 0;
  align-items: flex-start;
  line-height: 1.35;
}

.admin-obj-note-row {
  grid-column: 1 / -1;
}

.admin-obj-note-row textarea {
  width: 100%;
  min-height: 44px;
  max-height: 160px;
  border: 1px solid #bdbdbd;
  background: #f7f7f7;
  font-size: 12px;
  padding: 4px 6px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}

.admin-user-form-grid .row {
  min-width: 0;
}

.admin-benutzer-list-wrap {
  padding: 6px 8px 10px;
  max-height: min(52vh, 520px);
  overflow: auto;
}

.admin-user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.admin-user-table th,
.admin-user-table td {
  border: 1px solid #d3d3d3;
  padding: 4px 5px;
  text-align: left;
  vertical-align: middle;
}

.admin-user-table th {
  background: #f0f0f0;
}

.admin-user-table td:last-child {
  white-space: nowrap;
}

.admin-user-table button {
  margin-right: 4px;
}

.admin-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 0 6px;
}

.admin-list-header .login-title {
  margin: 0;
}

.admin-list-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-reset-request {
  font-weight: 700;
  color: #8b1d1d;
}

.admin-user-list-empty {
  margin: 8px 6px;
  font-size: 12px;
  color: #555;
}

.admin-user-form {
  padding-bottom: 4px;
}

.admin-user-password-note {
  margin: 6px 4px 2px;
  font-size: 11px;
  color: #444;
  line-height: 1.3;
}

.admin-user-form-hint {
  min-height: 18px;
  padding: 2px 4px 4px;
  font-size: 12px;
}

.admin-user-form-actions {
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
body.auth-pending {
  visibility: hidden;
}

.login-status {
  min-height: 18px;
  padding: 3px 4px;
  font-size: 12px;
}

.login-status.success { color: #1c5e1c; }
.login-status.error { color: #8b1d1d; }
