/* =====================================================================
   National Museum of Cambodia – UI in the e-Portfolio "Apple" style (museum red + gold)
   - System font (SF Pro / Segoe UI Variable / Roboto) + Khmer fallback
   - iOS colours, light by default, iOS dark mode (#1c1c1e / #2c2c2e)
   - iOS easing, hover lift, press shrink, staggered fade-rise
   - Phone: logo header + bell + profile photo, floating glass bottom bar
     with raised Home in the middle, sheets instead of side panels,
     tables become cards
   ===================================================================== */
/* Google fonts, bundled (work offline): Inter for English, Kantumruy Pro for Khmer, Moul for official Khmer titles. SIL Open Font License. */
@font-face { font-family: "Inter"; src: url("../fonts/inter-latin.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-latin-ext.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
/* Khmer: Battambang everywhere (Danh Hong, SIL Open Font License). Always the bundled copy: older "Khmer OS Battambang" fonts installed on
   Windows computers shape some letter groups wrongly (e.g. ស្ណ in វិស្ណុ), and have no real bold. */
@font-face { font-family: "Khmer OS Battambang"; src: url("../fonts/battambang-khmer-regular.woff") format("woff"); font-weight: 100 600; font-style: normal; font-display: swap;
  unicode-range: U+1780-17FF, U+19E0-19FF, U+200B-200D, U+25CC; }
@font-face { font-family: "Khmer OS Battambang"; src: url("../fonts/battambang-khmer-bold.woff") format("woff"); font-weight: 700 900; font-style: normal; font-display: swap;
  unicode-range: U+1780-17FF, U+19E0-19FF, U+200B-200D, U+25CC; }
/* older font names now show Khmer OS Battambang too */
@font-face { font-family: "Kantumruy Pro"; src: url("../fonts/battambang-khmer-regular.woff") format("woff"); font-weight: 100 600; font-display: swap; unicode-range: U+1780-17FF, U+19E0-19FF, U+200B-200D, U+25CC; }
@font-face { font-family: "Kantumruy Pro"; src: url("../fonts/battambang-khmer-bold.woff") format("woff"); font-weight: 700 900; font-display: swap; unicode-range: U+1780-17FF, U+19E0-19FF, U+200B-200D, U+25CC; }
@font-face { font-family: "Moul"; src: url("../fonts/battambang-khmer-bold.woff") format("woff"); font-weight: 100 900; font-display: swap; unicode-range: U+1780-17FF, U+19E0-19FF, U+200B-200D, U+25CC; }
:root {
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --surface-3: #e5e5ea;
  --border: rgba(60, 60, 67, .14);
  --hair: rgba(60, 60, 67, .12);
  --text: #1c1c1e;
  --text-2: #3c3c43;
  --muted: #8e8e93;
  --accent: #691103;
  --accent-2: #4f0d02;
  --accent-soft: rgba(105, 17, 3, .10);
  --gold: #c9a227;
  --success: #34c759;
  --warning: #ff9f0a;
  --danger: #ff3b30;
  --violet: #5e5ce6;
  --home-a: #691103;
  --home-b: #3f0a02;
  --glass: rgba(255, 255, 255, .78);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .06), 0 0 0 .5px rgba(0, 0, 0, .04);
  --shadow: 0 12px 40px rgba(0, 0, 0, .16);
  --radius: 14px;
  --radius-lg: 20px;
  --sidebar-w: 268px;
  --ease: cubic-bezier(.32, .72, 0, 1);
  --font: "Inter", "Khmer OS Battambang", "Khmer OS Siemreap", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --font-title: "Moul", "Khmer OS Muol Light", "Khmer OS Battambang", serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --surface-3: #3a3a3c;
  --border: rgba(84, 84, 88, .55);
  --hair: rgba(84, 84, 88, .45);
  --text: #f5f5f7;
  --text-2: #d1d1d6;
  --muted: #98989f;
  --accent: #d0644c;
  --accent-soft: rgba(208, 100, 76, .22);
  --gold: #e3b54f;
  --success: #30d158;
  --warning: #ffd60a;
  --danger: #ff453a;
  --glass: rgba(30, 30, 32, .72);
  --shadow-sm: 0 0 0 .5px rgba(255, 255, 255, .06);
  --shadow: 0 16px 50px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.47; letter-spacing: -.01em;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.022em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
.kh { font-family: var(--font); letter-spacing: 0; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.lg { width: 24px; height: 24px; }

/* entrance animation */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
.content > * { animation: rise .45s var(--ease) both; }
.content > *:nth-child(2) { animation-delay: 40ms; }
.content > *:nth-child(3) { animation-delay: 80ms; }
.content > *:nth-child(4) { animation-delay: 120ms; }
.content > *:nth-child(n+5) { animation-delay: 160ms; }

/* ---------------------------------------------------------- layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--surface);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  padding: 16px 12px; overflow-y: auto; z-index: 40; border-right: .5px solid var(--hair);
  transition: transform .35s var(--ease), width .3s var(--ease);
}
.sidebar .brand { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 18px; }
.brand-logo { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.06rem; }
.brand-logo:hover { text-decoration: none; }
.mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: linear-gradient(180deg, var(--home-a), var(--home-b)); color: #fff; font-weight: 800; font-size: .9rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 6px rgba(143, 20, 48, .3);
}
.mark.logo { background: #fff; padding: 3px; overflow: hidden; box-shadow: 0 0 0 .5px var(--hair), 0 2px 6px rgba(0, 0, 0, .12); }
.mark.logo img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.nav-group { margin-bottom: 4px; }
.nav-label { color: var(--muted); font-size: .76rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: 14px 12px 6px; display: flex; align-items: center; justify-content: space-between; }
.nav-label.toggle { cursor: pointer; }
.nav-label .chev { transition: transform .3s var(--ease); }
.nav-group.closed .nav-label .chev { transform: rotate(-90deg); }
.nav-group.closed .nav-items { display: none; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px;
  color: var(--text); font-size: .97rem; font-weight: 500; transition: background .2s, transform .15s var(--ease);
}
.nav-link:hover { background: var(--surface-2); text-decoration: none; }
.nav-link:active { transform: scale(.97); }
.nav-link .ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3); }
.nav-link .ico svg { width: 17px; height: 17px; stroke-width: 2; }
.nav-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-link .soon { margin-left: auto; font-size: .64rem; text-transform: uppercase; letter-spacing: .05em; padding: 2px 7px; border-radius: 99px; background: var(--surface-3); color: var(--muted); }
.sidebar-bottom { margin-top: auto; display: grid; gap: 8px; padding-top: 14px; }
.side-card { background: var(--surface-2); border-radius: var(--radius); padding: 10px 12px; display: flex; gap: 10px; align-items: center; }
.side-card select { background: transparent; border: 0; color: var(--text); font: inherit; font-weight: 600; width: 100%; padding: 0; cursor: pointer; }
.side-card .lbl { font-size: .72rem; color: var(--muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar-d { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 30px 0; }
.phone-head, .bnav { display: none; }
.content { padding: 14px 30px 60px; width: 100%; max-width: 1480px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .back { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.page-head .back:hover { text-decoration: none; }
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 35; display: none; backdrop-filter: blur(2px); }

body.side-collapsed .sidebar { width: 78px; }
body.side-collapsed .sidebar .txt, body.side-collapsed .sidebar .nav-label, body.side-collapsed .sidebar .soon,
body.side-collapsed .side-card > div, body.side-collapsed .brand-logo span { display: none; }
body.side-collapsed .nav-link { justify-content: center; }

/* round icon buttons (bell, theme, profile) */
.rbtn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; border: 0; cursor: pointer;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); transition: transform .15s var(--ease); position: relative; }
.rbtn:active { transform: scale(.92); }
.rbtn .dotn { position: absolute; top: -2px; right: -2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; }
.me-btn { padding: 0; overflow: hidden; }
.me-btn img, .me-btn .ini { width: 100%; height: 100%; object-fit: cover; display: grid; place-items: center; font-weight: 700; font-size: .8rem; background: linear-gradient(180deg, #8e8e93, #636366); color: #fff; }
.me-pop { position: fixed; right: 24px; top: 62px; width: 270px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; z-index: 80; display: none; animation: pop .2s var(--ease); }
.me-pop.open { display: block; }
.me-pop .who { padding: 10px 12px 12px; border-bottom: .5px solid var(--hair); margin-bottom: 6px; }
.me-pop a, .me-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 9px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.me-pop a:hover, .me-pop button:hover { background: var(--surface-2); text-decoration: none; }
.me-pop .danger { color: var(--danger); }
.me-wrap { position: relative; }

/* ---------------------------------------------------------- components */
.card { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .grid > * + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 16px;
  border-radius: 999px; border: 0; font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; white-space: nowrap;
  background: var(--surface-3); color: var(--text); text-decoration: none !important;
  transition: transform .15s var(--ease), filter .2s, box-shadow .2s;
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active { transform: scale(.96); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn-success { background: var(--success); color: #fff; box-shadow: 0 4px 12px rgba(52, 199, 89, .25); }
.btn-violet { background: var(--violet); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-sm { height: 32px; padding: 0 12px; font-size: .86rem; }
.btn-icon { width: 44px; height: 44px; padding: 0; background: var(--surface); box-shadow: var(--shadow-sm); }
.btn-icon.sm { width: 32px; height: 32px; background: var(--surface-2); box-shadow: none; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.link-btn { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; font-weight: 500; }
.link-btn.danger { color: var(--danger); }

.chip { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 10px 0 5px; border-radius: 999px; background: var(--surface); color: var(--text); font-weight: 500; font-size: .92rem; box-shadow: var(--shadow-sm); }
.chip .dot { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: .75rem; font-weight: 700; }
.chip a { color: var(--muted); display: grid; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; background: var(--surface); color: var(--text); font-size: .86rem; font-weight: 500; border: 0; font-family: inherit; cursor: pointer; box-shadow: var(--shadow-sm); transition: transform .15s var(--ease); }
.pill:active { transform: scale(.95); }
.pill svg { width: 15px; height: 15px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: .76rem; font-weight: 600; background: var(--surface-2); color: var(--text-2); }
.badge.working, .badge.ok { background: rgba(52, 199, 89, .15); color: #1f9d45; }
.badge.probation, .badge.warn { background: rgba(255, 159, 10, .16); color: #c27400; }
.badge.suspended, .badge.resigned, .badge.terminated, .badge.retired, .badge.bad { background: rgba(255, 59, 48, .13); color: var(--danger); }
.badge.primary { background: var(--accent-soft); color: var(--accent); }
:root[data-theme="dark"] .badge.working, :root[data-theme="dark"] .badge.ok { color: var(--success); }
:root[data-theme="dark"] .badge.probation, :root[data-theme="dark"] .badge.warn { color: var(--warning); }

.avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; background: linear-gradient(180deg, #aeaeb2, #8e8e93); display: grid; place-items: center; color: #fff; font-weight: 700; flex: none; overflow: hidden; font-size: .9rem; }
.avatar.sm { width: 34px; height: 34px; font-size: .74rem; }
.avatar.xl { width: 112px; height: 112px; font-size: 2rem; box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px var(--accent); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* forms – iOS grouped style */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label { color: var(--text-2); font-size: .88rem; font-weight: 500; }
.req::after { content: " *"; color: var(--danger); }
.input, select.input, textarea.input {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid transparent;
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 16px; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
textarea.input { height: auto; min-height: 88px; padding: 12px 14px; resize: vertical; }
select.input { appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%238e8e93' stroke-width='2.2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.input:focus { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input::placeholder { color: var(--muted); }
.input.sm { height: 38px; font-size: .92rem; }
.has-error .input { border-color: var(--danger); background: rgba(255, 59, 48, .06); }
.err { color: var(--danger); font-size: .82rem; }
.check-group { display: flex; align-items: center; gap: 24px; height: 46px; padding: 0 14px; border-radius: 12px; background: var(--surface-2); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; margin: 0; }
/* iOS switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 46px; height: 28px; border-radius: 99px; background: var(--surface-3); position: relative; cursor: pointer; transition: background .25s var(--ease); margin: 0; flex: none; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .3s var(--ease); }
.switch input:checked { background: var(--success); }
.switch input:checked::after { transform: translateX(18px); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section { font-size: 1.12rem; font-weight: 700; margin: 26px 0 12px; }
.form-section:first-child { margin-top: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; flex-wrap: wrap; }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 2px; gap: 2px; }
.seg a, .seg button { padding: 6px 14px; border-radius: 8px; color: var(--text); font-size: .88rem; font-weight: 500; border: 0; background: none; cursor: pointer; font-family: inherit; }
.seg a:hover { text-decoration: none; }
.seg .on { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); font-weight: 600; }

/* toolbar */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search { position: relative; flex: 1 1 260px; max-width: 380px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { height: 44px; padding-left: 42px; background: var(--surface); box-shadow: var(--shadow-sm); border-radius: 999px; }
.bulkbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }

/* table */
.table-wrap { background: var(--surface); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow-sm); }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 600; color: var(--muted); padding: 14px 16px; white-space: nowrap; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.table th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.table th a:hover { text-decoration: none; color: var(--accent); }
.table td { padding: 12px 16px; border-top: .5px solid var(--hair); vertical-align: middle; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover > td { background: var(--surface-2); }
.table .sel { width: 42px; }
.table .exp { width: 36px; }
.emp-cell { display: flex; align-items: center; gap: 12px; min-width: 240px; }
.emp-cell a { color: var(--text); }
.emp-cell a:hover { color: var(--accent); text-decoration: none; }
.emp-cell .name { font-weight: 600; }
.emp-cell .code { color: var(--muted); font-size: .86rem; }
.detail-row td { background: var(--surface-2) !important; }
.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 20px; padding: 4px 4px; }
.kv .k { color: var(--muted); font-size: .8rem; }
.kv .v { font-weight: 500; overflow-wrap: anywhere; }
.chev-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; display: grid; }
.chev-btn svg { transition: transform .3s var(--ease); }
.chev-btn.open svg { transform: rotate(180deg); }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.pager { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pager a, .pager span { min-width: 36px; height: 36px; display: grid; place-items: center; padding: 0 10px; border-radius: 999px; background: var(--surface); color: var(--text); font-weight: 600; font-size: .9rem; box-shadow: var(--shadow-sm); }
.pager .cur { background: var(--accent); color: #fff; }
.pager a:hover { text-decoration: none; color: var(--accent); }
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }

/* iOS grouped list */
.glist { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.glist .row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; position: relative; color: var(--text); }
.glist .row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--hair); }
.glist a.row:hover { background: var(--surface-2); text-decoration: none; }
.glist .row .grow { flex: 1; min-width: 0; }

/* sheet (Add Employee) – side sheet on desktop, bottom sheet on phone */
.drawer-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .3s; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.drawer {
  position: fixed; top: 12px; right: 12px; bottom: 12px; width: min(580px, calc(100% - 24px)); background: var(--surface); z-index: 61;
  border-radius: var(--radius-lg); transform: translateX(calc(100% + 24px)); transition: transform .45s var(--ease);
  display: flex; flex-direction: column; box-shadow: var(--shadow); overflow: hidden;
}
.drawer.open { transform: none; }
.drawer-back.open { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 0 14px 0 22px; height: 56px; background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: .5px solid var(--hair); flex: none; }
.drawer-head h2 { font-size: 1.08rem; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 22px 20px; }
.drawer-foot { padding: 12px 22px calc(14px + env(safe-area-inset-bottom)); display: flex; justify-content: flex-end; gap: 10px; border-top: .5px solid var(--hair); flex: none; }
.drawer-alert { color: var(--danger); font-size: .9rem; padding: 0 22px; }
.drawer-alert:not(:empty) { padding-top: 10px; }
.photo-pick { display: grid; place-items: center; margin: 6px 0 20px; }
.photo-pick label { position: relative; cursor: pointer; transition: transform .2s var(--ease); }
.photo-pick label:active { transform: scale(.96); }
.photo-pick .cam { position: absolute; right: 0; bottom: 2px; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 0 0 3px var(--surface); }
.icon-close { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-3); border: 0; color: var(--text-2); cursor: pointer; display: grid; place-items: center; transition: transform .15s var(--ease); }
.icon-close:active { transform: scale(.9); }
.icon-close svg { width: 15px; height: 15px; stroke-width: 2.4; }

/* modal (centre sheet) */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 70; display: none; align-items: flex-start; justify-content: center; padding: 4vh 16px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal-back.open { display: flex; }
.modal { background: var(--surface); border-radius: var(--radius-lg); width: min(640px, 100%); max-height: 92vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); animation: pop .3s var(--ease); }
.modal-head { display: flex; justify-content: space-between; align-items: center; height: 54px; padding: 0 14px 0 20px; background: var(--glass); backdrop-filter: blur(20px); border-bottom: .5px solid var(--hair); flex: none; }
.modal-head h3 { font-size: 1.05rem; }
.modal-body { padding: 18px 20px 20px; overflow-y: auto; }

/* profile */
.profile-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 20px; align-items: start; }
.tabnav { background: var(--surface); border-radius: var(--radius-lg); padding: 8px; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: var(--shadow-sm); }
.tabnav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--text); font-size: .96rem; font-weight: 500; transition: background .15s; }
.tabnav a:hover { background: var(--surface-2); text-decoration: none; }
.tabnav a .ti { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3); }
.tabnav a .ti svg { width: 16px; height: 16px; stroke-width: 2; }
.tabnav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tabnav .count { margin-left: auto; font-size: .76rem; color: var(--muted); }
.profile-hero { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.profile-hero .names .kh { font-size: 1.35rem; font-weight: 700; }
.profile-hero .names .en { color: var(--text-2); font-size: 1.02rem; font-weight: 500; }
.profile-hero .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 28px; }
.info-grid .k { color: var(--muted); font-size: .84rem; margin-bottom: 2px; }
.info-grid .v { font-size: 1rem; font-weight: 500; overflow-wrap: anywhere; }
.section-title { font-size: 1.08rem; font-weight: 700; margin: 24px 0 12px; }
.section-title:first-child { margin-top: 0; }
.branch-chip { display: inline-flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 14px; padding: 8px 16px 8px 8px; }
.branch-chip .st { color: var(--success); font-size: .86rem; font-weight: 600; }
.pos-card { background: var(--surface-2); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 6px; }
.pos-card.past { opacity: .6; }
.pos-card .row { display: flex; justify-content: space-between; gap: 10px; align-items: start; flex-wrap: wrap; }
.pos-card .t { font-weight: 700; font-size: 1.02rem; }
.list-card { background: var(--surface-2); border-radius: var(--radius); padding: 12px 14px; display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.list-card + .list-card { margin-top: 8px; }

/* roster */
.roster { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.roster .day { background: var(--surface-2); border-radius: 12px; padding: 10px; min-height: 84px; display: grid; gap: 3px; align-content: start; font-size: .84rem; }
.roster .day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.roster .day .d { color: var(--muted); font-size: .76rem; font-weight: 500; }
.roster .day .s { border-left: 3px solid var(--accent); padding-left: 6px; font-weight: 600; }
.roster .day.off .s { border-color: var(--surface-3); color: var(--muted); font-weight: 500; }
.roster .day .ov { font-size: .7rem; color: var(--warning); font-weight: 600; }
.weekline { display: flex; gap: 5px; flex-wrap: wrap; }
.weekline span { font-size: .76rem; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.weekline span.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* launcher – glossy squircle app tiles (home) */
.hero { border-radius: var(--radius-lg); padding: 22px 24px; color: #fff; background: linear-gradient(135deg, var(--home-a), var(--home-b)); box-shadow: 0 10px 30px rgba(143, 20, 48, .25); display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.hero .clock { font-size: 2rem; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 18px 12px; }
.app-tile { display: grid; justify-items: center; gap: 8px; color: var(--text); text-align: center; font-size: .84rem; font-weight: 500; transition: transform .2s var(--ease); }
.app-tile:hover { text-decoration: none; transform: translateY(-3px); }
.app-tile:active { transform: scale(.94); }
.app-tile .sq { width: 64px; height: 64px; border-radius: 30%; display: grid; place-items: center; color: #fff; position: relative; overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 6px 16px -4px var(--tc, rgba(0, 0, 0, .3)); }
.app-tile .sq::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 45%, rgba(0, 0, 0, .12)); }
.app-tile .sq svg { width: 30px; height: 30px; stroke-width: 1.9; position: relative; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .2)); }
.app-tile .soon { font-size: .66rem; color: var(--muted); margin-top: -6px; }
.apps .app-tile { animation: rise .5s var(--ease) both; animation-delay: calc(60ms + var(--i, 0) * 32ms); }
.t-blue { background: linear-gradient(180deg, #3b9bff, #0a6cdb); --tc: rgba(10, 108, 219, .5); }
.t-green { background: linear-gradient(180deg, #4cd964, #26a645); --tc: rgba(38, 166, 69, .5); }
.t-orange { background: linear-gradient(180deg, #ffb340, #ff8a00); --tc: rgba(255, 138, 0, .5); }
.t-red { background: linear-gradient(180deg, #ff6b61, #e0352b); --tc: rgba(224, 53, 43, .5); }
.t-purple { background: linear-gradient(180deg, #a77bff, #6e44e0); --tc: rgba(110, 68, 224, .5); }
.t-teal { background: linear-gradient(180deg, #4fd1d9, #1a9fb0); --tc: rgba(26, 159, 176, .5); }
.t-indigo { background: linear-gradient(180deg, #6f72ff, #3b3fd9); --tc: rgba(59, 63, 217, .5); }
.t-pink { background: linear-gradient(180deg, #ff6fa0, #e0306c); --tc: rgba(224, 48, 108, .5); }
.t-gray { background: linear-gradient(180deg, #a1a1a8, #6c6c73); --tc: rgba(108, 108, 115, .5); }
.t-navy { background: linear-gradient(180deg, var(--home-a), var(--home-b)); --tc: rgba(143, 20, 48, .5); }
.t-brown { background: linear-gradient(180deg, #c49a6c, #8f6236); --tc: rgba(143, 98, 54, .5); }
.t-mint { background: linear-gradient(180deg, #5fe3b8, #1fae80); --tc: rgba(31, 174, 128, .5); }

/* stats */
.stat { background: var(--surface); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 2px; box-shadow: var(--shadow-sm); }
.stat .n { font-size: 1.85rem; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: .86rem; font-weight: 500; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 180px) 1fr 40px; gap: 12px; align-items: center; padding: 5px 0; font-size: .9rem; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transform-origin: left; animation: grow .8s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }
.mini-list .item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: .5px solid var(--hair); }
.mini-list .item:first-child { border-top: 0; }
.mini-list .item .grow { flex: 1; min-width: 0; }
.cols-chart { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; align-items: end; height: 170px; padding-top: 10px; }
.cols-chart .col { display: grid; gap: 3px; align-items: end; height: 100%; grid-template-rows: 1fr auto; text-align: center; }
.cols-chart .bars { display: flex; gap: 3px; align-items: end; justify-content: center; height: 100%; }
.cols-chart .bars i { width: 40%; max-width: 16px; border-radius: 4px 4px 0 0; background: var(--accent); min-height: 2px; }
.cols-chart .bars i.out { background: var(--danger); }
.cols-chart .m { font-size: .72rem; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: .82rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* permission matrix */
.perm-module { background: var(--surface); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; box-shadow: var(--shadow-sm); }
.perm-module > .head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; font-weight: 700; background: var(--surface-2); }
.perm-feature { display: grid; grid-template-columns: 220px 1fr; gap: 12px; padding: 14px 18px; border-top: .5px solid var(--hair); }
.perm-feature .fname { font-weight: 600; display: flex; align-items: start; gap: 10px; }
.perm-actions { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.perm-actions .desc { color: var(--muted); font-size: .78rem; display: block; }
.perm-item { display: flex; gap: 9px; align-items: start; min-width: 230px; flex: 1 1 230px; font-size: .92rem; }

/* flash */
.flash-wrap { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(440px, calc(100% - 24px)); }
.flash { padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; font-weight: 500; animation: drop .45s var(--ease); background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); color: var(--text); }
.flash .fi { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }
.flash .fi svg { width: 14px; height: 14px; stroke-width: 3; }
.flash.success .fi { background: var(--success); }
.flash.error .fi { background: var(--danger); }
.flash.warning .fi, .flash.info .fi { background: var(--warning); }
@keyframes drop { from { transform: translateY(-20px); opacity: 0; } }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 500px at 80% -10%, color-mix(in srgb, var(--home-a) 20%, transparent), transparent), radial-gradient(700px 420px at 10% 110%, rgba(201, 162, 39, .16), transparent), var(--bg); }
.auth-card { width: min(400px, 100%); background: var(--surface); border-radius: 22px; padding: 32px 28px; box-shadow: var(--shadow); animation: pop .4s var(--ease); }

@media (max-width: 1440px) and (min-width: 769px) {
  .table td, .table th { padding-left: 11px; padding-right: 11px; }
  .col-lg { display: none; }
  .emp-cell { min-width: 220px; }
}
/* ---------------------------------------------------------- tablet */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-layout { grid-template-columns: 230px minmax(0, 1fr); }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------------------------------------------------------- phone & small tablet (e-Portfolio phone style) */
@media (max-width: 900px) {
  body { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); box-shadow: var(--shadow); width: min(300px, 86vw) !important; border-radius: 0 20px 20px 0; }
  body.side-open .sidebar { transform: none; }
  body.side-open .overlay { display: block; }
  body.side-collapsed .sidebar .txt, body.side-collapsed .sidebar .nav-label, body.side-collapsed .side-card > div, body.side-collapsed .brand-logo span { display: revert; }
  .sidebar .collapse-btn, .topbar-d { display: none; }

  /* header: logo + title, bell, profile picture */
  .phone-head { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: .5px solid var(--hair); }
  .phone-head .t { font-weight: 700; font-size: 1.06rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .me-pop { right: 12px; top: calc(62px + env(safe-area-inset-top)); }
  .phone-head .mark { width: 34px; height: 34px; border-radius: 10px; font-size: .8rem; }

  /* floating glass bottom bar with raised Home in the middle */
  .bnav { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 50; height: 64px;
    background: var(--glass); backdrop-filter: saturate(180%) blur(22px); -webkit-backdrop-filter: saturate(180%) blur(22px);
    border-radius: 22px; box-shadow: 0 8px 30px rgba(0, 0, 0, .18), inset 0 0 0 .5px var(--hair); align-items: center; justify-content: space-around; padding: 0 6px; }
  .bnav a, .bnav button { flex: 1; display: grid; justify-items: center; gap: 3px; color: var(--muted); font-size: .66rem; font-weight: 500; background: none; border: 0; font-family: inherit; cursor: pointer; padding: 6px 0; transition: transform .15s var(--ease); }
  .bnav a:hover { text-decoration: none; }
  .bnav a:active, .bnav button:active { transform: scale(.9); }
  .bnav a.on { color: var(--accent); font-weight: 700; }
  .bnav svg { width: 24px; height: 24px; }
  .bnav .home { margin-top: -12px; }
  .bnav .home .hc { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; color: #fff;
    background: linear-gradient(180deg, var(--home-a), var(--home-b)); box-shadow: 0 0 0 4px var(--bg), 0 6px 16px rgba(143, 20, 48, .4); }
  .bnav .home .hc svg { width: 25px; height: 25px; stroke-width: 2; }

  .content { padding: 14px 16px 24px; }
  .page-head { margin-bottom: 14px; }
  .page-head h1 { font-size: 1.5rem; }
  .profile-layout { grid-template-columns: 1fr; gap: 14px; }
  .tabnav { position: static; display: flex; overflow-x: auto; padding: 5px; gap: 2px; border-radius: 14px; max-height: none; scrollbar-width: none; scroll-snap-type: x proximity; }
  .tabnav::-webkit-scrollbar { display: none; }
  .tabnav a { flex: none; padding: 7px 12px 7px 7px; gap: 7px; font-size: .88rem; scroll-snap-align: start; }
  .tabnav a .ti { width: 24px; height: 24px; border-radius: 7px; }
  .tabnav .count { display: none; }
  .profile-hero { gap: 14px; flex-wrap: nowrap; align-items: flex-start; }
  .profile-hero .avatar.xl { width: 74px; height: 74px; font-size: 1.4rem; box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }
  .profile-hero .photo-pick .cam { width: 28px; height: 28px; right: -4px; bottom: -2px; }
  .profile-hero .names { min-width: 0 !important; }
  .profile-hero .names .kh { font-size: 1.12rem; }
  .roster .day .s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .grid-3 { grid-template-columns: 1fr; }
  .apps { grid-template-columns: repeat(3, 1fr); gap: 20px 8px; }
  .app-tile .sq { width: 66px; height: 66px; }
  .flash-wrap { top: calc(64px + env(safe-area-inset-top)); }
}
@media (max-width: 768px) {
  .grid-2, .grid-4 { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr 1fr; gap: 12px 16px; }
  .card { padding: 16px; }
  .search { max-width: none; flex-basis: 100%; order: -1; }

  /* tables become cards */
  .table-wrap.cards { background: transparent; overflow: visible; box-shadow: none; }
  .table-wrap.cards table, .table-wrap.cards tbody, .table-wrap.cards tr, .table-wrap.cards td { display: block; width: 100%; }
  .table-wrap.cards thead { display: none; }
  .table-wrap.cards tr { background: var(--surface); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; position: relative; box-shadow: var(--shadow-sm); }
  .table-wrap.cards tbody tr:hover > td { background: transparent; }
  .table-wrap.cards td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; font-size: .92rem; }
  .table-wrap.cards td::before { content: attr(data-label); color: var(--muted); text-align: left; font-size: .84rem; flex: none; }
  .table-wrap.cards td.no-label { display: block; text-align: left; }
  .table-wrap.cards td.no-label::before { display: none; }
  .table-wrap.cards td.sel { position: absolute; right: 12px; top: 14px; width: auto; padding: 0; }
  .table-wrap.cards td.sel::before { display: none; }
  .table-wrap.cards td.exp { display: none; }
  .table-wrap.cards .emp-cell { min-width: 0; padding-right: 30px; margin-bottom: 4px; }
  .table-wrap.cards tr.detail-row { display: none !important; }
  .table-wrap.cards td.actions { justify-content: flex-end; padding-top: 8px; }

  /* side sheet → bottom sheet */
  .drawer { top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: 94vh; border-radius: 20px 20px 0 0; transform: translateY(100%); }
  .drawer::before { content: ""; position: absolute; top: 6px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 99px; background: var(--surface-3); z-index: 2; }
  .drawer-head, .drawer-body, .drawer-foot { padding-left: 16px; padding-right: 16px; }
  .drawer-foot .btn { flex: 1; }
  .modal-back { padding: 0; align-items: flex-end; }
  .modal { width: 100%; border-radius: 20px 20px 0 0; max-height: 94vh; animation: rise .4s var(--ease); }
  .modal-body { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .perm-feature { grid-template-columns: 1fr; }
  .roster { gap: 4px; }
  .roster .day { padding: 6px 4px; min-height: 68px; font-size: .7rem; border-radius: 9px; }
  .roster .day .s { padding-left: 4px; border-left-width: 2px; }
  .bar-row { grid-template-columns: 100px 1fr 34px; }
  .hero .clock { font-size: 1.6rem; }
}
@media (max-width: 480px) {
  .grid-2, .grid-4 { gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .n { font-size: 1.5rem; }
  .info-grid { grid-template-columns: 1fr 1fr; gap: 10px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .sidebar, .phone-head, .bnav, .topbar-d, .tabnav, .btn, .bulkbar, .toolbar { display: none !important; }
  .profile-layout { grid-template-columns: 1fr; }
  body { background: #fff; color: #000; padding: 0; }
}

/* =====================================================================
   Compact density – fits more on screen, especially with Windows 125–150% scaling
   ===================================================================== */
body { font-size: 14px; }
h1 { font-size: 1.45rem; }
.sidebar { --sidebar-w: 236px; width: 236px; padding: 12px 10px; }
.sidebar .brand { padding: 2px 6px 12px; }
.mark { width: 34px; height: 34px; border-radius: 10px; font-size: .78rem; }
.nav-label { padding: 10px 10px 4px; font-size: .7rem; }
.nav-link { padding: 6px 10px; gap: 10px; font-size: .9rem; border-radius: 9px; }
.nav-link .ico { width: 26px; height: 26px; border-radius: 7px; }
.nav-link .ico svg { width: 15px; height: 15px; }
.side-card { padding: 8px 10px; }
.topbar-d { padding: 10px 24px 0; gap: 8px; }
.topbar-d .chip { height: 32px; font-size: .85rem; }
.rbtn { width: 34px; height: 34px; }
.content { padding: 6px 24px 40px; }
.page-head { margin-bottom: 12px; }
.card { padding: 16px; }
.btn { height: 36px; padding: 0 14px; font-size: .88rem; gap: 6px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: .82rem; }
.btn-icon { width: 38px; height: 38px; }
.btn-icon.sm { width: 30px; height: 30px; }
.input, select.input { height: 40px; font-size: 15px; border-radius: 10px; }
.input.sm { height: 34px; font-size: .88rem; }
.check-group { height: 40px; }
.form-grid { gap: 12px 14px; }
.field { gap: 4px; }
.field > label { font-size: .82rem; }
.chip { height: 32px; font-size: .86rem; }
.chip .dot { width: 22px; height: 22px; font-size: .7rem; }
.pill { height: 30px; padding: 0 10px; font-size: .8rem; gap: 5px; }
.pill svg { width: 14px; height: 14px; }
.search .input { height: 38px; padding-left: 38px; font-size: .92rem; }
.search svg { left: 12px; width: 17px; height: 17px; }
.table th { padding: 10px 12px; font-size: .72rem; }
.table td { padding: 7px 12px; font-size: .9rem; }
.emp-cell .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 290px; display: block; }
.emp-cell .code { font-size: .78rem; }
.table .avatar { width: 34px; height: 34px; font-size: .72rem; }
.pager a, .pager span { min-width: 32px; height: 32px; font-size: .84rem; }
.stat { padding: 12px 14px; }
.stat .n { font-size: 1.55rem; }
.tabnav a { padding: 7px 10px; font-size: .9rem; }
.tabnav a .ti { width: 24px; height: 24px; }
.info-grid { gap: 12px 24px; }
.info-grid .v { font-size: .94rem; }
.section-title { margin: 18px 0 10px; font-size: 1rem; }
.app-tile .sq svg { width: 26px; height: 26px; }
.hero { padding: 16px 20px; }
.hero h1 { font-size: 1.35rem !important; }
.hero .clock { font-size: 1.6rem; }

/* one action row: toolbar + selection + add button */
.listbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.listbar .spacer { flex: 1; }
.listbar .group { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.listbar .sep { width: 1px; height: 22px; background: var(--border); margin: 0 2px; }

/* =====================================================================
   Full-screen sheet (Add Employee)
   ===================================================================== */
.drawer.fs { top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; border-radius: 0; background: var(--bg); transform: translateY(100%); }
.drawer.fs.open { transform: none; }
.drawer.fs::before { display: none; }
.fs-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 54px; padding: 0 16px; flex: none;
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: .5px solid var(--hair); }
.fs-bar h2 { font-size: 1.05rem; position: absolute; left: 50%; transform: translateX(-50%); pointer-events: none; white-space: nowrap; }
.fs-body { flex: 1; overflow-y: auto; padding: 14px 16px 30px; }
.fs-body .drawer-alert { max-width: 1120px; margin: 0 auto; padding: 0 0 10px; }
.fs-body .drawer-alert:empty { display: none; }
.fs-grid { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 14px; max-width: 1120px; margin: 0 auto; align-items: start; }
.fs-side { position: sticky; top: 0; }
.fs-main { display: grid; gap: 14px; }
.fs-main .card + .card { margin-top: 0; }
.fs-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .98rem; margin-bottom: 12px; }
.fs-title .ti { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; color: #fff; }
.fs-title .ti svg { width: 14px; height: 14px; stroke-width: 2.2; }
.fs-main .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fs-main .form-grid .full { grid-column: span 3; }
.fs-id .avatar.xl { width: 92px; height: 92px; }
.photo-pick .avatar.xl svg { width: 34px; height: 34px; color: var(--muted); }
/* segmented radio (Male | Female, Working | Probation) */
.segr { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 3px; height: 40px; }
.segr label { flex: 1; display: grid; cursor: pointer; }
.segr input { position: absolute; opacity: 0; pointer-events: none; }
.segr span { display: grid; place-items: center; border-radius: 8px; font-size: .88rem; font-weight: 500; color: var(--text-2); transition: background .2s, color .2s; }
.segr input:checked + span { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.segr input:focus-visible + span { outline: 2px solid var(--accent); }
.has-error .segr { box-shadow: 0 0 0 1px var(--danger); }
/* input + button */
.input-group { display: flex; background: var(--surface-2); border-radius: 10px; border: 1px solid transparent; }
.input-group:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface); }
.input-group .input { border: 0; box-shadow: none !important; background: transparent; flex: 1; min-width: 0; font-weight: 600; letter-spacing: .02em; }
.ig-btn { border: 0; background: none; color: var(--accent); width: 40px; cursor: pointer; display: grid; place-items: center; }

@media (max-width: 1100px) {
  .fs-main .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fs-main .form-grid .full { grid-column: span 2; }
}
@media (max-width: 900px) {
  .fs-grid { grid-template-columns: 1fr; }
  .fs-side { position: static; }
  .fs-id { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .fs-id .photo-pick, .fs-id > .muted { grid-column: 1 / -1; }
  .fs-id .field { margin-top: 0 !important; }
  .content { padding: 10px 14px 24px; }
}
@media (max-width: 768px) {
  .fs-main .form-grid, .fs-id { grid-template-columns: 1fr 1fr; }
  .fs-main .form-grid .full { grid-column: 1 / -1; }
  .hide-sm { display: none; }
  .fs-bar .btn-ghost { padding: 0 8px; }
  .drawer.fs { height: 100%; border-radius: 0; }
}
@media (max-width: 420px) {
  .fs-main .form-grid, .fs-id { grid-template-columns: 1fr; }
}

/* clickable rows + compact action buttons */
.row-link { cursor: pointer; }
.emp-table .actions { width: 1%; }
.emp-table .actions .btn-icon.sm { width: 28px; height: 28px; background: transparent; color: var(--muted); }
.emp-table .actions .btn-icon.sm:hover { background: var(--surface-2); color: var(--accent); }
.emp-table tbody tr:hover .actions .btn-icon.sm { color: var(--text-2); }
@media (max-width: 768px) {
  .emp-table .actions .btn-icon.sm { width: 34px; height: 34px; background: var(--surface-2); }
  .listbar .spacer { display: none; }
  .listbar > .group { width: 100%; }
}

/* thin scrollbars everywhere */
* { scrollbar-width: thin; scrollbar-color: rgba(128, 128, 128, .35) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(128, 128, 128, .35); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(128, 128, 128, .6); }
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar { scrollbar-width: none; }
.sidebar:hover { scrollbar-width: thin; }

/* page shown inside the full-screen popup */
body.embedded { padding-bottom: 0 !important; }
.embed-content { padding: 14px 18px 30px; max-width: 1180px; margin: 0 auto; }
html.embedded .page-head .back svg { display: none; }
html.embedded .page-head .back { pointer-events: none; }
html.embedded .page-head .back[href*="/edit"], html.embedded a.back[href*="employees/"] { pointer-events: auto; }
#pageSheet { z-index: 75; }
@media (max-width: 900px) { .embed-content { padding: 10px 12px 24px; } }
.profile-hero .avatar.xl { width: 84px; height: 84px; font-size: 1.5rem; box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }
.profile-hero .photo-pick .cam { width: 28px; height: 28px; }
.profile-hero .names .kh { font-size: 1.2rem; }

/* desktop-only compact sizes (kept out of phone layouts) */
@media (min-width: 901px) {
  .search { max-width: 340px; }
  .emp-cell { gap: 10px; min-width: 210px; }
  .profile-layout { grid-template-columns: 228px minmax(0, 1fr); gap: 16px; }
  .apps { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 14px 8px; }
  .app-tile .sq { width: 54px; height: 54px; }
}
@media (max-width: 900px) { .emp-cell { gap: 10px; } }

@media (max-width: 768px) { .table-wrap.cards td > div { text-align: right; } .table-wrap.cards td.no-label > div { text-align: left; } }

/* =====================================================================
   Clean navigation: plain line icons, one accent for the active page
   ===================================================================== */
.sidebar { background: var(--surface); }
.nav-link { gap: 11px; padding: 7px 10px; color: var(--text-2); font-weight: 500; }
.nav-link .ico { width: 20px; height: 20px; border-radius: 0; background: none !important; box-shadow: none; color: var(--muted); }
.nav-link .ico svg { width: 19px; height: 19px; stroke-width: 1.7; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link:hover .ico { color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-link.active .ico { color: var(--accent); }
.nav-link .soon { font-size: .6rem; padding: 1px 6px; background: transparent; border: 1px solid var(--border); }
.nav-label { color: var(--muted); font-weight: 600; letter-spacing: .06em; }
.nav-label.toggle:hover { color: var(--text); }
.sidebar .brand .collapse-btn { background: transparent; color: var(--muted); }
.sidebar .brand .collapse-btn:hover { background: var(--surface-2); color: var(--text); }
.side-card { background: transparent; border: 1px solid var(--border); }
body.side-collapsed .nav-link { padding: 9px 0; }
body.side-collapsed .nav-link .ico { width: 22px; height: 22px; }

/* top-right: plain round icons */
.topbar-d .chip { box-shadow: none; background: transparent; border: 1px solid var(--border); padding: 0 12px 0 8px; }
.topbar-d .chip .dot { background: none; color: var(--muted); width: 18px; }
.rbtn { box-shadow: none; background: transparent; color: var(--text-2); }
.rbtn:hover { background: var(--surface-2); color: var(--text); }
.me-btn { border: 1px solid var(--border); }

/* phone bottom bar: thinner labels, same plain icons */
@media (max-width: 900px) {
  .bnav a, .bnav button { font-weight: 500; }
  .bnav svg { width: 23px; height: 23px; stroke-width: 1.7; }
  .phone-head .rbtn { width: 34px; height: 34px; }
}

/* staff movement */
.mv-grid { display: grid; grid-template-columns: minmax(0, 1fr) 36px minmax(0, 1.4fr); gap: 10px; align-items: stretch; }
.mv-arrow { display: grid; place-items: center; color: var(--muted); }
.mv-changed .input { border-color: var(--accent); background: var(--accent-soft); }
.mv-changed > label { color: var(--accent); font-weight: 600; }
.mv-table td, .mv-table th { padding: 9px 14px; }
.mv-row-changed td { background: var(--accent-soft); }
@media (max-width: 900px) { .mv-grid { grid-template-columns: 1fr; } .mv-arrow { transform: rotate(90deg); height: 20px; } }

/* searchable select */
.ss-wrap { position: relative; min-width: 0; }
.ss-native { position: absolute !important; inset: auto 0 0 0; width: 100% !important; height: 1px !important; opacity: 0; pointer-events: none; padding: 0 !important; border: 0 !important; }
.ss-btn { text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; display: block; line-height: 38px; }
.ss-btn.input { line-height: 38px; }
.ss-btn.input.sm { line-height: 32px; }
.ss-btn.ss-empty { color: var(--muted); }
.ss-open .ss-btn { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.ss-panel { position: fixed; z-index: 200; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow), 0 0 0 .5px var(--hair); overflow: hidden; animation: pop .16s var(--ease); }
.ss-search { position: relative; padding: 8px; border-bottom: .5px solid var(--hair); }
.ss-search svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.ss-search input { width: 100%; height: 36px; border-radius: 9px; border: 0; background: var(--surface-2); padding: 0 10px 0 32px; font: inherit; font-size: 15px; color: var(--text); outline: none; }
.ss-list { overflow-y: auto; max-height: 268px; padding: 4px; }
.ss-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: .92rem; }
.ss-item.act { background: var(--surface-2); }
.ss-item.on { color: var(--accent); font-weight: 600; }
.ss-item b { color: var(--accent); }
.ss-item.ss-none { color: var(--muted); }
.ss-group { padding: 8px 10px 2px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ss-empty-msg { padding: 14px; text-align: center; color: var(--muted); font-size: .9rem; }
.ss-panel.ss-sheet { left: 0 !important; right: 0; bottom: 0 !important; top: auto !important; width: auto !important; border-radius: 18px 18px 0 0; max-height: 72vh; display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom); animation: rise .25s var(--ease); }
.ss-panel.ss-sheet .ss-list { max-height: none !important; flex: 1; }
.ss-panel.ss-sheet .ss-item { padding: 12px; font-size: 1rem; }
@media (max-width: 768px) { .fs-main .form-grid .field[style*="span 2"] { grid-column: 1 / -1 !important; } }
.ss-btn.input { padding-right: 38px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%238e8e93' stroke-width='2.2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }

/* ===== leave tracking (parcel-style) ===== */
.track { list-style: none; margin: 0; padding: 0; position: relative; }
.tk { position: relative; display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; padding: 0 0 18px; }
.tk:last-child { padding-bottom: 0; }
.tk::before { content: ""; position: absolute; left: 13px; top: 24px; bottom: -2px; width: 2px; background: var(--surface-3); }
.tk:last-child::before { display: none; }
.tk-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); box-shadow: inset 0 0 0 2px var(--surface-3); color: #fff; position: relative; z-index: 1; }
.tk-dot svg { width: 14px; height: 14px; stroke-width: 3; }
.tk-done .tk-dot { background: var(--success); box-shadow: none; }
.tk-done::before { background: var(--success); }
.tk-skip .tk-dot { box-shadow: inset 0 0 0 2px var(--surface-3); background: var(--surface-2); }
.tk-bad .tk-dot { background: var(--danger); box-shadow: none; }
.tk-current .tk-dot { background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.tk-current .tk-dot::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--accent); opacity: .5; animation: tkpulse 1.6s ease-out infinite; }
@keyframes tkpulse { from { transform: scale(.7); opacity: .7; } to { transform: scale(1.35); opacity: 0; } }
.tk-title { font-weight: 600; line-height: 1.3; padding-top: 3px; }
.tk-sub { color: var(--muted); font-size: .84rem; margin-top: 1px; }
.tk-time { color: var(--muted); font-size: .76rem; text-align: right; line-height: 1.3; padding-top: 4px; white-space: nowrap; }
.tk-todo .tk-title, .tk-skip .tk-title { color: var(--muted); font-weight: 500; }
.tk-first .tk-title { font-size: 1.02rem; }
.tk-first.tk-current .tk-title { color: var(--accent); }
.tk-first.tk-done .tk-title { color: var(--success); }
.tk-first.tk-bad .tk-title { color: var(--danger); }
/* mini tracker (lists) */
.mtk { display: grid; gap: 4px; min-width: 140px; }
.mtk-line { display: flex; align-items: center; }
.mtk-line i { flex: 1; height: 4px; background: var(--surface-3); position: relative; }
.mtk-line i:first-child { border-radius: 99px 0 0 99px; } .mtk-line i:last-child { border-radius: 0 99px 99px 0; }
.mtk-line i + i { margin-left: 2px; }
.mtk-line .mtk-done, .mtk-line .mtk-skip { background: var(--success); }
.mtk-line .mtk-current { background: var(--accent); }
.mtk-line .mtk-bad { background: var(--danger); }
.mtk-label { font-size: .78rem; color: var(--text-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mtk-bad .mtk-label { color: var(--danger); }
.tk-next { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--surface-3); }
.tk-chip { font-size: .8rem; background: var(--surface-2); border-radius: 999px; padding: 4px 10px; color: var(--text-2); }
.tk-arrow { color: var(--muted); }
.lv-show { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .lv-show { grid-template-columns: minmax(0, 1fr); } .lv-show > .card:last-child { order: -1; } }
.me-leave { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 22px; align-items: start; }
.me-bal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 900px) { .me-leave { grid-template-columns: minmax(0, 1fr); } }
.mini-list .item .mtk { flex: 0 0 auto; width: 120px; min-width: 0; }
/* profile tab list: no inner scroll box, it scrolls with the page */
@media (min-width: 769px) { .tabnav { position: static; max-height: none; overflow: visible; } }

/* popups: no top bar - the page's own header row carries the title and a round close button */
#pageSheet > .fs-bar { display: none; }
html.embedded .page-head { justify-content: space-between; margin-bottom: 12px; }
html.embedded .page-head h1 { font-size: 1.05rem !important; font-weight: 700; letter-spacing: -.01em; }
.pop-x { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--surface-3); display: inline-grid; place-items: center; flex: none; cursor: pointer;
  background: var(--surface); color: var(--text-2); padding: 0; transition: background .15s, color .15s; }
.pop-x:hover { background: var(--surface-2); color: var(--text); }
.pop-x svg { width: 14px; height: 14px; stroke-width: 2.2; }
.pop-x.floating { position: fixed; top: 10px; left: 12px; z-index: 60; }
.page-head .pop-left { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: auto; }
.page-head .pop-left h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* small round pen (edit) button on cards and section titles */
.pen { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; border: 1px solid var(--surface-3);
  background: var(--surface); color: var(--accent); cursor: pointer; padding: 0; transition: background .15s; }
.pen:hover { background: var(--accent-soft); text-decoration: none; }
.pen svg { width: 14px; height: 14px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.profile-hero.has-pen { position: relative; }
.hero-acts { position: absolute; top: 0; right: 0; display: flex; gap: 6px; }
.pen.gray { color: var(--text-2); }
.pen.gray:hover { background: var(--surface-2); color: var(--text); }
.profile-hero.has-pen .names { padding-right: 8px; }
@media (max-width: 600px) { .profile-hero.has-pen { padding-top: 34px; } }
.page-head.pop-only { margin-bottom: 10px; }

/* ===== Home screen – One UI / HyperOS launcher look ===== */
.ou-widget { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  background: var(--surface); border-radius: 28px; padding: 22px 26px; box-shadow: var(--shadow-sm); }
.ou-clock .t { font-size: 3.4rem; font-weight: 300; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--text); }
.ou-clock .d { margin-top: 6px; color: var(--text-2); font-weight: 500; }
.ou-hello { text-align: right; display: grid; justify-items: end; gap: 2px; }
.ou-hello .g { color: var(--muted); font-size: .9rem; }
.ou-hello .n { font-size: 1.2rem; font-weight: 700; }
.ou-pill { margin-top: 8px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: #fff4e0; color: #9a5b00; font-size: .82rem; font-weight: 600; }
.ou-pill b { background: #ff9500; color: #fff; border-radius: 999px; min-width: 20px; height: 20px; display: inline-grid; place-items: center; font-size: .72rem; padding: 0 5px; }
.ou-pill:hover { text-decoration: none; filter: brightness(.97); }
[data-theme="dark"] .ou-pill { background: rgba(255, 149, 0, .16); color: #ffb340; }

.ou-home { margin-top: 22px; }
.ou-home .apps, .ou-folder .apps { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 22px 10px; }
.app-tile { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; gap: 7px; }
.app-tile:hover { transform: none; }
.app-tile:hover .sq { transform: scale(1.06); }
.app-tile:active .sq { transform: scale(.9); }
.app-tile .sq { width: 60px; height: 60px; border-radius: 28%; box-shadow: 0 4px 12px var(--tc, rgba(0, 0, 0, .15)); transition: transform .2s var(--ease); }
.app-tile .sq::before { display: none; }                         /* flat, no gloss */
.app-tile .sq svg { width: 28px; height: 28px; stroke-width: 2.3; filter: none; }
.app-tile .lbl { font-size: .8rem; font-weight: 500; color: var(--text); max-width: 92px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-tile .soon-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .85); }
.app-tile .soon { display: none; }
/* folder icon: frosted square with 4 mini icons */
.app-tile .sq.folder { background: color-mix(in srgb, var(--surface-3) 70%, transparent); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .04);
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 9px; place-items: stretch; backdrop-filter: blur(10px); }
.app-tile .sq.folder i { border-radius: 28%; display: grid; place-items: center; }
.app-tile .sq.folder i svg { width: 11px; height: 11px; stroke-width: 2.6; color: #fff; }
/* folder popup */
.ou-folder { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px;
  background: rgba(20, 20, 24, .28); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
  opacity: 0; pointer-events: none; transition: opacity .2s; }
.ou-folder.open { opacity: 1; pointer-events: auto; }
.ou-folder-box { width: min(420px, 100%); background: color-mix(in srgb, var(--surface) 88%, transparent); border-radius: 30px; padding: 22px 18px 26px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25); transform: scale(.9); transition: transform .25s var(--ease); }
.ou-folder.open .ou-folder-box { transform: none; }
.ou-folder-title { text-align: center; font-weight: 700; font-size: 1.1rem; margin-bottom: 18px; }
.ou-folder .apps { grid-template-columns: repeat(3, 1fr); }
.ou-folder .app-tile { animation: none; }
/* leave widgets: rounder One UI cards */
.me-leave > .card { border-radius: 26px; }
.me-bal .list-card { border-radius: 18px; border-left-width: 0 !important; position: relative; overflow: hidden; }
.me-bal .list-card::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: currentColor; opacity: 0; }
@media (max-width: 768px) {
  .ou-widget { padding: 20px; border-radius: 26px; }
  .ou-clock .t { font-size: 2.8rem; }
  .ou-hello { text-align: left; justify-items: start; }
  .ou-home .apps { grid-template-columns: repeat(4, 1fr); gap: 20px 4px; }
  .app-tile .sq { width: 56px; height: 56px; }
  .app-tile .sq svg { width: 26px; height: 26px; }
  .app-tile .lbl { font-size: .74rem; max-width: 78px; }
}
@media (max-width: 768px) {
  .ou-widget { align-items: center; padding: 16px 18px; gap: 10px; }
  .ou-clock .t { font-size: 2.5rem; }
  .ou-clock .d { font-size: .85rem; margin-top: 4px; }
  .ou-hello { text-align: right; justify-items: end; }
  .ou-hello .g { font-size: .78rem; }
  .ou-hello .n { font-size: .98rem; }
  .ou-pill { flex-basis: 100%; }
  .ou-widget > .ou-pill { justify-content: center; }
}
@media (min-width: 769px) { .ou-widget { display: grid; grid-template-columns: 1fr auto; } .ou-widget > .ou-pill { grid-column: 2; justify-self: end; margin-top: -6px; } }
/* branch picker with search */
.br-pick { background: var(--surface-2); border-radius: 16px; padding: 10px; }
.br-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.br-tools .search { flex: 1; min-width: 180px; }
.br-tools .search .input { height: 38px; background: var(--surface); }
.br-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; max-height: 300px; overflow-y: auto; }
.br-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface); cursor: pointer; border: 1.5px solid transparent; transition: border-color .15s, background .15s; }
.br-item input { position: absolute; opacity: 0; pointer-events: none; }
.br-item .tick { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--surface-3); color: transparent; flex: none; }
.br-item .tick svg { width: 13px; height: 13px; stroke-width: 3; }
.br-item:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.br-item:has(input:checked) .tick { background: var(--accent); border-color: var(--accent); color: #fff; }
.br-item.hidden { display: none; }
/* credentials card */
.cred-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.cred-row + .cred-row { margin-top: 8px; }
.cred-row .k { color: var(--muted); font-size: .8rem; width: 78px; flex: none; }
.cred-row .v { flex: 1; font-weight: 700; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.05rem; word-break: break-all; }
.cred-row .v.plain { font-family: inherit; font-weight: 500; font-size: .9rem; }
.cred-ok { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 10px; background: #e3f8e9; color: var(--success); }
.cred-ok svg { width: 26px; height: 26px; stroke-width: 2.6; }
.user-form, .user-form-head { max-width: 760px; margin-left: auto; margin-right: auto; }
.user-form { padding: 24px 26px; border-radius: 24px; }
.user-form .form-section:first-of-type { margin-top: 0; }
.user-form .form-actions { border-top: 1px solid var(--surface-2); padding-top: 16px; margin-top: 20px; }
@media (max-width: 768px) { .user-form { padding: 18px 16px; } }
.user-form .form-grid { align-items: start; }
.br-item .grow { flex: 1; min-width: 0; }
#credBox { align-items: center; }
#credBox .modal { border-radius: 26px; }
.step-rules { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 6px 0 0 30px; }

/* ===== Attendance ===== */
.att-nav { margin-bottom: 4px; }
.att-head-r { display: flex; gap: 8px; align-items: center; }
.dev-pill { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); color: var(--text); font-size: .86rem; font-weight: 500; }
.dev-pill:hover { text-decoration: none; }
.dev-pill i { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(52, 199, 89, .2); }
.dev-pill.warn i { background: var(--warning); box-shadow: 0 0 0 3px rgba(255, 149, 0, .2); }
.date-nav { display: flex; align-items: center; gap: 6px; }
.date-nav .input { width: auto; }
.att-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.att-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: .86rem; box-shadow: var(--shadow-sm); border: 1.5px solid transparent; }
.att-chip b { color: var(--text); font-size: .95rem; }
.att-chip:hover { text-decoration: none; }
.att-chip.on { border-color: var(--accent); background: var(--accent-soft); }
.att-chip.s-late b, .att-chip.s-missing b { color: #c77800; }
.att-chip.s-absent b { color: var(--danger); }
.att-chip.s-present b { color: var(--success); }
.att-chip.s-leave b { color: var(--accent); }
.att-table .t-in, .att-table .t-out { font-weight: 600; font-variant-numeric: tabular-nums; }
.att-table .miss, .day-row em { color: #8e44ad; font-style: normal; font-weight: 600; font-size: .85rem; }
.late { color: #c77800; font-weight: 600; }
.shift-tag { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: .75rem; font-weight: 700; color: #fff; background: var(--c); }
.badge.purple, .badge.att-missing { background: rgba(142, 68, 173, .12); color: #8e44ad; }
.badge.teal, .badge.att-holiday { background: rgba(26, 159, 176, .12); color: #148a99; }
.badge.att-off, .badge.att-notin, .badge.att-upcoming { background: var(--surface-2); color: var(--muted); }
/* monthly grid */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 10px; }
.legend i { display: inline-grid; place-items: center; min-width: 22px; height: 20px; border-radius: 6px; font-style: normal; font-weight: 700; font-size: .7rem; margin-right: 4px; vertical-align: middle; }
.month-wrap { padding: 0; overflow: auto; max-height: calc(100vh - 260px); }
.month-grid { border-collapse: separate; border-spacing: 0; font-size: .78rem; min-width: 100%; }
.month-grid th, .month-grid td { padding: 0; height: 34px; min-width: 30px; text-align: center; border-bottom: 1px solid var(--surface-2); }
.month-grid thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; font-weight: 600; color: var(--text-2); padding: 6px 0; line-height: 1.1; }
.month-grid thead th span { display: block; font-size: .65rem; color: var(--muted); font-weight: 500; }
.month-grid th.we { color: var(--muted); }
.month-grid th.today { color: var(--accent); }
.month-grid .stick { position: sticky; left: 0; background: var(--surface); z-index: 1; text-align: left; padding: 4px 12px; min-width: 190px; max-width: 220px; }
.month-grid thead .stick { z-index: 3; }
.month-grid .stick a { display: grid; color: var(--text); line-height: 1.25; }
.month-grid .stick a b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.month-grid td { font-weight: 700; }
.month-grid .tot { min-width: 54px; padding: 0 8px; color: var(--text-2); font-weight: 600; background: var(--surface); }
.c-present { color: #1f9d4a; background: rgba(52, 199, 89, .10); }
.c-late, .c-early { color: #c77800; background: rgba(255, 149, 0, .14); }
.c-missing { color: #8e44ad; background: rgba(142, 68, 173, .12); }
.c-absent { color: #e0352b; background: rgba(255, 59, 48, .14); }
.c-leave { color: #0a6cdb; background: rgba(10, 132, 255, .12); font-size: .68rem; }
.c-holiday { color: #148a99; background: rgba(26, 159, 176, .12); }
.c-off, .c-upcoming { background: var(--surface-2); }
.c-notin { color: var(--muted); }
.legend i.c-off { background: var(--surface-2); }
/* person / my scans */
.att-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.att-tiles div { background: var(--surface); border-radius: 18px; padding: 12px 14px; box-shadow: var(--shadow-sm); display: grid; gap: 2px; }
.att-tiles b { font-size: 1.5rem; letter-spacing: -.02em; }
.att-tiles b small { font-size: .85rem; color: var(--muted); font-weight: 500; }
.att-tiles span { color: var(--muted); font-size: .8rem; }
.att-tiles .t-late b { color: #c77800; } .att-tiles .t-absent b { color: var(--danger); } .att-tiles .t-leave b { color: var(--accent); }
.day-list { padding: 4px 6px; }
.day-row { display: flex; align-items: center; gap: 14px; padding: 10px 10px; border-bottom: 1px solid var(--surface-2); }
.day-row:last-child { border-bottom: 0; }
.day-row .dd { width: 42px; text-align: center; display: grid; line-height: 1.1; flex: none; }
.day-row .dd b { font-size: 1.15rem; }
.day-row .dd span { font-size: .72rem; color: var(--muted); }
.day-row.s-off .dd b, .day-row.s-holiday .dd b { color: var(--muted); }
.day-row .io { display: flex; gap: 18px; flex-wrap: wrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.day-row .io small { display: block; font-size: .68rem; color: var(--muted); font-weight: 500; }
/* devices */
.dev-new { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 0 0; border: 1.5px solid var(--accent); background: var(--accent-soft); }
.dev-new-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.dev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-top: 14px; }
.dev-card { display: grid; gap: 12px; border-radius: 22px; }
.dev-top { display: flex; align-items: center; gap: 10px; }
.dev-name { display: block; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--muted); }
.dev-dot.on { background: var(--success); box-shadow: 0 0 0 4px rgba(52, 199, 89, .18); }
.dev-dot.err { background: var(--danger); box-shadow: 0 0 0 4px rgba(255, 59, 48, .15); }
.dev-dot.off { background: #c7c7cc; }
.dev-dot.usb { background: var(--accent); }
.dev-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.dev-kv div { display: grid; min-width: 0; }
.dev-kv span { font-size: .72rem; color: var(--muted); }
.dev-kv b { font-size: .88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev-mem { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; display: grid; gap: 6px; }
.dev-mem > div:first-child { display: flex; justify-content: space-between; }
.dev-mem .bar { height: 6px; border-radius: 99px; background: var(--surface-3); position: relative; overflow: visible; }
.dev-mem .bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: var(--success); }
.dev-mem .bar i.hi { background: var(--warning); }
.dev-mem .bar em { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text-2); opacity: .35; }
.dev-err { color: var(--danger); background: rgba(255, 59, 48, .08); border-radius: 12px; padding: 8px 10px; display: flex; gap: 6px; align-items: flex-start; }
.dev-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dev-cmd { display: flex; gap: 6px; }
.dev-cmd .input { width: auto; height: 34px; }
.dev-empty { grid-column: 1 / -1; display: grid; justify-items: center; gap: 6px; padding: 40px; }
.dev-empty svg { width: 40px; height: 40px; color: var(--muted); }
.dev-lower { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; margin-top: 16px; align-items: start; }
.dev-guide summary { cursor: pointer; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; list-style: none; }
.dev-guide summary::-webkit-details-marker { display: none; }
.dev-guide summary::after { content: "›"; margin-left: auto; transform: rotate(90deg); color: var(--muted); }
.dev-guide[open] summary::after { transform: rotate(-90deg); }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 14px; }
.guide-grid h4 { margin: 0 0 4px; font-size: .95rem; display: flex; gap: 6px; align-items: center; }
.guide-grid ol { padding-left: 18px; margin: 8px 0; display: grid; gap: 4px; }
.guide-grid code, .dev-guide code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: .82rem; }
.g-tag { font-size: .66rem; padding: 2px 7px; border-radius: 99px; background: rgba(52, 199, 89, .15); color: #1f9d4a; }
.rules-grid { display: grid; gap: 10px; }
.rules-grid label { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .86rem; }
.rules-grid label span { display: flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
.rules-grid .input { width: 72px; height: 34px; }
.unk-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.unk { display: grid; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); color: var(--text); }
.unk:hover { text-decoration: none; background: var(--accent-soft); }
.unk span { font-size: .84rem; } .unk small { color: var(--muted); font-size: .74rem; }
.seg-wide { display: flex; width: 100%; } .seg-wide button { flex: 1; }
@media (max-width: 900px) {
  .dev-lower { grid-template-columns: minmax(0, 1fr); }
  .att-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .month-wrap { max-height: none; }
}
@media (max-width: 600px) { .att-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dev-grid { grid-template-columns: minmax(0, 1fr); } }
.c-none { color: var(--surface-3); }

/* ===== Working calendar ===== */
.wc-bar { margin-top: 4px; }
.wc-year { font-size: 1.25rem; min-width: 60px; text-align: center; letter-spacing: -.02em; }
.wc-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-left: auto; color: var(--muted); }
.wc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.wc-legend i { width: 14px; height: 14px; border-radius: 5px; display: inline-block; }
.lg-work { background: var(--surface); box-shadow: inset 0 0 0 1px var(--surface-3); }
.lg-we { background: var(--surface-2); }
.lg-hol { background: #ff3b30; }
.lg-today { box-shadow: inset 0 0 0 2px var(--accent); }
.wc-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.wc-stats div { background: var(--surface); border-radius: 18px; padding: 12px 16px; box-shadow: var(--shadow-sm); display: grid; }
.wc-stats b { font-size: 1.5rem; letter-spacing: -.02em; }
.wc-stats span { color: var(--muted); font-size: .8rem; }
.wc-stats div:first-child b { color: #e0352b; }
.wc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.wc-year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.wc-month { padding: 14px 14px 12px; border-radius: 20px; }
.wc-mname { font-weight: 700; margin: 0 0 8px 4px; }
.wc-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.wc-h { font-size: .66rem; color: var(--muted); text-align: center; font-weight: 600; padding-bottom: 2px; }
.wc-h.we { color: #c7c7cc; }
.wc-d { aspect-ratio: 1; border: 0; border-radius: 9px; font: inherit; font-size: .8rem; font-weight: 500; cursor: pointer; color: var(--text); background: transparent; display: grid; place-items: center; padding: 0; transition: background .12s, transform .12s; }
.wc-d.work:hover { background: var(--accent-soft); }
.wc-d.we { color: var(--muted); background: var(--surface-2); }
.wc-d.hol { background: #ff3b30; color: #fff; font-weight: 700; }
.wc-d.hol:hover { transform: scale(1.08); }
.wc-d.past:not(.hol) { opacity: .55; }
.wc-d.hol.past { background: #ff8a83; }
.wc-d.today { box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); font-weight: 700; opacity: 1; }
.wc-d.today.hol { color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.wc-list { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; padding: 16px; border-radius: 22px; }
.wc-next { background: linear-gradient(135deg, #ff6b61, #e0352b); color: #fff; border-radius: 16px; padding: 12px 14px; display: grid; gap: 2px; margin-bottom: 12px; }
.wc-next .muted { color: rgba(255, 255, 255, .8); }
.wc-mhead { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 12px 0 4px; }
.wc-item { display: flex; gap: 10px; align-items: center; padding: 7px 6px; border-radius: 12px; font-size: .88rem; }
.wc-item:hover { background: var(--surface-2); }
.wc-item.past { opacity: .5; }
.wc-date { width: 36px; display: grid; text-align: center; line-height: 1.1; flex: none; }
.wc-date b { color: #e0352b; } .wc-date small { font-size: .66rem; color: var(--muted); }
@media (max-width: 1100px) { .wc-layout { grid-template-columns: minmax(0, 1fr); } .wc-list { position: static; max-height: none; } }
@media (max-width: 700px) { .wc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .wc-legend { margin-left: 0; } }

/* ===== Corarl-style UI: time clock, action banner, app cards, tab bar with + ===== */
.clock-card { padding: 16px 18px; border-radius: 22px; margin-bottom: 14px; }
.cc-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .92rem; color: var(--text-2); padding-bottom: 10px; border-bottom: 1px solid var(--surface-2); margin-bottom: 12px; flex-wrap: wrap; }
.cc-shift { font-size: .76rem; font-weight: 600; background: var(--surface-2); padding: 3px 9px; border-radius: 99px; color: var(--text-2); }
.cc-body { display: flex; align-items: center; gap: 12px; }
.cc-time { flex: 1; min-width: 0; }
.cc-time .t { font-size: 3rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--text); }
.cc-time .t small { font-size: .95rem; font-weight: 700; margin-left: 4px; color: var(--text-2); }
.cc-time .d { margin-top: 4px; color: var(--muted); font-size: .85rem; }
.cc-tile { width: 112px; flex: none; border-radius: 14px; padding: 10px 12px; background: linear-gradient(160deg, var(--home-a), var(--home-b)); color: #fff; display: grid; gap: 1px; box-shadow: 0 6px 16px rgba(0, 0, 0, .12); }
.cc-tile:hover { text-decoration: none; filter: brightness(1.05); }
.cc-tile small { font-size: .7rem; opacity: .85; }
.cc-tile b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.cc-tile .cc-ic svg { width: 18px; height: 18px; }
.cc-tile.in { background: linear-gradient(160deg, #34c759, #1f9d4a); }
.cc-tile.late { background: linear-gradient(160deg, #ffb340, #ff8a00); }
.cc-tile.out { background: linear-gradient(160deg, #5e5ce6, #3b3fd9); }
.cc-note { margin-top: 10px; font-size: .82rem; font-weight: 600; }
.cc-note.late { color: #c77800; }
.alert-card { background: linear-gradient(160deg, #f08a2c, #e06c10); color: #fff; border-radius: 20px; padding: 14px 16px 16px; margin-bottom: 16px; box-shadow: 0 8px 22px rgba(224, 108, 16, .25); }
.alert-card .ah { display: flex; justify-content: space-between; align-items: center; font-size: 1.02rem; }
.alert-card p { margin: 6px 0 12px; opacity: .95; font-size: .9rem; }
.alert-card .ab { display: block; text-align: center; background: #fff; color: #222; font-weight: 700; padding: 11px; border-radius: 12px; }
.alert-card .ab:hover { text-decoration: none; filter: brightness(.97); }
.app-sec-title { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; font-size: 1.05rem; margin: 4px 2px 10px; }
.app-sec-title a { font-size: .85rem; font-weight: 600; }
.app-section { margin-bottom: 20px; }
.app-section .app-sec-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.app-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.app-card { position: relative; background: var(--surface); border-radius: 16px; padding: 18px 10px 14px; display: grid; justify-items: center; gap: 10px; text-align: center; color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 2px 10px rgba(0, 0, 0, .04); transition: transform .15s var(--ease), box-shadow .15s; animation: rise .45s var(--ease) both; animation-delay: calc(30ms + var(--i, 0) * 25ms); }
.app-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, .08); }
.app-card:active { transform: scale(.96); }
.ac-ico { width: 40px; height: 40px; display: grid; place-items: center; background: none !important; box-shadow: none !important; }
.ac-ico svg { width: 34px; height: 34px; stroke-width: 1.5; }
.ac-lbl { font-weight: 600; font-size: .88rem; line-height: 1.25; }
.ac-soon { position: absolute; top: 8px; right: 8px; font-size: .6rem; font-weight: 700; color: var(--muted); background: var(--surface-2); padding: 2px 6px; border-radius: 99px; }
.ac-ico.t-blue { color: #0a84ff; } .ac-ico.t-green { color: #26a645; } .ac-ico.t-orange { color: #f08a00; } .ac-ico.t-red { color: #e0352b; }
.ac-ico.t-purple { color: #7d4fe6; } .ac-ico.t-teal { color: #1a9fb0; } .ac-ico.t-indigo { color: #4b4fe0; } .ac-ico.t-pink { color: #e0306c; }
.ac-ico.t-gray { color: #6c6c73; } .ac-ico.t-navy { color: var(--home-b); } .ac-ico.t-brown { color: #a36d38; } .ac-ico.t-mint { color: #1fae80; }
[data-theme="dark"] .ac-ico.t-navy { color: var(--gold); }
/* notifications */
.note-list { display: grid; gap: 10px; max-width: 760px; }
.note-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.note-item:hover { text-decoration: none; transform: translateY(-1px); }
.note-item .grow { display: grid; gap: 2px; }
.note-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-2); }
.tone-warn .note-ic { background: rgba(255, 149, 0, .14); color: #e07800; }
.tone-bad .note-ic { background: rgba(255, 59, 48, .12); color: #e0352b; }
.tone-ok .note-ic, .note-ic.tone-ok { background: rgba(52, 199, 89, .14); color: #1f9d4a; }
.tone-info .note-ic { background: var(--accent-soft); color: var(--accent); }
.note-empty { display: grid; justify-items: center; gap: 6px; padding: 40px 20px; }
/* desktop bell */
.bell-d { position: relative; }
.bell-d i, .bnav .bell i { position: absolute; top: -4px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #ff3b30; color: #fff; font-size: .66rem; font-style: normal; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--surface); }
/* quick actions sheet */
.quick-sheet { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, .35); display: flex; align-items: flex-end; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .2s; backdrop-filter: blur(4px); }
.quick-sheet.open { opacity: 1; pointer-events: auto; }
.qs-box { width: min(560px, 100%); background: var(--surface); border-radius: 26px 26px 0 0; padding: 8px 18px calc(22px + env(safe-area-inset-bottom)); transform: translateY(40px); transition: transform .25s var(--ease); }
.quick-sheet.open .qs-box { transform: none; }
.qs-grab { width: 40px; height: 5px; border-radius: 9px; background: var(--surface-3); margin: 4px auto 10px; }
.qs-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 1.05rem; }
.qs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.qs-grid a { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 14px 6px; border-radius: 16px; background: var(--surface-2); color: var(--text); font-size: .82rem; font-weight: 600; }
.qs-grid a:hover { text-decoration: none; background: var(--accent-soft); }
.qs-grid .ac-ico svg { width: 28px; height: 28px; }
@media (min-width: 769px) { .quick-sheet { align-items: center; } .qs-box { border-radius: 26px; } .qs-grab { display: none; } }
@media (max-width: 900px) {
  /* brand-colour header like a native app */
  .phone-head { background: linear-gradient(135deg, var(--home-a), var(--home-b)) !important; color: #fff; border-bottom: 0 !important; box-shadow: 0 2px 12px rgba(0, 0, 0, .12); }
  .phone-head .t { color: #fff; font-weight: 700; }
  .phone-head .rbtn { background: rgba(255, 255, 255, .18) !important; color: #fff; box-shadow: none !important; }
  .phone-head .brand-mark, .phone-head .bm { box-shadow: 0 0 0 2px rgba(255, 255, 255, .5); }
  /* tab bar: flat, full width, raised + */
  .bnav.tabbar { left: 0; right: 0; bottom: 0; height: calc(62px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); border-radius: 0; background: var(--surface) !important;
    box-shadow: 0 -1px 0 var(--surface-2), 0 -6px 20px rgba(0, 0, 0, .06) !important; backdrop-filter: none; }
  .bnav.tabbar a, .bnav.tabbar button { font-size: .68rem; }
  .bnav.tabbar a.on { color: var(--home-a); }
  [data-theme="dark"] .bnav.tabbar a.on { color: var(--gold); }
  .bnav.tabbar .bell { position: relative; display: grid; }
  .bnav.tabbar .fab { flex: 0 0 74px; margin-top: -30px; padding: 0; }
  .bnav.tabbar .fab span { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto; color: #fff;
    background: linear-gradient(160deg, var(--home-a), var(--home-b)); box-shadow: 0 8px 20px rgba(0, 0, 0, .25), 0 0 0 5px var(--surface); }
  .bnav.tabbar .fab svg { width: 28px; height: 28px; stroke-width: 2.4; }
  .content { padding-bottom: 96px !important; }
  .app-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
  .app-card { padding: 16px 6px 12px; gap: 8px; border-radius: 14px; }
  .ac-ico svg { width: 30px; height: 30px; }
  .ac-lbl { font-size: .8rem; }
  .cc-time .t { font-size: 2.5rem; }
  .cc-tile { width: 92px; padding: 8px 10px; }
  .cc-tile b { font-size: 1.05rem; }
}
@media (max-width: 380px) { .cc-tile { width: 80px; } .cc-time .t { font-size: 2.1rem; } }
@media (max-width: 560px) {
  .cc-body { flex-wrap: wrap; }
  .cc-time { flex-basis: 100%; }
  .cc-tile { flex: 1; width: auto; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 10px 14px; }
  .cc-tile .cc-ic { grid-row: span 2; }
  .cc-tile .cc-ic svg { width: 24px; height: 24px; }
  .cc-time .t { font-size: 2.8rem; }
}
.alert-card .ah svg { width: 22px; height: 22px; }
@media (max-width: 900px) {
  /* the brand header already shows the page title */
  .content > .page-head > h1:first-child { display: none; }
  .content > .page-head:has(> h1:only-child) { display: none; }
}

/* ===== Popups float over the page (the page stays visible behind) ===== */
.drawer-back { background: rgba(15, 18, 25, .32); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.drawer.fs {
  top: 28px; bottom: 28px; left: 50%; right: auto; width: min(1180px, calc(100vw - 64px)); height: auto;
  border-radius: 26px; background: var(--bg); box-shadow: 0 30px 80px rgba(0, 0, 0, .28), 0 0 0 1px rgba(0, 0, 0, .04);
  opacity: 0; transform: translate(-50%, 36px) scale(.98); transition: transform .38s var(--ease), opacity .25s;
}
.drawer.fs.open { opacity: 1; transform: translate(-50%, 0); }
.sidebar ~ .main .drawer.fs, body:not(.side-collapsed) .drawer.fs { }
@media (min-width: 901px) {
  /* keep the menu visible: centre the popup over the content area, not the whole window */
  .drawer.fs { left: calc(50% + var(--side-w, 248px) / 2); width: min(1180px, calc(100vw - var(--side-w, 248px) - 56px)); }
  html.pre-collapsed .drawer.fs, body.side-collapsed .drawer.fs { left: calc(50% + 36px); width: min(1180px, calc(100vw - 72px - 56px)); }
}
@media (max-width: 900px) {
  /* phone: sheet slides up and leaves the page visible at the top */
  .drawer.fs { top: calc(44px + env(safe-area-inset-top)); bottom: 0; left: 0; width: 100%; border-radius: 22px 22px 0 0;
    transform: translateY(100%); opacity: 1; }
  .drawer.fs.open { transform: none; }
  .drawer.fs::before { display: block; content: ""; position: absolute; top: 7px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 9px; background: var(--surface-3); z-index: 2; }
}

/* page popup: centred, as big as its content (size set by app.js), page visible around it */
@media (min-width: 901px) {
  #pageSheet.drawer.fs { top: 50%; bottom: auto; height: calc(100vh - 56px); max-height: calc(100vh - 56px);
    transform: translate(-50%, -46%) scale(.98); transition: transform .32s var(--ease), opacity .22s, height .2s var(--ease); }
  #pageSheet.drawer.fs.open { transform: translate(-50%, -50%); }
}
@media (max-width: 900px) {
  #pageSheet.drawer.fs { top: auto; height: calc(100vh - 52px); max-height: calc(100vh - 52px); transition: transform .35s var(--ease), height .25s var(--ease); }
}

/* ===== compact pages inside popups ===== */
html.embedded { font-size: 15px; }
html.embedded .embed-content { padding: 12px 16px 18px; }
html.embedded .page-head { margin-bottom: 10px; gap: 10px; }
html.embedded .card { padding: 16px 18px; border-radius: 18px; }
html.embedded .user-form { padding: 16px 18px; }
html.embedded .form-section, html.embedded .section-title { font-size: .95rem; margin: 14px 0 8px; }
html.embedded .form-section:first-child, html.embedded .section-title:first-child, html.embedded .card > .form-section:first-of-type { margin-top: 0; }
html.embedded .form-grid { gap: 10px 14px; }
html.embedded .field label { font-size: .8rem; margin-bottom: 4px; }
html.embedded .input { height: 38px; font-size: .9rem; border-radius: 10px; padding: 0 12px; }
html.embedded textarea.input { height: auto; padding: 8px 12px; }
html.embedded .field .muted.small, html.embedded .field .small { font-size: .74rem; }
html.embedded .switch { gap: 8px; }
html.embedded .btn { height: 36px; font-size: .88rem; padding: 0 14px; }
html.embedded .btn-sm { height: 32px; }
html.embedded .form-actions { margin-top: 14px; padding-top: 12px; }
html.embedded .br-pick { padding: 8px; border-radius: 14px; }
html.embedded .br-item { padding: 8px 10px; border-radius: 10px; font-size: .86rem; }
html.embedded .br-tools .search .input { height: 34px; }
html.embedded .info-grid { gap: 10px 18px; }
html.embedded .info-grid .k { font-size: .74rem; }
html.embedded .info-grid .v { font-size: .9rem; }
html.embedded .profile-hero { gap: 14px; }
html.embedded .tabnav a { padding: 7px 10px; font-size: .88rem; }
html.embedded .tabnav a .ti { width: 24px; height: 24px; }
html.embedded .pop-x { width: 30px; height: 30px; }
.mv-form { max-width: 920px; }
/* phone-only rules must not apply inside a popup frame that happens to be narrow */
html.embedded .content, html.embedded .embed-content { padding-bottom: 18px !important; }
html.embedded .content > .page-head > h1:first-child { display: block; }
html.embedded .content > .page-head:has(> h1:only-child) { display: flex; }
/* a closed popup must never block clicks on the page */
.drawer.fs:not(.open) { pointer-events: none; visibility: hidden; transition: transform .32s var(--ease), opacity .22s, visibility 0s linear .32s; }
.drawer.fs.open { visibility: visible; transition-delay: 0s; }

/* ===== compact employee profile (popup and page) ===== */
.profile-layout { grid-template-columns: 200px minmax(0, 1fr); gap: 14px; max-width: 1040px; }
.tabnav { padding: 6px; border-radius: 16px; }
.tabnav a { padding: 6px 9px; gap: 9px; font-size: .86rem; border-radius: 9px; }
.tabnav a .ti { width: 22px; height: 22px; border-radius: 7px; }
.tabnav a .ti svg { width: 13px; height: 13px; }
.tabnav .count { font-size: .7rem; }
.profile-hero { gap: 14px; }
.profile-hero .avatar.xl { width: 68px; height: 68px; font-size: 1.25rem; box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--accent); }
.profile-hero .photo-pick .cam { width: 24px; height: 24px; }
.profile-hero .names .kh { font-size: 1rem; }
.profile-hero .names .en { font-size: .95rem; }
.profile-hero .names .muted { font-size: .82rem; }
.profile-hero .meta { margin-top: 6px; gap: 6px; }
.profile-layout .card { padding: 14px 16px; border-radius: 16px; }
.profile-layout .card + .card, .profile-layout .card[style*="margin-bottom"] { margin-bottom: 12px !important; }
.profile-layout .section-title { font-size: .92rem; margin: 14px 0 8px; }
.profile-layout .info-grid { gap: 8px 16px; }
.profile-layout .info-grid .k { font-size: .72rem; }
.profile-layout .info-grid .v { font-size: .88rem; }
.profile-layout .pen { width: 26px; height: 26px; }
.profile-layout .pen svg { width: 12px; height: 12px; }
.hero-acts { gap: 5px; }
html.embedded .profile-layout { max-width: 980px; }
@media (max-width: 900px) { .profile-layout { grid-template-columns: minmax(0, 1fr); max-width: none; } }
.tabnav a { padding: 5px 8px; font-size: .82rem; gap: 8px; }
.tabnav a .ti { width: 20px; height: 20px; border-radius: 6px; }
.tabnav a .ti svg { width: 12px; height: 12px; }
.profile-hero .avatar.xl { width: 60px; height: 60px; font-size: 1.1rem; }
.profile-layout .info-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 14px; }
.profile-layout .info-grid > div { line-height: 1.3; }
@media (max-width: 1100px) { .profile-layout .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .profile-layout .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
html.embedded .profile-layout .info-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 700px) { html.embedded .profile-layout .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ===== Language switcher ===== */
.lang-wrap { position: relative; }
.lang-btn { padding: 0 !important; display: grid; place-items: center; }
.flag { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .9), 0 1px 3px rgba(0, 0, 0, .25); flex: none; }
svg.flag { width: 22px; height: 22px; }
.lang-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 80; min-width: 170px; background: var(--surface); border-radius: 16px; padding: 6px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .18), 0 0 0 .5px var(--hair); display: none; }
.lang-wrap.open .lang-menu { display: grid; gap: 2px; animation: pop .16s var(--ease); }
.lang-menu form { margin: 0; }
.lang-menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; background: none; border-radius: 11px; font: inherit; font-size: .95rem; color: var(--text); cursor: pointer; text-align: left; }
.lang-menu button:hover { background: var(--surface-2); }
.lang-menu button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.lang-menu button.kh { font-family: var(--font); }
.auth-lang { position: fixed; top: 16px; right: 16px; z-index: 5; }
.auth-lang .rbtn { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-sm); border: 0; cursor: pointer; }
/* Khmer: Khmer font first, a little more line height, no tight letter spacing */
html[lang="km"] body { font-family: var(--font); letter-spacing: 0; line-height: 1.6; }   /* same standard size as English */
html[lang="km"] h1, html[lang="km"] h2, html[lang="km"] h3, html[lang="km"] .btn, html[lang="km"] .badge { letter-spacing: 0; }
.lang-default { display: flex; align-items: center; gap: 8px; }
.lang-table { padding: 6px 0; }
.lt-head, .lt-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: center; padding: 6px 16px; }
.lt-head { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--surface-2); padding-bottom: 10px; }
.lt-head span { display: flex; align-items: center; gap: 6px; } .lt-head .flag { width: 16px; height: 16px; }
.lt-row { border-bottom: 1px solid var(--surface-2); }
.lt-row:hover { background: var(--surface-2); }
.lt-row.edited { background: var(--accent-soft); }
.lt-src { font-size: .88rem; word-break: break-word; }
.lt-row .input { height: 36px; font-size: .88rem; }
.lang-table .form-actions { padding: 10px 16px 6px; margin: 0; }
@media (max-width: 760px) { .lt-head { display: none; } .lt-row { grid-template-columns: 1fr; gap: 6px; padding: 12px 16px; } }
.lang-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.lang-card { padding: 12px 14px; display: grid; gap: 8px; border-radius: 18px; border: 1.5px solid transparent; }
.lang-card.on { border-color: var(--accent); }
.lang-card.off { opacity: .6; }
.lc-main { display: flex; align-items: center; gap: 10px; color: var(--text); }
.lc-main:hover { text-decoration: none; }
.lc-main .grow { display: grid; }
.lc-flag .flag { width: 32px; height: 32px; }
.lc-bar { height: 5px; border-radius: 9px; background: var(--surface-2); overflow: hidden; }
.lc-bar i { display: block; height: 100%; background: var(--success); border-radius: 9px; }
.lc-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.lc-acts { display: flex; gap: 4px; }
.flag-code { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .55rem; font-weight: 800; }
.lc-flag .flag-code { width: 32px; height: 32px; font-size: .75rem; }
img.flag { object-fit: cover; }
.lt-head, .lt-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; }
.lt-in { display: flex; gap: 6px; align-items: center; }


/* ===== every popup fills the whole screen (desktop, tablet and phone) ===== */
.drawer.fs, #pageSheet.drawer.fs,
html.pre-collapsed .drawer.fs, body.side-collapsed .drawer.fs {
  position: fixed; inset: 0 !important; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
  width: 100vw !important; height: 100vh !important; height: 100dvh !important; max-height: none !important; max-width: none !important;
  border-radius: 0 !important; opacity: 1; transform: translateY(100%) !important; transition: transform .32s var(--ease) !important;
}
.drawer.fs.open, #pageSheet.drawer.fs.open { transform: none !important; }
.drawer.fs::before { display: none !important; }
.drawer.fs ~ .drawer-back, .drawer-back[data-back-for="pageSheet"] { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
/* round close button stays reachable under the phone notch */
html.embedded .pop-x { top: calc(10px + env(safe-area-inset-top)); }

/* in-page dialogs (add holiday, language, import …) also cover the screen; content stays a readable width */
.modal-back { padding: 0 !important; align-items: stretch !important; }
.modal-back .modal:not(.modal-alert) {
  width: 100vw !important; max-width: none !important; height: 100vh; height: 100dvh; max-height: none !important;
  border-radius: 0 !important; box-shadow: none;
}
.modal-back .modal:not(.modal-alert) .modal-head { padding-top: env(safe-area-inset-top); height: calc(54px + env(safe-area-inset-top)); }
.modal-back .modal:not(.modal-alert) .modal-body { flex: 1; width: 100%; max-width: 860px; margin: 0 auto; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
/* small alerts (password copied, …) stay a small centred card */
.modal-back:has(.modal-alert) { padding: 16px !important; align-items: center !important; }
/* side drawers (new leave request …) cover the screen too, form kept at a readable width */
.drawer:not(.fs) { inset: 0 !important; top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important; width: 100vw !important;
  height: 100vh !important; height: 100dvh !important; border-radius: 0 !important; transform: translateY(100%); }
.drawer:not(.fs).open { transform: none; }
.drawer:not(.fs) .drawer-body, .drawer:not(.fs) .drawer-foot { width: 100%; max-width: 860px; margin-left: auto; margin-right: auto; }
.drawer:not(.fs) .drawer-head { padding-top: env(safe-area-inset-top); }
/* content inside a full-screen popup uses the full width */
html.embedded .embed-content { max-width: none; }
html.embedded .profile-layout { max-width: none; }
input[style*="uppercase"]::placeholder { text-transform: none; }

/* ======================================================================
   v3.5 – list pages like the school system: title in the top bar, toolbar row,
   table card that scrolls inside (header stays), total + pages at the bottom.
   Every screen opens as a normal page (no popups).
   ====================================================================== */
/* sidebar: plain outline icons, group names in normal case, active item with a bar */
.nav-label { text-transform: none; letter-spacing: 0; font-size: .98rem; color: var(--text); font-weight: 500; padding: 16px 12px 6px; }
.nav-link { padding: 10px 12px; font-size: .97rem; gap: 14px; position: relative; border-radius: 10px; color: var(--text); }
.nav-link .ico { background: transparent !important; color: inherit; width: 22px; height: 22px; border-radius: 0; }
.nav-link .ico svg { width: 20px; height: 20px; stroke-width: 1.8; }
.nav-link.active { background: var(--surface-2); color: var(--accent); font-weight: 500; }
.nav-link.active::before { content: ""; position: absolute; left: -8px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }

/* top bar with the page title */
.tb-title { display: none; }
@media (min-width: 901px) {
  .topbar-d { padding: 14px 28px 8px; min-height: 66px; }
  .topbar-d .tb-title { display: flex; align-items: center; gap: 10px; margin-right: auto; min-width: 0; font-size: 1.3rem; font-weight: 700; letter-spacing: -.01em; }
  .tb-title > span, .tb-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tb-title .muted { font-size: .95rem !important; font-weight: 500 !important; }
  .tb-back { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--text); flex: none; }
  .tb-back:hover { color: var(--accent); text-decoration: none; }
  .content { max-width: none; }
  /* list pages fill the window; only the table scrolls */
  body.list-page { overflow: hidden; }
  body.list-page .main { height: 100vh; height: 100dvh; overflow: hidden; }
  body.list-page .content { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: 16px; }
  body.list-page .content > * { flex: none; }
  body.list-page .content > .table-wrap { flex: 1 1 auto; min-height: 140px; overflow: auto; overscroll-behavior: contain; }
  body.list-page .table thead th { position: sticky; top: 0; z-index: 3; background: var(--surface); box-shadow: inset 0 -1px 0 var(--hair); }
}

/* toolbar row */
.listbar, .toolbar { gap: 10px; margin-bottom: 14px; align-items: center; }
.listbar .spacer { display: none; }
.listbar .search .input, .toolbar .search .input, .toolbar > .input, .toolbar select.input, .toolbar input.input { height: 44px; border-radius: 12px; background: var(--surface); box-shadow: none; }
.listbar .btn-icon, .toolbar .btn-icon { width: 48px; height: 44px; border-radius: 12px; background: var(--surface); box-shadow: none; }
.listbar .chip, .toolbar .chip { height: 38px; border-radius: 10px; background: var(--surface); box-shadow: none; padding: 0 10px 0 6px; }
.bar-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-left: auto; order: 1; }
.bar-actions > form { display: contents; }
.bar-actions .btn, .bulk-acts .btn { height: 44px; border-radius: 12px; padding: 0 18px; }
.btn-soft { background: var(--surface); color: var(--text); box-shadow: none; border: 0; }
.btn-soft:hover { color: var(--accent); }
.btn-soft:disabled, .btn-soft[disabled] { opacity: .45; cursor: default; }
.listbar .bulk-acts { order: 1; margin-left: auto; }
.listbar .bulk-acts + .bar-actions, .listbar .bulk-acts ~ .bar-actions { margin-left: 0; }
.listbar .bar-break { order: 2; flex-basis: 100%; height: 0; }
.listbar .sel-group { order: 3; }
.sel-group .pill { height: 34px; border-radius: 8px; background: var(--surface); box-shadow: none; font-weight: 500; }

/* table card */
.table-wrap { border-radius: 18px; background: var(--surface); box-shadow: none; padding: 0 14px; }
.table-wrap .table { border-collapse: separate; border-spacing: 0; }
.table th { text-transform: none; letter-spacing: 0; color: var(--text); font-weight: 700; font-size: .93rem; padding: 18px 14px; }
.table th a { gap: 6px; }
.table td { padding: 14px; font-size: .95rem; border-top: 1px solid var(--hair); }
.table tbody tr:first-child > td { border-top: 0; }
.table tbody tr:hover > td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table .avatar { width: 44px; height: 44px; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px color-mix(in srgb, var(--accent) 75%, transparent); }
.emp-cell { gap: 14px; }
.emp-cell .name { font-weight: 500; color: var(--text); }
.emp-cell .code { color: var(--muted); }
.table .exp { width: 34px; padding-right: 0; }
.exp-btn { width: 30px; height: 30px; border: 0; background: none; color: var(--text); cursor: pointer; border-radius: 8px; display: grid; place-items: center; transition: transform .25s var(--ease); }
.exp-btn:hover { background: var(--surface-2); }
tr.expanded .exp-btn { transform: rotate(180deg); }
.table tr.detail-row > td { background: var(--surface-2); padding: 12px 18px 14px 108px; border-top: 0; }
.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 20px; }
.detail-grid span { display: block; color: var(--muted); font-size: .78rem; }
.detail-grid b { font-weight: 500; }

/* row action buttons: outlined squares – view (accent), edit (orange), delete (red), more */
.table td.actions, .table td.right { white-space: nowrap; }
.table .act, .table td .btn-icon.sm { width: 36px; height: 36px; border-radius: 10px; display: inline-grid; place-items: center; vertical-align: middle;
  background: transparent; border: 1.5px solid currentColor; color: var(--accent); box-shadow: none; margin-left: 6px; cursor: pointer; padding: 0; }
.table .act:hover, .table td .btn-icon.sm:hover { background: color-mix(in srgb, currentColor 12%, transparent); text-decoration: none; }
.table .act-edit, .table td a.btn-icon.sm[href*="edit"] { color: #f59e0b; }
.table td form .btn-icon.sm, .table td form[data-confirm] .btn-icon.sm { color: var(--danger) !important; }
.table .act-more { color: var(--muted); border-color: var(--hair); }
details.kebab { display: inline-block; position: relative; }
details.kebab > summary { list-style: none; }
details.kebab > summary::-webkit-details-marker { display: none; }
.kebab-menu { position: fixed; z-index: 90; min-width: 170px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; text-align: left; }
.kebab-menu form { margin: 0; }
.kebab-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; background: none; border-radius: 9px; font: inherit; font-size: .9rem; color: var(--text); cursor: pointer; }
.kebab-menu button:hover { background: var(--surface-2); }
.kebab-menu .danger { color: var(--danger); }

/* footer: total + rows per page + pages */
.table-foot { margin-top: 14px; }
.table-foot .muted { color: var(--text); font-size: .98rem; }
.table-foot .muted b { font-weight: 700; }
.table-foot select.input.sm { height: 44px; border-radius: 12px; background: var(--surface); min-width: 78px; font-weight: 600; box-shadow: none; }
.pager { gap: 8px; }
.pager .pg { min-width: 44px; height: 44px; padding: 0 12px; border-radius: 12px; background: var(--surface); color: var(--text); display: grid; place-items: center; font-weight: 600; font-size: .95rem; box-shadow: none; }
.pager a.pg:hover { color: var(--accent); text-decoration: none; }
.pager .pg.cur { background: var(--accent); color: #fff; }
.pager .pg.off { opacity: .35; }

/* phone / tablet */
@media (max-width: 900px) {
  .listbar .group, .listbar > form.group { width: 100%; }
  .listbar .bulk-acts, .bar-actions { width: 100%; margin-left: 0; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .bar-actions .btn, .bulk-acts .btn { height: 40px; padding: 0 14px; flex: none; }
  .bar-actions .btn-primary { margin-left: auto; }
  .listbar .sel-group { width: auto; }
  .table-wrap { padding: 0; }
  .table-wrap.cards tr { border-radius: 16px; padding: 14px; }
  .table-wrap.cards td.actions { gap: 6px; padding-top: 10px; }
  .table .act, .table td .btn-icon.sm { margin-left: 0; }
  .table-foot { flex-direction: column; align-items: stretch; gap: 10px; }
  .table-foot > div:last-child { justify-content: space-between; }
  .pager { gap: 6px; }
  .pager .pg { min-width: 38px; height: 38px; padding: 0 8px; border-radius: 10px; }
  .table-foot select.input.sm { height: 38px; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.listbar > form.group .search { flex: 0 1 380px !important; width: 380px; }
@media (max-width: 900px) {
  .listbar > form.group .search { flex: 1 1 auto !important; width: auto; }
  .listbar .bulk-acts { display: none; }
  .listbar .sel-group .sep { display: none; }
  .bar-actions { justify-content: flex-end; }
}
@media (min-width: 901px) { html:not(.embedded) .profile-layout { max-width: none; } }

/* ---- compact sizes (more rows on screen) ---- */
.nav-label { font-size: .9rem; padding: 12px 12px 4px; }
.nav-link { padding: 7px 12px; font-size: .9rem; gap: 12px; }
.nav-link .ico svg { width: 18px; height: 18px; }
@media (min-width: 901px) {
  .topbar-d { padding: 10px 22px 4px; min-height: 54px; }
  .topbar-d .tb-title { font-size: 1.12rem; }
  .content { padding: 6px 22px 30px; }
  body.list-page .content { padding-bottom: 12px; }
}
.listbar, .toolbar { gap: 8px; margin-bottom: 10px; }
.listbar .search .input, .toolbar .search .input, .toolbar > .input, .toolbar select.input, .toolbar input.input { height: 38px; border-radius: 10px; font-size: .88rem; }
.listbar .btn-icon, .toolbar .btn-icon { width: 40px; height: 38px; border-radius: 10px; }
.listbar .chip, .toolbar .chip { height: 32px; font-size: .84rem; }
.bar-actions .btn, .bulk-acts .btn { height: 38px; border-radius: 10px; padding: 0 14px; font-size: .86rem; }
.sel-group .pill { height: 30px; font-size: .8rem; }
.listbar > form.group .search { flex-basis: 320px !important; width: 320px; }
.table-wrap { border-radius: 14px; padding: 0 10px; }
.table th { padding: 12px 10px; font-size: .84rem; }
.table td { padding: 8px 10px; font-size: .88rem; }
.table .avatar { width: 34px; height: 34px; font-size: .7rem; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px color-mix(in srgb, var(--accent) 75%, transparent); }
.emp-cell { gap: 10px; }
.emp-cell .code { font-size: .78rem; }
.table .act, .table td .btn-icon.sm { width: 30px; height: 30px; border-radius: 8px; margin-left: 4px; border-width: 1.3px; }
.table .act svg, .table td .btn-icon.sm svg { width: 14px; height: 14px; }
.exp-btn { width: 26px; height: 26px; }
.table .sel { width: 34px; }
.table tr.detail-row > td { padding: 10px 14px 12px 88px; font-size: .86rem; }
.table-foot { margin-top: 10px; }
.table-foot .muted { font-size: .9rem; }
.table-foot select.input.sm { height: 36px; min-width: 66px; border-radius: 10px; }
.pager { gap: 6px; }
.pager .pg { min-width: 36px; height: 36px; padding: 0 8px; border-radius: 10px; font-size: .86rem; }
.badge { font-size: .74rem; }
@media (max-width: 900px) {
  .pager .pg { min-width: 34px; height: 34px; }
  .table-wrap.cards tr { padding: 10px 12px; margin-bottom: 8px; }
}
@media (max-width: 900px) {
  .listbar > form.group { flex-wrap: nowrap; }
  .listbar > .group:not(.sel-group):not(.bulk-acts) { width: auto; }
  .listbar > form.group { width: 100%; }
  .listbar .bar-actions, .toolbar .bar-actions { width: auto; margin-left: auto; }
  .listbar .sel-group { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .listbar .sel-group > * { flex: none; }
}
@media (max-width: 900px) {
  .listbar > form.group .search { min-width: 0; }
  .listbar > form.group .search .input { width: 100%; min-width: 0; }
  .listbar > form.group > .btn-icon { flex: none; }
}
@media (max-width: 900px) { .listbar > form.group .search { flex: 1 1 0 !important; width: auto; } }

/* ===== Menu: module launcher (like the school system) ===== */
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 34px 16px; max-width: 1200px; margin: 40px auto 20px; }
.mod-tile { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--text); text-align: center; padding: 6px; border-radius: 18px; }
.mod-tile:hover { text-decoration: none; }
.mod-ico { width: 84px; height: 84px; border-radius: 26px; background: var(--c); color: #fff; display: grid; place-items: center;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--c) 30%, transparent); transition: transform .2s var(--ease); }
.mod-ico svg { width: 32px; height: 32px; stroke-width: 2; }
.mod-tile:hover .mod-ico { transform: translateY(-3px) scale(1.04); }
.mod-tile:active .mod-ico { transform: scale(.94); }
.mod-name { font-weight: 600; font-size: .98rem; }
.mod-foot { text-align: center; margin-top: 30px; }
@media (max-width: 900px) {
  .mod-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 8px; margin: 18px 0; }
  .mod-ico { width: 64px; height: 64px; border-radius: 20px; }
  .mod-ico svg { width: 26px; height: 26px; }
  .mod-name { font-size: .84rem; }
}

/* ===== profile sections: one row of tabs on top (no second menu next to the sidebar) ===== */
html:not(.embedded) .profile-layout { grid-template-columns: minmax(0, 1fr) !important; gap: 12px; }
html:not(.embedded) .tabnav { position: static; display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 2px; padding: 5px; max-height: none;
  border-radius: 14px; box-shadow: none; scrollbar-width: thin; }
html:not(.embedded) .tabnav a { flex: none; padding: 7px 12px; gap: 7px; font-size: .86rem; border-radius: 10px; }
html:not(.embedded) .tabnav a .ti { width: 20px; height: 20px; border-radius: 6px; }
html:not(.embedded) .tabnav a .ti svg { width: 12px; height: 12px; }
html:not(.embedded) .tabnav .count { margin-left: 2px; font-size: .72rem; }

/* ===== Employee Detail: profile panel on the left (photo, name, sections), information on the right ===== */
html:not(.embedded) .profile-layout.emp-detail { grid-template-columns: 270px minmax(0, 1fr) !important; gap: 18px; align-items: start; }
.emp-side { background: var(--surface); border-radius: 18px; padding: 16px 12px 12px; position: sticky; top: 8px; max-height: calc(100vh - 80px); overflow-y: auto; scrollbar-width: thin; }
.side-min-btn { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--text); display: grid; place-items: center; cursor: pointer; z-index: 2; }
.es-photo { display: flex; justify-content: center; margin-top: 18px; }
.es-photo .avatar.xl, .es-photo .avatar { width: 104px; height: 104px; font-size: 1.6rem; box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--accent); }
.es-photo .photo-pick label { position: relative; display: inline-block; cursor: pointer; }
.es-photo .cam { position: absolute; right: -2px; bottom: 2px; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 0 0 3px var(--surface); }
.es-name { text-align: center; margin: 12px 0 10px; display: grid; gap: 2px; }
.es-name .kh { font-size: .95rem; }
.es-name b { font-size: 1.02rem; }
.es-name .muted { font-size: .86rem; }
.es-badges { display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.es-acts { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
.es-nav { display: grid; gap: 2px; border-top: 1px solid var(--hair); padding-top: 10px; margin-top: 6px; }
.es-nav a { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-radius: 10px; color: var(--text); font-size: .93rem; font-weight: 500; }
.es-nav a svg { width: 18px; height: 18px; flex: none; }
.es-nav a:hover { background: var(--surface-2); text-decoration: none; }
.es-nav a.active { color: var(--accent); background: var(--accent-soft); }
.es-nav .count { margin-left: auto; font-size: .74rem; color: var(--muted); }
/* collapsed panel: icons only */
.emp-detail.side-min { grid-template-columns: 76px minmax(0, 1fr) !important; }
.emp-detail.side-min .emp-side { padding: 12px 8px; }
.emp-detail.side-min .side-min-btn { position: static; margin: 0 auto 8px; transform: scaleX(-1); }
.emp-detail.side-min .es-photo { margin-top: 0; }
.emp-detail.side-min .es-photo .avatar { width: 48px; height: 48px; font-size: .8rem; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.emp-detail.side-min .es-photo .cam, .emp-detail.side-min .es-name, .emp-detail.side-min .es-nav .t, .emp-detail.side-min .es-nav .count { display: none; }
.emp-detail.side-min .es-nav a { justify-content: center; padding: 10px 0; }
/* information cards */
.emp-main > .card, .emp-main .card { border-radius: 18px; padding: 20px 24px; }
.emp-main .section-title { display: flex; align-items: center; justify-content: space-between; font-size: 1.02rem; margin: 22px 0 14px; }
.emp-main .card > .section-title:first-child { margin-top: 0; }
.emp-main .info-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 28px; }
.emp-main .info-grid .k { font-size: .84rem; margin-bottom: 3px; }
.emp-main .info-grid .v { font-size: .95rem; }
.emp-main .pen:not(.gray), .es-acts .pen:not(.gray) { background: var(--accent); color: #fff; border-color: var(--accent); width: 32px; height: 32px; }
@media (max-width: 900px) {
  html:not(.embedded) .profile-layout.emp-detail, .emp-detail.side-min { grid-template-columns: minmax(0, 1fr) !important; }
  .emp-side { position: static; max-height: none; padding: 14px 10px 8px; }
  .side-min-btn { display: none; }
  .es-photo { margin-top: 4px; }
  .es-photo .avatar { width: 84px !important; height: 84px !important; }
  .es-nav { display: flex; overflow-x: auto; scrollbar-width: none; gap: 4px; }
  .es-nav a { flex: none; padding: 8px 12px; }
  .emp-main .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .emp-main > .card, .emp-main .card { padding: 16px; }
}
@media (min-width: 901px) { html:not(.embedded) .profile-layout.emp-detail.side-min { grid-template-columns: 76px minmax(0, 1fr) !important; } }

/* Home: module tiles, compact */
.home-mods { margin: 4px 0 18px; }
.home-mods .mod-grid, .mod-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 16px 8px; margin: 0; max-width: none; }
.mod-tile { gap: 8px; padding: 8px 4px; border-radius: 14px; }
.mod-tile:hover { background: var(--surface); }
.mod-ico { width: 56px; height: 56px; border-radius: 17px; box-shadow: 0 6px 14px color-mix(in srgb, var(--c) 28%, transparent);
  background: linear-gradient(145deg, color-mix(in srgb, var(--c) 82%, #fff), var(--c)); }
.mod-ico svg { width: 26px; height: 26px; stroke-width: 1.9; }
.mod-name { font-size: .84rem; font-weight: 600; line-height: 1.25; }
@media (max-width: 900px) {
  .home-mods .mod-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 4px; }
  .mod-ico { width: 52px; height: 52px; border-radius: 16px; }
  .mod-ico svg { width: 24px; height: 24px; }
  .mod-name { font-size: .74rem; }
}

/* ===== Payroll ===== */
.pr-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.pr-stats .stat { box-shadow: none; padding: 12px 14px; border-radius: 14px; }
.pr-stats .stat .n { font-size: 1.2rem; }
.pr-stats .stat .l { font-size: .78rem; }
.pr-recalc { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.pr-recalc .input { height: 38px; border-radius: 10px; }
.pr-exp > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; height: 38px; border-radius: 10px; padding: 0 14px; }
.pr-exp > summary::-webkit-details-marker { display: none; }
.kebab-menu a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--text); font-size: .9rem; white-space: nowrap; }
.kebab-menu a:hover { background: var(--surface-2); text-decoration: none; }
.pr-line { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.pr-line .card { border-radius: 16px; padding: 16px 18px; }
.pr-calc table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.pr-calc td, .pr-calc th { padding: 6px 4px; border-top: 1px solid var(--hair); text-align: left; vertical-align: top; }
.pr-calc th { color: var(--muted); font-weight: 600; font-size: .78rem; border-top: 0; }
.pr-calc td.r, .pr-calc th.r { text-align: right; white-space: nowrap; }
.pr-calc tr.tot td { font-weight: 700; border-top: 2px solid var(--hair); }
.pr-calc h3 { font-size: .95rem; margin: 16px 0 6px; display: flex; justify-content: space-between; }
.pr-calc h3:first-child { margin-top: 0; }
.pr-net { display: flex; justify-content: space-between; align-items: center; background: var(--accent-soft); color: var(--accent); border-radius: 14px; padding: 14px 16px; margin-top: 14px; }
.pr-net b { font-size: 1.5rem; }
.pr-tag { font-size: .68rem; color: var(--muted); border: 1px solid var(--hair); border-radius: 6px; padding: 0 5px; margin-left: 4px; }
.pr-rows .pr-row { display: grid; grid-template-columns: minmax(0, 1.3fr) 110px minmax(0, 1fr) 32px; gap: 6px; margin-bottom: 6px; }
.pr-rows.wide .pr-row { grid-template-columns: minmax(0, 1.3fr) 100px 110px 110px minmax(0, 1fr) 32px; }
.pr-rows .input { height: 36px; border-radius: 9px; }
.pr-set .switch { margin: 6px 0; }
.pr-set .grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.pr-set .card h3 { font-size: .98rem; margin: 0 0 10px; }
.pr-set .card { border-radius: 16px; padding: 16px 18px; }
@media (max-width: 1100px) { .pr-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } .pr-line { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) {
  .pr-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pr-recalc { margin-left: 0; flex-wrap: wrap; }
  .pr-set .grid2 { grid-template-columns: minmax(0, 1fr); }
  .pr-rows .pr-row, .pr-rows.wide .pr-row { grid-template-columns: minmax(0, 1fr) 90px 32px; }
  .pr-rows .pr-row .note, .pr-rows .pr-row .mon { display: none; }
  .pr-rows.wide .pr-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 32px; padding-bottom: 8px; border-bottom: 1px solid var(--hair); }
  .pr-rows.wide .pr-row > select { grid-column: 1 / 4; grid-row: 1; }
  .pr-rows.wide .pr-row > button.btn-icon { grid-column: 4; grid-row: 1; }
  .pr-rows.wide .pr-row > [name="item_amount[]"] { grid-column: 1; grid-row: 2; }
  .pr-rows.wide .pr-row .mon.dp-btn { display: flex !important; }
  .pr-rows.wide .pr-row [name="item_from[]"] + .dp-btn { grid-column: 2; grid-row: 2; }
  .pr-rows.wide .pr-row [name="item_to[]"] + .dp-btn { grid-column: 3 / 5; grid-row: 2; }
  .pr-rows.wide .pr-row .dp-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
}
.pr-set .switch { display: flex; align-items: flex-start; gap: 10px; }
.pr-line { grid-template-columns: minmax(0, 440px) minmax(0, 1fr); }
#funds .pr-row { grid-template-columns: 100px 1.4fr 140px 80px 80px 110px 110px 70px 78px 32px !important; min-width: 960px; }
.pr-fx { font-weight: 700; color: var(--muted); }
.pr-fxrow { display: flex; align-items: center; gap: 8px; }
.pr-rate-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pr-rate-form .input { height: 38px; border-radius: 10px; }
.pr-stats .stat .small { font-size: .74rem; }
.pr-rate-form .input { width: auto; }
.pr-rate-form input[type=month] { width: 170px; }

/* ===== phone polish ===== */
@media (max-width: 900px) {
  /* bottom bar: every tab the same size, the active one only changes colour */
  .bnav.tabbar a, .bnav.tabbar button:not(.fab) { flex: 1 1 0; min-width: 0; font-size: .66rem !important; font-weight: 500 !important; gap: 2px; padding: 8px 0 4px; }
  .bnav.tabbar a.on { font-weight: 600 !important; }
  .bnav.tabbar svg { width: 22px !important; height: 22px !important; stroke-width: 1.8; }
  .bnav.tabbar .fab { flex: 0 0 64px !important; margin-top: -24px; }
  .bnav.tabbar .fab span { width: 54px !important; height: 54px !important; }
  /* no sideways scrolling */
  html, body { overflow-x: hidden; }
  .content { padding-left: 12px !important; padding-right: 12px !important; max-width: 100vw; }
  .content > * { max-width: 100%; }
}
@media (max-width: 700px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr) !important; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .grid-3 { grid-template-columns: minmax(0, 1fr) !important; }
}
@media (max-width: 900px) { .bnav.tabbar .fab svg { width: 26px !important; height: 26px !important; stroke-width: 2.4; } }

/* ===== compact cards everywhere + gentle motion ===== */
html:not(.embedded) .content .card { padding: 14px 16px; border-radius: 14px; }
html:not(.embedded) .content .card + .card { margin-top: 12px; }
html:not(.embedded) .content .grid { gap: 12px; }
.content .card-head { margin-bottom: 8px; }
.content .card-head h2, .content .card > h2 { font-size: 1rem; }
.content .kv .k, .content .detail-grid .k { font-size: .76rem; }
.content .kv .v { font-size: .9rem; }
.content .grid-3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.content .grid-3 .card [style*="font-size:1.6rem"] { font-size: 1.25rem !important; }
.content .grid-3 .card .card-head > div > div:first-child { font-size: .95rem !important; }
.content .grid-3 .card .detail-grid { gap: 6px 12px !important; margin-top: 8px !important; }
.content .grid-3 .card .btn-icon.sm { width: 28px; height: 28px; }
/* cards appear one after another and lift a little on hover */
@keyframes card-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.content .grid > .card, .content .grid > a.card, .content .pr-stats > .stat, .content .mod-grid > .mod-tile {
  animation: card-in .38s var(--ease) both; }
.content .grid > :nth-child(2), .content .pr-stats > :nth-child(2), .content .mod-grid > :nth-child(2) { animation-delay: .03s; }
.content .grid > :nth-child(3), .content .pr-stats > :nth-child(3), .content .mod-grid > :nth-child(3) { animation-delay: .06s; }
.content .grid > :nth-child(4), .content .pr-stats > :nth-child(4), .content .mod-grid > :nth-child(4) { animation-delay: .09s; }
.content .grid > :nth-child(5), .content .pr-stats > :nth-child(5), .content .mod-grid > :nth-child(5) { animation-delay: .12s; }
.content .grid > :nth-child(6), .content .pr-stats > :nth-child(6), .content .mod-grid > :nth-child(6) { animation-delay: .15s; }
.content .grid > :nth-child(n+7), .content .mod-grid > :nth-child(n+7) { animation-delay: .18s; }
.content .grid > .card { transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
@media (hover: hover) { .content .grid > .card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0, 0, 0, .08); } }
.table tbody tr { animation: card-in .3s var(--ease) both; }
@media (prefers-reduced-motion: reduce) { .content *, .table tbody tr { animation: none !important; transition: none !important; } }
html:not(.embedded) .content .grid > .card + .card, .content .grid > .card + .card { margin-top: 0; }
/* space between stacked cards only in normal page flow – never inside grids / rows (keeps cards aligned) */
.card + .card, html:not(.embedded) .content .card + .card { margin-top: 0; }
.content > .card + .card, .emp-main > .card + .card, .content > form > .card + .card, .pr-calc + .card, .content > div:not([class]) > .card + .card,
html:not(.embedded) .content > .card + .card, html:not(.embedded) .emp-main > .card + .card { margin-top: 12px; }
.me-bal > * + * { margin-top: 0 !important; }
.es-photo .avatar.xl, .es-photo .avatar { width: 84px; height: 84px; font-size: 1.3rem; }
.es-photo { margin-top: 10px; }
.es-nav a { padding: 7px 12px; font-size: .9rem; }
.es-nav a svg { width: 17px; height: 17px; }
.emp-main .info-grid { gap: 12px 24px; }
.emp-main .section-title { margin: 16px 0 10px; }
.alert-card { padding: 14px 16px !important; }
.alert-card .btn, .alert-card a.btn { height: 38px; }
.clock-card .cc-time .t { font-size: 2.6rem; }

/* ===== Organisation chart ===== */
.oc-co { margin-bottom: 18px; }
.oc-co-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.oc-co-head > div { display: grid; }
.oc-co-head b { font-size: 1.05rem; }
.oc-co-logo { width: 40px; height: 40px; border-radius: 12px; background: var(--surface); display: grid; place-items: center; overflow: hidden; color: var(--accent); }
.oc-co-logo img { width: 100%; height: 100%; object-fit: contain; }
.oc-divs { display: grid; gap: 12px; border-left: 2px solid var(--hair); margin-left: 19px; padding-left: 18px; }
.oc-div { position: relative; }
.oc-div::before { content: ""; position: absolute; left: -18px; top: 15px; width: 14px; border-top: 2px solid var(--hair); }
.oc-div-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.oc-div-head b { font-size: .95rem; }
.oc-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.oc-deps { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.oc-dep { background: var(--surface); border-radius: 14px; padding: 12px 14px; color: var(--text); display: grid; gap: 8px; align-content: start;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease); animation: card-in .35s var(--ease) both; }
.oc-dep:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 0, 0, .07); }
.oc-dep-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.oc-n { min-width: 26px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: .76rem; font-weight: 700; display: grid; place-items: center; }
.oc-head { display: flex; align-items: center; gap: 8px; font-size: .84rem; }
.oc-head .avatar { width: 28px; height: 28px; font-size: .62rem; }
.oc-head > span { display: grid; line-height: 1.2; }
.oc-head small { color: var(--muted); font-size: .72rem; }
.oc-head.none { color: var(--muted); font-size: .78rem; }
.oc-secs { display: flex; flex-wrap: wrap; gap: 4px; }
.oc-secs span { font-size: .72rem; background: var(--surface-2); border-radius: 6px; padding: 2px 7px; }
.oc-tree { padding: 12px 14px; }
.oc-tree ul { list-style: none; margin: 0; padding-left: 22px; position: relative; }
.oc-tree > ul { padding-left: 0; }
.oc-tree li { position: relative; margin: 4px 0; }
.oc-tree ul ul li::before { content: ""; position: absolute; left: -14px; top: 22px; width: 12px; border-top: 1.5px solid var(--hair); }
.oc-tree ul ul::before { content: ""; position: absolute; left: 8px; top: 0; bottom: 18px; border-left: 1.5px solid var(--hair); }
.oc-tree summary { list-style: none; cursor: pointer; }
.oc-tree summary::-webkit-details-marker { display: none; }
.oc-person { display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: 12px; background: var(--surface-2); color: var(--text); min-width: 230px; }
.oc-person:hover { text-decoration: none; background: var(--accent-soft); }
.oc-person > span:not(.oc-n) { display: grid; line-height: 1.25; flex: 1; }
.oc-person small { color: var(--muted); font-size: .74rem; }
.oc-person .avatar { width: 32px; height: 32px; font-size: .66rem; }
details[open] > summary .oc-person { box-shadow: inset 3px 0 0 var(--accent); }
@media (max-width: 700px) { .oc-person { min-width: 0; } .oc-divs { margin-left: 8px; padding-left: 12px; } .oc-div::before { left: -12px; width: 9px; } }
.oc-person .avatar, .oc-head .avatar { flex: none; } .oc-person { max-width: 100%; }
.oc-person > .avatar, .oc-head > .avatar { flex: 0 0 auto !important; display: grid !important; width: 32px; height: 32px; border-radius: 50%; }
.oc-head > .avatar { width: 28px; height: 28px; }
.oc-person { min-width: 250px; }
.pr-info { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; font-size: .86rem; color: var(--muted); }
.pr-info b { color: var(--text); }
/* Home clock card: one compact row */
.clock-card { padding: 10px 14px !important; border-radius: 16px; margin-bottom: 10px; }
.clock-card .cc-body { gap: 8px; align-items: center; }
.cc-hi { font-size: .84rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-hi .cc-shift { margin-left: 6px; font-size: .7rem; padding: 2px 7px; }
.cc-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.clock-card .cc-time .t { font-size: 1.9rem; letter-spacing: -.02em; }
.clock-card .cc-time .t small { font-size: .75rem; }
.clock-card .cc-time .d { margin: 0; font-size: .8rem; }
.clock-card .cc-tile { width: auto; min-width: 104px; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; padding: 7px 12px; border-radius: 12px; box-shadow: 0 3px 10px rgba(0,0,0,.1); }
.clock-card .cc-tile .cc-ic { grid-row: span 2; display: flex; }
.clock-card .cc-tile .cc-ic svg { width: 18px; height: 18px; }
.clock-card .cc-tile small { font-size: .68rem; line-height: 1.1; }
.clock-card .cc-tile b { font-size: .98rem; line-height: 1.15; }
.clock-card .cc-note { margin-top: 6px; }
@media (max-width: 640px) {
  .clock-card .cc-body { flex-wrap: wrap; }
  .clock-card .cc-time { flex-basis: 100%; }
  .clock-card .cc-tile { flex: 1; }
  .clock-card .cc-time .t { font-size: 1.8rem; }
}
/* Needs-your-action: one slim row */
.alert-card { display: grid !important; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px; padding: 10px 14px !important; border-radius: 16px !important; margin-bottom: 10px !important; }
.alert-card .ah { display: contents; }
.alert-card .ah b { font-size: .9rem; grid-column: 1; grid-row: 1; }
.alert-card .ah svg { display: none; }
.alert-card p { margin: 0 !important; font-size: .82rem; grid-column: 2; grid-row: 1; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert-card .ab { grid-column: 3; grid-row: 1; margin: 0 !important; padding: 6px 14px !important; font-size: .8rem; width: auto !important; border-radius: 99px !important; }
@media (max-width: 640px) {
  .alert-card { grid-template-columns: 1fr auto; }
  .alert-card .ah b { grid-column: 1; grid-row: 1; }
  .alert-card p { grid-column: 1; grid-row: 2; }
  .alert-card .ab { grid-column: 2; grid-row: 1 / span 2; }
}
.clock-card .cc-tile.act { background: linear-gradient(160deg, #f59a2f, #e06c10); box-shadow: 0 3px 10px rgba(224,108,16,.28); position: relative; }
.clock-card .cc-tile.act b { font-size: .9rem; }
.clock-card .cc-tile.act::after { content: ""; position: absolute; top: 6px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse-dot 1.6s infinite; }
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
@media (max-width: 640px) { .clock-card .cc-tile.act { flex-basis: 100%; order: 3; } }
/* action tile = same size as Scan in / Scan out */
.clock-card .cc-tile { width: 112px; min-width: 0; }
.clock-card .cc-tile.act::after { display: none; }
.clock-card .cc-tile.act b { font-size: .98rem; }
@media (max-width: 640px) { .clock-card .cc-tile, .clock-card .cc-tile.act { flex: 1 1 0; flex-basis: 0; order: 0; width: auto; padding: 7px 9px; column-gap: 6px; } .clock-card .cc-tile b { font-size: .9rem; } }
/* rounder module icons, softer shadow */
.mod-ico { border-radius: 21px !important; box-shadow: 0 4px 10px color-mix(in srgb, var(--c) 22%, transparent) !important; }
.clock-card .cc-tile { border-radius: 16px; }
@media (max-width: 640px) { .mod-ico { border-radius: 20px !important; } }
.clock-card .cc-tile b, .clock-card .cc-tile small { white-space: nowrap; }
/* bottom bar: Home is the raised button in the middle */
@media (max-width: 900px) {
  .bnav.tabbar a.fab { flex: 0 0 64px !important; margin-top: -24px; padding: 0; display: grid; place-items: start center; }
  .bnav.tabbar a.fab span { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(160deg, var(--home-a), var(--home-b)); box-shadow: 0 6px 16px rgba(0,0,0,.2); }
  .bnav.tabbar a.fab svg { stroke: #fff; }
  .bnav.tabbar a.fab.on span { box-shadow: 0 0 0 3px var(--surface), 0 6px 16px rgba(0,0,0,.22); }
}
@media (max-width:900px){ .bnav.tabbar a.fab svg { width: 26px !important; height: 26px !important; stroke-width: 2.1; } }
@media (max-width:900px){ .bnav.tabbar .bn-gap { flex: 1 1 0; } }
/* smaller middle Home button */
@media (max-width: 900px) {
  .bnav.tabbar a.fab { flex: 0 0 56px !important; margin-top: -14px; }
  .bnav.tabbar a.fab span { width: 44px; height: 44px; box-shadow: 0 4px 10px rgba(0,0,0,.18); }
  .bnav.tabbar a.fab svg { width: 21px !important; height: 21px !important; stroke-width: 2; }
}
/* Home button: same level as the other tabs */
@media (max-width: 900px) {
  .bnav.tabbar a.fab { flex: 1 1 0 !important; margin-top: 0 !important; padding: 0 !important; place-items: center !important; align-self: center; }
  .bnav.tabbar a.fab span { width: 42px !important; height: 42px !important; border-radius: 14px !important; box-shadow: 0 3px 8px rgba(0,0,0,.16) !important; }
  .bnav.tabbar a.fab svg { width: 21px !important; height: 21px !important; }
}
@media (max-width:900px){ .bnav.tabbar a.fab span { border-radius: 50% !important; } }
.rv-item { padding: 9px 0; border-bottom: 1px solid var(--surface-2); font-size: .88rem; }
.rv-item:last-child { border-bottom: 0; }
.note-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border-radius: 12px; font-size: .86rem; background: var(--surface-2); }
.note-bar.warn { background: rgba(255, 159, 10, .13); color: #8a5300; }
:root[data-theme="dark"] .note-bar.warn { color: var(--warning); }
[hidden] { display: none !important; }
/* Roles & Privileges: matrix */
.rl-top { margin-bottom: 12px; align-items: start; }
.rl-top h3 { margin: 0 0 8px; }
.rl-mods { display: flex; flex-wrap: wrap; gap: 6px; }
.rl-mod { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; background: var(--surface-2); font-size: .84rem; font-weight: 600; cursor: pointer; }
.rl-mod input, .rl-cb input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; flex: none; }
.rl-br { max-height: 240px; overflow: auto; }
.rl-co { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 4px 2px; }
.rl-card { padding: 8px 10px 12px !important; }
.rl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rl-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .84rem; min-width: 900px; }
.rl-table th { text-align: left; font-size: .74rem; font-weight: 600; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--surface-2); position: sticky; top: 0; background: var(--surface); }
.rl-table td { padding: 7px 6px; border-bottom: 1px solid var(--surface-2); white-space: nowrap; vertical-align: middle; }
.rl-table .rl-name { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 210px; }
.rl-module td { background: var(--surface-2); }
.rl-module td.rl-name { background: var(--surface-2); }
.rl-module td:first-child { border-radius: 10px 0 0 10px; } .rl-module td:last-child { border-radius: 0 10px 10px 0; }
.rl-feat td.rl-name { padding-left: 34px; }
.rl-cb { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--text-2); }
.rl-cb input:checked + span { color: var(--text); font-weight: 600; }
.rl-feat td:not(.rl-name) .rl-cb + .rl-cb { margin-left: 8px; }
.rl-x { color: var(--muted); opacity: .45; padding-left: 3px; }
.rl-tog { border: 0; background: none; padding: 2px; margin-right: 6px; cursor: pointer; color: var(--muted); display: inline-grid; vertical-align: middle; transition: transform .2s; }
tbody.shut .rl-tog { transform: rotate(-90deg); }
tbody.shut .rl-feat { display: none; }
.rl-save { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); background: var(--glass); backdrop-filter: blur(20px); padding: 8px 10px; border-radius: 999px; box-shadow: var(--shadow-sm); margin-top: 12px; }
@media (max-width: 900px) { .rl-save { bottom: calc(74px + env(safe-area-inset-bottom)); } .rl-table .rl-name { min-width: 160px; } }
/* Administration › Modules */
.md-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.md-card { display: flex; align-items: flex-start; gap: 12px; padding: 14px !important; cursor: pointer; opacity: .7; transition: opacity .2s, box-shadow .2s; }
.md-card.on { opacity: 1; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent), var(--shadow-sm); }
.md-ico { width: 44px; height: 44px; border-radius: 14px; flex: none; display: grid; place-items: center; color: #fff; background: var(--c); }
.md-ico svg { width: 22px; height: 22px; }
.md-body { flex: 1; min-width: 0; display: grid; gap: 3px; }
.md-req { font-size: .74rem; font-weight: 600; color: var(--muted); }
.md-sw { position: relative; flex: none; width: 46px; height: 28px; }
.md-sw input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.md-sw i { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-2); transition: background .2s; }
.md-sw i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.md-sw input:checked + i { background: #34c759; }
.md-sw input:checked + i::after { transform: translateX(18px); }
.md-sw input:disabled + i { opacity: .6; }
.sh-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.sh-tags:empty { display: none; }
.sh-sw { display: grid; gap: 6px; }
.roster.rot { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
.ot { color: #1f9d45; font-weight: 600; }
/* ---------- notification panel (right side) ---------- */
.nt-drawer { position: fixed; inset: 0; z-index: 120; pointer-events: none; }
.nt-drawer .nt-back { position: absolute; inset: 0; background: rgba(0,0,0,.28); opacity: 0; transition: opacity .25s; }
.nt-drawer .nt-box { position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); background: var(--bg, var(--surface-2)); box-shadow: -10px 0 40px rgba(0,0,0,.18);
  transform: translateX(105%); transition: transform .3s cubic-bezier(.2,.8,.2,1); overflow-y: auto; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.nt-drawer.open { pointer-events: auto; }
.nt-drawer.open .nt-back { opacity: 1; }
.nt-drawer.open .nt-box { transform: none; }
body.nt-lock { overflow: hidden; }
.nt-load { padding: 40px; text-align: center; color: var(--muted); }
.nt-head { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.nt-head > b { font-size: 1.15rem; }
.nt-x, .nt-menu > summary { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; border: 0; background: var(--surface); color: var(--text-2); }
.nt-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.nt-tabs button { border: 0; background: none; padding: 7px 14px; border-radius: 99px; font: inherit; font-size: .88rem; font-weight: 600; color: var(--text-2); cursor: pointer; }
.nt-tabs button.on { background: var(--accent); color: #fff; }
.nt-tabs button i { font-style: normal; font-size: .7rem; background: #ff3b30; color: #fff; border-radius: 99px; padding: 1px 6px; margin-left: 3px; }
.nt-search { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 14px; padding: 0 12px; height: 42px; margin-bottom: 12px; color: var(--muted); }
.nt-search input { flex: 1; border: 0; background: none; outline: none; font: inherit; color: var(--text); }
.nt-list { display: grid; gap: 8px; }
.nt-card { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border-radius: 16px; padding: 12px 12px 12px 14px; color: inherit; text-decoration: none; position: relative; animation: card-in .3s both; }
.nt-card:hover { text-decoration: none; box-shadow: var(--shadow-sm); }
.nt-card a { color: inherit; text-decoration: none; }
.nt-ic { width: 34px; height: 34px; border-radius: 11px; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.nt-card.tone-ok .nt-ic { background: rgba(52,199,89,.15); color: #1f9d45; }
.nt-card.tone-bad .nt-ic { background: rgba(255,59,48,.12); color: var(--danger); }
.nt-card.tone-warn .nt-ic { background: rgba(255,159,10,.16); color: #c27400; }
.nt-tx { flex: 1; min-width: 0; display: grid; gap: 3px; font-size: .86rem; }
.nt-tx b { font-size: .92rem; }
.nt-tx span { color: var(--text-2); line-height: 1.4; }
.nt-tx small { color: var(--muted); font-size: .76rem; }
.nt-card.todo .nt-tx small { color: #c27400; font-weight: 600; }
.nt-card:not(.unread):not(.todo) .nt-tx b { font-weight: 600; color: var(--text-2); }
.nt-side { display: grid; justify-items: center; gap: 14px; align-self: stretch; align-content: space-between; }
.nt-dot { width: 9px; height: 9px; border-radius: 50%; background: #ff3b30; flex: none; margin-top: 4px; }
.nt-del { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 8px; opacity: .6; }
.nt-del:hover { color: var(--danger); opacity: 1; }
.nt-empty { display: grid; justify-items: center; gap: 6px; padding: 40px 10px; color: var(--muted); text-align: center; }
.nt-empty svg { width: 34px; height: 34px; }
.nt-empty b { color: var(--text); }
.nt-page { max-width: 640px; }
.nt-page .nt-head > b { display: none; }
.nt-page .nt-card { background: var(--surface-2); }
@media (max-width: 640px) { .nt-drawer .nt-box { width: 100vw; } }
.es-ids b { color: var(--text); font-weight: 600; }
/* signature box */
.sig { display: grid; gap: 8px; }
.sig-view { min-height: 110px; border-radius: 14px; border: 1.5px dashed var(--border, #d1d1d6); background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px;
  display: grid; place-items: center; padding: 10px; overflow: hidden; }
.sig-view img { max-width: 100%; max-height: 160px; object-fit: contain; }
.sig-view canvas { touch-action: none; background: #fff; border-radius: 10px; cursor: crosshair; }
.sig-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.mv-sal:not([hidden]) { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; } @media (max-width:640px){ .mv-sal:not([hidden]) { grid-template-columns: 1fr; } }

/* ======================================================================
   v3.12 – clean popups: a sheet from the right on computers, full screen on phones;
   "New / Add" buttons show the + in a circle
   ====================================================================== */
.modal-back:not(:has(.modal-alert)) { padding: 0 !important; align-items: stretch !important; justify-content: flex-end !important; background: rgba(0,0,0,.28); }
.modal-back .modal:not(.modal-alert) {
  width: min(620px, 100vw) !important; height: 100vh; height: 100dvh; max-height: none !important;
  border-radius: 22px 0 0 22px !important; box-shadow: -12px 0 40px rgba(0,0,0,.16) !important; animation: sheet-in .32s cubic-bezier(.2,.8,.2,1) both !important;
}
@keyframes sheet-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-back .modal:not(.modal-alert) .modal-head { height: auto !important; padding: 16px 18px 12px !important; border-bottom: 1px solid var(--surface-2); }
.modal-back .modal:not(.modal-alert) .modal-head h3 { font-size: 1.08rem; margin: 0; }
.modal-back .modal:not(.modal-alert) .modal-body { max-width: none !important; padding: 14px 18px 0 !important; overflow-y: auto; }
.modal-back .modal:not(.modal-alert) .modal-body .form-grid { gap: 10px 12px; }
.modal-back .modal:not(.modal-alert) .form-actions { position: sticky; bottom: 0; margin: 14px -18px 0; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--surface-2); z-index: 2; }
.modal-back .modal .form-section, .modal-back .modal .section-title { margin-top: 14px; }
.icon-close { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--surface-2); display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.drawer:not(.fs) { left: auto !important; width: min(620px, 100vw) !important; border-radius: 22px 0 0 22px !important; transform: translateX(105%); box-shadow: -12px 0 40px rgba(0,0,0,.16); }
.drawer:not(.fs).open { transform: none; }
.drawer:not(.fs) .drawer-body, .drawer:not(.fs) .drawer-foot { max-width: none !important; }
@media (max-width: 700px) {
  .modal-back .modal:not(.modal-alert), .drawer:not(.fs) { width: 100vw !important; border-radius: 0 !important; }
  .modal-back .modal:not(.modal-alert) .modal-head { padding-top: calc(14px + env(safe-area-inset-top)) !important; }
}
/* + in a circle on New / Add buttons */
.btn svg.i-plus { width: 18px; height: 18px; padding: 3px; border-radius: 50%; background: rgba(255,255,255,.25); stroke-width: 2.6; box-sizing: border-box; }
.btn:not(.btn-primary):not(.btn-success) svg.i-plus { background: var(--accent-soft); color: var(--accent); }
.btn-primary:has(svg.i-plus), .btn-success:has(svg.i-plus) { padding-left: 10px; }
/* live search: small spinner while results load */
.search.is-loading::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; animation: spin .7s linear infinite; margin-right: 10px; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.input[type=color] { width: 64px !important; height: 40px; padding: 4px !important; cursor: pointer; }
.input[type=color]::-webkit-color-swatch-wrapper { padding: 0; } .input[type=color]::-webkit-color-swatch { border: 0; border-radius: 8px; }
/* employee / my profile: compact header – small photo beside the name (less than half the old height) */
.emp-detail:not(.side-min) .emp-side { display: grid; grid-template-columns: 58px minmax(0, 1fr); column-gap: 12px; align-content: start; padding-top: 12px; }
.emp-detail:not(.side-min) .emp-side > :not(.es-photo):not(.es-name):not(.side-min-btn) { grid-column: 1 / -1; }
.emp-detail:not(.side-min) .es-photo { grid-column: 1; margin: 2px 0 0 !important; justify-content: flex-start; }
.emp-detail:not(.side-min) .es-photo .avatar, .emp-detail:not(.side-min) .es-photo .avatar.xl { width: 56px !important; height: 56px !important; font-size: .95rem !important; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent) !important; }
.emp-detail:not(.side-min) .es-photo .cam { width: 22px; height: 22px; right: -4px; bottom: -2px; box-shadow: 0 0 0 2px var(--surface); }
.emp-detail:not(.side-min) .es-photo .cam svg { width: 12px; height: 12px; }
.emp-detail:not(.side-min) .es-name { grid-column: 2; text-align: left; margin: 0 34px 8px 0; gap: 1px; }
.emp-detail:not(.side-min) .es-name .kh { font-size: .82rem; color: var(--text-2); line-height: 1.3; }
.emp-detail:not(.side-min) .es-name > b { font-size: .95rem; line-height: 1.25; }
.emp-detail:not(.side-min) .es-name .es-ids { font-size: .76rem; }
.emp-detail:not(.side-min) .es-badges { justify-content: flex-start; margin-top: 4px; gap: 4px; }
.emp-detail:not(.side-min) .es-badges .badge { font-size: .7rem; padding: 1px 7px; }
.emp-detail:not(.side-min) .es-acts { justify-content: flex-start; margin-top: 6px; gap: 4px; }
.emp-detail:not(.side-min) .es-acts .pen { width: 28px !important; height: 28px !important; }
.emp-detail:not(.side-min) .es-acts .pen svg { width: 14px; height: 14px; }
.emp-detail:not(.side-min) .side-min-btn { top: 10px; right: 10px; width: 28px; height: 28px; }
.emp-detail:not(.side-min) .es-nav { margin-top: 2px; }
.emp-detail:not(.side-min) .es-name { display: flex; flex-wrap: wrap; align-items: center; column-gap: 6px; }
.emp-detail:not(.side-min) .es-name > .kh, .emp-detail:not(.side-min) .es-name > b, .emp-detail:not(.side-min) .es-name > .es-ids { flex-basis: 100%; }
.emp-detail:not(.side-min) .es-ids b { font-size: inherit !important; font-weight: 600; }
.emp-detail:not(.side-min) .es-badges, .emp-detail:not(.side-min) .es-acts { margin-top: 5px; }
/* smaller signature box */
.sig { max-width: 380px; gap: 6px; }
.sig-view { min-height: 64px; padding: 6px; border-radius: 12px; }
.sig-view img { max-height: 70px; }
.sig-view canvas { height: 120px !important; }
.sig .muted.small { font-size: .72rem; }
.sig-tools .btn { height: 30px; padding: 0 10px; font-size: .8rem; }
/* ---------- Apple-style date picker ---------- */
.dp-src { position: absolute !important; opacity: 0 !important; pointer-events: none !important; width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important; }
.dp-btn { display: flex !important; align-items: center; justify-content: space-between; gap: 8px; text-align: left; cursor: pointer; font: inherit; color: var(--text); width: 100%; }
.dp-btn.empty span { color: var(--muted); }
.dp-btn svg { color: var(--accent); flex: none; }
.dp-btn:disabled { opacity: .6; cursor: default; }
.dp-pop { position: fixed; z-index: 200; width: 300px; background: var(--surface); border-radius: 18px; box-shadow: 0 18px 50px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.04); padding: 12px 12px 8px;
  opacity: 0; transform: translateY(-4px) scale(.98); pointer-events: none; transition: opacity .15s, transform .15s; }
.dp-pop.open { opacity: 1; transform: none; pointer-events: auto; }
.dp-grab { display: none; }
.dp-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 8px; }
.dp-title { border: 0; background: none; font: inherit; font-weight: 700; font-size: 1rem; color: var(--text); display: inline-flex; align-items: center; gap: 2px; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.dp-title svg { color: var(--accent); width: 14px; height: 14px; }
.dp-title:hover { background: var(--surface-2); }
.dp-nav { display: flex; gap: 2px; }
.dp-nav button { border: 0; background: none; color: var(--accent); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.dp-nav button:hover { background: var(--accent-soft); }
.dp-wd, .dp-days { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.dp-wd span { font-size: .68rem; font-weight: 600; color: var(--muted); padding: 2px 0 6px; text-transform: uppercase; }
.dp-d { border: 0; background: none; font: inherit; font-size: .92rem; width: 36px; height: 36px; margin: 1px auto; border-radius: 50%; cursor: pointer; color: var(--text); font-variant-numeric: tabular-nums; }
.dp-d.we { color: var(--text-2); }
.dp-d:hover { background: var(--surface-2); }
.dp-d.today { color: #ff3b30; font-weight: 700; }
.dp-d.sel { background: var(--accent); color: #fff; font-weight: 700; }
.dp-d.sel.today { background: #ff3b30; }
.dp-d:disabled { color: var(--muted); opacity: .35; cursor: default; background: none; }
.dp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px 0 8px; }
.dp-m { border: 0; background: var(--surface-2); font: inherit; font-size: .9rem; padding: 12px 0; border-radius: 12px; cursor: pointer; color: var(--text); }
.dp-m:hover { background: var(--accent-soft); }
.dp-m.today { color: #ff3b30; font-weight: 700; }
.dp-m.sel { background: var(--accent); color: #fff; font-weight: 700; }
.dp-foot { display: flex; justify-content: space-between; border-top: 1px solid var(--surface-2); margin-top: 6px; padding-top: 6px; }
.dp-foot button { border: 0; background: none; font: inherit; font-size: .88rem; color: var(--accent); padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.dp-foot .dp-strong { font-weight: 700; }
/* phone: bottom sheet */
.dp-pop.sheet { left: 0 !important; right: 0; bottom: 0; top: auto !important; width: auto; border-radius: 22px 22px 0 0; padding: 8px 16px calc(14px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .28s cubic-bezier(.2,.8,.2,1), opacity .2s; box-shadow: 0 -10px 40px rgba(0,0,0,.2); }
.dp-pop.sheet.open { transform: none; }
.dp-pop.sheet .dp-grab { display: block; width: 38px; height: 5px; border-radius: 99px; background: var(--surface-2); margin: 2px auto 10px; }
.dp-pop.sheet .dp-d { width: 42px; height: 42px; font-size: 1rem; }
/* ---------- birthdays ---------- */
.bd-hero { position: relative; overflow: hidden; border-radius: 18px; padding: 14px 16px; margin-bottom: 10px; color: #fff;
  background: linear-gradient(120deg, var(--home-a, #2a6aa6), #9b5de5 60%, #ff6fb5); display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.bd-hero-tx { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 220px; position: relative; z-index: 1; }
.bd-hero-tx b { display: block; font-size: 1.1rem; }
.bd-hero-tx span { font-size: .84rem; opacity: .92; }
.bd-hero-ic { font-size: 2rem; line-height: 1; }
.bd-hero-btn { background: #fff !important; color: #5b2a86 !important; position: relative; z-index: 1; }
.bd-wishes { flex-basis: 100%; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; position: relative; z-index: 1; }
.bd-wish { flex: none; max-width: 260px; background: rgba(255,255,255,.18); border-radius: 12px; padding: 6px 10px; font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-cf { position: absolute; top: -12px; width: 7px; height: 12px; border-radius: 2px; opacity: .9; animation: bd-fall linear infinite; }
@keyframes bd-fall { to { transform: translateY(160px) rotate(540deg); opacity: 0; } }
.bd-today { padding: 10px 14px !important; margin-bottom: 10px; }
.bd-today-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bd-today-h svg { color: #ff5f6d; }
.bd-today-h a { margin-left: auto; }
.bd-today-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px 14px; }
.bd-person { display: flex; align-items: center; gap: 10px; }
.bd-p-tx { flex: 1; min-width: 0; display: grid; }
.bd-p-tx b { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* month list */
.bd-months a { display: inline-flex; align-items: center; }
.bd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.bd-card { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 16px; padding: 10px 12px; animation: card-in .3s both; }
.bd-card.past { opacity: .6; }
.bd-card.today { box-shadow: 0 0 0 2px #ff6fb5; background: linear-gradient(120deg, rgba(255,111,181,.08), rgba(155,93,229,.08)); }
.bd-date { width: 46px; flex: none; text-align: center; border-radius: 12px; background: var(--surface-2); padding: 4px 0; display: grid; line-height: 1.1; }
.bd-date b { font-size: 1.2rem; } .bd-date span { font-size: .68rem; color: #ff3b30; font-weight: 700; text-transform: uppercase; }
.bd-card.today .bd-date { background: #ff3b30; } .bd-card.today .bd-date b, .bd-card.today .bd-date span { color: #fff; }
.bd-who { flex: 1; min-width: 0; display: grid; }
.bd-who b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-now { font-size: .76rem; font-weight: 700; color: #d63384; }
/* card designer */
.bdc-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; align-items: start; }
.bdc-stage { padding: 12px !important; display: grid; place-items: center; background: var(--surface-2) !important; }
.bdc-stage canvas { width: 100%; max-width: 460px; height: auto; border-radius: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.15); }
.bdc-themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.bdc-themes button { border: 0; background: var(--surface-2); border-radius: 12px; padding: 8px 4px; font: inherit; font-size: .78rem; display: grid; justify-items: center; gap: 4px; cursor: pointer; color: var(--text); }
.bdc-themes button i { width: 34px; height: 34px; border-radius: 10px; }
.bdc-themes button.on { box-shadow: 0 0 0 2px var(--accent); font-weight: 700; }
@media (max-width: 900px) { .bdc-wrap { grid-template-columns: 1fr; } }
.dp-btn { height: 40px !important; min-height: 0 !important; align-self: start; line-height: 1.2; padding-top: 0 !important; padding-bottom: 0 !important; }
html.embedded .dp-btn { height: 38px !important; }
.field > .dp-src + .dp-btn { margin-top: 0; }
.dp-btn { padding-left: 14px !important; padding-right: 12px !important; }
/* date buttons: same size as the other fields; smaller in toolbars */
.dp-btn { font-size: .92rem; }
.dp-btn svg { width: 15px; height: 15px; }
.dp-btn.sm, .toolbar .dp-btn, .listbar .dp-btn, .bar-actions .dp-btn, form.group .dp-btn { height: 36px !important; width: auto; min-width: 150px; border-radius: 999px; font-size: .86rem; padding-left: 12px !important; }
.dp-m:disabled { opacity: .3; cursor: default; background: var(--surface-2); }
.pr-fxrow { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; } .pr-fxrow .pr-fx { white-space: nowrap; flex: none; } .pr-fxrow .input { flex: 1; min-width: 0; }

/* Payroll › Exchange Rate › automatic check */
.pr-auto { display: flex; align-items: center; gap: 14px; justify-content: space-between; padding: 12px 14px; margin-bottom: 12px; flex-wrap: wrap; }
.pr-auto-l { display: flex; gap: 10px; align-items: flex-start; flex: 1 1 360px; min-width: 0; }
.pr-auto-l > .i { width: 20px; height: 20px; color: var(--accent); margin-top: 2px; flex: none; }
.pr-auto-r { display: flex; gap: 10px; align-items: center; }
.pr-auto-r form { margin: 0; }

/* Sidebar branch picker with search */
.scope-pop { position: fixed; z-index: 400; max-height: min(460px, 70vh); display: flex; flex-direction: column; background: var(--surface); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.18), 0 0 0 1px var(--border); padding: 8px; }
.scope-q input { width: 100%; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); padding: 0 10px; font: inherit; color: var(--text); }
.scope-list { overflow: auto; margin-top: 6px; }
.scope-co { font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 8px 8px 3px; }
.scope-it { display: block; width: 100%; text-align: left; border: 0; background: none; font: inherit; color: var(--text); padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.scope-it.sub { padding-left: 16px; }
.scope-it:hover, .scope-it:focus { background: var(--surface-2); outline: 0; }
.scope-it.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.scope-none { padding: 10px; }
.chip-btn { cursor: pointer; font: inherit; border: inherit; }
.chip-btn > .i:last-child { width: 14px; height: 14px; opacity: .6; margin-left: 2px; }

/* smaller language switch button */
.lang-btn .flag, .lang-btn svg.flag, .lang-btn img.flag, .lang-btn .flag-code { width: 17px !important; height: 17px !important; box-shadow: 0 0 0 1px rgba(255,255,255,.9), 0 1px 2px rgba(0,0,0,.2); }
.lang-btn .flag-code { font-size: .45rem; }
.topbar .lang-btn, .lang-btn.rbtn { width: 30px !important; height: 30px !important; min-width: 30px; }

/* Students module */
.badge.st-active { background: rgba(52, 199, 89, .15); color: #1f9d45; }
.badge.st-paused { background: rgba(255, 159, 10, .16); color: #c27400; }
.badge.st-graduated { background: var(--accent-soft); color: var(--accent); }
.badge.st-dropped, .badge.st-left { background: rgba(255, 59, 48, .13); color: var(--danger); }
.badge.res-passed { background: rgba(52, 199, 89, .15); color: #1f9d45; }
.badge.res-repeat { background: rgba(255, 159, 10, .16); color: #c27400; }
.badge.res-graduated { background: var(--accent-soft); color: var(--accent); }
.badge.res-dropped { background: rgba(255, 59, 48, .13); color: var(--danger); }
.avatar.st-av-f { background: linear-gradient(135deg, #ff9ac6, #ff6fa8); color: #fff; }
.avatar.st-av-m { background: linear-gradient(135deg, #7cc4ff, #3a8dff); color: #fff; }
.avatar.st-sp { background: linear-gradient(135deg, #ff8a8a, #ff5a7a); color: #fff; }
.st-add-top { display: flex; gap: 18px; align-items: center; margin-bottom: 14px; }
.st-matrix th, .st-matrix td { white-space: nowrap; }
.st-matrix tfoot td { border-top: 2px solid var(--border); }
@media (max-width: 640px) { .st-add-top { flex-direction: column; align-items: stretch; } .st-add-top .photo-pick { align-self: center; } }
.st-matrix th.right, .st-matrix td.right { text-align: right; }
.st-matrix th:first-child, .st-matrix td:first-child { text-align: left; }
.cc-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; padding-top: 4px; }
.cc-row label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; margin: 0; }
.cc-row input[type=color] { width: 34px; height: 30px; border: 1px solid var(--border); border-radius: 8px; padding: 2px; background: var(--surface); cursor: pointer; }

/* ================= Library ================= */
.lb-head { flex-wrap: wrap; gap: 10px; }
.lb-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-wrap: wrap; }
details.lb-tools { position: relative; }
details.lb-tools > summary { list-style: none; } details.lb-tools > summary::-webkit-details-marker { display: none; }
.lb-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 230px; max-width: calc(100vw - 28px); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; }
.lb-menu a, .lb-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; background: none; border-radius: 9px; font: inherit; font-size: .9rem; color: var(--text); cursor: pointer; text-decoration: none; text-align: left; }
.lb-menu a:hover, .lb-menu button:hover { background: var(--surface-2); }
.lb-menu form { margin: 0; }
.lb-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.lb-stats > * { background: var(--surface); border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow-sm); color: var(--text); text-decoration: none; display: flex; align-items: baseline; gap: 8px; }
.lb-stats b { font-size: 1.35rem; font-variant-numeric: tabular-nums; } .lb-stats span { color: var(--muted); font-size: .84rem; }
.lb-stats .bad b { color: var(--danger); }
.lb-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.lb-bar .search { flex: 1 1 260px; min-width: 200px; }
.lb-bar > select.input, .lb-bar .ss-wrap { width: auto; max-width: 170px; }
.lb-cats { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.lb-cats::-webkit-scrollbar { display: none; }
.lb-cats a { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 99px; background: var(--surface); color: var(--text); font-size: .84rem; text-decoration: none; box-shadow: var(--shadow-sm); white-space: nowrap; }
.lb-cats a i { width: 8px; height: 8px; border-radius: 50%; } .lb-cats a span { color: var(--muted); font-size: .76rem; }
.lb-cats a.on { background: var(--accent); color: #fff; } .lb-cats a.on span { color: rgba(255,255,255,.8); }

/* the shelf: cover + title + author, nothing else */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 22px 18px; }
.bk { cursor: pointer; outline: none; min-width: 0; }
.bk.off { opacity: .55; }
.bk-cover { position: relative; aspect-ratio: 2 / 3; background: var(--surface-2); overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 6px 16px -6px rgba(0,0,0,.25); transition: transform .18s var(--ease), box-shadow .18s; }
.bk:hover .bk-cover, .bk:focus-visible .bk-cover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(0,0,0,.08), 0 14px 26px -8px rgba(0,0,0,.35); }
.bk:focus-visible .bk-cover { outline: 2px solid var(--accent); outline-offset: 2px; }
.bk-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bk-gen { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 12px 10px 10px 14px; color: #fff;
  background: linear-gradient(160deg, var(--c), color-mix(in srgb, var(--c) 55%, #000)); }
.bk-gen::before { content: ""; position: absolute; left: 5px; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,.25); }
.bk-gen b { font-size: .88rem; line-height: 1.25; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.bk-gen i { font-style: normal; font-size: .72rem; opacity: .85; }
.bk-tag { position: absolute; right: 0; bottom: 0; font-size: .7rem; font-weight: 700; padding: 3px 7px; color: #fff; }
.bk-tag.in { background: #1f9d45; } .bk-tag.out { background: var(--danger); }
.bk-broken { position: absolute; left: 0; top: 0; font-size: .68rem; font-weight: 700; padding: 2px 6px; background: var(--danger); color: #fff; }
.bk-t { margin-top: 8px; font-weight: 600; font-size: .88rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bk-a { color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-flag { display: inline-block; margin-top: 3px; margin-right: 4px; font-size: .68rem; padding: 1px 6px; border-radius: 6px; background: rgba(255,159,10,.16); color: #c27400; }
.lb-more { text-align: center; margin: 22px 0 6px; }

/* detail popup */
.lb-detail { width: min(720px, 100%); }
.lbd, .lbs { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 20px; align-items: start; }
.lbs { padding: 16px; }
.lbd-cover { position: relative; aspect-ratio: 2 / 3; background: var(--surface-2); overflow: hidden; box-shadow: 0 6px 18px -6px rgba(0,0,0,.3); }
.lbd-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lbd-avail { margin: 10px 0 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lbd-dl { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: .9rem; }
.lbd-dl dt { color: var(--muted); } .lbd-dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.lbd-desc { margin: 12px 0 0; color: var(--text-2); font-size: .9rem; white-space: pre-line; }
.lbd-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--hair); }
.lbd-acts form { margin: 0; display: flex; gap: 6px; align-items: center; }
.lbd-acts .spacer { flex: 1; }
.btn-danger-soft { color: var(--danger) !important; background: rgba(255,59,48,.1) !important; }
.lbf { display: flex; gap: 16px; align-items: flex-start; }
.lbf-cover { flex: none; cursor: pointer; }
.lbf-prev { width: 96px; aspect-ratio: 2 / 3; display: grid; place-items: center; align-content: center; gap: 4px; background: var(--surface-2); border: 1.5px dashed var(--border); color: var(--muted); overflow: hidden; }
.lbf-prev img { width: 100%; height: 100%; object-fit: cover; }
.lb-late { color: var(--danger); font-weight: 600; }

/* desk */
.desk { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.desk-main { display: grid; gap: 14px; min-width: 0; }
.desk-side { display: grid; gap: 14px; position: sticky; top: 76px; }
.ci { padding: 16px 18px; cursor: text; }
.ci-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ci-ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #34c759, #1f9d45); position: relative; flex: none; }
.ci-ico::after { content: ""; position: absolute; inset: -4px; border-radius: 16px; border: 2px solid #34c759; opacity: 0; animation: ciPulse 2.2s infinite; }
@keyframes ciPulse { 0% { opacity: .6; transform: scale(.9); } 70%, 100% { opacity: 0; transform: scale(1.15); } }
.ci-top > div { flex: 1; } .ci-top b { font-size: 1.1rem; }
.ci-state { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: #1f9d45; }
.ci-state i { width: 8px; height: 8px; border-radius: 50%; background: #34c759; }
.ci-state.lost { color: #c27400; } .ci-state.lost i { background: #ff9f0a; }
.ci-count { text-align: center; text-decoration: none; color: var(--text); background: var(--surface-2); border-radius: 12px; padding: 6px 12px; line-height: 1.1; }
.ci-count b { display: block; font-size: 1.35rem; } .ci-count span { font-size: .72rem; color: var(--muted); }
.ci-row { display: flex; gap: 8px; }
.ci-box { flex: 1; display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 12px; border-radius: 14px; background: var(--surface-2); border: 2px solid transparent; transition: border-color .15s; }
.ci-box:focus-within { border-color: #34c759; background: var(--surface); }
.ci-box input { flex: 1; border: 0; background: none; font: inherit; font-size: 1.05rem; color: var(--text); outline: none; min-width: 0; }
.ci-x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; display: grid; }
.ci-go { height: 50px; padding: 0 22px; font-size: 1rem; }
.ci-find { height: 50px; width: 50px; padding: 0; justify-content: center; }
.ci-res { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 10px 12px; border-radius: 14px; }
.ci-res.ok { background: rgba(52,199,89,.12); } .ci-res.dup { background: rgba(255,159,10,.14); }
.ci-tag { font-size: .76rem; font-weight: 800; letter-spacing: .04em; padding: 4px 10px; border-radius: 99px; color: #fff; }
.ci-res.ok .ci-tag { background: #1f9d45; } .ci-res.dup .ci-tag { background: #ff9f0a; }
.grow { flex: 1; min-width: 0; }
.desk-nf { padding: 16px 18px; border-left: 4px solid #ff9f0a; }
.desk-mem { padding: 16px 18px; }
.dm-head { display: flex; gap: 14px; align-items: flex-start; }
.dm-head.card { padding: 16px 18px; }
.dm-name { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.dm-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.dm-borrow { display: flex; gap: 8px; align-items: flex-end; margin: 16px 0 10px; flex-wrap: wrap; }
.dm-find { flex: 1 1 280px; position: relative; }
.dm-find .search { width: 100%; }
.dm-due { display: grid; gap: 2px; }
.dm-due .input { width: 150px; }
.dm-sug { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; max-height: 340px; overflow: auto; }
.dm-sug button { display: flex; gap: 10px; align-items: center; width: 100%; border: 0; background: none; padding: 7px 8px; border-radius: 10px; cursor: pointer; text-align: left; font: inherit; color: var(--text); }
.dm-sug button:hover { background: var(--surface-2); } .dm-sug button.no { opacity: .55; }
.dm-sug small { display: block; color: var(--muted); font-size: .76rem; } .dm-sug em { font-style: normal; font-size: .76rem; font-weight: 700; color: #1f9d45; } .dm-sug .no em { color: var(--danger); }
.dm-cov { width: 30px; height: 42px; flex: none; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.dm-cov img { width: 100%; height: 100%; object-fit: cover; }
.dm-loans { display: grid; gap: 8px; }
.dm-loan { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.dm-loan.late { background: rgba(255,59,48,.08); }
.dm-loan a { color: var(--text); }
.dm-acts { display: flex; gap: 6px; align-items: center; } .dm-acts form { margin: 0; }
.dm-none { padding: 6px 2px; }
.dk-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dk-stats > * { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; text-decoration: none; color: var(--text); }
.dk-stats b { display: block; font-size: 1.4rem; font-variant-numeric: tabular-nums; } .dk-stats span { font-size: .78rem; color: var(--muted); }
.dk-stats .bad b { color: var(--danger); }
.dk-act { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--hair); }
.dk-act:first-of-type { border-top: 0; }
.dk-act a { color: var(--text); } .dk-act form { margin: 0; }
.dk-ico { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none; color: #fff; }
.dk-ico.out { background: var(--accent); } .dk-ico.ret { background: #34c759; }
.lb-rank { width: 22px; text-align: center; font-weight: 700; color: var(--muted); flex: none; }
.lb-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.badge.lb-t-student { background: var(--accent-soft); color: var(--accent); } .badge.lb-t-staff { background: rgba(175,82,222,.14); color: #8e3fc0; }
.avatar.lb-av-student { background: linear-gradient(135deg, #7cc4ff, #3a8dff); color: #fff; }
.avatar.lb-av-staff { background: linear-gradient(135deg, #c99bf0, #8e3fc0); color: #fff; }
.avatar.lb-av-other { background: linear-gradient(135deg, #b0b6c0, #6b7280); color: #fff; }
.lb-hours .col { min-width: 0; }

@media (max-width: 1024px) { .desk { grid-template-columns: 1fr; } .desk-side { position: static; } }
@media (max-width: 640px) {
  .lb-stats { grid-template-columns: 1fr 1fr; }
  .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 10px; }
  .bk-t { font-size: .8rem; } .bk-gen b { font-size: .74rem; }
  .lbd, .lbs { grid-template-columns: 1fr; } .lbd-cover { max-width: 170px; margin: 0 auto; }
  .lbd-acts { position: sticky; bottom: 0; background: var(--surface); }
  .lb-bar > select.input, .lb-bar .ss-wrap { flex: 1 1 40%; max-width: none; }
  .ci-row { flex-wrap: wrap; } .ci-go { flex: 1; } .ci-box input { font-size: 16px; }
  .dm-borrow > * { flex: 1 1 100%; } .dm-due .input { width: 100%; }
  .dm-loan { flex-wrap: wrap; } .dm-acts { width: 100%; justify-content: flex-end; }
  .lbf { flex-direction: column; align-items: center; } .lbf .form-grid { width: 100%; }
}
.lbd-broken { display: flex; gap: 6px; align-items: center; margin: 0; }
.lbd-broken .input { width: 70px; height: 32px; }
.lbd-acts { flex-wrap: nowrap; } .lbd-acts .btn { white-space: nowrap; }

/* student journey: Grade 10 → 11 → 12 → Finished */
.st-path { display: flex; gap: 0; overflow-x: auto; padding: 6px 2px 16px; margin-bottom: 6px; }
.st-step { position: relative; flex: 0 0 auto; min-width: 128px; display: grid; justify-items: center; text-align: center; gap: 2px; padding: 0 8px; }
.st-step::before { content: ""; position: absolute; top: 16px; left: -50%; width: 100%; height: 3px; background: var(--border); z-index: 0; }
.st-step:first-child::before { display: none; }
.st-step.res-passed::before, .st-step.res-graduated::before, .st-step.st-end::before { background: #34c759; }
.st-dot { position: relative; z-index: 1; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--accent); box-shadow: 0 0 0 4px var(--surface); }
.st-step.res-passed .st-dot { background: #34c759; } .st-step.res-repeat .st-dot { background: #ff9f0a; } .st-step.res-dropped .st-dot, .st-step.st-stop .st-dot { background: var(--danger); }
.st-step.res-graduated .st-dot, .st-step.st-end .st-dot { background: linear-gradient(135deg, #ffd60a, #ff9f0a); }
.st-step b { font-size: .9rem; margin-top: 4px; } .st-step small { color: var(--muted); font-size: .74rem; }
.st-res { font-size: .74rem; font-weight: 600; color: var(--text-2); max-width: 150px; }
.st-end b { color: #c27400; }
.badge.st-exam { background: linear-gradient(135deg, #ffd60a, #ff9f0a); color: #5c3b00; font-weight: 800; }
.st-opt { display: grid; gap: 8px; }

/* scan machines: face / fingerprint */
.dev-type { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: .74rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); }
.dev-type.t-face, .dev-type.t-both { background: rgba(175,82,222,.14); color: #8e3fc0; }
.dev-type.t-finger { background: var(--accent-soft); color: var(--accent); }
.vm { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.vm-face { color: #8e3fc0; } .vm-finger { color: var(--accent); } .vm-card { color: #c27400; }
.scan-ph { display: inline-block; vertical-align: middle; margin-left: 6px; }
.scan-ph img { width: 30px; height: 38px; object-fit: cover; border-radius: 6px; box-shadow: 0 0 0 1px var(--border); }
.dev-sw { display: grid; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--hair); }
.dev-sw .switch { align-items: flex-start; } .dev-sw .switch span { line-height: 1.4; }

/* ================= Assets ================= */
.as-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.as-stats > * { background: var(--surface); border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow-sm); color: var(--text); text-decoration: none; display: grid; gap: 2px; border: 2px solid transparent; }
.as-stats b { font-size: 1.35rem; font-variant-numeric: tabular-nums; } .as-stats span { color: var(--muted); font-size: .8rem; }
.as-stats .on { border-color: var(--accent); }
.as-stats .s-in_use b { color: #1f9d45; } .as-stats .s-repair b { color: #c27400; } .as-stats .s-broken b { color: var(--danger); } .as-stats .s-value b { font-size: 1.15rem; }
.badge.as-in_use { background: rgba(52,199,89,.15); color: #1f9d45; } .badge.as-in_store { background: var(--accent-soft); color: var(--accent); }
.badge.as-repair { background: rgba(255,159,10,.16); color: #c27400; } .badge.as-broken, .badge.as-lost { background: rgba(255,59,48,.13); color: var(--danger); }
.badge.as-disposed { background: var(--surface-2); color: var(--muted); }
.as-thumb { width: 40px; height: 40px; border-radius: 11px; flex: none; display: grid; place-items: center; overflow: hidden; color: #fff; background: linear-gradient(135deg, var(--c, #8e8e93), color-mix(in srgb, var(--c, #8e8e93) 60%, #000)); }
.as-thumb img { width: 100%; height: 100%; object-fit: cover; } .as-thumb.lg { width: 64px; height: 64px; border-radius: 16px; }
.as-cat { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; } .as-cat i { width: 8px; height: 8px; border-radius: 50%; }
.as-warn { color: #c27400; font-weight: 600; } .as-due { color: var(--danger); font-weight: 600; }
.as-head { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 20px; align-items: start; padding: 18px; }
.as-photo { width: 150px; height: 150px; border-radius: 20px; overflow: hidden; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #000)); }
.as-photo img { width: 100%; height: 100%; object-fit: cover; } .as-photo .i { width: 48px; height: 48px; }
.as-main h2 { margin: 2px 0 8px; font-size: 1.4rem; }
.as-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.as-where { display: grid; gap: 6px; margin: 12px 0; } .as-where > div { display: flex; gap: 8px; align-items: center; }
.as-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.as-qr { display: grid; justify-items: center; gap: 4px; font-size: .78rem; font-weight: 700; letter-spacing: .04em; }
.as-qr svg { width: 120px; height: 120px; border-radius: 10px; box-shadow: 0 0 0 1px var(--border); }
.as-val { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.as-val > div { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; } .as-val span { display: block; font-size: .78rem; color: var(--muted); } .as-val b { font-size: 1.2rem; }
.as-life { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 14px 0 6px; } .as-life i { display: block; height: 100%; background: linear-gradient(90deg, #34c759, #0a84ff); }
.as-tl { display: grid; gap: 0; }
.as-tl-i { display: flex; gap: 12px; padding: 0 0 14px 2px; position: relative; }
.as-tl-i > i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); margin-top: 5px; flex: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.as-tl-i:not(:last-child)::before { content: ""; position: absolute; left: 6px; top: 18px; bottom: 0; width: 2px; background: var(--hair); }
.as-tl-i.k-dispose > i, .as-tl-i.k-audit > i { background: var(--danger); } .as-tl-i.k-repair > i { background: #ff9f0a; } .as-tl-i.k-assign > i { background: #34c759; }
.as-pick { display: flex; gap: 8px; flex-wrap: wrap; } .as-pick label { cursor: pointer; } .as-pick input { display: none; }
.as-pick .badge { padding: 6px 12px; font-size: .86rem; border: 2px solid transparent; } .as-pick input:checked + .badge { border-color: currentColor; }
.as-ph .lbf-prev { aspect-ratio: 1; width: 110px; border-radius: 16px; }
.as-mine { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.as-mine-i { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; }
.as-prog { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; min-width: 120px; } .as-prog i { display: block; height: 100%; background: #34c759; } .as-prog.lg { height: 10px; margin-top: 8px; }
.ck-top { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 14px; }
.ck-scan { padding: 16px 18px; } .ck-big { font-size: 1.1rem; margin-top: 6px; } .ck-big b { font-size: 2.2rem; } .ck-big span { color: var(--muted); }
.ck-sum { display: grid; gap: 12px; align-content: start; padding: 16px 18px; } .ck-sum b { font-size: 1.3rem; margin-right: 4px; }
.ck-sum .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; } .dot.bad { background: var(--danger); } .dot.ok { background: #34c759; } .dot.warn { background: #ff9f0a; }
#ckVideo { width: 100%; max-height: 300px; border-radius: 14px; margin-top: 10px; background: #000; object-fit: cover; }
@media (max-width: 1024px) { .as-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } .ck-top { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .as-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .as-head { grid-template-columns: 1fr; justify-items: start; } .as-photo { width: 100%; height: 180px; } .as-qr { justify-self: center; }
  .as-val { grid-template-columns: 1fr 1fr; }
}

/* ================= Inventory ================= */
.iv-add { position: relative; display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.iv-add .search { flex: 1; min-width: 220px; }
.iv-add .dm-sug { position: absolute; top: 100%; left: 0; right: 0; z-index: 30; max-height: 320px; overflow: auto; }
.iv-tbl td { vertical-align: middle; }
.iv-tbl .iv-q, .iv-tbl .iv-c { width: 96px; text-align: right; display: inline-block; }
.iv-tbl tr.over td { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.iv-tbl tr.over .iv-q { border-color: var(--danger); }
.iv-diff.up { color: #1f9d45; font-weight: 700; } .iv-diff.down { color: var(--danger); font-weight: 700; }
.iv-lowc { color: #c27400; font-weight: 700; } .iv-q-out, td.iv-q-out { color: var(--danger); font-weight: 700; } .iv-q-low { color: #c27400; font-weight: 700; }
.iv-in { color: #1f9d45; font-weight: 600; } .iv-out { color: var(--danger); font-weight: 600; }
.lb-stats .warnc b { color: #c27400; }
.badge.iv-t-in { background: #e3f6e8; color: #1f7a3c; } .badge.iv-t-out { background: #fff1e0; color: #a85d00; }
.badge.iv-t-transfer { background: #e6f0ff; color: #1d5fc4; } .badge.iv-t-adjust { background: #f1e8ff; color: #6b3fc4; }
.badge.iv-r-pending { background: #fff1e0; color: #a85d00; } .badge.iv-r-issued { background: #e3f6e8; color: #1f7a3c; }
.badge.iv-r-rejected { background: #ffe5e5; color: #c0262c; } .badge.iv-r-cancelled { background: var(--surface-2); color: var(--muted); }
.iv-voucher { max-width: 900px; }
.iv-vh { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.iv-vh > div:first-child { display: flex; gap: 12px; align-items: center; }
.iv-logo { width: 48px; height: 48px; object-fit: contain; border-radius: 10px; }
.iv-vt { font-size: 1.15rem; font-weight: 800; letter-spacing: .04em; color: var(--accent); }
.iv-vi { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 18px; padding: 14px 0; }
.iv-vi > div { display: grid; gap: 2px; min-width: 0; } .iv-vi .full { grid-column: 1 / -1; }
.iv-vi span { color: var(--muted); font-size: .78rem; } .iv-vi b { font-weight: 600; overflow-wrap: anywhere; }
.iv-sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 40px; text-align: center; }
.iv-sign > div { display: grid; gap: 50px; } .iv-sign span { color: var(--muted); font-size: .82rem; }
.iv-sign b { border-top: 1px solid var(--text); padding-top: 6px; min-height: 1.6em; font-weight: 500; }
@media (max-width: 640px) {
  .iv-tbl thead { display: none; }
  .iv-tbl, .iv-tbl tbody, .iv-tbl tr, .iv-tbl td { display: block; width: 100%; }
  .iv-tbl tr { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; margin-bottom: 8px; }
  .iv-tbl td { border: 0; padding: 4px 0; text-align: left; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .iv-tbl td.no-label { display: block; padding-right: 36px; }
  .iv-tbl td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .8rem; }
  .iv-tbl td:last-child { position: absolute; top: 6px; right: 6px; width: auto; padding: 0; }
  .iv-tbl tfoot tr { border: 0; padding: 4px 10px; } .iv-tbl tfoot td { justify-content: flex-end; }
  .iv-tbl tfoot td:empty, .iv-tbl tfoot td:last-child { display: none; }
  .iv-vh { flex-direction: column; } .iv-vh .right { text-align: left; }
  .iv-vtbl { font-size: .85rem; } .iv-sign { gap: 10px; }
}
@media print { .iv-voucher { box-shadow: none; max-width: none; } }

/* phones: segmented tabs scroll sideways instead of running off the screen */
@media (max-width: 640px) {
  .seg { display: flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
  .seg::-webkit-scrollbar { display: none; }
  .seg a, .seg button { white-space: nowrap; flex: 0 0 auto; }
  .iv-vtbl th:nth-child(5), .iv-vtbl td:nth-child(5) { display: none; }
  .iv-vtbl th, .iv-vtbl td { padding-left: 6px; padding-right: 6px; }
}
.iv-per { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 8px; }
.iv-per > * { display: grid; gap: 1px; padding: 6px 12px; border-radius: 12px; background: var(--surface-2); color: var(--text); text-decoration: none; min-width: 84px; border: 2px solid transparent; }
.iv-per > a:hover { text-decoration: none; border-color: var(--hair); }
.iv-per span { font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.iv-per b { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.iv-per .tot { background: var(--accent-soft); } .iv-per .tot b { color: var(--accent); } .iv-per .tot small { color: var(--muted); }
.iv-per .on { border-color: var(--accent); } .iv-per .low b { color: #c27400; }
.cols-chart.n6 { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 640px) { .lb-bar .search, .listbar > .search { flex: 1 1 100%; width: 100%; } }
@media (max-width: 640px) {
  .listbar > form.group:has(> .search), .lb-bar > form:has(> .search) { flex: 1 1 100% !important; width: 100%; }
  .listbar form.group > .search, form.group > label.search { max-width: none !important; flex: 1 1 100% !important; }
}
@media (max-width: 640px) { .listbar label.search, .lb-bar label.search, .toolbar label.search, form > label.search { flex: 1 1 100% !important; max-width: none !important; } }
.cols-chart { grid-template-columns: repeat(12, minmax(0, 1fr)); } .cols-chart .col { min-width: 0; } .cols-chart .m { overflow: hidden; white-space: nowrap; text-overflow: clip; }
@media (max-width: 640px) { .cols-chart { gap: 3px; } .cols-chart .m { font-size: .62rem; } }

/* ================= School ================= */
.sc-sec { font-weight: 700; margin: 14px 2px 8px; color: var(--text-2, var(--muted)); font-size: .9rem; }
.sc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.sc-cls-h { display: flex; gap: 12px; align-items: center; }
.sc-badge { min-width: 52px; height: 52px; padding: 0 8px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 1.05rem; color: #fff; background: linear-gradient(135deg, #5856d6, #0a84ff); }
.sc-badge.sm { min-width: 42px; height: 34px; border-radius: 10px; font-size: .88rem; }
.sc-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.sc-sub { gap: 10px; }
.sc-info { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.sc-info > div { background: var(--surface); border-radius: 12px; padding: 8px 12px; box-shadow: var(--shadow-sm); display: grid; gap: 2px; }
.sc-info span { color: var(--muted); font-size: .76rem; } .sc-info b { font-size: 1.05rem; }
.sc-sheet { padding: 6px 10px 10px; }
.sc-grid td { vertical-align: middle; padding-top: 6px; padding-bottom: 6px; } .sc-grid .c { text-align: center; }
.sc-grid tr.abs td { background: color-mix(in srgb, var(--danger) 7%, transparent); }
.sc-in { width: 92px; height: 40px; text-align: center; font-size: 1.05rem; font-weight: 700; display: inline-block; }
.sc-in.bad { border-color: var(--danger); color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.sc-abs { width: 20px; height: 20px; }
.sc-f { color: #d63384; font-weight: 700; }
.sc-bar { position: sticky; bottom: 0; display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; padding: 10px 4px 2px; background: var(--surface); border-top: 1px solid var(--line); margin-top: 6px; }
.sc-bar .muted { margin-right: auto; }
.sc-status { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.sc-rel { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .sc-rel form { display: flex; align-items: center; }
.sc-res-wrap { overflow-x: auto; }
.sc-res th, .sc-res td { white-space: nowrap; } .sc-res .c { text-align: center; }
.sc-res th small { display: block; font-weight: 400; color: var(--muted); font-size: .7rem; }
.sc-res th.sc-subj span { display: block; max-width: 86px; overflow: hidden; text-overflow: ellipsis; font-size: .78rem; }
.sc-res .sticky { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 150px; }
.sc-res td.sc-low { color: var(--danger); } .sc-res td.sc-empty { color: var(--muted); }
.sc-g { display: inline-grid; place-items: center; width: 26px; height: 24px; border-radius: 7px; font-weight: 800; font-size: .82rem; color: #fff; background: #8e8e93; }
.sc-g.g-A { background: #1f9d45; } .sc-g.g-B { background: #34c759; } .sc-g.g-C { background: #0a84ff; } .sc-g.g-D { background: #5856d6; } .sc-g.g-E { background: #ff9f0a; } .sc-g.g-F { background: #ff3b30; }
.att-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.att-row:last-child { border-bottom: 0; }
.att-seg { display: inline-flex; background: var(--surface-3, var(--surface-2)); border-radius: 10px; padding: 2px; gap: 2px; flex: 0 0 auto; }
.att-seg label { cursor: pointer; } .att-seg input { position: absolute; opacity: 0; pointer-events: none; }
.att-seg span { display: block; padding: 7px 11px; border-radius: 8px; font-size: .84rem; font-weight: 600; color: var(--muted); }
.att-seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.att-seg input[value=late]:checked + span { color: #c27400; } .att-seg input[value=permission]:checked + span { color: #0a84ff; } .att-seg input[value=absent]:checked + span { color: var(--danger); }
.att-sheet td, .att-sheet th { padding: 4px 3px !important; font-size: .78rem; text-align: center; min-width: 22px; }
.att-sheet .nm { text-align: left; white-space: nowrap; position: sticky; left: 0; background: var(--surface); }
.att-sheet .m-absent { color: var(--danger); font-weight: 700; } .att-sheet .m-permission { color: #0a84ff; font-weight: 700; } .att-sheet .m-late { color: #c27400; }
@media (max-width: 640px) {
  .sc-info { grid-template-columns: repeat(2, minmax(0, 1fr)); } .sc-info > div:last-child { grid-column: 1 / -1; }
  .sc-grid thead { display: none; } .sc-grid, .sc-grid tbody { display: block; }
  .sc-grid tr { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; grid-template-areas: "n name in ab"; gap: 6px; align-items: center; padding: 6px 2px; border-bottom: 1px solid var(--line); }
  .sc-grid td { border: 0 !important; padding: 0 !important; } .sc-grid td:nth-child(3) { display: none; }
  .sc-grid td:nth-child(1) { grid-area: n; } .sc-grid td:nth-child(2) { grid-area: name; min-width: 0; } .sc-grid td:nth-child(4) { grid-area: in; } .sc-grid td:nth-child(5) { grid-area: ab; }
  .sc-in { width: 74px; }
  .sc-bar .muted { flex-basis: 100%; }
  .att-seg span { padding: 7px 8px; font-size: .78rem; }
}
.sc-prof { display: flex; gap: 16px; align-items: center; }
.sc-ph { width: 86px; height: 104px; border-radius: 16px; overflow: hidden; display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 800; font-size: 1.6rem; flex: 0 0 auto; }
.sc-ph img { width: 100%; height: 100%; object-fit: cover; }
.sc-attsum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.sc-attsum > div { background: var(--surface-2); border-radius: 12px; padding: 8px 10px; display: grid; } .sc-attsum b { font-size: 1.2rem; } .sc-attsum span { font-size: .75rem; color: var(--muted); }
.sc-exc { margin-bottom: 12px; }
.sc-subs { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 12px; }
.sc-subj-t { display: grid; gap: 3px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: var(--text); text-decoration: none; border: 1.5px solid transparent; }
a.sc-subj-t:hover { border-color: var(--accent); text-decoration: none; }
.sc-subj-t.ok { background: color-mix(in srgb, #34c759 12%, var(--surface)); } .sc-subj-t.part { background: color-mix(in srgb, #ff9f0a 12%, var(--surface)); }
.sc-prog { height: 5px; border-radius: 3px; background: var(--hair); overflow: hidden; } .sc-prog i { display: block; height: 100%; background: var(--accent); }
.sc-subj-t.ok .sc-prog i { background: #34c759; }
.sc-cin { width: 64px; height: 34px; text-align: center; padding: 0 4px; font-weight: 600; }
.sc-cin.bad { border-color: var(--danger); color: var(--danger); }
.sc-cg td { padding: 3px 4px !important; }
@media (max-width: 640px) { .sc-exc .sc-cls-h, .card .sc-cls-h { flex-wrap: wrap; } .sc-prof { align-items: flex-start; } .sc-ph { width: 70px; height: 86px; } }
.sc-exc .sc-cls-h .grow { flex: 1 1 55%; }
.sc-abl { display: inline-grid; justify-items: center; gap: 1px; cursor: pointer; } .sc-abl span { display: none; font-size: .62rem; color: var(--muted); }
@media (max-width: 640px) { .sc-abl span { display: block; } }
/* School timetable */
.tt-title { margin: 4px 2px 10px; font-size: 1.05rem; }
.tt-wrap { overflow-x: auto; }
.tt { table-layout: fixed; min-width: 760px; } .tt th, .tt td { text-align: center; vertical-align: middle; padding: 4px !important; border: 1px solid var(--hair); }
.tt th.today { color: var(--accent); }
.tt .tt-t { width: 92px; font-size: .78rem; color: var(--muted); } .tt .tt-t b { display: block; color: var(--text); font-size: .95rem; } .tt .tt-t span { white-space: nowrap; }
.tt-c { height: 58px; } .tt-c.ed { cursor: pointer; } .tt-c.ed:hover { background: var(--surface-2); }
.tt-c.has { background: hsl(var(--h, 210) 80% 95%); } :root[data-theme="dark"] .tt-c.has { background: hsl(var(--h, 210) 30% 20%); }
.tt-c.clash { outline: 2px solid var(--danger); outline-offset: -2px; }
.tt-l { line-height: 1.25; } .tt-l b { display: block; font-size: .84rem; } .tt-l span { font-size: .72rem; color: var(--muted); }
.tt-break td { background: var(--surface-2); color: var(--muted); font-size: .78rem; height: 26px; }
.tt-gap td { background: var(--surface-3, var(--surface-2)); font-weight: 700; font-size: .8rem; text-align: left !important; padding-left: 10px !important; }
.tt-hours { display: flex; flex-wrap: wrap; gap: 6px; } .tt-hours span { background: hsl(var(--h) 80% 94%); color: #1c1c1e; border-radius: 99px; padding: 4px 10px; font-size: .82rem; }
@media print { .tt { min-width: 0; } .tt-c { height: 46px; } .tt-wrap { box-shadow: none; } }

/* Show / hide password eye inside the box */
.pw-wrap { position: relative; display: block; }
.pw-wrap > .input { width: 100%; padding-right: 46px; }
.pw-eye { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); width: 34px; height: 34px; border: 0; padding: 0; border-radius: 10px;
  background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: color .15s, background .15s; }
.pw-eye:hover { color: var(--accent); background: var(--accent-soft); }
.pw-eye:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pw-eye[aria-pressed="true"] { color: var(--accent); }
.pw-wrap input::-ms-reveal, .pw-wrap input::-ms-clear { display: none; }   /* Edge has its own eye – use ours only */

/* ===== Home / Menu app icons – latest iOS style =====
   continuous-corner squircle, vertical colour gradient, glass sheen and light rim; glass glyph (see app_icons.php).
   Dark mode: dark tile, glyph tinted with the app colour. Packed tight like a phone home screen, one-line labels. */
.mod-ico {
  --cut: var(--c2, var(--c));
  position: relative; overflow: hidden; color: #fff; width: 60px; height: 60px; border-radius: 23% !important;
  background: linear-gradient(180deg, var(--c1, var(--c)) 0%, var(--c2, var(--c)) 100%) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 0 0 .5px rgba(255, 255, 255, .3), inset 0 -10px 18px rgba(0, 0, 0, .07),
              0 1px 2px rgba(0, 0, 0, .1), 0 4px 10px -4px color-mix(in srgb, var(--c2, var(--c)) 55%, transparent) !important;
  transition: transform .25s var(--ease);
}
.mod-ico::before {   /* glass sheen on the top half */
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, .3) 0%, rgba(255, 255, 255, .06) 46%, transparent 47%);
}
.mod-ico::after { display: none; }
.mod-ico svg { position: relative; z-index: 1; width: 60% !important; height: 60% !important; filter: drop-shadow(0 1px 1.2px rgba(0, 0, 0, .16)); }
.mod-ico svg.i { width: 48% !important; height: 48% !important; stroke-width: 2.2; }
.mod-tile:hover .mod-ico { transform: translateY(-2px) scale(1.04); }
.mod-tile:active .mod-ico { transform: scale(.9); filter: brightness(.92); }
[data-theme="dark"] .mod-ico {
  --cut: #1f1f22; color: var(--c1, var(--c));
  background: linear-gradient(180deg, #3a3a3e 0%, #1f1f22 100%) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 0 0 .5px rgba(255, 255, 255, .12), 0 2px 8px rgba(0, 0, 0, .5) !important;
}
[data-theme="dark"] .mod-ico::before { background: linear-gradient(180deg, rgba(255, 255, 255, .08), transparent 50%); }
[data-theme="dark"] .mod-ico svg { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--c1, var(--c)) 35%, transparent)); }

/* tight grid: icon + one-line label, small gaps */
.home-mods .mod-grid, .mod-grid { grid-template-columns: repeat(auto-fill, 76px) !important; justify-content: start; gap: 10px 6px !important; max-width: none; margin: 0; }
.mod-tile { gap: 5px !important; padding: 4px 0 !important; min-width: 0; border-radius: 12px; }
.mod-tile:hover { background: none !important; }
.mod-name { font-size: .74rem !important; font-weight: 500 !important; line-height: 1.2; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) {
  .home-mods .mod-grid, .mod-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 8px 2px !important; }
  .mod-ico { width: 58px !important; height: 58px !important; }
  .mod-name { font-size: .7rem !important; }
}
/* standard label text: normal size and weight, long names wrap to 2 lines (no cut-off) */
.mod-name { font-size: .8rem !important; font-weight: 500 !important; line-height: 1.25; white-space: normal !important; text-overflow: clip !important;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: normal; }
@media (max-width: 640px) { .mod-name { font-size: .75rem !important; } }
/* room for long one-word names (Appointments, Administration); softer glass sheen without a hard line */
.home-mods .mod-grid, .mod-grid { grid-template-columns: repeat(auto-fill, 92px) !important; gap: 10px 4px !important; }
.mod-ico::before { background: linear-gradient(180deg, rgba(255, 255, 255, .26) 0%, rgba(255, 255, 255, .08) 45%, transparent 70%) !important; }
@media (max-width: 640px) { .home-mods .mod-grid, .mod-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 8px 2px !important; } }

/* ===== Security pages ===== */
.sec-ic { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; color: #fff; background: linear-gradient(180deg, #5ab0ff, #2f6bff); box-shadow: 0 6px 14px -4px rgba(47, 107, 255, .6); }
.sec-ic svg { width: 32px; height: 32px; }
.sec-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; align-self: center; background: var(--success); }
.sec-dot.bad { background: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 18%, transparent); }
.sec-tips { margin: 0; padding-left: 18px; line-height: 1.7; }

/* =====================================================================
   Church theme 2026 – dark navy sidebar with coloured modules, clean top bar
   ===================================================================== */
.sidebar {
  --sb-text: #e8eeff; --sb-muted: #8fa3d6;
  background: radial-gradient(120% 60% at 0% 0%, #1d3a86 0%, transparent 60%), linear-gradient(180deg, #13265f 0%, #0d1b48 55%, #0a1638 100%) !important;
  color: var(--sb-text); width: 268px !important; padding: 14px 12px 0 !important; border-right: 0 !important;
  display: flex; flex-direction: column;
}
.sidebar .brand { padding: 4px 6px 18px !important; }
.sidebar .brand-logo { color: #fff; gap: 12px; min-width: 0; }
.sidebar .brand-logo .mark { width: 48px; height: 48px; border-radius: 14px; box-shadow: 0 6px 16px rgba(0, 0, 0, .35); }
.sidebar .bl-tx { display: grid; line-height: 1.15; min-width: 0; }
.sidebar .bl-tx b { font-size: 1.02rem; font-weight: 700; color: #fff; white-space: normal; }
.sidebar .bl-tx small { font-size: .74rem; font-weight: 500; color: var(--sb-muted); margin-top: 2px; }
.sidebar .collapse-btn { color: var(--sb-muted); background: rgba(255, 255, 255, .06) !important; border: 0; }
.sidebar .nav-label { color: var(--sb-muted) !important; text-transform: none; letter-spacing: 0; font-size: .82rem !important; font-weight: 500; padding: 14px 10px 6px !important; }
.sidebar .nav-link { color: var(--sb-text) !important; padding: 8px 10px !important; border-radius: 12px !important; gap: 12px !important; font-size: .95rem !important; font-weight: 500; }
.sidebar .nav-link .ico { width: 30px !important; height: 30px !important; border-radius: 9px !important; color: #fff !important;
  background: linear-gradient(160deg, var(--c1, #5ab0ff), var(--c2, #2f6bff)) !important; box-shadow: 0 3px 8px -2px color-mix(in srgb, var(--c2, #2f6bff) 70%, transparent) !important; }
.sidebar .nav-link .ico svg { width: 17px !important; height: 17px !important; stroke-width: 2 !important; }
/* module names in their own colour */
.sidebar .nav-link .txt { color: color-mix(in srgb, var(--c1, #e8eeff) 55%, #fff); }
.sidebar .nav-link:hover { background: rgba(255, 255, 255, .07) !important; color: #fff !important; }
.sidebar .nav-link:hover .txt { color: #fff; }
.sidebar .nav-link.active { background: color-mix(in srgb, var(--c2, #2f6bff) 32%, transparent) !important; color: #fff !important; font-weight: 600; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.sidebar .nav-link.active .txt { color: #fff; }
.sidebar .nav-link.active::before { display: none; }
.sidebar .nav-home { --c1: #6aa8ff; --c2: #2f6bff; }
.sidebar .nav-home.active { background: linear-gradient(90deg, #3b82f6, #2563eb) !important; box-shadow: 0 8px 20px -6px rgba(37, 99, 235, .7) !important; }
.sidebar .nav-home.active .ico { background: rgba(255, 255, 255, .18) !important; box-shadow: none !important; }
.sidebar .nav-home .txt { color: #fff; }
.sidebar .side-card { background: rgba(255, 255, 255, .07) !important; color: #fff; }
.sidebar .side-card select { color: #fff !important; }
.sidebar .side-card select option, .sidebar .side-card select optgroup { color: #1c1c1e; }
.sidebar .side-card .lbl { color: var(--sb-muted) !important; }
.sidebar-bottom { padding-top: 10px !important; }
.side-art { position: relative; margin: 6px -12px 0; height: 150px; overflow: hidden; }
.side-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.side-motto { position: absolute; left: 22px; bottom: 16px; display: grid; gap: 2px; color: #dfe7ff; font-size: .86rem; line-height: 1.3; text-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.side-motto b { font-weight: 600; } .side-motto span { color: #b9c6ec; }
body.side-collapsed .sidebar { width: 82px !important; }
body.side-collapsed .side-motto, body.side-collapsed .bl-tx { display: none; }
@media (max-width: 900px) { .sidebar { width: min(300px, 86vw) !important; } body.side-collapsed .bl-tx, body.side-collapsed .side-motto { display: grid; } }

/* top bar: white strip, no page title, account chip with name */
.topbar-d { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  padding: 10px 24px !important; border-bottom: .5px solid var(--hair); margin-bottom: 14px; }
/* page title on the left of the top bar (computers) */
.topbar-d .tb-title { font-size: 1.15rem !important; }
.topbar-d .rbtn { background: var(--surface-2); }
.me-chip { display: flex; align-items: center; gap: 10px; border: 0; background: none; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; padding: 2px 6px 2px 2px; border-radius: 99px; }
.me-chip:hover { background: var(--surface-2); }
.me-chip .me-btn { width: 38px; height: 38px; }
.me-chip .me-name { max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-chip svg.i { width: 16px; height: 16px; color: var(--muted); }
.content { padding-top: 0 !important; }

/* ===== Home (church design) ===== */
.home { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.home-main { display: grid; gap: 16px; min-width: 0; }
.home-rail { display: grid; gap: 14px; position: sticky; top: 76px; }
@media (max-width: 1280px) { .home { grid-template-columns: minmax(0, 1fr); } .home-rail { position: static; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); } }

.hero { position: relative; overflow: hidden; border-radius: 22px; min-height: 196px; color: #fff; padding: 26px 30px;
  background: linear-gradient(105deg, #0b1c56 0%, #17358f 45%, #2f5bc4 75%, #6a5aa8 100%); box-shadow: 0 14px 34px -14px rgba(23, 53, 143, .65); }
.hero-art { position: absolute; right: 0; bottom: 0; height: 100%; width: 62%; pointer-events: none; }
.hero-tx { position: relative; z-index: 1; max-width: 520px; }
.hero-hi { font-size: 1.05rem; opacity: .92; }
.hero-name { font-size: 1.9rem !important; font-weight: 800; margin: 2px 0 6px; color: #fff; letter-spacing: -.02em; }
.hero-bless { opacity: .88; font-size: .95rem; }
.hero-meta { display: flex; align-items: center; gap: 14px; margin-top: 16px; font-weight: 500; flex-wrap: wrap; }
.hero-meta > span { display: inline-flex; align-items: center; gap: 7px; }
.hero-meta .sep { width: 1px; height: 18px; background: rgba(255, 255, 255, .4); }
.hero-meta svg.i { width: 18px; height: 18px; }
.hero-chips { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.hchip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: rgba(255, 255, 255, .16); color: #fff; font-size: .84rem;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); }
.hchip:hover { text-decoration: none; background: rgba(255, 255, 255, .26); }
.hchip b { font-weight: 700; } .hchip.ok b { color: #9ff0c6; } .hchip.late b { color: #ffd48a; } .hchip.act { background: rgba(255, 159, 10, .35); }
.hero-verse { position: absolute; z-index: 1; right: 26px; top: 22px; width: min(270px, 34%); margin: 0; font-style: italic; font-size: .9rem; line-height: 1.45;
  color: rgba(255, 255, 255, .92); text-align: right; text-shadow: 0 1px 6px rgba(0, 0, 0, .35); }
.hero-verse cite { display: block; margin-top: 6px; font-size: .74rem; font-style: normal; opacity: .8; }
@media (max-width: 900px) {
  .hero { padding: 20px 18px 22px; min-height: 0; border-radius: 20px; }
  .hero-name { font-size: 1.45rem !important; } .hero-art { width: 100%; opacity: .45; } .hero-verse { display: none; }
}

.mcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.mcard { position: relative; display: grid; align-content: end; gap: 2px; min-height: 128px; padding: 14px 14px 13px; border-radius: 18px; color: #fff; overflow: hidden;
  background: linear-gradient(140deg, color-mix(in srgb, var(--c1) 92%, #fff) 0%, var(--c2) 100%);
  box-shadow: 0 10px 22px -12px color-mix(in srgb, var(--c2) 85%, transparent), inset 0 1px 0 rgba(255, 255, 255, .35); transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.mcard::after { content: ""; position: absolute; right: -30px; bottom: -40px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.mcard:hover { text-decoration: none; transform: translateY(-3px); box-shadow: 0 16px 28px -12px color-mix(in srgb, var(--c2) 90%, transparent), inset 0 1px 0 rgba(255, 255, 255, .35); }
.mcard:active { transform: scale(.97); }
.mc-ic { position: absolute; left: 14px; top: 14px; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c2) 70%, #000 8%), var(--c2)); box-shadow: 0 6px 12px -4px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .3); --cut: var(--c2); }
.mc-ic svg { width: 28px; height: 28px; }
.mc-go { position: absolute; right: 12px; top: 14px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .25); }
.mc-go svg.i { width: 14px; height: 14px; }
.mc-t { font-weight: 700; font-size: 1rem; position: relative; z-index: 1; text-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.mc-s { font-size: .76rem; opacity: .92; position: relative; z-index: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .mcards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .mcard { min-height: 112px; } }

.hstats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.hstat { background: var(--surface); border-radius: 18px; padding: 14px 16px; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; box-shadow: var(--shadow-sm); }
.hs-ic { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(160deg, var(--c1), var(--c2)); box-shadow: 0 6px 14px -6px var(--c2); }
.hs-ic svg.i { width: 22px; height: 22px; }
.hstat .l { display: block; color: var(--muted); font-size: .82rem; }
.hstat .n { display: block; font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.hs-tr { text-align: right; display: grid; gap: 2px; }
.hs-tr small { color: var(--muted); font-size: .7rem; white-space: nowrap; }
.st-tr { font-weight: 700; font-size: .84rem; } .st-tr.good { color: var(--success); } .st-tr.bad { color: var(--danger); } .st-tr.flat { color: var(--muted); }
@media (max-width: 1100px) { .hstats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .hstat { grid-template-columns: auto 1fr; } .hs-tr { grid-column: 1 / -1; text-align: left; display: flex; gap: 6px; align-items: baseline; } }

.hgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) { .hgrid { grid-template-columns: minmax(0, 1fr); } }
.home .card { border-radius: 18px; }
.home .card-head h2 { display: inline-flex; align-items: center; gap: 8px; font-size: 1rem; }
.home .card-head h2 svg.i { color: var(--accent); }
.pill-link { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); }
.pill-link:hover { text-decoration: none; color: var(--accent); }
.pill-link svg.i { width: 13px; height: 13px; }
.donut-wrap { display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: center; }
.donut { width: 150px; height: 150px; }
.donut .dn-n { font-size: 22px; font-weight: 800; fill: var(--text); } .donut .dn-l { font-size: 8.5px; fill: var(--muted); }
.donut-legend { display: grid; gap: 8px; font-size: .88rem; }
.donut-legend > div { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; }
.donut-legend i { width: 10px; height: 10px; border-radius: 50%; } .donut-legend small { color: var(--muted); font-weight: 500; }
@media (max-width: 520px) { .donut-wrap { grid-template-columns: 1fr; justify-items: center; } .donut-legend { width: 100%; } }
.all-clear { text-align: center; padding: 22px 10px; display: grid; justify-items: center; gap: 4px; }
.all-clear > span { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; color: #fff; background: linear-gradient(160deg, #4fd8a0, #10b37a); margin-bottom: 6px; }

.cal { padding: 14px 14px 12px !important; }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cal-head b { display: inline-flex; gap: 8px; align-items: center; } .cal-head b svg.i { color: var(--accent); }
.cal-head .rbtn.sm { width: 28px; height: 28px; display: inline-grid; place-items: center; background: var(--surface-2); border-radius: 50%; color: var(--text); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; font-size: .8rem; }
.cal-grid .wd { color: var(--muted); font-size: .68rem; padding: 2px 0 6px; }
.cal-grid .dy { position: relative; height: 32px; display: grid; place-items: center; border-radius: 50%; font-weight: 500; }
.cal-grid .dy.sun { color: var(--danger); }
.cal-grid .dy.ev::after { content: ""; position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.cal-grid .dy.today { background: linear-gradient(160deg, #3b82f6, #2563eb); color: #fff; font-weight: 700; box-shadow: 0 6px 12px -4px rgba(37, 99, 235, .6); }
.cal-grid .dy.today::after { background: #fff; }
.ev-list, .act-list { display: grid; gap: 4px; }
.ev { display: grid; grid-template-columns: 12px 1fr; gap: 12px; align-items: center; padding: 8px 6px; border-radius: 12px; color: inherit; }
.ev:hover { background: var(--surface-2); text-decoration: none; }
.ev i { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 16%, transparent); }
.ev b, .act b { display: block; font-size: .88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev > div, .act > div { min-width: 0; display: grid; }
.tone-red { color: #ef4444; background: #ef4444; } .tone-green { color: #22c55e; background: #22c55e; } .tone-purple { color: #8b5cf6; background: #8b5cf6; }
.tone-blue { color: #3b82f6; background: #3b82f6; } .tone-teal { color: #14b8a6; background: #14b8a6; } .tone-orange { color: #f97316; background: #f97316; }
.tone-indigo { color: #6366f1; background: #6366f1; } .tone-gray { color: #64748b; background: #64748b; } .tone-coral { color: #f0643e; background: #f0643e; } .tone-yellow { color: #eab308; background: #eab308; }
.act { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 7px 4px; }
.act-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, currentColor 14%, transparent) !important; }
.act time { white-space: nowrap; align-self: start; padding-top: 2px; }
/* fixes after first look */
.hstat { grid-template-columns: auto minmax(0, 1fr) !important; align-items: center; }
.hstat .l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs-tr { grid-column: 2; text-align: left !important; display: flex !important; gap: 6px; align-items: baseline; margin-top: -4px; }
.hs-tr small { overflow: hidden; text-overflow: ellipsis; }
.hstat > div:nth-child(2) { min-width: 0; }
.hero-verse { width: min(250px, 28%); }
.sidebar .nav-link { padding: 6px 10px !important; }
.sidebar .nav-link .ico { width: 28px !important; height: 28px !important; }
.side-art { height: 112px; }
.sidebar nav { flex: 1 1 auto; overflow-y: auto; min-height: 0; scrollbar-width: none; }
.sidebar { height: 100vh; position: sticky; top: 0; overflow: hidden !important; }
.sidebar-bottom { flex: none; }
@media (max-width: 900px) { .sidebar { position: fixed; } }
.st-tr { white-space: nowrap; }
/* computers: the centre is switched in the top bar ("All centres"), so no second switcher in the sidebar (phones keep it) */
@media (min-width: 901px) { .sidebar .side-card { display: none !important; } }
/* top bar: only the profile picture (no name, no arrow) */
.me-chip .me-name, .me-chip > svg.i { display: none !important; }
.me-chip { padding: 0 !important; }
/* module cards 30% smaller */
.mcards { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 9px; }
.mcard { min-height: 90px; padding: 10px 10px 9px; border-radius: 14px; }
.mcard::after { width: 84px; height: 84px; right: -22px; bottom: -30px; }
.mc-ic { left: 10px; top: 10px; width: 32px; height: 32px; border-radius: 10px; }
.mc-ic svg { width: 20px; height: 20px; }
.mc-go { right: 9px; top: 10px; width: 20px; height: 20px; }
.mc-go svg.i { width: 11px; height: 11px; }
.mc-t { font-size: .82rem; }
.mc-s { font-size: .66rem; }
@media (max-width: 640px) { .mcards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } .mcard { min-height: 84px; } .mc-s { display: none; } }

/* =====================================================================
   Forms – clean, rounded, standard size (all form pages)
   ===================================================================== */
:root { --field-h: 40px; --field-r: 12px; --field-bd: rgba(60, 60, 67, .16); --field-bg: #fff; }
:root[data-theme="dark"] { --field-bd: rgba(255, 255, 255, .12); --field-bg: #232326; }
.input, select.input, textarea.input, .ss-btn.input, .dp-btn {
  height: var(--field-h) !important; min-height: var(--field-h); border-radius: var(--field-r) !important; font-size: 14.5px !important;
  background: var(--field-bg) !important; border: 1px solid var(--field-bd) !important; box-shadow: 0 1px 1px rgba(0, 0, 0, .02);
  padding-left: 13px; padding-right: 13px; transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
textarea.input { height: auto !important; min-height: 92px; padding-top: 10px; padding-bottom: 10px; line-height: 1.5; }
select.input, .ss-btn.input { padding-right: 38px; }
.ss-btn { line-height: calc(var(--field-h) - 2px) !important; }
.input:hover, .ss-btn.input:hover, .dp-btn:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--field-bd)) !important; }
.input:focus, .input:focus-visible, .ss-btn.input:focus, .dp-btn:focus {
  outline: none; border-color: var(--accent) !important; box-shadow: 0 0 0 4px var(--accent-soft) !important; background: var(--field-bg) !important; }
.input::placeholder { color: color-mix(in srgb, var(--muted) 85%, transparent); font-weight: 400; }
.input.sm { --field-h: 34px; font-size: 13.5px !important; border-radius: 10px !important; }
.input:disabled, .input[readonly] { background: var(--surface-2) !important; color: var(--text-2); }
.input-group { background: var(--field-bg) !important; border: 1px solid var(--field-bd) !important; border-radius: var(--field-r) !important; height: var(--field-h); }
.input-group .input { border: 0 !important; background: transparent !important; box-shadow: none !important; height: calc(var(--field-h) - 2px) !important; }
.input-group:focus-within { border-color: var(--accent) !important; box-shadow: 0 0 0 4px var(--accent-soft) !important; }

/* labels and spacing */
.field { gap: 6px !important; }
.field > label { font-size: .82rem !important; font-weight: 600 !important; color: var(--text-2); letter-spacing: 0; }
.field > label.req::after, label.req::after { color: var(--danger); }
.form-grid { gap: 14px 16px !important; }
.field .muted.small, .field .small { font-size: .76rem; line-height: 1.4; }

/* choice switches (Male / Female, Working / Probation …) */
.segr { height: var(--field-h) !important; border-radius: var(--field-r) !important; padding: 3px !important; background: var(--surface-2) !important; border: 1px solid var(--field-bd); }
.segr span { border-radius: 9px !important; font-size: .9rem !important; }
.segr input:checked + span { background: var(--field-bg) !important; color: var(--accent) !important; box-shadow: 0 1px 4px rgba(0, 0, 0, .12) !important; }
.seg { border-radius: 12px !important; padding: 3px !important; }
.seg a, .seg button { border-radius: 9px !important; }

/* form cards and section titles */
.card { border-radius: 18px !important; }
form.card, .card form, .modal-body { --card-pad: 20px; }
.form-section { font-size: 1rem !important; font-weight: 700; margin: 22px 0 12px !important; display: flex; align-items: center; gap: 10px; }
.form-section:first-child { margin-top: 0 !important; }
.check, .switch { gap: 8px; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
.field { align-content: start; }   /* fields line up even when a neighbour has long help text */
.ss-wrap { display: block; } .ss-open .ss-btn { box-shadow: 0 0 0 4px var(--accent-soft) !important; border-color: var(--accent) !important; }

/* buttons in forms: same height and roundness as the fields */
.form-actions .btn, .modal .btn:not(.btn-icon):not(.sm):not(.btn-sm), form .btn-primary:not(.btn-sm), form .btn-success:not(.btn-sm) { height: var(--field-h); border-radius: var(--field-r); padding: 0 18px; }
.form-actions { gap: 10px; }

/* pop-up windows */
.modal { border-radius: 20px !important; }
.modal-head { padding: 16px 20px !important; }
.modal-head h3 { font-size: 1.05rem; }
.drawer .fs-bar, .sheet-head { border-radius: 0; }
/* My Centre */
.mc-logo { display: flex; gap: 16px; align-items: center; }
.mc-logo-img img { width: 72px; height: 72px; border-radius: 20px; object-fit: cover; box-shadow: var(--shadow-sm); background: #fff; }

/* sidebar: no picture / motto at the bottom; long menus get a thin, clean scrollbar */
.side-art { display: none !important; }
.sidebar nav { overflow-y: auto !important; scrollbar-width: thin !important; scrollbar-color: rgba(255, 255, 255, .22) transparent; padding-right: 2px; margin-right: -4px; padding-bottom: 12px; }
.sidebar nav::-webkit-scrollbar { width: 5px; display: block; }
.sidebar nav::-webkit-scrollbar-track { background: transparent; }
.sidebar nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); border-radius: 99px; }
.sidebar nav:hover::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .32); }
.sidebar:hover { scrollbar-width: thin; }
/* password rules checklist */
.pw-rules { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; font-size: .78rem; color: var(--muted); }
.pw-rules li { display: flex; align-items: center; gap: 6px; transition: color .15s; }
.pw-rules li::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid currentColor; flex: none; box-sizing: border-box; }
.pw-rules li.ok { color: var(--success); font-weight: 600; }
.pw-rules li.ok::before { background: var(--success) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 10px no-repeat; border-color: var(--success); }

/* ---- Library: front / back cover and more photos ---- */
.lbf-covers { display: flex; gap: 8px; flex: none; }
.lbf-covers .lbf-prev { width: 84px; }
.lbf-imgs { display: flex; flex-wrap: wrap; gap: 8px; }
.lbf-img, .lbf-add { position: relative; width: 64px; height: 84px; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.lbf-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lbf-img.off img { opacity: .25; filter: grayscale(1); }
.lbf-img.new { outline: 2px solid var(--accent, #691103); outline-offset: -2px; }
.lbf-x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center;
  background: rgba(0,0,0,.6); color: #fff; cursor: pointer; }
.lbf-x svg { width: 12px; height: 12px; }
.lbf-img.off .lbf-x { background: var(--accent, #691103); }
.lbf-add { display: grid; place-items: center; align-content: center; gap: 2px; border: 1.5px dashed var(--border, #c7c7cc); cursor: pointer; color: var(--muted, #8e8e93); }
.lbf-add[hidden] { display: none; }
.lbf-add small { font-size: .7rem; }
.lbd-gal { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.lbd-gal .lbd-cover { cursor: zoom-in; }
.lbd-thumbs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.lbd-thumbs button { flex: none; width: 46px; padding: 0; border: 2px solid transparent; border-radius: 8px; background: none; cursor: pointer; overflow: hidden; }
.lbd-thumbs button.on { border-color: var(--accent, #691103); }
.lbd-thumbs img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; display: block; border-radius: 6px; }
.lbd-thumbs small { display: none; }
@media (max-width: 640px) { .lbf-covers .lbf-prev { width: 72px; } .lbd-gal { max-width: 200px; margin: 0 auto; } .lbd-gal .lbd-cover { max-width: none; } }

/* =========================================================
   Phone view refresh (v4): space under the header, calmer cards, gentle motion
   ========================================================= */
@media (max-width: 900px) {
  /* header: a little taller, rounded bottom, room for the long church name */
  .phone-head { gap: 8px; padding: calc(13px + env(safe-area-inset-top)) 14px 13px; min-height: calc(62px + env(safe-area-inset-top));
    border-radius: 0 0 22px 22px; box-shadow: 0 6px 22px -8px rgba(143, 20, 48, .55) !important; }
  .phone-head .t { font-size: 1.02rem; letter-spacing: -.01em; }
  .phone-head .t.home { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.15; font-size: .95rem; }
  .phone-head .rbtn { width: 36px; height: 36px; border-radius: 50%; transition: transform .18s var(--ease), background .2s; }
  .phone-head .rbtn:active { transform: scale(.9); background: rgba(255, 255, 255, .3) !important; }
  .phone-head .mark, .phone-head .brand-mark { width: 36px; height: 36px; }

  /* space between the header and the page */
  .content { padding: 18px 14px 100px !important; }
  .content > * + * { margin-top: 0; }
  .content > .page-head { margin-bottom: 12px; }

  /* motion: page parts rise in one after another */
  .content > *:not(.drawer):not(.drawer-back):not(.modal-back):not(script) { animation: m-rise .5s cubic-bezier(.2, .8, .2, 1) backwards; }
  .content > .drawer, .content > .drawer-back, .content > .modal-back { animation: none !important; }
  .content > *:nth-child(2) { animation-delay: 50ms; }
  .content > *:nth-child(3) { animation-delay: 100ms; }
  .content > *:nth-child(4) { animation-delay: 150ms; }
  .content > *:nth-child(n+5) { animation-delay: 200ms; }

  /* home */
  .hero { border-radius: 22px; padding: 20px 18px; }
  .mcards { gap: 10px; }
  .mcard { border-radius: 18px; animation: m-pop .45s cubic-bezier(.2, .9, .3, 1.2) backwards; transition: transform .18s var(--ease), box-shadow .2s; }
  .mcard:active { transform: scale(.95); }
  .mcards .mcard:nth-child(1) { animation-delay: 60ms; }  .mcards .mcard:nth-child(2) { animation-delay: 90ms; }
  .mcards .mcard:nth-child(3) { animation-delay: 120ms; } .mcards .mcard:nth-child(4) { animation-delay: 150ms; }
  .mcards .mcard:nth-child(5) { animation-delay: 180ms; } .mcards .mcard:nth-child(6) { animation-delay: 210ms; }
  .mcards .mcard:nth-child(7) { animation-delay: 240ms; } .mcards .mcard:nth-child(8) { animation-delay: 270ms; }
  .mcards .mcard:nth-child(9) { animation-delay: 300ms; } .mcards .mcard:nth-child(n+10) { animation-delay: 330ms; }
  .hstats > * , .card { border-radius: 18px; }

  /* list pages: search bar and chips in one tidy row each, buttons scroll sideways */
  .listbar, .toolbar { gap: 8px; margin-bottom: 12px; }
  .bulkbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px 12px; padding: 2px 14px 4px; gap: 8px;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 22px), transparent); mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 22px), transparent); }
  .bulkbar::-webkit-scrollbar { display: none; }
  .bulkbar > * { flex: none; }

  /* record cards: same width as the bar above, compact rows, light dividers */
  .table-wrap.cards { padding: 0 !important; margin: 0; }
  .table-wrap.cards tr { border-radius: 18px; padding: 12px 14px 10px; margin-bottom: 10px; border: 1px solid var(--border, rgba(0,0,0,.06));
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 16px -10px rgba(0, 0, 0, .18); animation: m-rise .45s cubic-bezier(.2, .8, .2, 1) backwards; transition: transform .16s var(--ease); }
  .table-wrap.cards tr:active { transform: scale(.985); }
  .table-wrap.cards tbody tr:nth-child(2) { animation-delay: 40ms; }  .table-wrap.cards tbody tr:nth-child(3) { animation-delay: 80ms; }
  .table-wrap.cards tbody tr:nth-child(4) { animation-delay: 120ms; } .table-wrap.cards tbody tr:nth-child(5) { animation-delay: 160ms; }
  .table-wrap.cards tbody tr:nth-child(n+6) { animation-delay: 200ms; }
  .table-wrap.cards td { padding: 5px 0; font-size: .9rem; align-items: center; }
  .table-wrap.cards td + td:not(.actions):not(.sel):not(.no-label) { border-top: 1px dashed var(--surface-2, rgba(0,0,0,.06)); }
  .table-wrap.cards td::before { font-size: .8rem; }
  .table-wrap.cards td.no-label { padding-bottom: 8px; }
  .table-wrap.cards td.actions { padding-top: 10px; gap: 8px; border-top: 1px solid var(--surface-2, rgba(0,0,0,.06)); margin-top: 4px; }
  .table-wrap.cards td.actions .btn, .table-wrap.cards td.actions .icon-btn { width: 38px; height: 38px; min-height: 38px; border-radius: 12px; padding: 0; }
  .empty, .table-wrap .empty-state { border-radius: 18px; }

  /* every button and tile gives a soft press */
  .btn, .chip, .rbtn, .icon-btn, .bnav.tabbar a, .bnav.tabbar button { -webkit-tap-highlight-color: transparent; transition: transform .16s var(--ease), background .2s, color .2s, box-shadow .2s; }
  .btn:active, .chip:active, .icon-btn:active { transform: scale(.95); }

  /* tab bar: active tab gets a small pill, icons lift a little */
  .bnav.tabbar { border-radius: 22px 22px 0 0; }
  .bnav.tabbar a:not(.fab), .bnav.tabbar button:not(.fab) { position: relative; }
  .bnav.tabbar a:not(.fab) svg, .bnav.tabbar button:not(.fab) svg { transition: transform .25s cubic-bezier(.2, .9, .3, 1.3); }
  .bnav.tabbar a.on:not(.fab) svg { transform: translateY(-2px) scale(1.08); }
  .bnav.tabbar a.on:not(.fab)::before { content: ""; position: absolute; top: 3px; left: 50%; width: 22px; height: 3px; border-radius: 3px;
    background: currentColor; transform: translateX(-50%); animation: m-pill .35s cubic-bezier(.2, .9, .3, 1.2) both; }
  .bnav.tabbar a:active:not(.fab) svg { transform: scale(.85); }
  .bnav.tabbar a.fab:active span { transform: scale(.92); }
  .bnav.tabbar a.fab span { transition: transform .18s var(--ease); }

  /* pop-ups slide up smoothly from the bottom */
  .modal-back.open .modal:not(.modal-alert) { animation: m-sheet .38s cubic-bezier(.2, .8, .2, 1) backwards; }
  .modal-back.open { animation: m-fade .25s ease both; }

  /* forms: a little more breathing room on small screens */
  .form-grid { gap: 12px; }
  .form-actions { gap: 8px; }
}
@keyframes m-rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes m-pop { from { opacity: 0; transform: translateY(10px) scale(.92); } }
@keyframes m-pill { from { width: 0; opacity: 0; } }
@keyframes m-sheet { from { transform: translateY(40px); opacity: .4; } }
@keyframes m-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .content > *, .mcard, .table-wrap.cards tr, .modal-back.open, .modal-back.open .modal, .bnav.tabbar a.on::before { animation: none !important; }
}

/* ---- cleaner icons ---- */
/* home module cards: white glyph on a soft frosted circle, no dark tile, no arrow bubble */
.mc-ic { background: rgba(255, 255, 255, .22) !important; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28) !important; border-radius: 50% !important;
  --cut: color-mix(in srgb, var(--c1) 55%, var(--c2)); color: #fff; }
.mc-go { display: none !important; }
[data-theme="dark"] .mc-ic { background: rgba(255, 255, 255, .16) !important; }
@media (max-width: 900px) {
  .mc-ic { width: 34px; height: 34px; }
  .mc-ic svg { width: 20px; height: 20px; }
  /* header buttons: light glass circles, thin icons, small round flag */
  .phone-head .rbtn { background: rgba(255, 255, 255, .14) !important; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22) !important; }
  .phone-head .rbtn svg.i { width: 18px; height: 18px; stroke-width: 1.9; }
  .phone-head .lang-btn img, .phone-head .lang-btn svg:not(.i) { width: 20px !important; height: 20px !important; border-radius: 50%; object-fit: cover; }
  .phone-head .me-btn { background: transparent !important; box-shadow: none !important; padding: 0; }
  .phone-head .me-btn img, .phone-head .me-btn .av, .phone-head .me-btn > span { width: 36px !important; height: 36px !important; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255, 255, 255, .55); }
  /* tab bar icons: thinner lines, badge tucked to the corner */
  .bnav.tabbar a:not(.fab) svg, .bnav.tabbar button:not(.fab) svg { width: 22px; height: 22px; stroke-width: 1.8; }
  .bnav.tabbar .bell > i { top: -6px !important; right: -9px !important; left: auto !important; min-width: 17px; height: 17px; padding: 0 4px; font-size: .62rem; line-height: 17px;
    border-radius: 9px; box-shadow: 0 0 0 2px var(--surface); font-style: normal; }
  /* card action buttons: soft tinted squares instead of outlined boxes */
  .table-wrap.cards td.actions .btn, .table-wrap.cards td.actions .icon-btn { border-width: 0 !important; background: var(--surface-2) !important; }
  .table-wrap.cards td.actions svg.i { width: 18px; height: 18px; stroke-width: 1.9; }
}
@media (max-width: 900px) {
  .mcard { min-height: 98px !important; }
  .table-wrap.cards td.actions .act { width: 38px; height: 38px; border-radius: 12px; border: 0 !important; display: inline-grid; place-items: center; }
  .table-wrap.cards td.actions .act-view { background: color-mix(in srgb, var(--home-a, #691103) 10%, transparent) !important; }
  .table-wrap.cards td.actions .act-edit { background: color-mix(in srgb, #ff9f0a 14%, transparent) !important; }
  .table-wrap.cards td.actions .btn-icon { color: #e5484d; background: color-mix(in srgb, #e5484d 10%, transparent) !important; }
}

/* ---- Student leave ---- */
.slv-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.slv-tile { position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 12px 14px;
  border-radius: 16px; background: var(--surface); color: inherit; box-shadow: var(--shadow-sm); border: 1.5px solid transparent; transition: transform .18s var(--ease), border-color .2s; }
.slv-tile:hover { text-decoration: none; transform: translateY(-2px); }
.slv-tile .ic { grid-row: 1 / 3; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.slv-tile b { font-size: 1.35rem; line-height: 1.1; } .slv-tile small { color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slv-tile.t-away .ic { background: linear-gradient(150deg, #ffb340, #ff9500); } .slv-tile.t-late .ic { background: linear-gradient(150deg, #ff6b6b, #e5484d); }
.slv-tile.t-up .ic { background: linear-gradient(150deg, #5ac8fa, #0a84ff); }
.slv-tile.on { border-color: var(--home-a, #691103); }
.slv-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 12px; }
.slv-tabs::-webkit-scrollbar { display: none; }
.slv-tabs a { flex: none; padding: 7px 14px; border-radius: 999px; background: var(--surface); color: var(--text); font-size: .86rem; font-weight: 500; box-shadow: var(--shadow-sm); }
.slv-tabs a:hover { text-decoration: none; } .slv-tabs a.on { background: var(--home-a, #691103); color: #fff; font-weight: 600; }
.slv-reason { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slv-row.s-late td:first-child { box-shadow: inset 3px 0 0 #e5484d; }
.slv-clip { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2); color: var(--muted); vertical-align: middle; }
.slv-back-btn { white-space: nowrap; }
.slv-kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.slv-kinds label, .slv-dec label { cursor: pointer; }
.slv-kinds input, .slv-dec input { position: absolute; opacity: 0; pointer-events: none; }
.slv-kinds span { display: inline-block; padding: 8px 13px; border-radius: 999px; background: var(--surface-2); font-size: .86rem; transition: background .2s, color .2s, transform .15s; }
.slv-kinds input:checked + span { background: var(--home-a, #691103); color: #fff; font-weight: 600; }
.slv-kinds label:active span { transform: scale(.95); }
.slv-dec { padding: 3px; } .slv-dec label { flex: 1; text-align: center; }
.slv-dec span { display: block; padding: 7px 8px; border-radius: 8px; font-size: .88rem; }
.slv-dec input:checked + span { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); font-weight: 600; }
.slv-dec label:last-child input:checked + span { color: #e5484d; }
.slv-quick { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.slv-quick button { border: 0; background: var(--surface-2); color: var(--text); padding: 4px 10px; border-radius: 999px; font: inherit; font-size: .76rem; cursor: pointer; }
.slv-quick button.on { background: var(--home-a, #691103); color: #fff; }
.slv-hist { display: grid; gap: 8px; }
.slv-h { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.slv-h .d { text-align: center; line-height: 1.1; } .slv-h .d b { display: block; font-size: .95rem; } .slv-h .d small { color: var(--muted); font-size: .72rem; }
.slv-h .r { display: flex; gap: 6px; align-items: center; }
.slv-h .act { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--surface); }
@media (max-width: 640px) {
  .slv-tiles { gap: 8px; } .slv-tile { grid-template-columns: 1fr; padding: 10px; text-align: center; justify-items: center; row-gap: 4px; }
  .slv-tile .ic { grid-row: auto; width: 34px; height: 34px; } .slv-tile small { white-space: normal; line-height: 1.2; }
  .slv-reason { max-width: 190px; }
  .slv-h { grid-template-columns: 44px minmax(0, 1fr); } .slv-h .r { grid-column: 1 / -1; justify-content: flex-end; }
}

/* ---- Staff leave request: tap-friendly ---- */
.lvf-types { display: flex; flex-wrap: wrap; gap: 7px; }
.lvf-types button { border: 0; padding: 9px 14px; border-radius: 999px; background: var(--surface-2); color: var(--text); font: inherit; font-size: .9rem; cursor: pointer;
  transition: background .2s, color .2s, transform .15s; }
.lvf-types button small { opacity: .7; }
.lvf-types button.on { background: var(--home-a, #691103); color: #fff; font-weight: 600; box-shadow: 0 6px 14px -8px var(--home-a, #691103); }
.lvf-types button:active { transform: scale(.95); }
.lvf-hide { position: absolute !important; opacity: 0; height: 1px !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; width: 1px !important; pointer-events: none; }
.field:has(.lvf-hide) { position: relative; }
.lvf-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: -4px; }
.lvf-quick button { border: 1px solid var(--border, rgba(0,0,0,.08)); background: var(--surface); color: var(--text); padding: 6px 12px; border-radius: 999px; font: inherit; font-size: .8rem; cursor: pointer; transition: all .2s; }
.lvf-quick button.on { background: color-mix(in srgb, var(--home-a, #691103) 12%, transparent); border-color: var(--home-a, #691103); color: var(--home-a, #691103); font-weight: 600; }
.lvf-quick button:nth-child(4) { margin-left: 8px; }
#lvPreview #lvDays { transition: transform .25s; }
@media (max-width: 768px) {
  #leaveForm .drawer-foot { gap: 8px; }
  #leaveForm .drawer-foot .btn { flex: 1; height: 48px; font-size: 1rem; border-radius: 14px; }
  #leaveForm .drawer-foot .btn-success { flex: 2; }
  .lvf-quick button:nth-child(4) { margin-left: 0; }
}

/* ---- Sign-in: remember me ---- */
.login-remember { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: .92rem; user-select: none; margin-top: -2px; }
.login-remember input { position: absolute; opacity: 0; pointer-events: none; }
.login-remember .box { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--border, #c7c7cc); background: var(--surface); display: grid; place-items: center; transition: all .2s; flex: none; }
.login-remember input:checked + .box { background: var(--home-a, #691103); border-color: var(--home-a, #691103); }
.login-remember input:checked + .box::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.2px 2.2px 0; transform: translateY(-1px) rotate(45deg); }
.login-remember input:focus-visible + .box { box-shadow: 0 0 0 3px color-mix(in srgb, var(--home-a, #691103) 30%, transparent); }

/* ---- Student import ---- */
.imp-steps { list-style: none; counter-reset: s; padding: 0; margin: 0 0 6px; display: grid; gap: 14px; }
.imp-steps li { counter-increment: s; position: relative; padding-left: 40px; display: grid; gap: 4px; justify-items: start; }
.imp-steps li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--home-a, #691103) 12%, transparent); color: var(--home-a, #691103); font-weight: 700; }
.imp-steps span { color: var(--muted); font-size: .86rem; }
.imp-steps .btn { margin-top: 4px; }
.imp-drop { margin-top: 6px; width: 100%; display: flex; align-items: center; gap: 10px; padding: 16px; border: 1.5px dashed var(--border, #c7c7cc); border-radius: 14px; cursor: pointer; color: var(--muted); transition: all .2s; }
.imp-drop:hover { border-color: var(--home-a, #691103); }
.imp-drop.has { border-style: solid; border-color: var(--success, #34c759); color: var(--text); background: color-mix(in srgb, var(--success, #34c759) 8%, transparent); }
.imp-sum { display: flex; flex-wrap: wrap; gap: 12px; align-items: stretch; }
.imp-file { flex: 1 1 260px; display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); }
.imp-tiles { display: flex; gap: 10px; flex: 0 1 auto; }
.imp-tiles > div { min-width: 120px; padding: 12px 16px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); display: grid; }
.imp-tiles b { font-size: 1.6rem; line-height: 1.1; } .imp-tiles span { color: var(--muted); font-size: .82rem; }
.imp-tiles .ok b { color: var(--success, #34c759); } .imp-tiles .bad b { color: var(--danger, #e5484d); }
.imp-bad { display: grid; gap: 8px; }
.imp-row { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--danger, #e5484d) 7%, transparent); }
.imp-row .ln { font-weight: 700; color: var(--danger, #e5484d); font-size: .86rem; }
.imp-row ul { margin: 4px 0 0; padding-left: 18px; font-size: .88rem; }
.imp-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
@media (max-width: 640px) { .imp-tiles { width: 100%; } .imp-tiles > div { flex: 1; min-width: 0; } .imp-actions .btn, .imp-actions form { flex: 1; } .imp-actions form .btn { width: 100%; } }
@media (max-width: 640px) {
  #slvForm .form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  #slvForm .form-actions .btn-success { grid-column: 1 / -1; order: -1; height: 48px; font-size: 1rem; }
  #slvForm .form-actions .btn { justify-content: center; }
}

/* =========================================================
   Employee / student detail: small profile card, standard text, Khmer and English the same size
   ========================================================= */
.emp-detail:not(.side-min) .emp-side { grid-template-columns: 46px minmax(0, 1fr); column-gap: 10px; padding: 12px 10px 10px; }
.emp-detail:not(.side-min) .es-photo .avatar, .emp-detail:not(.side-min) .es-photo .avatar.xl { width: 44px !important; height: 44px !important; font-size: .82rem !important;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--accent) !important; }
.emp-detail:not(.side-min) .es-photo .cam { width: 18px; height: 18px; right: -5px; bottom: -3px; }
.emp-detail:not(.side-min) .es-photo .cam svg { width: 10px; height: 10px; }
.emp-detail:not(.side-min) .es-name { margin: 0 30px 6px 0; row-gap: 0; }
/* name lines: Khmer and English exactly the same size and weight */
.emp-detail:not(.side-min) .es-name > .kh, .emp-detail:not(.side-min) .es-name > b { font-size: .9rem !important; font-weight: 600; line-height: 1.45; color: var(--text); }
.emp-detail:not(.side-min) .es-name .es-ids { font-size: .74rem !important; line-height: 1.5; }
.emp-detail:not(.side-min) .es-badges .badge { font-size: .68rem; padding: 0 7px; line-height: 1.7; }
.emp-detail:not(.side-min) .es-badges .badge svg { width: 11px; height: 11px; }
.emp-detail:not(.side-min) .es-acts .pen { width: 26px !important; height: 26px !important; }
.emp-detail:not(.side-min) .es-acts .pen svg { width: 13px; height: 13px; }
.emp-detail:not(.side-min) .side-min-btn { width: 26px; height: 26px; top: 8px; right: 8px; }
.emp-detail .es-nav { padding-top: 8px; }
.emp-detail .es-nav a { padding: 7px 12px; font-size: .86rem; gap: 10px; }
.emp-detail .es-nav a svg { width: 16px; height: 16px; }
/* main area: standard sizes */
.emp-main .section-title { font-size: .95rem !important; margin: 14px 0 10px !important; }
.emp-main .section-title:first-child { margin-top: 2px !important; }
.emp-main .info-grid { gap: 10px 22px; }
.emp-main .info-grid .k { font-size: .76rem; margin-bottom: 1px; }
.emp-main .info-grid .v { font-size: .88rem; font-weight: 500; line-height: 1.45; }
.emp-main .pen:not(.gray) { width: 28px !important; height: 28px !important; }
.emp-main .pen svg { width: 13px; height: 13px; }
/* Khmer text everywhere: same size as the English next to it, never smaller, room for the marks above and below */
.kh { line-height: 1.5; }
.info-grid .v .kh { font-size: inherit !important; font-weight: inherit; }
@media (max-width: 900px) {
  .emp-side { padding: 12px 10px 6px !important; }
  .emp-detail .es-photo .avatar { width: 52px !important; height: 52px !important; font-size: .9rem !important; }
  .emp-detail .es-nav a { padding: 7px 11px; font-size: .84rem; }
}

/* add / edit forms: photo picker half size */
.st-add-top { gap: 14px; align-items: flex-end; }
:is(.modal, .drawer, .fs-id) .photo-pick .avatar.xl { width: 58px !important; height: 58px !important; font-size: .95rem;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--accent) !important; }
:is(.modal, .drawer, .fs-id) .photo-pick .avatar.xl svg { width: 22px !important; height: 22px !important; }
:is(.modal, .drawer, .fs-id) .photo-pick .cam { width: 22px !important; height: 22px !important; right: -4px !important; bottom: -2px !important; box-shadow: 0 0 0 2px var(--surface) !important; }
:is(.modal, .drawer, .fs-id) .photo-pick .cam svg { width: 12px; height: 12px; }
.st-add-top .photo-pick { flex: none; margin-bottom: 4px !important; }
@media (max-width: 640px) { .st-add-top { flex-direction: row; align-items: flex-end; } .st-add-top .photo-pick { align-self: flex-end; } }

/* ---- Shift cards (compact) ---- */
.sh-head { margin-top: 6px; }
.sh-intro { margin: -6px 0 14px; max-width: 900px; }
.sh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.sh-card { position: relative; background: var(--surface); border-radius: 16px; padding: 12px 14px 12px; box-shadow: var(--shadow-sm); border: 1px solid var(--border, rgba(0,0,0,.05)); overflow: hidden; transition: transform .18s var(--ease), box-shadow .2s; }
.sh-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c); }
.sh-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.sh-card.off { opacity: .55; }
.sh-top { display: flex; align-items: center; gap: 8px; }
.sh-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.sh-name { flex: 1; min-width: 0; line-height: 1.25; }
.sh-name b { display: block; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-name small { color: var(--muted); font-size: .72rem; letter-spacing: .03em; }
.sh-top .act { width: 30px; height: 30px; border-radius: 10px; border: 0; display: inline-grid; place-items: center; background: var(--surface-2); color: var(--text); cursor: pointer; }
.sh-top .act-del { color: var(--danger, #e5484d); }
.sh-top form { margin: 0; }
.sh-time { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; }
.sh-time .badge { font-size: .66rem; }
.sh-hours { margin-left: auto; font-size: .78rem; font-weight: 600; color: var(--muted); }
.sh-bar { position: relative; height: 6px; border-radius: 6px; background: var(--surface-2); margin: 8px 0 10px; overflow: hidden; }
.sh-bar i { position: absolute; top: 0; bottom: 0; }
.sh-bar .w { background: var(--c); border-radius: 6px; }
.sh-bar .b { background: repeating-linear-gradient(45deg, #fff 0 2px, color-mix(in srgb, var(--c) 45%, #fff) 2px 4px); }
.sh-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.sh-tags .badge { font-size: .7rem; display: inline-flex; align-items: center; gap: 3px; }
.sh-tags .badge svg { width: 11px; height: 11px; }
.sh-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border, rgba(0,0,0,.08)); }
.sh-kv div { display: grid; line-height: 1.3; }
.sh-kv span { font-size: .7rem; color: var(--muted); }
.sh-kv b { font-size: .82rem; font-weight: 600; }

/* ---- Recycle bin ---- */
.rc-note { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); margin-bottom: 12px; }
.rc-note .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(150deg, #8e8e93, #636366); flex: none; }
.rc-bar { margin-bottom: 12px; }
.rc-list { display: grid; gap: 8px; }
.rc-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); }
.rc-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; color: #fff; background: #8e8e93; }
.rc-ic.m-hr { background: #34c759; } .rc-ic.m-students { background: #5e5ce6; } .rc-ic.m-library { background: #ff6b6b; } .rc-ic.m-assets { background: #0a84ff; }
.rc-ic.m-inventory { background: #a3c93a; } .rc-ic.m-leave { background: #30b0c7; } .rc-ic.m-payroll { background: #ff9f0a; } .rc-ic.m-tasks { background: #64d2ff; }
.rc-ic.m-notes { background: #ffcc00; } .rc-ic.m-appointments { background: #ff375f; } .rc-ic.m-administration { background: #3a3a3c; }
.rc-main { flex: 1; min-width: 0; }
.rc-main b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .92rem; }
.rc-acts { display: flex; gap: 6px; align-items: center; }
.rc-acts form { margin: 0; }
@media (max-width: 640px) {
  .rc-row { flex-wrap: wrap; }
  .rc-main { flex-basis: calc(100% - 50px); }
  .rc-row > .badge { margin-left: 46px; }
  .rc-acts { margin-left: auto; }
}
.lv-na { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
/* leave request: say why it cannot be sent */
#lvSubmit.is-blocked { opacity: .55; filter: saturate(.4); }
.lv-why { order: -1; flex: 1 1 100%; font-size: .8rem; color: var(--danger, #e5484d); background: color-mix(in srgb, var(--danger, #e5484d) 8%, transparent); border-radius: 10px; padding: 6px 10px; line-height: 1.35; }
.lv-why.shake { animation: lv-shake .4s; }
@keyframes lv-shake { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
#leaveForm .drawer-foot { flex-wrap: wrap; }

/* ---- Leave: came to work ---- */
.lv-ctw { margin-top: 16px; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, #ff9f0a 10%, transparent); border: 1px solid color-mix(in srgb, #ff9f0a 35%, transparent); display: grid; gap: 4px; }
.lv-ctw .h { display: flex; align-items: center; gap: 6px; }
.lv-ctw-btn { margin-top: 16px; text-align: right; }
.lv-days { display: grid; gap: 6px; }
.lv-day { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; background: var(--surface-2); cursor: pointer; }
.lv-day input { width: 20px; height: 20px; accent-color: var(--home-a, #691103); flex: none; }
.lv-day .d { flex: 1; display: grid; line-height: 1.25; } .lv-day .d small { color: var(--muted); font-size: .74rem; }
.lv-day .s { font-size: .78rem; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.lv-day .s.ok { color: var(--success, #34c759); font-weight: 600; }
.lv-day .s svg { width: 13px; height: 13px; }
.badge svg.i { width: 11px; height: 11px; vertical-align: -1px; }

/* =========================================================
   Phone home – app style: profile header, floating quick actions, "waiting for you" cards, white app grid
   ========================================================= */
.m-home { display: none; }
@media (max-width: 640px) {
  body:has(.m-home) .phone-head { border-radius: 0 !important; box-shadow: none !important; }
  .m-home { display: block; margin: -18px -14px 14px; width: calc(100% + 28px); max-width: none; justify-self: start; }
  .m-hero { position: relative; display: grid; justify-items: center; text-align: center; gap: 4px; padding: 8px 20px 64px; color: #fff;
    background: radial-gradient(circle at 85% 0%, rgba(255,255,255,.16) 0 70px, transparent 71px), radial-gradient(circle at 5% 100%, rgba(255,255,255,.1) 0 90px, transparent 91px),
                linear-gradient(170deg, var(--home-a, #691103), var(--home-b, #3f0a02));
    border-radius: 0 0 30px 30px; animation: m-fade .4s ease both; }
  .m-av { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: rgba(255,255,255,.22);
    box-shadow: 0 0 0 3px rgba(255,255,255,.85), 0 8px 20px -6px rgba(0,0,0,.35); font-weight: 700; font-size: 1.2rem; animation: m-pop .5s .05s cubic-bezier(.2,.9,.3,1.2) both; }
  .m-av img { width: 100%; height: 100%; object-fit: cover; }
  .m-who { display: grid; margin-top: 6px; } .m-who b { font-size: 1.12rem; letter-spacing: -.01em; } .m-who small { opacity: .85; font-size: .82rem; }
  .m-hi { font-size: .74rem; opacity: .75; margin-top: 2px; }
  /* first block after the header floats over it */
  .m-hero + * { margin-top: -46px; position: relative; z-index: 1; }
  .m-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 4px; margin-left: 14px; margin-right: 14px; padding: 14px 8px 12px;
    background: var(--surface); border-radius: 20px; box-shadow: 0 12px 30px -12px rgba(0,0,0,.28); animation: m-rise .5s .08s cubic-bezier(.2,.8,.2,1) backwards; }
  .m-wait + .m-quick { margin-top: 12px; }
  .m-quick a { display: grid; justify-items: center; gap: 6px; color: var(--text); text-align: center; font-size: .74rem; line-height: 1.2; padding: 4px 2px; border-radius: 14px; transition: transform .15s; }
  .m-quick a:active { transform: scale(.94); }
  .m-quick a:hover { text-decoration: none; }
  .m-quick .qi { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(150deg, var(--q1), var(--q2));
    box-shadow: 0 6px 14px -6px var(--q2); }
  .m-quick .qi svg { width: 21px; height: 21px; }
  .m-wait { padding: 0 0 0 14px; }
  .m-wait-h { display: flex; align-items: center; gap: 6px; color: #fff; font-size: .82rem; margin: 0 0 8px 4px; }
  .m-wait-h span { background: #fff; color: var(--home-a, #691103); border-radius: 99px; padding: 0 7px; font-weight: 700; font-size: .72rem; }
  .m-wrow { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding: 0 14px 16px 0; margin-bottom: -10px; scroll-snap-type: x mandatory; }
  .m-wrow::-webkit-scrollbar { display: none; }
  .m-wcard { flex: 0 0 78%; scroll-snap-align: start; background: var(--surface); color: var(--text); border-radius: 16px; box-shadow: 0 10px 26px -12px rgba(0,0,0,.3);
    display: grid; overflow: hidden; animation: m-rise .45s cubic-bezier(.2,.8,.2,1) backwards; }
  .m-wcard:hover { text-decoration: none; }
  .m-wtop { display: flex; align-items: center; gap: 10px; padding: 12px; }
  .m-wtop > span:last-child { display: grid; min-width: 0; } .m-wtop b { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .m-wtop small { color: var(--muted); font-size: .74rem; }
  .m-wbot { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--border, rgba(0,0,0,.07)); font-size: .74rem; color: var(--muted); }
  .m-wbot span { padding: 8px 12px; text-align: center; } .m-wbot span + span { border-left: 1px solid var(--border, rgba(0,0,0,.07)); color: var(--home-a, #691103); font-weight: 600; }

  /* the desktop banner is replaced by the header above */
  .home .hero { display: none !important; }
  /* app grid: white tiles, round coloured icon, name below */
  .mcards { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 10px !important; }
  .mcard { min-height: 0 !important; background: var(--surface) !important; color: var(--text) !important; border-radius: 18px !important; padding: 14px 6px 12px !important;
    display: grid !important; justify-items: center; align-content: start; gap: 8px; text-align: center; box-shadow: 0 4px 14px -8px rgba(0,0,0,.22) !important; }
  .mcard::before, .mcard::after { display: none !important; }
  .mcard .mc-ic { position: static !important; width: 46px !important; height: 46px !important; border-radius: 50% !important; margin: 0 !important;
    background: linear-gradient(150deg, var(--c1), var(--c2)) !important; box-shadow: 0 6px 14px -6px var(--c2) !important; --cut: var(--c2); color: #fff; }
  .mcard .mc-ic svg { width: 24px !important; height: 24px !important; }
  .mcard .mc-t { position: static !important; font-size: .76rem !important; font-weight: 600; line-height: 1.2; color: var(--text) !important; margin: 0 !important; }
  .mcard .mc-s, .mcard .mc-go { display: none !important; }
}

/* phone home header: logo in the middle, no duplicate name or profile picture (the big photo below opens the account menu) */
@media (max-width: 900px) {
  .phone-head.is-home { display: grid !important; grid-template-columns: 1fr auto 1fr; align-items: center; }
  .phone-head.is-home > .t, .phone-head.is-home > .me-wrap { display: none !important; }
  .phone-head.is-home > a:first-child { grid-column: 2; grid-row: 1; justify-self: center; }
  .phone-head.is-home > a:first-child { display: grid; place-items: center; }
  .phone-head.is-home > a:first-child .mark { width: 52px !important; height: 52px !important; border-radius: 15px !important; padding: 4px !important;
    background: #fff !important; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .35) !important; }
  .phone-head.is-home > a:first-child .mark img { width: 100% !important; height: 100% !important; object-fit: contain !important; border-radius: 11px; }
  .phone-head.is-home > .lang-wrap { grid-column: 1; grid-row: 1; justify-self: start; }
  .phone-head.is-home > [data-theme-toggle] { grid-column: 3; grid-row: 1; justify-self: end; }
  .m-av[data-me] { cursor: pointer; }
}
@media (max-width: 640px) {
  /* home: header and profile area are one smooth colour, no line between them */
  body:has(.m-home) .phone-head.is-home { background: var(--home-a, #691103) !important; }
  .m-hero { background: radial-gradient(circle at 105% 60%, rgba(255,255,255,.1) 0 80px, transparent 81px), radial-gradient(circle at 5% 100%, rgba(255,255,255,.1) 0 90px, transparent 91px),
                        linear-gradient(180deg, var(--home-a, #691103), var(--home-b, #3f0a02)) !important; }
}

/* =========================================================
   Home header + photo slideshow (Nov 2026): logo left; language, dark mode, profile right; photos behind
   ========================================================= */
.hs { position: absolute; inset: 0; overflow: hidden; z-index: 0; border-radius: inherit; }
.hs-s { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; transform: scale(1.06);
  transition: opacity 1.1s ease, transform 6s ease-out; }
.hs-s.on { opacity: 1; transform: scale(1); }
.hs-shade { position: absolute; inset: 0; z-index: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(90deg, rgba(40, 4, 14, .8) 0%, rgba(40, 4, 14, .45) 45%, rgba(0, 0, 0, .08) 78%), linear-gradient(0deg, rgba(0, 0, 0, .35), transparent 40%); }
.hs-foot { position: absolute; z-index: 2; right: 24px; bottom: 18px; display: flex; align-items: center; gap: 12px; font-size: .8rem; color: #fff; max-width: 60%; }
.hs-cap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 6px rgba(0, 0, 0, .45); transition: opacity .4s; }
.hs-dots { display: inline-flex; gap: 5px; flex: none; }
.hs-dots button { width: 6px; height: 6px; padding: 0; border: 0; border-radius: 9px; background: rgba(255, 255, 255, .5); cursor: pointer; transition: width .3s, background .3s; }
.hs-dots button.on { width: 18px; background: #fff; }
.hs-arr { position: absolute; z-index: 2; right: 20px; top: 18px; display: flex; gap: 8px; opacity: 0; transition: opacity .25s; }
.hero:hover .hs-arr { opacity: 1; }
.hs-arr button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .16); color: #fff;
  font-size: 1.2rem; line-height: 1; cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.hs-arr button:hover { background: rgba(255, 255, 255, .3); }
/* desktop banner with photos: the drawn picture and verse step aside */
.hero.has-slides { min-height: 250px; box-shadow: 0 14px 34px -14px rgba(60, 6, 18, .45); }
.hero.has-slides .hero-art, .hero.has-slides .hero-verse { display: none; }
.hero.has-slides .hero-tx { z-index: 1; }
.hero.has-slides .hero-tx, .hero.has-slides .hero-name { text-shadow: 0 1px 10px rgba(0, 0, 0, .3); }
.hero.has-slides .hchip, .hero.has-slides .hero-meta > span { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }

@media (max-width: 900px) {
  /* header on Home: logo + name left; language, dark mode, small profile picture right */
  .phone-head.is-home { display: flex !important; align-items: center; gap: 8px; }
  .phone-head.is-home > a:first-child { order: 0; flex: none; }
  .phone-head.is-home > a:first-child .mark { width: 40px !important; height: 40px !important; border-radius: 12px !important; padding: 3px !important; }
  .phone-head.is-home > .t { display: -webkit-box !important; order: 1; flex: 1; min-width: 0; color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, .25); }
  .phone-head.is-home > .lang-wrap { order: 2; }
  .phone-head.is-home > [data-theme-toggle] { order: 3; }
  .phone-head.is-home > .me-wrap { display: block !important; order: 4; }
  .phone-head.is-home .me-btn img, .phone-head.is-home .me-btn .av, .phone-head.is-home .me-btn > span { width: 32px !important; height: 32px !important; font-size: .72rem; }
}
@media (max-width: 640px) {
  /* the header floats over the photos and turns solid when you scroll */
  body:has(.m-home) .phone-head.is-home { background: transparent !important; box-shadow: none !important; transition: background .3s, box-shadow .3s; }
  body:has(.m-home) .phone-head.is-home.solid { background: linear-gradient(135deg, var(--home-a, #691103), var(--home-b, #3f0a02)) !important; box-shadow: 0 4px 16px -6px rgba(0, 0, 0, .3) !important; }
  .m-home .m-hero { margin-top: calc(-1 * (62px + env(safe-area-inset-top))); padding: calc(84px + env(safe-area-inset-top)) 20px 92px; min-height: calc(300px + env(safe-area-inset-top));
    display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; text-align: left; overflow: hidden; }
  .m-hero.has-slides { background: #3a0b20 !important; }
  .m-hero .hs-shade { background: linear-gradient(180deg, rgba(0, 0, 0, .45) 0%, rgba(0, 0, 0, .05) 34%, rgba(0, 0, 0, .12) 58%, rgba(60, 6, 18, .82) 100%); }
  .m-tx { position: relative; z-index: 1; display: grid; gap: 2px; animation: m-rise .5s .05s cubic-bezier(.2, .8, .2, 1) backwards; }
  .m-tx .m-hi { font-size: .8rem; opacity: .9; margin: 0; }
  .m-name { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
  .m-job { font-size: .84rem; opacity: .88; }
  .m-hero.has-slides .m-tx { text-shadow: 0 1px 8px rgba(0, 0, 0, .35); }
  .m-hero .hs-foot { left: 20px; right: 20px; bottom: 58px; max-width: none; justify-content: space-between; font-size: .72rem; }
  .m-hero .hs { border-radius: 0 0 30px 30px; }
}

/* profile card (tap your picture): photo, details, leave left, links */
.me-pop .pc { display: grid; gap: 10px; padding: 4px 4px 10px; border-bottom: 1px solid var(--border, rgba(0, 0, 0, .08)); margin-bottom: 6px; }
.pc-top { display: flex; gap: 12px; align-items: center; }
.pc-av { width: 56px; height: 56px; border-radius: 50%; overflow: hidden; flex: none; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 1.1rem;
  background: linear-gradient(160deg, var(--home-a, #691103), var(--home-b, #3f0a02)); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px rgba(105, 17, 3, .22); }
.pc-av img { width: 100%; height: 100%; object-fit: cover; }
.pc-who { min-width: 0; display: grid; } .pc-who b { font-size: 1.02rem; } .pc-who .kh { font-size: .86rem; color: var(--text-2, var(--muted)); } .pc-who small { color: var(--muted); font-size: .78rem; }
.pc-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.pc-tags span { font-size: .7rem; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--surface-2, rgba(120, 120, 128, .12)); }
.pc-tags .r { background: rgba(105, 17, 3, .1); color: var(--home-a, #691103); }
.pc-info { background: var(--surface-2, rgba(120, 120, 128, .08)); border-radius: 14px; padding: 2px 12px; font-size: .8rem; }
.pc-info div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border, rgba(0, 0, 0, .06)); }
.pc-info div:last-child { border: 0; } .pc-info span { color: var(--muted); flex: none; } .pc-info em { font-style: normal; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-bal { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; }
.pc-bal a { background: var(--surface-2, rgba(120, 120, 128, .08)); border-radius: 12px; padding: 7px 4px; text-align: center; font-size: .7rem; color: var(--muted); }
.pc-bal a:hover { text-decoration: none; } .pc-bal b { display: block; font-size: 1.05rem; color: var(--text); }
.me-pop.has-card { width: 340px; max-height: calc(100vh - 80px); overflow-y: auto; }
@media (max-width: 640px) {
  /* phone: slides up from the bottom */
  .me-pop.has-card { position: fixed !important; left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important; width: auto !important; max-height: 86vh;
    border-radius: 24px 24px 0 0 !important; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)) !important; z-index: 1000;
    transform: translateY(105%); transition: transform .32s cubic-bezier(.2, .8, .2, 1), visibility 0s .32s; visibility: hidden; display: block !important; }
  .me-pop.has-card.open { transform: none; visibility: visible; transition: transform .32s cubic-bezier(.2, .8, .2, 1); }
  .me-pop.has-card::before { content: ""; display: block; width: 38px; height: 5px; border-radius: 9px; background: rgba(120, 120, 128, .35); margin: 0 auto 12px; }
  .me-pop.has-card .pc-links { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .me-pop.has-card .pc-links > a, .me-pop.has-card .pc-links > form > button { display: grid !important; justify-items: center; gap: 5px; text-align: center; font-size: .68rem !important;
    padding: 6px 2px !important; line-height: 1.2; width: 100%; }
  .me-pop.has-card .pc-links svg.i { width: 40px !important; height: 40px !important; padding: 10px; border-radius: 14px; background: var(--surface-2, rgba(120, 120, 128, .12)); box-sizing: border-box; }
  .me-pop.has-card .pc-links .danger svg.i { background: rgba(105, 17, 3, .1); }
  .me-dim { position: fixed; inset: 0; background: rgba(0, 0, 0, .38); z-index: 999; opacity: 0; pointer-events: none; transition: opacity .3s; }
  .me-dim.on { opacity: 1; pointer-events: auto; }
}
/* System Settings › Home slides */
.hs-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.hs-item { border: 1px solid var(--border, rgba(0, 0, 0, .08)); border-radius: 14px; overflow: hidden; background: var(--surface); }
.hs-item img { width: 100%; height: 120px; object-fit: cover; display: block; }
.hs-f { display: grid; gap: 8px; padding: 10px; } .hs-r { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hs-defs { display: flex; gap: 6px; margin-top: 8px; } .hs-defs img { width: 72px; height: 40px; object-fit: cover; border-radius: 8px; }
@media (max-width: 900px) {
  .phone-head.is-home > .t.home { font-size: .78rem !important; font-weight: 600; line-height: 1.2; letter-spacing: 0; -webkit-line-clamp: 2; max-width: 150px; opacity: .97; }
}
@media (max-width: 640px) {
  body:has(.m-home) .phone-head.is-home.solid { background: color-mix(in srgb, var(--home-b, #3f0a02) 62%, transparent) !important;
    backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); }
  body:has(.m-home) .phone-head.is-home .rbtn { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
}
@media (max-width: 640px) { .me-pop.has-card { animation: none !important; } }
@media (max-width: 900px) {
  .phone-head.is-home > .t.home { margin-right: auto; font-size: .72rem !important; max-width: 140px; }
}
@media (max-width: 640px) {
  /* photos run right up to the top edge, under the header */
  body:has(.m-home) .phone-head.is-home:not(.solid) { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  .m-home .m-hero { margin-top: calc(-1 * (84px + env(safe-area-inset-top))); padding-top: calc(100px + env(safe-area-inset-top)); min-height: calc(322px + env(safe-area-inset-top)); }
}
.me-pop .pc-bal a { display: block !important; padding: 7px 4px !important; text-align: center; font-size: .7rem !important; color: var(--muted) !important; }
.me-pop .pc-bal a b { display: block; font-size: 1.05rem; color: var(--text); line-height: 1.2; }
/* phone header on every page: logo + church name (small, two lines), same as Home */
@media (max-width: 900px) {
  .phone-head > .t.home { display: -webkit-box !important; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: normal; overflow: hidden;
    font-size: .72rem !important; font-weight: 600; line-height: 1.2; letter-spacing: 0; max-width: 140px; margin-right: auto; flex: 1; min-width: 0; color: #fff; }
  .phone-head > a:first-child .mark { width: 40px !important; height: 40px !important; border-radius: 12px !important; padding: 3px !important; background: #fff !important; }
  .phone-head > a:first-child .mark img { width: 100% !important; height: 100% !important; object-fit: contain !important; border-radius: 9px; }
}
/* phone: the main "add" button of a page becomes a round + button floating above the bottom bar */
@media (max-width: 640px) {
  .m-fab { position: fixed !important; right: 18px; bottom: calc(82px + env(safe-area-inset-bottom)); z-index: 45; width: 58px; height: 58px; padding: 0 !important;
    border-radius: 50% !important; display: grid !important; place-items: center; background: linear-gradient(160deg, var(--home-a, #691103), var(--home-b, #3f0a02)) !important;
    color: #fff !important; box-shadow: 0 10px 24px -6px rgba(143, 20, 48, .55) !important; animation: m-pop .45s .15s cubic-bezier(.2, .9, .3, 1.2) backwards; transition: transform .15s; }
  .m-fab:active { transform: scale(.92); }
  .m-fab > span { display: none; }
  .m-fab svg.i { width: 28px !important; height: 28px !important; stroke-width: 2.4; margin: 0 !important; }
  body:has(.m-fab) .content { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) { .m-fab svg.i, .m-fab .i { background: none !important; box-shadow: none !important; padding: 0 !important; border-radius: 0 !important; } .m-fab::before, .m-fab::after { display: none !important; } }
/* phone: smaller cards */
@media (max-width: 640px) {
  .lv-bal { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 8px !important; margin-bottom: 14px !important; }
  .lv-bal .stat { padding: 9px 10px 10px !important; border-radius: 14px !important; border-top-width: 3px !important; gap: 1px; min-height: 0 !important; }
  .lv-bal .stat .l { font-size: .68rem !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lv-bal .stat .n { font-size: 1.3rem !important; line-height: 1.15; }
  .lv-bal .stat .n .muted { font-size: .66rem !important; }
  .lv-bal .stat .n[style] { font-size: .9rem !important; padding: 4px 0 2px; }
  .lv-bal .stat .small { font-size: .6rem !important; line-height: 1.3; }
  .stat { padding: 12px 14px; }
  .card { padding: 14px; border-radius: 16px; }
  .card-head h2 { font-size: 1rem; }
  .mini-list .item { padding-top: 9px; padding-bottom: 9px; }
}
/* phone Home: header curves only on the left; "today" card instead of repeated shortcuts */
@media (max-width: 640px) {
  .m-home .m-hero, .m-home .m-hero .hs { border-radius: 0 0 0 64px !important; }
  .m-today { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); margin: 0 14px; padding: 12px 6px; background: var(--surface);
    border-radius: 20px 20px 20px 20px; box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .28); animation: m-rise .5s .08s cubic-bezier(.2, .8, .2, 1) backwards; }
  .m-wait + .m-today { margin-top: 12px; }
  .m-today a { display: grid; justify-items: center; gap: 2px; color: var(--text); padding: 2px 4px; text-align: center; min-width: 0; }
  .m-today a + a { border-left: 1px solid var(--border, rgba(0, 0, 0, .07)); }
  .m-today a:hover { text-decoration: none; } .m-today a:active { opacity: .6; }
  .m-today .ti { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 3px;
    background: rgba(105, 17, 3, .09); color: var(--home-a, #691103); }
  .m-today .ti svg.i { width: 16px; height: 16px; }
  .m-today b { font-size: 1rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
  .m-today small { font-size: .66rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .m-today .ok .ti { background: rgba(52, 199, 89, .12); color: #1f9d55; } .m-today .ok b { color: #1f9d55; }
  .m-today .warn .ti { background: rgba(255, 159, 10, .14); color: #c77700; } .m-today .warn b { color: #c77700; }
  .m-today .bad b { color: var(--home-a, #691103); }
}
@media (max-width: 640px) { .m-hero + .m-today { margin-top: -46px; position: relative; z-index: 1; } }
@media (max-width: 640px) {
  .m-hero + .m-today, .m-hero + .m-wait { margin-top: 14px !important; }
  .m-home .m-hero { padding-bottom: 46px !important; min-height: calc(276px + env(safe-area-inset-top)) !important; }
  .m-hero .hs-foot { bottom: 16px !important; }
  .m-home .m-hero, .m-home .m-hero .hs { border-radius: 0 0 0 72px !important; }
  .m-wait-h { color: var(--text) !important; } .m-wait-h span { background: var(--home-a, #691103) !important; color: #fff !important; }
}
/* Library Setting › Features */
.lb-feat-list { display: grid; gap: 8px; }
.lb-feat { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2, rgba(120, 120, 128, .07)); cursor: pointer; }
.lb-feat .switch { flex: none; }
.lb-off-ic { width: 56px; height: 56px; border-radius: 18px; display: inline-grid; place-items: center; color: #fff; background: linear-gradient(160deg, #ff9f7a, #ff5e3a); }
.lb-off-ic svg.i { width: 26px; height: 26px; }
/* Library: banner after adding a book (Edit / Delete if it was a mistake) */
.lb-added { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 14px; border-radius: 16px;
  background: rgba(52, 199, 89, .1); border: 1px solid rgba(52, 199, 89, .28); animation: m-rise .4s cubic-bezier(.2, .8, .2, 1) backwards; }
.lb-added .ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #34c759; color: #fff; flex: none; }
.lb-added .ic svg.i { width: 18px; height: 18px; }
.lb-added .grow { flex: 1 1 200px; min-width: 0; }
.lb-added form { margin: 0; }
/* drop-down menus in a page head (Tools, Export …) open above the cards below them */
.page-head { position: relative; z-index: 6; }
.page-head:has(details[open]), .toolbar:has(details[open]), .card-head:has(details[open]) { z-index: 70; }
details[open] > .lb-menu, details[open] > .menu, details[open] > .dropdown { z-index: 80; }
/* Assets: more photos (form) and gallery on the asset page */
.as-more { margin: 10px 0 4px; }
.as-gal { display: grid; gap: 8px; align-content: start; }
.as-thumbs { display: flex; gap: 6px; flex-wrap: wrap; max-width: 220px; }
.as-thumbs button { width: 40px; height: 40px; padding: 0; border: 2px solid transparent; border-radius: 9px; overflow: hidden; background: var(--surface-2); cursor: pointer; }
.as-thumbs button.on { border-color: var(--accent, #691103); }
.as-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.as-more .lbf-img, .as-more .lbf-add { width: 72px; height: 72px; }
/* Security › Active devices */
.dv .card-head form { margin: 0; }
.dv-list { display: grid; gap: 6px; }
.dv-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2, rgba(120, 120, 128, .06)); }
.dv-row.me { background: rgba(52, 199, 89, .08); }
.dv-row .grow { min-width: 0; } .dv-row form { margin: 0; }
.dv-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; background: rgba(10, 132, 255, .1); color: #0a84ff; }
.dv-row.me .dv-ic { background: rgba(52, 199, 89, .14); color: #1f9d55; }
.dv-on { color: #1f9d55; font-weight: 600; }
.dv-on::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #34c759; margin-right: 5px; vertical-align: 1px; }
@media (max-width: 640px) { .dv-row { flex-wrap: wrap; } .dv-row form { margin-left: 50px; } }
@media (max-width: 640px) {
  .dv-row { flex-wrap: nowrap; align-items: flex-start; } .dv-row form { margin-left: 0; }
  .dv-end { width: 34px; height: 34px; padding: 0 !important; border-radius: 50% !important; display: grid !important; place-items: center; }
  .dv-end span { display: none; }
  .dv .card-head { flex-wrap: wrap; gap: 8px; }
}

/* =========================================================
   Devices (Telegram-style): Security page, new-device code page, alert on the first device
   ========================================================= */
.tg { max-width: 620px; margin: 0 auto; }
.tg-hero { text-align: center; padding: 6px 10px 14px; }
.tg-hero-ic { width: 64px; height: 64px; border-radius: 20px; display: inline-grid; place-items: center; color: #fff;
  background: linear-gradient(160deg, #5ac8fa, #0a84ff); box-shadow: 0 10px 24px -10px rgba(10, 132, 255, .6); }
.tg-hero-ic svg.i { width: 30px; height: 30px; }
.tg-hero h1 { font-size: 1.35rem; margin: 10px 0 4px; }
.tg-hero p { color: var(--muted); margin: 0; font-size: .9rem; }
.tg-label { font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 16px 6px; }
.tg-card { background: var(--surface); border-radius: 16px; overflow: hidden; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.tg-note { font-size: .76rem; color: var(--muted); margin: 6px 16px 0; line-height: 1.45; }
.tg-row, .tg-link { display: flex; align-items: center; gap: 12px; padding: 11px 14px; position: relative; }
.tg-row + .tg-row::before, .tg-card > form::before, .tg-link + .tg-hist::before, .tg-row + form::before { content: ""; position: absolute; left: 62px; right: 0; top: 0; border-top: 1px solid var(--border, rgba(0, 0, 0, .07)); }
.tg-card > form, .tg-hist { position: relative; display: block; margin: 0; }
.tg-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; color: #fff; }
.tg-ic svg.i { width: 18px; height: 18px; }
.tg-and { background: linear-gradient(160deg, #6fd36a, #2fb344); } .tg-ios { background: linear-gradient(160deg, #a1a1a6, #636366); }
.tg-win { background: linear-gradient(160deg, #5ac8fa, #0a84ff); } .tg-mac { background: linear-gradient(160deg, #b9b9be, #8e8e93); }
.tg-oth { background: linear-gradient(160deg, #ffb340, #ff9500); } .tg-key { background: linear-gradient(160deg, #ffcc4d, #ff9f0a); } .tg-his { background: linear-gradient(160deg, #bf8cff, #7d5cff); }
.tg-tx { flex: 1; min-width: 0; }
.tg-t { display: flex; align-items: baseline; gap: 8px; } .tg-t b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.tg-when { font-size: .74rem; color: var(--muted); flex: none; } .tg-when.on { color: #0a84ff; font-weight: 600; }
.tg-s { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-end { width: 30px; height: 30px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; flex: none;
  background: rgba(255, 59, 48, .1); color: #ff3b30; transition: transform .15s; }
.tg-end:active { transform: scale(.88); }
.tg-danger { width: 100%; display: flex; align-items: center; gap: 12px; padding: 13px 14px 13px 24px; border: 0; background: none; color: #ff3b30; font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.tg-danger:hover, .tg-link:hover { background: var(--surface-2, rgba(120, 120, 128, .06)); text-decoration: none; }
.tg-link { color: var(--text); cursor: pointer; list-style: none; } .tg-link::-webkit-details-marker { display: none; }
.tg-link > svg.i:last-child { color: var(--muted); }
.tg-hist[open] > summary > svg.i:last-child { transform: rotate(180deg); }
.tg-hrow { display: flex; align-items: flex-start; gap: 10px; padding: 9px 14px 9px 62px; font-size: .86rem; border-top: 1px solid var(--border, rgba(0, 0, 0, .05)); }
.tg-hrow .sec-dot { margin-top: 6px; }

/* the page a new device sees */
.dw { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; background: var(--bg); }
.dw-card { width: min(420px, 100%); background: var(--surface); border-radius: 24px; padding: 30px 24px 22px; text-align: center; box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .25); }
.dw-ic { width: 66px; height: 66px; border-radius: 20px; display: inline-grid; place-items: center; color: #fff; background: linear-gradient(160deg, #5ac8fa, #0a84ff); }
.dw-ic svg.i { width: 30px; height: 30px; }
.dw-card h1 { font-size: 1.35rem; margin: 12px 0 6px; } .dw-card > p { margin: 0 0 16px; font-size: .9rem; }
.dw-form { display: grid; gap: 10px; margin-bottom: 12px; }
.dw-code-in { font: inherit; font-size: 1.9rem; font-weight: 700; letter-spacing: .5em; text-align: center; padding: 12px 0 12px .5em; border-radius: 16px;
  border: 1.5px solid var(--border, rgba(0, 0, 0, .12)); background: var(--surface-2, #f2f2f7); color: var(--text); font-variant-numeric: tabular-nums; }
.dw-code-in:focus { outline: none; border-color: #0a84ff; box-shadow: 0 0 0 4px rgba(10, 132, 255, .15); }
.dw-go { justify-content: center; height: 46px; border-radius: 14px; }
.dw-alt { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; font-size: .78rem; color: var(--muted); margin-bottom: 14px; }
.dw-alt form { margin: 0; } .dw-link { border: 0; background: none; color: #0a84ff; font: inherit; cursor: pointer; padding: 0; }
.dw-wait { display: flex; justify-content: center; align-items: center; gap: 5px; font-size: .74rem; color: var(--muted); margin-bottom: 12px; }
.dw-wait i { width: 6px; height: 6px; border-radius: 50%; background: #0a84ff; animation: dwb 1.2s infinite ease-in-out; }
.dw-wait i:nth-child(2) { animation-delay: .15s; } .dw-wait i:nth-child(3) { animation-delay: .3s; } .dw-wait span { margin-left: 6px; }
@keyframes dwb { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }

/* alert on my first device: a new device wants to sign in */
.nd-alert { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 16px; border-radius: 18px;
  background: linear-gradient(135deg, rgba(10, 132, 255, .1), rgba(90, 200, 250, .08)); border: 1px solid rgba(10, 132, 255, .25); animation: m-rise .4s cubic-bezier(.2, .8, .2, 1) backwards; }
.nd-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(160deg, #5ac8fa, #0a84ff); flex: none; }
.nd-alert .grow { flex: 1 1 220px; min-width: 0; } .nd-alert .small { color: var(--muted); }
.nd-code { margin-top: 4px; font-size: .86rem; } .nd-code b { font-size: 1.25rem; letter-spacing: .12em; color: #0a84ff; font-variant-numeric: tabular-nums; }
.nd-acts { display: flex; gap: 8px; } .nd-acts form { margin: 0; }
.dw-code-in { width: 100%; min-width: 0; box-sizing: border-box; }
.dw-form, .dw-card { min-width: 0; } .dw-card { box-sizing: border-box; }
@media (max-width: 640px) { .m-home + .nd-alert { margin-top: 0; } }
/* phone Home: a soft gold (yellow) line glows along the curved bottom edge; slogan a little to the right of the curve */
@media (max-width: 640px) {
  .m-home .m-hero { box-shadow: 0 10px 26px -10px rgba(255, 196, 64, .75), 0 2px 0 0 rgba(255, 214, 102, .35); }
  .m-home .m-hero::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; border-radius: 0 0 0 72px;
    border-left: 3px solid #ffd666; border-bottom: 3px solid #ffd666; filter: blur(2.5px); opacity: .95;
    -webkit-mask-image: linear-gradient(to bottom, transparent 55%, #000 82%); mask-image: linear-gradient(to bottom, transparent 55%, #000 82%); }
  .m-hero .hs-foot { left: 46px !important; right: 20px; z-index: 2; }
}

/* ---- National Museum of Cambodia: login */
.nmc-login-head { display: grid; justify-items: center; gap: 12px; margin-bottom: 24px; text-align: center; }
.nmc-banner { width: 100%; max-width: 340px; height: auto; display: block; margin: 0 auto; }
:root[data-theme="dark"] .nmc-banner { background: #fff; border-radius: 14px; padding: 8px; }

/* ---- National Museum of Cambodia: one colour (the brand colour from System Settings, default #691103) ---- */
/* every icon, card and tile uses the brand colour instead of a different colour per module */
[style*="--c1"] { --c1: var(--home-a) !important; --c2: var(--home-b) !important; }

/* side menu: brand colour with white text */
.sidebar { background: var(--home-a) !important; color: #fff; border-right: 0; }
.sidebar .brand, .sidebar .brand *, .sidebar .nav-label, .sidebar .nav-link, .sidebar .txt { color: #fff !important; }
.sidebar .brand .collapse-btn { color: rgba(255, 255, 255, .8) !important; background: rgba(255, 255, 255, .1) !important; }
.sidebar .nav-label { opacity: .65; }
.sidebar .nav-link { color: rgba(255, 255, 255, .9) !important; background: transparent; box-shadow: none !important; }
.sidebar .nav-link .ico { background: rgba(255, 255, 255, .14) !important; color: #fff !important; box-shadow: none !important; }
.sidebar .nav-link .ico svg { color: #fff; stroke: currentColor; }
.sidebar .nav-link:hover { background: rgba(255, 255, 255, .1) !important; }
.sidebar .nav-link.active, .sidebar .nav-link[aria-current] { background: #fff !important; color: var(--home-a) !important; }
.sidebar .nav-link.active .txt, .sidebar .nav-link[aria-current] .txt { color: var(--home-a) !important; font-weight: 600; }
.sidebar .nav-link.active .ico, .sidebar .nav-link[aria-current] .ico { background: var(--home-a) !important; }
.sidebar ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .25); }
.sidebar .mark.logo { background: #fff; }

/* Home: tiles and figures in one colour */
.mcard { background: var(--home-a) !important; }
.hs-ic { background: var(--home-a) !important; }

/* ---- NMC: cleaner Home tiles (white card, icon in the middle) and a lighter side menu ---- */
.mcard { background: var(--surface) !important; color: var(--text); align-content: center; justify-items: center; text-align: center; gap: 4px;
  min-height: 132px; padding: 16px 10px 14px; box-shadow: var(--shadow-sm) !important; border: 1px solid var(--hair); }
.mcard::after, .mc-go { display: none; }
.mcard:hover { box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--home-a) 55%, transparent) !important; border-color: color-mix(in srgb, var(--home-a) 35%, transparent); }
.mc-ic { position: static; width: 52px; height: 52px; border-radius: 50%; background: var(--home-a) !important; color: #fff; box-shadow: none; margin-bottom: 6px; }
.mc-ic svg { width: 26px; height: 26px; }
.mc-t { color: var(--text); text-shadow: none; font-size: .95rem; }
.mc-s { color: var(--muted); opacity: 1; max-width: 100%; }
@media (max-width: 640px) { .mcard { min-height: 100px; padding: 12px 6px 10px; } .mc-ic { width: 40px; height: 40px; } .mc-ic svg { width: 20px; height: 20px; } .mc-s { display: none; } }

.sidebar .nav-link { border-radius: 12px; }
.sidebar .nav-link .ico { background: transparent !important; }
.sidebar .nav-link.active .ico, .sidebar .nav-link[aria-current] .ico { background: transparent !important; }
.sidebar .nav-link.active .ico svg, .sidebar .nav-link[aria-current] .ico svg { color: var(--home-a) !important; }
.sidebar .brand .bl-tx b { font-size: 1.02rem; letter-spacing: .01em; }
.sidebar .brand .bl-tx small { opacity: .75; }
.hero .hs-shade { background: linear-gradient(90deg, color-mix(in srgb, var(--home-a) 92%, transparent) 0%, color-mix(in srgb, var(--home-a) 70%, transparent) 30%, transparent 55%) !important; }
.hero .hs-foot:has(.hs-cap:empty) { display: none; }

/* ---- NMC: simple, friendly shapes – small corners instead of big curves ---- */
:root { --radius: 8px; --radius-lg: 10px; }
.card, .hstat, .mcard, .as-stats > *, .table-wrap, .modal, .auth-card, .hero, .bd-strip, .note-bar { border-radius: 10px !important; }
.btn, .input, .pill, .seg, .seg a, .seg button, .lb-cats a, .sidebar .nav-link, .act, .cl-pick span { border-radius: 6px !important; }
.mc-ic, .hs-ic { border-radius: 8px !important; }
.hero { min-height: 220px; box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .35) !important; }
.hero .hs-s { background-size: cover; background-position: right center; }
.hero .hs-shade { background: linear-gradient(90deg, rgba(40, 6, 0, .55) 0%, rgba(40, 6, 0, .15) 45%, transparent 70%) !important; }
.hero-name { font-size: 1.7rem; }

/* ---- NMC phone: straight banner (no curve, no gold glow), no logo in the phone header ---- */
@media (max-width: 640px) {
  .m-home .m-hero, .m-home .m-hero .hs, .m-hero .hs, .m-home .m-hero::after { border-radius: 0 !important; }
  .m-home .m-hero { box-shadow: none !important; }
  .m-home .m-hero::after { display: none !important; }
  .m-hero.has-slides { background: var(--home-b, #3f0a02) !important; }
  .m-hero .hs-s { background-size: cover; background-position: 62% 30%; }
  .m-hero .hs-shade { background: linear-gradient(180deg, rgba(40, 6, 0, .35) 0%, rgba(40, 6, 0, .1) 35%, rgba(40, 6, 0, .55) 70%, rgba(40, 6, 0, .9) 100%) !important; }
  .phone-head > a:first-child .mark, .phone-head.is-home > a:first-child .mark { display: none !important; }
  .phone-head.is-home > a:first-child { display: none !important; }
  .phone-head .t.home, .phone-head.is-home > .t { display: block !important; font-weight: 700; }
}
@media (max-width: 640px) {
  .m-wcard, .m-today, .m-home .card, .bd-strip { border-radius: 10px !important; }
  .m-hero .hs-shade { background: linear-gradient(180deg, rgba(40, 6, 0, .35) 0%, rgba(40, 6, 0, .08) 30%, rgba(40, 6, 0, .78) 58%, rgba(40, 6, 0, .95) 100%) !important; }
}
@media (max-width: 640px) {
  /* the whole museum picture fits on the phone: full width under the header, greeting below it */
  .m-hero .hs-s { background-size: 100% auto !important; background-position: center calc(64px + env(safe-area-inset-top)) !important; background-repeat: no-repeat; background-color: var(--home-b, #3f0a02); }
  .m-hero .hs-shade { background: linear-gradient(180deg, transparent 0%, transparent 55%, rgba(40, 6, 0, .6) 100%) !important; }
  .m-home .m-hero { padding-top: calc(64px + 30vw + 18px + env(safe-area-inset-top)) !important; min-height: 0 !important; }
  /* straight header on every page */
  .phone-head { border-radius: 0 !important; }
}
@media (max-width: 640px) { .m-home .m-hero { padding-bottom: 26px !important; } }

/* ---- NMC premium: soft gradients, rounded corners, glossy icons ---- */
:root { --nmc-a: var(--home-a, #691103); --nmc-b: color-mix(in srgb, var(--home-a, #691103) 70%, #c8452a); --nmc-c: var(--home-b, #3f0a02); --radius: 12px; --radius-lg: 16px; }
.card, .hstat, .mcard, .as-stats > *, .table-wrap, .modal, .auth-card, .bd-strip, .note-bar { border-radius: 16px !important; }
.hero { border-radius: 18px !important; }
.btn, .input, .pill, .seg, .lb-cats a, .act { border-radius: 10px !important; }
.seg a, .seg button, .cl-pick span { border-radius: 8px !important; }
.sidebar .nav-link { border-radius: 12px !important; }

/* side menu: deep museum-red gradient */
.sidebar { background: linear-gradient(180deg, color-mix(in srgb, var(--nmc-a) 85%, #b53a1f) 0%, var(--nmc-a) 40%, var(--nmc-c) 100%) !important; }
.sidebar .nav-link.active, .sidebar .nav-link[aria-current] { box-shadow: 0 6px 16px -8px rgba(0, 0, 0, .45) !important; }

/* glossy gradient icons */
.mc-ic, .hs-ic, .cl-h b {
  background: radial-gradient(120% 90% at 30% 15%, rgba(255, 255, 255, .28) 0%, rgba(255, 255, 255, 0) 45%), linear-gradient(145deg, var(--nmc-b) 0%, var(--nmc-a) 55%, var(--nmc-c) 100%) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -2px 6px rgba(0, 0, 0, .25), 0 8px 18px -8px color-mix(in srgb, var(--nmc-a) 75%, transparent) !important;
  color: #fff !important; }
.mc-ic { width: 58px; height: 58px; border-radius: 16px !important; }
.mc-ic svg { width: 28px; height: 28px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25)); }
.hs-ic { border-radius: 14px !important; }
.mcard { transition: transform .18s ease, box-shadow .18s ease; }
.mcard:hover { transform: translateY(-3px); }
.mcard:hover .mc-ic { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), inset 0 -2px 6px rgba(0, 0, 0, .25), 0 12px 22px -8px color-mix(in srgb, var(--nmc-a) 85%, transparent) !important; }
.sidebar .nav-link .ico { background: linear-gradient(145deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .06)) !important; border-radius: 10px !important; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18) !important; }
.sidebar .nav-link.active .ico, .sidebar .nav-link[aria-current] .ico { background: linear-gradient(145deg, var(--nmc-b), var(--nmc-a)) !important; }
.sidebar .nav-link.active .ico svg, .sidebar .nav-link[aria-current] .ico svg { color: #fff !important; }

/* primary buttons and the active filter chips */
.btn-primary, .lb-cats a.on, .page-link.active, .pagination .on { background: linear-gradient(145deg, var(--nmc-b), var(--nmc-a) 60%, var(--nmc-c)) !important; border-color: transparent !important; color: #fff !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 6px 14px -8px color-mix(in srgb, var(--nmc-a) 80%, transparent) !important; }
.btn-success { background: linear-gradient(145deg, #3ccf6a, #24a148) !important; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 6px 14px -8px rgba(36, 161, 72, .7) !important; border-color: transparent !important; }

@media (max-width: 640px) {
  .mc-ic { width: 44px; height: 44px; border-radius: 13px !important; } .mc-ic svg { width: 22px; height: 22px; }
  .m-wcard, .m-today, .m-home .card, .bd-strip { border-radius: 16px !important; }
}

/* ---- Khmer: correct Unicode shaping with Khmer OS Battambang ----
   Any letter-spacing breaks Khmer (subscripts and vowels come apart), and Khmer needs taller lines. */
html[lang="km"] { --font: "Khmer OS Battambang", "Inter", -apple-system, "Segoe UI", system-ui, sans-serif; }
html[lang="km"] *, :lang(km), .kh, [lang="km"] * { letter-spacing: normal !important; font-feature-settings: normal; font-synthesis: none; }
html[lang="km"] body { line-height: 1.7; }
html[lang="km"] h1, html[lang="km"] h2, html[lang="km"] h3, html[lang="km"] .page-head h1 { line-height: 1.55; font-weight: 700; }
html[lang="km"] .btn, html[lang="km"] .pill, html[lang="km"] .seg a, html[lang="km"] .nav-link, html[lang="km"] .badge, html[lang="km"] .cl-flag,
html[lang="km"] .input, html[lang="km"] th, html[lang="km"] label { line-height: 1.6; }
html[lang="km"] .input { padding-top: 6px; padding-bottom: 6px; }

/* ---- NMC icon style (reference): soft tinted circle, icon in the brand colour, white tile ---- */
.mc-ic, .hs-ic, .cl-h b {
  background: color-mix(in srgb, var(--nmc-a) 10%, #fff) !important;
  color: var(--nmc-a) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nmc-a) 8%, transparent) !important; }
.mc-ic { width: 54px; height: 54px; border-radius: 50% !important; margin-bottom: 8px; }
.mc-ic svg { width: 24px; height: 24px; filter: none; color: var(--nmc-a); stroke-width: 2; }
.hs-ic { border-radius: 14px !important; }
.hs-ic svg { color: var(--nmc-a); }
.cl-h b { color: var(--nmc-a) !important; }
.mcard { box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 14px -6px rgba(16, 24, 40, .1) !important; border: 1px solid color-mix(in srgb, var(--nmc-a) 6%, #eceef3); }
.mcard:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--nmc-a) 25%, transparent); }
.mcard:hover .mc-ic { background: var(--nmc-a) !important; color: #fff !important; box-shadow: 0 8px 16px -8px color-mix(in srgb, var(--nmc-a) 80%, transparent) !important; }
.mcard:hover .mc-ic svg { color: #fff; }
.mc-t { font-weight: 600; font-size: .9rem; }
/* dark mode: soft tint on the dark surface */
:root[data-theme="dark"] .mc-ic, :root[data-theme="dark"] .hs-ic, :root[data-theme="dark"] .cl-h b { background: color-mix(in srgb, #ff8a70 16%, transparent) !important; color: #ffb4a3 !important; }
:root[data-theme="dark"] .mc-ic svg, :root[data-theme="dark"] .hs-ic svg { color: #ffb4a3; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mc-ic, :root:not([data-theme="light"]) .hs-ic { background: color-mix(in srgb, #ff8a70 16%, transparent) !important; color: #ffb4a3 !important; } }
@media (max-width: 640px) { .mc-ic { width: 44px; height: 44px; } .mc-ic svg { width: 20px; height: 20px; } }

/* ---- NMC: each icon its own soft colour, mixed with the museum red ---- */
.mcard, .hstat { --ic: var(--nmc-a); }
.mcard:nth-child(9n+1), .hstat:nth-child(4n+1) { --ic: #691103; }
.mcard:nth-child(9n+2), .hstat:nth-child(4n+2) { --ic: #b7791f; }
.mcard:nth-child(9n+3), .hstat:nth-child(4n+3) { --ic: #0f766e; }
.mcard:nth-child(9n+4), .hstat:nth-child(4n+4) { --ic: #2f5bd3; }
.mcard:nth-child(9n+5) { --ic: #c2410c; }
.mcard:nth-child(9n+6) { --ic: #7e3fbf; }
.mcard:nth-child(9n+7) { --ic: #15803d; }
.mcard:nth-child(9n+8) { --ic: #be123c; }
.mcard:nth-child(9n+9) { --ic: #475569; }
.mcard .mc-ic, .hstat .hs-ic { background: color-mix(in srgb, var(--ic) 12%, #fff) !important; color: var(--ic) !important; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ic) 10%, transparent) !important; }
.mcard .mc-ic svg, .hstat .hs-ic svg { color: var(--ic) !important; }
.mcard:hover .mc-ic { background: var(--ic) !important; color: #fff !important; box-shadow: 0 8px 16px -8px color-mix(in srgb, var(--ic) 80%, transparent) !important; }
.mcard:hover .mc-ic svg { color: #fff !important; }
.mcard:hover { border-color: color-mix(in srgb, var(--ic) 30%, transparent); }
:root[data-theme="dark"] .mcard .mc-ic, :root[data-theme="dark"] .hstat .hs-ic { background: color-mix(in srgb, var(--ic) 26%, transparent) !important; color: color-mix(in srgb, var(--ic) 55%, #fff) !important; }
:root[data-theme="dark"] .mcard .mc-ic svg, :root[data-theme="dark"] .hstat .hs-ic svg { color: color-mix(in srgb, var(--ic) 55%, #fff) !important; }

/* ---- NMC phone: compact banner (about half the size) ---- */
@media (max-width: 640px) {
  .m-home .m-hero { padding: calc(52px + 20vw + 10px + env(safe-area-inset-top)) 18px 14px !important; min-height: 0 !important; gap: 0 !important; }
  .m-hero .hs-s { background-size: 66% auto !important; background-position: center calc(54px + env(safe-area-inset-top)) !important; }
  .m-hero .m-name { font-size: 16px !important; line-height: 1.3 !important; font-weight: 700 !important; }
  .m-hero .m-hi { font-size: 11.5px !important; margin-top: 0 !important; }
  .m-hero .m-job { font-size: 11.5px !important; }
  .m-hero .m-tx { gap: 1px !important; }
  .phone-head { min-height: calc(48px + env(safe-area-inset-top)) !important; padding-top: calc(8px + env(safe-area-inset-top)) !important; padding-bottom: 8px !important; }
  .phone-head .t { font-size: .9rem !important; }
  .phone-head .icon-btn, .phone-head .lang-wrap > button, .phone-head [data-theme-toggle], .phone-head .me-btn, .phone-head .av { width: 34px !important; height: 34px !important; }
}
@media (max-width: 640px) {
  .m-home .m-hero { padding: calc(44px + 25vw + env(safe-area-inset-top)) 18px 12px !important; }
  .m-hero .hs-s { background-size: 100% auto !important; background-position: center calc(40px + env(safe-area-inset-top)) !important; }
}
@media (max-width: 640px) { .m-home .m-hero { padding-top: calc(56px + 25vw + env(safe-area-inset-top)) !important; } }
/* NMC phone: name about half the original size (24px → 13px) */
@media (max-width: 900px) {
  .m-hero .m-name, .m-home .m-name { font-size: 13px !important; font-weight: 600 !important; line-height: 1.35 !important; letter-spacing: 0 !important; }
  .m-hero .m-hi, .m-hero .m-job { font-size: 11px !important; }
}

/* ---- NMC: Home tiles adjust to the screen (more per row on wide screens, full labels) ---- */
.mcards { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(clamp(78px, 22vw, 150px), 1fr)) !important; gap: clamp(8px, 2vw, 14px) !important; }
.mcard { min-height: 0 !important; padding: clamp(10px, 2.4vw, 16px) 6px clamp(8px, 2vw, 14px) !important; min-width: 0; }
.mc-ic { width: clamp(38px, 11vw, 56px) !important; height: clamp(38px, 11vw, 56px) !important; margin-bottom: 6px !important; }
.mc-ic svg { width: clamp(18px, 5vw, 26px) !important; height: clamp(18px, 5vw, 26px) !important; }
.mc-t { font-size: clamp(11px, 3.1vw, 14.5px) !important; line-height: 1.25 !important; white-space: normal !important; overflow-wrap: anywhere; text-align: center; display: block; max-width: 100%; }
@media (max-width: 640px) {
  .mcards { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)) !important; gap: 8px !important; }
  .mcard { border-radius: 14px !important; }
}
@media (max-width: 340px) { .mcards { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; } }

/* ---- NMC: Home button like the iPhone 7 home button: round, metal ring, small rounded square inside ---- */
@media (max-width: 900px) {
  .bnav .fab { display: grid; place-items: center; }
  .bnav .fab > span {
    width: 58px !important; height: 58px !important; border-radius: 50% !important; display: grid !important; place-items: center !important;
    background: radial-gradient(circle at 50% 35%, #ffffff 0%, #f4f4f6 55%, #e6e6ea 100%) !important;
    border: 2.5px solid color-mix(in srgb, var(--nmc-a, #691103) 85%, #c9a227) !important;
    box-shadow: 0 0 0 4px var(--surface, #fff), 0 0 0 5px rgba(0, 0, 0, .08), 0 8px 18px -6px rgba(0, 0, 0, .35), inset 0 2px 4px rgba(255, 255, 255, .9), inset 0 -3px 6px rgba(0, 0, 0, .08) !important;
    color: var(--nmc-a, #691103) !important; transition: transform .12s ease, box-shadow .12s ease; position: relative; }
  .bnav .fab > span svg { display: none !important; }
  .bnav .fab > span::after { content: ""; width: 17px; height: 17px; border: 2px solid var(--nmc-a, #691103); border-radius: 5px; opacity: .85; }
  .bnav .fab:active > span { transform: scale(.94); box-shadow: 0 0 0 4px var(--surface, #fff), 0 0 0 5px rgba(0, 0, 0, .08), 0 3px 8px -4px rgba(0, 0, 0, .35), inset 0 3px 8px rgba(0, 0, 0, .14) !important; }
  .bnav .fab.on > span::after { background: color-mix(in srgb, var(--nmc-a, #691103) 14%, transparent); }
  :root[data-theme="dark"] .bnav .fab > span { background: radial-gradient(circle at 50% 35%, #3a3a3e 0%, #2a2a2e 60%, #1f1f22 100%) !important; color: #ffb4a3 !important; }
  :root[data-theme="dark"] .bnav .fab > span::after { border-color: #ffb4a3; }
}
/* desktop keeps more tiles per row */
@media (min-width: 901px) { .mcards { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)) !important; } }
.mc-t { overflow-wrap: normal !important; word-break: normal !important; hyphens: auto; -webkit-hyphens: auto; }
@media (max-width: 640px) { .mc-t { font-size: clamp(10.5px, 2.9vw, 13px) !important; } }

/* ---- NMC phone: one seamless banner – white museum outline on one red gradient, no line under the header ---- */
@media (max-width: 640px) {
  .m-home .m-hero, .m-hero.has-slides { background: radial-gradient(120% 80% at 70% 30%, color-mix(in srgb, var(--home-a, #691103) 80%, #c0452a) 0%, var(--home-a, #691103) 45%, var(--home-b, #3f0a02) 100%) !important; }
  .m-hero .hs, .m-hero .hs-s { background-color: transparent !important; }
  .m-hero .hs-s { background-image: url("../img/nmc/banner-white.png") !important; background-size: 84% auto !important; background-repeat: no-repeat !important;
    background-position: center calc(46px + env(safe-area-inset-top)) !important; opacity: .95; }
  .m-hero .hs-s:not(:first-child) { display: none !important; }
  .m-hero .hs-shade { background: none !important; }
  body:has(.m-home) .phone-head.is-home:not(.solid) { background: transparent !important; box-shadow: none !important; }
  .m-home .m-hero { padding-top: calc(52px + 22vw + env(safe-area-inset-top)) !important; }
}
@media (max-width: 640px) { .m-home .m-hero { padding-top: calc(60px + 22vw + env(safe-area-inset-top)) !important; } .phone-head:not(.is-home) { background: linear-gradient(135deg, color-mix(in srgb, var(--home-a, #691103) 85%, #b53a1f), var(--home-b, #3f0a02)) !important; } }

/* ---- NMC: shorter desktop top bar ---- */
@media (min-width: 901px) {
  .topbar-d { min-height: 46px !important; height: 46px !important; padding-top: 0 !important; padding-bottom: 0 !important; gap: 6px !important; }
  .topbar-d .rbtn, .topbar-d .me-btn, .topbar-d .lang-wrap > button { width: 32px !important; height: 32px !important; min-width: 32px; }
  .topbar-d .rbtn svg { width: 16px; height: 16px; }
  .topbar-d .tb-title { font-size: 1.05rem !important; }
  .topbar-d .me-btn { font-size: .78rem; }
}

/* ---- NMC: attractive mixed-colour gradient banner (desktop + phone) ---- */
.hero, .m-home .m-hero, .m-hero.has-slides {
  background:
    radial-gradient(60% 90% at 88% 10%, rgba(201, 162, 39, .55) 0%, rgba(201, 162, 39, 0) 60%),
    radial-gradient(55% 80% at 12% 100%, rgba(122, 31, 79, .65) 0%, rgba(122, 31, 79, 0) 65%),
    radial-gradient(70% 90% at 55% 40%, rgba(196, 72, 38, .55) 0%, rgba(196, 72, 38, 0) 70%),
    linear-gradient(120deg, #4a0b02 0%, #691103 40%, #8a2410 70%, #5a0f1e 100%) !important; }
.hero .hs, .hero .hs-s { background-color: transparent !important; }
.hero .hs-s { background-image: url("../img/nmc/banner-white.png") !important; background-repeat: no-repeat !important;
  background-size: auto 78% !important; background-position: right 4% center !important; }
.hero .hs-s:not(:first-child) { display: none !important; }
.hero .hs-shade { background: linear-gradient(90deg, rgba(40, 6, 0, .35) 0%, rgba(40, 6, 0, 0) 45%) !important; }
.hero::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, .10) 0 2px, transparent 3px) 0 0 / 26px 26px; opacity: .5; }
.hero .hs-s { background-size: auto 70% !important; background-position: right 3% center !important; } @media (max-width: 640px) { .m-hero .hs-s { background-size: 84% auto !important; background-position: center calc(46px + env(safe-area-inset-top)) !important; } }

/* ---- NMC: no "Total Records" text under lists; page numbers stay when there is more than one page ---- */
.table-foot > .muted:first-child { display: none !important; }
.table-foot { justify-content: flex-end !important; }
.table-foot:not(:has(.pg:not(.off):not(.cur))):not(:has(select)) { display: none !important; }

/* ---- NMC: smaller summary cards everywhere ---- */
.as-stats { gap: 8px !important; margin-bottom: 10px !important; }
.as-stats > a, .as-stats > div { padding: 8px 12px !important; min-height: 0 !important; border-radius: 12px !important; }
.as-stats > a b, .as-stats > div b { font-size: 1.15rem !important; line-height: 1.2; }
.as-stats > a span, .as-stats > div span { font-size: .78rem !important; }
.hstat { padding: 12px 14px !important; gap: 10px !important; }
.hstat .hs-ic { width: 40px !important; height: 40px !important; }
.hstat .hs-ic svg { width: 19px; height: 19px; }
.hstat b, .hstat .hs-n { font-size: 1.35rem !important; }
@media (max-width: 640px) { .as-stats > a, .as-stats > div { padding: 7px 10px !important; } .as-stats > a b { font-size: 1.05rem !important; } }

/* ---- NMC pop-up (every message, confirm and question) ---- */
.nd-back { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 18px; background: rgba(20, 8, 4, .42);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; transition: opacity .18s ease; }
.nd-back.show { opacity: 1; }
.nd-back.nd-toast { background: rgba(20, 8, 4, .12); backdrop-filter: none; -webkit-backdrop-filter: none; }
.nd { width: min(380px, 100%); background: var(--surface, #fff); color: var(--text); border-radius: 20px; padding: 24px 22px 18px; text-align: center;
  box-shadow: 0 24px 60px -18px rgba(0, 0, 0, .45), 0 0 0 1px rgba(0, 0, 0, .04); transform: translateY(10px) scale(.96); transition: transform .2s cubic-bezier(.2, .9, .3, 1.2); }
.nd-back.show .nd { transform: none; }
.nd-ic { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 12px; --c: var(--nmc-a, #691103);
  background: color-mix(in srgb, var(--c) 12%, #fff); color: var(--c); box-shadow: 0 0 0 6px color-mix(in srgb, var(--c) 6%, transparent); }
.nd-ic svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nd-ok .nd-ic { --c: #1f9d55; } .nd-error .nd-ic, .nd-danger .nd-ic { --c: #d93025; } .nd-warn .nd-ic { --c: #c27400; }
.nd-t { font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; }
.nd-m { color: var(--text); font-size: .98rem; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.nd-in { width: 100%; margin-top: 12px; resize: vertical; text-align: left; }
.nd-b { display: flex; gap: 10px; margin-top: 18px; }
.nd-b .btn { flex: 1; justify-content: center; min-height: 44px; font-weight: 600; }
.nd-b .btn-danger { background: linear-gradient(145deg, #ef4b3f, #c62a1f) !important; color: #fff !important; border-color: transparent !important; box-shadow: 0 6px 14px -8px rgba(198, 42, 31, .8) !important; }
.nd-toast .nd { width: auto; min-width: 220px; max-width: min(380px, 100%); padding: 18px 22px; }
.nd-toast .nd-ic { width: 44px; height: 44px; margin-bottom: 8px; }
:root[data-theme="dark"] .nd-ic { background: color-mix(in srgb, var(--c) 22%, transparent); }
@media (max-width: 640px) { .nd-back:not(.nd-toast) { align-items: end; } .nd-back:not(.nd-toast) .nd { width: 100%; border-radius: 22px; margin-bottom: calc(10px + env(safe-area-inset-bottom)); } }
.flash-wrap .flash { display: none !important; }

/* ---- NMC: smaller text everywhere – normal text 12px, everything else scaled the same way (×0.86) ---- */
html { font-size: 13.7px; }
body { font-size: 12px !important; }
.input, select.input, textarea.input, .ss-btn.input, .dp-btn { font-size: 12.5px !important; }
/* searchable dropdowns in filter bars: "All places" is a real choice, so it uses the normal text colour like the other filters */
form[method="get"] .ss-btn.ss-empty, form[method="GET"] .ss-btn.ss-empty { color: var(--text); }
.btn { font-size: 12px; }
.table td { font-size: 12px; } .table th { font-size: 11.5px; }
.small, .muted.small { font-size: 11.5px; }
.tb-title { font-size: 14.5px !important; }
.sidebar .nav-link .txt { font-size: 13px; }

/* ---- NMC: stat cards with a soft colour gradient (each card its own colour) ---- */
.as-stats > * { --c: #8e8e93; position: relative; overflow: hidden; isolation: isolate;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 18%, var(--surface)) 0%, color-mix(in srgb, var(--c) 5%, var(--surface)) 55%, var(--surface) 100%) !important;
  border: 1px solid color-mix(in srgb, var(--c) 18%, transparent) !important; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.as-stats > *::after { content: ""; position: absolute; z-index: -1; right: -26px; top: -30px; width: 92px; height: 92px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 30%, transparent) 0%, transparent 70%); }
.as-stats > a:hover { transform: translateY(-1px); box-shadow: 0 6px 18px color-mix(in srgb, var(--c) 18%, transparent); }
.as-stats > * b { color: var(--c) !important; }
.as-stats > * span { color: color-mix(in srgb, var(--c) 45%, var(--muted)) !important; }
.as-stats > .on { border: 2px solid var(--c) !important;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 30%, var(--surface)) 0%, color-mix(in srgb, var(--c) 10%, var(--surface)) 70%) !important; }
.as-stats .s-all     { --c: var(--accent); }
.as-stats .s-in_use  { --c: #1f9d45; }
.as-stats .s-repair  { --c: #d98200; }
.as-stats .s-broken  { --c: #e5383b; }
.as-stats .s-restore { --c: #f06d1f; }
.as-stats .s-photo   { --c: #5e5ce6; }
.as-stats .s-value   { --c: #0a84ff; }
.as-stats .s-in_store { --c: #30b0c7; }
.as-stats > :not([class*="s-"]) { --c: var(--accent); }
/* searchable dropdown text sits at the same height as the other filters */
.ss-btn.input { line-height: calc(var(--field-h) - 4px) !important; padding-top: 0 !important; padding-bottom: 2px !important; }
/* ---- NMC: full-colour stat cards (strong gradient, white text) ---- */
.as-stats > * { border: 0 !important; color: #fff !important;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 82%, #fff) 0%, var(--c) 48%, color-mix(in srgb, var(--c) 70%, #000) 100%) !important;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--c) 30%, transparent) !important; }
.as-stats > *::after { right: -22px; top: -34px; width: 104px; height: 104px; background: radial-gradient(circle, rgba(255,255,255,.32) 0%, rgba(255,255,255,0) 68%); }
.as-stats > *::before { content: ""; position: absolute; z-index: -1; left: -30px; bottom: -46px; width: 110px; height: 110px; border-radius: 50%; background: rgba(255,255,255,.08); }
.as-stats > * b { color: #fff !important; text-shadow: 0 1px 2px rgba(0,0,0,.18); }
.as-stats > * span { color: rgba(255,255,255,.9) !important; }
.as-stats > a:hover { transform: translateY(-2px); box-shadow: 0 8px 22px color-mix(in srgb, var(--c) 42%, transparent) !important; }
.as-stats > .on { border: 0 !important; transform: translateY(-2px);
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 82%, #fff) 0%, var(--c) 48%, color-mix(in srgb, var(--c) 70%, #000) 100%) !important;
  box-shadow: 0 0 0 3px var(--bg, #fff), 0 0 0 5px var(--c), 0 8px 22px color-mix(in srgb, var(--c) 40%, transparent) !important; }
.as-stats .s-repair { --c: #e08a00; }
.as-stats .s-photo  { --c: #6b5ce7; }
/* selected stat card: keep its ring fully visible (no lift, room above the row) */
.as-stats { padding-top: 5px; }
.as-stats > .on { transform: none !important; }
/* styled dropdown without a search box (short lists, filter bars): the hidden box still takes keyboard / type-to-find */
.ss-panel.ss-nosearch .ss-search { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; opacity: 0; pointer-events: none; }
.ss-panel.ss-nosearch .ss-list { padding: 5px; }
.ss-item { font-size: 12.5px; line-height: 1.6; }
.ss-panel.ss-sheet .ss-item { font-size: 14px; }
/* the highlighted dropdown item also has the class "act" – keep it a plain row (not the activity-list grid) */
.ss-item.act { display: block !important; grid-template-columns: none !important; gap: 0 !important; padding: 8px 10px !important; }
.ss-panel.ss-nosearch .ss-item.ss-none { color: var(--text); }
/* ---- NMC: home app icons – on hover the light circle fades softly to full colour and the icon turns white; the icon stays centred, nothing moves ---- */
.mcard .mc-ic { position: relative !important; overflow: hidden !important; isolation: isolate; display: grid !important; place-items: center !important; transform: none !important;
  transition: box-shadow .4s ease, color .4s ease !important; }
.mcard .mc-ic::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--ic); opacity: 0; transition: opacity .4s ease; }
.mcard .mc-ic svg { position: relative; transform: none !important; transition: color .4s ease !important; }
.mcard:hover .mc-ic { background: color-mix(in srgb, var(--ic) 12%, #fff) !important; transform: none !important; }
.mcard:hover .mc-ic::before { opacity: 1; }
:root[data-theme="dark"] .mcard:hover .mc-ic { background: color-mix(in srgb, var(--ic) 26%, transparent) !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mcard:hover .mc-ic { background: color-mix(in srgb, var(--ic) 26%, transparent) !important; } }
/* the tag (Collection) drawing is heavy at its square corner and thin at its point: move it slightly down-right so it looks centred in the circle */
.mc-ic[data-icon="tag"] svg { translate: 5% 5%; }
/* ---- NMC: phone layout ---- */
@media (max-width: 640px) {
  /* home app tiles: icon above the name, no overlap, long names shortened with … */
  .mcards { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 8px !important; }
  .mcard { display: flex !important; flex-direction: column !important; align-items: center !important; justify-content: flex-start !important;
    gap: 10px !important; padding: 12px 4px 10px !important; min-height: 0 !important; }
  .mcard .mc-ic { width: 44px !important; height: 44px !important; margin: 0 !important; flex: 0 0 auto; }
  .mcard .mc-ic svg { width: 22px !important; height: 22px !important; }
  .mcard .mc-t { font-size: 11px !important; line-height: 1.6 !important; text-align: center; width: 100%; max-width: 100%; min-width: 0; margin: 0 !important; padding: 2px 2px 0;
    white-space: normal; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: normal; overflow-wrap: anywhere; }
  /* coloured count cards: 3 per row, compact */
  .as-stats { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 6px !important; padding-top: 4px; }
  .as-stats > a, .as-stats > div { padding: 8px 9px !important; border-radius: 12px !important; gap: 0 !important; }
  .as-stats > a b, .as-stats > div b { font-size: 1rem !important; }
  .as-stats > a span, .as-stats > div span { font-size: 10.5px !important; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .as-stats > *::after { width: 70px; height: 70px; right: -20px; top: -26px; }
}
@media (hover: none) { .mcard:hover, .as-stats > a:hover { transform: none !important; } }
/* ---- NMC: home tile names – Khmer and English look the same weight and size ----
   Khmer OS Battambang has no bold face (the browser fakes it, blurry), so Khmer uses its normal weight and a slightly larger size */
.mcard .mc-t { font-weight: 600; letter-spacing: 0; }
:lang(km) .mcard .mc-t { font-weight: 400 !important; font-size: 15px; line-height: 1.6; }
.mcard .mc-s { font-size: 11px !important; line-height: 1.5; }
:lang(km) .mcard .mc-s { font-size: 11.5px !important; }
@media (max-width: 640px) {
  .mcard .mc-t { font-size: 11.5px !important; white-space: nowrap !important; display: block !important; overflow: hidden; text-overflow: clip; }
  :lang(km) .mcard .mc-t { font-size: 12.5px !important; }
}
/* room between the circle and the name (Khmer marks sit above the line) */
.mcard .mc-ic { margin-bottom: 8px !important; }
:lang(km) .mcard .mc-t { padding-top: 3px; }
@media (max-width: 640px) { .mcard .mc-ic { margin-bottom: 0 !important; } }
/* the old corner placement (left/top 14px) must not push the circle when it is position: relative – keep it in the centre at every screen size */
.mcard .mc-ic { left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; margin-left: auto !important; margin-right: auto !important; }
/* ---- NMC: phone tiles – every name the same size; long names wrap to a 2nd line (never cut, never shrunk one by one) ---- */
@media (max-width: 640px) {
  .mcard { justify-content: flex-start !important; gap: 8px !important; padding: 12px 4px 10px !important; }
  .mcard .mc-t, :lang(km) .mcard .mc-t { font-size: 11px !important; line-height: 1.35 !important; font-weight: 600 !important;
    white-space: normal !important; overflow-wrap: anywhere; word-break: normal; text-overflow: clip;
    display: -webkit-box !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    min-height: 2.7em; width: 100%; padding: 0 2px !important; }
  :lang(km) .mcard .mc-t { font-size: 11.5px !important; line-height: 1.55 !important; font-weight: 400 !important; min-height: 3.1em; }
}
/* ---- NMC: home tiles flex with the screen – as many columns as fit, each tile at least 86px wide; tile height follows its content ---- */
@media (max-width: 640px) {
  .mcards { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)) !important; gap: 10px !important; }
  .mcard { justify-content: center !important; padding: 12px 4px !important; }
  .mcard .mc-t, :lang(km) .mcard .mc-t { min-height: 0 !important; }
}
/* ---- NMC: tablet tiles (iPad portrait / landscape) – flexible columns, a little bigger than on phones ---- */
@media (min-width: 641px) and (max-width: 1180px) {
  .mcards { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)) !important; gap: 12px !important; }
  .mcard { display: flex !important; flex-direction: column !important; align-items: center !important; justify-content: center !important;
    gap: 8px !important; padding: 16px 8px 14px !important; min-height: 0 !important; }
  .mcard .mc-ic { width: 52px !important; height: 52px !important; margin: 0 !important; }
  .mcard .mc-ic svg { width: 26px !important; height: 26px !important; }
  .mcard .mc-t { font-size: 13px !important; line-height: 1.4 !important; text-align: center; width: 100%; white-space: normal !important; overflow-wrap: anywhere;
    display: -webkit-box !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  :lang(km) .mcard .mc-t { font-size: 13.5px !important; line-height: 1.6 !important; }
  .mcard .mc-s { font-size: 11px !important; text-align: center; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
/* ---- photo viewer (large photo on a dark background) ---- */
.lb-view { position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center; background: rgba(0, 0, 0, .9); padding: 56px 64px; }
.lb-view.on { display: flex; animation: lbIn .18s ease; }
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }
.lb-view figure { margin: 0; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.lb-view img { max-width: 100%; max-height: calc(100% - 30px); object-fit: contain; border-radius: 8px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); transition: opacity .2s ease; background: #111; }
.lb-view img.lb-loading { opacity: .35; }
.lb-view figcaption { color: rgba(255, 255, 255, .8); font-size: 13px; font-variant-numeric: tabular-nums; min-height: 18px; }
.lb-view button { position: absolute; border: 0; background: rgba(255, 255, 255, .12); color: #fff; width: 44px; height: 44px; border-radius: 50%; font-size: 30px; line-height: 1; cursor: pointer; display: grid; place-items: center; transition: background .15s; }
.lb-view button:hover { background: rgba(255, 255, 255, .25); }
.lb-x { top: 14px; right: 14px; font-size: 28px !important; }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
.lb-view.lb-one .lb-prev, .lb-view.lb-one .lb-next { display: none; }
html.lb-lock, html.lb-lock body { overflow: hidden; }
@media (max-width: 640px) { .lb-view { padding: 56px 8px 24px; } .lb-prev, .lb-next { top: auto; bottom: 18px; transform: none; } .lb-prev { left: calc(50% - 60px); } .lb-next { right: calc(50% - 60px); } .lb-view img { max-height: calc(100% - 80px); } }
/* photos that open the viewer */
[data-lb] { cursor: zoom-in; }
button.as-thumb { border: 0; padding: 0; font: inherit; }
/* ---- Khmer text: never squeeze letters (negative letter-spacing pulls Khmer letter groups apart) ---- */
h1, h2, h3, h4, .hero-name, .m-name, .tb-title, .page-head h1, .as-main h1, .as-main h2, .name { letter-spacing: 0 !important; }
:lang(km) body, :lang(km) h1, :lang(km) h2, :lang(km) h3, :lang(km) h4 { letter-spacing: 0 !important; }
/* the Khmer bold face is real now: Khmer tile names may use the normal bold weight again */
:lang(km) .mcard .mc-t { font-weight: 600 !important; }
/* row delete button: red outline like the others */
.table .act-del { color: var(--danger, #e5383b) !important; }
.table-wrap.cards td .act-del { background: color-mix(in srgb, var(--danger, #e5383b) 12%, transparent) !important; }
/* password pop-up: common-word rule, match line, Save waits until everything is right */
.pw-rules li.bad { color: var(--danger, #e5383b); font-weight: 600; }
.pw-match { font-size: .8rem; margin-top: 6px; min-height: 1.2em; }
.pw-match.ok { color: var(--success, #1f9d45); font-weight: 600; } .pw-match.no { color: var(--danger, #e5383b); }
#pwModal button[type=submit]:disabled { opacity: .45; cursor: not-allowed; }
