body {
  margin: 0;
  font-family: system-ui, Arial, sans-serif;
  background: #f5f8fa;
}

/* Login */
#loginScreen {
  position: fixed;
  inset: 0;
  background: #009fb3;
  display: flex;
  align-items: center;
  justify-content: center;
}

#loginBox {
  background: #ffffff;
  padding: 24px 28px;
  border-radius: 14px;
  max-width: 360px;
  width: 90%;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

#loginBox h1 {
  margin-top: 0;
  margin-bottom: 8px;
  color: #009fb3;
}

#loginBox label {
  display: block;
  margin-top: 10px;
  font-size: 0.95rem;
}

#loginBox input {
  width: 100%;
  padding: 7px;
  margin-top: 3px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

#btnLogin {
  margin-top: 14px;
  width: 100%;
  padding: 8px;
  border: none;
  background: #009fb3;
  color: white;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}

#loginMessage {
  margin-top: 8px;
  font-size: 0.85rem;
  color: #c0392b;
}

.hint {
  font-size: 0.8rem;
  margin: 4px 0 10px;
}

/* App Layout */
.hidden {
  display: none !important;
}

#app {
  display: flex;
  height: 100vh;
}

/* Sidebar (Desktop) */
#sidebar {
  width: 260px;
  background: #009fb3;
  color: white;
  padding: 15px;
  display: flex;
  flex-direction: column;
}

#sidebar h2 {
  margin: 0 0 10px 0;
}

#sidebar button {
  margin-bottom: 10px;
  padding: 8px;
  border: none;
  background: white;
  color: #009fb3;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}

#sidebar hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.4);
  margin: 10px 0;
}

#userInfo {
  margin-top: auto;
  font-size: 0.85rem;
}

#userInfo button {
  width: 100%;
  margin-top: 6px;
}

/* Hauptbereich */
#main {
  flex: 1;
  padding: 20px 26px;
  display: flex;
  flex-direction: column;
}

/* Icon-Leiste (Mobil) – Desktop standardmäßig aus */
#topIconBar {
  display: none;
  gap: 10px;
  margin-bottom: 10px;
}

#topIconBar button {
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 1.1rem;
  cursor: pointer;
  background: #009fb3;
  color: #fff;
}

.topRow {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 12px;
}

.topRow h1 {
  margin: 0;
}

#search {
  flex: 1;
  padding: 7px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

/* Tabelle */
#tableWrapper {
  flex: 1;
  overflow: auto;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

#pwTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

#pwTable th,
#pwTable td {
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
}

#pwTable th {
  text-align: left;
  background: #f2f6f8;
  position: sticky;
  top: 0;
  z-index: 1;
}

#pwTable tbody tr {
  cursor: pointer;
}

#pwTable tbody tr:hover {
  background: #f9fcff;
}

/* Popup */
#popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

#popupBox {
  width: 360px;
  max-width: 90vw;
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.2);
}

#popupBox label {
  display: block;
  margin-bottom: 10px;
}

#popupBox input {
  width: 100%;
  padding: 7px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.popupButtons {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
}

.danger {
  background: #d94848 !important;
  color: #fff !important;
}

/* --------- Mobile Ansicht --------- */
@media (max-width: 768px) {
  #sidebar {
    display: none;
  }

  #app {
    flex-direction: column;
  }

  #main {
    padding: 12px;
  }

  #topIconBar {
    display: flex;
    justify-content: flex-end;
  }

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

  #tableWrapper {
    box-shadow: none;
    border-radius: 0;
  }

  /* Tabelle als Karten */
  #pwTable,
  #pwTable thead,
  #pwTable tbody,
  #pwTable th,
  #pwTable tr,
  #pwTable td {
    display: block;
  }

  #pwTable thead {
    display: none;
  }

  #pwTable tr {
    margin: 0 0 10px;
    border: 1px solid #e0e6eb;
    border-radius: 8px;
    padding: 6px 8px;
    background: #ffffff;
  }

  #pwTable td {
    border: none;
    padding: 4px 0;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.9rem;
  }

  #pwTable td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #666;
  }
}

/* Druck */
@media print {
  #loginScreen,
  #sidebar,
  #popup,
  #topIconBar,
  #search,
  .topRow h1 {
    display: none !important;
  }

  #main {
    padding: 0;
  }

  #tableWrapper {
    box-shadow: none;
  }

  #pwTable {
    font-size: 11pt;
  }

  #pwTable,
  #pwTable thead,
  #pwTable tbody,
  #pwTable th,
  #pwTable tr,
  #pwTable td {
    display: table;
  }
}
/* Passwort Icons */
.pw-action {
  cursor: pointer;
  margin-left: 6px;
  font-size: 1.1rem;
}

.pw-visible.hidden,
.pw-hidden.hidden {
  display: none;
}
