* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  color: #1f2430;
  background: #f8f9fb;
}
.hidden { display: none !important; }
.muted { color: #8a93a6; }

/* Sign-in screen */
.sign-in-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sign-in-card {
  background: #fff;
  border: 1px solid #e2e5ea;
  border-radius: 10px;
  padding: 32px 36px;
  width: 320px;
  text-align: center;
}
.sign-in-card h1 { margin: 0 0 6px; font-size: 20px; }
.sign-in-card p { margin: 0 0 18px; }
.sign-in-error {
  color: #b4302f;
  background: #fdecea;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  margin-bottom: 14px !important;
}

/* App shell */
.app-shell {
  display: grid;
  grid-template-columns: 190px 1fr;
  grid-template-rows: 52px 1fr;
  height: 100vh;
}
.left-rail {
  grid-row: 1 / 3;
  background: #1f2430;
  color: #cbd3e6;
  padding: 14px 0;
}
.brand-row {
  padding: 0 16px 14px;
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid #333a4a;
  margin-bottom: 10px;
}
.nav-item {
  padding: 9px 16px;
  margin: 0 8px 2px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.nav-item:hover { background: #2b3142; }
.nav-item.active { background: #323a4d; color: #fff; }

.top-bar {
  grid-column: 2;
  background: #fff;
  border-bottom: 1px solid #e2e5ea;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}
.view-title { font-weight: 600; font-size: 15px; }

.user-menu { position: relative; }
.user-menu-trigger { cursor: pointer; }
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #6ea8fe;
  background-size: cover;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}
.user-menu-popover {
  position: absolute;
  right: 0;
  top: 38px;
  background: #fff;
  border: 1px solid #e2e5ea;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  min-width: 180px;
  z-index: 10;
}
.user-email { font-size: 12px; color: #666; margin-bottom: 10px; word-break: break-all; }

#view-host {
  grid-column: 2;
  overflow: auto;
  padding: 20px;
}

.empty-state { color: #8a93a6; text-align: center; margin-top: 60px; }
.empty-state p { margin: 4px 0; }

/* Users screen: list + detail */
.list-toolbar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.back-link { font-size: 12px; color: #2b6fe0; cursor: pointer; margin-bottom: 12px; display: inline-block; }
.detail-card { background: #fff; border: 1px solid #e2e5ea; border-radius: 10px; padding: 20px; max-width: 440px; }
.detail-email { margin: 0 0 2px; font-size: 17px; }
.detail-sub { margin: 0 0 16px !important; font-size: 12px; }
.section-label { font-size: 11px; text-transform: uppercase; color: #8a93a6; margin: 4px 0 8px; }
.danger-zone { border-top: 1px solid #f0f1f4; margin-top: 20px; padding-top: 16px; }
.save-status { font-size: 11px; margin-top: 4px; }

/* Buttons */
button { font-family: inherit; font-size: 13px; cursor: pointer; }
.btn-primary, .btn-secondary, .btn-danger {
  border-radius: 6px;
  padding: 7px 14px;
  border: 1px solid transparent;
}
.btn-primary { background: #2b6fe0; color: #fff; }
.btn-primary:hover { background: #2159b8; }
.btn-secondary { background: #fff; border-color: #ccd2dc; color: #1f2430; }
.btn-secondary:hover { background: #f2f4f7; }
.btn-danger { background: #fff; border-color: #e0a3a3; color: #b4302f; }
.btn-danger:hover { background: #fdecea; }

/* Tables */
table.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 0 0 1px #e2e5ea; }
table.data-table th { text-align: left; font-size: 11px; text-transform: uppercase; color: #8a93a6; padding: 9px 12px; border-bottom: 1px solid #e2e5ea; font-weight: 500; }
table.data-table td { padding: 9px 12px; border-bottom: 1px solid #f0f1f4; }
table.data-table tr.alt-row td { background: #f7f8fa; }
table.data-table tr.clickable-row { cursor: pointer; }
table.data-table tr.clickable-row:hover td { background: #eef3fc; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 11px; background: #eef1f6; }
.pill.admin { background: #ffe4c2; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,24,32,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  width: 320px;
  box-shadow: 0 8px 30px rgba(0,0,0,.18);
}
.modal h3 { margin: 0 0 12px; font-size: 15px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 11px; color: #666; margin-bottom: 4px; }
.field input, .field select {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid #ccd2dc;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}
