:root {
  --bg: #f3efe7;
  --bg-strong: #17212b;
  --panel: rgba(255, 252, 246, 0.94);
  --panel-border: rgba(23, 33, 43, 0.08);
  --text: #17212b;
  --muted: #576474;
  --accent: #b65c2b;
  --accent-strong: #8d4218;
  --success: #2f6b48;
  --warning: #b57d19;
  --danger: #b23a30;
  --shadow: 0 24px 60px rgba(23, 33, 43, 0.1);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Aptos", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(182, 92, 43, 0.18), transparent 34%),
    radial-gradient(circle at top right, rgba(23, 33, 43, 0.08), transparent 30%),
    linear-gradient(180deg, #fcf8f2 0%, #f1ece3 100%);
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

code {
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(23, 33, 43, 0.06);
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.9em;
}

.hidden {
  display: none !important;
}

.shell {
  width: min(1600px, calc(100% - 48px));
  margin: 0 auto;
  padding: 36px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 28px;
  align-items: stretch;
}

.hero-copy,
.session-card,
.panel,
.subpanel,
.modal-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-copy {
  border-radius: var(--radius-xl);
  padding: 42px 44px;
}

.eyebrow,
.panel-kicker,
.session-label {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  color: var(--accent-strong);
}

.hero h1,
.panel h2,
.subpanel h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.hero h1 {
  font-size: clamp(2.4rem, 4vw, 4rem);
}

.hero-text,
.session-status,
.panel-note,
.form-note,
.toggle-copy,
.message {
  color: var(--muted);
  line-height: 1.6;
}

.hero-text {
  max-width: 44rem;
  margin: 16px 0 0;
  font-size: 1.12rem;
}

.session-card {
  border-radius: var(--radius-xl);
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.panel-header h2 {
  margin-bottom: 10px;
}

.session-head,
.panel-header,
.subpanel-header,
.panel-actions,
.form-actions,
.list-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.95fr) minmax(280px, 1.2fr);
  gap: 18px;
  align-items: stretch;
}

.session-head,
.panel-header,
.subpanel-header {
  justify-content: space-between;
}

.session-body {
  display: grid;
  gap: 14px;
}

.session-body strong {
  font-size: 1.12rem;
}

.layout {
  margin-top: 28px;
  display: grid;
  gap: 24px;
}

.panel {
  border-radius: var(--radius-xl);
  padding: 34px;
}

.auth-panel {
  max-width: 560px;
}

.subpanel {
  border-radius: var(--radius-lg);
  padding: 28px;
}

.subpanel-wide {
  margin-top: 24px;
}

.stack {
  display: grid;
  gap: 18px;
}

.field,
.toggle-field {
  display: grid;
  gap: 10px;
}

.field span,
.toggle-field span:first-child {
  font-size: 0.92rem;
  font-weight: 600;
}

.field input,
.field select,
.search-field input {
  width: 100%;
  border: 1px solid rgba(23, 33, 43, 0.14);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.field input:focus,
.field select:focus,
.search-field input:focus {
  outline: none;
  border-color: rgba(182, 92, 43, 0.55);
  box-shadow: 0 0 0 4px rgba(182, 92, 43, 0.12);
}

.toggle-field {
  padding: 16px 18px;
  border: 1px solid rgba(23, 33, 43, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: start;
  column-gap: 16px;
  row-gap: 6px;
}

.toggle-field input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
  margin: 1px 0 0;
  grid-column: 2;
  grid-row: 1 / span 2;
  justify-self: end;
}

.toggle-copy {
  font-size: 0.9rem;
  grid-column: 1;
  grid-row: 2;
  max-width: 30ch;
}

.toggle-field span:first-child {
  grid-column: 1;
  grid-row: 1;
}

.primary-button,
.secondary-button,
.ghost-button {
  border: none;
  border-radius: 999px;
  padding: 13px 20px;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.primary-button {
  color: #fffdf9;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 12px 28px rgba(182, 92, 43, 0.22);
}
#login-button {
  margin-bottom: 10px;
}

.secondary-button {
  color: var(--text);
  background: rgba(182, 92, 43, 0.12);
}

.ghost-button {
  color: var(--text);
  background: rgba(23, 33, 43, 0.06);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(23, 33, 43, 0.38);
  backdrop-filter: blur(8px);
}

.modal-dialog {
  width: min(760px, 100%);
  max-height: calc(100vh - 56px);
  overflow: auto;
}

.modal-panel {
  border-radius: var(--radius-xl);
  padding: 30px;
}

.modal-header,
.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.modal-header {
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-close-button {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 999px;
  font-size: 1.55rem;
  line-height: 1;
  color: var(--text);
  background: rgba(23, 33, 43, 0.08);
}

.modal-close-button:hover {
  background: rgba(182, 92, 43, 0.16);
}

.message {
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  border: 1px solid rgba(23, 33, 43, 0.08);
  background: rgba(23, 33, 43, 0.04);
}

.message.error {
  color: var(--danger);
  background: rgba(178, 58, 48, 0.08);
  border-color: rgba(178, 58, 48, 0.16);
}

.message.success {
  color: var(--success);
  background: rgba(47, 107, 72, 0.08);
  border-color: rgba(47, 107, 72, 0.16);
}

.panel-note,
.form-note {
  margin: 0;
  font-size: 0.94rem;
}

.pill,
.role-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.pill {
  color: var(--muted);
  background: rgba(23, 33, 43, 0.07);
}

.role-badge.admin {
  color: #fff;
  background: linear-gradient(135deg, #17212b 0%, #2f4254 100%);
}

.role-badge.moderator {
  color: #fff;
  background: linear-gradient(135deg, #b65c2b 0%, #d78342 100%);
}

.role-badge.neutral {
  color: var(--muted);
  background: rgba(23, 33, 43, 0.08);
}

.status-badge.active {
  color: var(--success);
  background: rgba(47, 107, 72, 0.1);
}

.status-badge.inactive {
  color: var(--danger);
  background: rgba(178, 58, 48, 0.1);
}

.status-badge.neutral {
  color: var(--muted);
  background: rgba(23, 33, 43, 0.08);
}

.view-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(23, 33, 43, 0.06);
}

.view-switch-button {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
}

.view-switch-button.is-active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 20px rgba(23, 33, 43, 0.08);
}

.table-wrap {
  margin-top: 18px;
  overflow: auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(23, 33, 43, 0.08);
}

.profiles-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1120px;
  background: rgba(255, 255, 255, 0.72);
}

.profiles-table thead {
  background: rgba(23, 33, 43, 0.06);
}

.profiles-table th {
  white-space: nowrap;
}

.profiles-table th,
.profiles-table td {
  padding: 18px 18px;
  text-align: left;
  border-bottom: 1px solid rgba(23, 33, 43, 0.08);
  vertical-align: middle;
}

.profiles-table tbody tr:hover {
  background: rgba(182, 92, 43, 0.05);
}

.profiles-table td.uid-cell {
  max-width: 220px;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.82rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.profiles-table td.actions-cell {
  width: 200px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.profiles-table td.meta-cell {
  white-space: nowrap;
}

.profiles-table td.type-cell {
  white-space: nowrap;
}

.row-button {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  color: var(--text);
  background: rgba(23, 33, 43, 0.07);
}

.row-button.danger {
  color: var(--danger);
  background: rgba(178, 58, 48, 0.1);
}

.row-button.is-disabled {
  cursor: default;
  opacity: 0.55;
}

.row-button:hover {
  background: rgba(182, 92, 43, 0.16);
}

.row-button.danger:hover {
  background: rgba(178, 58, 48, 0.18);
}

.row-button.is-disabled:hover {
  background: rgba(23, 33, 43, 0.07);
}

.sort-button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  border: none;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
}

.sort-button.is-active {
  color: var(--text);
}

.sort-indicator {
  min-width: 12px;
  text-align: center;
  color: var(--accent-strong);
}

.empty-row {
  text-align: center;
  color: var(--muted);
}

.search-field {
  flex: 1;
}

.toast-container {
  position: fixed;
  top: 26px;
  right: 26px;
  z-index: 1000;
  display: grid;
  gap: 12px;
}

.toast {
  min-width: 260px;
  max-width: 360px;
  border-radius: 18px;
  padding: 16px 18px;
  color: #fff;
  box-shadow: var(--shadow);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.toast.success {
  background: linear-gradient(135deg, #2f6b48 0%, #478a63 100%);
}

.toast.error {
  background: linear-gradient(135deg, #b23a30 0%, #d45449 100%);
}

.toast.warning {
  background: linear-gradient(135deg, #9f7425 0%, #c6922c 100%);
}

@media (max-width: 1040px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    max-width: none;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1280px);
    padding-top: 16px;
  }

  .hero-copy,
  .session-card,
  .panel,
  .subpanel,
  .modal-panel {
    padding: 20px;
  }

  .panel-header,
  .subpanel-header,
  .panel-actions,
  .form-actions,
  .list-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

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

  .toast-container {
    left: 10px;
    right: 10px;
    top: 10px;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .toast {
    max-width: none;
    min-width: 0;
  }
}
