/* Phong Thủy quản trị — khuôn POffice (chép từ PCemeteryServer) nhưng màu theo app PhongThuy
   (lib/core/theme/app_colors.dart): đỏ son + vàng làm điểm nhấn, nền kem, thẻ trắng bo 18 có bóng. */
@import url("fonts/fonts.css");
:root {
  --brand: #8a1f1f; --brand-d: #5b1a1a; --navy: #2b2b2b; --gold: #b8975a; --gold-2: #7a5e2e; --gold-l: #f3e7c9;
  --bg: #f4f1ea; --surface: #fff; --surface-2: #ede7da; --ink: #2b2b2b; --ink-2: #3d3631; --muted: #5f564d; --line: #eadfc9;
  --red: #a63d32;
  --grad-brand: linear-gradient(135deg, #8a1f1f 0%, #5b1a1a 100%);
  --grad-gold: linear-gradient(135deg, #e9d9b0 0%, #c9ad74 100%);
  --r: 18px; --r-sm: 12px;
  --e1: 0 1px 2px rgba(28,43,38,.06), 0 2px 6px rgba(28,43,38,.05);
  --e2: 0 6px 16px -6px rgba(28,43,38,.16), 0 12px 30px -10px rgba(28,43,38,.10);
  --e3: 0 18px 34px -10px rgba(28,43,38,.22), 0 34px 60px -18px rgba(28,43,38,.20);
  --glow: 0 6px 16px -8px rgba(28,43,38,.40);
  --st-available: #e6f4ea; --st-available-b: #6fb58a;
  --st-reserved: #f6edd6; --st-reserved-b: #b8975a;
  --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(138,31,31,.08), transparent 60%),
    radial-gradient(700px 500px at 102% 0%, rgba(184,151,90,.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, #efe2c0 0%, #d9c08a 100%); color: #3d2f17; border-color: transparent; }
button.danger { color: var(--red); border-color: #ecd0cb; }
button.danger:hover { background: #faf1ef; }
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: #f5e1dd; 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: #fcfbf8; 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(46,94,78,.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; }
.brand-name { font-weight: 800; font-size: 18px; }
.brand-sub { color: var(--gold-2); font-weight: 600; font-size: 11px; }

/* Khung như POffice (menu LFCore): thanh bên sáng cố định 246px gồm các thẻ nhóm; mục của nhóm đang
   chọn là dải tab dính dưới thanh trên. Điện thoại: thanh bên là ngăn kéo mở bằng nút ☰. */
.layout { display: flex; min-height: 100vh; }
.side { width: 246px; flex-shrink: 0; position: fixed; inset: 0 auto 0 0; overflow-y: auto; z-index: 100; display: flex; flex-direction: column;
  background: linear-gradient(185deg, #f3f1ea, #e9e6dc 100%); border-right: 1px solid var(--line); box-shadow: 2px 0 20px -12px rgba(28,43,38,.22); }
.side::-webkit-scrollbar { width: 0; }
.side .logo { display: flex; align-items: center; gap: 12px; padding: 20px 20px 8px; }
.side .pick { padding: 4px 12px 6px; }
.side-overlay { display: none; position: fixed; inset: 0; background: rgba(28,43,38,.5); z-index: 99; }
.side-foot { margin-top: auto; padding: 16px 22px; color: var(--muted); font-size: 10.5px; border-top: 1px solid var(--line); }
.navg-list { padding: 6px 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.navg { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 16px; border: 1px solid var(--line); text-decoration: none;
  background: linear-gradient(180deg, #fff 0%, #faf8f3 100%); color: var(--ink-2);
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 #d8d4c8, 0 6px 10px -4px rgba(28,43,38,.16); transition: .22s cubic-bezier(.4,0,.2,1); }
.navg:hover { transform: translateY(-2px); border-color: rgba(46,94,78,.5); }
.navg-ic { width: 36px; height: 36px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; background: rgba(46,94,78,.10); }
.navg-tx { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.navg-t { font-size: 13.5px; font-weight: 700; color: var(--navy); }
.navg-h { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.navg-n { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--line); color: var(--muted); }
.navg.active { background: var(--grad-brand); border-color: transparent; color: #fff;
  box-shadow: 0 3px 0 #173a2f, 0 9px 16px -5px rgba(31,67,55,.5), inset 0 1px 0 rgba(255,255,255,.28); }
.navg.active .navg-ic { background: rgba(255,255,255,.2); }
.navg.active .navg-t { color: #fff; } .navg.active .navg-h { color: rgba(255,255,255,.82); }
.navg.active .navg-n { background: var(--gold); color: var(--navy); }
.nav-sec { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 1.4px; padding: 10px 20px 6px; text-transform: uppercase; display: flex; align-items: center; gap: 7px; border-top: 1px solid var(--line); }
.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; }
.navtabs { position: sticky; top: 64px; z-index: 40; background: rgba(255,255,255,.86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.navtabs[hidden] { display: none; }
.navtabs-in { display: flex; gap: 4px; overflow-x: auto; padding: 8px 24px 0; scrollbar-width: none; }
.navtabs-in::-webkit-scrollbar { display: none; }
.navtab { margin-bottom: -1px; flex-shrink: 0; white-space: nowrap; display: flex; align-items: center; gap: 7px; padding: 8px 14px; border: 1px solid transparent; border-bottom: 0;
  border-radius: 12px 12px 0 0; font-size: 13px; font-weight: 600; color: var(--ink-2); text-decoration: none; transition: .18s; }
.navtab:hover { background: rgba(46,94,78,.10); color: var(--brand-d); }
.navtab.active { background: var(--bg); border-color: var(--line); color: var(--brand-d); box-shadow: inset 0 3px 0 var(--brand); }
.hamburger { display: none; flex-direction: column; gap: 5px; padding: 6px; background: none; border: 0; box-shadow: none; }
.hamburger:hover { transform: none; box-shadow: none; }
.hamburger span { display: block; width: 22px; height: 2px; background: var(--ink-2); border-radius: 2px; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; background: #fff; border: 1px solid var(--line); justify-content: center; font-size: 16px; padding: 0; box-shadow: var(--e1); }
.icon-btn:hover { transform: translateY(-2px); box-shadow: var(--e2); }
.tree { margin: 0 8px 14px; }
.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(46,94,78,.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: 246px; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { height: 64px; position: sticky; top: 0; z-index: 50; 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 12px 5px 6px; 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; box-shadow: 0 3px 8px rgba(46,94,78,.35); }
.content { flex: 1; padding: 26px; max-width: 1400px; width: 100%; margin: 0 auto; }
.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: #f6f4ee; }

/* 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(28,43,38,.55); backdrop-filter: blur(4px); display: flex; align-items: flex-start; justify-content: center; z-index: 200; 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(15,23,20,.9); display: flex; align-items: center; justify-content: center; z-index: 210; 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: 220; max-width: calc(100% - 32px); box-shadow: var(--e3); font-weight: 600; }
.toast.bad { background: linear-gradient(135deg, #a63d32, #8a3229); } .toast.show { opacity: 1; transform: translate(-50%, 0); }
.report { padding-left: 18px; } .report li { margin-bottom: 3px; }

@media (max-width: 860px) {
  .side { transform: translateX(-100%); transition: transform .25s; box-shadow: none; }
  .side.open { transform: none; box-shadow: var(--e3); }
  .side-overlay.open { display: block; }
  .hamburger { display: flex; }
  .main { margin-left: 0; }
  .top { padding: 0 12px; gap: 8px; }
  .top .crumb { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .navtabs-in { padding: 8px 12px 0; }
  .content { padding: 16px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .userchip .nm, .userchip .rl { display: none; }
  .userchip { padding: 4px; }
}
@media print { .side, .top, .navtabs, .side-overlay, .no-print { display: none !important; } .main { margin: 0; } body { background: #fff; } }
