@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --background: #f5f5f7;
  --foreground: #1d1d1f;
  --surface: #ffffff;
  --surface-hover: #f5f5f7;
  --surface-active: #ebebef;
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.14);
  --primary: #15364c;
  --primary-hover: #1a4460;
  --primary-active: #0f2a3c;
  --primary-foreground: #ffffff;
  --locus-deep-blue: #15364c;
  --locus-light-blue: #c4e8ed;
  --locus-accent: #f15942;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #007aff;
  --sidebar-width: 240px;
  --header-height: 60px;
  --radius-pill: 9999px;
  --radius-lg: 12px;
  --control-height: 36px;
  --control-padding-x: 16px;
  --control-font-size: 0.875rem;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --transition-fast: 0.18s cubic-bezier(0.25, 0.1, 0.25, 1);
  --transition-press: 0.12s cubic-bezier(0.25, 0.1, 0.25, 1);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-control: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 1px rgba(0, 0, 0, 0.03);
  --shadow-control-hover: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --focus-ring: 0 0 0 4px rgba(0, 122, 255, 0.18);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.011em;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button:not(:disabled),
input:not(:disabled),
select:not(:disabled),
.app-nav-link:not(.is-disabled),
.db-th.is-sortable {
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-press);
}

button:not(:disabled):active,
.btn:not(:disabled):active {
  transform: none;
}

.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.app-sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.app-sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--locus-deep-blue);
  letter-spacing: -0.02em;
}

.app-sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  color: #64748b;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.app-nav-link:hover {
  background: var(--surface-hover);
  color: var(--foreground);
  border-color: var(--border);
}

.app-nav-link:active {
  background: var(--surface-active);
}

.app-nav-link.is-active {
  background: #e8f4f8;
  color: var(--locus-deep-blue);
  font-weight: 600;
  border-color: #bae6fd;
}

.app-nav-link.is-active:hover {
  background: #dff0f7;
}

.app-nav-link.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.app-sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.user-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: #334155;
  margin-bottom: 2px;
}

.user-meta {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-bottom: 12px;
}

.app-main {
  flex: 1;
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-main.admin-page {
  overflow-x: hidden;
  overflow-y: auto;
}

.app-content {
  padding: 24px 32px;
  max-width: 1600px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--locus-deep-blue);
}

.preview-banner {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  margin-bottom: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.card p {
  color: #64748b;
  font-size: 0.875rem;
  line-height: 1.5;
}

.placeholder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.placeholder-tile {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 20px;
  background: #f8fafc;
  min-height: 96px;
}

.placeholder-tile strong {
  display: block;
  font-size: 0.8125rem;
  color: var(--locus-deep-blue);
  margin-bottom: 6px;
}

.placeholder-tile span {
  font-size: 0.75rem;
  color: #94a3b8;
}

.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 calc(var(--control-padding-x) + 2px);
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: var(--control-font-size);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1;
  border: 0.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  -webkit-font-smoothing: antialiased;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.btn:focus-visible {
  outline: none;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.btn:disabled::before,
.btn[disabled]::before {
  opacity: 0;
}

.btn-primary {
  color: var(--primary-foreground);
  background: var(--locus-deep-blue);
  border-color: transparent;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 1px 1px rgba(0, 0, 0, 0.06);
}

.btn-primary::before {
  display: none;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 2px 6px rgba(0, 0, 0, 0.1);
}

.btn-primary:active:not(:disabled) {
  background: var(--primary-active);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18);
}

.btn-primary:focus-visible {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    var(--focus-ring),
    0 1px 1px rgba(0, 0, 0, 0.06);
}

.btn-secondary {
  color: #1d1d1f;
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: var(--shadow-control);
}

.btn-secondary::before {
  display: none;
}

.btn-secondary:hover:not(:disabled) {
  background: #fafafa;
  border-color: rgba(0, 0, 0, 0.14);
  box-shadow: var(--shadow-control-hover);
}

.btn-secondary:active:not(:disabled) {
  background: var(--surface-active);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.btn-secondary:focus-visible {
  box-shadow: var(--focus-ring), var(--shadow-control);
}

.input,
select.input,
textarea.input {
  display: inline-flex;
  align-items: center;
  width: auto;
  max-width: 100%;
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 var(--control-padding-x);
  border: 0.5px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.92);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: var(--control-font-size);
  font-weight: 400;
  letter-spacing: -0.011em;
  line-height: 1.2;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.input:hover:not(:disabled),
select.input:hover:not(:disabled),
textarea.input:hover:not(:disabled) {
  border-color: rgba(0, 0, 0, 0.18);
  background-color: #ffffff;
}

.input:focus,
select.input:focus,
textarea.input:focus {
  outline: none;
  border-color: rgba(0, 122, 255, 0.55);
  background-color: #ffffff;
  box-shadow: var(--focus-ring);
}

.input:active:not(:disabled),
select.input:active:not(:disabled) {
  background-color: #ffffff;
  border-color: rgba(0, 122, 255, 0.45);
}

.input:disabled,
select.input:disabled,
textarea.input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: rgba(245, 245, 247, 0.9);
}

select.input {
  appearance: none;
  padding-right: 38px;
  background-color: rgba(255, 255, 255, 0.92);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  cursor: pointer;
}

select.input:hover:not(:disabled) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231d1d1f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

.input-search {
  min-width: 240px;
}

.toolbar .input,
.toolbar select.input {
  flex: 0 1 auto;
}

.table-shell {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: white;
  overflow: hidden;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.db-page-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  padding-bottom: 0;
}

.db-page-table-root {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.table-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.db-table-container {
  height: 100%;
}

.db-table-scroll {
  flex: 1;
  overflow: auto;
  min-height: 0;
  position: relative;
}

.db-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

.db-th {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: #64748b;
  font-weight: 500;
  background: #f8fafc;
  white-space: nowrap;
  vertical-align: bottom;
}

.db-table thead {
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.db-th-title {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #334155;
}

.db-th-sub {
  font-size: 0.65rem;
  color: #94a3b8;
  font-weight: 400;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

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

.db-page-subtitle {
  color: #64748b;
  font-size: 0.875rem;
  margin-top: 4px;
}

.db-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.db-toolbar-filters {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  align-items: center;
  /* Own full-width row so search + all three dropdowns stay on one line;
     action buttons wrap to the row below. */
  flex: 1 1 100%;
}

.db-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
}

.db-action-btn {
  white-space: nowrap;
}

.db-search-wrap {
  position: relative;
  flex: 0 1 250px;
  min-width: 150px;
  max-width: 100%;
}

.db-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.db-search-input {
  width: 100%;
  padding-left: 36px !important;
}

.db-filter-select {
  width: auto;
}

.db-action-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  font-size: 0.875rem;
}

.db-action-banner-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.db-action-banner-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
}

.db-action-banner-success {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
}

.db-action-banner-warning {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
}

.db-action-banner-close {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
  padding: 4px;
}

.db-action-banner-close:hover {
  opacity: 1;
}

/* Shared modals */
.app-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.app-modal-panel {
  position: relative;
  z-index: 1;
  width: 520px;
  max-width: 95vw;
  max-height: 90vh;
  overflow: auto;
  padding: 0;
}

.app-modal-panel-wide {
  width: 640px;
}

.app-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.app-modal-header h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.app-modal-header p {
  margin: 4px 0 0;
  font-size: 0.875rem;
  color: #64748b;
}

.app-modal-body {
  padding: 20px 24px;
}

.app-modal-copy {
  color: #475569;
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: 12px;
}

.app-modal-list {
  margin: 0 0 16px 1.1rem;
  color: #64748b;
  font-size: 0.875rem;
  line-height: 1.6;
}

.app-modal-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 4px;
  color: #475569;
  font-size: 0.8125rem;
  line-height: 1.5;
  cursor: pointer;
}

.app-modal-check input {
  margin-top: 2px;
  flex-shrink: 0;
}

.app-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.app-file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 28px 20px;
  border: 1px dashed rgba(0, 0, 0, 0.14);
  border-radius: var(--radius-lg);
  background: #fafafa;
  cursor: pointer;
  text-align: center;
}

.app-file-drop:hover {
  background: #f5f5f7;
  border-color: rgba(0, 0, 0, 0.22);
}

.app-file-drop-icon {
  color: #64748b;
}

.app-file-drop-title {
  font-weight: 600;
  color: #1d1d1f;
}

.app-file-drop-sub {
  font-size: 0.8125rem;
  color: #64748b;
}

.app-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.app-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.app-form-field-span-2 {
  grid-column: span 2;
}

.app-form-field span {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #475569;
}

.app-form-field .input {
  width: 100%;
}

.app-form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: #475569;
}

/* Admin pill tabs */
.admin-page-header {
  margin-bottom: 20px;
}

.admin-tab-shell {
  display: flex;
  flex-direction: column;
}

.admin-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 16px 20px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.admin-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: #6b7280;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast);
}

.admin-tab:hover {
  color: #374151;
  background: rgba(0, 0, 0, 0.04);
}

.admin-tab.is-active {
  background: var(--locus-deep-blue);
  color: #fff;
  font-weight: 600;
}

.admin-tab.is-active:hover {
  background: var(--primary-hover);
  color: #fff;
}

.admin-tab-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  min-height: 360px;
  padding: 28px 24px;
}

.admin-tab-panel .table-container {
  flex: none;
  min-height: auto;
}

.admin-card-subtitle + .admin-inline-actions,
.admin-card-subtitle + .admin-form-panel,
.admin-card-subtitle + .admin-stat-grid,
.admin-card-subtitle + .table-container,
.admin-card-subtitle + #ipeds-bulk-banner,
.admin-card-header + .table-container,
.admin-card-header + #membership-diagnostics-panel,
.admin-card-header + .table-container,
#membership-diagnostics-panel[hidden] + .table-container,
#membership-diagnostics-panel:not([hidden]) + .table-container {
  margin-top: 16px;
}

.admin-tab-empty h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--locus-deep-blue);
}

.admin-tab-empty p {
  color: #64748b;
  font-size: 0.875rem;
  line-height: 1.6;
  max-width: 640px;
}

.db-th.is-sortable {
  cursor: pointer;
}

.db-th.is-sortable:hover {
  background: #eef4f8;
}

.db-th.is-sortable:active {
  background: #e2edf3;
}

.db-th-actions {
  padding-left: 16px;
}

.sticky-col-1 {
  position: sticky;
  left: 0;
  z-index: 30;
  background: #f8fafc;
  box-shadow: inset 0 -1px 0 var(--border);
}

.sticky-col-2 {
  position: sticky;
  left: 152px;
  z-index: 30;
  background: #f8fafc;
  box-shadow: inset -1px -1px 0 var(--border);
}

.sticky-col-right {
  position: sticky;
  right: 0;
  z-index: 30;
  background: #f8fafc;
  box-shadow: inset 1px 0 0 var(--border);
}

td.sticky-col-1,
td.sticky-col-2,
td.sticky-col-right {
  background: #fff;
  z-index: 5;
}

.sort-icon {
  display: inline-flex;
  align-items: center;
  color: #94a3b8;
  margin-left: 2px;
}

.sort-icon.active {
  color: #2563eb;
}

.db-empty-cell {
  text-align: center;
  padding: 64px 24px;
  color: #64748b;
}

.db-empty-message h3 {
  font-size: 1rem;
  color: #334155;
  margin-bottom: 8px;
}

.db-empty-message p {
  font-size: 0.875rem;
  line-height: 1.5;
}

.db-table-footer {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: #fff;
  flex-shrink: 0;
}

.db-table-footer-left,
.db-table-footer-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.db-footer-text {
  font-size: 0.875rem;
  color: #64748b;
}

.db-th.is-sortable:hover .db-th-title,
.db-th.is-sorted .db-th-title {
  color: var(--locus-deep-blue);
}

.db-download-btn,
.db-page-btn {
  /* inherit standard pill control sizing from .btn */
}

.db-page-size-select {
  width: auto;
  min-width: 72px;
}

.db-page-size-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: #64748b;
}

.db-pagination-buttons {
  display: flex;
  gap: 8px;
}

.download-modal-close {
  background: transparent;
  border: 1px solid transparent;
  color: #64748b;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  width: 36px;
  height: 36px;
  min-height: 36px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: none;
}

.download-modal-close::before {
  display: none;
}

.download-modal-close:hover {
  background: var(--surface-hover);
  border-color: var(--border);
  color: #334155;
}

.download-modal-close:active {
  background: var(--surface-active);
}


.download-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.download-modal[hidden] {
  display: none;
}

.download-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.download-modal-panel {
  position: relative;
  width: 480px;
  max-width: 95vw;
  padding: 0;
  z-index: 1;
}

.download-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.download-modal-header h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.download-modal-header p {
  margin: 4px 0 0;
  font-size: 0.875rem;
  color: #64748b;
}

.download-modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.download-option {
  justify-content: flex-start;
  width: 100%;
}

.download-modal-note {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.5;
}

.table-empty {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: white;
  overflow: hidden;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-empty {
  text-align: center;
  padding: 48px 24px;
  color: #64748b;
}

.table-empty h3 {
  font-size: 1rem;
  color: #334155;
  margin-bottom: 8px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-preview {
  background: #e0f2fe;
  color: #0369a1;
}

/* Database table cells */
.db-td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: middle;
  background: #fff;
}

.db-cell-missing-sync {
  background: #fee2e2 !important;
}

.db-cell-institution {
  font-weight: 500;
}

.db-cell-ipeds,
.db-link-ipeds {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.db-link-ipeds {
  color: #2563eb;
  font-weight: 500;
  text-decoration: underline;
}

.db-link-ipeds:hover {
  color: #1d4ed8;
}

.db-btn-institution {
  background: none;
  border: none;
  padding: 0;
  color: var(--locus-deep-blue);
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  font-size: inherit;
  font-family: inherit;
}

.db-public-private-cell {
  display: flex;
  flex-direction: column;
}

.db-public-private-affiliation {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 2px;
  line-height: 1.2;
}

.db-cell-change-bold {
  font-weight: 600;
}

.db-cell-change-positive {
  color: var(--success);
}

.db-cell-change-negative {
  color: var(--danger);
}

.db-cell-change-zero {
  color: var(--info);
}

.db-td.sticky-col-1,
.db-td.sticky-col-2,
.db-td.sticky-col-right {
  z-index: 5;
}

.db-td.sticky-col-1 {
  box-shadow: inset 0 -1px 0 var(--border);
}

.db-td.sticky-col-2 {
  box-shadow: inset -1px -1px 0 var(--border);
}

.db-td.sticky-col-right {
  box-shadow: inset 1px 0 0 var(--border);
}

.db-row-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.db-row-action-btn {
  padding: 2px 8px !important;
  font-size: 0.75rem !important;
  height: auto !important;
  min-height: 28px !important;
}

.db-row-menu-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.db-row-menu-btn:hover {
  background: var(--surface-hover);
  color: #334155;
}

.row-action-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
}

.row-action-menu {
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  min-width: 180px;
  padding: 4px;
  display: flex;
  flex-direction: column;
}

.row-action-menu-item {
  padding: 8px 12px;
  font-size: 0.75rem;
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #0f172a;
  width: 100%;
  border-radius: 4px;
}

.row-action-menu-item:hover {
  background: var(--surface-hover);
}

.row-action-menu-item-accent {
  color: #4338ca;
}

.row-action-menu-item-purple {
  color: #6d28d9;
}

.row-action-menu-item-warn {
  color: #b45309;
}

.row-action-menu-item-danger,
.row-action-menu-item-delete {
  color: #ef4444;
}

.row-action-menu-divider {
  padding: 8px 12px 4px;
  font-size: 0.65rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-top: 1px solid #f1f5f9;
  margin-top: 4px;
}

.row-action-menu-item-delete {
  border-top: 1px solid #f1f5f9;
  margin-top: 4px;
  padding-top: 8px;
}

/* Admin tab content */
.admin-tab-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.admin-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.admin-card-subtitle {
  color: #64748b;
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 0;
}

.admin-card-header {
  margin-bottom: 16px;
}

.admin-card-header-split {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-card-accent-purple {
  border-left: 4px solid #8b5cf6;
}

.admin-card-accent-blue {
  border-left: 4px solid #3b82f6;
}

.admin-card-accent-green {
  border-left: 4px solid #10b981;
}

.admin-stat-grid {
  display: grid;
  gap: 16px;
}

.admin-stat-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-stat-grid-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

@media (max-width: 960px) {
  .admin-stat-grid-4,
  .admin-stat-grid-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.admin-stat-box {
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
  text-align: center;
}

.admin-stat-value {
  font-size: 1.5rem;
  font-weight: 600;
}

.admin-stat-text {
  font-size: 1rem !important;
  margin-top: 6px;
}

.admin-stat-label {
  font-size: 0.875rem;
  color: #64748b;
  margin-top: 4px;
}

.admin-stat-blue { color: #3b82f6; }
.admin-stat-green { color: #10b981; }
.admin-stat-purple { color: #8b5cf6; }
.admin-stat-orange { color: #f59e0b; }
.admin-stat-red { color: #ef4444; }

.admin-inline-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.admin-form-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f8fafc;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.admin-form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.admin-select-medium {
  width: 100%;
  max-width: 400px;
}

.admin-inner-card {
  box-shadow: none;
  border: 1px solid #e2e8f0;
}

.admin-inner-title,
.admin-inner-title-plain {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 8px;
  color: #0f172a;
}

.admin-title-with-icon {
  margin-bottom: 8px;
}

.admin-inner-copy {
  margin: 0 0 16px;
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.6;
}

.admin-divider-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

.admin-subsection-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.admin-subsection-copy {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 8px;
}

.admin-mini-btn {
  padding: 4px 8px !important;
  font-size: 0.75rem !important;
  height: auto !important;
  min-height: 28px !important;
}

.admin-mini-primary {
  padding: 6px 12px !important;
  font-size: 0.875rem !important;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.admin-table thead {
  background: #f8fafc;
}

.admin-table th,
.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.admin-th-center { text-align: center !important; }
.admin-th-right { text-align: right !important; }

.admin-cell-strong { font-weight: 500; }
.admin-cell-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
  color: #64748b;
}

.admin-empty-cell {
  text-align: center;
  padding: 24px;
  color: #64748b;
}

.admin-empty-dashed,
.admin-empty-soft {
  padding: 24px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px dashed #cbd5e1;
  text-align: center;
  color: #64748b;
  font-size: 0.875rem;
}

.admin-empty-soft {
  border-style: solid;
  border-color: #e2e8f0;
  padding: 16px;
}

.admin-muted { color: #64748b; }
.admin-small { font-size: 0.75rem; }

.admin-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.admin-icon-btn.is-active { color: #10b981; }
.admin-icon-btn-danger { color: #ef4444; }

.admin-active-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #8b5cf6;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 8px;
  background: #ede9fe;
  border-radius: 12px;
}

.admin-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: #475569;
  cursor: pointer;
}

.admin-progress-panel,
.admin-diagnostics-panel,
.admin-banner-panel,
.admin-live-panel {
  margin-top: 16px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.admin-progress-header,
.admin-banner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.admin-progress-bar {
  width: 100%;
  background: #e2e8f0;
  border-radius: 4px;
  height: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}

.admin-progress-bar > div {
  height: 100%;
  background: #6366f1;
  transition: width 0.3s ease;
}

.admin-progress-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.875rem;
}

.admin-error-panel {
  margin-top: 12px;
  padding: 12px;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #991b1b;
  font-size: 0.75rem;
}

.admin-diagnostics-panel h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.admin-diag-label {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.admin-diag-density { margin-top: 16px; }
.admin-diag-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.875rem;
}

.admin-diag-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.admin-diagnostics-error { color: #dc2626; }

.admin-pool-section { margin-bottom: 32px; }
.admin-pool-section:last-child { margin-bottom: 0; }

.admin-pool-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.admin-pool-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.admin-pool-count {
  color: #64748b;
  font-size: 0.875rem;
  font-weight: 400;
}

.admin-dropdown-wrap { position: relative; }

.admin-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: var(--shadow-control-hover);
  min-width: 160px;
  overflow: hidden;
}

.admin-dropdown-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  background: transparent;
  border: none;
  font-size: 0.75rem;
  cursor: pointer;
}

.admin-dropdown-menu button:hover { background: #f8fafc; }

.admin-rule-badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.admin-rule-badge-alias {
  background: #dcfce7;
  color: #166534;
}

.admin-rule-badge-exclude {
  background: #fee2e2;
  color: #991b1b;
}

.admin-review-exceptions-btn {
  background: #fef2f2 !important;
  color: #ef4444 !important;
  border-color: #fecaca !important;
}

.admin-live-panel.is-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.admin-live-panel.is-warning {
  background: #fffbeb;
  border-color: #fcd34d;
}

.admin-live-grid {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}

.admin-warning-copy {
  margin-top: 12px;
  color: #b45309;
  font-weight: 500;
  font-size: 0.875rem;
}

.admin-success-copy {
  margin-top: 12px;
  color: #16a34a;
  font-weight: 500;
  font-size: 0.875rem;
}

.badge-verified {
  background: #dcfce7;
  color: #166534;
}

.badge-suggested {
  background: #fef3c7;
  color: #92400e;
}

.badge-unmatched {
  background: #fee2e2;
  color: #991b1b;
}

.admin-bulk-modal .admin-bulk-panel {
  width: min(1200px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
}

.admin-bulk-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.admin-bulk-header h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
}

.admin-bulk-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.admin-bulk-confirm-btn {
  background: #10b981 !important;
  border-color: #059669 !important;
}

.admin-bulk-filters {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.admin-bulk-content {
  overflow-y: auto;
  flex: 1;
  padding-top: 16px;
  background: #f1f5f9;
  margin: 0 -24px -24px;
  padding: 24px;
  border-radius: 0 0 12px 12px;
}

.admin-bulk-empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}

.admin-bulk-group {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
}

.admin-bulk-group-header {
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-bulk-candidates {
  display: flex;
  flex-direction: column;
}

.admin-bulk-candidate {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.admin-bulk-candidate:last-child {
  border-bottom: none;
}

.admin-bulk-candidate-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* Users & Access tab */
.admin-form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-form-field > label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #334155;
}
.admin-field-hint {
  font-size: 0.75rem;
  color: #64748b;
  margin: 4px 0 0;
}
.admin-form-note {
  padding: 12px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  font-size: 0.75rem;
  color: #3730a3;
}
.admin-form-alert {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 0.8125rem;
}
.admin-form-alert.is-success {
  background: #dcfce7;
  color: #166534;
}
.admin-form-alert.is-error {
  background: #fef2f2;
  color: #b91c1c;
}
.admin-inline-actions-tight {
  gap: 8px;
}

/* Institution Drawer (View/Edit) */
.app-drawer { position: fixed; inset: 0; z-index: 100; }
.app-drawer-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.45); }
.app-drawer-panel {
  position: absolute; top: 0; right: 0; height: 100%; width: 600px; max-width: 100%;
  background: #fff; box-shadow: -8px 0 24px rgba(15, 23, 42, 0.18);
  display: flex; flex-direction: column; animation: drawer-in 0.18s ease-out;
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0.6; } to { transform: translateX(0); opacity: 1; } }
.app-drawer-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 24px; border-bottom: 1px solid #e2e8f0; }
.app-drawer-title { font-size: 1.15rem; font-weight: 600; margin: 0 0 6px; }
.app-drawer-subtitle { font-size: 0.8rem; }
.app-drawer-ipeds { font-size: 0.8rem; color: #64748b; margin-top: 6px; }
.app-drawer-ipeds a { color: #2563eb; text-decoration: none; }
.app-drawer-ipeds a:hover { text-decoration: underline; }
.app-drawer-body { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 28px; }
.app-drawer-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; border-top: 1px solid #e2e8f0; background: #f8fafc; }
.app-drawer-footer-actions { display: flex; gap: 12px; }
.app-drawer-id { font-size: 0.72rem; color: #94a3b8; }
.drawer-section-title { font-size: 0.95rem; font-weight: 600; margin: 0 0 12px; color: #334155; }
.drawer-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.drawer-section-head .drawer-section-title { margin: 0; }
.drawer-match-btn { padding: 4px 12px; font-size: 0.8rem; }
.drawer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.drawer-field { display: flex; flex-direction: column; gap: 4px; }
.drawer-field > span { font-size: 0.78rem; font-weight: 500; color: #475569; }
.input-readonly { background: #f1f5f9; color: #64748b; cursor: not-allowed; }
.drawer-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.drawer-table th, .drawer-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #e2e8f0; }
.drawer-tag { font-size: 0.7rem; color: #2563eb; font-weight: 600; }
.drawer-calc { font-size: 0.8rem; color: #64748b; margin-top: 8px; }
.drawer-hint { font-size: 0.72rem; color: #94a3b8; margin-top: 8px; }
.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: transparent; border-color: transparent; color: #64748b; box-shadow: none; }
.btn-ghost:hover { background: #f1f5f9; color: #334155; }

/* Login page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: #f1f5f9; }
.login-card { width: 100%; max-width: 400px; padding: 32px; }
.login-brand { margin-bottom: 20px; }
.login-title { font-size: 1.4rem; font-weight: 600; margin: 0 0 4px; }
.login-subtitle { color: #64748b; font-size: 0.875rem; margin: 0 0 20px; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: #94a3b8; font-size: 0.78rem; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: #e2e8f0; }
.login-oauth { display: flex; flex-direction: column; gap: 10px; }
.login-oauth-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; }
.app-signout-link { display: inline-block; margin-top: 8px; color: #ef4444; font-size: 0.8rem; text-decoration: none; }
.app-signout-link:hover { text-decoration: underline; }
.sidebar-security-actions {
  border-top: 1px solid #e2e8f0;
  margin-top: 12px;
  padding-top: 12px;
  display: grid;
  gap: 8px;
}
.sidebar-security-actions button {
  text-align: left;
  color: #334155;
  font-weight: 600;
  font-size: 0.875rem;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
}
.sidebar-security-actions button:hover { color: var(--primary); }

/* Admin security dashboard */
.security-table-wrap { overflow-x: auto; }
.security-table tbody + tbody { border-top: 1px solid #e2e8f0; }
.security-row-expanded { background: #fff7f7; }
.security-details-cell {
  padding: 0 !important;
  background: #eef3f8;
}
.security-details-grid {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.security-details-wide {
  padding: 0 20px 20px;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
}
.security-panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
}
.security-panel h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 14px;
  color: #263832;
}
.security-kv {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  font-size: 0.875rem;
}
.security-kv strong { color: #64748b; }
.security-kv span { min-width: 0; word-break: break-word; }
.security-center-note {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-weight: 600;
  text-align: center;
}
.security-events {
  display: grid;
  gap: 10px;
}
.security-event {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 12px;
}
.security-event p {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 0.875rem;
}
.audit-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 24px;
}
.map-grant-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 24px;
}
.map-grant-toggle {
  display: grid;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #334155;
}
.map-grant-toggle input {
  width: 44px;
  height: 24px;
  accent-color: var(--primary);
}
.account-security-modal .app-modal-panel {
  width: min(720px, 96vw);
  max-height: 88vh;
  overflow: auto;
}
.account-security-body { display: grid; gap: 18px; }
.account-security-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.account-security-head h3,
.account-session h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: #0f172a;
}
.account-security-head p {
  color: #64748b;
  line-height: 1.5;
  margin: 0;
}
.account-security-actions {
  display: flex;
  justify-content: flex-end;
}
.account-session-count {
  font-weight: 600;
  color: #475569;
  margin: 12px 0 20px;
}
.account-session-list {
  display: grid;
  gap: 18px;
}
.account-session {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 18px;
}
.account-session p {
  color: #64748b;
  margin: 10px 0 0;
}
@media (max-width: 1100px) {
  .security-details-grid,
  .security-details-wide,
  .audit-filters,
  .map-grant-form {
    grid-template-columns: 1fr;
  }
}

/* ---- Small button ---- */
.btn-sm { padding: 5px 10px; font-size: 0.8125rem; gap: 6px; }

/* ---- Maps Explorer ---- */
.maps-explorer { display: flex; flex-direction: column; height: 100%; min-height: 0; padding: 20px 24px; gap: 14px; }
.maps-header { flex-shrink: 0; }
.maps-body { flex: 1 1 0; min-height: 0; display: flex; gap: 16px; }
.maps-sidebar { width: 380px; flex-shrink: 0; display: flex; flex-direction: column; min-height: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.maps-controls { flex: 0 1 auto; max-height: 52%; min-height: 0; overflow-y: auto; padding: 16px; border-bottom: 1px solid var(--border); }
.maps-found { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: #f8fafc; }
.maps-found-head { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; font-weight: 600; font-size: 0.875rem; background: #fff; border-bottom: 1px solid var(--border); }
.maps-found-list { flex: 1 1 0; min-height: 0; overflow-y: auto; }

.maps-section { margin-bottom: 18px; }
.maps-section-head { display: flex; align-items: center; justify-content: space-between; }
.maps-section h3 { font-size: 0.95rem; font-weight: 600; margin: 0 0 8px; }
.maps-help { color: #64748b; font-size: 0.8rem; margin: 6px 0 10px; }
.maps-link-btn { background: none; border: none; color: #2563eb; font-size: 0.78rem; cursor: pointer; padding: 0; }
.maps-link-btn:hover { text-decoration: underline; }
.maps-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 0.8rem; color: #475569; }
.maps-filter-group { margin-top: 12px; }
.maps-filter-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: #64748b; margin-bottom: 6px; }
.maps-check-list { max-height: 150px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 8px; background: #fff; }
.maps-check { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: #334155; padding: 3px 2px; cursor: pointer; }
.maps-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.maps-empty { color: #94a3b8; font-size: 0.8rem; margin: 4px 0; }

.maps-density-box { margin-top: 12px; border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: #f8fafc; }
.maps-density-box h4 { margin: 0 0 6px; font-size: 0.85rem; }
.maps-density-formula { font-size: 0.8rem; color: #334155; margin: 0 0 8px; }
.maps-density-note { font-size: 0.72rem; color: #94a3b8; margin: 0 0 8px; }
.maps-density-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.maps-density-col-head { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; margin-bottom: 4px; }
.maps-density-col-head.include { color: #15803d; }
.maps-density-col-head.exclude { color: #b91c1c; }
.maps-density-actions { display: flex; justify-content: flex-end; gap: 8px; }
.maps-ranking-panel { margin-top: 10px; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: #f8fafc; font-size: 0.76rem; color: #475569; display: flex; flex-direction: column; gap: 3px; }

.maps-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border: none; border-bottom: 1px solid var(--border); background: transparent; text-align: left; cursor: pointer; }
.maps-row:hover { background: #fff; }
.maps-row.is-selected { background: #eff6ff; }
.maps-row-main { min-width: 0; }
.maps-row-name { font-weight: 600; font-size: 0.85rem; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.maps-row-loc { font-size: 0.76rem; color: #64748b; margin: 2px 0 4px; }
.maps-row-metric { text-align: right; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; }
.maps-row-metric-label { font-size: 0.62rem; font-weight: 600; letter-spacing: 0.03em; color: #94a3b8; }
.maps-row-metric-value { font-size: 0.95rem; font-weight: 700; color: #0f172a; }
.maps-row-metric-sub { font-size: 0.68rem; color: #94a3b8; }

.maps-map-wrap { flex: 1 1 0; min-width: 0; position: relative; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.maps-map { position: absolute; inset: 0; width: 100%; height: 100%; background: #eef2f7; }
/* Google Maps injects its own DOM; the global `* { box-sizing: border-box }`
   reset mis-sizes tiles and renders a blank map. Restore content-box on the
   container AND all descendants. */
.maps-map, .maps-map * { box-sizing: content-box; }
.maps-map img { max-width: none; }
.maps-map-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; color: #64748b; font-size: 0.9rem; background: #f8fafc; z-index: 2; }
/* The `hidden` attribute must win over display:flex, or the overlay covers the map. */
.maps-map-msg[hidden] { display: none; }

/* ---- Admin: Data Definition ---- */
.dd-stack { display: flex; flex-direction: column; gap: 24px; }
.dd-card { padding: 24px; }
.dd-title { font-size: 1.1rem; font-weight: 600; margin: 0 0 4px; }
.dd-sub { color: #64748b; font-size: 0.85rem; margin: 0 0 16px; }
.dd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.dd-h3 { font-size: 0.95rem; font-weight: 600; margin: 0 0 10px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.dd-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 0.82rem; color: #475569; }
.dd-note { font-size: 0.82rem; color: #475569; margin: 0 0 6px; }
.dd-note code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 0.78rem; }
.dd-muted { color: #94a3b8; }
.dd-check-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 10px; background: #f8fafc; display: flex; flex-direction: column; gap: 6px; }
.dd-check { display: flex; align-items: flex-start; gap: 8px; font-size: 0.82rem; color: #334155; cursor: pointer; }
.dd-check-label { font-weight: 500; }
.dd-check-source { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.03em; color: #94a3b8; }
.dd-color-list { display: flex; flex-direction: column; gap: 8px; }
.dd-color-row { display: flex; align-items: center; gap: 10px; font-size: 0.82rem; color: #334155; }
.dd-empty { color: #94a3b8; font-size: 0.82rem; }
.dd-formula-box { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; background: #f8fafc; font-size: 0.85rem; color: #334155; margin-bottom: 16px; }
.dd-col-head { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; padding-bottom: 6px; border-bottom: 2px solid var(--border); margin-bottom: 8px; }
.dd-col-head.include { color: #15803d; border-bottom-color: #bbf7d0; }
.dd-col-head.exclude { color: #b91c1c; border-bottom-color: #fecaca; }
.dd-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 18px; }
.dd-status { font-size: 0.8rem; color: #64748b; }
.dd-status.is-ok { color: #15803d; }
.dd-status.is-err { color: #b91c1c; }
