:root {
  --brand: #001542;
  --brand-soft: #e8eef8;
  --accent: #fd5f03;
  --accent-soft: #fdede5;
  --navy-deep: #040e34;
  --canvas: #f7f8fa;
  --softblue: #f5f9ff;
  --border: #e5e5e5;
  --ink: #001542;
  --ink-muted: #646f83;
  --ink-subtle: #9aa3b5;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --white: #ffffff;
  --sidebar-width: 260px;
  --radius: 10px;
  --shadow: 0 8px 24px rgba(0, 21, 66, 0.06);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--canvas);
  line-height: 1.45;
}

a {
  color: var(--brand);
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--brand);
  color: var(--white);
  padding: 1.25rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.sidebar-brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.sidebar-brand-text strong {
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.sidebar-brand-text span {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.65);
}

.sidebar-user {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8125rem;
  margin: 0 0.5rem 1rem;
  flex-shrink: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 0.25rem;
  margin-bottom: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
  margin: 0.25rem 0;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(253, 95, 3, 0.65);
}

.sidebar-nav::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}


.nav-group {
  margin-bottom: 0.15rem;
}

.nav-group-toggle,
.nav-subgroup-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  text-align: left;
  font: inherit;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
}

.nav-group-toggle {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.nav-group-toggle:hover,
.nav-subgroup-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-subgroup-toggle {
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  padding: 0.4rem 0.65rem;
}

.nav-chevron {
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-group.is-open > .nav-group-toggle .nav-chevron,
.nav-subgroup.is-open > .nav-subgroup-toggle .nav-chevron {
  transform: rotate(45deg);
}

.nav-group-body,
.nav-subgroup-body {
  display: none;
  padding: 0.15rem 0 0.35rem;
}

.nav-group.is-open > .nav-group-body,
.nav-subgroup.is-open > .nav-subgroup-body {
  display: block;
}

.nav-subgroup {
  margin: 0.15rem 0 0.25rem;
  padding-left: 0.35rem;
}

.nav-subgroup-body {
  padding-left: 0.5rem;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  margin-left: 0.55rem;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.1rem;
  font-size: 0.875rem;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.sidebar nav a.active .nav-badge {
  background: rgba(255, 255, 255, 0.95);
  color: var(--accent);
}

.nav-subgroup-body a {
  padding-left: 0.65rem;
  font-size: 0.8125rem;
}

.sidebar nav a.active,
.sidebar nav a:hover {
  background: rgba(253, 95, 3, 0.18);
  color: #fff;
}

.sidebar nav a.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.logout-form {
  flex-shrink: 0;
  margin-top: 0;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--brand);
  position: relative;
  z-index: 1;
}

.logout-form .btn {
  box-shadow: none;
}

.content {
  flex: 1;
  padding: 1.75rem 2rem 2.5rem;
  min-width: 0;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-header h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--navy-deep);
}

.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
}

.btn:disabled,
.btn.is-loading {
  cursor: wait;
  opacity: 0.85;
  pointer-events: none;
}

.btn.is-loading::before {
  content: "";
  width: 0.85em;
  height: 0.85em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  flex-shrink: 0;
  animation: btn-spin 0.65s linear infinite;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--navy-deep);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
}

.btn-secondary,
.btn-ghost {
  background: var(--softblue);
  color: var(--brand);
  border-color: var(--border);
}

.btn-danger {
  background: #fef2f2;
  color: var(--danger);
  border-color: #fecaca;
}

.btn-block {
  width: 100%;
  border-radius: 10px;
}

.data-table {
  width: max(100%, 40rem);
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: visible;
  box-shadow: var(--shadow);
}

.data-table th,
.data-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.data-table th {
  background: var(--softblue);
  color: var(--ink-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: #fafbfd;
}

/*
 * Do NOT set display:flex on td.row-actions — that takes the cell out of the
 * table border model and misaligns horizontal row borders vs other columns.
 * Keep the td as table-cell; lay out controls as wrapping inline-flex children.
 */
td.row-actions {
  vertical-align: middle;
}

div.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

td.row-actions > a.btn,
td.row-actions > .btn,
td.row-actions > form {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  vertical-align: middle;
  margin: 0.15rem 0.5rem 0.15rem 0;
}

.row-actions-group {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem;
}

.row-actions-group > a.btn,
.row-actions-group > .btn,
.row-actions-group > form {
  display: inline-flex;
  margin: 0;
}

.row-actions-group form {
  flex-wrap: nowrap;
}

.row-actions a {
  font-weight: 600;
  text-decoration: none;
}

.row-actions form {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

body.admin-dialog-open,
body.slide-panel-open {
  overflow: hidden;
}

.slide-panel {
  position: fixed;
  inset: 0;
  z-index: 1100;
}

.slide-panel[hidden] {
  display: none !important;
}

.slide-panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 14, 52, 0.45);
}

.slide-panel-sheet {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(32rem, 100%);
  height: 100%;
  background: var(--canvas);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(0, 21, 66, 0.18);
}

.slide-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
  padding: 1.1rem 1.25rem;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}

.slide-panel-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy-deep);
  line-height: 1.3;
}

.slide-panel-body {
  flex: 1;
  overflow: auto;
  padding: 1rem 1.15rem 1.5rem;
}

.slide-panel-body .import-panel {
  box-shadow: none;
  margin-bottom: 1rem;
}

.slide-panel-body .import-panel:last-child {
  margin-bottom: 0;
}

.slide-panel-body .import-panel-desc {
  max-width: none;
}

.slide-panel-body .import-form-grid,
.slide-panel-body .import-form-grid--other,
.slide-panel-body .import-form-grid--simple {
  grid-template-columns: 1fr;
}

.slide-panel-body .import-form-actions {
  align-items: stretch;
}

.slide-panel-body .import-form-actions .btn {
  width: 100%;
}

.slide-panel-body .import-form-actions-spacer {
  display: none;
}

.slide-panel-body .import-panel-note {
  white-space: normal;
}

.admin-dialog {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.admin-dialog[hidden] {
  display: none !important;
}

.admin-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 14, 52, 0.45);
}

.admin-dialog-card {
  position: relative;
  z-index: 1;
  width: min(28rem, 100%);
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 18px 48px rgba(0, 21, 66, 0.22);
  border: 1px solid var(--border);
  padding: 1.25rem 1.35rem 1.2rem;
}

.admin-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.admin-dialog-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy-deep);
  line-height: 1.3;
}

.admin-dialog-close {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}

.admin-dialog-close:hover {
  background: var(--canvas);
  color: var(--ink);
}

.admin-dialog-message {
  margin: 0 0 0.9rem;
  color: var(--ink-muted);
  font-size: 0.92rem;
}

.admin-dialog-label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--navy-deep);
  margin-bottom: 0.35rem;
}

.admin-dialog-input {
  display: block;
  width: 100%;
  resize: vertical;
  min-height: 4.5rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  color: var(--ink);
  background: var(--white);
}

.admin-dialog-input:focus {
  outline: 2px solid rgba(0, 21, 66, 0.18);
  border-color: var(--brand);
}

.admin-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 1rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.alert-info {
  background: var(--accent-soft);
  color: #9a3412;
  border-color: #fdba74;
}

.filter-bar,
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.filter-row .field {
  margin: 0;
  min-width: 200px;
}

.filter-row .field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 0.35rem;
}

.filter-row .field select,
.filter-row .field input {
  margin-top: 0;
  max-width: none;
}

.form .field,
.form-stack label {
  margin-bottom: 1rem;
  display: block;
}

.form label,
.form-stack label {
  font-weight: 600;
  color: var(--navy-deep);
  font-size: 0.9rem;
}

.form input:not([type='checkbox']):not([type='radio']):not([type='file']):not([type='hidden']),
.form textarea,
.form select,
.form-stack input:not([type='checkbox']):not([type='radio']):not([type='file']):not([type='hidden']),
.form-stack select,
.form-stack textarea,
.filter-bar input,
.filter-bar select,
.filter-row input,
.filter-row select {

  display: block;
  width: 100%;
  max-width: 640px;
  margin-top: 0.35rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: var(--white);
  color: var(--ink);
}

.form textarea {
  min-height: 110px;
  resize: vertical;
}

/* Toggle/checkbox fields: same label → control stack as text inputs */
.form .field > .field-label,
.form-card .field > .field-label,
.form.card .field > .field-label {
  display: block;
  font-weight: 600;
  color: var(--navy-deep);
  font-size: 0.9rem;
}

.form .field.field--toggle .toggle-control,
.form-card .field.field--toggle .toggle-control,
.form.card .field.field--toggle .toggle-control {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  max-width: none;
  margin-top: 0.35rem;
  padding: 0.65rem 0.75rem;
  background: var(--softblue);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  color: var(--navy-deep);
  font-size: 0.9rem;
  line-height: 1.3;
  box-sizing: border-box;
}

.form input[type='checkbox'],
.form-stack input[type='checkbox'],
.form-card input[type='checkbox'],
.form.card input[type='checkbox'],
.field.field--toggle input[type='checkbox'] {
  display: inline-block !important;
  width: 1.15rem !important;
  height: 1.15rem !important;
  min-width: 1.15rem;
  margin: 0 !important;
  padding: 0 !important;
  flex-shrink: 0;
  accent-color: var(--brand);
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  vertical-align: middle;
}

.actions,
.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.link-button {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
}

.empty,
.meta,
.muted,
.text-muted {
  color: var(--ink-muted);
}

.detail-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.detail-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.detail-list li:last-child {
  border-bottom: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--softblue);
  color: var(--brand);
}

.badge-pending {
  background: var(--accent-soft);
  color: #9a3412;
}

.badge-approved,
.badge-success {
  background: #ecfdf5;
  color: #065f46;
}

.badge-rejected,
.badge-danger {
  background: #fef2f2;
  color: #991b1b;
}

.image-upload {
  margin-top: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 100%;
}

.image-upload-preview {
  width: 100%;
  min-height: 160px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--softblue);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0.75rem;
}

.image-upload-preview.is-empty {
  color: var(--ink-muted);
}

.image-upload-preview img {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 6px;
}

.fps-proof-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.fps-proof-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.fps-proof-item a {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.fps-proof-preview {
  max-width: 320px;
  max-height: 320px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--softblue);
  padding: 0.5rem;
}

.image-upload-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.image-upload-hint {
  margin: 0;
  font-size: 0.8125rem;
}

.image-upload .alert {
  margin: 0;
}

.mt-6 {
  margin-top: 1.5rem;
}

.mt-8 {
  margin-top: 2rem;
}

.table-card,
.table-scroll {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.table-scroll {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.table-card .data-table,
.table-scroll .data-table {
  box-shadow: none;
  border: 0;
  border-radius: 0;
  margin: 0;
}

.pardon-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 14rem;
}

.pardon-form-reason {
  font-size: 0.75rem;
  color: var(--muted);
}

.pardon-form input[type='text'] {
  width: 100%;
}

.pardon-form-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
}

.form.card,
.form-card {
  display: block;
  max-width: 820px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.form-card.form-card--wide {
  max-width: none;
}

.form-card .table-card {
  margin-top: 0.75rem;
}

.form-card .meta {
  margin: 0.75rem 0 0;
}

.form-card .field,
.form.card .field {
  margin-bottom: 1rem;
}

.form-card label,
.form.card label {
  display: block;
  font-weight: 600;
  color: var(--navy-deep);
  font-size: 0.9rem;
}

.form-card input:not([type='checkbox']):not([type='radio']):not([type='file']):not([type='hidden']),
.form-card textarea,
.form-card select,
.form.card input:not([type='checkbox']):not([type='radio']):not([type='file']):not([type='hidden']),
.form.card textarea,
.form.card select {
  display: block;
  width: 100%;
  max-width: none;
  margin-top: 0.35rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: var(--white);
}

.form-card textarea.cms-custom-css {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.45;
  min-height: 12rem;
  resize: vertical;
}

.form-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.form-section:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.form-section > h2 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.3;
  color: var(--navy-deep);
}

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

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

.detail-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  max-width: 920px;
  margin-bottom: 1.25rem;
}

.detail-card.detail-card--member {
  max-width: 960px;
}

.detail-card > h2,
.form-card > h2,
.form.card > h2 {
  margin: 0 0 1rem;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--navy-deep);
  letter-spacing: -0.01em;
}

.form-card > h3,
.form.card > h3 {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--navy-deep);
}

.admin-card-stack .detail-card,
.admin-card-stack .form-card,
.admin-card-stack .form.card,
.member-detail-stack .detail-card,
.member-detail-stack .form-card,
.member-detail-stack .form.card {
  max-width: none;
  margin-bottom: 1.25rem;
}

.admin-card-stack .detail-card:last-child,
.admin-card-stack .form-card:last-child,
.admin-card-stack .form.card:last-child,
.member-detail-stack .detail-card:last-child,
.member-detail-stack .form-card:last-child,
.member-detail-stack .form.card:last-child {
  margin-bottom: 0;
}

.detail-card .form-card,
.detail-card .form.card {
  max-width: none;
  margin-top: 1rem;
  box-shadow: none;
  background: var(--softblue);
  border-color: var(--border);
}

.detail-card .form-card:first-of-type,
.detail-card .form.card:first-of-type {
  margin-top: 0.75rem;
}

.detail-section {
  margin-bottom: 1.15rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--border);
}

.detail-section + .detail-section {
  margin-top: 0.25rem;
}

.detail-card > .form-actions,
.detail-card > .actions {
  margin-top: 0.25rem;
}

.detail-section h3 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.3;
  color: var(--navy-deep);
}

.detail-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
}

.detail-section-icon svg {
  width: 1rem;
  height: 1rem;
  display: block;
}

.detail-attrs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1.5rem;
  align-items: start;
}

.detail-attr {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.detail-attr--span-2 {
  grid-column: 1 / -1;
}

.detail-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0.65rem 1.25rem;
  align-items: start;
}

.detail-grid .detail-label,
.detail-attr .detail-label {
  color: var(--ink-muted);
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 0.15rem;
}

.detail-attr .detail-label {
  padding-top: 0;
}

.detail-grid .detail-value,
.detail-attr .detail-value {
  color: var(--ink);
  font-weight: 500;
  word-break: break-word;
}

.detail-attr .detail-value .badge {
  margin-left: 0.35rem;
  vertical-align: middle;
}

.detail-attr .detail-value .badge:first-child {
  margin-left: 0;
}

.progress-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.progress-text {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  width: 100%;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--brand-soft);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  min-width: 0;
  transition: width 0.15s ease;
}

.stack-gap {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  border-radius: 999px;
}

/* TinyMCE inside admin forms */
.form .tox-tinymce {
  border-radius: 12px;
  border-color: var(--border);
}

.form .tox .tox-edit-area__iframe {
  background: var(--white);
}

.btn-danger {
  background: #fef2f2;
  color: var(--danger);
  border-color: #fecaca;
}

.btn-danger:hover {
  background: #fee2e2;
}

.btn-block {
  width: 100%;
}

.row-actions .btn {
  white-space: nowrap;
}

.badge-warning {
  background: #fff7ed;
  color: #9a3412;
}

.table-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--softblue);
  display: inline-block;
  vertical-align: middle;
}

.table-thumb--contain {
  object-fit: contain;
}

.order-item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.order-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.order-item .table-thumb,
.order-item a {
  flex-shrink: 0;
}

.order-item a {
  display: inline-flex;
  line-height: 0;
}

.order-item a .table-thumb {
  cursor: zoom-in;
}

.table-thumb--empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  font-size: 0.75rem;
}

.listing-image-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.listing-image-gallery__item {
  margin: 0;
  width: 120px;
}

.listing-image-gallery__item img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--softblue);
  display: block;
}

.listing-image-gallery__item.is-cover img {
  border-color: var(--accent, #fd5f03);
}

.listing-image-gallery__item figcaption {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--ink-muted);
  text-align: center;
}

.badge-info {
  background: #eff6ff;
  color: #1d4ed8;
}

.badge-accent {
  background: var(--accent-soft);
  color: #9a3412;
}

.toast-root {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(360px, calc(100vw - 2rem));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  box-shadow: var(--shadow);
  background: var(--white);
  animation: toast-in 0.2s ease;
}

.toast.is-hiding {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-success {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

.toast-error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.toast-close {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
  opacity: 0.7;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .content {
    padding: 1.25rem 1rem 2rem;
  }

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

  .detail-grid {
    grid-template-columns: 1fr;
    gap: 0.25rem 0;
  }

  .detail-grid .detail-label {
    margin-top: 0.5rem;
  }

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

  .filter-row .field {
    min-width: 0;
    width: 100%;
  }
}

/* Tom Select skin */
.ts-wrapper.single .ts-control {
  border-radius: 8px !important;
  border-color: var(--border) !important;
  padding: 0.45rem 0.75rem !important;
  min-height: 42px;
}

.ts-dropdown {
  border-color: var(--border) !important;
  border-radius: 8px !important;
  box-shadow: var(--shadow) !important;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background:
    radial-gradient(circle at top right, rgba(253, 95, 3, 0.12), transparent 40%),
    linear-gradient(160deg, var(--softblue), var(--canvas));
}

.login-shell {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.login-logo {
  height: 48px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  background: transparent;
  display: block;
}

.qr-scan {
  margin: 0.75rem 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.qr-scan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.qr-scan-viewport {
  width: 100%;
  max-width: 360px;
  min-height: 240px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #0f172a;
}

.qr-scan-viewport video {
  width: 100% !important;
  height: auto !important;
  display: block;
}

.qr-scan-status {
  margin: 0;
  font-size: 0.875rem;
  color: var(--ink-muted, #64748b);
}

.qr-scan-status.is-error {
  color: var(--danger, #b91c1c);
}

.qr-scan-status.is-success {
  color: var(--success, #15803d);
}

.login-card {
  width: 100%;
  background: var(--white);
  padding: 2rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0 0 0.35rem;
  color: var(--navy-deep);
}

.import-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem 1.35rem;
  margin-bottom: 1.25rem;
  max-width: none;
}

.import-panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.65rem;
}

.import-panel-eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.import-panel-header h2,
.import-panel-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy-deep);
  line-height: 1.25;
}

.import-panel-note {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  color: var(--ink-subtle);
  white-space: nowrap;
}

.import-panel-desc {
  margin: 0 0 0.85rem;
  color: var(--ink-muted);
  font-size: 0.92rem;
  max-width: 52rem;
}

.import-panel-desc code,
.import-result code {
  font-size: 0.85em;
  background: var(--brand-soft);
  color: var(--brand);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.import-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
}

.import-col-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: var(--softblue);
  border: 1px solid #d7e4f7;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 600;
}

.import-form-grid {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) minmax(16rem, 1.4fr) auto;
  gap: 0.85rem 1rem;
  align-items: start;
}

.import-form-grid--other {
  grid-template-columns: minmax(10rem, 1fr) minmax(10rem, 1fr) minmax(14rem, 1.4fr) auto;
}

.import-form-grid--simple {
  grid-template-columns: minmax(16rem, 1.6fr) auto;
}

.import-form .field--overwrite {
  grid-column: 1 / -1;
}

.import-form .field > .field-label {
  display: block;
  font-weight: 600;
  color: var(--navy-deep);
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
  line-height: 1.25;
}

.import-form .field.field--toggle .toggle-control {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  max-width: 28rem;
  margin-top: 0;
  padding: 0.65rem 0.75rem;
  background: var(--softblue);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  color: var(--navy-deep);
  font-size: 0.9rem;
  line-height: 1.3;
  box-sizing: border-box;
}

.import-overwrite-hint {
  margin: 0.4rem 0 0;
  font-size: 0.82rem;
  color: var(--ink-subtle);
  line-height: 1.35;
  max-width: 40rem;
}

.import-form .field {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}

.import-form .field > label:not(.file-drop) {
  display: block;
  font-weight: 600;
  color: var(--navy-deep);
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
  line-height: 1.25;
  min-height: 1.1rem;
}

.import-form select {
  display: block;
  width: 100%;
  height: 2.75rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: var(--white);
  color: var(--ink);
}

.import-form-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

.import-form-actions-spacer {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1.25;
  min-height: 1.1rem;
  margin-bottom: 0.35rem;
  visibility: hidden;
  user-select: none;
}

.import-form-actions .btn {
  height: 2.75rem;
  padding-left: 1.15rem;
  padding-right: 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.file-drop,
.import-form .field > label.file-drop {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  height: 2.75rem;
  min-height: 2.75rem;
  margin: 0;
  padding: 0 0.85rem;
  border: 1.5px dashed #c5d0e0;
  border-radius: 8px;
  background: var(--canvas);
  cursor: pointer;
  font-weight: 400;
  line-height: 1.2;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.file-drop:hover,
.file-drop:focus-within {
  border-color: var(--brand);
  background: var(--softblue);
}

.file-drop.has-file {
  border-style: solid;
  border-color: #b7c9e8;
  background: var(--brand-soft);
}

.file-drop input[type='file'] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-drop-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--brand);
  flex-shrink: 0;
}

.file-drop-meta {
  font-size: 0.8rem;
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.file-drop-meta::before {
  content: '·';
  margin-right: 0.45rem;
  color: var(--ink-subtle);
}

.import-job {
  margin-top: 1.1rem;
}

.import-result {
  padding: 0.9rem 1rem;
  border-radius: 8px;
  background: var(--softblue);
  border: 1px solid #d7e4f7;
}

.import-job-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.import-job-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--ink-muted);
}

.import-job-badge[data-status='running'] {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.import-job-badge[data-status='completed'] {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: var(--success);
}

.import-job-badge[data-status='paused'] {
  background: #fff7ed;
  border-color: #fdba74;
  color: #c2410c;
}

.import-job-badge[data-status='cancelled'] {
  background: #f4f4f5;
  border-color: #d4d4d8;
  color: #52525b;
}

.import-job-actions {
  margin-left: auto;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.import-progress-track {
  height: 0.45rem;
  border-radius: 999px;
  background: #dbe7f8;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.import-progress-bar {
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.import-result-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
}

.import-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.import-stat strong {
  color: var(--ink);
  font-size: 1rem;
}

.import-stat--success {
  border-color: #a7f3d0;
  background: #ecfdf5;
}

.import-stat--success strong {
  color: var(--success);
}

.import-stat--info strong {
  color: var(--brand);
}

.import-stat--warn {
  border-color: #fde68a;
  background: #fffbeb;
}

.import-stat--warn strong {
  color: var(--warning);
}

.import-result-details {
  margin-top: 0.75rem;
}

.import-result-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--brand);
  font-size: 0.9rem;
}

.import-result-details ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  color: var(--ink-muted);
  font-size: 0.88rem;
}

.import-result-details li {
  margin-bottom: 0.25rem;
}

.import-row {
  display: inline-block;
  min-width: 3.5rem;
  font-weight: 600;
  color: var(--ink);
}

@media (max-width: 900px) {
  .import-form-grid,
  .import-form-grid--simple,
  .import-form-grid--other {
    grid-template-columns: 1fr;
  }

  .import-form-actions {
    align-items: stretch;
  }

  .import-form-actions .btn {
    width: 100%;
  }

  .import-form-actions-spacer {
    display: none;
  }

  .import-panel-note {
    white-space: normal;
  }
}

.pagination {
  margin-top: 1rem;
}

.pagination-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.pagination-pages {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.pagination-ellipsis {
  color: var(--ink-muted);
  padding: 0 0.15rem;
  user-select: none;
}

.pagination-jump {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.25rem;
}

.pagination-jump-label {
  color: var(--ink-muted);
  font-size: 0.875rem;
  white-space: nowrap;
}

.pagination-jump-input {
  width: 4.5rem;
  min-width: 4.5rem;
  padding: 0.35rem 0.5rem;
}

@media (max-width: 900px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    max-height: none;
    position: relative;
    overflow: visible;
  }

  .sidebar-nav {
    overflow: visible;
    flex: none;
    margin-bottom: 0.75rem;
  }
}
