:root {
  --primary: #0c2d4a;
  --primary-light: #1a4a6e;
  --accent: #c41e3a;
  --accent-dark: #9a1830;
  --gold: #d4a017;
  --success: #2d6a4f;
  --danger: #c41e3a;
  --bg: #f0f3f7;
  --bg-card: #ffffff;
  --text: #1a2332;
  --text-muted: #5a6a7e;
  --border: #e2e8f0;
  --sidebar-w: 260px;
  --font: 'Be Vietnam Pro', system-ui, sans-serif;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(12, 45, 74, 0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea {
  font-family: inherit;
  font-size: 0.9rem;
}

/* ---- Login ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  padding: 24px;
}

.login-card {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 420px;
  padding: 40px 36px;
}

.login-card__logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-card__logo h1 {
  font-size: 1.15rem;
  color: var(--primary);
  margin-top: 8px;
}

.login-card__logo p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.login-card__badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
  background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-light);
}

.form-group textarea { min-height: 120px; resize: vertical; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-light); }
.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover { background: var(--accent-dark); }
.btn--ghost { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
.btn--ghost:hover { background: var(--bg); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--sm { padding: 6px 12px; font-size: 0.8rem; }
.btn--block { width: 100%; }

.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.alert--error { background: #fde8ec; color: var(--accent-dark); border: 1px solid #f5c6cb; }
.alert--success { background: #d8f3dc; color: var(--success); border: 1px solid #b7e4c7; }

/* ---- Layout ---- */
.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--primary);
  color: rgba(255,255,255,0.9);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar__brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar__brand h2 { font-size: 0.95rem; font-weight: 700; }
.sidebar__brand p { font-size: 0.75rem; opacity: 0.65; margin-top: 4px; }

.sidebar__nav { flex: 1; padding: 16px 12px; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.75);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.2s, color 0.2s;
  margin-bottom: 4px;
}

.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.15); color: #fff; font-weight: 600; }
.nav-item__icon { font-size: 1.1rem; width: 22px; text-align: center; }

.sidebar__footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.78rem;
}

.sidebar__footer .user-name { font-weight: 600; margin-bottom: 8px; }

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar h1 { font-size: 1.2rem; color: var(--primary); }

.content { padding: 24px 28px; flex: 1; }

/* ---- Stats ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}

.stat-card--accent { border-left-color: var(--accent); }
.stat-card--gold { border-left-color: var(--gold); }
.stat-card--success { border-left-color: var(--success); }

.stat-card__value { font-size: 2rem; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-card__label { font-size: 0.82rem; color: var(--text-muted); margin-top: 6px; }

/* ---- Toolbar ---- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.toolbar__search {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar__search input,
.toolbar__search select {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  min-width: 160px;
}

.btn--filter {
  background: var(--accent);
  color: #fff;
  border: none;
  font-weight: 700;
  min-width: 96px;
  padding: 9px 18px;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  box-shadow: 0 3px 12px rgba(196, 30, 58, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn--filter:hover {
  background: #a81830;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(196, 30, 58, 0.45);
}

.toolbar-filter-form {
  align-items: stretch;
}

.toolbar-filter-form input,
.toolbar-filter-form select {
  min-height: 40px;
}

.input-styled.is-invalid,
.toolbar__search input.is-invalid {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.12);
}

.field-error {
  display: block;
  color: var(--accent);
  font-size: 0.78rem;
  margin-top: 4px;
}

.form-alert {
  margin-bottom: 16px;
}

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 45, 74, 0.55);
  backdrop-filter: blur(4px);
  padding: 20px;
}

.confirm-dialog {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  padding: 24px;
  max-width: 420px;
  width: 100%;
}

.confirm-dialog__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
}

.confirm-dialog__message {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
}

.confirm-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---- Table ---- */
.table-wrap {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  background: var(--bg);
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbfc; }

.data-table .cell-title {
  font-weight: 600;
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table .cell-actions {
  white-space: nowrap;
  vertical-align: middle;
  text-align: right;
  width: 1%;
}

.data-table .cell-actions .btn + .btn {
  margin-left: 6px;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #e8f0fe;
  color: var(--primary);
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding: 12px 0 4px;
}

.pagination__btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
}

.pagination__btn:hover:not(:disabled):not(.active) {
  background: var(--bg);
  border-color: var(--primary-light);
}

.pagination__btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.pagination__btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pagination__ellipsis {
  color: var(--text-muted);
  padding: 0 4px;
}

.pagination__info {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-left: 8px;
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 45, 74, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal {
  background: var(--bg-card);
  border-radius: 14px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.2);
}

.modal__header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal__header h2 { font-size: 1.05rem; color: var(--primary); }

.modal__body { padding: 20px 24px; }

.modal__footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
}

/* ---- Enhanced forms ---- */
.label-hint { font-weight: 400; color: var(--text-muted); font-size: 0.78rem; }

.input-styled,
.select-styled {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-styled:focus,
.select-styled:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(26, 74, 110, 0.12);
}

.input-styled--sm { min-height: 72px; resize: vertical; }

.select-wrap {
  position: relative;
}

.select-wrap::after {
  content: '▾';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.85rem;
}

.select-styled {
  appearance: none;
  padding-right: 36px;
  cursor: pointer;
}

/* ---- Searchable select ---- */
.search-select {
  position: relative;
  width: 100%;
}

.search-select__native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0);
}

.search-select__trigger {
  width: 100%;
  text-align: left;
  cursor: pointer;
  padding-right: 36px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: inherit;
}

.search-select__trigger.is-placeholder { color: var(--text-muted); }

.search-select__trigger:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  background: #f5f7fa;
}

.search-select.is-open .search-select__trigger {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(26, 74, 110, 0.12);
}

.search-select__dropdown {
  position: absolute;
  z-index: 300;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 100%;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(26, 35, 50, 0.12);
  max-height: 300px;
  display: flex;
  flex-direction: column;
}

.search-select__dropdown[hidden] { display: none !important; }

.search-select__search {
  margin: 8px;
  width: calc(100% - 16px);
  padding: 8px 10px;
  font-size: 0.85rem;
}

.search-select__list {
  overflow-y: auto;
  flex: 1;
  padding: 0 4px 8px;
}

.search-select__group {
  padding: 8px 10px 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.search-select__option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text);
  font-family: inherit;
}

.search-select__option:hover { background: #eef4fa; }

.search-select__option.is-selected {
  background: rgba(26, 74, 110, 0.1);
  color: var(--primary);
  font-weight: 600;
}

.search-select__empty {
  padding: 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.toolbar__search .search-select { min-width: 160px; }

.form-nice .form-group { margin-bottom: 18px; }

/* ---- Rich text editor ---- */
.rich-editor {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}

.rich-editor__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.rich-editor__btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text);
}

.rich-editor__btn:hover { background: #eef3f8; border-color: var(--primary-light); }

.rich-editor__sep {
  width: 1px;
  background: var(--border);
  margin: 4px 4px;
}

.rich-editor__body {
  min-height: 220px;
  max-height: 360px;
  overflow-y: auto;
  padding: 16px 18px;
  line-height: 1.7;
  font-size: 0.95rem;
}

.rich-editor__body:focus { outline: none; }

.rich-editor__body h3 { font-size: 1.1rem; margin: 12px 0 8px; color: var(--primary); }

.rich-editor__body p { margin-bottom: 10px; }

.rich-editor__body ul, .rich-editor__body ol { margin: 8px 0 12px 24px; }

/* ---- Pill selector ---- */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.pill:hover { border-color: var(--primary-light); }

.pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ---- Martyr grave picker ---- */
.wizard-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding: 10px 14px;
  background: #eef4fa;
  border-radius: 8px;
  border-left: 3px solid var(--primary-light);
}

.cemetery-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.cemetery-pick {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.cemetery-pick:hover { border-color: var(--primary-light); }

.cemetery-pick.selected {
  border-color: var(--accent);
  background: #fff8f9;
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.12);
}

.cemetery-pick__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--cem-color, var(--accent));
}

.cemetery-pick__name { font-weight: 600; font-size: 0.82rem; color: var(--primary); }

.cemetery-pick__meta { font-size: 0.72rem; color: var(--text-muted); }

.grave-picker {
  margin-top: 16px;
  padding: 16px;
  background: var(--primary);
  border-radius: var(--radius);
}

.grave-picker__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.75);
}

.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: middle;
}

.legend-dot.empty { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3); }

.legend-dot.occupied { background: rgba(45, 106, 79, 0.6); }

.legend-dot.selected { background: var(--accent); }

.grave-picker__grid {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  padding: 4px;
}

.grave-picker__grid-inner {
  display: grid;
  gap: 6px;
  width: max-content;
}

.grave-pick {
  aspect-ratio: 1;
  min-height: 52px;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  position: relative;
}

.grave-pick__code {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.1;
}

.grave-pick__name {
  font-size: 0.58rem;
  font-weight: 500;
  opacity: 0.95;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.1;
}

.grave-pick__badge {
  position: absolute;
  top: 3px;
  right: 4px;
  font-size: 0.55rem;
  background: #fff;
  color: #1b4332;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.grave-pick.empty:hover:not([data-occupied]) {
  background: rgba(196, 30, 58, 0.35);
  border-color: var(--accent);
  color: #fff;
  transform: scale(1.05);
}

.grave-pick.occupied {
  background: linear-gradient(145deg, #2d6a4f 0%, #1b4332 100%);
  border-color: #95d5b2;
  color: #fff;
  cursor: not-allowed;
  opacity: 1;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
}

.grave-pick.occupied:hover {
  transform: none;
  border-color: #b7e4c7;
}

.grave-pick.occupied .grave-pick__code {
  font-size: 0.62rem;
  opacity: 0.85;
}

.grave-pick--unused {
  cursor: default;
  opacity: 0.35;
  background: rgba(255,255,255,0.04);
  border-style: dashed;
  pointer-events: none;
}

.grave-pick.selected {
  background: var(--accent) !important;
  border-color: #fff !important;
  color: #fff !important;
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(196, 30, 58, 0.5);
  cursor: pointer;
}

.grave-pick.selected .grave-pick__badge {
  display: none;
}

.grave-picker__info {
  margin-top: 12px;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.85);
}

.form-group--check { display: flex; align-items: flex-end; padding-bottom: 4px; }

.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.88rem;
}

.check-label input { width: 18px; height: 18px; accent-color: var(--primary); }

/* ---- Modal sizes ---- */
.modal--md { max-width: 560px; }

.modal--lg { max-width: 780px; }

.modal--xl { max-width: 920px; }

.modal__footer { flex-wrap: wrap; }

.modal__footer .btn:disabled { opacity: 0.45; cursor: not-allowed; }

.rich-editor__group {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding-right: 8px;
  margin-right: 8px;
  border-right: 1px solid var(--border);
}

.rich-editor__group:last-child { border-right: none; }

.rich-editor__select {
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.78rem;
  padding: 0 6px;
}

.rich-editor__color {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.rich-editor__color input[type=color] {
  width: 24px;
  height: 24px;
  border: none;
  padding: 0;
  cursor: pointer;
}

.rich-editor__body .editor-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

.rich-editor__body .editor-table td,
.rich-editor__body .editor-table th {
  border: 1px solid var(--border);
  padding: 8px 10px;
  min-width: 60px;
}

.rich-editor__body blockquote {
  border-left: 4px solid var(--primary-light);
  margin: 12px 0;
  padding: 8px 16px;
  color: var(--text-muted);
  background: #f8fafc;
}

.rich-editor__body pre {
  background: #1a2332;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.85rem;
}

.page-form {
  max-width: 820px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
}

.page-form--wide { max-width: 900px; }

.page-form--map {
  max-width: none;
  width: 100%;
  padding: 16px 20px 20px;
  box-shadow: none;
  background: transparent;
}

.content--map-editor {
  padding: 12px 16px 20px;
  max-width: none;
}

.gme-form-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.gme-form-head__title {
  flex: 1;
  min-width: 200px;
  margin-bottom: 0 !important;
}

.gme-form-head__meta {
  display: flex;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-bottom: 8px;
}

.gme-form-head__meta span {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
}

.page-form--map .page-form__actions {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 20px;
  margin-top: 12px;
  border: 1px solid var(--border);
}

.page-form__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ---- Compact forms ---- */
.form-compact .form-group { margin-bottom: 12px; }

.form-compact .form-group label {
  font-size: 0.82rem;
  margin-bottom: 4px;
}

.form-compact .wizard-hint {
  margin-bottom: 12px;
  padding: 8px 12px;
  font-size: 0.82rem;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.form-group--sm textarea { min-height: 56px; }

.form-group--editor { margin-bottom: 8px; }

.form-group--editor .tox-tinymce {
  border-radius: var(--radius);
  border-color: var(--border) !important;
}

.tinymce-target { min-height: 0; visibility: hidden; height: 0; }

.grave-selected-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #eef4fa;
  border-radius: var(--radius);
  margin-bottom: 12px;
  border: 1px solid #d0e0f0;
  flex-wrap: wrap;
}

.grave-selected-banner span:first-child {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
}

.grave-selected-banner__meta {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.cemetery-pick-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.cemetery-pick-grid--compact .cemetery-pick {
  padding: 8px 10px;
}

.grave-picker--compact {
  margin-top: 12px;
  padding: 12px;
}

.grave-picker--compact .grave-picker__grid {
  max-height: 200px;
}

.grave-picker--compact .grave-pick {
  min-height: 44px;
}

.form-compact .pill-group { gap: 6px; }

.form-compact .pill { padding: 6px 12px; font-size: 0.82rem; }

.file-upload {
  position: relative;
}

.file-upload__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-upload__zone {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 18px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fafbfd 0%, #f4f8fc 100%);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.file-upload__zone:hover,
.file-upload--drag .file-upload__zone {
  border-color: var(--primary-light);
  background: #eef5fb;
  box-shadow: 0 0 0 3px rgba(26, 74, 110, 0.08);
}

.file-upload__icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--primary-light);
}

.file-upload__icon svg {
  width: 26px;
  height: 26px;
}

.file-upload__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.file-upload__title {
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 500;
  line-height: 1.4;
}

.file-upload__title em {
  color: var(--primary-light);
  font-style: normal;
  font-weight: 600;
}

.file-upload__hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.file-upload__picked {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #c8d9ea;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.file-upload__picked-icon {
  font-size: 1.45rem;
  line-height: 1;
}

.file-upload__picked-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-upload__picked-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-upload__picked-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.file-upload__clear {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: #f0f3f7;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.file-upload__clear:hover {
  background: #fde8ec;
  color: var(--accent);
}

.file-upload--compact .file-upload__zone {
  padding: 14px 16px;
  gap: 12px;
}

.file-upload--compact .file-upload__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.file-upload--compact .file-upload__icon svg {
  width: 22px;
  height: 22px;
}

.file-upload--compact .file-upload__title {
  font-size: 0.84rem;
}

.martyr-files .file-current {
  margin-bottom: 10px;
}

.file-current {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.file-current a { color: var(--primary); font-weight: 600; }

.library-file-preview {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #0a1628;
  max-width: 420px;
}

.library-file-preview img,
.library-file-preview video {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
}

.library-list-thumb {
  width: 56px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}

.library-list-album {
  position: relative;
  display: inline-block;
}

.library-list-album__count {
  position: absolute;
  right: 4px;
  bottom: 4px;
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 10px;
  background: rgba(12, 45, 74, 0.88);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

/* ---- Album gallery (thư viện ảnh) ---- */
.album-gallery {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #fafbfd 0%, #f4f8fc 100%);
  padding: 16px;
}

.album-gallery__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  margin-bottom: 14px;
}

.album-gallery__count {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary);
}

.album-gallery__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.album-gallery__grid:empty {
  display: none;
  margin-bottom: 0;
}

.album-gallery__item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 2px 8px rgba(12, 45, 74, 0.06);
}

.album-gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.album-gallery__badge {
  position: absolute;
  left: 6px;
  top: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(12, 45, 74, 0.82);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.album-gallery__remove {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.album-gallery__item:hover .album-gallery__remove,
.album-gallery__remove:focus {
  opacity: 1;
}

.album-gallery__remove:hover {
  background: #fde8ec;
  color: var(--accent);
}

.album-gallery__dropzone {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  border: 2px dashed #c8d9ea;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.album-gallery__dropzone:hover,
.album-gallery__dropzone--drag {
  border-color: var(--primary-light);
  background: #eef5fb;
  box-shadow: 0 0 0 3px rgba(26, 74, 110, 0.08);
}

.album-gallery__drop-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #f0f5fa;
  color: var(--primary-light);
}

.album-gallery__drop-icon svg {
  width: 24px;
  height: 24px;
}

.album-gallery__drop-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.album-gallery__drop-text strong {
  font-size: 0.88rem;
  color: var(--text);
}

.album-gallery__drop-text span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.cover-upload {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  align-items: start;
}

.cover-upload__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cover-upload__preview {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #eef4fa;
}

.cover-upload__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-upload {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.avatar-upload__preview {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 2px dashed var(--border);
  background: linear-gradient(135deg, #eef4fa, #f8fafc);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-upload__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-upload__img[hidden] {
  display: none !important;
}

.avatar-upload__placeholder {
  font-size: 2.5rem;
  opacity: 0.35;
  line-height: 1;
  pointer-events: none;
}

.avatar-upload--has-image .avatar-upload__placeholder {
  display: none;
}

.avatar-upload__actions {
  flex: 1;
  min-width: 0;
}

.avatar-upload__actions .file-upload__zone {
  min-height: 140px;
  justify-content: center;
}

.avatar-upload .file-upload--filled .file-upload__zone {
  display: flex;
}

.avatar-upload .file-upload__picked {
  display: none !important;
}

@media (max-width: 720px) {
  .avatar-upload {
    flex-direction: column;
    align-items: stretch;
  }
  .avatar-upload__preview {
    width: 100%;
    max-width: 180px;
    margin: 0 auto;
  }
}

.admin-thumb {
  width: 56px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}

.cell-thumb { width: 72px; }

@media (max-width: 720px) {
  .cover-upload { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .page-form { padding: 16px; }
}

.nav-sub { padding-left: 12px; }

.nav-sub .nav-item { font-size: 0.82rem; padding-left: 28px; }

/* ---- Org chart (lãnh đạo — dạng gia phả) ---- */
.org-chart-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  overflow-x: auto;
}

.org-chart-panel--empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
}

.org-chart {
  display: flex;
  justify-content: center;
  gap: 64px;
  min-width: min-content;
  padding: 20px 32px 40px;
}

.org-chart__branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.org-chart__children {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: nowrap;
  gap: 56px;
  padding-top: 56px;
  position: relative;
}

.org-chart__children::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 56px;
  background: #b8c5d3;
}

.org-chart__children > .org-chart__branch {
  position: relative;
  flex: 0 0 auto;
  padding: 56px 28px 0;
}

.org-chart__children > .org-chart__branch::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  border-top: 2px solid #b8c5d3;
}

.org-chart__children > .org-chart__branch::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 56px;
  background: #b8c5d3;
}

.org-chart__children > .org-chart__branch:first-child::before {
  left: 50%;
}

.org-chart__children > .org-chart__branch:last-child::before {
  right: 50%;
}

.org-chart__children > .org-chart__branch:only-child::before {
  display: none;
}

.org-chart__card {
  position: relative;
  width: 252px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 18px 18px 14px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, transform 0.15s;
}

.org-chart__card:hover {
  box-shadow: 0 6px 20px rgba(12, 45, 74, 0.12);
  transform: translateY(-2px);
}

.org-chart__card--group {
  border-color: #b8c9d9;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  min-width: 252px;
}

.org-chart__card--person {
  border-color: var(--primary-light);
}

.org-chart__card--hidden {
  opacity: 0.65;
}

.org-chart__card-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.org-chart__avatar-img {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.org-chart__avatar {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.org-chart__icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #e8f0fe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.org-chart__card-text { min-width: 0; flex: 1; }

.org-chart__name {
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.35;
  color: var(--primary);
}

.org-chart__role {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 4px;
}

.org-chart__field {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.35;
}

.org-chart__badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.68rem;
}

.org-chart__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 10px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

.org-chart__actions .btn--sm {
  padding: 5px 10px;
  font-size: 0.72rem;
  flex: 1;
  min-width: 58px;
}

@media (max-width: 720px) {
  .org-chart__card { width: 220px; }
  .org-chart__children { gap: 32px; flex-wrap: wrap; }
  .org-chart__children > .org-chart__branch { padding-left: 12px; padding-right: 12px; }
}

/* ---- Grave map editor & canvas ---- */
.grave-map-canvas { position: relative; margin: 0 auto; }
.grave-map-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.grave-map-canvas--edit .grave-map-svg { pointer-events: none; }
.grave-map-canvas--edit .grave-map-path,
.grave-map-canvas--edit .grave-map-shape { pointer-events: all; cursor: pointer; }
.grave-map-cells { position: relative; z-index: 1; width: 100%; height: 100%; }
.grave-map-cell {
  position: absolute; box-sizing: border-box; border: 2px solid rgba(255,255,255,0.18);
  border-radius: 10px; background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 6px 4px 4px; font-size: 0.72rem; font-weight: 700; line-height: 1.15;
  transform-origin: center center; overflow: hidden; transition: box-shadow 0.15s, border-color 0.15s;
}
.grave-map-cell__code { font-size: 0.7rem; font-weight: 800; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grave-map-cell__name { font-size: 0.58rem; font-weight: 500; opacity: 0.92; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grave-map-cell__badge {
  position: absolute; top: 4px; right: 4px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; color: #1b4332; font-size: 0.5rem; display: flex; align-items: center;
  justify-content: center; font-weight: 800; line-height: 1;
}
.grave-map-cell.empty { cursor: pointer; }
.grave-map-cell.empty:hover { background: rgba(196, 30, 58, 0.35); border-color: var(--accent); }
.grave-map-cell.occupied { background: linear-gradient(145deg, #2d6a4f 0%, #1b4332 100%); border-color: #95d5b2; cursor: pointer; }
.grave-map-cell.unused { opacity: 0.28; border-style: dashed; pointer-events: none; }
.grave-map-cell.unplaced {
  border-color: #ffd166 !important;
  border-style: dashed !important;
  box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.35);
  animation: gme-pulse 1.6s ease-in-out infinite;
}
.grave-map-cell.placed { border-style: solid; }
.grave-map-cell.selected { border-color: #fff !important; box-shadow: 0 0 0 3px rgba(255,255,255,0.55); z-index: 2; }
.grave-map-cell.is-dragging {
  opacity: 0.92;
  z-index: 30 !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  cursor: grabbing !important;
}
.grave-map-cell--edit { cursor: grab; }
.grave-map-cell--edit:active { cursor: grabbing; }

.grave-map-guides {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
}
.grave-map-guide {
  position: absolute; box-sizing: border-box;
  border: 1px dashed rgba(255,255,255,0.12);
  border-radius: 8px; background: rgba(255,255,255,0.02);
}

@keyframes gme-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.25); }
  50% { box-shadow: 0 0 0 4px rgba(255, 209, 102, 0.5); }
}

.gme-viewport--place { cursor: crosshair; }
.gme-place-label { font-weight: 600; margin-right: 8px; }
.gme-slot-pick { min-width: 160px; display: inline-block; }
.gme-place-meta { margin-left: 12px; font-size: 0.82rem; opacity: 0.85; }
.gme-draw-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 8px; padding: 10px 14px; background: #fff8e6; border: 1px solid #ffd166;
  border-radius: 8px; font-size: 0.85rem; color: #7a5c00;
}

.gme--full { width: 100%; }
.gme-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-start;
  padding: 12px 14px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 8px;
}
.gme-toolbar__group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.gme-toolbar__label {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); margin-right: 4px; width: 100%;
}
.gme-toolbar__group:not(:last-child) { padding-right: 14px; border-right: 1px solid var(--border); }
.gme-tool {
  border: 1px solid var(--border); background: #fff; border-radius: 8px; padding: 7px 12px;
  font-size: 0.8rem; cursor: pointer; color: var(--text); transition: all 0.15s; white-space: nowrap;
}
.gme-tool:hover { border-color: var(--primary-light); background: #f0f6fc; }
.gme-tool.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.gme-tool--action { background: #f8fafc; font-size: 0.78rem; padding: 7px 10px; }
.gme-hint { margin: 0 0 8px; padding: 8px 12px; background: #eef5fb; border-radius: 8px; border: 1px solid #d4e4f4; }
.gme-hint b { color: var(--primary); }
.gme-draw-banner {
  margin-bottom: 8px; padding: 10px 14px; background: #fff8e6; border: 1px solid #ffd166;
  border-radius: 8px; font-size: 0.85rem; color: #7a5c00;
}
.gme-quickbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 8px; padding: 8px 12px; background: #fff; border: 1px solid var(--border); border-radius: 8px;
}
.gme-quickbar__label { font-size: 0.82rem; font-weight: 600; margin-right: 4px; }
.gme-viewport {
  overflow: auto; width: 100%; min-height: calc(100vh - 260px); max-height: none;
  border: 2px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(180deg, #0f2940 0%, #1a4a6e 100%);
  cursor: default; -webkit-overflow-scrolling: touch;
  box-shadow: inset 0 2px 12px rgba(0,0,0,0.25);
}
.gme-viewport.is-panning { cursor: grab; }
.gme-viewport--draw { cursor: crosshair; }
.gme-stage-wrap { display: inline-block; min-width: 100%; min-height: 100%; }
.gme-stage { position: relative; display: inline-block; min-width: calc(100% - 360px); min-height: calc(100vh - 320px); }
.gme-map-inner { position: relative; }
.gme-row-handle {
  position: absolute; width: 44px; height: 28px; border-radius: 8px;
  background: rgba(255, 209, 102, 0.92); color: #1a4a6e; font-size: 0.68rem; font-weight: 800;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: ew-resize; z-index: 20; user-select: none; border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35); line-height: 1.05; padding: 0;
}
.gme-row-handle small { font-size: 0.55rem; opacity: 0.8; }
.gme-row-handle:hover, .gme-row-handle.is-dragging { background: #ffd166; transform: scale(1.05); }
.cemetery-map-editor-mount { width: 100%; }
.grave-picker__grid .grave-map-canvas { margin: 0; }
.grave-picker--compact .grave-picker__grid { max-height: min(55vh, 480px); }

@media (max-width: 900px) {
  .gme-toolbar__group { border-right: none !important; padding-right: 0 !important; }
  .gme-stage { min-width: 800px; }
}

.gme-shapes { position: relative; z-index: 2; width: 100%; height: 100%; }
.gme-shape {
  position: absolute; box-sizing: border-box; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 4px; transform-origin: center center;
  font-size: 0.72rem; font-weight: 700; border: 2px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.1); color: #fff; overflow: hidden;
}
.gme-shape--draft { border: 2px dashed #ffd166; background: rgba(255,209,102,0.12); color: #ffd166; cursor: pointer; }
.gme-shape--grave { border-color: rgba(255,255,255,0.35); background: rgba(255,255,255,0.12); cursor: grab; }
.gme-shape--occupied { background: linear-gradient(145deg, #2d6a4f, #1b4332); border-color: #95d5b2; cursor: grab; }
.gme-shape--selected { box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(255,209,102,0.55); z-index: 20; }
.gme-shape--dragging { opacity: 0.9; z-index: 30; cursor: grabbing !important; }
.gme-shape__code { font-size: 0.68rem; font-weight: 800; }
.gme-shape__name { font-size: 0.55rem; opacity: 0.9; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gme-shape__draft { font-size: 1.1rem; opacity: 0.7; }
.gme-shape__badge {
  position: absolute; top: 3px; right: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; color: #1b4332; font-size: 0.5rem; display: flex; align-items: center; justify-content: center;
}
.gme-resize-handle {
  position: absolute; right: -4px; bottom: -4px; width: 12px; height: 12px;
  background: #ffd166; border: 2px solid #1a4a6e; border-radius: 2px; cursor: nwse-resize;
}
.gme-draft-preview {
  position: absolute; border: 2px dashed #ffd166; background: rgba(255,209,102,0.15);
  border-radius: 8px; pointer-events: none; z-index: 40;
}
.gme-viewport--draw { cursor: crosshair; }
.gme-viewport--assign { cursor: pointer; }
.gme-quickbar__assign { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.gme-slot-assign { min-width: 140px; padding: 4px 8px !important; }
.gme--free { width: 100%; }
