:root {
  --bg: #f3efe6;
  --surface: #fffdf8;
  --surface-strong: #fff7ec;
  --surface-accent: #e4f1ed;
  --ink: #203234;
  --muted: #607274;
  --line: #d8d1c4;
  --teal: #175f63;
  --teal-soft: #d6ece9;
  --amber: #c9822b;
  --amber-soft: #f8e4cb;
  --rose: #b45857;
  --rose-soft: #f6dcdc;
  --moss: #4d6f55;
  --shadow: 0 16px 40px rgba(25, 43, 44, 0.08);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(23, 95, 99, 0.14), transparent 26%),
    radial-gradient(circle at bottom left, rgba(201, 130, 43, 0.14), transparent 30%),
    var(--bg);
  color: var(--ink);
  font-family: Aptos, "Trebuchet MS", "Gill Sans", sans-serif;
}

body {
  padding: 12px 8px;
}

body.auth-body {
  display: grid;
  place-items: center;
}

h1,
h2,
h3,
strong {
  font-family: Cambria, Georgia, serif;
}

p,
label,
input,
select,
textarea,
button,
table {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 318px minmax(0, 1fr);
  gap: 16px;
  max-width: none;
  margin: 0;
}

/* Single-column shell for the case-management portal — the left sidebar was
   collapsed when "My Active Cases" / "Your top priorities" was removed and
   the brand + signed-in chip moved to the top horizontal bar. */
.app-shell.app-shell-flat {
  grid-template-columns: minmax(0, 1fr);
}

/* HR shell keeps a narrow sidebar (HR Tools + Note copy) but the brand and
   signed-in chip still live in the top bar, so the sidebar starts a row down. */
.app-shell.hr-shell-flat {
  grid-template-columns: 280px minmax(0, 1fr);
}

/* ============================================================
   Top horizontal header bar (replaces the in-sidebar brand + sign-in
   block). Spans the full width above the .app-shell grid.
   ============================================================ */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 22px;
  margin: 0 0 16px;
  border-radius: var(--radius-xl);
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid rgba(216, 209, 196, 0.85);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.top-bar-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.top-bar-brand h1 {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1;
}

.top-bar-brand .eyebrow {
  margin: 0;
}

.top-bar-user {
  display: flex;
  align-items: center;
  gap: 14px;
}

.top-bar-user .section-label {
  margin: 0;
}

.top-bar-user .user-chip-block {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  text-align: right;
}

.top-bar-user .user-chip-block strong {
  font-size: 0.95rem;
}

.top-bar-user .user-chip-block span {
  font-size: 0.78rem;
  color: var(--muted);
}

.top-bar-user .ghost-link {
  white-space: nowrap;
}

@media (max-width: 760px) {
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 16px;
  }

  .top-bar-user {
    width: 100%;
    justify-content: space-between;
  }
}

/* "No further visits" disabled state — the date label fades when the
   companion checkbox is ticked. Mirrors the .is-disabled pattern used by
   the cath-tracking grid. */
label.is-disabled {
  opacity: 0.55;
}

label.is-disabled input[type="date"] {
  cursor: not-allowed;
  background: #f4efe6;
}

/* Visual divider inside the Bulk Import card between import and backup. */
.backup-divider {
  height: 1px;
  background: var(--line);
  margin: 16px 0 12px;
}

.login-shell {
  width: min(1100px, 100%);
}

.login-card {
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid rgba(216, 209, 196, 0.85);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 34px;
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr);
  gap: 28px;
}

.login-form,
.login-copy,
.demo-users-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-strong) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.login-form {
  display: grid;
  gap: 16px;
}

.demo-users-card {
  grid-column: 1 / -1;
}

.demo-users-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.demo-users-grid article {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: white;
}

.demo-users-grid article strong,
.demo-users-grid article span {
  display: block;
}

.demo-users-grid article span {
  color: var(--muted);
  margin-top: 4px;
}

.error-banner {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--rose-soft);
  color: var(--rose);
  font-weight: 700;
}

.sidebar,
.board-panel,
.detail-panel,
.rail-card,
.hero,
.metrics article {
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid rgba(216, 209, 196, 0.85);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.sidebar {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 24px;
  align-self: start;
}

.brand-block h1 {
  margin: 6px 0 10px;
  font-size: 2rem;
  line-height: 1;
}

.supporting-copy,
.hero-copy,
.muted-copy,
.permission-note {
  color: var(--muted);
}

.eyebrow,
.section-label,
.field-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
}

.section-label,
.field-label {
  display: block;
  margin-bottom: 8px;
}

.sidebar-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-strong) 100%);
  border: 1px solid var(--line);
}

.priority-sidebar-card {
  display: grid;
  gap: 14px;
}

.priority-sidebar-card .panel-heading {
  margin-bottom: 0;
}

.user-chip-block {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.ghost-link {
  color: var(--teal);
  font-weight: 700;
  text-decoration: none;
  /* When .ghost-link is used on a <button>, neutralise the global button
     defaults (teal gradient + 100% width + 12px padding) so the link looks
     like a text link, not a giant pill with invisible text. */
  background: transparent;
  border: 0;
  padding: 0;
  width: auto;
  cursor: pointer;
}

.ghost-link:hover {
  text-decoration: underline;
}

.nav-list,
.checkpoint-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.nav-item,
.checkpoint-list li {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: white;
  border: 1px solid var(--line);
}

.nav-item.active {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
}

.workspace {
  display: grid;
  gap: 24px;
}

.hero {
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
  gap: 18px;
  background:
    linear-gradient(120deg, rgba(255, 247, 236, 0.92), rgba(255, 253, 248, 0.92)),
    linear-gradient(135deg, rgba(23, 95, 99, 0.14), transparent);
}

.hero h2 {
  margin: 10px 0 12px;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1.05;
  max-width: 14ch;
}

.hero-panel {
  display: grid;
  gap: 12px;
  align-content: start;
}

.hero-stat {
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
}

.hero-stat span {
  display: block;
  color: var(--muted);
  margin-bottom: 5px;
}

.hero-stat strong {
  font-size: 1.1rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.metrics article {
  padding: 18px 20px;
}

.metrics .metric-label {
  color: var(--muted);
  margin-bottom: 8px;
}

.metrics strong {
  font-size: 2rem;
}

.metrics .metric-foot {
  margin-top: 10px;
  color: var(--teal);
}

.board-panel,
.detail-panel,
.rail-card {
  padding: 22px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  margin-bottom: 18px;
}

.panel-heading h3 {
  margin: 4px 0 0;
  font-size: 1.4rem;
}

.panel-heading.compact {
  margin-bottom: 14px;
}

.sync-pill,
.status-ribbon {
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
  background: var(--teal-soft);
  color: var(--teal);
  white-space: nowrap;
}

.status-ribbon {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  max-width: min(100%, 420px);
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.toolbar-wide {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.view-tools {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.board-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.board-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
  align-items: stretch;
}

.board-tabs .board-tab {
  flex: 1 1 240px;
  min-width: 200px;
}

.guided-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 0;
}

.guided-card {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  grid-template-areas:
    "dot label value"
    "dot note  value"
    "dot hint  hint";
  align-items: center;
  gap: 4px 12px;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease, background-color 0.15s ease;
}

.guided-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(25, 43, 44, 0.08);
}

.guided-card::before {
  content: "";
  grid-area: dot;
  align-self: start;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(96, 114, 116, 0.35);
  margin-top: 4px;
}

.guided-card-rose::before { border-color: var(--rose); }
.guided-card-amber::before { border-color: var(--amber); }
.guided-card-teal::before { border-color: var(--teal); }

.guided-card.is-active {
  background: var(--surface-strong);
}

.guided-card-rose.is-active {
  border-color: var(--rose);
  box-shadow: inset 0 0 0 2px rgba(180, 88, 87, 0.22);
  background: #fff4f4;
}
.guided-card-rose.is-active::before { box-shadow: inset 0 0 0 4px var(--rose); }

.guided-card-amber.is-active {
  border-color: var(--amber);
  box-shadow: inset 0 0 0 2px rgba(201, 130, 43, 0.22);
  background: #fdf3e1;
}
.guided-card-amber.is-active::before { box-shadow: inset 0 0 0 4px var(--amber); }

.guided-card-teal.is-active {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 2px rgba(23, 95, 99, 0.2);
  background: #e6f3f0;
}
.guided-card-teal.is-active::before { box-shadow: inset 0 0 0 4px var(--teal); }

.guided-card-clear {
  background: rgba(255, 255, 255, 0.6);
}
.guided-card-clear::before {
  border-color: var(--muted);
}
.guided-card-clear.is-active {
  border-color: var(--ink);
  background: white;
  box-shadow: inset 0 0 0 2px rgba(32, 50, 52, 0.12);
}
.guided-card-clear.is-active::before { box-shadow: inset 0 0 0 4px var(--ink); }

.guided-card-label,
.guided-card-note,
.guided-card-hint {
  display: block;
}

.guided-card-label {
  grid-area: label;
  align-self: end;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.2;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.guided-card-value {
  grid-area: value;
  align-self: center;
  justify-self: end;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  padding-left: 6px;
}

.guided-card-value.rose { color: var(--rose); }
.guided-card-value.amber { color: var(--amber); }
.guided-card-value.teal { color: var(--teal); }

.guided-card-note {
  grid-area: note;
  align-self: start;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.3;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.guided-card-hint {
  grid-area: hint;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(96, 114, 116, 0.25);
}

.guided-card.is-active .guided-card-hint {
  color: var(--ink);
}

.guided-list {
  display: grid;
  gap: 8px;
  max-height: 292px;
  overflow-y: auto;
  padding-right: 4px;
  align-content: start;
  scrollbar-gutter: stable;
}

.guided-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.guided-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(25, 43, 44, 0.08);
  border-color: var(--teal);
}

.guided-item.is-highlighted {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 2px rgba(23, 95, 99, 0.22);
  background: #f0f7f5;
}

.guided-item-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.guided-item-copy strong,
.guided-item-copy span {
  display: block;
  min-width: 0;
}

.guided-item-copy strong {
  font-size: 0.86rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.guided-item-action {
  font-weight: 700;
  color: var(--teal);
  font-size: 0.78rem;
  line-height: 1.3;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

.guided-item-detail {
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--muted);
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.guided-empty {
  padding: 10px 4px;
  font-size: 0.82rem;
  color: var(--muted);
}

.guided-item-cta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  justify-self: end;
  align-self: center;
}

.guided-item-cta .pill {
  padding: 5px 10px;
  font-size: 0.72rem;
  white-space: nowrap;
}

.guided-item-arrow {
  font-weight: 700;
  font-size: 0.7rem;
  color: var(--teal);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.guided-list::-webkit-scrollbar {
  width: 8px;
}

.guided-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(96, 114, 116, 0.35);
}

.guided-list::-webkit-scrollbar-track {
  background: transparent;
}

.priority-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.86rem;
  margin-bottom: 4px;
}

.priority-banner[hidden] {
  display: none;
}

.priority-banner-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  animation: priority-banner-pulse 1.6s ease-in-out infinite;
}

.priority-banner-copy {
  flex: 1 1 240px;
  min-width: 0;
  line-height: 1.4;
}

.priority-banner-copy strong {
  font-size: 0.95rem;
  margin-right: 2px;
}

.priority-banner-clear {
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.02em;
}

.priority-banner-clear:hover {
  background: rgba(0, 0, 0, 0.08);
}

.priority-banner-rose {
  border-color: var(--rose);
  background: #fff4f4;
  color: var(--rose);
}

.priority-banner-amber {
  border-color: var(--amber);
  background: #fdf3e1;
  color: var(--amber);
}

.priority-banner-teal {
  border-color: var(--teal);
  background: #e6f3f0;
  color: var(--teal);
}

.priority-banner-rose .priority-banner-dot { background: var(--rose); }
.priority-banner-amber .priority-banner-dot { background: var(--amber); }
.priority-banner-teal .priority-banner-dot { background: var(--teal); }

@keyframes priority-banner-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.55; }
}

tbody tr.is-priority-dim {
  opacity: 0.38;
  transition: opacity 0.2s ease;
}

tbody tr.is-priority-dim:hover {
  opacity: 0.7;
}

tbody tr.is-priority-match {
  animation: priority-row-pulse 1.1s ease-out;
}

tbody tr.priority-match-do_first {
  box-shadow: inset 4px 0 0 var(--rose);
}

tbody tr.priority-match-follow_up {
  box-shadow: inset 4px 0 0 var(--amber);
}

tbody tr.priority-match-ready_now {
  box-shadow: inset 4px 0 0 var(--teal);
}

.table-frame.is-sheet tbody tr.priority-match-do_first td {
  background-color: #fff4f4;
}

.table-frame.is-sheet tbody tr.priority-match-follow_up td {
  background-color: #fdf3e1;
}

.table-frame.is-sheet tbody tr.priority-match-ready_now td {
  background-color: #e6f3f0;
}

.table-frame.is-sheet tbody tr.is-priority-match.is-selected td {
  box-shadow: inset 0 0 0 2px rgba(23, 95, 99, 0.32);
}

@keyframes priority-row-pulse {
  0% {
    background-color: rgba(255, 240, 180, 0.6);
    transform: translateX(-2px);
  }
  100% {
    background-color: transparent;
    transform: translateX(0);
  }
}

.board-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.board-tab strong {
  font-size: 1.2rem;
  font-family: Aptos, "Trebuchet MS", sans-serif;
}

.board-tab.is-active {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}

.quick-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-chip {
  width: auto;
  padding: 10px 14px;
  border-radius: 999px;
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
}

.filter-chip.is-active {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}

.board-filter-chip {
  align-self: center;
  padding: 10px 16px;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}

.row-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-right: 4px;
  border: none;
  background: transparent;
  color: var(--teal);
  cursor: pointer;
  border-radius: 4px;
  font-size: 10px;
  transition: transform 0.15s ease, background 0.15s ease;
  vertical-align: middle;
}
.row-chevron:hover { background: var(--teal-soft); }
.row-chevron.is-open { transform: rotate(90deg); }

.prior-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  background: var(--amber-soft);
  color: var(--amber);
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

tbody tr.lapsed-child-row td {
  background: #faf6ed;
  color: var(--muted);
  font-size: 0.72rem;
}
tbody tr.lapsed-child-row .pill {
  opacity: 0.55;
  filter: saturate(0.6);
}
.lapsed-marker {
  display: inline-block;
  padding-left: 16px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.saved-view-bar {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(280px, 1.2fr) 170px 170px;
  gap: 12px;
  align-items: end;
}

.search-field {
  grid-column: 1 / -1;
}

label {
  display: block;
}

input,
select,
textarea,
button {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 12px 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(23, 95, 99, 0.12);
}

input[readonly],
textarea[readonly],
select:disabled,
input:disabled {
  background: #f6f3eb;
  color: #57686a;
}

button {
  cursor: pointer;
  background: linear-gradient(135deg, var(--teal) 0%, #0f4a4d 100%);
  color: white;
  font-weight: 700;
  border: 0;
}

button:hover {
  transform: translateY(-1px);
}

.secondary-button {
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
}

.secondary-button:hover {
  background: #fff8ef;
}

.danger-button {
  background: linear-gradient(135deg, var(--rose) 0%, #8e3837 100%);
  color: white;
  border: 0;
}

.danger-button:hover {
  filter: brightness(1.05);
}

.full-width {
  width: 100%;
}

.table-frame {
  overflow: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: white;
}

.table-frame.is-sheet {
  border-radius: 16px;
  background: #fbfaf6;
  overflow-x: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 960px;
}

thead {
  background: #f7f1e6;
}

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid #ece5d8;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal);
}

tbody tr {
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

tbody tr:hover {
  background: #fff8ef;
}

tbody tr.is-selected {
  background: #eaf5f3;
}

tbody tr.is-mismatch {
  box-shadow: inset 4px 0 0 var(--rose);
}

tbody tr.is-archived {
  background: #fbf8f0;
}

tbody tr.is-lapsed {
  background: #f8f5ee;
}

.table-frame.is-sheet table {
  width: 100%;
  min-width: 100%;
  table-layout: fixed;
  font-size: 0.78rem;
}

.table-frame.is-sheet thead {
  background: #f4efe3;
}

.table-frame.is-sheet th,
.table-frame.is-sheet td {
  padding: 6px 8px;
  border-right: 1px solid #e7e0d4;
  border-bottom: 1px solid #e7e0d4;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.table-frame.is-sheet th:last-child,
.table-frame.is-sheet td:last-child {
  border-right: 0;
}

.table-frame.is-sheet th {
  font-size: 0.68rem;
  line-height: 1.15;
  letter-spacing: 0.04em;
  background: #f6f1e6;
}

.table-frame.is-sheet tbody tr:nth-child(even) td {
  background-image: linear-gradient(rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.12));
}

.table-frame.is-sheet tbody tr:hover td {
  background-color: #f9f3e8;
}

.table-frame.is-sheet tbody tr.is-selected td {
  background-color: #eaf5f3 !important;
  background-image: none !important;
}

.board-editable {
  display: inline-block;
  width: 100%;
  cursor: pointer;
  border-radius: 4px;
  padding: 1px 2px;
  transition: box-shadow 0.12s ease, background 0.12s ease;
}

.board-editable:hover {
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--teal-soft);
}

.board-editable.is-editing {
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--teal);
}

.board-editor {
  width: 100%;
  padding: 2px 4px;
  border: none;
  background: transparent;
  font: inherit;
  color: var(--ink);
  outline: none;
}

.table-frame.is-sheet tbody tr.is-archived td {
  background-color: #faf5ea;
}

.table-frame.is-sheet .column-row-number,
.table-frame.is-sheet .column-mrn {
  position: sticky;
  z-index: 2;
}

.table-frame.is-sheet .column-row-number {
  left: 0;
  min-width: 34px;
  width: 34px;
  text-align: center;
  background: #f1ece1;
}

.table-frame.is-sheet .column-mrn {
  left: 34px;
  min-width: 70px;
  width: 70px;
  background: #fffdf9;
}

.table-frame.is-sheet thead .column-row-number,
.table-frame.is-sheet thead .column-mrn {
  z-index: 3;
}

.sheet-header-text {
  display: inline-block;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.sheet-case-id {
  font-family: "Aptos Narrow", Aptos, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
}

.case-id-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.trace-button {
  width: auto;
  padding: 2px 8px;
  font-size: 0.66rem;
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--teal-soft);
  color: var(--teal);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.trace-button:hover {
  background: white;
  border-color: var(--teal);
  transform: translateY(-1px);
}

.row-index-label {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--muted);
}

.sheet-range-cell {
  min-width: 0;
}

.sheet-range-cell strong {
  display: block;
  font-size: 0.82rem;
  line-height: 1.3;
  font-family: "Aptos Narrow", Aptos, sans-serif;
  font-weight: 700;
  white-space: normal;
}

.sheet-token {
  display: inline-flex;
  align-items: center;
  padding: 4px 7px;
  border-radius: 7px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
  max-width: 100%;
  white-space: normal;
}

.table-frame.is-sheet .column-patientlastname {
  width: 78px;
}

.table-frame.is-sheet .column-patientfirstname {
  width: 70px;
}

.table-frame.is-sheet .column-episodetype {
  width: 108px;
}

.table-frame.is-sheet .column--nextaction {
  width: 118px;
}

.table-frame.is-sheet .column-workflowstage {
  width: 92px;
}

.table-frame.is-sheet .column-assignedqa,
.table-frame.is-sheet .column-assignedcm,
.table-frame.is-sheet .column-assignedcoder,
.table-frame.is-sheet .column-assignedformsclerk {
  width: 60px;
}

.table-frame.is-sheet .column-codingstatus,
.table-frame.is-sheet .column-oasisstatus,
.table-frame.is-sheet .column-oasisqastatus,
.table-frame.is-sheet .column-formsstatus,
.table-frame.is-sheet .column-visitnotestatus,
.table-frame.is-sheet .column-dcoasisstatus {
  width: 72px;
}

.table-frame.is-sheet .column-followupduedate,
.table-frame.is-sheet .column-oasisqaduedate,
.table-frame.is-sheet .column-codingduedate,
.table-frame.is-sheet .column-dischargedate,
.table-frame.is-sheet .column-supplyduedate,
.table-frame.is-sheet .column-cathchangeduedate {
  width: 78px;
}

.table-frame.is-sheet .column-dischargestatus {
  width: 82px;
}

.table-frame.is-sheet .column-firstinvoicenumber,
.table-frame.is-sheet .column-secondinvoicenumber {
  width: 84px;
}

.sheet-next-action {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.sheet-action-label {
  display: block;
  font-size: 0.75rem;
  line-height: 1.2;
}

.sheet-next-detail {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.2;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.sheet-inline-input {
  width: 100%;
  min-width: 0;
  padding: 5px 6px;
  border-radius: 6px;
  border: 1px solid rgba(23, 95, 99, 0.16);
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.72rem;
  box-shadow: none;
}

.sheet-cell-text {
  display: inline-block;
  font-size: 0.74rem;
  line-height: 1.18;
  color: var(--ink);
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.sheet-cell-text.green {
  color: #2f6b3c;
}

.sheet-cell-text.amber {
  color: #8a571d;
}

.sheet-cell-text.rose {
  color: #8b3c3a;
}

td.is-overdue-cell {
  background-color: #fde6e6 !important;
  background-image: none !important;
}

td.is-overdue-cell .sheet-cell-text,
td.is-overdue-cell .pill {
  color: #c0392b !important;
  font-weight: 700;
}

td.is-overdue-cell .pill {
  background-color: #fbd1d1 !important;
}

.sheet-cell-text.teal {
  color: var(--teal);
}

.priority-sidebar-card .guided-list {
  max-height: 250px;
}

.sheet-stack-cell {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.patient-summary-cell strong,
.owner-summary-cell strong {
  font-size: 0.82rem;
  line-height: 1.22;
}

.workflow-summary-cell {
  gap: 7px;
}

.sheet-flag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.sheet-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 6px;
}

.sheet-summary-item {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.sheet-summary-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.sheet-owner-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
}

.sheet-owner-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.invoice-summary-cell {
  gap: 8px;
}

.sheet-inline-field {
  display: grid;
  gap: 4px;
}

.table-frame.is-sheet .column-flags {
  width: 88px;
}

.sheet-inline-input[readonly] {
  border-style: dashed;
  background: rgba(246, 243, 235, 0.9);
}

.table-frame.is-sheet .category-assignment {
  background-color: #eef2fb;
}

.table-frame.is-sheet .category-status {
  background-color: #eef8e7;
}

.table-frame.is-sheet .category-discharge {
  background-color: #f7ead8;
}

.table-frame.is-sheet .category-date {
  background-color: #fcf4e7;
}

.table-frame.is-sheet .category-workflow {
  background-color: #e6f1f0;
}

.table-frame.is-sheet .category-guidance {
  background-color: #f7f3ea;
}

.table-frame.is-sheet .category-episode {
  background-color: #faf3e2;
}

.table-frame.is-sheet .category-identity {
  background-color: #fffdfa;
}

.table-frame.is-sheet .category-flags {
  background-color: #f4f3ee;
}

.table-frame.is-sheet .column-firstinvoicenumber,
.table-frame.is-sheet .column-secondinvoicenumber {
  background-color: #f4efe4;
}

.patient-cell strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1rem;
}

.subline {
  color: var(--muted);
  font-size: 0.9rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.pill.green {
  background: #e4f5e5;
  color: #2f6b3c;
}

.pill.amber {
  background: var(--amber-soft);
  color: #8a571d;
}

.pill.rose {
  background: var(--rose-soft);
  color: #8b3c3a;
}

.pill.teal {
  background: var(--teal-soft);
  color: var(--teal);
}

.pill.neutral {
  background: #edf0f0;
  color: #506265;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.8fr);
  gap: 24px;
}

.detail-form {
  display: grid;
  gap: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.full-span {
  grid-column: 1 / -1;
}

.detail-form-sections {
  display: grid;
  gap: 14px;
}

.detail-section-divider {
  height: 2px;
  background: var(--ink);
  margin: 10px 0 4px;
  border-radius: 2px;
}

.detail-section-label {
  margin: 0 0 4px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal);
}

.detail-section-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  /* All cells align to the top of the row — keeps label-to-input spacing
     tight and consistent even when a sibling cell renders something taller
     (e.g. a status dropdown in the same row as a text input). */
  align-items: start;
}

/* Every label inside a grid cell stacks compactly: label → input,
   with the input filling the cell's width. No stretching downward. */
.detail-section-grid > label {
  display: flex;
  flex-direction: column;
  align-self: start;
  margin: 0;
}
.detail-section-grid > label > input,
.detail-section-grid > label > select,
.detail-section-grid > label > textarea {
  margin: 0;
}

.detail-section-grid.is-full-width > label,
.detail-section-grid.is-full-width > .detail-field-spacer {
  grid-column: 1 / -1;
}

.detail-field-spacer {
  visibility: hidden;
}

.cath-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  font-size: 0.92rem;
  color: var(--ink);
  width: fit-content;
}

.cath-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
  margin: 0;
}

.cath-toggle input[type="checkbox"]:disabled + span {
  color: var(--muted);
}

.detail-section-grid.cath-grid.is-disabled {
  opacity: 0.55;
}

.detail-section-block {
  display: grid;
  gap: 12px;
}

.detail-section-block.is-conditional.is-hidden {
  display: none;
}

.episode-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 4px 0 2px;
}

.boolean-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  font-size: 0.92rem;
  color: var(--ink);
  cursor: pointer;
}

.boolean-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
  margin: 0;
}

.boolean-field input[type="checkbox"]:disabled {
  cursor: not-allowed;
}

.boolean-field input[type="checkbox"]:disabled + span {
  color: var(--muted);
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-top: 8px;
}

.button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.form-actions button {
  max-width: 260px;
}

.rail {
  display: grid;
  gap: 24px;
}

.queue-summary,
.activity-feed {
  display: grid;
  gap: 12px;
}

.workflow-guide {
  display: grid;
  gap: 16px;
}

.workflow-current {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fffdf8 0%, #fff7ec 100%);
}

.workflow-current-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 2px 0 10px;
}

.workflow-toggle,
.worklog-toggle {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--teal);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.workflow-toggle:hover,
.worklog-toggle:hover {
  background: var(--teal-soft);
  border-color: var(--teal);
}

.worklog-compact {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ============================================================
   1.1 Toast notifications
   ============================================================ */
.toast-host {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: min(420px, calc(100vw - 40px));
}

.toast {
  pointer-events: auto;
  padding: 12px 16px;
  border-radius: 10px;
  background: white;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  box-shadow: 0 12px 28px rgba(25, 43, 44, 0.16);
  font-size: 0.88rem;
  color: var(--ink);
  cursor: pointer;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.toast-success { border-left-color: var(--moss); }
.toast-error   { border-left-color: var(--rose); background: #fef4f3; }
.toast-info    { border-left-color: var(--teal); }

/* ============================================================
   2.2 Help tooltip "(?)" button
   ============================================================ */
.help-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  vertical-align: middle;
  line-height: 1;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.help-tip:hover,
.help-tip:focus {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
  outline: none;
}

/* ============================================================
   4.5 Login tagline
   ============================================================ */
.login-tagline {
  margin: 14px 0 0;
  font-size: 0.92rem;
  font-style: italic;
  color: var(--teal);
  border-left: 3px solid var(--teal-soft);
  padding-left: 10px;
}

/* ============================================================
   6.1 Toolbar action button (CSV export)
   ============================================================ */
.toolbar-action {
  align-self: flex-end;
  white-space: nowrap;
}

/* ============================================================
   6.1b Reset Filters button
   - Hidden when no filters are active.
   - Amber pill with count badge so it's easy to spot when something is filtered.
   ============================================================ */
.reset-filters-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--amber);
  background: var(--amber-soft);
  color: #6f4216;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 2px rgba(201, 130, 43, 0.15);
}

.reset-filters-button:hover {
  background: #f6d6a8;
  box-shadow: 0 2px 6px rgba(201, 130, 43, 0.3);
  transform: translateY(-1px);
}

.reset-filters-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(201, 130, 43, 0.15);
}

.reset-filters-button:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.reset-filters-icon {
  font-size: 1rem;
  line-height: 1;
}

.reset-filters-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--amber);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

/* ============================================================
   6.1c Detail form field tone highlights
   - Visible but neat: tone dot + bold tone label + 2px ring
     around the input + a soft tinted background on the input.
   - Same visual language as the queue cells but applied only to
     the input (not the whole field block) so it stays minimalist.
   ============================================================ */
.detail-form label.field-tone-rose,
.detail-form label.field-tone-amber,
.detail-form label.field-tone-green,
.mini-form label.field-tone-rose,
.mini-form label.field-tone-amber,
.mini-form label.field-tone-green {
  position: relative;
  background: transparent;
  border: 0;
  padding: 0;
  border-radius: 0;
}

/* Dot indicator before the label. */
.detail-form label.field-tone-rose > .field-label::before,
.detail-form label.field-tone-amber > .field-label::before,
.detail-form label.field-tone-green > .field-label::before,
.detail-form label.field-tone-rose > .field-label-text::before,
.detail-form label.field-tone-amber > .field-label-text::before,
.detail-form label.field-tone-green > .field-label-text::before,
.mini-form label.field-tone-rose > .field-label::before,
.mini-form label.field-tone-amber > .field-label::before,
.mini-form label.field-tone-green > .field-label::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.detail-form label.field-tone-rose > .field-label::before,
.detail-form label.field-tone-rose > .field-label-text::before { background: var(--rose); }
.detail-form label.field-tone-amber > .field-label::before,
.detail-form label.field-tone-amber > .field-label-text::before { background: var(--amber); }
.detail-form label.field-tone-green > .field-label::before,
.detail-form label.field-tone-green > .field-label-text::before { background: #2f6b3c; }

/* Bold tone-colored label so the eye finds it instantly. */
.detail-form label.field-tone-rose > .field-label,
.detail-form label.field-tone-rose > .field-label-text,
.mini-form label.field-tone-rose > .field-label {
  color: var(--rose);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.detail-form label.field-tone-amber > .field-label,
.detail-form label.field-tone-amber > .field-label-text,
.mini-form label.field-tone-amber > .field-label {
  color: #8a571d;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.detail-form label.field-tone-green > .field-label,
.detail-form label.field-tone-green > .field-label-text,
.mini-form label.field-tone-green > .field-label {
  color: #2f6b3c;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* The input itself: 2px tone ring + soft tinted background.
   Strong enough to spot from across the screen, soft enough
   to not feel alarming. */
.detail-form label.field-tone-rose select,
.detail-form label.field-tone-rose input[type="date"],
.detail-form label.field-tone-rose input[type="text"],
.mini-form label.field-tone-rose input[type="date"] {
  border: 2px solid var(--rose);
  background-color: #fde9e9;
  color: #6f2c2c;
  font-weight: 600;
}

.detail-form label.field-tone-amber select,
.detail-form label.field-tone-amber input[type="date"],
.detail-form label.field-tone-amber input[type="text"],
.mini-form label.field-tone-amber input[type="date"] {
  border: 2px solid var(--amber);
  background-color: #fdefd6;
  color: #6f4216;
  font-weight: 600;
}

.detail-form label.field-tone-green select,
.detail-form label.field-tone-green input[type="date"],
.detail-form label.field-tone-green input[type="text"],
.mini-form label.field-tone-green input[type="date"] {
  border: 2px solid #2f6b3c;
  background-color: #e9f3ec;
  color: #1f4e2a;
  font-weight: 600;
}

/* Focus ring stays visible on top of the tone border. */
.detail-form label.field-tone-rose select:focus,
.detail-form label.field-tone-rose input:focus,
.mini-form label.field-tone-rose input:focus {
  outline: 2px solid var(--rose);
  outline-offset: 1px;
}
.detail-form label.field-tone-amber select:focus,
.detail-form label.field-tone-amber input:focus,
.mini-form label.field-tone-amber input:focus {
  outline: 2px solid var(--amber);
  outline-offset: 1px;
}
.detail-form label.field-tone-green select:focus,
.detail-form label.field-tone-green input:focus,
.mini-form label.field-tone-green input:focus {
  outline: 2px solid #2f6b3c;
  outline-offset: 1px;
}

/* Auto-WorkflowStage hint — confirms the stage just got auto-updated.
   Fades after a few seconds so it doesn't linger on the form. */
.workflow-auto-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0;
  padding: 6px 10px;
  background: var(--teal-soft);
  border-left: 3px solid var(--teal);
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--teal);
  font-weight: 600;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.workflow-auto-hint.is-fading {
  opacity: 0;
}

.workflow-auto-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  flex-shrink: 0;
}

.workflow-auto-hint strong {
  color: var(--ink);
  font-weight: 700;
}

/* Inline error message under a form field — shown on bad date / bad name. */
.field-error-message {
  margin: 4px 0 0;
  padding: 4px 8px;
  background: #fde9e9;
  border-left: 3px solid var(--rose);
  border-radius: 4px;
  font-size: 0.74rem;
  color: var(--rose);
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Keyboard shortcut hint — small caption under the Save button row. */
.shortcut-hint {
  margin: 6px 0 0;
  font-size: 0.74rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.shortcut-hint kbd {
  display: inline-block;
  padding: 1px 6px;
  margin: 0 2px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink);
  background: #f1ede4;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  line-height: 1.4;
}

/* ============================================================
   3.1 Global search modal
   ============================================================ */
.global-search-card {
  width: min(560px, 92vw);
  padding: 0;
  overflow: hidden;
}

.global-search-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.global-search-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 1rem;
  color: var(--teal);
  flex-shrink: 0;
}

/* Override the global `input` rule with high specificity so the search
   field renders as a visible, readable text input on a white background. */
.global-search-card .global-search-input {
  flex: 1 1 auto;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  font-size: 1rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.global-search-card .global-search-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(23, 95, 99, 0.15);
}

.global-search-card .global-search-input::placeholder {
  color: var(--muted);
}

/* Esc close button — small, neutral, distinct from the giant teal save buttons. */
.global-search-card .global-search-close {
  flex-shrink: 0;
  width: auto;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--surface-strong);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

.global-search-card .global-search-close:hover {
  background: var(--teal-soft);
  color: var(--teal);
  border-color: var(--teal);
}
.global-search-hint {
  margin: 0;
  padding: 8px 16px;
  font-size: 0.78rem;
  border-bottom: 1px solid var(--line);
  background: #fbf8f0;
}
.global-search-hint kbd {
  background: white;
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-family: ui-monospace, monospace;
}
.global-search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
}
.global-search-result {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f0eadf;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.global-search-result:last-child { border-bottom: none; }
.global-search-result.is-selected {
  background: var(--teal-soft);
}
.global-search-meta {
  font-size: 0.78rem;
  color: var(--muted);
}
.global-search-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-style: italic;
}

/* ============================================================
   5.2 Notification bell
   ============================================================ */
.hero-bell-wrap {
  position: relative;
  align-items: center;
  justify-content: center;
}
.notification-bell {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: white;
  border: 1px solid var(--line);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.notification-bell:hover {
  background: var(--teal-soft);
  border-color: var(--teal);
}
.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--rose);
  color: white;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}
.notification-dropdown {
  /* `position: fixed` escapes every parent stacking context — necessary
     because .metrics article creates its own via backdrop-filter and would
     otherwise paint over an absolute-positioned dropdown anchored to .hero.
     Top/right are recomputed in JS from the bell's bounding rect. */
  position: fixed;
  width: 360px;
  max-width: calc(100vw - 32px);
  background-color: #ffffff !important;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 14px 36px rgba(25, 43, 44, 0.18);
  z-index: 1200;
  overflow: hidden;
  isolation: isolate;
}
.notification-dropdown-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background-color: #ffffff !important;
}
.notification-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 380px;
  overflow-y: auto;
  background-color: #ffffff !important;
}
.notification-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-style: italic;
  background-color: #ffffff !important;
}
.notification-item {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid #f0eadf;
  cursor: pointer;
  transition: background-color 0.12s ease;
  background-color: #ffffff !important;
  color: var(--ink);
}
.notification-item:last-child {
  border-bottom: 0;
}
.notification-item:hover {
  background-color: var(--surface-strong) !important;
}
.notification-item.is-unread {
  background-color: #f4f9f8 !important;
}
.notification-item.is-unread:hover {
  background-color: #e7f1ef !important;
}

.notification-item-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.notification-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.notification-item-head strong {
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.2;
}

/* Inline NEW pill — replaces the prior section-head approach. */
.notification-new-pill {
  display: inline-block;
  padding: 1px 8px;
  background: var(--teal);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  border-radius: 999px;
  line-height: 1.4;
}

.notification-meta {
  font-size: 0.82rem;
  color: var(--ink);
  line-height: 1.35;
}
.notification-time {
  font-size: 0.72rem;
  color: var(--muted);
}

/* ============================================================
   5.4 'Currently editing' banner
   - Matches the alert-card tone language: slim 3px amber accent
     + 8px amber dot. The icon stays as the secondary cue.
   ============================================================ */
.case-lock-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fdefd6;
  border-left: 3px solid var(--amber);
  border-radius: 8px;
  font-size: 0.86rem;
  color: #6f4216;
  font-weight: 600;
  margin-bottom: 12px;
}

.case-lock-banner::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
}

.case-lock-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ============================================================
   Personalized hero — compact greeting + actionable stat chips
   Overrides the older verbose hero layout for the case-board view.
   ============================================================ */
.hero.hero-personal {
  padding: 18px 24px;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.hero.hero-personal .hero-greeting {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.hero.hero-personal .hero-eyebrow {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--teal);
  font-weight: 700;
  margin: 0;
}

.hero.hero-personal h2 {
  margin: 0;
  font-size: clamp(1.4rem, 2vw, 1.9rem);
  line-height: 1.2;
  max-width: none;
}

.hero.hero-personal .hero-subline {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 60ch;
}

.hero.hero-personal .hero-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: flex-end;
  gap: 10px;
}

/* Stat chips — buttons that filter the board on click. */
.hero-stat-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  width: auto;
  min-width: 110px;
  padding: 10px 14px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 500;
  text-align: left;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.hero-stat-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(25, 43, 44, 0.08);
}

.hero-stat-chip strong {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  color: var(--ink);
}

.hero-stat-chip span {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.hero-stat-chip.is-rose  { border-left: 3px solid var(--rose);  background: #fde9e9; }
.hero-stat-chip.is-rose strong  { color: var(--rose); }
.hero-stat-chip.is-amber { border-left: 3px solid var(--amber); background: #fdefd6; }
.hero-stat-chip.is-amber strong { color: var(--amber); }
.hero-stat-chip.is-teal  { border-left: 3px solid var(--teal);  background: var(--teal-soft); }
.hero-stat-chip.is-teal strong  { color: var(--teal); }
.hero-stat-chip.is-neutral { border-left: 3px solid var(--line); }

/* Tone dot before the chip's label, matching alert cards / form fields. */
.hero-stat-chip.is-rose span::before,
.hero-stat-chip.is-amber span::before,
.hero-stat-chip.is-teal span::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}
.hero-stat-chip.is-rose  span::before { background: var(--rose); }
.hero-stat-chip.is-amber span::before { background: var(--amber); }
.hero-stat-chip.is-teal  span::before { background: var(--teal); }

@media (max-width: 1100px) {
  .hero.hero-personal {
    grid-template-columns: 1fr;
  }
  .hero.hero-personal .hero-stats {
    justify-content: flex-start;
  }
}

/* ============================================================
   Status-change confirmation modal
   ============================================================ */
.status-change-card {
  width: min(540px, 92vw);
}

.status-change-list {
  margin: 12px 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-change-line {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.status-change-field {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--muted);
}

.status-change-flow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

.status-old {
  color: var(--rose);
  text-decoration: line-through;
  text-decoration-color: rgba(180, 88, 87, 0.5);
  font-weight: 600;
}

.status-arrow {
  color: var(--teal);
  font-weight: 700;
}

.status-new {
  color: var(--moss);
  font-weight: 700;
}

/* Auto-refresh modal can have many changes — let the list scroll. */
.auto-refresh-changes {
  max-height: 220px;
  overflow-y: auto;
  margin-top: 12px;
}

/* ============================================================
   My Active Cases sidebar list
   ============================================================ */
.my-active-cases-card .panel-heading {
  margin-bottom: 12px;
}

.my-active-cases {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.my-case-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  padding: 10px 12px;
  background: white;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  font-weight: 500;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.my-case-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(25, 43, 44, 0.08);
  border-color: var(--teal);
}

.my-case-row strong {
  font-size: 0.92rem;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.2;
}

.my-case-meta {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.my-case-summary {
  font-size: 0.82rem;
  color: var(--moss);
  margin-top: 2px;
}

.my-case-row.is-overdue {
  border-left-color: var(--rose);
  background: #fef4f3;
}
.my-case-row.is-overdue .my-case-summary {
  color: var(--rose);
  font-weight: 700;
}

.my-case-row.is-warning {
  border-left-color: var(--amber);
  background: #fff7e2;
}
.my-case-row.is-warning .my-case-summary {
  color: var(--amber);
  font-weight: 700;
}

.my-case-row.is-selected {
  outline: 2px solid var(--teal);
  outline-offset: -2px;
  background: var(--teal-soft);
}

.my-cases-more {
  width: 100%;
  text-align: center;
  padding: 8px 12px;
  background: transparent;
  color: var(--teal);
  font-weight: 600;
  font-size: 0.82rem;
  border: 1px dashed var(--line);
  border-radius: 8px;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.my-cases-more:hover {
  background: var(--teal-soft);
  border-color: var(--teal);
}

.board-tab-deleted span {
  color: var(--rose);
  font-weight: 700;
}

.board-tab-deleted strong {
  color: var(--rose);
}

.board-tab-deleted.is-active {
  background: var(--rose);
  border-color: var(--rose);
}

.board-tab-deleted.is-active span,
.board-tab-deleted.is-active strong {
  color: white;
}

tbody tr.deleted-row td {
  background: #faf6ed;
  color: var(--muted);
}

tbody tr.deleted-row strong {
  color: var(--ink);
}

.stage-popover {
  position: absolute;
  z-index: 1000;
  width: 320px;
  max-width: calc(100vw - 16px);
  background: white;
  border: 1px solid var(--line);
  border-left: 3px solid var(--teal);
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(25, 43, 44, 0.18);
  padding: 14px 16px;
  font-size: 0.85rem;
  color: var(--ink);
}

.stage-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.stage-popover-head strong {
  color: var(--teal);
  font-size: 0.95rem;
}

.stage-popover-close {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 4px;
}

.stage-popover-close:hover { color: var(--rose); }

.stage-popover-desc {
  margin: 0 0 10px;
  color: var(--ink);
  line-height: 1.4;
}

.stage-popover-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  padding-top: 8px;
}

.stage-popover-meta em {
  font-style: normal;
  font-weight: 700;
  color: var(--teal);
  margin-right: 3px;
}

.workflow-timeline {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.workflow-step {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: white;
}

.workflow-step-index {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-weight: 700;
  background: #edf0f0;
  color: var(--muted);
}

.workflow-step-copy strong,
.workflow-step-copy span {
  display: block;
}

.workflow-step-copy strong {
  margin-bottom: 4px;
}

.workflow-step-copy span {
  color: var(--muted);
  font-size: 0.92rem;
}

.workflow-step.is-current {
  border-color: rgba(23, 95, 99, 0.35);
  background: #eef7f6;
}

.workflow-step.is-current .workflow-step-index {
  background: var(--teal);
  color: white;
}

.workflow-step.is-complete {
  border-color: rgba(77, 111, 85, 0.3);
  background: #f2f8f2;
}

.workflow-step.is-complete .workflow-step-index {
  background: #dcecdc;
  color: #2f6b3c;
}

.workflow-step.is-upcoming {
  opacity: 0.82;
}

.workflow-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.workflow-summary-card {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: white;
}

.workflow-summary-card strong,
.workflow-summary-card span,
.workflow-empty strong,
.workflow-empty span {
  display: block;
}

.workflow-summary-card strong {
  font-size: 1.25rem;
  margin-bottom: 4px;
}

.workflow-summary-card span,
.workflow-empty span {
  color: var(--muted);
}

.workflow-empty {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--line);
  background: rgba(255, 255, 255, 0.75);
}

.workflow-empty strong {
  margin-bottom: 6px;
}

.queue-card,
.activity-item {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: white;
}

.queue-card strong {
  display: block;
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.queue-card span,
.activity-item span {
  color: var(--muted);
  display: block;
}

.activity-item strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.98rem;
}

.alert-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

/* Alert cards — same tone language as the form fields:
   slim 3px left accent + 8px tone dot + soft tinted fill + bold tone text. */
.alert-card {
  position: relative;
  padding: 12px 14px 12px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  border-left: 3px solid transparent;
}

.alert-card::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.alert-danger {
  background: #fde9e9;
  color: var(--rose);
  border-left-color: var(--rose);
}
.alert-danger::before { background: var(--rose); }

.alert-warning {
  background: #fdefd6;
  color: #8a571d;
  border-left-color: var(--amber);
}
.alert-warning::before { background: var(--amber); }

.alert-success {
  background: #e9f3ec;
  color: #2f6b3c;
  border-left-color: #2f6b3c;
}
.alert-success::before { background: #2f6b3c; }

.alert-guide {
  background: #edf7f5;
  color: var(--teal);
  border-left-color: var(--teal);
}
.alert-guide::before { background: var(--teal); }

.alert-info {
  background: var(--teal-soft);
  color: var(--teal);
  border-left-color: var(--teal);
}
.alert-info::before { background: var(--teal); }

.mini-form {
  display: grid;
  gap: 12px;
}

.mini-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.import-result {
  display: grid;
  gap: 8px;
}

.import-result:empty {
  display: none;
}

.import-skipped-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  font-size: 0.88rem;
}

.login-ghost {
  background: transparent;
  border: 0;
  padding: 4px 0;
  color: var(--teal);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.92rem;
  text-align: left;
  width: fit-content;
}

.login-ghost:hover {
  text-decoration: underline;
}

.forgot-panel {
  grid-column: 1 / -1;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-strong) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: grid;
  gap: 12px;
}

[hidden] {
  display: none !important;
}

.invite-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.invite-grid-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.hr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.hr-table thead th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--teal);
  border-bottom: 2px solid var(--line);
}

.hr-table tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.hr-table tbody tr:hover {
  background: var(--surface-strong);
}

.hr-table tbody tr.row-inactive td {
  color: var(--muted);
  font-style: italic;
}

.hr-table .secondary-button {
  padding: 6px 12px;
  font-size: 0.85rem;
  margin-right: 6px;
}

/* Protected (founder/owner) accounts — shown in place of the Deactivate
   button to make clear that the account cannot be removed via the UI. */
.protected-tag {
  display: inline-block;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--teal);
  background: var(--teal-soft);
  border: 1px solid var(--teal);
  border-radius: 999px;
  cursor: not-allowed;
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.status-online {
  background: #2da25a;
  box-shadow: 0 0 0 3px rgba(45, 162, 90, 0.18);
}

.status-offline {
  background: var(--muted);
}

.status-inactive {
  background: var(--rose);
}

.hr-shell .hero h2 {
  margin: 8px 0 0;
}

.hr-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.hr-tab {
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.hr-tab:hover {
  color: var(--ink);
}

.hr-tab.is-active {
  background: var(--teal);
  color: var(--surface);
}

.hr-filter-banner {
  position: relative;
  margin: 0 0 12px;
  padding: 10px 14px 10px 18px;
  background: var(--teal-soft);
  border-left: 3px solid var(--teal);
  border-radius: var(--radius-md);
  color: var(--teal);
  font-weight: 700;
  font-size: 0.92rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.hr-filter-banner::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  flex-shrink: 0;
  margin-right: 4px;
}

.hr-filter-banner .ghost-link {
  background: transparent;
  border: 0;
  color: var(--teal);
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
}

.hr-filter-banner .ghost-link:hover {
  text-decoration: underline;
}

.sortable-table thead th[data-sort-field] {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 28px;
}

.sortable-table thead th[data-sort-field]:hover {
  background: var(--surface-strong);
}

.sortable-table thead th[data-sort-field]::after {
  content: "↕";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.78rem;
  opacity: 0.4;
}

.sortable-table thead th.is-sorted-asc::after {
  content: "↑";
  opacity: 1;
}

.sortable-table thead th.is-sorted-desc::after {
  content: "↓";
  opacity: 1;
}

.hr-groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding: 4px;
}

.hr-group-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-strong) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
  font: inherit;
  color: var(--ink);
}

.hr-group-card:hover {
  transform: translateY(-2px);
  border-color: var(--teal);
  box-shadow: var(--shadow);
}

.hr-group-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.hr-group-card-header strong {
  font-size: 1.05rem;
}

.hr-group-count {
  background: var(--teal);
  color: var(--surface);
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  min-width: 36px;
  text-align: center;
}

.hr-group-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--muted);
}

.hr-group-stats .status-dot {
  margin-right: 4px;
}

.hr-group-cta {
  font-size: 0.82rem;
  color: var(--teal);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.worklog {
  display: grid;
  gap: 14px;
}

.worklog-empty {
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.92rem;
}

.worklog-bucket {
  display: grid;
  gap: 8px;
}

.worklog-bucket-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 4px;
}

.worklog-bucket-body {
  display: grid;
  gap: 8px;
}

.worklog-event {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 10px 14px 10px 12px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius-md);
  background: var(--surface);
}

.worklog-event-green { border-left-color: var(--moss); }
.worklog-event-teal { border-left-color: var(--teal); }
.worklog-event-amber { border-left-color: var(--amber); }
.worklog-event-rose { border-left-color: var(--rose); }
.worklog-event-neutral { border-left-color: var(--line); }

.worklog-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 6px;
  background: var(--muted);
}

.worklog-dot-green { background: var(--moss); }
.worklog-dot-teal { background: var(--teal); }
.worklog-dot-amber { background: var(--amber); }
.worklog-dot-rose { background: var(--rose); }

.worklog-event-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.worklog-event-label {
  font-size: 0.95rem;
  line-height: 1.25;
  color: var(--ink);
}

.worklog-event-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.worklog-event-role {
  color: var(--muted);
}

.worklog-event-case {
  font-size: 0.78rem;
  color: var(--teal);
  font-weight: 700;
  margin-top: 2px;
}

.activity-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: end;
  margin-bottom: 14px;
}

.activity-toolbar label {
  display: grid;
  gap: 4px;
  flex: 1 1 200px;
  min-width: 0;
}

.activity-toolbar select,
.activity-toolbar input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: white;
  font: inherit;
  color: var(--ink);
}

.activity-summary {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 0 4px;
  margin-bottom: 6px;
}

@media (max-width: 900px) {
  .invite-grid {
    grid-template-columns: 1fr;
  }
}

.alert-card.alert-info {
  background: var(--teal-soft);
  border: 1px solid var(--teal);
  color: var(--teal);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  word-break: break-all;
  font-size: 0.92rem;
}

.alert-card.alert-info a {
  color: var(--teal);
  font-weight: 700;
}

.alert-card.alert-info button {
  margin-top: 8px;
}

.login-card.auth-single {
  grid-template-columns: minmax(0, 1fr);
}

.login-card.auth-single .login-form {
  grid-column: 1 / -1;
}

code {
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1ece2;
  color: var(--ink);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 37, 38, 0.48);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 50;
}

.modal-backdrop.is-hidden {
  display: none;
}

.modal-card {
  width: min(620px, 100%);
  background: rgba(255, 253, 248, 0.98);
  border: 1px solid rgba(216, 209, 196, 0.9);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 26px;
}

.modal-copy {
  color: var(--ink);
}

.modal-list {
  margin: 16px 0;
  padding-left: 18px;
  color: var(--muted);
}

.modal-list li + li {
  margin-top: 8px;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 20px;
}

.is-overdue {
  box-shadow: inset 4px 0 0 var(--rose);
}

.is-due-soon {
  box-shadow: inset 4px 0 0 var(--amber);
}

.auto-refresh-card {
  width: min(540px, 100%);
}

.auto-refresh-card h3 {
  margin: 6px 0 12px;
}

.auto-refresh-card .modal-copy {
  color: var(--ink);
  margin: 0 0 16px;
  line-height: 1.5;
}

.auto-refresh-countdown {
  margin: 0 0 18px;
  display: grid;
  gap: 8px;
}

.auto-refresh-countdown-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(23, 95, 99, 0.12);
  overflow: hidden;
}

.auto-refresh-countdown-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--amber) 0%, var(--rose) 100%);
  transition: width 0.95s linear;
}

.auto-refresh-countdown-text {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.auto-refresh-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.auto-refresh-actions button {
  width: auto;
  flex: 0 1 auto;
  padding: 10px 16px;
  font-size: 0.86rem;
}

@media (max-width: 1260px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .board-side {
    position: static;
  }

  .toolbar,
  .detail-grid,
  .hero {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .login-card {
    grid-template-columns: 1fr;
  }

  .demo-users-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .saved-view-bar {
    grid-template-columns: 1fr 1fr;
  }

  .board-workspace {
    grid-template-columns: 1fr;
  }

  .board-tabs {
    grid-template-columns: 1fr;
  }

  .guided-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    padding: 16px;
  }

  .board-panel,
  .detail-panel,
  .rail-card,
  .hero,
  .sidebar {
    border-radius: 20px;
    padding: 18px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .detail-section-grid {
    grid-template-columns: 1fr;
  }

  .demo-users-grid {
    grid-template-columns: 1fr;
  }

  .saved-view-bar {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .layout-toggle {
    flex-direction: column;
  }

  .layout-toggle .secondary-button {
    width: 100%;
  }

  .guided-cards {
    grid-template-columns: 1fr;
  }

  .guided-list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .guided-item {
    gap: 10px;
  }

  .workflow-summary-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .form-actions button {
    max-width: none;
  }
}
