/* HR Mail Desk — shared component styles.
   Tailwind (CDN) supplies layout utilities; everything here is scoped under body.hr so it
   wins over Tailwind's preflight resets regardless of stylesheet order.
   Visibility is always toggled with the [hidden] attribute, never a utility class. */

:root {
  --brand-50: #eef7f6;
  --brand-100: #d5ebe8;
  --brand-200: #aed7d2;
  --brand-500: #36807c;
  --brand-600: #2a6765;
  --brand-700: #255352;
  --brand-800: #214343;
  --ink: #1e293b;
  --ink-soft: #475569;
  --ink-mute: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --bg: #f6f8fa;
  --surface: #ffffff;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --warn: #b54708;
  --warn-bg: #fffaeb;
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --radius: 10px;
  --topbar-h: 56px;
  --tabbar-h: 60px;
  --sidebar-w: 248px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body.hr {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
html.hr-lock, body.hr.hr-lock { overflow: hidden; }
body.hr { overflow-wrap: break-word; }

.hr :focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: 4px;
}
.hr .sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.hr .skip-link {
  position: absolute; left: 8px; top: -48px; z-index: 100;
  background: var(--brand-700); color: #fff; padding: 8px 12px; border-radius: 6px;
}
.hr .skip-link:focus { top: 8px; }

/* ---------- Shell ----------
   < 1024px: top bar + bottom tab bar (one-handed).  >= 1024px: fixed sidebar. */
.hr .sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  background: var(--surface); border-right: 1px solid var(--line);
  display: none; flex-direction: column;
}
.hr .shell-main { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; min-width: 0; }
.hr .topbar {
  position: sticky; top: 0; z-index: 30; box-sizing: border-box;
  height: calc(var(--topbar-h) + var(--sat)); padding: var(--sat) max(12px, var(--sar)) 0 max(16px, var(--sal));
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.hr .topbar h1 { font-size: 17px; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 10px; }
.hr .topbar .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
.hr .main {
  flex: 1; box-sizing: border-box; width: 100%; max-width: 1280px; margin: 0 auto; min-width: 0;
  padding: 16px max(12px, var(--sar)) calc(var(--tabbar-h) + var(--sab) + 24px) max(12px, var(--sal));
}
.hr .main:focus { outline: none; }
.hr .main--bleed {
  max-width: none; padding: 0; display: flex; flex-direction: column; min-height: 0; flex: none;
  height: calc(100vh - var(--topbar-h) - var(--tabbar-h));
  height: calc(100dvh - var(--topbar-h) - var(--sat) - var(--tabbar-h) - var(--sab));
}
.hr .tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; box-sizing: border-box;
  height: calc(var(--tabbar-h) + var(--sab)); padding: 0 var(--sar) var(--sab) var(--sal);
  display: flex; background: rgba(255, 255, 255, .97); backdrop-filter: blur(6px); border-top: 1px solid var(--line);
}
.hr .tabbar a {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-mute); text-decoration: none; font-size: 11.5px; font-weight: 550; min-height: 48px;
  -webkit-tap-highlight-color: transparent;
}
.hr .tabbar a svg { width: 22px; height: 22px; }
.hr .tabbar a[aria-current="page"] { color: var(--brand-700); }
.hr .tabbar a[aria-current="page"] svg { stroke-width: 2.4; }
@media (min-width: 640px) {
  .hr .main { padding-left: max(20px, var(--sal)); padding-right: max(20px, var(--sar)); padding-top: 20px; }
  .hr .main--bleed { padding: 0; }
}
@media (min-width: 1024px) {
  .hr .sidebar { display: flex; }
  .hr .tabbar { display: none; }
  .hr .shell-main { padding-left: var(--sidebar-w); }
  .hr .topbar { padding: 0 24px; height: var(--topbar-h); }
  .hr .topbar .brand-mark { display: none; }
  .hr .main { padding: 24px 24px 48px; }
  .hr .main--bleed { padding: 0; height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h)); }
}
.hr .brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; font-weight: 650; font-size: 15px; color: var(--ink); text-decoration: none; }
.hr .brand-mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--brand-600); color: #fff;
  display: grid; place-items: center; flex: none;
}
.hr .nav { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.hr .nav-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  color: var(--ink-soft); text-decoration: none; font-weight: 500;
}
.hr .nav-link:hover { background: #f1f5f9; color: var(--ink); }
.hr .nav-link[aria-current="page"] { background: var(--brand-50); color: var(--brand-700); }
.hr .nav-link svg { width: 18px; height: 18px; flex: none; }
.hr .side-user { border-top: 1px solid var(--line); padding: 12px; display: flex; align-items: center; gap: 10px; }
.hr .avatar {
  width: 32px; height: 32px; border-radius: 999px; background: var(--brand-100); color: var(--brand-800);
  display: grid; place-items: center; font-weight: 600; flex: none; text-transform: uppercase;
}
.hr .progress { height: 3px; background: var(--brand-100); overflow: hidden; position: sticky; top: calc(var(--topbar-h) + var(--sat)); z-index: 29; }
.hr .progress > div { height: 100%; width: 35%; background: var(--brand-500); animation: hr-indet 1.3s ease-in-out infinite; }
@keyframes hr-indet { 0% { transform: translateX(-110%); } 100% { transform: translateX(320%); } }

/* ---------- Buttons ---------- */
.hr .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 550; line-height: 1.25; cursor: pointer; white-space: nowrap;
  text-decoration: none; transition: background-color .12s, border-color .12s, color .12s;
  min-height: 36px;
}
.hr .btn svg { width: 16px; height: 16px; flex: none; }
.hr .btn:disabled, .hr .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.hr .btn-primary { background: var(--brand-600); color: #fff; }
.hr .btn-primary:hover:not(:disabled) { background: var(--brand-700); }
.hr .btn-secondary { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.hr .btn-secondary:hover:not(:disabled) { background: #f8fafc; border-color: #94a3b8; }
.hr .btn-ghost { background: transparent; color: var(--ink-soft); }
.hr .btn-ghost:hover:not(:disabled) { background: #f1f5f9; color: var(--ink); }
.hr .btn-danger { background: #fff; color: var(--danger); border-color: #fda29b; }
.hr .btn-danger:hover:not(:disabled) { background: var(--danger-bg); }
.hr .btn-danger-solid { background: var(--danger); color: #fff; }
.hr .btn-danger-solid:hover:not(:disabled) { background: #912018; }
.hr .btn-sm { padding: 5px 10px; min-height: 30px; font-size: 13px; border-radius: 7px; }
.hr .btn-icon { padding: 0; width: 36px; min-height: 36px; }
.hr .btn-block { width: 100%; }
.hr .link { color: var(--brand-600); text-decoration: underline; text-underline-offset: 2px; font-weight: 500; }
.hr .link:hover { color: var(--brand-800); }
.hr .linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.hr .linklike:hover { text-decoration: underline; }

.hr .spinner {
  width: 16px; height: 16px; border-radius: 999px; flex: none; display: inline-block;
  border: 2px solid currentColor; border-right-color: transparent; animation: hr-spin .7s linear infinite;
}
@keyframes hr-spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.hr .label { display: block; font-weight: 550; font-size: 13px; color: var(--ink); margin-bottom: 5px; }
.hr .input {
  display: block; width: 100%; box-sizing: border-box; min-height: 38px;
  padding: 7px 11px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink); font: inherit; appearance: none; -webkit-appearance: none;
}
.hr select.input {
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3E%3Cpath d='M5.3 7.3a1 1 0 011.4 0L10 10.6l3.3-3.3a1 1 0 111.4 1.4l-4 4a1 1 0 01-1.4 0l-4-4a1 1 0 010-1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 18px;
}
.hr .input::placeholder { color: #94a3b8; }
.hr .input:hover { border-color: #94a3b8; }
.hr .input:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(54, 128, 124, .2); }
.hr .input[aria-invalid="true"] { border-color: #f04438; }
.hr .input:disabled, .hr .input[readonly] { background: #f8fafc; color: var(--ink-mute); }
.hr .hint { font-size: 12.5px; color: var(--ink-mute); margin-top: 5px; }
.hr .field-error { font-size: 12.5px; color: var(--danger); margin-top: 5px; }
.hr .alert { border-radius: 8px; padding: 10px 12px; border: 1px solid; font-size: 13.5px; }
.hr .alert-error { background: var(--danger-bg); border-color: #fecdca; color: #7a271a; }
.hr .alert-info { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-800); }
.hr .alert-warn { background: var(--warn-bg); border-color: #fedf89; color: #93370d; }
.hr .alert-ok { background: var(--ok-bg); border-color: #abefc6; color: #085d3a; }

.hr .seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 9px; padding: 3px; background: #f8fafc; gap: 2px; flex-wrap: wrap; }
.hr .seg label { position: relative; cursor: pointer; }
.hr .seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.hr .seg span { display: block; padding: 6px 14px; border-radius: 7px; font-weight: 550; color: var(--ink-soft); }
.hr .seg input:checked + span { background: #fff; color: var(--brand-700); box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }
.hr .seg input:focus-visible + span { outline: 2px solid var(--brand-500); outline-offset: 1px; }

.hr .switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.hr .switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.hr .switch .track { width: 38px; height: 22px; border-radius: 999px; background: #cbd5e1; position: relative; transition: background-color .15s; flex: none; }
.hr .switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 999px; background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .25); transition: transform .15s; }
.hr .switch input:checked + .track { background: var(--brand-600); }
.hr .switch input:checked + .track::after { transform: translateX(16px); }
.hr .switch input:focus-visible + .track { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.hr .switch input:disabled + .track { opacity: .5; }

/* ---------- Surfaces ---------- */
.hr .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.hr .card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.hr .card-title { font-size: 14.5px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; }
.hr .card-body { padding: 16px; }
.hr .muted { color: var(--ink-mute); }
.hr .count-pill { min-width: 22px; padding: 0 7px; height: 20px; border-radius: 999px; background: #f1f5f9; color: var(--ink-soft); font-size: 12px; font-weight: 600; display: inline-grid; place-items: center; }
.hr .count-pill.is-danger { background: var(--danger-bg); color: var(--danger); }
.hr .count-pill.is-warn { background: var(--warn-bg); color: var(--warn); }

.hr .tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.hr .tile-label { font-size: 12.5px; color: var(--ink-mute); font-weight: 500; }
.hr .tile-value { font-size: 26px; font-weight: 650; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.hr .tile.is-danger .tile-value { color: var(--danger); }
.hr .tile.is-warn .tile-value { color: var(--warn); }

.hr .badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 550; line-height: 18px; white-space: nowrap; border: 1px solid transparent; }
.hr .badge-gray { background: #f1f5f9; color: #475569; }
.hr .badge-teal { background: var(--brand-50); color: var(--brand-700); }
.hr .badge-blue { background: #eff8ff; color: #175cd3; }
.hr .badge-purple { background: #f4f3ff; color: #5925dc; }
.hr .badge-green { background: var(--ok-bg); color: var(--ok); }
.hr .badge-amber { background: var(--warn-bg); color: var(--warn); }
.hr .badge-red { background: var(--danger-bg); color: var(--danger); }
.hr .badge-pink { background: #fdf2fa; color: #c11574; }
.hr .badge-outline { background: #fff; color: var(--ink-soft); border-color: var(--line-strong); }

.hr .skeleton { display: block; border-radius: 6px; background: linear-gradient(90deg, #e9eef3 25%, #f4f7fa 37%, #e9eef3 63%); background-size: 400% 100%; animation: hr-shimmer 1.4s ease infinite; color: transparent; min-height: 12px; }
@keyframes hr-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.hr .empty { text-align: center; padding: 28px 16px; color: var(--ink-mute); }
.hr .empty-title { color: var(--ink); font-weight: 600; margin-bottom: 4px; }
.hr .empty .btn { margin-top: 12px; }

/* ---------- Task rows (dashboard) ---------- */
.hr .rows { list-style: none; margin: 0; padding: 0; }
.hr .rows > li + li { border-top: 1px solid var(--line); }
.hr .task-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; transition: opacity .18s, transform .18s; }
.hr .task-row.is-leaving { opacity: 0; transform: translateX(12px); }
.hr .task-main { min-width: 0; flex: 1; }
.hr .task-title { font-weight: 600; color: var(--ink); text-decoration: none; display: block; overflow-wrap: anywhere; }
.hr .task-title:hover { color: var(--brand-700); text-decoration: underline; }
.hr .task-meta { color: var(--ink-mute); font-size: 13px; overflow-wrap: anywhere; }
.hr .task-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* ---------- Tables ---------- */
.hr .tbl-wrap { overflow-x: auto; }
.hr .tbl { width: 100%; border-collapse: collapse; }
.hr .tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-mute); text-transform: uppercase; letter-spacing: .03em; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #f8fafc; white-space: nowrap; }
.hr .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.hr .tbl tbody tr:last-child td { border-bottom: 0; }
.hr .tbl tr.is-clickable { cursor: pointer; }
.hr .tbl tr.is-clickable:hover td { background: #f8fafc; }
.hr .tbl tr.is-done .subject-btn { color: var(--ink-mute); }
.hr .subject-btn { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.hr .clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.hr .clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Panels (every dialog) ----------
   Phone (< 768px): bottom sheet with a grab handle — drag up to full screen, down to shrink / close.
   Tablet + desktop: full-height right sidebar with a draggable left edge. JS: HR.dialog(). */
.hr .overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(15, 23, 42, .45);
  display: flex; justify-content: flex-end; align-items: flex-end; touch-action: none;
}
.hr .panel {
  position: relative; box-sizing: border-box; background: #fff; display: flex; flex-direction: column;
  width: 100%; min-width: 0; height: 72vh; height: 72dvh;
  max-height: calc(100vh - 8px); max-height: calc(100dvh - var(--sat) - 8px);
  border-radius: 16px 16px 0 0; box-shadow: 0 -12px 40px rgba(15, 23, 42, .25);
  padding: 0 var(--sar) var(--sab) var(--sal);
  animation: hr-sheet-up .22s ease; transition: height .18s ease;
}
.hr .panel--fit { height: auto; }
.hr .panel.is-dragging { transition: none; user-select: none; -webkit-user-select: none; }
.hr .panel:focus { outline: none; }
@keyframes hr-sheet-up { from { transform: translateY(40%); opacity: .5; } to { transform: none; opacity: 1; } }
@keyframes hr-slide { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
/* 44px drag zone; the header overlaps its lower part and is draggable too */
.hr .panel-grab { flex: none; box-sizing: border-box; height: 44px; margin-bottom: -18px; padding-top: 10px; display: flex; justify-content: center; align-items: flex-start; cursor: grab; touch-action: none; border-radius: 16px 16px 0 0; }
.hr .panel-grab::before { content: ""; width: 44px; height: 5px; border-radius: 999px; background: #cbd5e1; }
.hr .panel-grab:focus-visible { outline-offset: -3px; }
.hr .panel-resize { display: none; }
.hr .panel-head {
  flex: none; display: flex; align-items: center; gap: 8px; padding: 0 6px 8px 16px;
  border-bottom: 1px solid var(--line); touch-action: none; cursor: grab; position: relative;
}
.hr .panel-title { flex: 1; min-width: 0; font-size: 16px; font-weight: 600; margin: 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.hr .panel-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; padding: 16px; }
.hr .panel--fit .panel-body { flex: 0 1 auto; }
.hr .panel-foot { flex: none; display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.hr .panel-foot .btn { flex: 1; }
@media (min-width: 768px) {
  .hr .overlay { align-items: stretch; }
  .hr .panel {
    height: 100% !important; max-height: none; width: 560px; min-width: 360px; max-width: calc(100vw - 80px);
    border-radius: 0; padding: 0; box-shadow: -12px 0 40px rgba(15, 23, 42, .2);
    animation: hr-slide .18s ease; transition: none;
  }
  .hr .panel-grab { display: none; }
  .hr .panel-resize { display: block; position: absolute; left: -6px; top: 0; bottom: 0; width: 12px; cursor: col-resize; touch-action: none; z-index: 2; }
  .hr .panel-resize::after { content: ""; position: absolute; left: 5px; top: 0; bottom: 0; width: 3px; background: transparent; transition: background-color .12s; }
  .hr .panel-resize::before { content: ""; position: absolute; left: 3px; top: 50%; width: 7px; height: 44px; margin-top: -22px; border-radius: 999px; background: #cbd5e1; border: 1px solid #fff; box-sizing: border-box; }
  .hr .panel-resize:hover::after, .hr .panel-resize:focus-visible::after, .hr .panel.is-dragging .panel-resize::after { background: var(--brand-500); }
  .hr .panel-resize:focus-visible { outline: none; }
  .hr .panel-head { padding: 12px 10px 12px 20px; touch-action: auto; cursor: default; }
  .hr .panel-body { padding: 20px; }
  .hr .panel--fit .panel-body { flex: 1; }
  .hr .panel-foot { padding: 14px 20px; justify-content: flex-end; }
  .hr .panel-foot .btn { flex: none; }
}
.hr .kv { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 6px 12px; margin: 0; }
.hr .kv dt { color: var(--ink-mute); font-size: 13px; }
.hr .kv dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.hr .mail-body { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; font-family: inherit; font-size: 14px; line-height: 1.55; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 0; }
.hr .section-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-mute); margin: 20px 0 8px; }
.hr .thread-item { display: flex; gap: 10px; width: 100%; box-sizing: border-box; text-align: left; padding: 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font: inherit; cursor: pointer; color: inherit; min-height: 44px; }
.hr .thread-item + .thread-item { margin-top: 6px; }
.hr .thread-item:hover { border-color: #94a3b8; }
.hr .thread-item[aria-current="true"] { background: var(--brand-50); border-color: var(--brand-200); cursor: default; }
/* status / priority / reply strip at the top of the email panel */
.hr .facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hr .fact { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; background: #f8fafc; }
.hr .fact-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-mute); }
.hr .fact-value { font-size: 15px; font-weight: 650; margin-top: 2px; overflow-wrap: anywhere; }
.hr .fact.is-ok { background: var(--ok-bg); border-color: #abefc6; } .hr .fact.is-ok .fact-value { color: var(--ok); }
.hr .fact.is-warn { background: var(--warn-bg); border-color: #fedf89; } .hr .fact.is-warn .fact-value { color: var(--warn); }
.hr .fact.is-danger { background: var(--danger-bg); border-color: #fecdca; } .hr .fact.is-danger .fact-value { color: var(--danger); }
.hr .fact.is-info { background: #eff8ff; border-color: #b2ddff; } .hr .fact.is-info .fact-value { color: #175cd3; }
.hr .fact.is-none .fact-value { color: var(--ink-mute); font-weight: 500; }

/* ---------- Toasts ---------- */
.hr .toast-region { position: fixed; z-index: 80; right: max(12px, var(--sar)); bottom: calc(var(--tabbar-h) + var(--sab) + 10px); left: max(12px, var(--sal)); display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.hr .toast { pointer-events: auto; width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--brand-500); border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 23, 42, .16); padding: 12px 12px 12px 14px; display: flex; gap: 10px; align-items: flex-start; animation: hr-toast .18s ease; }
@keyframes hr-toast { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.hr .toast-success { border-left-color: #17b26a; }
.hr .toast-error { border-left-color: #f04438; }
.hr .toast-warning { border-left-color: #f79009; }
.hr .toast-title { font-weight: 600; }
.hr .toast-msg { color: var(--ink-soft); font-size: 13px; overflow-wrap: anywhere; }
.hr .toast-figs { display: flex; gap: 16px; margin: 6px 0 0; }
.hr .toast-figs div { display: flex; flex-direction: column; }
.hr .toast-figs dt { font-size: 11.5px; color: var(--ink-mute); order: 2; }
.hr .toast-figs dd { margin: 0; font-weight: 650; font-size: 18px; font-variant-numeric: tabular-nums; }

/* ---------- Sheet (Excel-like grid) ---------- */
.hr .sheet-toolbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.hr .sheet-scroll { flex: 1; min-height: 0; overflow: auto; background: #fff; position: relative; }
.hr .sheet { border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 12.5px; line-height: 1.35; }
.hr .sheet th, .hr .sheet td {
  border-right: 1px solid #dfe5ec; border-bottom: 1px solid #dfe5ec; padding: 4px 8px; height: 28px; box-sizing: border-box;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; font-weight: 400; background: #fff;
}
.hr .sheet thead th { position: sticky; z-index: 3; }
.hr .sheet thead tr.sheet-letters th { top: 0; height: 22px; padding: 0 8px; background: #f1f5f9; color: var(--ink-mute); text-align: center; font-size: 11.5px; }
.hr .sheet thead tr.sheet-heads th { top: 22px; background: #e3efee; color: var(--brand-800); font-weight: 650; border-bottom: 1px solid #b7cfcc; }
.hr .sheet .rownum { position: sticky; left: 0; z-index: 2; background: #f1f5f9; color: var(--ink-mute); text-align: center; font-size: 11.5px; padding: 0 4px; }
.hr .sheet thead .rownum { z-index: 4; }
.hr .sheet tr.sheet-section td { background: #fff8e6; color: #7a4b00; font-weight: 650; border-bottom-color: #f0dba8; overflow: visible; }
.hr .sheet tr.sheet-section td.rownum { background: #f1f5f9; color: var(--ink-mute); font-weight: 400; }
.hr .sheet tr.sheet-section .section-stick { position: sticky; left: 52px; display: inline-flex; gap: 8px; align-items: center; }
.hr .sheet tbody tr:hover td:not(.rownum) { background: #f6fbfa; }
.hr .sheet tbody tr.sheet-section:hover td:not(.rownum) { background: #fff8e6; }
.hr .sheet tr.is-done td:not(.rownum) { color: var(--ink-mute); }
.hr .sheet tbody tr[data-id] { cursor: pointer; }
.hr .sheet tbody tr.is-open td:not(.rownum) { background: var(--brand-50); }
.hr .sheet .cell-btn { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; font-weight: 600; }
.hr .sheet .cell-btn:hover { color: var(--brand-700); text-decoration: underline; }
.hr .sheet .cell-overdue { color: var(--danger); font-weight: 600; }
.hr .status-toggle { position: relative; display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px 1px 5px; border-radius: 999px; border: 1px solid var(--line-strong); background: #fff; font: inherit; font-size: 12px; font-weight: 550; cursor: pointer; color: var(--warn); line-height: 18px; }
.hr .status-toggle::before { content: ""; width: 11px; height: 11px; border-radius: 3px; border: 1.5px solid currentColor; box-sizing: border-box; }
.hr .status-toggle[aria-pressed="true"] { color: var(--ok); background: var(--ok-bg); border-color: #abefc6; }
.hr .status-toggle[aria-pressed="true"]::before { background: currentColor; }
.hr .status-toggle:hover { border-color: #64748b; }
.hr .status-toggle:disabled { opacity: .6; cursor: progress; }
.hr .sheet-tabs { display: flex; align-items: stretch; gap: 2px; background: #eef1f5; border-top: 1px solid var(--line-strong); padding: 0 8px; overflow-x: auto; flex: none; min-height: 38px; }
.hr .sheet-tab { display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; border: 0; border-top: 3px solid transparent; margin-top: -1px; background: transparent; font: inherit; font-weight: 550; font-size: 13px; color: var(--ink-soft); cursor: pointer; white-space: nowrap; min-height: 38px; }
.hr .sheet-tab:hover { background: #e2e8f0; }
.hr .sheet-tab[aria-selected="true"] { background: #fff; color: var(--brand-700); border-top-color: transparent; box-shadow: inset 0 -3px 0 var(--brand-600), 1px 0 0 var(--line-strong), -1px 0 0 var(--line-strong); }
.hr .sheet-state { position: sticky; left: 0; width: 100%; max-width: 100vw; }

/* ---------- Auth pages ---------- */
.hr .auth-wrap { min-height: 100vh; min-height: 100dvh; box-sizing: border-box; display: grid; place-items: center; padding: calc(20px + var(--sat)) max(14px, var(--sar)) calc(20px + var(--sab)) max(14px, var(--sal)); }
.hr .auth-card { box-sizing: border-box; width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 28px 24px; box-shadow: 0 8px 30px rgba(15, 23, 42, .06); }
.hr .pw-wrap { position: relative; }
.hr .pw-wrap .input { padding-right: 62px; }
.hr .pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--brand-600); cursor: pointer; padding: 4px 6px; border-radius: 6px; }

/* ---------- Phones and tablets (< 1024px): touch sizing ----------
   16px inputs stop iOS zooming on focus; every control is at least 44px tall. */
@media (max-width: 1023.98px) {
  .hr .toast-region { align-items: stretch; }
  .hr .toast { max-width: none; }
  .hr .btn { min-height: 44px; }
  .hr .btn-sm { min-height: 44px; padding: 8px 12px; font-size: 14px; }
  .hr .btn-icon { width: 44px; min-height: 44px; }
  .hr .input { font-size: 16px; min-height: 46px; }
  .hr .pw-toggle { min-height: 44px; min-width: 52px; right: 2px; font-size: 14px; }
  .hr .seg { display: flex; }
  .hr .seg label { flex: 1; text-align: center; }
  .hr .seg span { padding: 12px 8px; }
  .hr .switch { min-height: 44px; }
  .hr .linklike.link, .hr .hit, .hr .auth-card a.link { min-height: 44px; display: inline-flex; align-items: center; }
  .hr .sheet-tab { min-height: 46px; padding: 0 14px; }
  .hr .sheet-tabs { min-height: 46px; }
  .hr .sheet th, .hr .sheet td { height: 44px; }
  .hr .sheet thead tr.sheet-heads th { height: 36px; }
  .hr .sheet .cell-btn { line-height: 44px; margin: -5px 0; }
  .hr .status-toggle { min-height: 32px; padding: 3px 10px 3px 7px; font-size: 13px; }
  .hr .status-toggle::after { content: ""; position: absolute; inset: -6px -4px; }
  .hr .subject-btn { min-height: 44px; display: inline-flex; align-items: center; }
  .hr .task-title { padding: 4px 0; }
  .hr .card-head { padding: 12px 14px; }
  .hr .card-body { padding: 14px; }
  .hr .task-row { padding: 12px 14px; }
  .hr .tbl th, .hr .tbl td { padding: 10px 8px; }
  .hr .tbl th:first-child, .hr .tbl td:first-child { padding-left: 14px; }
  .hr .tbl th:last-child, .hr .tbl td:last-child { padding-right: 14px; }
}
/* Emails table becomes a list of cards on phones: date + status on one line, subject below. */
@media (max-width: 639.98px) {
  .hr .tbl--stack, .hr .tbl--stack tbody { display: block; width: 100%; }
  .hr .tbl--stack thead, .hr .tbl--stack caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .hr .tbl--stack tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); align-items: center; }
  .hr .tbl--stack tbody tr:last-child { border-bottom: 0; }
  .hr .tbl--stack td { padding: 0 !important; border: 0; min-width: 0; }
  .hr .tbl--stack td[colspan] { grid-column: 1 / -1; }
  .hr .tbl--stack td.c-date { grid-column: 1; grid-row: 1; display: flex; gap: 6px; align-items: baseline; color: var(--ink-mute); font-size: 12.5px; }
  .hr .tbl--stack td.c-status { grid-column: 2; grid-row: 1; }
  .hr .tbl--stack td.c-subject { grid-column: 1 / -1; grid-row: 2; }
}
@media (min-width: 768px) { .hr .f-toggle { display: none; } }
@media (max-width: 767.98px) {
  .hr #email-filters:not(.is-open) .f-more { display: none; }
  .hr #email-filters .card-body { padding: 12px; }
}
@media (max-width: 559.98px) {
  .hr .task-row { flex-wrap: wrap; }
  .hr .task-row > .btn { width: 100%; }
  .hr .tile { padding: 12px 14px; }
  .hr .tile-value { font-size: 24px; }
  .hr .facts { gap: 6px; }
  .hr .fact { padding: 7px 8px; }
  .hr .fact-value { font-size: 14px; }
  .hr .auth-card { padding: 24px 18px; }
  .hr .sheet-toolbar { padding: 8px 12px; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .hr *, .hr *::before, .hr *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
@media print {
  .hr .sidebar, .hr .topbar, .hr .tabbar, .hr .toast-region { display: none !important; }
  .hr .shell-main { padding-left: 0; }
}
@media (min-width: 1024px) {
  .hr .toast-region { bottom: 16px; right: 16px; left: 16px; }
}
/* Truncated helper lines must not widen the emails table: take the column's width, add none. */
.hr .tbl .c-subject .clamp-1 { width: 0; min-width: 100%; }
@media (max-width: 1023.98px) { .hr .tbl .c-who > div { max-width: 150px !important; } }
/* Phones: the sheet's Subject column pins to the left edge once scrolled past, so it stays
   readable while the grid is scrolled sideways to Status. */
@media (max-width: 767.98px) {
  .hr .sheet td.col-subject, .hr .sheet th.col-subject { position: sticky; left: 44px; z-index: 1; box-shadow: 1px 0 0 #b7cfcc; }
  .hr .sheet thead th.col-subject { z-index: 4; }
}
/* Keyboard focus never hides under the fixed top bar / bottom tab bar. */
@media (max-width: 1023.98px) {
  html { scroll-padding-top: calc(56px + env(safe-area-inset-top, 0px) + 8px); scroll-padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px) + 8px); }
}
