/* Cymru Compliance portal — app shell & components (builds on ../../css/style.css variables) */
html, body { height: 100%; }
body.portal { background: var(--slate-50); color: var(--ink); }
[hidden] { display: none !important; }

/* ---------- boot / auth ---------- */
#boot { display: flex; align-items: center; justify-content: center; height: 100vh; color: var(--slate-600); font-weight: 600; }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: linear-gradient(160deg, var(--navy-900), var(--blue-600) 140%); color: #fff; padding: 64px 56px; display: flex; flex-direction: column; justify-content: center; }
.auth-side h1 { color: #fff; font-size: 2.2rem; }
.auth-side p { color: rgba(255,255,255,0.8); }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { padding: 28px 22px; } .auth-side h1 { font-size: 1.45rem; } .auth-side p { margin: 0; font-size: 0.92rem; } .auth-main { align-items: flex-start; } }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: #fff; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand-row { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; color: var(--navy-900); margin-bottom: 24px; }
.auth-card .brand-row img { width: 40px; height: 40px; }
.tabs { display: flex; gap: 4px; background: var(--slate-100); border-radius: 10px; padding: 4px; margin-bottom: 22px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 9px 10px; border-radius: 8px; font-weight: 700; font-size: 0.86rem; color: var(--slate-600); cursor: pointer; }
.tabs button.active { background: #fff; color: var(--navy-900); box-shadow: var(--shadow-sm); }
.form-error { background: var(--status-red-bg); color: #9b2b2b; border: 1px solid #f0c3c3; border-radius: 8px; padding: 10px 12px; font-size: 0.88rem; margin-bottom: 14px; }
.form-info { background: var(--sky-100); color: var(--navy-800); border: 1px solid var(--sky-300); border-radius: 8px; padding: 10px 12px; font-size: 0.88rem; margin-bottom: 14px; }
.demo-box { margin-top: 24px; padding: 16px; border: 1px dashed var(--sky-300); border-radius: 12px; background: var(--sky-100); }
.demo-box h4 { margin: 0 0 4px; font-size: 0.95rem; }
.demo-box p { font-size: 0.82rem; margin: 0 0 10px; }
.demo-roles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-roles button { text-align: left; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--slate-200); background: #fff; cursor: pointer; font-size: 0.8rem; font-weight: 700; color: var(--navy-800); }
.demo-roles button small { display: block; font-weight: 500; color: var(--slate-600); font-size: 0.72rem; }
.demo-roles button:hover { border-color: var(--blue-500); }
.link-btn { background: none; border: 0; color: var(--blue-600); font-weight: 600; cursor: pointer; padding: 0; font-size: 0.88rem; }

/* ---------- app shell ---------- */
#app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--navy-900); color: #fff; padding: 20px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand-row { display: flex; align-items: center; gap: 10px; font-weight: 800; padding: 4px 8px 18px; font-size: 1.02rem; }
.sidebar .brand-row img { width: 34px; height: 34px; background: #fff; border-radius: 8px; padding: 2px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; color: rgba(255,255,255,0.78); font-weight: 600; font-size: 0.92rem; text-decoration: none; }
.sidebar nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar nav a.active { background: rgba(79,182,232,0.2); color: #fff; }
.sidebar nav a .ico { width: 20px; text-align: center; }
.sidebar .side-foot { font-size: 0.78rem; color: rgba(255,255,255,0.55); padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,0.12); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 40; background: #fff; border-bottom: 1px solid var(--slate-200); display: flex; align-items: center; gap: 12px; padding: 12px 24px; }
.topbar h2 { font-size: 1.15rem; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar select { max-width: 240px; padding: 8px 10px; border: 1px solid var(--slate-200); border-radius: 8px; background: var(--slate-50); font-family: inherit; font-size: 0.88rem; }
.menu-btn { display: none; border: 0; background: none; font-size: 1.5rem; cursor: pointer; padding: 4px 8px; color: var(--navy-900); }
.user-pill { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--blue-600), var(--sky-400)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.8rem; }
.user-pill .who { line-height: 1.15; }
.user-pill .who small { display: block; color: var(--slate-400); font-size: 0.72rem; }
#view { padding: 24px; max-width: 1280px; width: 100%; }
.sidebar-scrim { display: none; }

@media (max-width: 960px) {
  #app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 90; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform 180ms ease; }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(10,31,61,0.5); z-index: 80; }
  .menu-btn { display: block; }
  .user-pill .who { display: none; }
  .topbar { padding: 10px 14px; }
  #view { padding: 16px 14px 40px; }
}

/* ---------- page furniture ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 1.5rem; margin: 0; }
.page-head p { margin: 4px 0 0; font-size: 0.92rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-sm { padding: 7px 13px; font-size: 0.82rem; border-radius: 8px; }
.btn-danger { background: #fff; color: var(--status-red); border-color: #f0c3c3; }
.btn-danger:hover { background: var(--status-red-bg); }
.panel { background: #fff; border: 1px solid var(--slate-200); border-radius: 14px; padding: 20px; box-shadow: var(--shadow-sm); }
.panel h3 { font-size: 1.02rem; margin-bottom: 12px; }
.panel + .panel { margin-top: 16px; }
.grid-kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.grid-charts { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .grid-kpi { grid-template-columns: 1fr 1fr; } .grid-charts { grid-template-columns: 1fr; } .cols-2 { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .grid-kpi { grid-template-columns: 1fr; } }
.kpi { background: #fff; border: 1px solid var(--slate-200); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow-sm); }
.kpi .label { font-size: 0.78rem; font-weight: 700; color: var(--slate-600); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi .value { font-size: 2rem; font-weight: 800; color: var(--navy-900); line-height: 1.1; margin: 6px 0 2px; }
.kpi .sub { font-size: 0.82rem; color: var(--slate-600); }
.kpi.green .value { color: var(--status-green); } .kpi.amber .value { color: var(--status-amber); } .kpi.red .value { color: var(--status-red); }
.chart-box { position: relative; height: 230px; }
.empty { text-align: center; color: var(--slate-600); padding: 32px 12px; font-size: 0.92rem; }
.muted { color: var(--slate-600); } .small { font-size: 0.82rem; }
.banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-size: 0.9rem; }
.banner.info { background: var(--sky-100); border: 1px solid var(--sky-300); color: var(--navy-800); }
.banner.warn { background: var(--status-amber-bg); border: 1px solid #f0d9a6; color: #7a4f00; }

/* ---------- chips ---------- */
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; white-space: nowrap; }
.chip-green { background: var(--status-green-bg); color: #146c3a; }
.chip-amber { background: var(--status-amber-bg); color: #8a5600; }
.chip-red { background: var(--status-red-bg); color: #a02727; }
.chip-blue { background: var(--sky-100); color: var(--blue-600); }
.chip-none, .chip-grey { background: var(--slate-100); color: var(--slate-600); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--slate-200); border-radius: 12px; background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 640px; }
table.data th { text-align: left; padding: 11px 14px; background: var(--slate-50); color: var(--slate-600); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--slate-200); white-space: nowrap; }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--slate-100); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: var(--slate-50); }
table.data td.actions-cell { white-space: nowrap; text-align: right; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.filters select, .filters input { padding: 8px 10px; border: 1px solid var(--slate-200); border-radius: 8px; background: #fff; font-family: inherit; font-size: 0.88rem; }

/* ---------- category cards ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 1100px) { .cat-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .cat-grid { grid-template-columns: 1fr; } }
.cat-card { background: #fff; border: 1px solid var(--slate-200); border-left-width: 5px; border-radius: 12px; padding: 14px 16px; text-align: left; cursor: pointer; font-family: inherit; width: 100%; }
.cat-card:hover { box-shadow: var(--shadow-md); }
.cat-card.green { border-left-color: var(--status-green); } .cat-card.amber { border-left-color: #e0a100; } .cat-card.red { border-left-color: var(--status-red); } .cat-card.none { border-left-color: var(--slate-200); }
.cat-card .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cat-card strong { color: var(--navy-900); font-size: 0.95rem; }
.cat-card .score { font-size: 1.5rem; font-weight: 800; color: var(--navy-900); margin-top: 6px; }
.cat-card .meta { font-size: 0.8rem; color: var(--slate-600); }
.progress { height: 8px; border-radius: 4px; background: var(--slate-100); overflow: hidden; min-width: 70px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue-600), var(--sky-400)); }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--slate-100); font-size: 0.92rem; }
.list li:last-child { border-bottom: 0; }
.list .sub { color: var(--slate-600); font-size: 0.8rem; }

/* ---------- self-assessment ---------- */
.q-card { padding: 14px 0; border-bottom: 1px solid var(--slate-100); }
.q-card:last-child { border-bottom: 0; }
.q-card .q-text { font-weight: 600; margin-bottom: 8px; font-size: 0.93rem; }
.q-card .q-hint { display:block; margin-top:4px; font-size:12.5px; color:var(--slate-600); font-weight:400; }
.q-card .q-ref { color: var(--blue-600); font-weight: 800; margin-right: 6px; }
.answers { display: flex; gap: 6px; flex-wrap: wrap; }
.answers label { cursor: pointer; }
.answers input { position: absolute; opacity: 0; pointer-events: none; }
.answers span { display: inline-block; padding: 6px 14px; border: 1px solid var(--slate-200); border-radius: 999px; font-size: 0.82rem; font-weight: 700; color: var(--slate-600); background: #fff; }
.answers input:checked + span.a-yes { background: var(--status-green-bg); border-color: var(--status-green); color: #146c3a; }
.answers input:checked + span.a-partial { background: var(--status-amber-bg); border-color: #e0a100; color: #8a5600; }
.answers input:checked + span.a-no { background: var(--status-red-bg); border-color: var(--status-red); color: #a02727; }
.answers input:checked + span.a-na { background: var(--slate-100); border-color: var(--slate-400); color: var(--slate-800); }
.answers input:focus-visible + span { outline: 2px solid var(--blue-500); outline-offset: 2px; }
.q-card textarea { width: 100%; margin-top: 8px; padding: 8px 10px; border: 1px solid var(--slate-200); border-radius: 8px; font-family: inherit; font-size: 0.85rem; min-height: 38px; }

/* ---------- modal & toasts ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 500; background: rgba(10,31,61,0.55); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 14px; overflow-y: auto; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 520px; box-shadow: var(--shadow-lg); }
.modal-wide { max-width: 820px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--slate-100); }
.modal-head h3 { margin: 0; font-size: 1.1rem; }
.icon-btn { border: 0; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--slate-600); padding: 0 6px; }
.modal-body { padding: 18px 20px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal-error { background: var(--status-red-bg); color: #9b2b2b; border-radius: 8px; padding: 9px 12px; font-size: 0.86rem; margin-bottom: 12px; }
.checks { display: grid; gap: 6px; max-height: 220px; overflow-y: auto; border: 1px solid var(--slate-200); border-radius: 8px; padding: 10px; }
.checks label { display: flex; gap: 8px; align-items: center; font-size: 0.9rem; font-weight: 500; margin: 0; }
.checks input { width: auto; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 900; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--navy-900); color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 0.88rem; box-shadow: var(--shadow-md); max-width: 340px; transition: opacity 300ms; }
.toast-err { background: #9b2b2b; } .toast.hide { opacity: 0; }

/* ---------- misc ---------- */
.field.inline { display: flex; align-items: center; gap: 10px; }
.qr { background: #fff; border: 1px solid var(--slate-200); border-radius: 12px; padding: 10px; display: inline-block; }
.qr img { width: 180px; height: 180px; }
code.secret { background: var(--slate-100); padding: 3px 8px; border-radius: 6px; font-size: 0.85rem; word-break: break-all; }
.print-only { display: none; }
@media print {
  .sidebar, .topbar, .actions, .btn, #toasts, .modal-foot { display: none !important; }
  #app { display: block; } #view { padding: 0; } .print-only { display: block; }
  body.portal { background: #fff; }
}

/* ==========================================================================
   Modern & friendly theme — matches the marketing site (soft gradients,
   rounded cards, pill buttons, gentle shadows). Loaded last so it overrides.
   ========================================================================== */
body.portal {
  background:
    radial-gradient(900px 420px at 100% -80px, rgba(79,182,232,0.20), transparent 65%),
    radial-gradient(700px 380px at -10% 30%, rgba(20,103,199,0.07), transparent 60%),
    var(--slate-50);
  background-attachment: fixed;
}

/* buttons: friendly pills */
.btn { border-radius: 999px; }
.btn-sm { border-radius: 999px; padding: 8px 16px; }

/* ---- sidebar: floating gradient panel ---- */
#app { grid-template-columns: 276px 1fr; }
.sidebar {
  margin: 14px 0 14px 14px; height: calc(100vh - 28px); top: 14px;
  border-radius: 24px; padding: 20px 14px;
  background: linear-gradient(170deg, var(--navy-900) 0%, var(--navy-700) 55%, #1a5aa8 130%);
  box-shadow: var(--shadow-lg);
}
.sidebar .brand-row { padding: 6px 10px 20px; font-size: 1.08rem; letter-spacing: -0.01em; }
.sidebar .brand-row img { border-radius: 12px; width: 38px; height: 38px; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.sidebar nav { gap: 4px; }
.sidebar nav a { border-radius: 14px; padding: 11px 14px; transition: background 160ms, transform 160ms; }
.sidebar nav a:hover { background: rgba(255,255,255,0.10); transform: translateX(2px); }
.sidebar nav a.active { background: #fff; color: var(--navy-900); box-shadow: 0 6px 16px rgba(0,0,0,.18); }
.sidebar nav a .ico { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar nav a.active .ico { color: var(--blue-600); }
.sidebar .side-foot { border-top-color: rgba(255,255,255,.14); }

/* ---- top bar ---- */
.topbar { background: rgba(255,255,255,0.92); border: 0; margin: 14px 24px 0 14px; border-radius: 18px; box-shadow: var(--shadow-sm); top: 14px; }
.topbar select { border-radius: 999px; padding: 8px 14px; }
.avatar { width: 36px; height: 36px; box-shadow: 0 4px 10px rgba(20,103,199,.3); }
#view { padding: 26px 24px 48px 14px; }

/* ---- headings & greeting ---- */
.page-head h1 { font-size: 1.75rem; letter-spacing: -0.02em; }
.greet { font-size: 0.95rem; font-weight: 700; color: var(--blue-600); margin-bottom: 4px; }

/* ---- cards ---- */
.panel, .kpi, .cat-card, .table-wrap { border-radius: 20px; border-color: rgba(221,229,238,.8); box-shadow: 0 1px 2px rgba(10,31,61,.04), 0 8px 24px rgba(10,31,61,.05); }
.panel { padding: 24px; }
.panel h3 { font-size: 1.08rem; }
.kpi { position: relative; overflow: hidden; padding: 20px 22px; transition: transform 180ms, box-shadow 180ms; }
.kpi::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: linear-gradient(90deg, var(--blue-600), var(--sky-400)); }
.kpi.green::before { background: linear-gradient(90deg, #1f9d55, #5fd18d); }
.kpi.amber::before { background: linear-gradient(90deg, #e0a100, #ffcf5c); }
.kpi.red::before { background: linear-gradient(90deg, #d64545, #ff8a8a); }
.kpi:hover, .cat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi .value { font-size: 2.3rem; letter-spacing: -0.02em; }
.cat-card { border-left-width: 1px; border-top: 4px solid var(--slate-200); transition: transform 180ms, box-shadow 180ms; }
.cat-card.green { border-top-color: var(--status-green); } .cat-card.amber { border-top-color: #e0a100; } .cat-card.red { border-top-color: var(--status-red); }
.banner { border-radius: 16px; }
.chip { padding: 4px 12px; }
.progress { height: 10px; border-radius: 999px; } .progress > span { border-radius: 999px; }

/* ---- tables ---- */
table.data th { background: transparent; }
table.data tr:hover td { background: var(--sky-100); }
.table-wrap { overflow-x: auto; }

/* ---- forms ---- */
.field input, .field select, .field textarea, .filters select, .filters input, .q-card textarea { border-radius: 12px; }
.answers span { padding: 8px 18px; transition: transform 120ms, border-color 120ms; }
.answers label:hover span { border-color: var(--blue-500); transform: translateY(-1px); }

/* ---- modal ---- */
.modal { border-radius: 24px; }
.modal-overlay { backdrop-filter: blur(3px); }
.toast { border-radius: 14px; }

/* ---- sign-in screens ---- */
.auth-side {
  position: relative; overflow: hidden;
  background: linear-gradient(155deg, var(--navy-900) 0%, var(--navy-700) 50%, var(--blue-600) 130%);
}
.auth-side::before, .auth-side::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.auth-side::before { width: 420px; height: 420px; right: -140px; top: -120px; background: radial-gradient(circle, rgba(79,182,232,.45), transparent 70%); }
.auth-side::after { width: 360px; height: 360px; left: -120px; bottom: -140px; background: radial-gradient(circle, rgba(143,212,245,.25), transparent 70%); }
.auth-side > * { position: relative; z-index: 1; }
.auth-side h1 { font-size: 2.5rem; letter-spacing: -0.02em; }
.auth-main { background: linear-gradient(180deg, #fff, var(--slate-50)); }
.auth-card { background: #fff; padding: 34px 30px; border-radius: 28px; box-shadow: var(--shadow-lg); border: 1px solid var(--slate-100); }
.tabs { border-radius: 999px; } .tabs button { border-radius: 999px; }
.demo-box { border-radius: 20px; }
.demo-roles button { border-radius: 14px; transition: transform 140ms, border-color 140ms, box-shadow 140ms; }
.demo-roles button:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

/* ---- mobile ---- */
@media (max-width: 960px) {
  #app { grid-template-columns: 1fr; }
  .sidebar { margin: 0; top: 0; height: 100vh; border-radius: 0 24px 24px 0; width: 280px; }
  .topbar { margin: 10px 10px 0; padding: 10px 14px; top: 10px; }
  #view { padding: 18px 12px 40px; }
  .page-head h1 { font-size: 1.4rem; }
  .auth-card { box-shadow: none; border: 0; padding: 12px 4px; }
}
@media print { .sidebar, .topbar { display: none !important; } }

/* user icon -> settings; logo on sign-in side */
a.user-pill { color: inherit; text-decoration: none; padding: 4px 10px 4px 4px; border-radius: 999px; transition: background 160ms; cursor: pointer; }
a.user-pill:hover { background: var(--sky-100); text-decoration: none; }
.auth-logo { width: 72px; height: 72px; background: #fff; border-radius: 20px; padding: 6px; margin-bottom: 24px; box-shadow: 0 10px 28px rgba(0,0,0,.25); }
@media (max-width: 900px) { .auth-logo { width: 44px; height: 44px; border-radius: 12px; padding: 3px; margin-bottom: 12px; } }

/* bigger, centred sign-in logo */
.auth-side { align-items: center; text-align: center; }
.auth-logo { width: 150px; height: 150px; border-radius: 34px; padding: 12px; margin: 0 auto 32px; display: block; }
@media (max-width: 900px) { .auth-logo { width: 84px; height: 84px; border-radius: 22px; padding: 6px; margin-bottom: 14px; } }

/* ==========================================================================
   HR module
   ========================================================================== */
.hr-avatar { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: var(--sky-100); color: var(--blue-600); font-weight: 800; font-size: 0.85rem; box-shadow: 0 0 0 2px #fff, 0 2px 8px rgba(10,31,61,.12); }
.hr-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hr-avatar-sm { width: 30px; height: 30px; font-size: 0.7rem; }
.hr-avatar-lg { width: 72px; height: 72px; font-size: 1.4rem; }
.hr-avatar-xl { width: 92px; height: 92px; font-size: 1.8rem; }
.hr-avatar-init { background: linear-gradient(135deg, var(--sky-100), var(--sky-300)); color: var(--navy-800); }
.hr-person { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 600; }
a.hr-person:hover { text-decoration: none; color: var(--blue-600); }
.hr-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: baseline; }
.hr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.hr-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; background: #fff; border: 1px solid var(--slate-200); border-radius: 20px;
  padding: 20px 14px 14px; cursor: pointer; font-family: inherit; transition: transform 160ms, box-shadow 160ms, border-color 160ms; }
.hr-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--sky-300); }
.hr-card-name { font-weight: 800; color: var(--navy-900); margin-top: 8px; }
.hr-card-sub { font-size: 0.84rem; color: var(--slate-600); }
.hr-card-chips { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; min-height: 24px; margin-top: 4px; }
.hr-card-foot { font-size: 0.78rem; color: var(--slate-400); margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--slate-100); width: 100%; }
.hr-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; }
.hr-name { font-size: 1.35rem; font-weight: 800; color: var(--navy-900); }
.hr-photo-row { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.hr-h { margin: 18px 0 10px; font-size: 0.95rem; color: var(--navy-800); padding-bottom: 6px; border-bottom: 1px solid var(--slate-100); }
.hr-dl { display: grid; grid-template-columns: 200px 1fr; gap: 8px 16px; margin: 0; font-size: 0.92rem; }
.hr-dl dt { color: var(--slate-600); font-weight: 600; } .hr-dl dd { margin: 0; word-break: break-word; }
@media (max-width: 560px) { .hr-dl { grid-template-columns: 1fr; gap: 0; } .hr-dl dt { margin-top: 10px; } }
.hr-tabs { margin-bottom: 16px; flex-wrap: wrap; }
.hr-tabs button { white-space: nowrap; }
.hr-bal { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px) { .hr-bal { grid-template-columns: 1fr 1fr; } }

/* calendar */
.cal-head { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 12px; }
.cal-head strong { min-width: 160px; text-align: center; font-size: 1.05rem; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { text-align: center; font-size: 0.74rem; font-weight: 700; color: var(--slate-600); text-transform: uppercase; padding: 4px 0; }
.cal-cell { min-height: 96px; background: #fff; border: 1px solid var(--slate-100); border-radius: 10px; padding: 4px; overflow: hidden; }
.cal-empty { background: transparent; border-color: transparent; }
.cal-we { background: var(--slate-50); }
.cal-today { border-color: var(--blue-500); box-shadow: inset 0 0 0 1px var(--blue-500); }
.cal-bh { background: var(--sky-100); }
.cal-d { font-size: 0.78rem; font-weight: 700; color: var(--slate-600); margin-bottom: 2px; }
.cal-bhl { font-weight: 600; font-size: 0.62rem; color: var(--blue-600); }
.cal-ev { color: #fff; font-size: 0.7rem; font-weight: 600; padding: 1px 6px; border-radius: 6px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-pend { opacity: 0.5; border: 1px dashed rgba(0,0,0,.35); }
.cal-more { font-size: 0.7rem; color: var(--slate-600); margin-top: 2px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; font-size: 0.8rem; color: var(--slate-600); }
@media (max-width: 760px) {
  .cal { gap: 2px; } .cal-cell { min-height: 62px; padding: 2px; border-radius: 6px; }
  .cal-ev { font-size: 0; height: 8px; padding: 0; margin-top: 2px; } .cal-bhl { display: none; } .cal-dow { font-size: 0.62rem; }
}
@media print { .hr-card { break-inside: avoid; } }

/* tables: action buttons wrap instead of forcing sideways scroll */
table.data td.actions-cell { white-space: normal; }
table.data td.actions-cell .btn { margin: 2px 0 2px 4px; }

/* alerts bell + group training matrix */
.bell { position:relative; display:inline-flex; align-items:center; justify-content:center; width:40px; height:40px; border-radius:50%; color:var(--navy-700,#1e3a5f); background:transparent; text-decoration:none; }
.bell:hover { background:rgba(0,0,0,.06); }
.bell[hidden] { display:none; }
.bell-n { position:absolute; top:2px; right:0; min-width:18px; height:18px; padding:0 5px; border-radius:9px; font-size:11px; font-weight:700; line-height:18px; text-align:center; color:#fff; background:#c98a00; }
.bell-n.red { background:#d64545; }
.bell-n[hidden] { display:none; }
table.matrix th.mx-h { font-size:12px; max-width:120px; white-space:normal; text-align:center; }
table.matrix td.mx { text-align:center; font-weight:700; font-size:13px; }
.mx-green { background:rgba(31,157,85,.14); color:#17773f; }
.mx-amber { background:rgba(201,138,0,.16); color:#8a5e00; }
.mx-red { background:rgba(214,69,69,.16); color:#b02f2f; }
.mx-none { color:var(--slate-600); }
.check-row { display:flex; gap:8px; align-items:center; }

/* tasks calendar, segmented tabs, logs, matrices, policy text */
.seg { display:inline-flex; gap:2px; padding:3px; background:var(--slate-100,#eef2f7); border-radius:10px; flex-wrap:wrap; }
.seg button { border:0; background:transparent; padding:7px 14px; border-radius:8px; font:inherit; font-size:.88rem; cursor:pointer; color:var(--slate-600); }
.seg button.active { background:#fff; color:var(--navy-900,#0f2744); font-weight:700; box-shadow:0 1px 3px rgba(0,0,0,.12); }
.cal-head { display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.cal-head strong { flex:1; text-align:center; font-size:1.05rem; }
.cal-grid { display:grid; grid-template-columns:repeat(7, minmax(0,1fr)); gap:4px; }
.cal-wd { text-align:center; font-size:.78rem; font-weight:700; color:var(--slate-600); padding:4px 0; }
.cal-cell { min-height:92px; border:1px solid var(--slate-200); border-radius:8px; padding:4px; background:#fff; cursor:pointer; overflow:hidden; }
.cal-cell.cal-off { background:transparent; border-color:transparent; cursor:default; }
.cal-cell.cal-today { border-color:var(--blue-600,#1467c7); box-shadow:inset 0 0 0 1px var(--blue-600,#1467c7); }
.cal-d { font-size:.78rem; font-weight:700; color:var(--slate-600); margin-bottom:2px; }
.cal-ev { font-size:.72rem; line-height:1.25; padding:2px 5px; border-radius:5px; margin-bottom:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cal-ev.cal-blue, .cal-key.cal-blue { background:rgba(20,103,199,.14); color:#0d4f9e; }
.cal-ev.cal-red, .cal-key.cal-red { background:rgba(214,69,69,.16); color:#b02f2f; }
.cal-ev.cal-green, .cal-key.cal-green { background:rgba(31,157,85,.16); color:#17773f; }
.cal-ev.cal-grey, .cal-key.cal-grey { background:rgba(100,116,139,.16); color:#475569; }
.cal-key { display:inline-block; width:12px; height:12px; border-radius:3px; vertical-align:-1px; }
.cal-more { font-size:.7rem; color:var(--slate-600); }
.log-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(280px,1fr)); gap:12px; margin-bottom:16px; }
.log-card { background:#fff; border:1px solid var(--slate-200); border-radius:12px; padding:14px; display:flex; flex-direction:column; gap:8px; }
.log-card .row { display:flex; justify-content:space-between; gap:8px; align-items:flex-start; }
.matrix-scroll { overflow-x:auto; max-width:100%; }
table.mx-wide { min-width:max-content; }
table.mx-wide th.mx-h { min-width:92px; max-width:120px; }
table.mx-wide td.mx { font-size:.78rem; white-space:nowrap; }
table.mx-wide .sticky { position:sticky; left:0; background:#fff; z-index:1; min-width:170px; box-shadow:1px 0 0 var(--slate-200); }
.policy-body { line-height:1.55; max-height:55vh; overflow:auto; padding:4px 2px; }
@media (max-width:700px) { .cal-cell { min-height:64px; } .cal-ev { font-size:.65rem; } }

/* Draigworks "powered by" badge (all themes) */
.dw-badge { display: flex; align-items: center; justify-content: center; gap: 10px; width: fit-content; margin: 22px auto 0; padding: 4px 6px; background: none; color: var(--slate-600); font-size: .7rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; text-decoration: none; opacity: .85; transition: opacity .18s, transform .18s; }
.dw-badge:hover { opacity: 1; transform: translateY(-1px); text-decoration: none; }
.dw-badge img { height: 24px; width: auto; display: block; }
.sidebar .side-foot .dw-badge { margin: 12px 0 0; width: 100%; color: rgba(255,255,255,.7); }
.sidebar .side-foot #back-site { display: block; margin-bottom: 2px; }

/* Light theme on pages that also ship a dark stylesheet: use dark logo variants on white surfaces */
html[data-theme="light"] .auth-card .dw-badge img { content: url("../brand/draigworks-dark.png"); }
html[data-theme="light"] .auth-card .brand-row img[src*="draigworks-white"] { content: url("../../img/draigworks-dark.png"); }

/* Draigworks wordmark: keep its proportions in either theme */
.brand-row img[src*="draigworks"] { width: auto; height: 36px; object-fit: contain; }
.sidebar .brand-row img[src*="draigworks"] { height: 28px; }
html[data-theme="light"] .sidebar .brand-row img[src*="draigworks"] { background: none; padding: 0; box-shadow: none; border-radius: 0; }

/* Wordmark on the navy left panel (light theme): white, unboxed, proportional */
.auth-logo[src*="draigworks"] { width: 220px; height: auto; background: none; border-radius: 0; padding: 0; box-shadow: none; margin: 0 auto 34px; object-fit: contain; }
@media (max-width: 900px) { .auth-logo[src*="draigworks"] { width: 150px; margin-bottom: 14px; } }

/* Sign-in card: wordmark with the product name underneath, smaller */
.auth-card .brand-row:has(img[src*="draigworks"]) { flex-direction: column; align-items: flex-start; gap: 8px; }
.auth-card .brand-row:has(img[src*="draigworks"]) span { font-size: .95rem; font-weight: 600; }

/* Sidebar: wordmark with the product name underneath (both themes) */
.sidebar .brand-row:has(img[src*="draigworks"]) { flex-direction: column; align-items: flex-start; gap: 8px; }
.sidebar .brand-row:has(img[src*="draigworks"]) span { font-size: .85rem; font-weight: 600; line-height: 1.2; }

/* Policy templates */
.policy-body h4 { margin: 18px 0 6px; font-size: 1rem; }
.policy-body h4:first-child { margin-top: 4px; }
.policy-body p { margin: 0 0 8px; }
.policy-body ul { margin: 0 0 8px; padding-left: 20px; }
.policy-body li { margin: 3px 0; }
.pol-field { background: rgba(250,204,21,.28); color: inherit; border-radius: 4px; padding: 0 3px; }
.pol-viewer { background: var(--slate-100, #eef1f5); border-radius: 10px; min-height: 120px; padding: 8px; }
.pol-viewer iframe { display: block; border-radius: 6px; }
textarea[name="body"], textarea[name="body_en"] { width: 100%; min-height: 260px; }

/* Word-style editor */
.rte { border: 1px solid var(--slate-200, #d9dee5); border-radius: 12px; overflow: hidden; background: #fff; }
.rte-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 8px; border-bottom: 1px solid var(--slate-200, #d9dee5); background: var(--slate-50, #f6f8fa); }
.rte-bar select { width: auto; min-width: 130px; padding: 6px 8px; font-size: .85rem; }
.rte-btn { min-width: 34px; height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; font-size: .9rem; }
.rte-btn:hover { background: rgba(120,130,150,.18); }
.rte-sep { width: 1px; height: 22px; background: rgba(120,130,150,.35); margin: 0 4px; }
.rte-area { min-height: 320px; max-height: 55vh; overflow: auto; padding: 14px 16px; outline: none; line-height: 1.55; }
.rte-area:focus { box-shadow: inset 0 0 0 2px rgba(37,99,235,.35); }
.policy-body h2 { font-size: 1.25rem; margin: 18px 0 8px; }
.policy-body h3 { margin: 18px 0 6px; font-size: 1.05rem; }
.policy-body ol { margin: 0 0 8px; padding-left: 22px; }
