/* =====================================================================
   QUẢN LÝ TU SĨ — giao diện 3D Aero
   Font Nunito (tròn, nhỏ) · kính mờ · khối nổi · đổ bóng nhiều lớp
   ===================================================================== */
:root {
  color-scheme: light;
  --font: 'Nunito', 'Segoe UI Variable', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --fs: 14px;
  --fs-sm: 13px;
  --fs-xs: 12px;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 7px;

  --bg-1: #eaf5ff;
  --bg-2: #d6ebfd;
  --bg-3: #e6f7fc;
  --orb-1: rgba(120, 195, 255, .5);
  --orb-2: rgba(90, 205, 235, .3);
  --orb-3: rgba(255, 255, 255, .6);
  --pattern: rgba(31, 111, 209, .055);

  --surface: rgba(255, 255, 255, .74);
  --surface-strong: rgba(255, 255, 255, .92);
  --surface-solid: #f5faff;
  --surface-chart: #f3f9ff;
  --surface-sunken: rgba(218, 235, 252, .75);
  --glass-border: rgba(255, 255, 255, .78);
  --glass-edge: rgba(120, 150, 190, .22);
  --gloss: linear-gradient(180deg, rgba(255, 255, 255, .75) 0%, rgba(255, 255, 255, .18) 48%, rgba(255, 255, 255, 0) 52%);

  --text: #14304f;
  --text-2: #45607f;
  --text-3: #7088a4;
  --line: rgba(70, 130, 190, .16);
  --line-strong: rgba(70, 130, 190, .3);

  --primary: #2280d8;
  --primary-2: #5cb3f6;
  --primary-ink: #ffffff;
  --primary-soft: rgba(34, 128, 216, .11);
  --accent: #17a5c0;
  --gold: #d9a21b;
  --danger: #d64545;
  --warning: #e59a0b;
  --success: #1c9a5b;
  --violet: #7b3fa0;

  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;

  --shadow-1: 0 1px 1px rgba(16, 42, 84, .05), 0 2px 6px rgba(16, 42, 84, .06);
  --shadow-2: 0 1px 2px rgba(16, 42, 84, .06), 0 6px 16px rgba(16, 42, 84, .09), 0 18px 40px -16px rgba(16, 42, 84, .22);
  --shadow-3: 0 2px 4px rgba(16, 42, 84, .08), 0 14px 28px rgba(16, 42, 84, .14), 0 34px 64px -20px rgba(16, 42, 84, .34);
  --inset: inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 rgba(16, 42, 84, .05);
  --blur: saturate(170%) blur(18px);
  --side-bg: linear-gradient(180deg, rgba(240, 248, 255, .94), rgba(222, 239, 253, .92));
  --hero-bg: linear-gradient(120deg, #3b97e6 0%, #5ab6f2 55%, #53cfd6 100%);
  --sidebar-w: 252px;
  --topbar-h: 58px;
}
:root[data-theme="dark"] {
  /* v1.2.0: giao diện tối là chủ đạo — tông xanh đá (slate) sáng hơn, dịu mắt */
  color-scheme: dark;
  --bg-1: #1e2f4d; --bg-2: #253a5d; --bg-3: #20394a;
  --orb-1: rgba(110, 165, 245, .30); --orb-2: rgba(60, 190, 170, .17); --orb-3: rgba(242, 193, 78, .09);
  --pattern: rgba(170, 200, 255, .06);
  --surface: rgba(54, 75, 110, .60); --surface-strong: rgba(58, 80, 117, .95); --surface-solid: #2f4569; --surface-chart: #2a3f61;
  --surface-sunken: rgba(22, 36, 60, .42); --glass-border: rgba(175, 200, 240, .22); --glass-edge: rgba(0, 0, 0, .22);
  --gloss: linear-gradient(180deg, rgba(255, 255, 255, .12) 0%, rgba(255, 255, 255, .03) 48%, rgba(255, 255, 255, 0) 52%);
  --text: #f1f5fc; --text-2: #c6d2e5; --text-3: #9aabc5; --line: rgba(185, 208, 242, .15); --line-strong: rgba(185, 208, 242, .28);
  --primary: #5aa2f0; --primary-2: #8cc0ff; --primary-soft: rgba(90, 162, 240, .20);
  --series-1: #5b9ff0; --series-2: #f07a45; --series-3: #2dbb87; --series-4: #e0a21c; --series-5: #e46e9a;
  --shadow-1: 0 1px 2px rgba(6, 14, 30, .22); --shadow-2: 0 2px 4px rgba(6, 14, 30, .2), 0 10px 26px rgba(6, 14, 30, .24);
  --shadow-3: 0 4px 10px rgba(6, 14, 30, .28), 0 24px 60px rgba(6, 14, 30, .36);
  --inset: inset 0 1px 0 rgba(255, 255, 255, .10), inset 0 -1px 0 rgba(0, 0, 0, .18);
  --side-bg: linear-gradient(180deg, rgba(44, 63, 97, .92), rgba(38, 56, 88, .92));
  --hero-bg: linear-gradient(125deg, #2f6cb8 0%, #3d8fdc 52%, #2ba2ae 100%);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font); font-size: var(--fs); line-height: 1.5; color: var(--text);
  background-color: var(--bg-1);
  background-image:
    radial-gradient(1100px 620px at 8% -10%, var(--orb-1), transparent 60%),
    radial-gradient(900px 600px at 105% 8%, var(--orb-2), transparent 60%),
    radial-gradient(800px 520px at 50% 115%, var(--orb-3), transparent 60%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2) 55%, var(--bg-3));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* hoạ tiết: thánh giá + sóng biển rất nhạt */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%231f6fd1' stroke-opacity='.07' stroke-width='1.4'%3E%3Cpath d='M30 18v24M18 30h24'/%3E%3Cpath d='M0 92c10-6 20-6 30 0s20 6 30 0 20-6 30 0 20 6 30 0'/%3E%3Ccircle cx='90' cy='40' r='3'/%3E%3C/g%3E%3C/svg%3E");
  mask-image: linear-gradient(180deg, rgba(0,0,0,.9), rgba(0,0,0,.35));
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,.9), rgba(0,0,0,.35));
}
img { max-width: 100%; }
/* kích thước mặc định cho biểu tượng (độ ưu tiên 0 — mọi quy tắc khác đều ghi đè được) */
:where(svg[aria-hidden="true"]) { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 16px; } h4 { font-size: 14px; }
p { margin: 0 0 .7em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
[hidden] { display: none !important; }
::selection { background: rgba(77, 155, 255, .3); }
:focus-visible { outline: 2px solid var(--primary-2); outline-offset: 2px; }
.muted { color: var(--text-2); } .faint { color: var(--text-3); } .small { font-size: var(--fs-sm); } .xs { font-size: var(--fs-xs); }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; } .bold { font-weight: 800; }
.mt-0 { margin-top: 0 } .mt-1 { margin-top: 6px } .mt-2 { margin-top: 12px } .mt-3 { margin-top: 20px } .mb-0 { margin-bottom: 0 } .mb-1 { margin-bottom: 6px } .mb-2 { margin-bottom: 12px }
.pre { white-space: pre-line; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------------ layout */
.app { position: relative; z-index: 1; display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w); z-index: 40;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 12px 14px; display: flex; flex-direction: column; gap: 10px;
  background: var(--side-bg); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-right: 1px solid var(--glass-border); box-shadow: var(--shadow-2);
  transition: transform .25s ease;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 10px; border-bottom: 1px solid var(--line); }
.brand img { width: 42px; height: 42px; border-radius: 12px; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(16,42,84,.25)); }
.brand .t { font-weight: 900; font-size: 15px; letter-spacing: .04em; line-height: 1.15; background: linear-gradient(90deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand .s { font-size: 11.5px; color: var(--text-2); line-height: 1.25; margin-top: 2px; }
.nav { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; }
.nav-sec { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); margin: 12px 10px 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 2px 0; border-radius: 11px; color: var(--text-2);
  font-weight: 700; text-decoration: none; position: relative; transition: background .15s, color .15s, transform .15s;
}
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--primary-soft); color: var(--text); }
.nav a.active {
  color: #fff; text-shadow: 0 1px 1px rgba(8,50,100,.3); background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 6px 16px -4px rgba(34, 128, 216, .5), inset 0 1px 0 rgba(255,255,255,.4);
}
.nav a.active::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: var(--gloss); opacity: .6; pointer-events: none; }
.side-foot { border-top: 1px solid var(--line); padding-top: 8px; font-size: 12px; color: var(--text-3); }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 18px 0; display: flex; align-items: center; gap: 12px;
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--glass-border); box-shadow: var(--shadow-1);
}
.topbar .page-title { font-weight: 900; font-size: 17px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.topbar .today { font-size: 12.5px; color: var(--text-2); text-align: right; line-height: 1.25; }
.menu-btn { display: none; }
.content { flex: 1; padding: 18px 20px 24px; width: 100%; max-width: 1480px; margin: 0 auto; }
.footer {
  margin: 0 20px 16px; padding: 12px 16px; border-radius: var(--radius); font-size: 12.5px; color: var(--text-2); text-align: center;
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--glass-border); box-shadow: var(--shadow-1);
}
.footer .copy { color: var(--text-3); margin-top: 3px; }
.backdrop { position: fixed; inset: 0; background: rgba(8, 18, 36, .42); z-index: 35; backdrop-filter: blur(2px); }
.bottom-nav { display: none; }

/* global search */
.gsearch { position: relative; width: min(360px, 38vw); }
.gsearch input { padding-left: 34px; border-radius: 999px; }
.gsearch > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.gsearch .drop { position: absolute; left: 0; right: 0; top: calc(100% + 6px); max-height: 60vh; overflow: auto; z-index: 60; }

/* ------------------------------------------------------------------ glass cards */
.card {
  position: relative; background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border); border-radius: var(--radius); box-shadow: var(--shadow-2), var(--inset);
  padding: 16px; min-width: 0;
}
.card::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: var(--gloss); opacity: .35; pointer-events: none; }
.card > * { position: relative; }
.card.solid { background: var(--surface-strong); }
.card.flat { box-shadow: var(--shadow-1), var(--inset); }
.card-h { display: flex; align-items: center; gap: 10px; margin: -2px 0 12px; flex-wrap: wrap; }
.card-h h2, .card-h h3 { margin: 0; }
.card-h .grow { flex: 1; }
.card-h.page .grow { flex: 1 1 220px; }
.card-h .ico { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none;
  background: linear-gradient(135deg, var(--c1, var(--primary)), var(--c2, var(--primary-2))); box-shadow: 0 5px 12px -3px var(--c1, rgba(31,111,209,.6)), inset 0 1px 0 rgba(255,255,255,.4); }
.card-h .ico svg { width: 16px; height: 16px; }
.lift { transition: transform .18s ease, box-shadow .18s ease; }
.lift:hover { transform: translateY(-3px); box-shadow: var(--shadow-3), var(--inset); }

.grid { display: grid; gap: 16px; }
.grid > *, .row > *, .col > *, .spread > * { min-width: 0; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1; }

/* stat tile */
.stat { display: flex; gap: 14px; align-items: center; padding: 14px 16px; }
.stat .badge3d {
  width: 50px; height: 50px; border-radius: 15px; flex: none; display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, var(--c2, #6fb0ff), var(--c1, #1f6fd1));
  box-shadow: 0 10px 20px -8px var(--c1, #1f6fd1), inset 0 2px 0 rgba(255,255,255,.45), inset 0 -3px 6px rgba(0,0,0,.18);
  transform: perspective(300px) rotateX(8deg);
}
.stat .badge3d svg { width: 24px; height: 24px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.2)); }
.stat .v { font-size: 26px; font-weight: 900; line-height: 1; letter-spacing: -.02em; }
.stat .l { font-size: 12.5px; color: var(--text-2); font-weight: 700; margin-top: 4px; }
.stat .sub { font-size: 12px; color: var(--text-3); }

/* ------------------------------------------------------------------ controls */
.btn {
  --b1: #ffffff; --b2: #e6f1fc; --bc: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 15px; border-radius: 11px;
  font: inherit; font-weight: 800; font-size: 13.5px; color: var(--bc); cursor: pointer; white-space: nowrap; user-select: none;
  background: linear-gradient(180deg, var(--b1), var(--b2)); border: 1px solid var(--line-strong);
  box-shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 2px 4px rgba(16,42,84,.1); transition: transform .12s, box-shadow .12s, filter .12s;
  text-decoration: none !important;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { filter: brightness(1.03); box-shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 6px 14px -4px rgba(16,42,84,.25); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); box-shadow: inset 0 2px 5px rgba(16,42,84,.2); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn.primary { --b1: #5fb4f7; --b2: #1f78cf; --bc: #fff; border-color: #1f72c2; text-shadow: 0 1px 1px rgba(8,50,100,.35); box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 6px 14px -5px rgba(34,128,216,.65); }
.btn.success { --b1: #34c48e; --b2: #12a58a; --bc: #fff; border-color: #0f8c73; box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 6px 14px -5px rgba(18,165,138,.6); }
.btn.danger { --b1: #f07070; --b2: #d64545; --bc: #fff; border-color: #b83636; box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 6px 14px -5px rgba(214,69,69,.6); }
.btn.warn { --b1: #ffc24d; --b2: #e59a0b; --bc: #3b2600; border-color: #c98500; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--primary-soft); color: var(--text); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 9px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
:root[data-theme="dark"] .btn:not(.primary):not(.success):not(.danger):not(.warn) { --b1: #3b527c; --b2: #31476d; box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 2px 4px rgba(6,14,30,.22); }
.btn-help {
  width: 26px; height: 26px; border-radius: 50%; border: 0; cursor: pointer; font: 900 14px/1 var(--font); color: #fff; flex: none;
  background: radial-gradient(circle at 35% 30%, #8cc4ff, #1f6fd1 70%); box-shadow: 0 4px 10px -2px rgba(31,111,209,.6), inset 0 1px 0 rgba(255,255,255,.5);
}
.btn-help:hover { transform: scale(1.08); }

input, select, textarea {
  font: inherit; color: var(--text); width: 100%; min-height: 36px; padding: 7px 11px; border-radius: 10px;
  background: var(--surface-strong); border: 1px solid var(--line-strong); box-shadow: inset 0 2px 4px rgba(16,42,84,.06);
  transition: border-color .15s, box-shadow .15s; outline: none;
}
textarea { min-height: 80px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(77,155,255,.22), inset 0 2px 4px rgba(16,42,84,.05); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--primary); box-shadow: none; vertical-align: middle; }
input[type="color"] { padding: 2px; width: 46px; height: 34px; }
input[type="file"] { padding: 5px; }
select { appearance: none; -webkit-appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a8aa3' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 800; color: var(--text-2); }
label.f > span.req::after { content: ' *'; color: var(--danger); }
label.chk { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; cursor: pointer; }
.form { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form .full { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 12px; margin: 0; }
legend { font-weight: 900; font-size: 13px; padding: 0 6px; color: var(--primary); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar > input, .toolbar > select { width: auto; min-width: 140px; flex: 0 1 auto; }
.toolbar > .search { flex: 1 1 220px; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-sunken); box-shadow: inset 0 1px 3px rgba(16,42,84,.12); }
.seg button { border: 0; background: transparent; font: inherit; font-weight: 800; font-size: 13px; color: var(--text-2); padding: 5px 12px; border-radius: 9px; cursor: pointer; }
.seg button.on { background: var(--surface-strong); color: var(--primary); box-shadow: var(--shadow-1), var(--inset); }

/* chips / badges */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 800;
  background: var(--primary-soft); color: var(--text); border: 1px solid var(--line); white-space: nowrap; line-height: 1.6; }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--primary)); box-shadow: 0 0 0 2px rgba(255,255,255,.7); flex: none; }
.chip svg { width: 12px; height: 12px; }
.chip.st-active { background: rgba(28,154,91,.12); } .chip.st-active i { --dot: #1c9a5b; }
.chip.st-retired { background: rgba(217,162,27,.14); } .chip.st-retired i { --dot: #d9a21b; }
.chip.st-studying, .chip.st-abroad { background: rgba(42,120,214,.12); } .chip.st-studying i, .chip.st-abroad i { --dot: #2a78d6; }
.chip.st-deceased { background: rgba(90,100,120,.14); } .chip.st-deceased i { --dot: #5a6478; }
.chip.st-other { background: rgba(120,120,140,.12); } .chip.st-other i { --dot: #8a8aa0; }
.chip.imp-urgent { background: rgba(214,69,69,.14); } .chip.imp-urgent i { --dot: #d64545; }
.chip.imp-high { background: rgba(229,154,11,.16); } .chip.imp-high i { --dot: #e59a0b; }
.chip.imp-normal i { --dot: #2a78d6; } .chip.imp-low i { --dot: #8a96aa; }
.tag-type { --dot: var(--series-1); }
.t-patron { --dot: var(--series-1); } .t-birthday { --dot: var(--series-2); } .t-ordination { --dot: var(--series-3); }
.t-death { --dot: var(--series-4); } .t-feast { --dot: var(--series-5); } .t-bishop { --dot: #7b3fa0; } .t-pilgrimage, .t-retreat, .t-other { --dot: #8a96aa; }
.lc-tim { --lc: #7b3fa0; } .lc-trang { --lc: #e9e4d4; } .lc-do { --lc: #d0342c; } .lc-xanh { --lc: #1c9a5b; } .lc-hong { --lc: #e87ba4; } .lc-den { --lc: #333; }
.lc-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--lc, #aaa); border: 1px solid rgba(0,0,0,.25); box-shadow: inset 0 1px 1px rgba(255,255,255,.6); vertical-align: -2px; }

/* avatar */
.avatar { width: 44px; height: 44px; border-radius: 13px; object-fit: cover; flex: none; background: linear-gradient(145deg, #cfe0f5, #a9c3e6);
  box-shadow: 0 4px 10px -3px rgba(16,42,84,.35), inset 0 0 0 2px rgba(255,255,255,.75); display: grid; place-items: center; color: #3b5780; font-weight: 900; overflow: hidden; }
.avatar.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 12px; }
.avatar.xs { width: 24px; height: 24px; border-radius: 8px; font-size: 10px; }
.avatar.lg { width: 150px; height: 190px; border-radius: 18px; font-size: 36px; box-shadow: var(--shadow-3), inset 0 0 0 3px rgba(255,255,255,.85); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatars { display: flex; flex-wrap: wrap; gap: 6px; }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-strong); -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.t th { position: sticky; top: 0; z-index: 1; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2);
  padding: 9px 10px; background: linear-gradient(180deg, var(--surface-solid), var(--surface-sunken)); border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr { transition: background .12s; }
table.t tbody tr:hover { background: var(--primary-soft); }
table.t tr.clickable { cursor: pointer; }
table.t td.act { white-space: nowrap; text-align: right; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }

/* list items */
.list { display: flex; flex-direction: column; }
.li { display: flex; gap: 10px; align-items: center; padding: 9px 4px; border-bottom: 1px dashed var(--line); min-width: 0; }
.li:last-child { border-bottom: 0; }
.li .body { flex: 1; min-width: 0; }
.li .t1 { font-weight: 800; overflow: hidden; text-overflow: ellipsis; }
.li .t2 { font-size: 12.5px; color: var(--text-2); }
.empty { text-align: center; color: var(--text-3); padding: 26px 10px; font-weight: 700; }
.empty svg { width: 36px; height: 36px; opacity: .45; display: block; margin: 0 auto 6px; }

/* ------------------------------------------------------------------ priest cards */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.pcard { display: flex; gap: 12px; align-items: center; padding: 12px; cursor: pointer; }
.pcard .avatar { width: 58px; height: 72px; border-radius: 14px; }
.pcard .n { font-weight: 900; font-size: 14.5px; line-height: 1.2; }
.pcard .sn { font-size: 12px; color: var(--text-3); font-weight: 700; }
.pcard .pl { font-size: 12.5px; color: var(--text-2); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pcard .chips { margin-top: 5px; display: flex; gap: 4px; flex-wrap: wrap; }

/* profile popup */
.profile-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: start; }
.profile-head .who h2 { font-size: 22px; margin: 2px 0 4px; }
.profile-head .saint { color: var(--primary); font-weight: 800; letter-spacing: .03em; }
.kv { display: grid; grid-template-columns: minmax(120px, 34%) minmax(0, 1fr); gap: 0; font-size: 13.5px; }
.kv > div { padding: 6px 4px; border-bottom: 1px dashed var(--line); }
.kv > div:nth-child(odd) { color: var(--text-2); font-weight: 700; }
.kv > div:nth-last-child(-n+2) { border-bottom: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }
.fact { padding: 10px 12px; border-radius: 12px; background: var(--surface-strong); border: 1px solid var(--line); box-shadow: var(--shadow-1), var(--inset); }
.fact .v { font-weight: 900; font-size: 17px; }
.fact .l { font-size: 11.5px; color: var(--text-2); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 16px 0 12px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; font: inherit; font-weight: 800; color: var(--text-2); padding: 8px 12px; cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }
.timeline { position: relative; margin-left: 8px; padding-left: 18px; border-left: 2px solid var(--line-strong); }
.timeline .ti { position: relative; padding: 4px 0 12px; }
.timeline .ti::before { content: ''; position: absolute; left: -25px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface-strong); border: 3px solid var(--text-3); }
.timeline .ti.cur::before { border-color: var(--success); box-shadow: 0 0 0 4px rgba(28,154,91,.18); }
.timeline .ti .p { font-weight: 800; }
.timeline .ti .d { font-size: 12.5px; color: var(--text-2); }
.profile-doc { white-space: pre-line; font-size: 13.5px; line-height: 1.6; background: var(--surface-sunken); border-radius: 12px; padding: 12px 14px; max-height: 60vh; overflow: auto; }

/* ------------------------------------------------------------------ modal / toast */
.modal-layer { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(8,18,36,.45);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .15s ease; }
.modal {
  width: min(760px, 100%); max-height: calc(100vh - 36px); display: flex; flex-direction: column; border-radius: 22px; overflow: hidden;
  background: var(--surface-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-3), var(--inset); animation: pop .2s cubic-bezier(.2,.9,.3,1.2);
}
.modal.wide { width: min(1080px, 100%); } .modal.narrow { width: min(460px, 100%); }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.35), transparent); }
.modal-h h3 { margin: 0; flex: 1; font-size: 16px; min-width: 0; }
.modal-b { padding: 16px 18px; overflow: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.toasts { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { padding: 10px 14px; border-radius: 13px; font-weight: 700; color: #fff; box-shadow: var(--shadow-3); animation: pop .2s ease; display: flex; gap: 8px; align-items: flex-start;
  background: linear-gradient(135deg, #2c3e5a, #1a2740); }
.toast.ok { background: linear-gradient(135deg, #1fb57e, #12876a); }
.toast.err { background: linear-gradient(135deg, #ea5a5a, #b83636); }
.toast.warn { background: linear-gradient(135deg, #f0b43c, #c98500); color: #2b1c00; }
.loading { display: flex; justify-content: center; padding: 30px; }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--primary-soft); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-sunken), var(--surface-strong), var(--surface-sunken)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ------------------------------------------------------------------ dashboard */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 20px 22px; color: #fff; margin-bottom: 16px;
  background: var(--hero-bg); box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255,255,255,.35); text-shadow: 0 1px 2px rgba(8,50,100,.3);
}
.hero::before { content: ''; position: absolute; inset: 0; background:
  radial-gradient(400px 200px at 85% -20%, rgba(255,255,255,.35), transparent 60%),
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cpath d='M20 10v20M10 20h20' stroke='white' stroke-opacity='.10' stroke-width='2'/%3E%3C/svg%3E"); pointer-events: none; }
.hero::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 50%; background: linear-gradient(180deg, rgba(255,255,255,.14), transparent); pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: 20px; margin: 0; }
.hero .sub { opacity: .9; font-weight: 700; }
.hero .lit { margin-top: 10px; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3); font-weight: 800; }
.daybox { display: flex; flex-direction: column; gap: 10px; }
.daybox .dh { display: flex; align-items: center; gap: 10px; }
.daybox .dnum { width: 54px; height: 58px; border-radius: 14px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
  background: linear-gradient(160deg, #ffffff, #dfe9f7); border: 1px solid var(--line-strong); box-shadow: var(--shadow-2), var(--inset); color: #14304f; overflow: hidden; }
.daybox .dnum b { font-size: 22px; font-weight: 900; }
.daybox .dnum span { font-size: 11px; font-weight: 800; color: #fff; background: var(--danger); width: 100%; text-align: center; padding: 2px 0; margin-bottom: 4px; }
.daybox.tomorrow .dnum span { background: var(--primary); }
.feed-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 12px; background: var(--surface-strong); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.feed-item .fi { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none; color: #fff; background: var(--dot, var(--primary)); box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.feed-item .fi svg { width: 15px; height: 15px; }
.feed-item .ft { font-size: 13.5px; }
.feed-item .fl { font-size: 11.5px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.lit-banner { border-left: 5px solid var(--lc, #aaa); }

/* bar chart */
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 38px; align-items: center; gap: 8px; font-size: 13px; position: relative; }
.bar-row .lb { color: var(--text-2); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .tr { height: 14px; background: var(--surface-sunken); border-radius: 4px; overflow: hidden; }
.bar-row .fl { display: block; height: 100%; background: linear-gradient(90deg, var(--series-1), var(--primary-2)); border-radius: 0 4px 4px 0; min-width: 2px; transition: width .5s ease; }
.bar-row .vv { text-align: right; font-weight: 800; }
.bar-row:hover .fl { filter: brightness(1.12); }
.vbars { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 16px; border-bottom: 1px solid var(--line-strong); }
.vbars .vb { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; position: relative; min-width: 0; }
.vbars .vb .vcol { width: 70%; max-width: 34px; background: var(--series-1); border-radius: 4px 4px 0 0; transition: height .5s ease; }
.vbars .vb .vv { font-size: 12px; font-weight: 800; margin-bottom: 3px; }
.vlabels { display: flex; gap: 6px; }
.vlabels span { flex: 1; text-align: center; font-size: 11.5px; color: var(--text-2); font-weight: 700; padding-top: 4px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip { position: fixed; z-index: 300; pointer-events: none; padding: 6px 10px; border-radius: 9px; font-size: 13px; font-weight: 700; color: #fff; background: rgba(16,28,48,.92); box-shadow: var(--shadow-2); }

/* ------------------------------------------------------------------ calendar */
.cal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-head .mtitle { font-size: 20px; font-weight: 900; min-width: 190px; }
.cal-legend { display: flex; gap: 6px; flex-wrap: wrap; }
.cal-legend label { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--surface-strong); border: 1px solid var(--line); font-weight: 800; font-size: 12.5px; cursor: pointer; }
.cal-legend label i { width: 10px; height: 10px; border-radius: 3px; background: var(--dot); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; }
.cal .dow { text-align: center; font-size: 12px; font-weight: 900; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; padding: 2px 0; }
.cal .dow.sun { color: var(--danger); }
.cell {
  position: relative; min-height: 112px; border-radius: 14px; padding: 6px 6px 5px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; overflow: hidden;
  background: linear-gradient(170deg, var(--surface-strong), var(--surface)); border: 1px solid var(--glass-border);
  box-shadow: 0 1px 0 rgba(255,255,255,.8) inset, 0 3px 8px -2px rgba(16,42,84,.12); transition: transform .15s, box-shadow .15s;
}
.cell:hover { transform: translateY(-2px); box-shadow: var(--shadow-2), var(--inset); z-index: 2; }
.cell.out { opacity: .45; }
.cell .dn { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.cell .dn b { font-size: 15px; font-weight: 900; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 9px; }
.cell .dn small { font-size: 10.5px; color: var(--text-3); font-weight: 700; }
.cell.sun .dn b { color: var(--danger); }
.cell.today { border: 2px solid var(--primary-2); background: linear-gradient(170deg, rgba(77,155,255,.22), var(--surface-strong)); box-shadow: 0 0 0 4px rgba(77,155,255,.18), var(--shadow-2); }
.cell.today .dn b { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 4px 10px -2px rgba(31,111,209,.6); }
.cell.sel { outline: 2px dashed var(--accent); outline-offset: 1px; }
.cell .lcbar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--lc, transparent); }
.ev { font-size: 11.5px; font-weight: 800; padding: 1px 6px; border-radius: 6px; color: #fff; background: var(--ec, var(--primary)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.ev.lit { background: transparent; color: var(--text); border-left: 3px solid var(--ec); border-radius: 3px; padding-left: 4px; font-weight: 700; }
.ev.com { background: color-mix(in srgb, var(--ec) 16%, transparent); color: var(--text); border: 1px solid color-mix(in srgb, var(--ec) 45%, transparent); }
.ev.imp-urgent { box-shadow: 0 0 0 2px #d64545 inset; }
.ev.more { background: var(--surface-sunken); color: var(--text-2); }
.cal-side .item { padding: 8px 10px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-strong); margin-bottom: 8px; border-left: 4px solid var(--ec, var(--primary)); }

/* liturgical year */
.stamp-wrap { position: relative; }
.stamp-draft {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-16deg); z-index: 5; pointer-events: none;
  padding: 8px 26px; border: 5px double rgba(214, 40, 40, .78); border-radius: 12px; color: rgba(214, 40, 40, .78);
  font-weight: 900; font-size: clamp(28px, 7vw, 58px); letter-spacing: .18em; text-transform: uppercase; white-space: nowrap;
  text-shadow: 0 0 1px rgba(214,40,40,.4); mix-blend-mode: multiply; background: rgba(255,255,255,.05);
  -webkit-mask-image: repeating-linear-gradient(45deg, #000 0 6px, rgba(0,0,0,.82) 6px 8px);
  mask-image: repeating-linear-gradient(45deg, #000 0 6px, rgba(0,0,0,.82) 6px 8px);
}
.stamp-sticky { position: sticky; top: 42vh; height: 0; z-index: 6; pointer-events: none; }
.stamp-sticky .stamp-draft { top: 0; }
.mini .stamp-draft.sm { font-size: 22px; padding: 2px 12px; top: 55%; }
.stamp-draft.sm { font-size: 26px; border-width: 4px; padding: 4px 16px; }
.issued { margin-top: 12px; padding: 10px 14px; border-radius: 12px; font-size: 13px; background: rgba(28,154,91,.1); border: 1px solid rgba(28,154,91,.3); display: flex; gap: 8px; align-items: center; }
.issued svg { width: 18px; height: 18px; color: var(--success); }
.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.mini { padding: 12px; }
.mini h4 { margin: 0 0 8px; display: flex; justify-content: space-between; }
.mini .mg { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.mini .mg .h { font-size: 10.5px; text-align: center; color: var(--text-3); font-weight: 900; }
.mini .mg .d { position: relative; aspect-ratio: 1; border-radius: 8px; display: grid; place-items: center; font-size: 12.5px; font-weight: 800; cursor: pointer;
  background: var(--surface-strong); border: 1px solid var(--line); transition: transform .1s; }
.mini .mg .d:hover { transform: scale(1.1); z-index: 2; box-shadow: var(--shadow-2); }
.mini .mg .d::after { content: ''; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); width: 60%; height: 3px; border-radius: 2px; background: var(--lc, transparent); }
.mini .mg .d.rk { background: linear-gradient(160deg, #fff7e0, #f9e2a6); border-color: #e3c268; }
:root[data-theme="dark"] .mini .mg .d.rk { background: linear-gradient(160deg, #4a3d17, #3a300f); }
.mini .mg .d.sun { color: var(--danger); }
.mini .mg .d.today { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 0 0 3px rgba(77,155,255,.35); }
.mini .mg .d.blank { visibility: hidden; }
.dayline { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 12px; padding: 10px 6px; border-bottom: 1px dashed var(--line); align-items: start; }
.dayline.today { background: linear-gradient(90deg, rgba(77,155,255,.18), transparent); border-radius: 12px; box-shadow: inset 3px 0 0 var(--primary); }
.dayline .dd { text-align: center; border-radius: 12px; padding: 6px 4px; background: var(--surface-strong); border: 1px solid var(--line); border-top: 5px solid var(--lc, #ccc); box-shadow: var(--shadow-1); }
.dayline .dd b { display: block; font-size: 20px; line-height: 1; }
.dayline .dd small { display: block; font-size: 11px; color: var(--text-2); font-weight: 800; }
.dayline .cel { font-weight: 900; }
.dayline .rd { font-size: 12.5px; color: var(--text-2); white-space: pre-line; }
.dayline .nt { font-size: 13px; white-space: pre-line; margin-top: 4px; }

/* sơ đồ tổ chức — cây thư mục */
.otree { display: flex; flex-direction: column; }
.tnode { position: relative; }
.tnode [role="group"] { position: relative; margin-left: 22px; padding-left: 12px; border-left: 2px solid color-mix(in srgb, var(--oc) 35%, transparent); }
.trow {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; margin: 3px 0; border-radius: 13px; cursor: pointer; min-width: 0;
  background: linear-gradient(170deg, var(--surface-strong), var(--surface)); border: 1px solid var(--line);
  box-shadow: var(--shadow-1), var(--inset); transition: background .12s, transform .12s, box-shadow .12s;
}
.trow:hover { background: var(--primary-soft); box-shadow: var(--shadow-2), var(--inset); }
.trow.hit { outline: 2px solid var(--gold); outline-offset: -1px; }
.trow.off { opacity: .55; }
.tcar { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface-solid); color: var(--text-2);
  display: grid; place-items: center; cursor: pointer; flex: none; padding: 0; box-shadow: var(--shadow-1); }
.tcar svg { width: 15px; height: 15px; transition: transform .18s ease; }
.tcar.on svg { transform: rotate(90deg); }
.tcar.sp { border: 0; background: none; box-shadow: none; cursor: default; }
.tfold { width: 34px; height: 34px; border-radius: 11px; flex: none; display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, color-mix(in srgb, var(--oc) 55%, #fff), var(--oc));
  box-shadow: 0 6px 12px -6px var(--oc), inset 0 1px 0 rgba(255,255,255,.45); }
.tfold svg { width: 17px; height: 17px; }
.tmain { flex: 1; min-width: 0; }
.tt { font-weight: 900; font-size: 14.5px; line-height: 1.3; color: var(--text); }
.ts { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts b { color: var(--text); font-weight: 800; }
.tcnt { display: inline-block; min-width: 22px; padding: 0 7px; margin-left: 4px; border-radius: 999px; font-size: 11.5px; line-height: 19px; text-align: center; vertical-align: 1px;
  color: var(--oc); background: color-mix(in srgb, var(--oc) 13%, transparent); border: 1px solid color-mix(in srgb, var(--oc) 30%, transparent); }
.tav { flex: none; }
.tact { display: flex; gap: 2px; flex: none; opacity: .55; }
.trow:hover .tact { opacity: 1; }
@media (max-width: 640px) {
  .tnode [role="group"] { margin-left: 12px; padding-left: 8px; }
  .trow { gap: 7px; padding: 6px 7px; }
  .tfold { width: 28px; height: 28px; border-radius: 9px; }
  .ts { white-space: normal; }
  .tact { opacity: 1; }
}

/* news */
.ngrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.ncard { padding: 0; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; }
.ncard .cv { aspect-ratio: 16/9; background: linear-gradient(135deg, #5ab0f0, #5ccfd6); position: relative; overflow: hidden; }
.ncard .cv img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ncard .cv .ph { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255,255,255,.75); }
.ncard .cv .ph svg { width: 46px; height: 46px; }
.ncard .nb { padding: 12px 14px 14px; }
.ncard .nt { font-weight: 900; font-size: 15px; line-height: 1.3; margin-bottom: 4px; }
.ncard .ns { color: var(--text-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pin { position: absolute; top: 10px; left: 10px; z-index: 2; }
.article { max-width: 820px; margin: 0 auto; }
.article .cover { width: 100%; border-radius: 16px; margin-bottom: 14px; box-shadow: var(--shadow-2); }
.rich { font-size: 15px; line-height: 1.7; overflow-wrap: anywhere; }
.rich img { max-width: 100%; height: auto; border-radius: 10px; }
.rich blockquote { border-left: 4px solid var(--primary); margin: 10px 0; padding: 6px 14px; background: var(--primary-soft); border-radius: 0 10px 10px 0; }
.rich table { border-collapse: collapse; } .rich td, .rich th { border: 1px solid var(--line-strong); padding: 4px 8px; }
.rich .ql-align-center { text-align: center; } .rich .ql-align-right { text-align: right; } .rich .ql-align-justify { text-align: justify; }
.rich iframe { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 10px; }
.ql-toolbar.ql-snow { border-radius: 12px 12px 0 0; border-color: var(--line-strong) !important; background: var(--surface-solid); position: sticky; top: 0; z-index: 3; }
.ql-container.ql-snow { border-radius: 0 0 12px 12px; border-color: var(--line-strong) !important; background: #fff; font-family: var(--font) !important; font-size: 15px !important; color: #16243a; }
.ql-editor { min-height: 320px; }
.ql-snow .ql-picker { color: var(--text); }
.editor-wrap .ql-editor img { max-width: 100%; }

/* parish */
.mass { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.mass .mg { padding: 10px; border-radius: 12px; background: var(--surface-strong); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.mass .mg b { display: block; font-size: 12px; text-transform: uppercase; color: var(--text-2); letter-spacing: .05em; margin-bottom: 4px; }
.time-pill { display: inline-block; margin: 2px 3px 2px 0; padding: 2px 8px; border-radius: 8px; background: linear-gradient(180deg, #fff, #e6eefa); border: 1px solid var(--line-strong); font-weight: 900; font-size: 13px; color: #16243a; }

/* login */
.auth-page { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); padding: 26px 26px 22px; border-radius: 26px; }
.auth-card .logo { width: 88px; height: 88px; margin: -70px auto 8px; display: block; border-radius: 24px; filter: drop-shadow(0 12px 22px rgba(16,42,84,.35)); object-fit: contain; }
.auth-card h1 { text-align: center; font-size: 20px; margin-bottom: 2px; letter-spacing: .04em; }
.auth-card .slogan { text-align: center; color: var(--text-2); margin-bottom: 18px; font-weight: 700; }
.auth-foot { margin-top: 16px; text-align: center; font-size: 12px; color: var(--text-3); }

/* help */
.help-body h4 { margin: 12px 0 4px; color: var(--primary); }
.help-body ul { margin: 4px 0 8px; padding-left: 18px; }
.help-body li { margin: 3px 0; }
.tips { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: linear-gradient(135deg, rgba(242,193,78,.18), rgba(242,193,78,.06)); border: 1px solid rgba(217,162,27,.35); }
.tips b { color: #a77600; }
:root[data-theme="dark"] .tips b { color: #f2c14e; }
.hb-toc { position: sticky; top: calc(var(--topbar-h) + 12px); max-height: calc(100vh - 110px); overflow: auto; }
.hb-toc a { display: block; padding: 5px 8px; border-radius: 8px; font-weight: 700; color: var(--text-2); }
.hb-toc a:hover { background: var(--primary-soft); text-decoration: none; }
.hb-topic { scroll-margin-top: 80px; margin-bottom: 16px; }

/* perms matrix */
.pmx td, .pmx th { text-align: center; }
.pmx td:first-child, .pmx th:first-child { text-align: left; }
.logo-prev { width: 96px; height: 96px; border-radius: 20px; object-fit: contain; background: var(--surface-sunken); border: 1px dashed var(--line-strong); padding: 6px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; background: var(--surface-sunken); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
.alert { padding: 10px 12px; border-radius: 12px; border: 1px solid; font-weight: 700; font-size: 13.5px; }
.alert.info { background: rgba(42,120,214,.1); border-color: rgba(42,120,214,.3); }
.alert.warn { background: rgba(229,154,11,.12); border-color: rgba(229,154,11,.4); }
.alert.err { background: rgba(214,69,69,.1); border-color: rgba(214,69,69,.35); }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1200px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 991px) {
  .sidebar { transform: translateX(-105%); width: min(290px, 86vw); }
  body.nav-open .sidebar { transform: none; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gsearch { width: auto; flex: 1; }
  .topbar .today { display: none; }
  .topbar .page-title { display: none; }
  .content { padding: 14px 14px calc(84px + env(safe-area-inset-bottom, 0px)); }
  .footer { margin: 0 14px calc(84px + env(safe-area-inset-bottom, 0px)); }
  .bottom-nav {
    display: flex; position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 45; height: 60px; border-radius: 20px;
    background: var(--surface-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--glass-border); box-shadow: var(--shadow-3), var(--inset);
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 800; color: var(--text-3); text-decoration: none; min-width: 0; }
  .bottom-nav a svg { width: 21px; height: 21px; }
  .bottom-nav a.active { color: var(--primary); }
  .bottom-nav a.active svg { filter: drop-shadow(0 3px 5px rgba(31,111,209,.45)); transform: translateY(-1px); }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .cell { min-height: 78px; }
  .cell .dn small { display: none; }
}
@media (max-width: 640px) {
  :root { --fs: 14px; }
  .g-2, .g-3, .g-4, .form, .form.c3 { grid-template-columns: minmax(0, 1fr); }
  .stats.g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 10px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .stat .badge3d { width: 38px; height: 38px; border-radius: 12px; }
  .stat .badge3d svg { width: 19px; height: 19px; }
  .stat .v { font-size: 22px; }
  .content { padding-left: 12px; padding-right: 12px; }
  .card { padding: 13px; border-radius: 14px; }
  .modal-layer { padding: 0; align-items: flex-end; }
  .modal, .modal.wide, .modal.narrow { width: 100%; max-height: 94vh; border-radius: 22px 22px 0 0; }
  .profile-head { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .profile-head .row { justify-content: center; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv > div:nth-child(odd) { border-bottom: 0; padding-bottom: 0; font-size: 12px; }
  .pgrid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .cal { gap: 3px; }
  .cell { min-height: 58px; padding: 3px; border-radius: 9px; }
  .cell .dn b { font-size: 13px; width: 22px; height: 22px; }
  .cell .ev { font-size: 0; height: 5px; padding: 0; border-radius: 3px; }
  .cell .ev.lit { height: 3px; border-left: 0; background: var(--ec); }
  .cal .dow { font-size: 10.5px; letter-spacing: 0; }
  .cal-head .mtitle { font-size: 17px; min-width: 0; flex: 1; }
  .toolbar > input, .toolbar > select { flex: 1 1 140px; }
  .dayline { grid-template-columns: 58px minmax(0, 1fr); gap: 8px; }
  .hero { padding: 16px; border-radius: 18px; }
  .bar-row { grid-template-columns: 78px minmax(0, 1fr) 32px; }
}
@media print {
  .sidebar, .topbar, .bottom-nav, .toolbar, .btn, .footer { display: none !important; }
  .main { margin: 0; }
  body { background: #fff; }
  body::before { display: none; }
  .card { box-shadow: none; border: 1px solid #ccc; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* thông báo máy chủ chưa sẵn sàng (màn hình đăng nhập) */
.srv-issue { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; text-align: left;
  background: rgba(214, 48, 49, .08); border: 1px solid rgba(214, 48, 49, .35); color: #9b1c1c; }
[data-theme="dark"] .srv-issue { color: #ffb4b4; background: rgba(214, 48, 49, .16); }
.srv-issue a { color: inherit; font-weight: 700; }

/* tác vụ nhanh (bảng điều khiển quản trị) */
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; margin-bottom: 16px; }
.qa {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 16px; min-width: 0;
  color: var(--text); font-weight: 800; font-size: 14px; text-decoration: none !important;
  background: linear-gradient(170deg, var(--surface-strong), var(--surface)); border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-2), var(--inset); transition: transform .15s ease, box-shadow .15s ease;
}
.qa:hover { transform: translateY(-3px); box-shadow: var(--shadow-3), var(--inset); }
.qa:active { transform: translateY(0); }
.qa .qi {
  width: 40px; height: 40px; border-radius: 13px; flex: none; display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, var(--q2), var(--q1));
  box-shadow: 0 8px 16px -8px var(--q1), inset 0 2px 0 rgba(255,255,255,.45), inset 0 -3px 6px rgba(0,0,0,.15);
}
.qa .qi svg { width: 20px; height: 20px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.2)); }
.qa .qt { min-width: 0; line-height: 1.25; }
.qa .qt small { display: block; font-size: 12px; font-weight: 700; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .qa { padding: 8px; gap: 8px; font-size: 13px; } .qa .qi { width: 34px; height: 34px; } .qa .qt small { display: none; } }

/* linh mục quản xứ — nổi bật */
.chip.pastor {
  color: #6b4700; font-weight: 900; border-color: rgba(201, 138, 0, .45); padding-left: 6px;
  background: linear-gradient(180deg, #fff6d6, #ffe39a); box-shadow: 0 2px 6px -2px rgba(201, 138, 0, .45), inset 0 1px 0 rgba(255,255,255,.8);
}
.chip.pastor svg { width: 13px; height: 13px; color: #b07700; }
:root[data-theme="dark"] .chip.pastor { color: #ffe39a; background: linear-gradient(180deg, #5a4210, #3d2d08); border-color: rgba(242,193,78,.45); }
:root[data-theme="dark"] .chip.pastor svg { color: #f2c14e; }
.pcard { position: relative; }
.pcard.is-pastor { border-color: rgba(217, 162, 27, .55); box-shadow: var(--shadow-2), var(--inset), inset 0 0 0 1px rgba(242, 193, 78, .35); }
.pcard.is-pastor .avatar { box-shadow: 0 4px 10px -3px rgba(16,42,84,.35), 0 0 0 3px #f2c14e; }
.pastor-flag, .role-flag {
  position: absolute; top: 8px; right: 8px; z-index: 2; padding: 1px 8px 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 900; letter-spacing: .02em;
  color: #6b4700; background: linear-gradient(180deg, #fff3c4, #f7d36b); border: 1px solid rgba(201,138,0,.4); box-shadow: 0 3px 8px -3px rgba(201,138,0,.6);
}
.li.is-pastor { background: linear-gradient(90deg, rgba(242, 193, 78, .16), transparent); border-radius: 12px; }
.li.is-pastor .avatar { box-shadow: 0 0 0 3px #f2c14e; }
.pastor-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 2px 0; font-weight: 800; }
.my-parish { border: 1px solid rgba(217, 162, 27, .45); background: linear-gradient(135deg, rgba(255, 243, 196, .75), var(--surface)); }
:root[data-theme="dark"] .my-parish { background: linear-gradient(135deg, rgba(90, 66, 16, .45), var(--surface)); }
.mass-row { flex-wrap: nowrap; gap: 6px; }
.mass-row select { max-width: 190px; }
.mass-row input[type="time"] { max-width: 124px; }
@media (max-width: 640px) {
  .mass-row { flex-wrap: wrap; }
  .mass-row select { max-width: none; flex: 1 1 60%; }
  .mass-row input[type="time"] { flex: 1 1 30%; max-width: none; }
  .mass-row input[data-k="note"] { flex: 1 1 70%; }
}

/* lịch chung: biểu tượng sự kiện nhấp nháy */
.ev-flag {
  position: relative; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 8px; margin-right: auto; margin-left: 4px;
  color: #fff; background: var(--ec, var(--primary)); box-shadow: 0 0 0 0 var(--ec, var(--primary));
  animation: evblink 1.4s ease-in-out infinite;
}
.ev-flag svg { width: 13px; height: 13px; }
.ev-flag i { position: absolute; top: -6px; right: -7px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; font: 900 10px/16px var(--font); font-style: normal;
  color: #fff; background: #d64545; box-shadow: 0 0 0 2px var(--surface-strong); }
.ev-flag.imp-urgent { background: #d64545; --ec: #d64545; animation-duration: .9s; }
.ev-flag.imp-high { background: #e58a0b; --ec: #e58a0b; }
@keyframes evblink {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ec) 55%, transparent); }
  50% { opacity: .45; transform: scale(.9); box-shadow: 0 0 0 6px color-mix(in srgb, var(--ec) 0%, transparent); }
}
.cell.has-ev { border-color: color-mix(in srgb, var(--primary-2) 45%, var(--glass-border)); }
@media (max-width: 640px) { .ev-flag { width: 16px; height: 16px; border-radius: 5px; margin-left: 2px; } .ev-flag svg { width: 10px; height: 10px; } .ev-flag i { display: none; } }
@media (prefers-reduced-motion: reduce) { .ev-flag { animation: none !important; outline: 2px solid var(--ec); outline-offset: 1px; } }

/* quy trình duyệt lịch */
.wf { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 12px; counter-reset: wf; }
.wf li { flex: 1; min-width: 0; padding: 7px 10px; border-radius: 12px; background: var(--surface-sunken); border: 1px solid var(--line); position: relative; }
.wf li b { display: block; font-size: 13px; }
.wf li small { display: block; font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf li.done { background: rgba(28, 154, 91, .1); border-color: rgba(28, 154, 91, .3); }
.wf li.done b { color: var(--success); }
.wf li.on { background: linear-gradient(135deg, var(--primary), var(--primary-2)); border-color: transparent; color: #fff; box-shadow: var(--shadow-2); }
.wf li.on small { color: rgba(255,255,255,.85); }
@media (max-width: 640px) { .wf li small { display: none; } .wf li { padding: 6px 8px; } }

/* biểu tượng trong khung thông báo & nhãn lựa chọn nhiều dòng */
.alert svg { width: 16px; height: 16px; vertical-align: -3px; flex: none; }
label.chk.opt { display: flex; align-items: flex-start; gap: 8px; font-weight: 600; line-height: 1.4; }
label.chk.opt input { margin-top: 2px; flex: none; }

/* v1.2.0 — thanh lọc giáo hạt (thay các ô giáo hạt): kết quả tìm kiếm hiện ngay bên dưới */
.sticky-tools { position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 6px); z-index: 12; background: var(--surface-strong); padding: 10px 12px; }
.deanchips { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.dchip { flex: none; border: 1px solid var(--line-strong); background: var(--surface-sunken); color: var(--text-2); font: inherit; font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.dchip b { display: inline-block; min-width: 18px; margin-left: 3px; padding: 0 5px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); font-size: 11.5px; text-align: center; }
.dchip:hover { border-color: var(--primary); color: var(--text); }
.dchip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.dchip.on b { background: rgba(255,255,255,.25); color: #fff; }
.dchip.zero { opacity: .5; }
.dean-head { display: flex; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; }
.dean-head h3 { margin: 0 0 6px; }
@media (max-width: 760px) { .sticky-tools { top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); padding: 8px; } .sticky-tools .seg { width: 100%; overflow-x: auto; } .sticky-tools .seg button { white-space: nowrap; flex: 1 0 auto; padding: 5px 9px; } }

/* v1.2.0 — vai trò trên thẻ linh mục: Giám mục (tím) · Quản xứ (vàng) · Phó xứ (xanh ngọc) */
.pcard { padding-right: 14px; }
.pcard.is-pastor .n, .pcard.is-bishop .n, .pcard.is-vice .n { padding-right: 58px; }
.pcard.is-bishop { border-color: rgba(176, 120, 230, .7); box-shadow: var(--shadow-2), var(--inset), inset 0 0 0 1px rgba(190, 140, 240, .45); }
.pcard.is-bishop .avatar { box-shadow: 0 4px 10px -3px rgba(16,42,84,.35), 0 0 0 3px #b98ae8; }
.role-flag.is-bishop { color: #fff; background: linear-gradient(180deg, #a874dc, #7b3fa0); border-color: rgba(123,63,160,.6); box-shadow: 0 3px 8px -3px rgba(123,63,160,.7); }
.pcard.is-vice { border-color: rgba(38, 190, 176, .6); box-shadow: var(--shadow-2), var(--inset), inset 0 0 0 1px rgba(60, 205, 190, .32); }
.pcard.is-vice .avatar { box-shadow: 0 4px 10px -3px rgba(16,42,84,.35), 0 0 0 3px #3cc8b8; }
.role-flag.is-vice { color: #04352f; background: linear-gradient(180deg, #b5f2e9, #58d3c3); border-color: rgba(20,150,135,.5); box-shadow: 0 3px 8px -3px rgba(20,150,135,.6); }
.li.is-bishop { background: linear-gradient(90deg, rgba(176, 120, 230, .16), transparent); border-radius: 12px; }
.li.is-bishop .avatar { box-shadow: 0 0 0 3px #b98ae8; }
.li.is-vice { background: linear-gradient(90deg, rgba(60, 200, 184, .13), transparent); border-radius: 12px; }
.li.is-vice .avatar { box-shadow: 0 0 0 3px #3cc8b8; }
.chip.vice { color: #b5f2e9; background: rgba(60, 200, 184, .16); border-color: rgba(60, 200, 184, .45); font-weight: 800; }
.chip.bishop { color: #e6d2fb; background: rgba(176, 120, 230, .18); border-color: rgba(176, 120, 230, .5); font-weight: 800; }

/* v1.2.0 — thư viện ảnh & bản đồ giáo xứ */
.gal-cover { border-radius: 16px; box-shadow: var(--shadow-2); max-height: 320px; object-fit: cover; width: 100%; }
.gallery { display: flex; flex-direction: column; gap: 8px; }
.gal-main { position: relative; display: block; padding: 0; border: 0; border-radius: 16px; overflow: hidden; cursor: zoom-in; box-shadow: var(--shadow-2); background: var(--surface-sunken); }
.gal-main img { display: block; width: 100%; height: 300px; object-fit: cover; transition: transform .35s; }
.gal-main:hover img { transform: scale(1.02); }
.gal-count { position: absolute; right: 10px; bottom: 10px; display: inline-flex; gap: 5px; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; color: #fff; background: rgba(10, 20, 40, .62); backdrop-filter: blur(6px); }
.gal-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.gal-strip button { flex: none; padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; background: none; }
.gal-strip button:hover, .gal-strip button:focus-visible { border-color: var(--primary); }
.gal-strip img { display: block; width: 74px; height: 54px; object-fit: cover; }
.mapbox { border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-1); border: 1px solid var(--line); background: var(--surface-sunken); }
.mapbox iframe { display: block; width: 100%; height: 240px; border: 0; }
.modal.lightbox { max-width: min(1100px, 96vw); }
.modal.lightbox .modal-b { padding: 8px; }
.lb { position: relative; margin: 0; text-align: center; }
.lb img { max-width: 100%; max-height: 74vh; border-radius: 10px; object-fit: contain; }
.lb figcaption { margin-top: 6px; font-size: 13px; color: var(--text-2); min-height: 1em; }
.lb-prev, .lb-next { position: absolute; top: 45%; transform: translateY(-50%); border-radius: 50%; }
.lb-prev { left: 8px; } .lb-next { right: 8px; }
.gman { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gm-item { position: relative; border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; background: var(--surface-sunken); display: flex; flex-direction: column; }
.gm-item.pending { border-style: dashed; }
.gm-item img { width: 100%; height: 96px; object-fit: cover; display: block; }
.gm-cover { position: absolute; top: 6px; left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 900; color: #4a3200; background: #f7d36b; }
.gm-cap { margin: 5px 5px 0; width: calc(100% - 10px); font-size: 12px; padding: 4px 7px; min-height: 0; }
.gm-act { display: flex; align-items: center; justify-content: space-between; padding: 3px 4px; }
.gm-add { min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 2px dashed var(--line-strong); border-radius: 12px; background: transparent; color: var(--text-2); font: inherit; font-weight: 800; cursor: pointer; }
.gm-add:hover { border-color: var(--primary); color: var(--primary); }
.gm-add svg { width: 26px; height: 26px; }
.gm-add small { font-weight: 600; color: var(--text-3); }
@media (max-width: 760px) { .gal-main img { height: 210px; } .mapbox iframe { height: 200px; } }

/* v1.2.1 — độ rộng cột bảng: tên 1 dòng, cột chữ dài có độ rộng tối thiểu; kéo mép tiêu đề để đổi độ rộng */
table.t td.w-sm, table.t th.w-sm { min-width: 150px; }
table.t td.w-md, table.t th.w-md { min-width: 210px; }
table.t td.w-lg, table.t th.w-lg { min-width: 280px; }
table.t th .col-rz { position: absolute; top: 0; right: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 2; touch-action: none; }
table.t th .col-rz::after { content: ''; position: absolute; top: 25%; bottom: 25%; right: 0; width: 1px; background: var(--line-strong); opacity: 0; transition: opacity .15s; }
table.t thead:hover th .col-rz::after, table.t th .col-rz.on::after { opacity: 1; }
table.t th .col-rz.on::after { background: var(--primary); width: 2px; }
body.col-resizing, body.col-resizing * { cursor: col-resize !important; user-select: none !important; }

/* v1.2.2 — giờ lễ theo mục */
.mass2 { display: flex; flex-direction: column; gap: 10px; }
.mt-sec { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; background: var(--surface-sunken); }
.mt-h { font-weight: 900; font-size: 13px; color: var(--primary-2); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.mt-h svg { width: 15px; height: 15px; }
.mt-line { display: grid; grid-template-columns: minmax(110px, 38%) minmax(0, 1fr); gap: 4px 10px; padding: 4px 0; border-top: 1px dashed var(--line); }
.mt-h + .mt-line { border-top: 0; }
.mt-day { font-weight: 800; font-size: 13px; }
.mt-date { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 6px; background: var(--primary-soft); color: var(--primary-2); font-size: 12px; }
.mt-times { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.mt-times .xs { flex-basis: 100%; }
.mt-times .time-pill small { font-weight: 600; opacity: .8; margin-left: 3px; }
.mt-tabs { flex-wrap: wrap; }
.mt-tabs .mt-n { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--primary-soft); color: var(--primary-2); font-size: 11px; text-align: center; }
.mt-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mt-row select { flex: 0 1 200px; min-width: 150px; }
.mt-row input[type=time] { flex: 0 0 118px; }
.mt-row input[type=date] { flex: 0 0 150px; }
.mt-row .mt-grow { flex: 1 1 180px; min-width: 140px; }
@media (max-width: 760px) { .mt-line { grid-template-columns: minmax(0, 1fr); } .mt-row { padding: 6px; border: 1px solid var(--line); border-radius: 10px; } .mt-row select, .mt-row .mt-grow { flex-basis: 100%; } }

/* v1.2.2 — bảng rộng: thanh cuộn ngang nổi ở đáy màn hình; cột đã kéo độ rộng thì chữ tự xuống dòng */
.table-wrap { position: relative; }
.hscroll { position: fixed; bottom: 0; z-index: 25; height: 16px; overflow-x: auto; overflow-y: hidden; background: color-mix(in srgb, var(--surface-solid) 88%, transparent);
  border-top: 1px solid var(--line-strong); border-radius: 8px 8px 0 0; box-shadow: 0 -4px 12px rgba(6, 14, 30, .25); }
.hscroll > div { height: 1px; }
.hscroll[hidden] { display: none; }
.table-wrap { scrollbar-width: thin; }
table.t.rz-fixed { table-layout: fixed; }
table.t.rz-fixed th, table.t.rz-fixed td { white-space: normal !important; overflow-wrap: anywhere; min-width: 0 !important; }
table.t.rz-fixed th { overflow: hidden; text-overflow: ellipsis; }
table.t.rz-fixed td.act { white-space: nowrap !important; }
@media (max-width: 900px) { .hscroll { display: none !important; } }

/* v1.2.3 — danh sách chọn */
.lk-grid { grid-template-columns: minmax(0, 290px) minmax(0, 1fr); align-items: start; }
.lk-t input[data-f="label"] { min-height: 32px; padding: 4px 8px; }
@media (max-width: 900px) { .lk-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .tv-alert { flex-wrap: wrap; } .tv-alert .grow { flex: 1 1 calc(100% - 30px); } .tv-alert .btn { margin-left: 26px; } }
/* Du lịch nước ngoài — giai đoạn chuyến đi */
.chip.ph-done { background: rgba(28,154,91,.14); } .chip.ph-done i { --dot: #1c9a5b; }
.chip.ph-away { background: rgba(224,112,43,.16); } .chip.ph-away i { --dot: #e0702b; }
.chip.ph-planned { background: rgba(42,120,214,.14); } .chip.ph-planned i { --dot: #2a78d6; }
.chip.ph-overdue { background: rgba(217,162,27,.16); } .chip.ph-overdue i { --dot: #d9a21b; }
.chip.ph-cancelled { background: rgba(90,100,120,.16); } .chip.ph-cancelled i { --dot: #5a6478; }
.chip.ph-late { background: rgba(214,69,69,.16); } .chip.ph-late i { --dot: #d64545; }
.stat.tv-k { cursor: pointer; border-top: 3px solid var(--kc, transparent); transition: transform .15s; }
.stat.tv-k:hover { transform: translateY(-2px); }
.stat.tv-k.on { box-shadow: 0 0 0 2px var(--kc) inset; }
.tv-phase { display: grid; gap: 10px; }
.tv-phase .pr { display: grid; grid-template-columns: 150px 1fr 88px; gap: 10px; align-items: center; cursor: pointer; }
.tv-phase .pr .lb { font-weight: 800; display: flex; align-items: center; gap: 7px; }
.tv-phase .pr .lb i { width: 10px; height: 10px; border-radius: 50%; background: var(--pc); flex: none; }
.tv-phase .pr .tr { height: 12px; border-radius: 6px; background: var(--primary-soft); overflow: hidden; }
.tv-phase .pr .tr span { display: block; height: 100%; background: var(--pc); border-radius: 6px; }
.tv-phase .pr .vv { text-align: right; font-weight: 800; }
.tv-phase .pr .vv small { display: block; font-weight: 600; opacity: .7; font-size: 11px; }
@media (max-width: 640px) { .tv-phase .pr { grid-template-columns: 120px 1fr 70px; } }
/* v1.2.7 — mã đăng nhập & mật khẩu hệ thống */
.alert.ok { background: rgba(28,154,91,.12); border-color: rgba(28,154,91,.4); }
.alert:has(> svg) { display: flex; gap: 10px; align-items: flex-start; }
.pw-card { display: grid; gap: 8px; margin: 12px 0; padding: 12px 14px; border-radius: 14px; background: var(--surface-sunken); border: 1px dashed var(--line); }
.pw-card > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.pw-card span { font-size: 12px; font-weight: 700; opacity: .75; }
.pw-card b { font-size: 18px; letter-spacing: 1px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; user-select: all; }
.pw-card b.code { background: none; padding: 0; font-size: 18px; }
.login-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; letter-spacing: .5px; }
.pwb-list .li .right { text-align: right; }
.pw-policy { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.pw-policy > div { padding: 10px 12px; border-radius: 12px; background: var(--surface-sunken); }
.pw-policy b { display: block; font-size: 20px; }
.pw-policy span { font-size: 12px; opacity: .8; }
@media (max-width: 900px) { .pw-policy { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* v1.2.8 — linh mục đã đi khỏi Giáo phận / linh mục Dòng */
.chip.st-left { background: rgba(142,111,184,.18); } .chip.st-left i { --dot: #8e6fb8; }
.chip.rs-serving { background: rgba(28,154,91,.14); } .chip.rs-serving i { --dot: #1c9a5b; }
.chip.rs-expiring { background: rgba(217,162,27,.16); } .chip.rs-expiring i { --dot: #d9a21b; }
.chip.rs-expired { background: rgba(214,69,69,.16); } .chip.rs-expired i { --dot: #d64545; }
.chip.rs-left { background: rgba(142,111,184,.18); } .chip.rs-left i { --dot: #8e6fb8; }
.chip.pw-due { background: rgba(214,69,69,.16); } .chip.pw-due i { --dot: #d64545; }
.rs-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.rs-tabs button.on { background: var(--primary); color: #fff; border-color: transparent; }
