/* =====================================================================
   Church System – UI in the e-Portfolio "Apple" style (wine red + gold church theme)
   - 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; }
@font-face { font-family: "Kantumruy Pro"; src: url("../fonts/kantumruy-pro-khmer.woff2") format("woff2"); font-weight: 100 700; font-style: normal; font-display: swap;
  unicode-range: U+1780-17FF, U+19E0-19FF, U+200B-200D, U+25CC; }
@font-face { font-family: "Moul"; src: url("../fonts/moul-khmer.woff2") format("woff2"); font-weight: 400; font-style: normal; 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: #d0233f;
  --accent-2: #a81a33;
  --accent-soft: rgba(208, 35, 63, .10);
  --gold: #c9a227;
  --success: #34c759;
  --warning: #ff9f0a;
  --danger: #ff3b30;
  --violet: #5e5ce6;
  --home-a: #d0233f;
  --home-b: #8f1430;
  --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", "Kantumruy Pro", "Khmer OS Siemreap", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --font-title: "Moul", "Khmer OS Muol Light", "Kantumruy Pro", 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: #c0394b;
  --accent-soft: rgba(192, 57, 75, .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; } }
