:root {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Arial, sans-serif;
}

body { margin: 0; background: #0b1220; color: #e6eaf2; }

/* --- Topbar & Layout --- */
.topbar {
  padding: 14px 18px;
  background: #0f1a33;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.brand { font-weight: 700; font-size: 18px; }
.muted { opacity: .85; }
.authinfo { white-space: nowrap; }

.wrap { max-width: 1100px; margin: 20px auto; padding: 0 14px; display: grid; gap: 16px; }

/* --- Cards & General UI --- */
.card {
  background: #0f1a33;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
}

h2 { margin: 0 0 12px 0; font-size: 16px; }
.sub { opacity: .75; font-size: 12px; margin-top: 2px; }
.hint { opacity: .8; font-size: 12px; margin: 10px 0 0; }
code { background: rgba(255,255,255,.08); padding: 2px 6px; border-radius: 8px; }

.row { display: flex; gap: 10px; align-items: center; margin: 10px 0; flex-wrap: wrap; }

/* --- Inputs & Buttons --- */
input {
  background: #0b1220;
  color: #e6eaf2;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 260px;
}

/* Responsive Fix für Inputs auf kleinen Screens */
@media (max-width: 800px) {
  input { min-width: 0; width: 100%; }
}

button {
  background: #2b6cff;
  border: none;
  color: white;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}
button:hover { filter: brightness(1.05); }

.btn { cursor: pointer; }
.btn.secondary { opacity: .9; }

/* Löschen Button (Rot) */
.btn-delete {
  background-color: #e74c3c;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.2s;
}
.btn-delete:hover { background-color: #c0392b; }

/* --- Status Indicators --- */
.status { font-size: 12px; opacity: .85; margin-bottom: 8px; }
.status.ok { color: #9fffb8; }
.status.err { color: #ffb1b1; }

/* --- Tabs --- */
.tabs { display: flex; gap: 10px; }
.tab {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.10);
}
.tab.active {
  background: #2b6cff;
  border-color: rgba(255,255,255,.18);
}

/* --- Klassische Tabellen (Fileshare & Modal Listen) --- */
.tablewrap { overflow: auto; border-radius: 12px; border: 1px solid rgba(255,255,255,.08); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
thead { background: rgba(255,255,255,.06); }
th, td { padding: 10px 10px; border-bottom: 1px solid rgba(255,255,255,.06); white-space: nowrap; }

/* Spezifische Tabellen-Anpassungen */
td:last-child { text-align: center; white-space: nowrap; } /* Aktionen zentrieren */
table .btn { padding: 6px 10px; font-size: 0.85em; border-radius: 6px; }

/* Dropdowns in Tabellen */
table select.role-select {
  padding: 6px 25px 6px 8px;
  border-radius: 6px;
  font-size: 0.9em;
  border-color: rgba(255,255,255,.1);
  background-color: #1a2639;
}
table select.role-select:hover { border-color: rgba(255,255,255,.3); }

/* --- Dropdowns / Selects Global --- */
select {
  background: #0b1220;
  color: #e6eaf2;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23e6eaf2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 12px top 50%;
  background-size: 10px auto;
  padding-right: 30px;
}
select:focus { outline: none; border-color: #2b6cff; }

/* --- MODAL / SIDEBAR (M365 Style) --- */
.modal-overlay {
  position: fixed;
  top: 0; 
  left: 0;
  width: 100%; 
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);     
  z-index: 9999;
  
  /* Sidebar Logik */
  display: flex;
  justify-content: flex-end; 
  align-items: stretch; 
}

.modal-content {
  background: #0f1a33; 
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: -10px 0 30px rgba(0,0,0,0.5);
  
  width: 100%;
  max-width: 500px;
  height: 100% !important;
  margin: 0 !important;
  border-radius: 0 !important;
  
  display: flex;
  flex-direction: column;
  
  /* Slide-In Animation */
  transform: translateX(100%); 
  animation: slideInRight 0.3s cubic-bezier(0.2, 1, 0.3, 1) forwards; 
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,0.03);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: #fff;
  opacity: 0.6;
  cursor: pointer;
  padding: 0 5px;
  transition: opacity 0.2s;
}
.btn-close:hover { opacity: 1; color: #ff4444; }

.modal-table td { padding: 12px 5px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.modal-table tr:last-child td { border-bottom: none; }

.btn-icon {
    background: transparent;
    color: #ff4444;
    font-size: 16px;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    border: none;
}
.btn-icon:hover { background: rgba(255,68,68, 0.1); }

/* --- MODAL FORM GRID (Perfekte Ausrichtung für Formulare) --- */
.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.span-full { grid-column: 1 / -1; }

.modal-grid input, 
.modal-grid select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.modal-grid label { margin: 0; }

/* --- GRID TABELLE (Für User Liste) --- */
.grid-table {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  background: #0f1a33;
  overflow: hidden;
}

.grid-row {
  display: grid;
  /* Spalten-Definition: ID, Email, Vor, Nach, Tel, Abt, Aktionen */
  grid-template-columns: 80px 2fr 1fr 1fr 1fr 1fr 100px;
  gap: 15px;
  padding: 12px 16px;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,.06);
  font-size: 13px;
}

.grid-header {
  background: rgba(255,255,255,.06);
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.grid-row:not(.grid-header):hover { background: rgba(255,255,255,.03); }
.grid-row:last-child { border-bottom: none; }

.grid-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.grid-cell.actions {
  overflow: visible;
}

/* Spezielles Raster für Fileshare: ID, Name, Aktionen */
.grid-files {
  grid-template-columns: 80px 1fr 150px !important;
}

/* Klickbare Zeile für Ordner (Optisches Feedback) */
.grid-row-clickable {
  cursor: pointer;
  transition: background 0.2s;
}

#loginCard {
  padding: 16px;
}