/* =========================================================================
   OWMS — application styles (Bootstrap 5 + department colours)
   ========================================================================= */
:root {
  --owms-primary: #4F46E5;
  --dept: var(--owms-primary);
  --c-admin: #4F46E5; --c-finance: #059669; --c-operations: #2563EB; --c-hr: #DB2777;
  --c-purchase: #EA580C; --c-store: #0D9488; --c-maintenance: #D97706; --c-mgmt: #475569;
  --st-done: #16A34A; --st-progress: #2563EB; --st-pending: #F59E0B; --st-overdue: #DC2626; --st-closed: #6B7280;
  --sidebar-w: 260px; --sidebar-w-mini: 72px; --topbar-h: 60px;
  --radius: 12px; --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --shadow: 0 4px 14px rgba(15, 23, 42, .08);
  --page-bg: #F4F6FB; --card-bg: #FFFFFF; --muted: #64748B; --line: #E5E7EB;
  --sb-bg: #111827; --sb-fg: #CBD5E1; --sb-fg-strong: #FFFFFF; --sb-hover: rgba(255,255,255,.06); --sb-section: #64748B;
}
[data-bs-theme="dark"] {
  --page-bg: #0B1220; --card-bg: #111A2E; --muted: #94A3B8; --line: #1F2A44;
  --sb-bg: #0A0F1C; --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 4px 14px rgba(0,0,0,.35);
}
[data-sidebar="light"]:not([data-bs-theme="dark"]) {
  --sb-bg: #FFFFFF; --sb-fg: #334155; --sb-fg-strong: #0F172A; --sb-hover: #F1F5F9; --sb-section: #94A3B8;
}

html, body { height: 100%; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--page-bg); font-size: .925rem; -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; }
.text-muted, .small-muted { color: var(--muted) !important; }
.fw-600 { font-weight: 600; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */
.app-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--sb-bg);
  color: var(--sb-fg); z-index: 1040; display: flex; flex-direction: column;
  transition: width .2s ease, transform .2s ease; border-right: 1px solid rgba(148,163,184,.12);
}
.app-sidebar .brand { height: var(--topbar-h); display: flex; align-items: center; gap: .65rem; padding: 0 1.1rem; color: var(--sb-fg-strong); font-weight: 700; letter-spacing: .2px; flex-shrink: 0; }
.app-sidebar .brand-logo { width: 34px; height: 34px; border-radius: 9px; background: var(--owms-primary); display: grid; place-items: center; color: #fff; font-size: 1.05rem; overflow: hidden; flex-shrink: 0; }
.app-sidebar .brand-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.app-sidebar .brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.1; }
.app-sidebar .brand-text small { display: block; font-weight: 500; font-size: .7rem; color: var(--sb-section); }
.sidebar-scroll { overflow-y: auto; flex: 1; padding: .5rem .65rem 1.5rem; scrollbar-width: thin; }
.nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sb-section); padding: 1rem .65rem .35rem; white-space: nowrap; }
.side-link { display: flex; align-items: center; gap: .7rem; color: var(--sb-fg); padding: .5rem .65rem; border-radius: 9px; margin-bottom: 2px; position: relative; white-space: nowrap; font-weight: 500; }
.side-link:hover { background: var(--sb-hover); color: var(--sb-fg-strong); }
.side-link .ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; font-size: 1rem; background: color-mix(in srgb, var(--c, #64748B) 18%, transparent); color: var(--c, #94A3B8); }
.side-link.active { background: color-mix(in srgb, var(--c, var(--owms-primary)) 16%, transparent); color: var(--sb-fg-strong); }
.side-link.active::before { content: ""; position: absolute; left: -.65rem; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c, var(--owms-primary)); }
.side-link.active .ico { background: var(--c, var(--owms-primary)); color: #fff; }
.side-link .label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.side-link .phase { font-size: .62rem; padding: .1rem .4rem; border-radius: 20px; background: rgba(148,163,184,.16); color: var(--sb-section); }

.app-main { margin-left: var(--sidebar-w); min-height: 100vh; transition: margin .2s ease; display: flex; flex-direction: column; }
.sidebar-mini .app-sidebar { width: var(--sidebar-w-mini); }
.sidebar-mini .app-main { margin-left: var(--sidebar-w-mini); }
.sidebar-mini .app-sidebar .brand-text, .sidebar-mini .side-link .label, .sidebar-mini .side-link .phase, .sidebar-mini .nav-section { display: none; }
.sidebar-mini .side-link { justify-content: center; }
.sidebar-mini .nav-section + * { margin-top: .5rem; }

.app-topbar {
  height: var(--topbar-h); position: sticky; top: 0; z-index: 1030; background: color-mix(in srgb, var(--card-bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: .5rem; padding: 0 1rem;
}
.app-topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: linear-gradient(90deg, var(--c-admin), var(--c-operations), var(--c-finance), var(--c-store), var(--c-maintenance), var(--c-purchase), var(--c-hr)); opacity: .85; }
.topbar-search { position: relative; flex: 1; max-width: 520px; }
.topbar-search .form-control { padding-left: 2.3rem; border-radius: 10px; background: var(--page-bg); border-color: transparent; }
.topbar-search .form-control:focus { background: var(--card-bg); border-color: var(--owms-primary); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--owms-primary) 20%, transparent); }
.topbar-search .bi-search { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar-search kbd { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); font-size: .7rem; background: var(--line); color: var(--muted); }
.search-pop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--card-bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-height: 420px; overflow: auto; display: none; z-index: 1050; }
.search-pop.show { display: block; }
.search-pop .grp { font-size: .7rem; text-transform: uppercase; color: var(--muted); padding: .6rem .9rem .2rem; letter-spacing: .06em; }
.search-pop a, .search-pop .itm { display: block; padding: .45rem .9rem; color: inherit; }
.search-pop a:hover { background: var(--page-bg); }
.tb-btn { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; position: relative; color: var(--bs-body-color); border: 0; background: transparent; }
.tb-btn:hover { background: var(--page-bg); }
.tb-btn .count { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--st-overdue); color: #fff; font-size: .65rem; display: grid; place-items: center; padding: 0 4px; font-weight: 700; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; color: #fff; background: var(--dept); font-size: .8rem; flex-shrink: 0; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.3rem; }
.avatar.sm { width: 28px; height: 28px; font-size: .68rem; }

.app-content { padding: 1.25rem 1.25rem 2rem; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.4rem; font-weight: 700; margin: 0; }
.breadcrumb { font-size: .78rem; margin-bottom: .2rem; }
.breadcrumb a { color: var(--muted); }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); background: var(--card-bg); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); font-weight: 600; padding: .85rem 1rem; display: flex; align-items: center; gap: .5rem; }
.card-header .hdr-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--dept) 15%, transparent); color: var(--dept); }
.card-dept { border-top: 3px solid var(--dept); }

.kpi { position: relative; display: block; padding: 1rem 1.05rem; border-radius: var(--radius); background: var(--card-bg); border: 1px solid var(--line); box-shadow: var(--shadow-sm); color: inherit; height: 100%; overflow: hidden; transition: transform .12s ease, box-shadow .12s ease; }
.kpi::after { content: ""; position: absolute; right: -24px; top: -24px; width: 96px; height: 96px; border-radius: 50%; background: color-mix(in srgb, var(--k) 12%, transparent); }
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: inherit; }
.kpi .k-ico { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 1.2rem; color: #fff; background: var(--k); box-shadow: 0 4px 10px color-mix(in srgb, var(--k) 35%, transparent); }
.kpi .k-val { font-size: 1.65rem; font-weight: 700; line-height: 1.1; margin-top: .65rem; font-variant-numeric: tabular-nums; }
.kpi .k-lbl { color: var(--muted); font-size: .8rem; font-weight: 500; }
.kpi .k-trend { font-size: .75rem; font-weight: 600; }
.kpi .k-trend.up { color: var(--st-done); } .kpi .k-trend.down { color: var(--st-overdue); } .kpi .k-trend.flat { color: var(--muted); }
.kpi .k-trend.inv.up { color: var(--st-overdue); } .kpi .k-trend.inv.down { color: var(--st-done); }
.kpi.future { opacity: .62; background: repeating-linear-gradient(135deg, var(--card-bg), var(--card-bg) 10px, color-mix(in srgb, var(--k) 5%, var(--card-bg)) 10px, color-mix(in srgb, var(--k) 5%, var(--card-bg)) 20px); }
.kpi.future .k-val { font-size: 1rem; color: var(--muted); margin-top: .9rem; }

.dept-hero { border-radius: var(--radius); padding: 1.4rem 1.5rem; color: #fff; background: linear-gradient(120deg, var(--dept), color-mix(in srgb, var(--dept) 60%, #0F172A)); position: relative; overflow: hidden; }
.dept-hero::after { content: ""; position: absolute; right: -60px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.08); }
.dept-hero .hero-ico { font-size: 2.2rem; opacity: .9; }
.dept-hero h2 { font-weight: 700; font-size: 1.5rem; margin: 0; }

/* ---------- Status badges (same colours everywhere) ---------- */
.st { display: inline-flex; align-items: center; gap: .35rem; padding: .22rem .6rem; border-radius: 20px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-done { color: #15803D; background: #DCFCE7; } .st-progress { color: #1D4ED8; background: #DBEAFE; }
.st-pending { color: #B45309; background: #FEF3C7; } .st-overdue { color: #B91C1C; background: #FEE2E2; }
.st-closed { color: #4B5563; background: #F3F4F6; }
[data-bs-theme="dark"] .st-done { color: #86EFAC; background: rgba(22,163,74,.18); }
[data-bs-theme="dark"] .st-progress { color: #93C5FD; background: rgba(37,99,235,.2); }
[data-bs-theme="dark"] .st-pending { color: #FCD34D; background: rgba(245,158,11,.18); }
[data-bs-theme="dark"] .st-overdue { color: #FCA5A5; background: rgba(220,38,38,.2); }
[data-bs-theme="dark"] .st-closed { color: #D1D5DB; background: rgba(107,114,128,.25); }
.lvl { display: inline-block; min-width: 30px; text-align: center; padding: .15rem .45rem; border-radius: 6px; font-weight: 700; font-size: .72rem; color: #fff; background: #64748B; }
.lvl-L1 { background: #7C3AED; } .lvl-L2 { background: #4F46E5; } .lvl-L3 { background: #2563EB; } .lvl-L4 { background: #0D9488; } .lvl-L5 { background: #D97706; } .lvl-L6 { background: #6B7280; } .lvl-SP { background: #0F172A; }
.dept-chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 600; color: var(--dept); }
.dept-chip::before { content: ""; width: 8px; height: 8px; border-radius: 3px; background: var(--dept); }

/* ---------- Buttons ---------- */
.btn { border-radius: 9px; font-weight: 600; display: inline-flex; align-items: center; gap: .4rem; justify-content: center; }
.btn-lg { border-radius: 11px; }
.btn-dept { background: var(--dept); border-color: var(--dept); color: #fff; }
.btn-dept:hover, .btn-dept:focus { background: color-mix(in srgb, var(--dept) 85%, #000); border-color: color-mix(in srgb, var(--dept) 85%, #000); color: #fff; }
.btn-outline-dept { color: var(--dept); border-color: var(--dept); }
.btn-outline-dept:hover { background: var(--dept); color: #fff; }
.btn-approve { background: var(--st-done); border-color: var(--st-done); color: #fff; }
.btn-approve:hover { background: #15803D; color: #fff; }
.btn-icon { width: 34px; height: 34px; padding: 0; }
.btn.is-loading { pointer-events: none; opacity: .8; }
.seg { display: inline-flex; background: var(--page-bg); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a { padding: .35rem .8rem; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: .82rem; }
.seg a.on { background: var(--card-bg); color: var(--bs-body-color); box-shadow: var(--shadow-sm); }
.seg a .n { font-size: .7rem; margin-left: .3rem; padding: .05rem .4rem; border-radius: 10px; background: var(--line); }
.quick-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; padding: .85rem .5rem; border-radius: 12px; border: 1px dashed var(--line); color: inherit; font-weight: 600; font-size: .8rem; text-align: center; height: 100%; background: var(--card-bg); position: relative; }
.quick-btn i { font-size: 1.35rem; color: var(--dept); }
.quick-btn:hover { border-style: solid; border-color: var(--dept); color: inherit; }
.quick-btn.disabled { opacity: .55; }
.quick-btn .soon { position: absolute; top: 6px; right: 6px; font-size: .58rem; padding: .05rem .35rem; border-radius: 8px; background: var(--line); color: var(--muted); }
.form-switch .form-check-input { width: 2.6em; height: 1.35em; cursor: pointer; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { margin: 0; --bs-table-bg: transparent; }
.table thead th { font-size: .73rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap; background: color-mix(in srgb, var(--page-bg) 60%, transparent); }
.table thead th a { color: inherit; }
.table thead th a.sorted { color: var(--dept); }
.table td { vertical-align: middle; border-color: var(--line); }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: color-mix(in srgb, var(--dept) 5%, transparent); }
.dt-toolbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
.dt-toolbar .dt-search { position: relative; min-width: 220px; flex: 1; max-width: 340px; }
.dt-toolbar .dt-search i { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.dt-toolbar .dt-search input { padding-left: 2.1rem; }
.dt-foot { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; border-top: 1px solid var(--line); flex-wrap: wrap; gap: .5rem; font-size: .82rem; color: var(--muted); }
.pagination { margin: 0; } .page-link { border-radius: 8px !important; margin: 0 2px; border: 0; color: var(--bs-body-color); }
.page-item.active .page-link { background: var(--dept); }
.row-actions { white-space: nowrap; text-align: right; }
.col-hidden { display: none !important; }

.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-state i { font-size: 2.6rem; color: color-mix(in srgb, var(--dept) 60%, transparent); }
.empty-state h5 { margin-top: .75rem; font-weight: 600; }

/* ---------- Forms ---------- */
.form-label { font-weight: 600; font-size: .82rem; margin-bottom: .3rem; }
.form-control, .form-select { border-radius: 9px; }
.form-control:focus, .form-select:focus { border-color: var(--dept); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--dept) 18%, transparent); }
.req::after { content: " *"; color: var(--st-overdue); }
.help { cursor: help; color: var(--muted); font-size: .85em; }
.form-section { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; margin: 1.2rem 0 .6rem; display: flex; gap: .5rem; align-items: center; }
.form-section::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sticky-actions { position: sticky; bottom: 0; background: color-mix(in srgb, var(--card-bg) 94%, transparent); backdrop-filter: blur(6px); border-top: 1px solid var(--line); padding: .8rem 1rem; display: flex; gap: .5rem; justify-content: flex-end; border-radius: 0 0 var(--radius) var(--radius); z-index: 5; }
.select-filter { margin-bottom: .35rem; }

/* Permission grid */
.perm-grid th, .perm-grid td { text-align: center; vertical-align: middle; }
.perm-grid td:first-child, .perm-grid th:first-child { text-align: left; }
.perm-grid .form-check-input { width: 1.25em; height: 1.25em; cursor: pointer; }
.perm-grid .mod-row td:first-child { font-weight: 600; }
.perm-grid .grp td { background: color-mix(in srgb, var(--dept) 8%, transparent) !important; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--dept); }
.perm-grid .toggle-col, .perm-grid .toggle-row { cursor: pointer; font-size: .68rem; color: var(--muted); display: block; }
.perm-grid .toggle-col:hover, .perm-grid .toggle-row:hover { color: var(--dept); }

/* Org chart */
.org ul { list-style: none; padding-left: 1.6rem; margin: 0; position: relative; }
.org > ul { padding-left: 0; }
.org li { position: relative; padding: .3rem 0; }
.org ul ul li::before { content: ""; position: absolute; left: -1rem; top: 0; bottom: 0; border-left: 2px solid var(--line); }
.org ul ul li:last-child::before { bottom: auto; height: 1.55rem; }
.org ul ul li::after { content: ""; position: absolute; left: -1rem; top: 1.55rem; width: .9rem; border-top: 2px solid var(--line); }
.org-node { display: inline-flex; align-items: center; gap: .6rem; padding: .45rem .75rem .45rem .45rem; border-radius: 11px; border: 1px solid var(--line); background: var(--card-bg); box-shadow: var(--shadow-sm); border-left: 4px solid var(--dept); }
.org-node .nm { font-weight: 600; line-height: 1.15; }
.org-node .ds { font-size: .74rem; color: var(--muted); }
.org-toggle { border: 0; background: transparent; color: var(--muted); padding: 0 .2rem; }

/* Timeline (audit history) */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.6rem; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: -6px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li .dot { position: absolute; left: 0; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--dept); border: 3px solid var(--card-bg); box-shadow: 0 0 0 1px var(--line); }

/* Toasts */
.toast-zone { position: fixed; top: calc(var(--topbar-h) + 10px); right: 14px; z-index: 1090; display: flex; flex-direction: column; gap: .5rem; max-width: 420px; }
.toast { border: 0; border-radius: 12px; box-shadow: var(--shadow); border-left: 5px solid var(--tc, var(--st-progress)); background: var(--card-bg); }

/* Login */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: radial-gradient(1200px 600px at -10% -10%, #6366F1 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #0D9488 0%, transparent 55%), #0F172A; color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art .tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; max-width: 460px; }
.auth-art .tile { aspect-ratio: 1; border-radius: 16px; display: grid; place-items: center; font-size: 1.6rem; background: color-mix(in srgb, var(--c) 85%, transparent); box-shadow: 0 10px 25px color-mix(in srgb, var(--c) 30%, transparent); }
.auth-art .tile small { display: block; font-size: .6rem; text-align: center; margin-top: -1.2rem; opacity: .9; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--card-bg); }
.auth-card { width: 100%; max-width: 400px; }
.demo-list { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.demo-list button { display: flex; width: 100%; justify-content: space-between; gap: .5rem; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: .4rem .7rem; font-size: .8rem; text-align: left; color: inherit; }
.demo-list button:hover { background: var(--page-bg); }

/* ---------- Mobile ---------- */
.bottom-nav { display: none; }
.fab { display: none; }
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
  .sidebar-open .app-sidebar { transform: none; }
  .sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 1035; }
  .app-main, .sidebar-mini .app-main { margin-left: 0; }
  .sidebar-mini .app-sidebar .brand-text, .sidebar-mini .side-link .label, .sidebar-mini .nav-section { display: initial; }
  .app-content { padding: 1rem .85rem 5.5rem; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: calc(62px + env(safe-area-inset-bottom)); background: var(--card-bg); border-top: 1px solid var(--line); z-index: 1030; justify-content: space-around; padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .68rem; color: var(--muted); gap: 2px; position: relative; }
  .bottom-nav a i { font-size: 1.25rem; }
  .bottom-nav a.on { color: var(--owms-primary); font-weight: 600; }
  .fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: 76px; width: 56px; height: 56px; border-radius: 50%; background: var(--dept); color: #fff; font-size: 1.5rem; box-shadow: 0 8px 20px color-mix(in srgb, var(--dept) 45%, transparent); z-index: 1031; }
  .page-head .page-actions .hide-mobile { display: none; }
  .auth-wrap { grid-template-columns: 1fr; } .auth-art { display: none; }
}
/* Tables become cards on phones */
@media (max-width: 767.98px) {
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { border: 1px solid var(--line); border-radius: 12px; margin: .6rem .6rem; width: auto; padding: .4rem .2rem; background: var(--card-bg); box-shadow: var(--shadow-sm); }
  .table-cards td { border: 0; padding: .3rem .75rem; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  .table-cards td::before { content: attr(data-label); font-weight: 600; color: var(--muted); font-size: .75rem; text-align: left; }
  .table-cards td[data-label=""]::before { content: none; }
  .table-cards td.hide-m { display: none; }
  .table-cards td.row-actions { justify-content: flex-end; border-top: 1px solid var(--line); margin-top: .25rem; padding-top: .5rem; }
  .topbar-search kbd { display: none; }
}
@media print {
  .app-sidebar, .app-topbar, .bottom-nav, .fab, .page-actions, .dt-toolbar, .dt-foot, .toast-zone { display: none !important; }
  .app-main { margin: 0 !important; } .card { box-shadow: none; }
}

/* =========================================================================
   Phase 2 — tasks, approvals, notifications
   ========================================================================= */
.side-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--st-overdue); color: #fff; font-size: .68rem; font-weight: 700; display: inline-grid; place-items: center; }
.sidebar-mini .side-count { position: absolute; top: 2px; right: 8px; min-width: 16px; height: 16px; font-size: .6rem; }
.bn-count { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--st-overdue); color: #fff; font-size: .6rem; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.bell-menu { width: 340px; max-width: calc(100vw - 24px); border-radius: 12px; overflow: hidden; }
.bell-list { max-height: 380px; overflow-y: auto; }
.bell-item { display: flex; gap: .65rem; padding: .65rem .9rem; color: inherit; border-bottom: 1px solid var(--line); font-size: .85rem; }
.bell-item:hover { background: var(--page-bg); color: inherit; }
.bell-item.unread { background: color-mix(in srgb, var(--owms-primary) 7%, transparent); }
.bell-item.unread .fw-600::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--owms-primary); margin-right: .35rem; vertical-align: middle; }
.b-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); }
.min-w-0 { min-width: 0; }
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Priority + progress */
.prio { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; font-weight: 600; color: var(--p); }
.prio::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--p); transform: rotate(45deg); }
.pbar { height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; min-width: 60px; }
.pbar > span { display: block; height: 100%; background: var(--pc, var(--st-progress)); border-radius: 4px; transition: width .3s; }
.due-late { color: var(--st-overdue); font-weight: 600; }
.due-soon { color: #B45309; font-weight: 600; }
.view-tabs { display: flex; gap: .25rem; flex-wrap: wrap; }
.view-tabs a { padding: .45rem .85rem; border-radius: 9px; font-weight: 600; font-size: .85rem; color: var(--muted); border: 1px solid transparent; }
.view-tabs a.on { background: var(--card-bg); color: var(--bs-body-color); border-color: var(--line); box-shadow: var(--shadow-sm); }
.view-tabs a .n { font-size: .7rem; padding: .05rem .4rem; border-radius: 10px; background: var(--line); margin-left: .25rem; }
.layout-switch .btn.on { background: var(--dept); color: #fff; border-color: var(--dept); }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: .9rem; overflow-x: auto; padding-bottom: .5rem; }
.k-col { background: color-mix(in srgb, var(--kc) 6%, var(--page-bg)); border-radius: var(--radius); border: 1px solid var(--line); display: flex; flex-direction: column; min-height: 60vh; }
.k-head { padding: .7rem .9rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; border-bottom: 3px solid var(--kc); }
.k-head .k-n { margin-left: auto; font-size: .75rem; background: var(--card-bg); border-radius: 10px; padding: .05rem .5rem; color: var(--muted); }
.k-list { padding: .6rem; flex: 1; display: flex; flex-direction: column; gap: .55rem; transition: background .15s; border-radius: 0 0 var(--radius) var(--radius); }
.k-list.over { background: color-mix(in srgb, var(--kc) 14%, transparent); outline: 2px dashed var(--kc); outline-offset: -6px; }
.k-card { background: var(--card-bg); border: 1px solid var(--line); border-left: 4px solid var(--p); border-radius: 10px; padding: .6rem .7rem; box-shadow: var(--shadow-sm); cursor: grab; color: inherit; display: block; }
.k-card:hover { box-shadow: var(--shadow); color: inherit; }
.k-card.dragging { opacity: .45; transform: rotate(1deg); }
.k-card .k-title { font-weight: 600; font-size: .88rem; line-height: 1.25; margin: .15rem 0 .35rem; }
.k-empty { color: var(--muted); font-size: .8rem; text-align: center; padding: 1.2rem .5rem; border: 1px dashed var(--line); border-radius: 10px; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { margin-left: -6px; border: 2px solid var(--card-bg); }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar.xs { width: 22px; height: 22px; font-size: .58rem; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal .dow { font-size: .72rem; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: .45rem .5rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--page-bg) 60%, transparent); }
.cal .day { min-height: 112px; padding: .35rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: .78rem; overflow: hidden; }
.cal .day.out { background: color-mix(in srgb, var(--page-bg) 70%, transparent); color: var(--muted); }
.cal .day.today { background: color-mix(in srgb, var(--dept) 7%, transparent); }
.cal .day .dn { font-weight: 700; font-size: .8rem; }
.cal .day.today .dn { background: var(--dept); color: #fff; border-radius: 6px; padding: 0 .35rem; }
.cal .ev { display: block; margin-top: 3px; padding: 2px 6px; border-radius: 6px; background: color-mix(in srgb, var(--p) 14%, transparent); color: inherit; border-left: 3px solid var(--p); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .ev.done { opacity: .55; text-decoration: line-through; }
.cal .ev.late { background: #FEE2E2; border-left-color: var(--st-overdue); }
[data-bs-theme="dark"] .cal .ev.late { background: rgba(220,38,38,.18); }
.cal .hol { display: block; font-size: .7rem; color: #DB2777; font-weight: 600; }
@media (max-width: 767.98px) {
  .cal { grid-template-columns: 1fr; border: 0; }
  .cal .dow, .cal .day.out.empty { display: none; }
  .cal .day { min-height: 0; border: 1px solid var(--line); border-radius: 10px; margin-bottom: .4rem; }
  .cal .day.empty { display: none; }
  .cal .day .dn::after { content: " " attr(data-dow); font-weight: 500; color: var(--muted); }
}

/* Week strip on My Dashboard */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: .4rem; }
.week .wd { border: 1px solid var(--line); border-radius: 10px; padding: .45rem; min-height: 96px; font-size: .75rem; }
.week .wd.today { border-color: var(--dept); box-shadow: 0 0 0 2px color-mix(in srgb, var(--dept) 25%, transparent); }
.week .wd .h { font-weight: 700; font-size: .72rem; color: var(--muted); text-transform: uppercase; }
.week .wd a { display: block; margin-top: 3px; padding: 1px 5px; border-radius: 5px; background: color-mix(in srgb, var(--p) 14%, transparent); color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 767.98px) { .week { grid-template-columns: repeat(7, minmax(84px, 1fr)); overflow-x: auto; } }

/* Task detail */
.task-head { border-left: 5px solid var(--p); }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .8rem; }
.meta-grid .m-l { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.meta-grid .m-v { font-weight: 600; }
.chk-item { display: flex; align-items: center; gap: .6rem; padding: .45rem 0; border-bottom: 1px dashed var(--line); }
.chk-item:last-child { border-bottom: 0; }
.chk-item.done .t { text-decoration: line-through; color: var(--muted); }
.chk-btn { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line); display: grid; place-items: center; background: transparent; padding: 0; color: #fff; flex-shrink: 0; }
.chk-item.done .chk-btn { background: var(--st-done); border-color: var(--st-done); }
.action-bar { display: flex; flex-wrap: wrap; gap: .5rem; }
.action-bar .btn { min-height: 44px; }
.comment { display: flex; gap: .7rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: 0; }
.comment .bubble { background: var(--page-bg); border-radius: 0 12px 12px 12px; padding: .55rem .8rem; }
.comment.clar .bubble { background: #FEF3C7; }
[data-bs-theme="dark"] .comment.clar .bubble { background: rgba(245,158,11,.15); }
.mention { color: var(--owms-primary); font-weight: 600; background: color-mix(in srgb, var(--owms-primary) 10%, transparent); border-radius: 4px; padding: 0 3px; }
.mention-pop { position: absolute; left: 0; right: 0; top: 100%; background: var(--card-bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); z-index: 20; display: none; max-height: 240px; overflow: auto; }
.mention-pop.show { display: block; }
.mention-pop .itm { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: .45rem .75rem; }
.mention-pop .itm:hover { background: var(--page-bg); }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.file-tile { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card-bg); font-size: .78rem; position: relative; }
.file-tile .thumb { height: 96px; display: grid; place-items: center; background: var(--page-bg); font-size: 2rem; }
.file-tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-tile .nm { padding: .35rem .5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-tile form { position: absolute; top: 4px; right: 4px; }
.dropzone { border: 2px dashed var(--line); border-radius: 12px; padding: 1rem; text-align: center; color: var(--muted); }
.dropzone.border-primary { border-color: var(--dept) !important; background: color-mix(in srgb, var(--dept) 5%, transparent); }

/* People picker */
.people-picker { border: 1px solid var(--line); border-radius: 10px; }
.people-picker .pp-list { max-height: 260px; overflow-y: auto; padding: .25rem; }
.pp-item { display: flex; align-items: center; gap: .55rem; padding: .35rem .5rem; border-radius: 8px; cursor: pointer; margin: 0; }
.pp-item:hover { background: var(--page-bg); }
.pp-item input:checked + .avatar { box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 4px var(--dept); }

/* Approval step timeline */
.steps { display: flex; flex-direction: column; gap: 0; }
.step { display: flex; gap: .8rem; position: relative; padding-bottom: 1.1rem; }
.step::before { content: ""; position: absolute; left: 15px; top: 34px; bottom: 0; width: 2px; background: var(--line); }
.step:last-child::before { display: none; }
.step .s-dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; color: #fff; background: #CBD5E1; font-weight: 700; font-size: .8rem; z-index: 1; }
.step.done .s-dot { background: var(--st-done); } .step.current .s-dot { background: var(--st-pending); box-shadow: 0 0 0 5px color-mix(in srgb, var(--st-pending) 25%, transparent); }
.step.rejected .s-dot { background: var(--st-overdue); } .step.sent_back .s-dot { background: var(--st-progress); }
.step.not_needed { opacity: .55; } .step.skipped .s-dot { background: var(--st-closed); }
.step .s-body { flex: 1; min-width: 0; }
.log-item { display: flex; gap: .6rem; font-size: .84rem; padding: .45rem 0; border-bottom: 1px dashed var(--line); }
.log-item:last-child { border-bottom: 0; }

/* Dashboard widgets */
.widget-tools { display: none; gap: .25rem; margin-left: auto; }
.customizing .widget-tools { display: inline-flex; }
.customizing [data-widget] > .card { outline: 2px dashed color-mix(in srgb, var(--dept) 50%, transparent); outline-offset: 2px; }
[data-widget].w-hidden { display: none; }
.customizing [data-widget].w-hidden { display: block; opacity: .45; }
.today-row { display: flex; align-items: center; gap: .65rem; padding: .6rem 1rem; border-bottom: 1px solid var(--line); }
.today-row:last-child { border-bottom: 0; }
.notice-ph { background: repeating-linear-gradient(135deg, var(--card-bg), var(--card-bg) 10px, color-mix(in srgb, var(--dept) 4%, var(--card-bg)) 10px, color-mix(in srgb, var(--dept) 4%, var(--card-bg)) 20px); }

@media print {
  .action-bar, .comment-form, .upload-form, .widget-tools { display: none !important; }
}
.btn-outline-warning { --bs-btn-color: #B45309; --bs-btn-border-color: #F59E0B; --bs-btn-hover-bg: #F59E0B; --bs-btn-hover-border-color: #F59E0B; --bs-btn-hover-color: #fff; }

/* ---------- Phase 3: HR ---------- */
.att-grid { border-collapse: separate; border-spacing: 0; font-size: .74rem; }
.att-grid th, .att-grid td { padding: .3rem .25rem; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
.att-grid th.name, .att-grid td.name { text-align: left; position: sticky; left: 0; background: var(--card-bg); z-index: 2; min-width: 170px; padding-left: .6rem; }
.att-grid thead th { position: sticky; top: 0; background: var(--card-bg); z-index: 1; font-weight: 600; color: var(--muted); }
.att-grid th.we { color: #DB2777; }
.att-grid th.td-today { color: var(--dept); }
.ac { display: inline-grid; place-items: center; min-width: 26px; height: 22px; border-radius: 6px; font-weight: 700; font-size: .68rem; }
.ac-P, .ac-OD { background: #DCFCE7; color: #15803D; } .ac-A { background: #FEE2E2; color: #B91C1C; }
.ac-HD, .ac-HDL { background: #FEF3C7; color: #B45309; } .ac-L { background: #DBEAFE; color: #1D4ED8; }
.ac-H { background: #FCE7F3; color: #BE185D; } .ac-WO { background: #F3F4F6; color: #6B7280; }
.ac-none { color: var(--muted); }
.ac.late { box-shadow: inset 0 -3px 0 #F59E0B; }
[data-bs-theme="dark"] .ac-P, [data-bs-theme="dark"] .ac-OD { background: #14532D; color: #BBF7D0; }
[data-bs-theme="dark"] .ac-A { background: #7F1D1D; color: #FECACA; }
[data-bs-theme="dark"] .ac-HD, [data-bs-theme="dark"] .ac-HDL { background: #78350F; color: #FDE68A; }
[data-bs-theme="dark"] .ac-L { background: #1E3A8A; color: #BFDBFE; }
[data-bs-theme="dark"] .ac-H { background: #831843; color: #FBCFE8; }
[data-bs-theme="dark"] .ac-WO { background: #1F2937; color: #9CA3AF; }
.punch-card { max-width: 520px; margin: 0 auto; text-align: center; }
.punch-clock { font-size: 3rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.punch-btn { width: 180px; height: 180px; border-radius: 50%; font-size: 1.25rem; font-weight: 700; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; border: 0; color: #fff; box-shadow: 0 10px 30px color-mix(in srgb, var(--pb) 40%, transparent); background: var(--pb); transition: transform .1s; }
.punch-btn:active { transform: scale(.97); }
.punch-btn i { font-size: 2.4rem; }
.punch-btn:disabled { opacity: .6; }
.cam-box { position: relative; width: 220px; height: 220px; margin: 0 auto; border-radius: 50%; overflow: hidden; background: #0F172A; }
.cam-box video, .cam-box img { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.bal-card { border-radius: 12px; padding: .9rem 1rem; border: 1px solid var(--line); background: var(--card-bg); position: relative; overflow: hidden; height: 100%; }
.bal-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--lc); }
.bal-card .n { font-size: 1.8rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.bal-card .bar { height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: .55rem; }
.bal-card .bar span { display: block; height: 100%; background: var(--lc); }
.pipe { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; }
.pipe .col-s { background: color-mix(in srgb, var(--page-bg) 70%, transparent); border-radius: 12px; padding: .5rem; min-height: 120px; }
.pipe .col-s h6 { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: .2rem .2rem .5rem; }
.pipe .cand { display: block; background: var(--card-bg); border: 1px solid var(--line); border-radius: 10px; padding: .5rem .6rem; margin-bottom: .45rem; color: inherit; font-size: .82rem; }
.pipe .cand:hover { border-color: var(--dept); }
.slip-table td, .slip-table th { padding: .35rem .5rem; }
.slip-net { background: var(--dept); color: #fff; border-radius: 12px; padding: .9rem 1.1rem; }
.lv-chip { display: inline-block; padding: 1px 6px; border-radius: 6px; font-size: .7rem; font-weight: 600; color: #fff; background: var(--lc, #DB2777); }
.meter { height: 8px; border-radius: 5px; background: var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--dept); }
@media print { .att-grid th.name, .att-grid td.name { position: static; } }

/* ---- Phase 7: Gantt timeline (projects) ---- */
.gantt { --gl: 260px; font-size: .82rem; overflow-x: auto; }
.gantt-compact { --gl: 200px; }
.gantt .g-head, .gantt .g-row { display: flex; min-width: 720px; }
.gantt .g-label { flex: 0 0 var(--gl); padding: 6px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--bs-border-color); }
.gantt .g-track { position: relative; flex: 1 1 auto; height: 32px; }
.gantt .g-head .g-track { height: 26px; border-bottom: 1px solid var(--bs-border-color); }
.gantt .g-week { position: absolute; top: 5px; font-size: .7rem; color: var(--bs-secondary-color); transform: translateX(2px); white-space: nowrap; }
.gantt .g-week.m { color: var(--bs-body-color); font-weight: 600; }
.gantt .g-row { border-bottom: 1px dashed var(--bs-border-color-translucent); }
.gantt .g-row.g-ms { background: color-mix(in srgb, #2563EB 5%, transparent); }
.gantt .g-grid { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--bs-border-color-translucent); }
.gantt .g-today { position: absolute; top: 0; bottom: 0; border-left: 2px solid #DC2626; z-index: 2; }
.gantt .g-bar { position: absolute; top: 9px; height: 14px; border-radius: 4px; background: color-mix(in srgb, #2563EB 28%, transparent); overflow: hidden; z-index: 1; min-width: 4px; }
.gantt .g-bar .g-fill { display: block; height: 100%; background: #2563EB; }
.gantt .g-bar.late { background: color-mix(in srgb, #DC2626 25%, transparent); }
.gantt .g-bar.late .g-fill { background: #DC2626; }
.gantt .g-bar.done .g-fill { background: #16A34A; }
.gantt .g-msbar { top: 14px; height: 4px; background: color-mix(in srgb, #2563EB 35%, transparent); }
.gantt .g-diamond { position: absolute; top: 9px; width: 14px; height: 14px; margin-left: -7px; background: #2563EB; transform: rotate(45deg); z-index: 3; border-radius: 2px; }
.gantt .g-diamond.done { background: #16A34A; }
.gantt .g-diamond.late { background: #DC2626; }
.ts-grid input { min-width: 56px; text-align: right; }
.ts-grid input[name=description] { text-align: left; }
.ts-grid td.wk-off, .ts-grid th.wk-off { background: color-mix(in srgb, var(--bs-secondary-bg) 70%, transparent); }
.room-strip { position: relative; height: 40px; background: repeating-linear-gradient(90deg, transparent 0, transparent calc(100% / 12 - 1px), var(--bs-border-color-translucent) calc(100% / 12 - 1px), var(--bs-border-color-translucent) calc(100% / 12)); border-radius: 6px; }
.room-strip .rb { position: absolute; top: 4px; bottom: 4px; border-radius: 5px; color: #fff; font-size: .72rem; padding: 2px 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@media print { .visitor-pass { border: 2px solid #000 !important; } }

/* Internal messages (Phase 8) */
.chat-list { max-height: calc(100vh - 220px); overflow: auto; }
.chat-list .active-conv { background: color-mix(in srgb, var(--dept, #4F46E5) 10%, transparent) !important; }
.chat-ava { width: 36px; height: 36px; border-radius: 50%; color: #fff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.chat-card { display: flex; flex-direction: column; height: calc(100vh - 200px); min-height: 420px; }
.chat-body { flex: 1; overflow: auto; padding: 14px; background: var(--bs-tertiary-bg); }
.chat-msg { max-width: 78%; margin-bottom: 10px; }
.chat-msg.mine { margin-left: auto; text-align: right; }
.chat-bubble { display: inline-block; text-align: left; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: 12px; padding: 7px 11px; font-size: .9rem; word-break: break-word; }
.chat-msg.mine .chat-bubble { background: #4F46E5; color: #fff; border-color: #4F46E5; }
.chat-msg.mine .chat-bubble a { color: #E0E7FF; }
.chat-who { font-size: .72rem; color: var(--muted); margin: 0 0 2px 4px; }
.chat-time { font-size: .68rem; color: var(--muted); margin: 2px 4px 0; }
@media (max-width: 991px) { .chat-card { height: calc(100vh - 230px); } }

/* ===== Mobile & installed app (v8.1) ===== */
.k-card { position: relative; }
.k-move { position: absolute; top: .35rem; right: .35rem; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--card-bg); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; opacity: 0; transition: opacity .15s; padding: 0; }
.k-card:hover .k-move, .k-card:focus-within .k-move, .k-move:focus { opacity: 1; }
@media (hover: none) { .k-move { opacity: 1; } }
.k-card .d-flex.justify-content-between:first-child { padding-right: 34px; }
.k-move-menu { position: fixed; z-index: 1080; min-width: 190px; background: var(--card-bg); border: 1px solid var(--line); border-radius: 12px; padding: .35rem; }
.k-move-menu .k-move-h { font-size: .72rem; color: var(--muted); text-transform: uppercase; font-weight: 700; padding: .35rem .6rem; }
.k-move-menu button { display: flex; align-items: center; gap: .55rem; width: 100%; border: 0; background: none; text-align: left; padding: .6rem .6rem; border-radius: 8px; font-weight: 600; color: inherit; }
.k-move-menu button i { font-size: .55rem; }
.k-move-menu button:hover, .k-move-menu button:focus { background: color-mix(in srgb, var(--kc) 12%, transparent); }
@media (max-width: 767.98px) {
  /* one column per screen, swipe sideways */
  .kanban { grid-template-columns: repeat(4, 84vw); scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; margin: 0 -.85rem; padding: 0 .85rem .5rem; scroll-padding: 0 .85rem; }
  .k-col { scroll-snap-align: start; min-height: 50vh; }
  .k-card { cursor: pointer; }
}
/* every wide table can be swiped sideways instead of stretching the page */
.table-responsive, .table-wrap { -webkit-overflow-scrolling: touch; }
/* larger touch targets on phones */
@media (pointer: coarse) {
  .btn-sm, .form-select-sm, .form-control-sm { min-height: 36px; }
  .dropdown-item { padding-top: .55rem; padding-bottom: .55rem; }
}
/* installed app: respect the iPhone notch / home bar */
html.pwa .app-topbar { padding-top: env(safe-area-inset-top); }
@media (max-width: 767.98px) {
  /* filter bars: wrap instead of pushing the page sideways */
  .app-content form.d-flex:not(.flex-nowrap) { flex-wrap: wrap; }
  .app-content .form-select[style*="width:auto"], .app-content .form-select[style*="width: auto"] { max-width: 100%; }
}

/* ===== 8.2: product brand in the sidebar, the user's company at the top ===== */
.app-sidebar .brand-logo.product { background: transparent; }
.app-sidebar .brand-logo.product img { background: transparent; object-fit: cover; }
.app-sidebar .brand-text { letter-spacing: .6px; font-size: .9rem; }
.tb-company { display: flex; align-items: center; gap: .6rem; min-width: 0; flex: 0 1 auto; max-width: 340px; color: var(--bs-body-color); padding: .25rem .5rem .25rem .25rem; border-radius: 10px; margin-right: .5rem; }
.tb-company:hover { background: var(--page-bg); color: var(--bs-body-color); }
.tb-company-logo { width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0; display: grid; place-items: center; overflow: hidden; background: color-mix(in srgb, var(--owms-primary) 12%, transparent); color: var(--owms-primary); font-size: 1.1rem; }
.tb-company-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.tb-company-text { min-width: 0; line-height: 1.15; }
.tb-company-name { display: block; font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-company-text small { display: block; font-size: .68rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .3px; }
@media (max-width: 575.98px) {
  .tb-company { flex: 1 1 auto; max-width: none; margin-right: 0; padding-right: .25rem; gap: .45rem; }
  .tb-company-logo { width: 30px; height: 30px; font-size: .95rem; }
  .tb-company-logo.generic { display: none; }
  .tb-company-name { font-size: .82rem; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.15; }
  .tb-company-text small { display: none; }
  .app-topbar { gap: .25rem; padding: 0 .5rem; }
  .app-topbar .tb-btn { width: 34px; }
}
@media print { .tb-company { display: none !important; } }
.auth-company { display: flex; align-items: center; gap: .7rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 1.5rem; background: var(--card-bg); }
.auth-company .tb-company-logo { width: 42px; height: 42px; }
.auth-company .min-w-0 { min-width: 0; }

/* 9.5.0 — a page shown inside "Ask MCB" (?embed=1): no menus, compact */
body.embed .app-sidebar, body.embed .sidebar-backdrop, body.embed .app-topbar, body.embed .bottom-nav,
body.embed .breadcrumb, body.embed .fab { display: none !important; }
body.embed .app-main, body.embed.sidebar-mini .app-main { margin-left: 0 !important; min-height: 0; }
body.embed .app-content { padding: .75rem .75rem 1rem !important; }
body.embed .page-head { margin-bottom: .6rem; }
body.embed .page-head h1 { font-size: 1.1rem; }

/* 9.5.0 — Ask MCB */
.ask-box { display: flex; gap: .5rem; }
.ask-box input { font-size: 1.05rem; }
.ask-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.ask-chip { border: 1px solid var(--bs-border-color); background: var(--bs-body-bg); border-radius: 999px; padding: .25rem .75rem; font-size: .85rem; cursor: pointer; }
.ask-chip:hover { border-color: var(--owms-primary); color: var(--owms-primary); }
.ask-q { align-self: flex-end; max-width: 85%; background: var(--owms-primary); color: #fff; border-radius: 14px 14px 4px 14px; padding: .5rem .85rem; }
.ask-a { border-radius: 14px; }
.ask-frame { width: 100%; height: 72vh; border: 1px solid var(--bs-border-color); border-radius: 10px; background: var(--bs-body-bg); }
.ask-thread { display: flex; flex-direction: column; gap: .8rem; }
