:root {
  --bg: #f7f1e7;
  --ink: #1e2329;
  --muted: #6d737c;
  --line: #e3d7c6;
  --brand: #2e6047;
  --brand-dark: #1e4636;
  --accent: #b98235;
  --white: #fff;
  --danger: #b3261e;
}

* { box-sizing: border-box; }
html { width: 100%; max-width: 100%; overflow-x: hidden; }
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 10% 0%, rgba(255,255,255,.95), rgba(255,255,255,0) 34%),
    linear-gradient(180deg, #fbf7ef 0%, var(--bg) 48%, #f5efe5 100%);
  color: var(--ink);
}
a { color: inherit; text-decoration: none; }
.page { width: 100%; max-width: 100%; min-height: 100vh; overflow-x: hidden; }
.public-page { display: flex; flex-direction: column; }
.public-page { touch-action: pan-y; }
.public-page img, .public-page video, .public-page canvas { max-width: 100%; }
.public-page main, .public-page section, .public-page header, .public-page footer, .public-page form { min-width: 0; max-width: 100%; }
.top {
  background: linear-gradient(135deg, #315f4b, #1f3d35);
  color: #fff;
  padding: 28px 18px 34px;
}
.top h1 { margin: 0; font-size: 24px; letter-spacing: 0; }
.top p { margin: 8px 0 0; color: rgba(255,255,255,.82); line-height: 1.6; }
.home-banner {
  background: #f5efe2;
  line-height: 0;
  max-height: 260px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(104, 75, 34, .12);
}
.home-banner img {
  display: block;
  width: 100%;
  height: clamp(132px, 24vw, 260px);
  object-fit: cover;
  object-position: center;
}
.wrap { max-width: 520px; margin: -18px auto 32px; padding: 0 14px; width: 100%; }
.home-wrap { margin-top: 14px; }
.detail-wrap { margin-top: -18px; }
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 14px 34px rgba(80, 58, 34, .1);
}
.search-panel {
  border-top: 3px solid var(--accent);
}
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.required-star { color: #d33b2f; font-weight: 800; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 16px;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 0;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(46, 96, 71, .12);
}
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  background: linear-gradient(180deg, #3a7658, var(--brand));
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(46, 96, 71, .22);
}
button:hover, .btn:hover { background: var(--brand-dark); }
.btn.secondary { background: #ece6dc; color: var(--ink); }
.btn.danger { background: var(--danger); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.6; }
.result {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-top: 12px;
  background: linear-gradient(180deg, #fff, #fffdf9);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.result:hover {
  border-color: #c8ad83;
  box-shadow: 0 10px 22px rgba(88, 62, 28, .1);
  transform: translateY(-1px);
}
.result strong { font-size: 18px; }
.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.meta { color: var(--muted); font-size: 14px; margin-top: 6px; line-height: 1.6; }
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.section-title h2 { margin: 0; font-size: 18px; }
.section-title span { color: var(--muted); font-size: 13px; }
.status-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}
.status-tag.overdue {
  color: #fff;
  background: #b6472f;
}
.status-tag.ok {
  color: var(--brand);
  background: #e8f2ed;
}
.info-list { display: grid; gap: 10px; margin: 0; }
.row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #eee8df;
  padding-bottom: 10px;
}
.row span:first-child { color: var(--muted); }
.fee-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.fee-table th, .fee-table td {
  padding: 11px 8px;
  border-bottom: 1px solid #eee8df;
  text-align: left;
}
.fee-table th { color: var(--muted); font-weight: 500; }
.price { color: var(--accent); font-size: 22px; font-weight: 700; }
.amount-line { margin: 14px 0 12px; }
.year-options {
  display: flex;
  flex-direction: row;
  gap: 6px;
  margin: 10px 0 4px;
  width: 100%;
}
.year-option {
  display: block;
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  cursor: pointer;
}
.year-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.year-option span {
  display: grid;
  gap: 3px;
  min-height: 54px;
  align-content: center;
  padding: 7px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #fffaf2);
  text-align: center;
}
.year-option strong { font-size: 15px; line-height: 1.1; }
.year-option em {
  color: var(--accent);
  font-style: normal;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.15;
}
.year-option input:checked + span {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(47, 107, 79, .14);
  background: #f3faf6;
}
.payer-grid { margin-top: 14px; }
.compact-detail-header { padding: 22px 16px 30px; }
.compact-detail-header h1 { font-size: 25px; margin-bottom: 5px; }
.compact-detail-header p { font-size: 13px; }
.compact-detail-wrap { max-width: 520px; }
.compact-grave-card,
.compact-payment-card { border-radius: 12px; }
.compact-grave-card { padding: 14px 16px; }
.compact-grave-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.compact-grave-title span:first-child {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 2px;
}
.compact-grave-title h2 {
  margin: 0;
  color: var(--brand);
  font-size: 21px;
  line-height: 1.25;
}
.compact-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.compact-info-grid > div {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #ece5da;
  border-radius: 7px;
  background: #faf8f3;
}
.compact-info-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 3px;
}
.compact-info-grid strong {
  display: block;
  color: #24382d;
  font-size: 13px;
  line-height: 1.35;
  word-break: break-word;
}
.compact-payment-card { margin-top: 10px; padding: 15px 16px; }
.compact-section-title { margin-bottom: 6px; }
.compact-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0 8px;
  padding: 11px 12px;
  border-radius: 8px;
  background: #f3f8f4;
}
.compact-total span { color: var(--muted); font-size: 13px; }
.compact-total strong { color: var(--accent); font-size: 22px; }
.compact-fee-summary {
  padding: 10px 12px;
  border: 1px solid #ebe3d6;
  border-radius: 8px;
  background: #faf8f3;
  color: #62685f;
  font-size: 12px;
  line-height: 1.6;
}
.compact-fee-summary p { margin: 0 0 3px; }
.compact-fee-summary p:last-child { margin-bottom: 0; }
.year-option.disabled { cursor: not-allowed; }
.year-option.disabled span {
  color: #999;
  background: #f3f3f1;
  border-color: #e1dfda;
  opacity: .72;
}
.year-option.disabled em { color: #a45c45; }
.notice { padding: 12px; border-radius: 6px; background: #fff7e8; color: #67451d; line-height: 1.6; }
.admin-layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: #24372f; color: #fff; padding: 20px; }
.sidebar h2 { margin: 0 0 18px; font-size: 18px; }
.sidebar a { display: block; padding: 10px 0; color: rgba(255,255,255,.84); }
.main { padding: 22px; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.admin-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 12px; border-bottom: 1px solid #eee8df; text-align: left; }
.admin-table th { color: var(--muted); font-weight: 500; background: #fbfaf7; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; background: #e9f2ed; color: var(--brand); font-size: 12px; }
.badge.pending { background: #fff3d6; color: #865b00; }
.permission-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.permission-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}
.permission-grid input { width: auto; min-height: auto; }
.site-footer {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
  padding: 8px 14px 24px;
  text-align: center;
  width: 100%;
  margin: 0 auto;
}

.memorial-search-page {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 88% 5%, rgba(255,255,255,.92), rgba(255,255,255,0) 25%),
    linear-gradient(180deg, rgba(247,250,243,.98), rgba(236,244,231,.94) 38%, #f9f8f0 100%);
}
.memorial-search-page::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 190px;
  pointer-events: none;
  opacity: .68;
  background:
    radial-gradient(ellipse at 16% 92%, rgba(72,103,77,.22), rgba(72,103,77,0) 22%),
    linear-gradient(0deg, rgba(221,229,216,.8), rgba(255,255,255,0));
}
.memorial-hero {
  height: 250px;
  position: relative;
  overflow: hidden;
  background: #eef4e9;
}
.memorial-hero img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}
.memorial-hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 96px;
  background: linear-gradient(180deg, rgba(244,248,239,0), rgba(244,248,239,.98));
}
.memorial-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: min(760px, calc(100% - 34px));
  margin: -22px auto 0;
  position: relative;
  z-index: 2;
}
.memorial-feature {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.feature-icon {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #7b6c49;
  background: rgba(255,255,255,.62);
  border: 1px solid rgba(139,126,91,.16);
  box-shadow: 0 7px 18px rgba(104,121,96,.12);
}
.feature-icon svg {
  width: 23px;
  height: 23px;
}
.memorial-feature strong {
  display: block;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
}
.memorial-feature em {
  display: block;
  color: #738078;
  font-size: 10px;
  font-style: normal;
  margin-top: 4px;
  white-space: nowrap;
}
.memorial-wrap {
  margin-top: 28px;
  margin-bottom: 28px;
  position: relative;
  z-index: 3;
}
.memorial-card {
  padding: 30px 26px 26px;
  border-radius: 18px;
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(213,215,201,.75);
  box-shadow: 0 16px 40px rgba(76,92,75,.16);
}
.memorial-card-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #2d5945;
}
.memorial-card-title h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 750;
  letter-spacing: 1px;
}
.memorial-card-title span {
  width: 28px;
  height: 15px;
  opacity: .9;
  background:
    radial-gradient(ellipse at 70% 50%, #d7b35c 0 38%, transparent 42%),
    linear-gradient(35deg, transparent 0 44%, #d7b35c 45% 55%, transparent 56%);
}
.memorial-card-title span:last-child {
  transform: scaleX(-1);
}
.memorial-card-subtitle {
  color: #7a817c;
  text-align: center;
  margin: 14px 0 24px;
  font-size: 15px;
  line-height: 1.6;
}
.memorial-search-form label {
  display: block;
  font-weight: 700;
  font-size: 15px;
  color: #242927;
  margin-bottom: 10px;
}
.memorial-input {
  height: 58px;
  border: 1px solid #d9c8a9;
  border-radius: 9px;
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  padding: 0 14px;
  color: #b2b4ae;
  background: #fff;
  box-shadow: 0 8px 18px rgba(173,142,84,.12);
}
.memorial-input svg {
  width: 23px;
  height: 23px;
}
.memorial-input input {
  min-height: 0;
  height: 56px;
  padding: 0;
  border: 0;
  box-shadow: none;
  font-size: 17px;
}
.memorial-input input:focus {
  box-shadow: none;
}
.memorial-tip {
  margin: 14px 0 16px;
  padding: 14px;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 8px;
  align-items: center;
  background: #f3f5f1;
  border: 1px solid #e4e7df;
  color: #6a716d;
  font-size: 13px;
  line-height: 1.7;
}
.memorial-tip svg {
  width: 24px;
  height: 24px;
  color: #4f6d5c;
}
.memorial-search-button {
  width: 100%;
  height: 62px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: linear-gradient(180deg, #367055, #24553f);
  color: white;
  font-size: 20px;
  font-weight: 750;
  box-shadow: 0 13px 28px rgba(39,87,65,.3), inset 0 0 0 1px rgba(255,255,255,.25);
}
.memorial-search-button svg {
  width: 25px;
  height: 25px;
}
.memorial-message,
.memorial-results {
  position: relative;
  z-index: 3;
  scroll-margin-top: 14px;
}
.memorial-footer {
  position: relative;
  z-index: 2;
  padding-top: 36px;
  padding-bottom: 44px;
  font-size: 14px;
  color: #6d756f;
}
.home-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.home-actions a {
  min-height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(213,215,201,.75);
  color: #2d5945;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(76,92,75,.1);
}
.home-actions a.active {
  background: linear-gradient(180deg, #367055, #24553f);
  color: #fff;
}
.shop-page {
  background:
    radial-gradient(circle at 88% 5%, rgba(255,255,255,.92), rgba(255,255,255,0) 25%),
    linear-gradient(180deg, rgba(247,250,243,.98), rgba(236,244,231,.94) 38%, #f9f8f0 100%);
}
.shop-hero {
  padding: 34px 18px 44px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(36,85,63,.95), rgba(63,112,82,.92)),
    url("/assets/home-banner-web.jpg") center / cover;
}
.shop-hero h1 { margin: 0; font-size: 24px; }
.shop-hero p { margin: 8px 0 0; color: rgba(255,255,255,.84); }
.shop-wrap { margin-top: -24px; }
.shop-cats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
}
.shop-cats a {
  flex: 0 0 auto;
  padding: 8px 13px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: #50605a;
  font-size: 14px;
}
.shop-cats a.active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}
.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.shop-card {
  overflow: hidden;
  border-radius: 14px;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(213,215,201,.75);
  box-shadow: 0 14px 32px rgba(76,92,75,.13);
}
.shop-cover {
  height: 118px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #edf4ec, #fff8ed);
  color: var(--brand);
  font-size: 28px;
  font-weight: 800;
}
.shop-cover img,
.shop-detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.shop-info { padding: 12px; }
.shop-info strong { display: block; font-size: 15px; }
.shop-info em {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}
.shop-info span {
  display: block;
  margin-top: 8px;
  color: var(--accent);
  font-weight: 800;
  font-size: 17px;
}
.shop-detail-wrap { margin-top: 14px; }
.shop-detail {
  border-radius: 16px;
  background: rgba(255,255,255,.96);
}
.shop-detail-cover {
  height: 190px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(135deg, #edf4ec, #fff8ed);
  color: var(--brand);
  font-size: 34px;
  font-weight: 800;
}
.shop-detail h1 { margin: 16px 0 4px; font-size: 22px; }
.shop-price {
  margin: 10px 0;
  color: var(--accent);
  font-size: 24px;
  font-weight: 800;
}
.shop-desc {
  color: #59635e;
  line-height: 1.8;
  padding: 12px;
  border-radius: 8px;
  background: #f8faf6;
}
.shop-order-form { margin-top: 16px; }
.shop-media-section {
  margin-top: 16px;
}
.shop-media-section h2 {
  margin: 0 0 10px;
  font-size: 18px;
  color: #2d5945;
}
.shop-media-section video {
  display: block;
  width: 100%;
  max-height: 420px;
  border-radius: 10px;
  background: #111;
}
.shop-detail-images {
  display: grid;
  gap: 10px;
}
.shop-detail-images img {
  display: block;
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.media-list {
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: 8px;
  background: #f8faf6;
}
.media-list a {
  color: var(--brand);
  word-break: break-all;
}
.inline-form {
  display: flex;
  gap: 6px;
  align-items: center;
}
.inline-form select {
  min-height: 34px;
  font-size: 13px;
  padding: 4px 8px;
}
.mini-btn {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
  box-shadow: none;
}
.my-page {
  background:
    radial-gradient(circle at 88% 5%, rgba(255,255,255,.92), rgba(255,255,255,0) 25%),
    linear-gradient(180deg, rgba(247,250,243,.98), rgba(236,244,231,.94) 38%, #f9f8f0 100%);
}
.my-section {
  border-radius: 14px;
  background: rgba(255,255,255,.96);
}
.my-record {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #fff, #fffdf9);
}
.notice-toggle { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.notice-toggle input { width: auto; }
.payment-filter-panel { margin-bottom: 12px; padding: 11px 12px; }
.payment-admin-page { background: #f6f7f5; }
.payment-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.payment-page-header h1 { margin: 0; color: #1f3128; font-size: 27px; }
.payment-page-header p { margin: 6px 0 0; color: #7a817c; font-size: 13px; }
.payment-result-count { color: #66746b; font-size: 13px; }
.payment-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
  border: 1px solid #dde3de;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.payment-summary-item {
  position: relative;
  padding: 16px 18px;
  border-right: 1px solid #e5e9e6;
}
.payment-summary-item:last-child { border-right: 0; }
.payment-summary-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: #72877a;
}
.payment-summary-item.is-paid::before { background: #2f7250; }
.payment-summary-item.is-unpaid::before { background: #b98235; }
.payment-summary-item span { display: block; color: #727c75; font-size: 12px; }
.payment-summary-item strong { display: block; margin: 5px 0 2px; color: #20342a; font-size: 25px; }
.payment-summary-item small { color: #89908b; font-size: 11px; }
.payment-filter-panel { border-color: #dde3de; box-shadow: none; }
.payment-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}
.payment-panel-heading h2 { margin: 0; color: #27382f; font-size: 16px; }
.payment-panel-heading p { margin: 4px 0 0; color: #89908b; font-size: 12px; }
.payment-panel-heading a { color: var(--brand); font-size: 12px; }
.payment-filter-form {
  display: grid;
  grid-template-columns: 1.15fr repeat(3, minmax(100px, 1fr)) repeat(2, minmax(125px, .85fr)) minmax(180px, 1.15fr);
  gap: 8px 10px;
  align-items: end;
  padding: 0;
}
.payment-filter-form label {
  display: block;
  margin-bottom: 3px;
  color: #182535;
  font-size: 12px;
  font-weight: 700;
}
.payment-filter-form .filter-field > label span {
  margin-right: 2px;
  color: #f0524d;
}
.payment-filter-form input,
.payment-filter-form select {
  width: 100%;
  min-height: 32px;
  height: 32px;
  padding: 4px 7px;
  box-sizing: border-box;
  border: 1px solid #d5dce5;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
}
.payment-filter-form input:focus,
.payment-filter-form select:focus {
  border-color: #4f9273;
  box-shadow: 0 0 0 3px rgba(79,146,115,.1);
}
.field-cemetery { grid-column: 1; grid-row: 1; }
.field-grave { grid-column: 2; grid-row: 1; }
.field-buyer { grid-column: 3; grid-row: 1; }
.field-user { grid-column: 4; grid-row: 1; }
.field-start { grid-column: 5; grid-row: 1; }
.field-end { grid-column: 6; grid-row: 1; }
.payment-status-filter { grid-column: 7; grid-row: 1; }
.payment-status-filter > div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 32px;
  align-items: center;
}
.payment-status-filter > div label {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  font-weight: 500;
  font-size: 12px;
}
.payment-status-filter input { width: 14px; height: 14px; min-height: 14px; }
.payment-filter-actions {
  grid-row: 2;
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}
.payment-filter-actions button,
.payment-filter-actions .btn {
  width: auto;
  min-width: 96px;
  min-height: 32px;
  padding: 0 14px;
  margin: 0;
  border: 1px solid #00a989;
  border-radius: 6px;
  background: #fff;
  color: #00a989;
  box-shadow: none;
  font-size: 12px;
}
.payment-record-section { margin-top: 18px; }
.payment-record-section > .payment-panel-heading { margin: 0 0 10px; }
.payment-table-wrap { border-color: #dde3de; box-shadow: none; }
.payment-record-table { min-width: 1050px; }
.payment-record-table th {
  padding: 11px 14px;
  color: #67746b;
  background: #f4f6f4;
  font-size: 12px;
  font-weight: 700;
}
.payment-record-table td {
  padding: 13px 14px;
  color: #35433b;
  font-size: 13px;
  vertical-align: top;
}
.payment-record-table tbody tr:hover { background: #fafcfb; }
.payment-record-table td strong,
.payment-record-table td span { display: block; color: #263a2f; }
.payment-record-table td small { display: block; margin-top: 4px; color: #838b86; font-size: 11px; line-height: 1.55; }
.payment-record-table .payment-amount { color: #9b6d29; font-size: 16px; }
.payment-status {
  display: inline-flex !important;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.payment-status.paid { color: #286345; background: #e6f2eb; }
.payment-status.unpaid { color: #93631c; background: #fff1d9; }
.payment-empty { padding: 36px; color: #87908a; text-align: center; }
body.notice-open { overflow: hidden; }
.detail-notice-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  padding: 22px;
  background: rgba(30, 42, 34, .68);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.detail-notice-modal {
  position: relative;
  flex: 0 1 520px;
  width: 100%;
  min-width: 0;
  max-width: 520px;
  max-height: calc(100vh - 44px);
  margin: auto;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 34px 30px 28px;
  box-sizing: border-box;
  border: 1px solid #dcc899;
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.98), rgba(249,247,235,.98));
  box-shadow: 0 24px 70px rgba(18, 36, 27, .32);
}
.detail-notice-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #9a7941;
  font-size: 34px;
  font-weight: 300;
  line-height: 1;
}
.detail-notice-mark {
  display: table;
  max-width: 100%;
  margin: 0 auto 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: #edf4ed;
  color: #326149;
  font-size: 12px;
  font-weight: 700;
}
.detail-notice-modal h2 {
  width: 100%;
  max-width: 400px;
  margin: 0 auto 24px;
  color: #203e2e;
  font-size: 25px;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
}
.public-support-link { color: #2e6047; text-decoration: underline; text-underline-offset: 3px; }
.public-support-link:hover { color: #1f7a4d; }
.detail-notice-content {
  width: 100%;
  max-width: 100%;
  color: #384b40;
  font-size: 16px;
  line-height: 1.95;
  text-align: justify;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.detail-notice-content br { display: block; }
.detail-notice-signature {
  max-width: 100%;
  margin: 20px 4px 22px;
  color: #2c4939;
  font-size: 15px;
  font-weight: 700;
  text-align: right;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.detail-notice-confirm {
  width: 100%;
  min-height: 52px;
  margin-top: 22px;
  border: 1px solid #b89755;
  border-radius: 8px;
  background: linear-gradient(180deg, #3f7658, #2d6248);
  color: #fff;
  box-shadow: 0 8px 20px rgba(43, 94, 69, .22);
  font-size: 17px;
  font-weight: 700;
}

@media (max-width: 700px) {
  .grid.two { grid-template-columns: 1fr; }
  .admin-layout { grid-template-columns: 1fr; }
  .year-options {
    display: flex;
    flex-direction: row;
    gap: 5px;
  }
  .permission-grid { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .main { padding: 14px; }
  .row { display: grid; gap: 4px; }
  .wrap { padding: 0 12px; }
  .panel { padding: 16px; }
  .home-banner { max-height: 150px; }
  .home-banner img {
    height: 150px;
    object-position: center;
  }
  .year-option span {
    min-height: 50px;
    padding: 6px 3px;
  }
  .year-option strong { font-size: 14px; }
  .year-option em { font-size: 11px; }
  .compact-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compact-grave-card,
  .compact-payment-card { padding: 13px; }
  .detail-notice-overlay { padding: 16px; }
  .detail-notice-modal { flex-basis: auto; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); padding: 30px 22px 22px; border-radius: 16px; }
  .detail-notice-modal h2 { font-size: 22px; margin-bottom: 18px; }
  .detail-notice-content { font-size: 15px; line-height: 1.85; }
  .payment-filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .field-cemetery,.field-grave,.field-buyer,.field-user,.field-start,.field-end,.payment-status-filter { grid-column: auto; grid-row: auto; }
  .payment-status-filter { grid-column: 1 / -1; }
  .payment-filter-actions { grid-column: 1 / -1; grid-row: auto; justify-content: stretch; gap: 8px; }
  .payment-filter-actions button { flex: 1; }
  .payment-page-header { align-items: flex-start; flex-direction: column; gap: 8px; }
  .payment-summary-grid { grid-template-columns: 1fr; }
  .payment-summary-item { border-right: 0; border-bottom: 1px solid #e5e9e6; }
  .payment-summary-item:last-child { border-bottom: 0; }
  .memorial-hero { height: 250px; }
  .memorial-features {
    width: calc(100% - 32px);
    gap: 6px;
  }
  .memorial-feature {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 6px;
  }
  .feature-icon {
    width: 36px;
    height: 36px;
    border-radius: 14px;
  }
  .feature-icon svg {
    width: 20px;
    height: 20px;
  }
  .memorial-feature strong { font-size: 12px; }
  .memorial-feature em { font-size: 9px; }
  .memorial-wrap {
    margin-top: 24px;
    padding: 0 20px;
  }
  .memorial-card {
    padding: 28px 24px 24px;
    border-radius: 18px;
  }
  .memorial-card-title h1 { font-size: 24px; }
  .memorial-search-button {
    height: 60px;
    font-size: 20px;
  }
  .shop-grid { grid-template-columns: 1fr 1fr; }
  .shop-cover { height: 108px; }
}

@media (max-width: 380px) {
  .memorial-feature {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .memorial-feature em { display: none; }
  .memorial-card {
    padding: 24px 18px 22px;
  }
}

/* Invoice and refund management */
.payment-row-actions { display: flex; flex-wrap: wrap; gap: 5px; min-width: 150px; }
.payment-row-actions button, .invoice-view-btn {
  display: inline-flex; align-items: center; justify-content: center; min-width: 0; min-height: 28px; height: 28px;
  padding: 0 8px; border-radius: 5px; box-shadow: none; font-size: 10px; white-space: nowrap;
}
.invoice-upload-btn { background: #1f7a4d; }
.invoice-view-btn { color: #fff; background: #2877b8; }
.invoice-delete-btn, .refund-open-btn { color: #fff; background: #c7544b; }
.refund-sync-btn { color: #fff; background: #b98235; }
.refund-disabled { color: #7d8881; background: #e9edeb; cursor: not-allowed; opacity: 1; }
.invoice-pending { display: inline-flex !important; padding: 4px 7px; border-radius: 999px; color: #77817b !important; background: #edf0ee; font-size: 10px; white-space: nowrap; }
.invoice-status-column, .invoice-status-cell { text-align: center !important; }
.invoice-status-cell small { display: block; margin-top: 4px; color: #98a19b; font-size: 9px; white-space: nowrap; }
.status-invoice-0, .status-invoice-1 {
  display: inline-flex !important; align-items: center; justify-content: center; min-height: 25px; padding: 0 9px;
  border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap;
}
.status-invoice-0 { color: #FF4D4F !important; background: #fff1f0; border: 1px solid #ffccc7; }
.status-invoice-1 { color: #52C41A !important; background: #f6ffed; border: 1px solid #b7eb8f; }
body.payment-manage-open { overflow: hidden; }
.payment-manage-overlay {
  position: fixed; z-index: 10000; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(21,31,25,.58); opacity: 0; visibility: hidden; transition: .18s ease;
}
.payment-manage-overlay.is-open { opacity: 1; visibility: visible; }
.payment-manage-modal {
  width: min(520px,90vw); max-width: 95vw; max-height: 90vh; overflow: hidden; border-radius: 12px;
  background: #fff; box-shadow: 0 24px 70px rgba(18,39,27,.25); transform: translateY(10px); transition: .18s ease;
}
.payment-manage-overlay.is-open .payment-manage-modal { transform: translateY(0); }
.payment-manage-modal header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid #e9eeeb; }
.payment-manage-modal h2 { margin: 0; color: #203229; font-size: 17px; }
.payment-manage-modal header button { width: 30px; min-width: 30px; min-height: 30px; height: 30px; padding: 0; color: #66756d; background: #f0f4f1; box-shadow: none; font-size: 22px; }
.payment-manage-modal form { display: flex; flex-direction: column; max-height: calc(90vh - 62px); }
.payment-manage-body { display: grid; gap: 8px; padding: 16px 18px; overflow-y: auto; }
.payment-manage-body label { margin: 3px 0 0; color: #43534a; font-size: 11px; font-weight: 700; }
.payment-manage-body input, .payment-manage-body select, .payment-manage-body textarea { min-height: 38px; border-color: #dce4df; font-size: 12px; }
.payment-manage-body small, .modal-order-text { margin: 0; color: #8c9790; font-size: 10px; }
.payment-manage-modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid #e9eeeb; background: #fafcfb; }
.payment-manage-modal footer button { min-height: 36px; height: 36px; box-shadow: none; font-size: 11px; }
.payment-manage-modal .modal-cancel { color: #5e6c64; border: 1px solid #d6dfd9; background: #fff; }
.payment-manage-modal .refund-confirm-btn { background: #c7544b; }
.invoice-preview-modal { display: flex; width: calc(100% - 32px); max-width: 900px; max-height: 90vh; flex-direction: column; overflow: hidden; border-radius: 12px; background: #fff; box-shadow: 0 24px 70px rgba(18,39,27,.25); transform: translateY(10px); transition: .18s ease; }
.payment-manage-overlay.is-open .invoice-preview-modal { transform: translateY(0); }
.invoice-preview-modal header { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid #e9eeeb; }
.invoice-preview-modal header h2 { margin: 0; color: #203229; font-size: 17px; }
.invoice-preview-modal header p { margin: 3px 0 0; color: #8c9790; font-size: 11px; }
.invoice-preview-modal header button { width: 30px; min-width: 30px; min-height: 30px; height: 30px; padding: 0; color: #66756d; background: #f0f4f1; box-shadow: none; font-size: 22px; }
.invoice-preview { min-height: 280px; padding: 16px; overflow: auto; background: #f3f5f4; text-align: center; -webkit-overflow-scrolling: touch; }
.invoice-preview iframe { display: none; width: 100%; height: 70vh; min-height: 480px; border: 0; background: #fff; }
.invoice-preview img { display: none; width: auto; height: auto; max-width: 100%; margin: 0 auto; object-fit: contain; }
.invoice-preview-overlay.is-pdf .invoice-preview-pdf, .invoice-preview-overlay.is-image .invoice-preview-image { display: block; }
.invoice-preview-modal footer { display: flex; flex: 0 0 auto; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid #e9eeeb; background: #fafcfb; }
.invoice-preview-modal footer a, .invoice-preview-modal footer button { display: inline-flex; min-width: 88px; min-height: 36px; height: 36px; padding: 0 14px; align-items: center; justify-content: center; border: 0; border-radius: 6px; color: #fff; background: #1f7a4d; box-shadow: none; font-size: 11px; white-space: nowrap; cursor: pointer; }
.invoice-preview-modal footer .invoice-preview-download { background: #2877b8; }
.invoice-preview-modal footer .modal-cancel { color: #5e6c64; border: 1px solid #d6dfd9; background: #fff; }
@media print { body.invoice-preview-printing > *:not(.invoice-preview-overlay) { display: none !important; } body.invoice-preview-printing .invoice-preview-overlay { position: static; display: block; padding: 0; background: #fff; opacity: 1; visibility: visible; } body.invoice-preview-printing .invoice-preview-modal { width: 100%; max-width: none; max-height: none; box-shadow: none; transform: none; } body.invoice-preview-printing .invoice-preview-modal header, body.invoice-preview-printing .invoice-preview-modal footer { display: none; } body.invoice-preview-printing .invoice-preview { padding: 0; overflow: visible; background: #fff; } body.invoice-preview-printing .invoice-preview img { max-width: 100%; } }
.refund-summary { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; margin-bottom: 4px; }
.refund-summary div { min-width: 0; padding: 8px; border-radius: 7px; background: #f5f8f6; }
.refund-summary span, .refund-summary b { display: block; }
.refund-summary span { color: #87928b; font-size: 9px; }
.refund-summary b { margin-top: 3px; overflow: hidden; color: #304238; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 767px) {
  .payment-row-actions { justify-content: flex-end; min-width: 0; }
  .invoice-status-cell { text-align: right !important; }
  .payment-manage-overlay { padding: 10px; }
  .payment-manage-modal { width: 90vw; max-width: 95vw; max-height: 90vh; }
  .invoice-preview-modal { width: calc(100% - 20px); max-height: 88vh; }
  .invoice-preview { min-height: 220px; padding: 8px; }
  .invoice-preview iframe { height: 62vh; min-height: 360px; }
  .invoice-preview-modal footer { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 10px; }
  .invoice-preview-modal footer a, .invoice-preview-modal footer button { width: 100%; min-width: 0; padding: 0 6px; }
  .refund-summary { grid-template-columns: 1fr 1fr; }
}

/* Grave management modal */
.grave-admin-page { background: #f4f6f5; }
.grave-page-toolbar { margin-bottom: 14px; }
.grave-page-toolbar h1 { margin-bottom: 3px; }
.grave-page-toolbar p { margin: 0; color: #7a837d; font-size: 13px; }
.grave-list-panel { padding: 0; overflow: hidden; border-color: #e0e5e2; box-shadow: 0 6px 20px rgba(24,54,39,.06); }
.grave-list-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 16px; border-bottom: 1px solid #e7ebe8; }
.grave-list-header h2 { margin: 0 0 3px; font-size: 17px; }
.grave-list-header span { color: #89918c; font-size: 12px; }
.grave-list-tools, .grave-search-form { display: flex; align-items: center; gap: 8px; }
.grave-search-form input { width: 260px; min-height: 34px; height: 34px; padding: 5px 9px; font-size: 13px; border-color: #dbe1dd; }
.grave-filter-button, .grave-add-button { min-height: 34px; height: 34px; padding: 0 13px; border-radius: 6px; box-shadow: none; font-size: 13px; }
.grave-filter-button { color: #355342; background: #eef4f0; border: 1px solid #d8e5dc; }
.grave-add-button { gap: 5px; background: #1f7a4d; }
.grave-add-button span { color: inherit; font-size: 18px; line-height: 1; }
.grave-reset-link { color: #718078; font-size: 12px; }
.grave-list-table th { background: #f8faf9; white-space: nowrap; }
.grave-list-table td { vertical-align: middle; }
.grave-list-table td strong { color: #274c38; }
.grave-edit-link { display: inline-flex; padding: 4px 9px; color: #1f7a4d; background: #eaf5ee; border-radius: 5px; font-size: 12px; }
.grave-empty { padding: 42px !important; color: #8b938e; text-align: center !important; }
.grave-modal-open { overflow: hidden; }
.grave-modal-overlay {
  position: fixed; z-index: 1200; inset: 0; display: flex; align-items: center; justify-content: center; padding: 22px;
  background: rgba(19,27,23,.56); backdrop-filter: blur(2px); opacity: 0; visibility: hidden;
  transition: opacity .18s ease, visibility .18s ease;
}
.grave-modal-overlay.is-open { opacity: 1; visibility: visible; }
.grave-modal {
  width: min(700px,100%); max-height: calc(100vh - 44px); overflow: hidden; border: 1px solid rgba(255,255,255,.72);
  border-radius: 10px; background: #fff; box-shadow: 0 24px 70px rgba(15,30,22,.25);
  transform: translateY(10px) scale(.99); transition: transform .18s ease;
}
.grave-modal-overlay.is-open .grave-modal { transform: translateY(0) scale(1); }
.grave-modal-header { display: flex; align-items: center; justify-content: space-between; min-height: 58px; padding: 0 20px; border-bottom: 1px solid #e8ece9; }
.grave-modal-header h2 { margin: 0; color: #1d2922; font-size: 18px; }
.grave-modal-close { width: 32px; min-height: 32px; padding: 0; color: #68736c; background: transparent; box-shadow: none; font-size: 26px; font-weight: 300; }
.grave-modal-close:hover { color: #1f7a4d; background: #eef5f1; }
.grave-modal-form { display: flex; flex-direction: column; max-height: calc(100vh - 102px); }
.grave-modal-body { padding: 18px 20px 8px; overflow-y: auto; }
.grave-form-section { min-width: 0; margin: 0 0 18px; padding: 0; border: 0; }
.grave-form-section legend { width: 100%; margin: 0 0 12px; padding: 0 0 0 10px; border-left: 3px solid #1f7a4d; color: #26352d; font-size: 14px; font-weight: 700; line-height: 16px; }
.grave-form-grid { display: grid; gap: 11px 12px; }
.grave-grid-three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.grave-grid-two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.grave-span-two { grid-column: span 2; }
.grave-field { min-width: 0; }
.grave-field label { margin-bottom: 4px; color: #3c4841; font-size: 12px; font-weight: 600; }
.grave-field input, .grave-field select, .grave-field textarea { min-height: 36px; height: 36px; padding: 6px 9px; border-color: #dbe1dd; border-radius: 6px; font-size: 13px; }
.grave-field textarea { height: 68px; min-height: 68px; resize: vertical; }
.grave-modal-footer { display: flex; flex: 0 0 auto; justify-content: flex-end; gap: 9px; padding: 12px 20px; border-top: 1px solid #e8ece9; background: #fbfcfb; }
.grave-modal-footer button { min-width: 82px; min-height: 34px; height: 34px; padding: 0 15px; box-shadow: none; font-size: 13px; }
.grave-cancel-button { color: #56625b; border: 1px solid #d6ddd8; background: #fff; }
.grave-cancel-button:hover { color: #26352d; background: #f3f5f4; }
.grave-save-button { background: #1f7a4d; }

@media (max-width: 720px) {
  .grave-list-header, .grave-list-tools { align-items: stretch; flex-direction: column; }
  .grave-search-form { width: 100%; }
  .grave-search-form input { width: 100%; }
  .grave-modal-overlay { align-items: flex-end; padding: 10px; }
  .grave-modal { max-height: calc(100vh - 20px); }
  .grave-modal-form { max-height: calc(100vh - 78px); }
  .grave-modal-body { padding: 16px 15px 6px; }
  .grave-grid-three, .grave-grid-two { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .grave-span-two { grid-column: span 2; }
  .grave-modal-footer { padding: 10px 15px; }
}

@media (max-width: 480px) {
  .grave-grid-three, .grave-grid-two { grid-template-columns: 1fr; }
  .grave-span-two { grid-column: auto; }
}

/* Grave modal reference layout */
.grave-admin-page { min-width: 0; padding: 28px; background: #f4f6f5; }
.grave-list-panel { min-height: calc(100vh - 56px); border: 1px solid #e5e9e6; border-radius: 8px; background: #fff; }
.grave-list-header { min-height: 76px; padding: 0 24px; }
.grave-list-header h2 { margin: 0; color: #19241e; font-size: 19px; font-weight: 700; }
.grave-list-tools { gap: 12px; }
.grave-filter-toggle, .grave-add-button {
  min-height: 38px; height: 38px; padding: 0 17px; border-radius: 6px; box-shadow: none; font-size: 13px;
}
.grave-filter-toggle { color: #27342d; border: 1px solid #dce2de; background: #fff; }
.grave-filter-toggle:hover { color: #1f7a4d; background: #f5f8f6; }
.grave-add-button { min-width: 120px; }
.grave-search-form {
  display: none; align-items: center; gap: 9px; margin: 0; padding: 13px 24px;
  border-bottom: 1px solid #e7ebe8; background: #fafbfa;
}
.grave-search-form.is-open { display: flex; }
.grave-search-form input { width: 320px; }
.grave-list-panel > .table-wrap { border: 0; border-radius: 0; }
.grave-list-table th, .grave-list-table td { padding: 17px 24px; border-bottom-color: #edf0ee; }
.grave-list-table th { color: #5f6963; background: #fafbfa; font-size: 13px; font-weight: 600; }
.grave-list-table td { font-size: 13px; }

.grave-modal-overlay {
  padding: 30px;
  background: rgba(24,29,26,.47);
  backdrop-filter: blur(1px) grayscale(.15);
}
.grave-modal {
  width: min(716px,100%);
  max-height: calc(100vh - 60px);
  border: 1px solid #e4e8e5;
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(20,29,24,.23);
}
.grave-modal-header { min-height: 68px; padding: 0 28px; }
.grave-modal-header h2 { font-size: 19px; font-weight: 700; }
.grave-modal-close { width: 30px; min-height: 30px; height: 30px; font-size: 25px; }
.grave-modal-form { max-height: calc(100vh - 128px); }
.grave-modal-body { padding: 24px 28px 8px; }
.grave-form-section { margin-bottom: 25px; }
.grave-form-section legend {
  margin-bottom: 17px; padding-left: 10px; border-left-width: 4px; border-radius: 2px;
  color: #25322b; font-size: 14px; line-height: 18px;
}
.grave-form-grid { gap: 17px 20px; }
.grave-grid-three, .grave-grid-fees { grid-template-columns: repeat(3,minmax(0,1fr)); }
.grave-field label { margin-bottom: 7px; color: #344139; font-size: 13px; font-weight: 600; }
.grave-field input, .grave-field select, .grave-field textarea {
  min-height: 42px; height: 42px; padding: 8px 12px; border: 1px solid #dce2de;
  border-radius: 6px; color: #26322c; background: #fff; font-size: 13px; box-shadow: none;
}
.grave-field input::placeholder, .grave-field textarea::placeholder { color: #a5ada8; }
.grave-field textarea { height: 70px; min-height: 70px; padding-right: 54px; }
.grave-remark-field { position: relative; }
.grave-character-count { position: absolute; right: 10px; bottom: 8px; color: #909a94; font-size: 11px; }
.grave-character-count b { color: inherit; font-weight: 400; }
.grave-modal-footer { gap: 15px; padding: 12px 28px 26px; border-top: 0; background: #fff; }
.grave-modal-footer button { min-width: 100px; min-height: 38px; height: 38px; font-size: 13px; }
.grave-save-button { background: #1f7a4d; }

@media (max-width: 800px) {
  .grave-admin-page { padding: 14px; }
  .grave-list-panel { min-height: calc(100vh - 28px); }
  .grave-list-header { min-height: auto; padding: 14px; }
  .grave-search-form { padding: 12px 14px; }
  .grave-search-form input { width: 100%; }
  .grave-modal-overlay { align-items: center; padding: 12px; }
  .grave-modal { max-height: calc(100vh - 24px); border-radius: 10px; }
  .grave-modal-form { max-height: calc(100vh - 92px); }
  .grave-modal-header { min-height: 60px; padding: 0 18px; }
  .grave-modal-body { padding: 20px 18px 6px; }
  .grave-modal-footer { padding: 11px 18px 18px; }
}

@media (max-width: 600px) {
  .grave-list-header, .grave-list-tools, .grave-search-form { align-items: stretch; flex-direction: column; }
  .grave-filter-toggle, .grave-add-button { width: 100%; }
  .grave-grid-three, .grave-grid-fees { grid-template-columns: 1fr; }
  .grave-span-two { grid-column: auto; }
}

/* Modern admin dashboard */
.modern-sidebar {
  position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 22px 14px 16px;
  border-right: 1px solid #e8ece9; background: #fff; color: #35423b;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; border-bottom: 1px solid #edf0ee; }
.sidebar-brand > span { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; background: #1f7a4d; color: #fff; font-size: 18px; font-weight: 800; }
.sidebar-brand > span.sidebar-brand-logo { overflow: hidden; padding: 0; background: #eef5f1; }
.sidebar-brand-logo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sidebar-brand div { min-width: 0; }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand strong { color: #17231c; font-size: 15px; white-space: nowrap; }
.sidebar-brand small { margin-top: 3px; color: #9aa39e; font-size: 10px; }
.sidebar-nav { display: grid; gap: 4px; margin-top: 18px; }
.modern-sidebar .sidebar-nav a {
  display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 11px; border-radius: 7px;
  color: #657069; font-size: 13px; font-weight: 500;
}
.sidebar-nav a i { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 5px; background: #f1f4f2; color: #849089; font-size: 9px; font-style: normal; }
.modern-sidebar .sidebar-nav a:hover { color: #1f7a4d; background: #f3f8f5; }
.modern-sidebar .sidebar-nav a.active { color: #1f7a4d; background: #eaf5ee; font-weight: 700; }
.sidebar-nav a.active i { color: #fff; background: #1f7a4d; }
.sidebar-secondary { display: grid; gap: 2px; margin-top: 22px; padding-top: 14px; border-top: 1px solid #edf0ee; }
.sidebar-secondary span { padding: 0 11px 7px; color: #a0a8a3; font-size: 10px; }
.modern-sidebar .sidebar-secondary a { padding: 6px 11px; color: #768079; font-size: 12px; }
.modern-sidebar .sidebar-secondary a:hover { color: #1f7a4d; }
.modern-sidebar .sidebar-logout { margin-top: auto; padding: 10px 11px; border-radius: 7px; color: #9b5b55; background: #fff5f3; font-size: 12px; text-align: center; }

.dashboard-layout { grid-template-columns: 220px minmax(0,1fr); background: #f3f5f4; }
.dashboard-page { min-width: 0; padding: 0 24px 34px; background: #f3f5f4; }
.dashboard-topbar { display: flex; align-items: center; justify-content: space-between; min-height: 64px; margin: 0 -24px; padding: 0 24px; border-bottom: 1px solid #e8ece9; background: #fff; }
.dashboard-breadcrumb { display: flex; gap: 9px; align-items: center; font-size: 12px; }
.dashboard-breadcrumb span, .dashboard-breadcrumb b { color: #9aa39e; font-weight: 400; }
.dashboard-breadcrumb strong { color: #435049; }
.dashboard-account { display: flex; align-items: center; gap: 9px; }
.dashboard-notice { position: relative; width: 34px; min-height: 34px; padding: 0; border: 1px solid #e3e8e5; border-radius: 8px; background: #fff; box-shadow: none; }
.dashboard-notice span { position: absolute; left: 50%; top: 8px; width: 12px; height: 13px; margin-left: -6px; border: 1.8px solid #6e7b73; border-radius: 7px 7px 4px 4px; }
.dashboard-notice span::after { content: ""; position: absolute; left: 3px; bottom: -5px; width: 4px; height: 2px; border-radius: 2px; background: #6e7b73; }
.dashboard-notice::after { content: ""; position: absolute; right: 6px; top: 5px; width: 5px; height: 5px; border-radius: 50%; background: #e05252; }
.dashboard-avatar { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; background: #dcefe4; color: #1f7a4d; font-size: 13px; font-weight: 700; }
.dashboard-account strong, .dashboard-account small { display: block; line-height: 1.3; }
.dashboard-account strong { color: #2b3730; font-size: 12px; }
.dashboard-account small { color: #9aa39e; font-size: 9px; }
.dashboard-account-menu { margin-left: 5px; color: #87918b; font-size: 11px; }
.dashboard-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; padding: 24px 0 18px; }
.dashboard-heading h1 { margin: 0; color: #17231c; font-size: 24px; letter-spacing: 0; }
.dashboard-heading p { margin: 6px 0 0; color: #8a958e; font-size: 12px; }
.dashboard-heading > span { padding: 5px 9px; border: 1px solid #dce8e0; border-radius: 5px; color: #478260; background: #f1f8f4; font-size: 10px; }
.dashboard-card { min-width: 0; border: 1px solid #e6ebe8; border-radius: 12px; background: #fff; box-shadow: 0 7px 22px rgba(34,61,47,.045); }
.dashboard-metrics { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 12px; }
.metric-card { display: flex; align-items: flex-start; gap: 11px; min-height: 112px; padding: 17px 14px; }
.metric-icon { position: relative; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 9px; background: #eaf5ee; }
.metric-icon span { position: absolute; inset: 9px; border: 2px solid #1f7a4d; border-radius: 4px; }
.metric-icon.normal { background: #edf7f1; }.metric-icon.normal span { border-radius: 50%; }
.metric-icon.overdue { background: #fff1ef; }.metric-icon.overdue span { border-color: #d65a4a; transform: rotate(45deg); }
.metric-icon.year,.metric-icon.month,.metric-icon.today { background: #fff6e8; }.metric-icon.year span,.metric-icon.month span,.metric-icon.today span { border-color: #d59534; border-radius: 50%; }
.metric-copy { min-width: 0; }
.metric-copy p { margin: 0 0 7px; color: #7f8a84; font-size: 11px; white-space: nowrap; }
.metric-copy strong { display: block; overflow: hidden; color: #17231c; font-size: clamp(17px,1.45vw,23px); line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.metric-copy small { display: block; margin-top: 8px; color: #1f8a55; font-size: 9px; }
.metric-copy small.down { color: #d25349; }
.metric-copy small em { margin-left: 3px; color: #a1aaa5; font-style: normal; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 14px; margin-top: 14px; }
.dashboard-grid-main { grid-template-columns: minmax(0,2fr) minmax(270px,1fr); }
.chart-card, .rate-card, .status-card, .forecast-card { min-height: 328px; padding: 18px; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-heading h2 { margin: 0; color: #26332c; font-size: 14px; }
.card-heading p { margin: 5px 0 0; color: #9aa39e; font-size: 10px; }
.card-heading > span, .card-heading > a { color: #97a19b; font-size: 10px; }
.card-heading > a { color: #1f7a4d; }
.chart-box { position: relative; height: 250px; margin-top: 12px; }
.chart-tooltip { position: absolute; z-index: 3; display: none; min-width: 105px; padding: 7px 9px; border: 1px solid #e0e6e2; border-radius: 6px; background: rgba(255,255,255,.96); box-shadow: 0 6px 18px rgba(30,50,39,.12); pointer-events: none; }
.chart-tooltip.show { display: block; }
.chart-tooltip strong,.chart-tooltip span { display: block; font-size: 10px; }
.chart-tooltip strong { color: #67736c; }.chart-tooltip span { margin-top: 3px; color: #1f7a4d; font-weight: 700; }
.rate-gauge { --gauge-color: #1f7a4d; position: relative; display: grid; width: 170px; height: 170px; margin: 24px auto 18px; place-items: center; border-radius: 50%; background: conic-gradient(var(--gauge-color) calc(var(--rate) * 1%),#edf1ee 0); }
.rate-gauge.warning { --gauge-color: #e5a13a; }.rate-gauge.danger { --gauge-color: #d65a4a; }
.rate-gauge::before { content: ""; position: absolute; inset: 18px; border-radius: 50%; background: #fff; }
.rate-gauge div { position: relative; z-index: 1; text-align: center; }
.rate-gauge strong,.rate-gauge span { display: block; }.rate-gauge strong { color: #1d2b23; font-size: 28px; }.rate-gauge span { margin-top: 4px; color: #99a29d; font-size: 10px; }
.rate-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.rate-card dl div { padding: 10px; border-radius: 7px; background: #f7f9f8; text-align: center; }
.rate-card dt { color: #929c96; font-size: 10px; }.rate-card dd { margin: 4px 0 0; color: #344139; font-size: 14px; font-weight: 700; }
.status-content { display: grid; grid-template-columns: 180px 1fr; align-items: center; gap: 25px; min-height: 245px; }
.donut-chart { position: relative; display: grid; width: 165px; height: 165px; place-items: center; border-radius: 50%; background: #edf1ee; }
.donut-chart::before { content: ""; position: absolute; inset: 24px; border-radius: 50%; background: #fff; }
.donut-chart div { position: relative; z-index: 1; text-align: center; }.donut-chart strong,.donut-chart span { display: block; }.donut-chart strong { color: #223128; font-size: 22px; }.donut-chart span { margin-top: 4px; color: #9aa39e; font-size: 9px; }
.status-content ul { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.status-content li { display: grid; grid-template-columns: 7px 1fr auto auto; align-items: center; gap: 8px; color: #748078; font-size: 10px; }
.status-content li i { width: 7px; height: 7px; border-radius: 50%; }.status-content li strong { color: #3a473f; font-size: 11px; }.status-content li em { width: 38px; color: #9da6a1; font-style: normal; text-align: right; }
.forecast-list { display: grid; gap: 10px; margin-top: 20px; }
.forecast-list div { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 16px; border: 1px solid #e7ece9; border-radius: 9px; background: #fafcfb; }
.forecast-list span { color: #7e8983; font-size: 11px; }.forecast-list strong { color: #1f7a4d; font-size: 18px; }.forecast-list a { grid-column: 1/-1; color: #9ca59f; font-size: 9px; }
.warning-center { margin-top: 14px; padding: 18px; }
.warning-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 10px; margin-top: 15px; }
.warning-item { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 9px; min-height: 78px; padding: 12px; border: 1px solid #e8ece9; border-radius: 9px; background: #fbfcfb; }
.warning-item > span { width: 8px; height: 34px; border-radius: 5px; background: #e5a13a; }.warning-item.danger > span { background: #d65a4a; }.warning-item.muted > span { background: #9aa5a0; }
.warning-item p { margin: 0 0 4px; color: #78837d; font-size: 10px; }.warning-item strong { color: #25332b; font-size: 19px; }.warning-item strong small { margin-left: 2px; color: #9aa39e; font-size: 9px; font-weight: 400; }.warning-item b { color: #a0aaa4; font-size: 9px; font-weight: 400; }
.dashboard-quick-actions { position: fixed; z-index: 20; right: 20px; bottom: 20px; display: flex; gap: 6px; padding: 6px; border: 1px solid #e2e8e4; border-radius: 10px; background: rgba(255,255,255,.95); box-shadow: 0 10px 30px rgba(31,62,45,.14); }
.dashboard-quick-actions a { display: flex; align-items: center; gap: 5px; min-height: 32px; padding: 0 9px; border-radius: 6px; color: #557063; font-size: 12px; }
.dashboard-quick-actions a:hover { color: #fff; background: #1f7a4d; }

@media (max-width: 1400px) {
  .dashboard-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .warning-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 1050px) {
  .dashboard-grid,.dashboard-grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .modern-sidebar { position: static; height: auto; }
  .dashboard-layout { grid-template-columns: 1fr; }
  .dashboard-page { padding: 0 12px 28px; }
  .dashboard-topbar { margin: 0 -12px; padding: 0 12px; }
  .dashboard-account-menu,.dashboard-account > div:nth-of-type(2) { display: none; }
  .dashboard-heading { align-items: flex-start; flex-direction: column; }
  .dashboard-metrics,.warning-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .status-content { grid-template-columns: 1fr; justify-items: center; }
  .status-content ul { width: 100%; }
  .dashboard-quick-actions { right: 10px; bottom: 10px; }
  .dashboard-quick-actions span { display: none; }
}

/* Compact dashboard density */
.dashboard-page { padding: 0 16px 20px; }
.dashboard-topbar { min-height: 52px; margin: 0 -16px; padding: 0 16px; }
.dashboard-metrics { gap: 9px; margin-top: 12px; }
.metric-card { min-height: 82px; gap: 8px; padding: 11px 10px; border-radius: 10px; }
.metric-icon { flex-basis: 28px; width: 28px; height: 28px; border-radius: 7px; }
.metric-icon span { inset: 7px; }
.metric-copy p { margin-bottom: 4px; font-size: 10px; }
.metric-copy strong { font-size: clamp(15px,1.25vw,20px); }
.metric-copy small { margin-top: 5px; font-size: 8px; }
.dashboard-grid { gap: 9px; margin-top: 9px; }
.dashboard-grid-overview { grid-template-columns: minmax(0,2.1fr) minmax(210px,.9fr) minmax(260px,1.15fr); }
.dashboard-grid-analysis { grid-template-columns: minmax(0,1.45fr) minmax(0,1fr) minmax(230px,.78fr); }
.chart-card, .rate-card, .status-card, .forecast-card { min-height: 242px; padding: 12px; border-radius: 10px; }
.card-heading h2 { font-size: 12px; }
.card-heading p { margin-top: 3px; font-size: 9px; }
.chart-box { height: 188px; margin-top: 7px; }
.rate-gauge { width: 120px; height: 120px; margin: 10px auto 9px; }
.rate-gauge::before { inset: 14px; }
.rate-gauge strong { font-size: 22px; }
.rate-card dl { gap: 6px; }
.rate-card dl div { padding: 6px; }
.rate-card dt { font-size: 9px; }
.rate-card dd { margin-top: 2px; font-size: 11px; }
.status-content { grid-template-columns: 118px 1fr; gap: 12px; min-height: 185px; }
.donut-chart { width: 112px; height: 112px; }
.donut-chart::before { inset: 18px; }
.donut-chart strong { font-size: 16px; }
.status-content ul { gap: 8px; }
.status-content li { grid-template-columns: 6px 1fr auto auto; gap: 5px; font-size: 9px; }
.status-content li strong { font-size: 9px; }
.status-content li em { width: 31px; font-size: 8px; }
.forecast-list { gap: 7px; margin-top: 10px; }
.forecast-list div { gap: 3px; padding: 10px; border-radius: 7px; }
.forecast-list span { font-size: 9px; }
.forecast-list strong { font-size: 14px; }
.forecast-list a { font-size: 8px; }
.dashboard-bottom-grid { display: grid; grid-template-columns: minmax(0,3.2fr) minmax(220px,.8fr); gap: 9px; margin-top: 9px; }
.warning-center { margin-top: 0; padding: 12px; border-radius: 10px; }
.warning-grid { gap: 7px; margin-top: 9px; }
.warning-item { grid-template-columns: 5px 1fr; gap: 7px; min-height: 61px; padding: 8px; border-radius: 7px; }
.warning-item > span { width: 5px; height: 27px; }
.warning-item p { margin-bottom: 2px; font-size: 9px; }
.warning-item strong { font-size: 15px; }
.warning-item b { display: none; }
.dashboard-quick-card { padding: 12px; }
.dashboard-quick-actions { position: static; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; margin-top: 15px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.dashboard-quick-actions a { display: grid; min-height: 70px; padding: 7px 3px; place-items: center; gap: 3px; border-radius: 8px; color: #1f7a4d; background: #f0f7f3; font-size: 18px; }
.dashboard-quick-actions a span { display: block; color: #65746b; font-size: 9px; white-space: nowrap; }

@media (max-width: 1250px) {
  .dashboard-grid-overview { grid-template-columns: minmax(0,1.8fr) minmax(210px,.8fr); }
  .dashboard-grid-overview .status-card { grid-column: 1 / -1; }
  .dashboard-grid-overview .status-content { grid-template-columns: 130px 1fr; }
  .dashboard-grid-overview .status-content ul { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .dashboard-grid-analysis { grid-template-columns: 1fr 1fr; }
  .dashboard-grid-analysis .forecast-card { grid-column: 1 / -1; }
  .dashboard-grid-analysis .forecast-list { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 900px) {
  .dashboard-grid-overview,.dashboard-grid-analysis,.dashboard-bottom-grid { grid-template-columns: 1fr; }
  .dashboard-grid-overview .status-card,.dashboard-grid-analysis .forecast-card { grid-column: auto; }
  .warning-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 700px) {
  .dashboard-page { padding: 0 10px 18px; }
  .dashboard-topbar { margin: 0 -10px; padding: 0 10px; }
  .dashboard-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-grid-overview .status-content { grid-template-columns: 1fr; }
  .dashboard-grid-overview .status-content ul { grid-template-columns: 1fr; }
  .dashboard-grid-analysis .forecast-list { grid-template-columns: 1fr; }
  .warning-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-quick-actions span { display: block; }
}

/* Compact system settings */
.settings-page { min-width: 0; padding: 18px; background: #f3f5f4; }
.settings-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.settings-header h1 { margin: 0; color: #18251e; font-size: 20px; }
.settings-header p { margin: 4px 0 0; color: #8c9790; font-size: 10px; }
.settings-save-top, .settings-footer button { min-height: 34px; height: 34px; padding: 0 16px; border-radius: 6px; background: #1f7a4d; box-shadow: none; font-size: 12px; }
.settings-message { margin-bottom: 10px; padding: 8px 11px; border-radius: 7px; font-size: 11px; }
.settings-message.success { color: #1f7048; border: 1px solid #cee5d7; background: #eef8f2; }
.settings-message.error { color: #a84940; border: 1px solid #efd5d1; background: #fff3f1; }
.settings-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.settings-section { padding: 13px; border-radius: 10px; box-shadow: 0 5px 18px rgba(34,61,47,.04); }
.settings-brand-section, .settings-form .settings-section:last-of-type, .settings-footer { grid-column: 1 / -1; }
.settings-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 11px; padding-bottom: 9px; border-bottom: 1px solid #edf0ee; }
.settings-section-heading h2 { margin: 0; color: #27342d; font-size: 13px; }
.settings-section-heading p { margin: 3px 0 0; color: #9aa39e; font-size: 9px; }
.settings-grid { display: grid; gap: 9px 11px; }
.settings-grid.two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.settings-grid.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.settings-field.full { grid-column: 1 / -1; }
.settings-field label { margin-bottom: 4px; color: #536058; font-size: 10px; font-weight: 600; }
.settings-field input, .settings-field select, .settings-field textarea { min-height: 34px; height: 34px; padding: 5px 8px; border-color: #dce3de; border-radius: 6px; font-size: 11px; }
.settings-field textarea { height: 76px; min-height: 76px; resize: vertical; }
.settings-brand-grid { display: grid; grid-template-columns: 68px 190px minmax(220px,1fr); align-items: center; gap: 12px; }
.settings-logo-preview { display: grid; width: 62px; height: 62px; overflow: hidden; place-items: center; border: 1px dashed #cfdad3; border-radius: 10px; color: #1f7a4d; background: #eff7f2; font-size: 22px; font-weight: 800; }
.settings-logo-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.settings-logo-actions { display: grid; justify-items: start; gap: 5px; }
.settings-upload-button { display: inline-flex; align-items: center; min-height: 29px; margin: 0; padding: 0 10px; border: 1px solid #d4dfd8; border-radius: 5px; color: #1f7a4d; background: #fff; font-size: 10px; cursor: pointer; }
.settings-upload-button input { display: none; }
.settings-remove-logo { display: flex; align-items: center; gap: 5px; margin: 0; color: #a1544c; font-size: 9px; }
.settings-remove-logo input { width: 12px; height: 12px; min-height: 12px; }
.settings-logo-actions small { color: #9ca59f; font-size: 8px; }
.settings-field-hint { display: block; margin-top: 4px; color: #9ca59f; font-size: 8px; line-height: 1.5; }
.settings-system-name { max-width: 420px; }
.settings-switch { display: flex; align-items: center; gap: 6px; margin: 0; color: #65726a; font-size: 10px; cursor: pointer; }
.settings-switch input { position: absolute; opacity: 0; pointer-events: none; }
.settings-switch span { position: relative; width: 30px; height: 16px; border-radius: 10px; background: #cbd3ce; transition: .16s ease; }
.settings-switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: .16s ease; }
.settings-switch input:checked + span { background: #1f7a4d; }
.settings-switch input:checked + span::after { transform: translateX(14px); }
.settings-footer { display: flex; justify-content: flex-end; padding-top: 2px; }
.sensitive-setting > div { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px; align-items: start; }
.sensitive-setting > div > input[type="hidden"] { display: none; }
.sensitive-setting button { min-height: 34px; height: 34px; padding: 0 10px; border: 1px solid #d4dfd8; color: #1f7a4d; background: #f5f9f6; box-shadow: none; font-size: 10px; }
.sensitive-setting textarea { grid-column: 1; }
.sensitive-setting button:disabled { color: #7f8d84; background: #edf1ee; opacity: 1; }
.sms-test-button { width: auto; min-height: 30px; height: 30px; margin-top: 6px; padding: 0 10px; border: 1px solid #cfe0d5; border-radius: 6px; color: #1f7a4d; background: #eff7f2; box-shadow: none; font-size: 10px; }
.invoice-notify-option { display: flex; align-items: center; gap: 7px; margin-top: 12px; color: #4f5f56; font-size: 12px; }
.invoice-notify-option input { width: 15px; height: 15px; min-height: 15px; }
.sms-filter-section { margin-bottom: 10px; }
.sms-filter-form { display: grid; grid-template-columns: minmax(180px,1.5fr) repeat(2,minmax(130px,1fr)) auto auto; gap: 9px; align-items: end; }
.sms-filter-form button,.sms-filter-form .btn { min-height: 34px; height: 34px; margin: 0; padding: 0 14px; font-size: 11px; white-space: nowrap; }
.sms-record-list .audit-table { min-width: 900px; }
.sms-status { display: inline-flex; padding: 3px 7px; border-radius: 5px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.sms-status.sent { color: #1f7a4d; background: #eaf5ee; }
.sms-status.failed { color: #b2463c; background: #fff0ee; }
.sms-status.pending { color: #9a6a22; background: #fff7e8; }
.sms-record-list td small { display: block; margin-top: 3px; color: #929c96; font-size: 9px; }
.sms-retry-button { min-height: 29px; height: 29px; padding: 0 9px; border: 1px solid #cfe0d5; color: #1f7a4d; background: #fff; box-shadow: none; font-size: 10px; }
@media (max-width: 900px) {
  .sms-filter-form { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .sms-filter-form button,.sms-filter-form .btn { width: 100%; }
}
.audit-page { min-width: 0; padding: 18px; background: #f3f5f4; }
.audit-count { color: #7f8c84; font-size: 10px; }
.audit-list { overflow: hidden; padding: 0; border-radius: 10px; }
.audit-list .table-wrap { border: 0; border-radius: 0; }
.audit-table { min-width: 980px; }
.audit-table th,.audit-table td { padding: 10px 12px; vertical-align: top; font-size: 11px; }
.audit-action { display: inline-flex; padding: 4px 7px; border-radius: 5px; color: #1f7a4d; background: #eaf5ee; font-size: 10px; white-space: nowrap; }
.audit-detail { min-width: 390px; }
.audit-entity { margin-bottom: 4px; color: #536159; font-size: 10px; font-weight: 700; }
.audit-detail details { margin-top: 4px; }
.audit-detail summary { color: #1f7a4d; font-size: 10px; cursor: pointer; }
.audit-changes { display: grid; gap: 4px; margin-top: 6px; }
.audit-changes div { display: grid; grid-template-columns: 110px minmax(70px,1fr) 18px minmax(70px,1fr); gap: 5px; padding: 5px 7px; border-radius: 5px; background: #f7f9f8; }
.audit-changes b { color: #526058; }.audit-changes span { color: #a0645d; overflow-wrap: anywhere; }.audit-changes i { color: #9ba49f; font-style: normal; text-align: center; }.audit-changes strong { color: #1f7048; overflow-wrap: anywhere; }
.audit-no-change { color: #9aa39e; font-size: 9px; }
.audit-detail pre { max-width: 560px; max-height: 180px; margin: 5px 0 0; padding: 7px; overflow: auto; border-radius: 5px; background: #f7f9f8; color: #657169; font-size: 9px; white-space: pre-wrap; }

@media (max-width: 1050px) {
  .settings-form { grid-template-columns: 1fr; }
  .settings-brand-section, .settings-form .settings-section:last-of-type, .settings-footer { grid-column: auto; }
  .settings-grid.three { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 700px) {
  .settings-page { padding: 12px; }
  .settings-header { align-items: flex-start; }
  .settings-save-top { display: none; }
  .settings-brand-grid { grid-template-columns: 62px 1fr; }
  .settings-system-name { grid-column: 1 / -1; max-width: none; }
  .settings-grid.two, .settings-grid.three { grid-template-columns: 1fr; }
  .settings-field.full { grid-column: auto; }
  .settings-footer button { width: 100%; }
  .memorial-features, .memorial-wrap, .wrap, .shop-wrap, .detail-wrap, .compact-detail-wrap { max-width: 100%; }
  .memorial-features { left: auto; right: auto; }
}

/* Modern system login */
.modern-login-body { background: #edf4ef; }
.modern-login-page {
  position: relative; display: grid; min-height: 100vh; padding: 28px; overflow: hidden; place-items: center;
  background:
    radial-gradient(circle at 18% 15%, rgba(255,255,255,.95), rgba(255,255,255,0) 30%),
    radial-gradient(circle at 85% 82%, rgba(170,207,184,.34), rgba(170,207,184,0) 31%),
    linear-gradient(145deg,#f4f8f5 0%,#e9f2ec 48%,#dfece4 100%);
}
.modern-login-page::before, .modern-login-page::after {
  content: ""; position: absolute; pointer-events: none; opacity: .32;
}
.modern-login-page::before { left: -5%; bottom: -8%; width: 48%; height: 38%; border-radius: 50% 70% 0 0; background: linear-gradient(145deg,transparent 24%,#98b7a3 25% 27%,transparent 28% 39%,#b5cabb 40% 42%,transparent 43%); transform: rotate(-5deg); }
.modern-login-page::after { right: -10%; top: -20%; width: 45%; height: 65%; border-radius: 50%; background: rgba(255,255,255,.7); filter: blur(2px); }
.modern-login-card {
  position: relative; z-index: 1; width: min(420px,100%); padding: 25px 27px 20px;
  border: 1px solid rgba(255,255,255,.82); border-radius: 12px; background: rgba(255,255,255,.97);
  box-shadow: 0 24px 70px rgba(31,74,50,.16);
}
.modern-login-brand { display: flex; align-items: center; gap: 10px; }
.modern-login-brand > img, .modern-login-brand > span { display: grid; width: 40px; height: 40px; overflow: hidden; place-items: center; border-radius: 9px; color: #fff; background: #1f7a4d; object-fit: cover; font-size: 18px; font-weight: 800; }
.modern-login-brand strong, .modern-login-brand small { display: block; }
.modern-login-brand strong { max-width: 285px; overflow: hidden; color: #1c2922; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.modern-login-brand small { margin-top: 3px; color: #9aa39e; font-size: 9px; }
.modern-login-heading { margin: 24px 0 17px; }
.modern-login-heading h1 { margin: 0; color: #19271f; font-size: 20px; letter-spacing: 0; }
.modern-login-heading p { margin: 6px 0 0; color: #929c96; font-size: 10px; }
.login-error { margin-bottom: 12px; padding: 8px 10px; border: 1px solid #f0d1cd; border-radius: 6px; color: #b84f46; background: #fff3f1; font-size: 10px; }
.modern-login-form { display: grid; gap: 12px; }
.login-field label { margin-bottom: 5px; color: #4d5b53; font-size: 11px; font-weight: 600; }
.login-field input {
  min-height: 40px; height: 40px; padding: 7px 10px; border: 1px solid #dce4df; border-radius: 7px;
  color: #25332b; background: #fff; font-size: 12px; transition: border-color .16s ease,box-shadow .16s ease;
}
.login-field input:focus { border-color: #4a9a70; box-shadow: 0 0 0 3px rgba(31,122,77,.1); }
.login-captcha-row { display: grid; grid-template-columns: minmax(0,1fr) 82px 34px; gap: 7px; }
.login-captcha-code {
  min-height: 40px; height: 40px; padding: 0; border: 1px solid #cfe0d5; border-radius: 7px; color: #1f7048;
  background: repeating-linear-gradient(-30deg,#eff7f2 0,#eff7f2 6px,#e5f1e9 6px,#e5f1e9 12px); box-shadow: none;
  font-family: Consolas,monospace; font-size: 18px; font-weight: 800; letter-spacing: 4px;
}
.login-captcha-code img { display: block; width: 100%; height: 100%; border-radius: 6px; object-fit: cover; pointer-events: none; }
.login-captcha-refresh { min-height: 40px; height: 40px; padding: 0; border: 1px solid #dce4df; border-radius: 7px; color: #66756c; background: #fff; box-shadow: none; font-size: 19px; }
.login-captcha-code:hover,.login-captcha-refresh:hover { color: #1f7a4d; background-color: #edf7f1; }
.login-captcha-code.refreshing { animation: captchaPulse .32s ease; }
.login-captcha-refresh.refreshing { animation: captchaRotate .32s ease; }
.login-options { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.login-options label { display: flex; align-items: center; gap: 5px; margin: 0; color: #758078; font-size: 10px; }
.login-options input { width: 13px; height: 13px; min-height: 13px; accent-color: #1f7a4d; }
.login-options a { color: #1f7a4d; font-size: 10px; }
.modern-login-submit { min-height: 41px; height: 41px; margin-top: 1px; border-radius: 7px; background: #1f7a4d; box-shadow: 0 8px 18px rgba(31,122,77,.2); font-size: 13px; font-weight: 700; transition: transform .12s ease,background .16s ease; }
.modern-login-submit:hover { background: #185f3c; }
.modern-login-submit:active { transform: translateY(1px) scale(.995); }
.other-login { display: grid; grid-template-columns: 1fr; gap: 9px; margin-top: 18px; text-align: center; }
.other-login span { position: relative; color: #a0a9a4; font-size: 9px; }
.other-login span::before,.other-login span::after { content: ""; position: absolute; top: 50%; width: 33%; height: 1px; background: #edf0ee; }
.other-login span::before { left: 0; }.other-login span::after { right: 0; }
.other-login button { min-height: 34px; height: 34px; border: 1px solid #dce5df; border-radius: 7px; color: #527260; background: #f7faf8; box-shadow: none; font-size: 11px; }
.other-login button:hover { color: #1f7a4d; background: #eff7f2; }
.modern-login-footer { margin-top: 16px; color: #a3aca7; font-size: 9px; text-align: center; }
@keyframes captchaRotate { to { transform: rotate(180deg); } }
@keyframes captchaPulse { 50% { opacity: .42; transform: scale(.97); } }

@media (max-width: 520px) {
  .modern-login-page { padding: 14px; }
  .modern-login-card { padding: 22px 18px 18px; border-radius: 10px; }
  .modern-login-heading { margin-top: 20px; }
  .modern-login-heading h1 { font-size: 18px; }
}

/* Public floating customer service */
.customer-service-float {
  position: fixed; z-index: 800; right: 16px; bottom: calc(22px + env(safe-area-inset-bottom));
  display: grid; width: 52px; height: 52px; min-height: 52px; padding: 5px; place-items: center; gap: 0;
  border: 1px solid rgba(255,255,255,.75); border-radius: 50%; color: #fff; background: #1f7a4d;
  box-shadow: 0 10px 26px rgba(31,122,77,.28); font-size: 15px; transition: transform .16s ease,background .16s ease;
}
.customer-service-float span { line-height: 1; font-size: 18px; }
.customer-service-float em { font-size: 8px; font-style: normal; line-height: 1; }
.customer-service-float:hover { background: #185f3c; transform: translateY(-2px); }
.customer-service-overlay {
  position: fixed; z-index: 900; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding: 16px;
  background: rgba(19,29,23,.5); backdrop-filter: blur(2px); opacity: 0; visibility: hidden;
  transition: opacity .18s ease,visibility .18s ease;
}
.customer-service-overlay.is-open { opacity: 1; visibility: visible; }
.customer-service-panel {
  width: 100%; max-width: 430px; max-height: calc(100vh - 32px); overflow: hidden; border: 1px solid rgba(255,255,255,.75);
  border-radius: 14px; background: #fff; box-shadow: 0 22px 65px rgba(20,38,28,.24); transform: translateY(14px);
  transition: transform .18s ease;
}
.customer-service-overlay.is-open .customer-service-panel { transform: translateY(0); }
.customer-service-panel header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 18px 13px; border-bottom: 1px solid #edf0ee; }
.customer-service-panel h2 { margin: 0; color: #213128; font-size: 16px; }
.customer-service-panel p { margin: 4px 0 0; color: #949f98; font-size: 10px; }
.customer-service-panel header button { width: 30px; min-height: 30px; height: 30px; padding: 0; color: #738078; background: #f3f6f4; box-shadow: none; font-size: 22px; }
.customer-service-list { display: grid; gap: 8px; max-height: 58vh; padding: 12px; overflow-y: auto; }
.customer-service-list a { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 9px; min-height: 52px; padding: 9px 11px; border: 1px solid #e5ebe7; border-radius: 9px; background: #fafcfb; }
.customer-service-list a:hover { border-color: #bcd5c6; background: #f0f7f3; }
.customer-service-list span { color: #35443b; font-size: 12px; font-weight: 700; }
.customer-service-list strong { color: #6f7b74; font-size: 11px; }
.customer-service-list b { padding: 5px 8px; border-radius: 5px; color: #fff; background: #1f7a4d; font-size: 10px; font-weight: 600; }

@media (min-width: 700px) {
  .customer-service-overlay { align-items: center; }
}
@media (max-width: 520px) {
  .customer-service-float { right: 12px; bottom: calc(16px + env(safe-area-inset-bottom)); width: 48px; height: 48px; min-height: 48px; }
  .customer-service-overlay { padding: 10px; }
  .customer-service-panel { max-height: calc(100vh - 20px); border-radius: 12px; }
  .customer-service-list a { grid-template-columns: 1fr auto; }
  .customer-service-list strong { grid-column: 1; }
  .customer-service-list b { grid-column: 2; grid-row: 1 / span 2; }
}

/* Payment information confirmation */
body.payment-confirm-open { overflow: hidden; }
.payment-confirm-overlay {
  position: fixed; z-index: 9500; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(20,31,25,.55); backdrop-filter: blur(2px); opacity: 0; visibility: hidden;
  transition: opacity .18s ease,visibility .18s ease;
}
.payment-confirm-overlay.is-open { opacity: 1; visibility: visible; }
.payment-confirm-modal {
  width: 100%; max-width: 480px; max-height: calc(100vh - 40px); overflow: hidden; border: 1px solid rgba(255,255,255,.72);
  border-radius: 12px; background: #fff; box-shadow: 0 24px 70px rgba(18,39,27,.25);
  transform: translateY(12px) scale(.99); transition: transform .18s ease;
}
.payment-confirm-overlay.is-open .payment-confirm-modal { transform: translateY(0) scale(1); }
.payment-confirm-modal header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid #e9eeeb; }
.payment-confirm-modal header span { display: block; margin-bottom: 3px; color: #1f7a4d; font-size: 9px; font-weight: 700; }
.payment-confirm-modal h2 { margin: 0; color: #1d2c23; font-size: 18px; }
.payment-confirm-modal header button { width: 30px; min-height: 30px; height: 30px; padding: 0; color: #718078; background: #f3f6f4; box-shadow: none; font-size: 22px; }
.payment-confirm-body { max-height: calc(100vh - 190px); padding: 13px 20px 8px; overflow-y: auto; }
.payment-confirm-body dl { display: grid; gap: 0; margin: 0; }
.payment-confirm-body dl div { display: grid; grid-template-columns: 125px minmax(0,1fr); gap: 14px; padding: 9px 0; border-bottom: 1px solid #edf0ee; }
.payment-confirm-body dt { color: #87928b; font-size: 11px; }
.payment-confirm-body dd { margin: 0; overflow-wrap: anywhere; color: #334239; font-size: 12px; font-weight: 600; text-align: right; }
.payment-confirm-body .payment-confirm-amount { margin-top: 4px; border-bottom: 0; }
.payment-confirm-amount dd { color: #b98235; font-size: 20px; font-weight: 800; }
.payment-confirm-body > p { margin: 8px 0 3px; color: #9aa39e; font-size: 9px; text-align: center; }
.payment-confirm-modal footer { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 13px 20px 18px; }
.payment-confirm-modal footer button { min-height: 40px; height: 40px; border-radius: 7px; box-shadow: none; font-size: 12px; font-weight: 700; }
.payment-confirm-cancel { color: #5f6b64; border: 1px solid #d8dfda; background: #fff; }
.payment-confirm-cancel:hover { color: #27352d; background: #f4f6f5; }
.payment-confirm-submit { background: #1f7a4d; }
.payment-confirm-submit:hover { background: #185f3c; }
.payment-confirm-modal.is-processing { cursor: wait; }
.payment-confirm-modal.is-processing .payment-confirm-body { opacity: .7; }
.payment-confirm-modal button:disabled { cursor: not-allowed; opacity: .62; }

@media (max-width: 600px) {
  .payment-confirm-overlay { padding: 10px; }
  .payment-confirm-modal { width: 80%; max-height: calc(100vh - 20px); }
  .payment-confirm-modal header { padding: 16px 15px 12px; }
  .payment-confirm-body { max-height: calc(100vh - 175px); padding: 10px 15px 6px; }
  .payment-confirm-body dl div { grid-template-columns: 100px minmax(0,1fr); gap: 8px; padding: 8px 0; }
  .payment-confirm-modal footer { padding: 11px 15px 15px; }
}
@media (max-width: 390px) {
  .payment-confirm-modal { width: 92%; }
}

/* Cross-device responsive compatibility */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body, .page, .admin-layout {
  min-width: 0;
}
img, video, canvas, svg {
  max-width: 100%;
}
input, select, textarea {
  max-width: 100%;
}
.grid > *, .payment-filter-form > *, .settings-grid > *,
.settings-form > *, .dashboard-grid > *, .dashboard-metrics > *,
.compact-info-grid > *, .shop-grid > * {
  min-width: 0;
}
.main {
  width: 100%;
  max-width: 1440px;
  min-width: 0;
  margin-right: auto;
  margin-left: auto;
}
.admin-layout {
  width: 100%;
  max-width: 1660px;
  margin: 0 auto;
}
.panel, .dashboard-card, .shop-card, .my-record, .result,
.settings-section, .table-wrap, .grave-list-panel {
  min-width: 0;
}
button, .btn, input[type="submit"], input[type="button"] {
  min-width: 88px;
  white-space: nowrap;
  flex-shrink: 0;
}
.grave-modal-close, .dashboard-notice, .login-captcha-refresh,
.login-captcha-code, .customer-service-panel header button,
.payment-confirm-modal header button, .customer-service-float {
  min-width: 0;
}
.price, .shop-price, .compact-total strong, .payment-amount,
.payment-summary-item strong, .metric-copy strong, .forecast-list strong,
.rate-card dd, input[type="tel"], input[type="date"], input[type="number"],
.status-tag, .badge, time {
  white-space: nowrap;
}
.result strong, .shop-info strong, .compact-grave-title h2,
.dashboard-account strong, .sidebar-brand strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meta, .shop-info em, .compact-fee-summary, .notice, .shop-desc {
  overflow-wrap: break-word;
  word-break: normal;
}
.line-clamp-2, .shop-info em {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.table-wrap {
  max-width: 100%;
}
.admin-table th,
.admin-table td {
  overflow-wrap: normal;
  word-break: keep-all;
}
.admin-table td {
  max-width: 360px;
}
.admin-table td strong,
.admin-table td small,
.admin-table td span {
  max-width: 100%;
}
.admin-table td a, .admin-table td button, .admin-table td .badge,
.admin-table td input[type="tel"], .admin-table td input[type="date"],
.admin-table td input[type="number"] {
  white-space: nowrap;
}
.grave-modal-overlay, .detail-notice-overlay, .payment-confirm-overlay,
.customer-service-overlay {
  padding:
    max(10px, env(safe-area-inset-top))
    max(10px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom))
    max(10px, env(safe-area-inset-left));
}
.grave-modal, .payment-confirm-modal,
.customer-service-panel {
  width: min(700px, 90vw);
  max-width: 95vw;
  max-height: 90vh;
}
.payment-confirm-modal, .customer-service-panel {
  overflow-y: auto;
}
.grave-modal-body, .payment-confirm-body, .customer-service-list {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.chart-box {
  width: 100%;
  min-width: 0;
  aspect-ratio: 16 / 7;
}
.chart-box canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* >= 1600px */
@media (min-width: 1600px) {
  .admin-layout { max-width: 1660px; }
  .main { max-width: 1440px; }
  .dashboard-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* 1200px - 1599px */
@media (min-width: 1200px) and (max-width: 1599px) {
  .main { max-width: 1380px; }
  .dashboard-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .metric-card { padding-right: 10px; padding-left: 10px; }
  .metric-copy strong { font-size: 17px; }
}

/* 992px - 1199px */
@media (min-width: 992px) and (max-width: 1199px) {
  .admin-layout, .dashboard-layout { grid-template-columns: 190px minmax(0, 1fr); }
  .sidebar, .modern-sidebar { padding-right: 13px; padding-left: 13px; }
  .main, .dashboard-page, .grave-admin-page { padding-right: 16px; padding-left: 16px; }
  .dashboard-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-grid-overview, .dashboard-grid-analysis, .dashboard-bottom-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid-overview .status-card, .dashboard-grid-analysis .forecast-card,
  .dashboard-bottom-grid > :first-child { grid-column: 1 / -1; }
  .settings-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 768px - 991px */
@media (min-width: 768px) and (max-width: 991px) {
  .admin-layout, .dashboard-layout { grid-template-columns: 170px minmax(0, 1fr); }
  .sidebar, .modern-sidebar { padding: 14px 10px; }
  .sidebar-brand small, .sidebar-nav i { display: none; }
  .main, .dashboard-page, .grave-admin-page, .settings-page, .audit-page { padding: 14px; }
  .dashboard-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-grid-overview, .dashboard-grid-analysis, .dashboard-bottom-grid { grid-template-columns: 1fr; }
  .dashboard-grid-overview .status-card, .dashboard-grid-analysis .forecast-card { grid-column: auto; }
  .warning-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .settings-form, .settings-grid.three { grid-template-columns: 1fr; }
  .permission-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-box { aspect-ratio: 16 / 8; }
}

/* Phone and small tablet */
@media (max-width: 767px) {
  body { background-attachment: scroll; }
  .admin-layout, .dashboard-layout {
    display: block;
    max-width: 100%;
  }
  .sidebar, .modern-sidebar {
    position: static;
    width: 100%;
    min-height: auto;
    padding: 12px;
  }
  .sidebar-brand { margin-bottom: 10px; }
  .sidebar-brand strong { max-width: calc(100vw - 100px); }
  .sidebar-brand small, .sidebar-secondary > span { display: none; }
  .sidebar-nav, .sidebar-secondary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 0;
  }
  .sidebar-nav a, .sidebar-secondary a, .sidebar-logout {
    min-width: 0;
    margin: 0;
    padding: 8px 9px;
    overflow: hidden;
    border-radius: 6px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .sidebar-nav i { display: none; }
  .sidebar-secondary { margin-top: 6px; }
  .sidebar-logout { display: block; margin-top: 6px; text-align: center; }
  .main, .dashboard-page, .grave-admin-page, .settings-page, .audit-page,
  .payment-admin-page {
    width: 100%;
    max-width: 100%;
    padding: 12px;
  }
  .toolbar, .payment-page-header, .settings-header, .grave-list-header,
  .section-title, .payment-panel-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .toolbar h1, .payment-page-header h1, .settings-header h1 { font-size: 20px; }
  .grid.two, .payer-grid, .settings-grid.two,
  .settings-grid.three, .permission-grid, .payment-summary-grid {
    grid-template-columns: 1fr;
  }
  .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .actions > *, .toolbar > button, .toolbar > .btn { min-width: 0; }
  .home-banner { max-height: 180px; }
  .home-banner img { height: clamp(115px, 34vw, 180px); }
  .memorial-hero { height: clamp(150px, 45vw, 220px); }
  .memorial-features { width: calc(100% - 20px); gap: 4px; }
  .memorial-feature { grid-template-columns: 30px minmax(0, 1fr); gap: 4px; }
  .feature-icon { width: 30px; height: 30px; border-radius: 10px; }
  .feature-icon svg { width: 18px; height: 18px; }
  .memorial-feature strong { font-size: 11px; }
  .memorial-feature em { display: none; }
  .memorial-wrap, .wrap, .shop-wrap, .detail-wrap, .compact-detail-wrap {
    width: 100%;
    max-width: 100%;
    padding-right: 10px;
    padding-left: 10px;
  }
  .memorial-card, .panel { padding: 15px; }
  .memorial-card-title h1 { font-size: 21px; }
  .memorial-card-subtitle { margin: 10px 0 16px; font-size: 13px; }
  .memorial-input { height: 50px; }
  .memorial-input input { height: 48px; font-size: 16px; }
  .memorial-search-button { height: 48px; font-size: 16px; }
  .result-head { align-items: flex-start; }
  .result strong { min-width: 0; font-size: 16px; }
  .row { align-items: flex-start; gap: 10px; }
  .row span:first-child { flex: 0 0 auto; }
  .row span:last-child { min-width: 0; text-align: right; overflow-wrap: break-word; }
  .year-options { gap: 5px; }
  .year-option span { min-height: 50px; padding: 6px 2px; }
  .year-option strong { font-size: 13px; }
  .year-option em { font-size: 10px; white-space: nowrap; }
  .shop-grid { gap: 9px; }
  .shop-cover { height: 105px; }
  .shop-info { padding: 9px; }
  .shop-info strong { font-size: 13px; }
  .shop-info span { font-size: 15px; white-space: nowrap; }
  .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .dashboard-grid-overview, .dashboard-grid-analysis,
  .dashboard-bottom-grid { grid-template-columns: 1fr; }
  .dashboard-grid-overview .status-card, .dashboard-grid-analysis .forecast-card,
  .dashboard-bottom-grid > :first-child { grid-column: auto; }
  .metric-card { min-height: 82px; padding: 10px; }
  .metric-icon { display: none; }
  .metric-copy strong { font-size: clamp(15px, 5vw, 20px); white-space: nowrap; }
  .warning-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-box { min-height: 210px; aspect-ratio: 4 / 3; }
  .status-content, .dashboard-grid-overview .status-content { grid-template-columns: 1fr; }
  .forecast-list, .dashboard-grid-analysis .forecast-list { grid-template-columns: 1fr; }
  .dashboard-quick-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-quick-actions a { min-width: 0; }
  .dashboard-topbar { min-height: 50px; }
  .dashboard-breadcrumb { min-width: 0; }
  .dashboard-account > div:not(.dashboard-avatar), .dashboard-account-menu { display: none; }
  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }
  .admin-table, .payment-record-table, .audit-table, .grave-list-table {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .admin-table thead { display: none; }
  .admin-table tbody { display: grid; gap: 10px; }
  .admin-table tr {
    display: block;
    overflow: hidden;
    border: 1px solid #e1e7e3;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(32, 58, 44, .05);
  }
  .admin-table td {
    display: grid;
    grid-template-columns: minmax(74px, 32%) minmax(0, 1fr);
    gap: 10px;
    width: 100%;
    max-width: none;
    padding: 9px 11px;
    border-bottom: 1px solid #edf0ee;
    text-align: right;
    word-break: normal;
  }
  .admin-table td:last-child { border-bottom: 0; }
  .admin-table td::before {
    content: attr(data-label);
    min-width: 0;
    color: #7a877f;
    font-size: 11px;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
  }
  .admin-table td > * { min-width: 0; justify-self: end; }
  .admin-table td form { max-width: 100%; }
  .admin-table .inline-form { flex-wrap: wrap; justify-content: flex-end; }
  .audit-detail { min-width: 0; }
  .audit-changes div { grid-template-columns: 1fr; }
  .audit-changes i { transform: rotate(90deg); }
  .grave-list-table th, .grave-list-table td { padding: 9px 11px; }
  .grave-modal, .payment-confirm-modal,
  .customer-service-panel {
    width: 90vw;
    max-width: 95vw;
    max-height: 90vh;
  }
  .grave-modal-form { max-height: calc(90vh - 60px); }
  .grave-modal-body { overflow-y: auto; }
  .grave-modal-footer, .payment-confirm-modal footer {
    position: sticky;
    bottom: 0;
    z-index: 2;
  }
  .payment-confirm-body dl div { grid-template-columns: 92px minmax(0, 1fr); }
  .payment-confirm-body dd { overflow-wrap: break-word; word-break: normal; }
  .modern-login-page {
    min-height: 100svh;
    padding:
      max(12px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }
  .modern-login-card { width: min(100%, 420px); }
  .login-captcha-row { grid-template-columns: minmax(76px, 1fr) 82px 36px; }
  .login-captcha-row > * { min-width: 0; }
  .login-captcha-code, .login-captcha-refresh { min-width: 0; }
  .settings-brand-grid { grid-template-columns: 58px minmax(0, 1fr); }
  .settings-system-name { grid-column: 1 / -1; }
  .sensitive-setting > div { grid-template-columns: minmax(0, 1fr) auto; }
  .payment-filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-cemetery, .field-grave, .field-buyer, .field-user,
  .field-start, .field-end, .payment-status-filter {
    grid-column: auto;
    grid-row: auto;
  }
  .payment-status-filter, .payment-filter-actions {
    grid-column: 1 / -1;
    grid-row: auto;
  }
  .payment-filter-actions { justify-content: stretch; }
  .payment-filter-actions button { flex: 1; min-width: 0; }
}

@media (min-width: 992px) and (max-width: 1199px) {
  .payment-filter-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .field-cemetery, .field-grave, .field-buyer, .field-user,
  .field-start, .field-end, .payment-status-filter {
    grid-column: auto;
    grid-row: auto;
  }
  .payment-status-filter { grid-column: span 2; }
  .payment-filter-actions { grid-column: 1 / -1; grid-row: auto; }
}

@media (min-width: 768px) and (max-width: 991px) {
  .payment-filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-cemetery, .field-grave, .field-buyer, .field-user,
  .field-start, .field-end, .payment-status-filter {
    grid-column: auto;
    grid-row: auto;
  }
  .payment-status-filter, .payment-filter-actions {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}

@media (max-width: 380px) {
  .main, .dashboard-page, .grave-admin-page, .settings-page, .audit-page,
  .payment-admin-page { padding: 9px; }
  .sidebar-nav, .sidebar-secondary { grid-template-columns: 1fr 1fr; }
  .actions { grid-template-columns: 1fr; }
  .dashboard-metrics { gap: 7px; }
  .metric-card { padding: 8px; }
  .metric-copy p { font-size: 10px; }
  .metric-copy strong { font-size: 15px; }
  .warning-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .year-option strong { font-size: 12px; }
  .year-option em { font-size: 9px; }
  .modern-login-card { padding: 18px 14px 15px; }
  .modern-login-brand strong { max-width: calc(100vw - 105px); }
  .login-captcha-row { grid-template-columns: minmax(68px, 1fr) 78px 34px; gap: 5px; }
  .admin-table td { grid-template-columns: 70px minmax(0, 1fr); padding: 8px 9px; }
  .payment-filter-form { grid-template-columns: 1fr; }
  .payment-status-filter, .payment-filter-actions { grid-column: auto; }
}

/* Unified public mobile shell: scoped so the administration UI is unchanged. */
:root { color-scheme: light; }
html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body.front-site {
  width: 100%;
  max-width: 520px;
  min-width: 0;
  margin: 0 auto;
  overflow-x: hidden;
  color: #1f2933;
  color-scheme: light;
  background: #f6f8f5;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}
.front-site *,
.front-site *::before,
.front-site *::after {
  box-sizing: border-box;
  min-width: 0;
}
.front-site .page {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}
.front-site .front-container,
.front-site .wrap,
.front-site .my-mobile,
.front-site .debug-page {
  width: 100%;
  max-width: 520px;
  margin-right: auto;
  margin-left: auto;
  padding-right: 16px;
  padding-left: 16px;
}
.front-site .memorial-features {
  width: 100%;
  max-width: 520px;
  margin-right: auto;
  margin-left: auto;
  padding-right: 16px;
  padding-left: 16px;
}
.front-site img,
.front-site video,
.front-site canvas,
.front-site svg {
  max-width: 100%;
}
.front-site img,
.front-site video {
  height: auto;
}
.front-site input,
.front-site textarea,
.front-site select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  color: #1f2933 !important;
  background: #fff !important;
  font-size: 14px;
}
.front-site button,
.front-site .btn {
  max-width: 100%;
  min-height: 44px;
  white-space: nowrap;
}
.front-site .actions > button,
.front-site .actions > .btn,
.front-site .memorial-search-button,
.front-site .shop-order-form > button {
  width: 100%;
}
.front-site .customer-service-float,
.front-site .detail-notice-close,
.front-site .payment-confirm-modal header button,
.front-site .customer-service-panel header button,
.front-site .invoice-preview-card > button {
  width: auto;
  min-width: 30px;
  min-height: 30px;
}
.front-site .grave-no,
.front-site .grave-cert-no,
.front-site .phone,
.front-site .amount,
.front-site .money,
.front-site .order-no,
.front-site .date,
.front-site [href^="tel:"],
.front-site input[type="tel"],
.front-site input[type="date"],
.front-site input[type="number"] {
  white-space: nowrap;
}
.front-site .compact-grave-title h2,
.front-site .compact-total strong,
.front-site .shop-price,
.front-site .shop-info span,
.front-site .payment-confirm-amount dd,
.front-site .record-sub,
.front-site .row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.front-site .long-text,
.front-site .notice-content,
.front-site .detail-notice-content,
.front-site .shop-desc,
.front-site .notice,
.front-site .order-items,
.front-site .refund-detail {
  overflow-wrap: break-word;
  word-break: break-word;
  line-height: 1.8;
}
.front-site .row,
.front-site .compact-info-grid > div,
.front-site .record-field,
.front-site .result {
  max-width: 100%;
}
.front-site .row strong,
.front-site .compact-info-grid strong,
.front-site .record-field b,
.front-site .result strong {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
}

/* One modal model for notices, payment confirmation, customer service and invoices. */
.front-site .front-modal-overlay,
.front-site .detail-notice-overlay,
.front-site .payment-confirm-overlay,
.front-site .customer-service-overlay,
.front-site .invoice-preview-overlay {
  position: fixed !important;
  inset: auto !important;
  top: var(--front-viewport-top, 0) !important;
  right: auto !important;
  bottom: auto !important;
  left: var(--front-viewport-left, 0) !important;
  z-index: 9999;
  align-items: center !important;
  justify-content: center !important;
  width: var(--front-viewport-width, 100%) !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: var(--front-viewport-height, 100dvh) !important;
  max-height: var(--front-viewport-height, 100dvh) !important;
  padding: 16px !important;
  overflow: hidden !important;
  background: rgba(18, 29, 23, .68);
}
.front-site .front-modal,
.front-site .detail-notice-modal,
.front-site .payment-confirm-modal,
.front-site .customer-service-panel,
.front-site .invoice-preview-card {
  position: relative !important;
  flex: 0 1 520px !important;
  width: var(--front-modal-width, calc(100% - 32px)) !important;
  max-width: 520px !important;
  min-width: 0 !important;
  max-height: var(--front-modal-max-height, 85vh) !important;
  margin: auto !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  transform: none !important;
  border-radius: 14px !important;
  background: #fff;
  box-shadow: 0 22px 70px rgba(21, 42, 29, .26);
  -webkit-overflow-scrolling: touch;
}
.front-site .front-modal-body,
.front-site .payment-confirm-body,
.front-site .customer-service-list {
  max-height: var(--front-modal-body-max-height, 65vh);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.front-site .detail-notice-modal {
  padding: 28px 20px 20px !important;
}
.front-site .detail-notice-modal h2,
.front-site .detail-notice-content,
.front-site .detail-notice-signature {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
}
.front-site .payment-confirm-modal footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: #fff;
}
.front-site .customer-service-panel {
  border-radius: 14px !important;
}
.front-site .invoice-preview-card {
  padding: 42px 12px 12px !important;
}
.front-site .invoice-preview-card img {
  display: block;
  max-width: 100%;
  max-height: calc(var(--front-viewport-height, 100dvh) - 100px);
  margin: auto;
  object-fit: contain;
}
.is-android .front-site .detail-notice-overlay,
.is-android .front-site .payment-confirm-overlay,
.is-android .front-site .customer-service-overlay,
.is-android .front-site .invoice-preview-overlay {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Public tables opt into a card layout on phones without horizontal scrolling. */
@media (max-width: 767px) {
  /* Prevent mobile browsers from zooming the page when an input gains focus. */
  .front-site input,
  .front-site textarea,
  .front-site select {
    font-size: 16px;
  }
  .front-site .front-container,
  .front-site .wrap,
  .front-site .my-mobile,
  .front-site .debug-page {
    width: 100%;
    max-width: 520px;
    padding-right: 12px;
    padding-left: 12px;
  }
  .front-site .memorial-features {
    width: 100%;
    max-width: 520px;
    padding-right: 12px;
    padding-left: 12px;
  }
  .front-site .front-table,
  .front-site .front-table tbody,
  .front-site .front-table tr,
  .front-site .front-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .front-site .front-table thead { display: none; }
  .front-site .front-table tr {
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px solid #e2e8e4;
    border-radius: 10px;
    background: #fff;
  }
  .front-site .front-table td {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 10px;
    padding: 9px 11px;
    border-bottom: 1px solid #edf1ee;
    text-align: right;
  }
  .front-site .front-table td::before {
    content: attr(data-label);
    color: #748078;
    text-align: left;
    white-space: nowrap;
  }
  .front-site .record-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .front-site .record-top { gap: 8px; }
  .front-site .record-sub {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .front-site .payment-confirm-modal footer {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 380px) {
  .front-site .front-modal,
  .front-site .detail-notice-modal,
  .front-site .payment-confirm-modal,
  .front-site .customer-service-panel,
  .front-site .invoice-preview-card {
    width: var(--front-modal-width, calc(100% - 20px)) !important;
  }
  .front-site .detail-notice-modal { padding: 24px 16px 16px !important; }
  .front-site .detail-notice-modal h2 { font-size: 20px; }
  .front-site .record-grid { grid-template-columns: 1fr; }
  .front-site .payment-confirm-body dl div {
    grid-template-columns: 82px minmax(0, 1fr);
  }
}
