/* PCemetery quản trị — cùng phong cách POffice: xanh lá đậm + điểm vàng ánh kim, nền xanh rất nhạt,
   thẻ trắng bo 18 có bóng, nút gradient, Inter (nội dung) + Plus Jakarta Sans (tiêu đề), tự host.
   Màu trạng thái ô mộ (--st-*) giữ riêng để sơ đồ dễ phân biệt. Nền tối chỉ dùng chữ trắng / vàng nhạt. */
@import url("fonts/fonts.css");
:root {
  --brand: #0f8259; --brand-d: #0b5c3e; --navy: #0c3325; --gold: #d4af37; --gold-2: #876305; --gold-l: #ffe9a8;
  --bg: #f3f8f4; --surface: #fff; --surface-2: #f2f8f3; --ink: #10382a; --ink-2: #2b4a3d; --muted: #4f675b; --line: #d3e2d8;
  --red: #c92a2a;
  --grad-brand: linear-gradient(135deg, #0f8259 0%, #0b5c3e 100%);
  --grad-gold: linear-gradient(135deg, #fff3c4 0%, #f1d270 32%, #d4af37 64%, #b8860b 100%);
  --r: 18px; --r-sm: 12px;
  --e1: 0 1px 2px rgba(8,40,28,.06), 0 2px 6px rgba(8,40,28,.05);
  --e2: 0 6px 16px -6px rgba(8,40,28,.16), 0 12px 30px -10px rgba(8,40,28,.10);
  --e3: 0 18px 34px -10px rgba(8,40,28,.22), 0 34px 60px -18px rgba(8,40,28,.20);
  --glow: 0 10px 24px -6px rgba(21,154,103,.45);
  --st-available: #e6f4ea; --st-available-b: #6fb58a;
  --st-reserved: #fff3d1; --st-reserved-b: #d4af37;
  --st-occupied: #e1e9f2; --st-occupied-b: #6f8aa6;
  --st-exhumed: #efe4f3; --st-exhumed-b: #a07bb3;
  --st-blocked: #e7e5e0; --st-blocked-b: #9a948a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body { font: 14px/1.5 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(720px 520px at 10% -6%, rgba(21,154,103,.10), transparent 60%),
    radial-gradient(700px 500px at 102% 0%, rgba(212,175,55,.13), transparent 55%),
    var(--bg) fixed; }
h1, h2, h3, .brand-name { font-family: 'Plus Jakarta Sans', 'Inter', sans-serif; color: var(--navy); }
h1 { font-size: 24px; font-weight: 800; letter-spacing: -.3px; margin-bottom: 4px; }
h2 { font-size: 18px; font-weight: 800; margin-bottom: 12px; }
h3 { font-size: 15px; font-weight: 700; margin: 18px 0 10px; }
a { color: var(--brand-d); }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .error { color: var(--red); min-height: 1em; margin-top: 8px; }
.sp { flex: 1; }

/* Nút */
button, .btn { font: inherit; font-size: 13px; font-weight: 700; border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 11px; padding: 9px 16px; cursor: pointer; box-shadow: var(--e1); transition: .2s; text-decoration: none; display: inline-flex;
  align-items: center; gap: 6px; white-space: nowrap; }
button:hover, .btn:hover { transform: translateY(-1px); box-shadow: var(--e2); }
button.primary { background: var(--grad-brand); color: #fff; border-color: transparent; box-shadow: var(--glow); }
button.gold { background: linear-gradient(135deg, #fff3c4 0%, #f1d270 50%, #e2bf4f 100%); color: #3a2c00; border-color: transparent; }
button.danger { color: var(--red); border-color: #ffd3d3; }
button.danger:hover { background: #fff5f5; }
button.small { padding: 6px 11px; font-size: 12px; border-radius: 9px; }
button:disabled { opacity: .5; cursor: default; transform: none; }
button.icon { border: 0; box-shadow: none; background: var(--surface-2); width: 34px; height: 34px; justify-content: center; font-size: 20px; padding: 0; border-radius: 10px; color: var(--muted); }
button.icon:hover { background: #ffe3e3; color: var(--red); }

/* Ô nhập */
input, select, textarea { font: inherit; font-size: 13.5px; width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 11px;
  background: #fbfdfb; color: var(--ink); outline: none; transition: .18s; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(21,154,103,.13); }
textarea { min-height: 76px; resize: vertical; }
input[type=checkbox] { width: auto; accent-color: var(--brand); }
input[type=file] { padding: 7px; }
label { font-weight: 600; font-size: 12px; color: var(--ink-2); display: block; margin: 12px 0 6px; }
label:has(input[type=checkbox]) { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.field { min-width: 0; } .field small { display: block; margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }

.card { background: var(--surface); border-radius: var(--r); padding: 22px; box-shadow: var(--e2); border: 1px solid rgba(255,255,255,.7); }
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login { width: 100%; max-width: 400px; } .login button { width: 100%; justify-content: center; margin-top: 16px; padding: 12px; }
.login .mark { margin: 0 auto 14px; }

/* Logo */
.mark { width: 44px; height: 44px; border-radius: 13px; background: var(--grad-gold); display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0; box-shadow: 0 8px 22px -6px rgba(212,175,55,.55); }
.brand-name { font-weight: 800; font-size: 18px; }
.brand-sub { color: var(--gold-2); font-weight: 600; font-size: 11px; }

/* Khung: thanh bên sáng cố định + thanh trên trắng mờ */
.layout { display: flex; min-height: 100vh; }
.side { width: 270px; flex-shrink: 0; position: fixed; inset: 0 auto 0 0; overflow-y: auto; z-index: 10;
  background: linear-gradient(185deg, #eef6f0, #e2eee6 100%); border-right: 1px solid var(--line); box-shadow: 2px 0 20px -12px rgba(8,40,28,.22); padding-bottom: 20px; }
.side .logo { display: flex; align-items: center; gap: 12px; padding: 20px 18px 12px; }
.side .pick { padding: 0 14px 8px; }
.nav-sec { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 1.4px; padding: 12px 18px 6px; text-transform: uppercase; display: flex; align-items: center; gap: 7px; }
.nav-sec::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--grad-gold); }
.nav-sec button { margin-left: auto; letter-spacing: 0; text-transform: none; }
.nav button { width: calc(100% - 16px); margin: 2px 8px; text-align: left; border: 0; box-shadow: none; background: none; padding: 9px 12px; border-radius: 12px;
  font-weight: 600; font-size: 13.5px; color: var(--ink-2); position: relative; }
.nav button:hover { background: rgba(18,136,91,.10); transform: translateX(3px); }
.nav button.on { background: var(--grad-brand); color: #fff; box-shadow: 0 3px 0 #0a5a3c, 0 9px 16px -5px rgba(15,130,89,.5); }
.nav button.on::after { content: ""; position: absolute; right: 12px; top: 50%; margin-top: -3.5px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.tree { margin: 0 8px; }
.tree ul { list-style: none; padding-left: 14px; } .tree > ul { padding-left: 0; }
.tree .lbl { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.tree .lbl:hover { background: rgba(18,136,91,.10); }
.tree .node.on > .lbl { background: var(--grad-brand); color: #fff; }
.tree .node.on > .lbl .kind, .tree .node.on > .lbl .cnt { color: rgba(255,255,255,.85); }
.tree .lbl .cnt { margin-left: auto; font-size: 11px; color: var(--muted); font-weight: 600; }
.tree .kind { font-size: 10px; color: var(--muted); text-transform: uppercase; width: 32px; letter-spacing: .4px; }
.tree .empty { padding: 4px 18px; }
.main { margin-left: 270px; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { height: 64px; position: sticky; top: 0; z-index: 9; display: flex; align-items: center; gap: 12px; padding: 0 26px;
  background: rgba(255,255,255,.74); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.top .crumb { color: var(--muted); font-size: 13px; } .top .crumb b { color: var(--ink); }
.userchip { display: flex; align-items: center; gap: 9px; background: #fff; border: 1px solid var(--line); border-radius: 30px; padding: 5px 6px 5px 12px; box-shadow: var(--e1); }
.userchip .nm { font-size: 12.5px; font-weight: 700; }
.userchip .rl { font-size: 11px; color: var(--navy); background: var(--grad-gold); padding: 2px 9px; border-radius: 20px; font-weight: 700; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--grad-brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.content { padding: 26px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); font-size: 13px; }

/* Thẻ số liệu */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; margin: 6px 0 24px; }
.stat { background: var(--surface); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--e2); position: relative; overflow: hidden; color: var(--muted); font-size: 12px; font-weight: 500; }
.stat::after { content: ""; position: absolute; top: -30px; right: -30px; width: 90px; height: 90px; border-radius: 50%; background: var(--grad-gold); opacity: .12; }
.stat b { display: block; font: 800 30px/1.1 'Plus Jakarta Sans', sans-serif; color: var(--navy); margin-bottom: 6px; }
.stat.st-available, .stat.st-reserved, .stat.st-occupied, .stat.st-exhumed, .stat.st-blocked { background: #fff; border-width: 0 0 0 6px; border-style: solid; }

/* Sơ đồ */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; margin: 12px 0 16px; color: var(--ink-2); }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; border: 1.5px solid; }
.lane { margin-bottom: 14px; }
.lane h3 { margin: 0 0 8px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.cells { display: grid; gap: 5px; overflow-x: auto; padding: 2px 2px 6px; }
.cell { width: 66px; height: 56px; border-radius: 10px; border: 1.5px solid; font-size: 11px; padding: 4px 5px; cursor: pointer; overflow: hidden; text-align: left;
  line-height: 1.2; display: block; box-shadow: none; color: var(--ink); font-weight: 500; }
.cell:hover { transform: translateY(-2px); box-shadow: var(--e2); }
.cell b { display: block; font-size: 13px; }
.cell .nm { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-available { background: var(--st-available); border-color: var(--st-available-b); }
.st-reserved { background: var(--st-reserved); border-color: var(--st-reserved-b); }
.st-occupied { background: var(--st-occupied); border-color: var(--st-occupied-b); }
.st-exhumed { background: var(--st-exhumed); border-color: var(--st-exhumed-b); }
.st-blocked { background: var(--st-blocked); border-color: var(--st-blocked-b); }
.legend .st-available, .legend .st-reserved, .legend .st-occupied, .legend .st-exhumed, .legend .st-blocked { background: none; }
.legend .st-available::before { background: var(--st-available); border-color: var(--st-available-b); }
.legend .st-reserved::before { background: var(--st-reserved); border-color: var(--st-reserved-b); }
.legend .st-occupied::before { background: var(--st-occupied); border-color: var(--st-occupied-b); }
.legend .st-exhumed::before { background: var(--st-exhumed); border-color: var(--st-exhumed-b); }
.legend .st-blocked::before { background: var(--st-blocked); border-color: var(--st-blocked-b); }
.badge { display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 20px; font-size: 11px; font-weight: 700; border: 1.5px solid; }

/* Bảng */
.table-wrap { overflow-x: auto; border-radius: var(--r); box-shadow: var(--e2); background: #fff; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; background: #fff; border-radius: var(--r); overflow: hidden; box-shadow: var(--e2); }
th { background: var(--surface-2); padding: 12px 15px; text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
td { padding: 12px 15px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tr.click { cursor: pointer; } tr.click:hover td { background: #f5faf6; }

/* Ngăn chi tiết ô */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(580px, 100%); background: #fff; border-left: 1px solid var(--line); box-shadow: var(--e3); z-index: 20; overflow: auto; padding: 22px; }
.drawer .head { display: flex; align-items: flex-start; gap: 10px; }
.drawer .head h2 { flex: 1; margin: 0; }
.burial { border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 13px; padding: 11px 13px; margin-bottom: 9px; box-shadow: var(--e1); }
.burial.gone { opacity: .65; border-left-color: var(--st-exhumed-b); }
.burial .nm { font-weight: 700; color: var(--navy); }
.events { font-size: 12.5px; padding-left: 18px; } .events li { margin-bottom: 4px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.photo { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.photo img { display: block; width: 100%; height: 100px; object-fit: cover; cursor: zoom-in; }
.photo .cap { font-size: 11px; padding: 4px 6px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo button { position: absolute; top: 4px; right: 4px; padding: 2px 7px; font-size: 11px; }
.qr { display: flex; gap: 14px; align-items: center; background: var(--surface-2); border-radius: 14px; padding: 12px; }
.qr img { width: 96px; height: 96px; background: #fff; border-radius: 8px; padding: 4px; }

/* Hộp thoại */
.modal { position: fixed; inset: 0; background: rgba(8,40,28,.55); backdrop-filter: blur(4px); display: flex; align-items: flex-start; justify-content: center; z-index: 30; padding: 44px 16px; overflow-y: auto; }
.modal-card { background: #fff; border-radius: 22px; padding: 26px; width: min(680px, 100%); box-shadow: var(--e3); }
.modal-head { display: flex; align-items: center; margin-bottom: 6px; } .modal-head h2 { flex: 1; margin: 0; }
.lightbox { position: fixed; inset: 0; background: rgba(8,20,14,.9); display: flex; align-items: center; justify-content: center; z-index: 40; cursor: zoom-out; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px); background: var(--grad-brand); color: #fff; padding: 11px 18px; border-radius: 12px;
  opacity: 0; transition: .25s; z-index: 50; max-width: calc(100% - 32px); box-shadow: var(--e3); font-weight: 600; }
.toast.bad { background: linear-gradient(135deg, #c92a2a, #9b1c1c); } .toast.show { opacity: 1; transform: translate(-50%, 0); }
.report { padding-left: 18px; } .report li { margin-bottom: 3px; }

@media (max-width: 860px) {
  .layout { display: block; }
  .side { position: static; width: auto; box-shadow: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .main { margin-left: 0; }
  .top { padding: 0 16px; }
  .content { padding: 16px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .userchip .nm { display: none; }
}
@media print { .side, .top, .no-print { display: none !important; } .main { margin: 0; } body { background: #fff; } }
