* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
body {
  background-color: #f8fafc;
  color: #0f172a;
  min-height: 100vh;
}
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background-color: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  position: relative;
  z-index: 50;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.app-logo {
  font-weight: 700;
  font-size: 1.125rem;
  color: #1e3a8a;
}
.app-env-badge {
  font-size: 0.75rem;
  font-weight: 600;
  background-color: #fef3c7;
  color: #854d00;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}
.header-right {
  display: flex;
  align-items: center;
}
.tenant-selector-wrapper {
  position: relative;
  display: inline-block;
}
.tenant-trigger-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  color: #0f172a;
}
.tenant-trigger-btn:hover {
  background: #f1f5f9;
}
.tenant-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 300px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
  display: block;
  z-index: 100;
}
.tenant-dropdown[hidden] {
  display: none !important;
}
.tenant-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
}
.tenant-item:hover {
  background: #f8fafc;
}
.tenant-item.active {
  background: #eff6ff;
  border-left: 3px solid #2563eb;
}
.tenant-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tenant-name {
  font-weight: 600;
  font-size: 0.875rem;
}
.tenant-role-badge {
  font-size: 0.6875rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: #ffffff;
  text-transform: uppercase;
  font-weight: 700;
}
.app-layout {
  display: flex;
  min-height: calc(100vh - 58px);
}
.sidebar {
  width: 240px;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  padding: 1.25rem 0.75rem;
  flex-shrink: 0;
}
.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  font-size: 0.875rem;
  border-radius: 6px;
  cursor: pointer;
  color: #475569;
}
.nav-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.nav-item.active {
  background: #e2e8f0;
  color: #1e3a8a;
  font-weight: 600;
}
.app-viewport {
  flex: 1;
  padding: 2rem;
  max-width: 900px;
}
.context-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.card-header h2 {
  font-size: 1.125rem;
  color: #0369a1;
}
.actions-row {
  display: flex;
  gap: 0.5rem;
}
.btn-primary {
  background: #2563eb;
  color: #ffffff;
  border: none;
  padding: 0.45rem 0.8rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover {
  background: #1d4ed8;
}
.btn-secondary {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 0.45rem 0.8rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondary:hover {
  background: #e2e8f0;
}
.permissions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.status-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.25rem;
}
.status-box h3 {
  font-size: 0.8125rem;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.5rem;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal-overlay.show {
  display: flex;
}
.modal-dialog {
  background: #ffffff;
  width: 100%;
  max-width: 480px;
  border-radius: 10px;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  overflow: hidden;
  animation: modalFadeIn 0.2s ease-out;
}
@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
}
.modal-close-x {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
}
.modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.form-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
}
.form-control {
  padding: 0.5rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.875rem;
  color: #0f172a;
  outline: none;
  background: #ffffff;
}
.form-control:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.form-row {
  display: flex;
  gap: 0.75rem;
}
.col-half {
  flex: 1;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f5f9;
}
