:root {
  color-scheme: light;
  font-family: "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at top, rgba(71, 133, 255, 0.16), transparent 32%),
    linear-gradient(180deg, #f4f7fb 0%, #eef3f8 100%);
  color: #132238;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  min-height: 100vh;
  padding: 24px;
}

.login-shell {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(19, 34, 56, 0.08);
  border-radius: 24px;
  box-shadow: 0 18px 40px rgba(26, 44, 77, 0.12);
}

.login-card {
  width: min(100%, 440px);
  padding: 32px;
}

.login-card h1,
.panel h2,
.panel h3 {
  margin: 0;
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(49, 99, 235, 0.1);
  color: #2447b5;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.muted {
  color: #5f6f86;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 14px;
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cfd7e6;
  border-radius: 12px;
  background: #fff;
  color: #132238;
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(49, 99, 235, 0.2);
  border-color: #3163eb;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.button {
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
}

.button-primary {
  background: #1d4ed8;
  color: #fff;
}

.button-primary:hover {
  background: #1a45bf;
}

.button-secondary {
  background: #e6ecf7;
  color: #22334d;
}

.button-secondary:hover {
  background: #d7e2f3;
}

.button-danger {
  background: #fee2e2;
  color: #b91c1c;
}

.button-danger:hover {
  background: #fecaca;
}

.button-ghost {
  background: transparent;
  color: #4b5f7b;
  border: 1px solid #d6deeb;
}

.button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.topbar h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 5vw, 38px);
}

.topbar-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.context-banner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  margin-bottom: 20px;
}

.context-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.nav-chip {
  border: 1px solid #d6deeb;
  background: rgba(255, 255, 255, 0.72);
  color: #48607d;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
}

.nav-chip-active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(19, 34, 56, 0.06);
  color: #2b3f5f;
  font-size: 14px;
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(320px, 1fr);
  gap: 20px;
}

.projects-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(360px, 1fr);
  gap: 20px;
}

.panel {
  padding: 20px;
}

.table-card {
  width: 100%;
}

.panel-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.panel-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.summary-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(19, 34, 56, 0.06);
}

.summary-card strong {
  display: block;
  font-size: 28px;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(180px, 0.8fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.filter-field {
  margin: 0;
}

.search-field input,
.role-field select {
  width: 100%;
}

.filter-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.toggle-chip-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.project-filter-card {
  margin-bottom: 28px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 15, 26, 0.48);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 30;
}

.modal {
  width: min(100%, 560px);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 24px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.membership-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.membership-editor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: rgba(246, 248, 251, 0.72);
}

.membership-toggle {
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
}

.membership-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 auto;
}

.membership-toggle span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.membership-toggle strong {
  line-height: 1.2;
}

.membership-role-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cfd7e6;
  border-radius: 10px;
  background: #fff;
  min-height: 38px;
}

.assignment-form {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(180px, 0.8fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.assignment-actions {
  display: flex;
}

.table-wrap {
  overflow: auto;
  border: 1px solid #e0e6f0;
  border-radius: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid #edf1f7;
  vertical-align: middle;
}

th:nth-last-child(2),
td:nth-last-child(2) {
  white-space: nowrap;
  min-width: 140px;
}

th:last-child,
td:last-child {
  white-space: nowrap;
  min-width: 190px;
}

th {
  font-size: 13px;
  color: #63758e;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr:hover {
  background: rgba(49, 99, 235, 0.04);
}

.row-selected {
  background: rgba(29, 78, 216, 0.08);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.role-admin {
  background: rgba(185, 28, 28, 0.1);
  color: #b91c1c;
}

.role-operator {
  background: rgba(3, 105, 161, 0.1);
  color: #0369a1;
}

.role-owner {
  background: rgba(168, 85, 247, 0.12);
  color: #7e22ce;
}

.role-viewer {
  background: rgba(71, 85, 105, 0.12);
  color: #334155;
}

.status-active {
  background: rgba(22, 101, 52, 0.12);
  color: #166534;
}

.status-archived {
  background: rgba(107, 114, 128, 0.12);
  color: #4b5563;
}

.table-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.table-actions .button {
  flex: 0 0 auto;
}

.member-role-select {
  width: 100%;
  min-width: 140px;
  padding: 10px 12px;
  border: 1px solid #cfd7e6;
  border-radius: 10px;
  background: #fff;
}

.empty-card {
  padding: 16px;
  margin-bottom: 16px;
  border: 1px dashed #d5deeb;
  border-radius: 14px;
  color: #64748b;
  background: rgba(246, 248, 251, 0.85);
}

.members-table-wrap {
  margin-top: 4px;
}

.membership-pill-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.membership-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(49, 99, 235, 0.08);
  color: #28446f;
  font-size: 12px;
  font-weight: 700;
}

.membership-pill-active {
  background: rgba(29, 78, 216, 0.16);
  color: #1d4ed8;
}

.notice {
  min-height: 24px;
  font-size: 14px;
}

.notice-error {
  color: #b91c1c;
}

.notice-success {
  color: #166534;
}

.empty {
  padding: 28px;
  text-align: center;
  color: #66788f;
}

.readonly {
  padding: 12px 14px;
  border-radius: 12px;
  background: #f6f8fb;
  border: 1px solid #dbe3ef;
  color: #42566f;
}

@media (max-width: 960px) {
  .shell {
    padding: 16px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

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

  .summary {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    grid-template-columns: 1fr;
  }

  .assignment-form {
    grid-template-columns: 1fr;
  }

  .membership-editor-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }
}
