@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: light;
  --ink: #132336;
  --muted: #54697f;
  --paper: linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(251, 254, 255, 0.9));
  --paper-strong: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(248, 252, 255, 0.94));
  --line: rgba(95, 128, 167, 0.34);
  --line-strong: rgba(77, 114, 156, 0.52);
  --brand: #2f639f;
  --brand-dark: #274f83;
  --brand-light: rgba(47, 99, 159, 0.08);
  --warn: #c83737;
  --shadow: 0 8px 20px rgba(19, 36, 56, 0.08);
  --shadow-lg: 0 14px 30px rgba(19, 36, 56, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  line-height: 1.45;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 10%, rgba(116, 162, 238, 0.08), transparent 40%),
    radial-gradient(circle at 85% 12%, rgba(92, 164, 229, 0.08), transparent 42%),
    radial-gradient(circle at 55% 88%, rgba(86, 168, 232, 0.05), transparent 44%),
    linear-gradient(155deg, #f5f9ff 0%, #edf4ff 56%, #e5f0ff 100%);
  overflow-x: hidden;
}

.lp-body {
  display: flex;
  min-height: 100vh;
}

.bg-shape {
  position: fixed;
  z-index: -1;
  pointer-events: none;
}

/* ECG waveform strip — subtle medical illustration at page bottom */
.bg-a {
  width: 100vw;
  height: 80px;
  bottom: 0;
  left: 0;
  top: auto;
  right: auto;
  border-radius: 0;
  filter: none;
  opacity: 1;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 80'%3E%3Cpath d='M0,40 L80,40 L88,37 L93,32 L98,37 L103,40 L106,44 L110,5 L114,68 L118,42 L130,35 L138,30 L146,35 L152,40 L320,40' fill='none' stroke='rgba(54,99,176,0.15)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") repeat-x center / 320px 80px;
}

.bg-b {
  display: none;
}

.shell {
  width: min(1380px, 94vw);
  margin: 18px auto 56px;
  display: grid;
  gap: 14px;
}

/* ─── Landing page (split-screen) ─── */

.lp-brand {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 64px;
  background: linear-gradient(155deg, #0a1628 0%, #0d2a42 50%, #134e6a 100%);
  color: white;
  position: relative;
  overflow: hidden;
}

.lp-brand::before,
.lp-brand::after {
  content: '';
  position: absolute;
  pointer-events: none;
}

.lp-brand::before {
  inset: 0;
  background:
    radial-gradient(ellipse 640px 500px at 15% 120%, rgba(54, 99, 176, 0.2) 0%, transparent 60%),
    radial-gradient(ellipse 480px 320px at 90% -15%, rgba(6, 182, 212, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse 300px 300px at 50% 50%, rgba(255, 255, 255, 0.02) 0%, transparent 70%);
}

.lp-brand::after {
  width: 520px;
  height: 520px;
  right: -120px;
  top: 50%;
  transform: translateY(-50%);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 52 52' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='2' y='2' width='48' height='48' rx='14' fill='rgba(255,255,255,0.06)' stroke='rgba(255,255,255,0.12)' stroke-width='1.5'/%3E%3Ccircle cx='26' cy='26' r='10' stroke='rgba(255,255,255,0.22)' stroke-width='2'/%3E%3Cpath d='M26 20v6l4 3' stroke='rgba(255,255,255,0.22)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M14 38c2-4 6-7 12-7s10 3 12 7' stroke='rgba(255,255,255,0.1)' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.lp-brand-inner {
  position: relative;
  z-index: 1;
  max-width: 400px;
}


.lp-title {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(3.2rem, 5vw, 5.5rem);
  font-weight: 400;
  line-height: 1.0;
  letter-spacing: -0.025em;
  margin: 0 0 20px;
  color: white;
}

.lp-tagline {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.58);
  margin: 0;
  line-height: 1.75;
}

.lp-auth-pane {
  width: 480px;
  min-width: 360px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 52px;
  overflow-y: auto;
}

.lp-auth-card {
  width: 100%;
}

.lp-auth-title {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 2.1rem;
  font-weight: 400;
  margin: 0 0 6px;
  color: var(--ink);
}

.lp-auth-sub {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 34px;
}

.lp-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.lp-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.lp-field-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.lp-field-input {
  width: 100%;
  border: 1.5px solid rgba(15, 23, 42, 0.14);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.97rem;
  font-family: inherit;
  color: var(--ink);
  background: #f8f8f9;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  min-height: 46px;
  box-sizing: border-box;
}

.lp-field-input:focus {
  outline: none;
  border-color: rgba(54, 99, 176, 0.55);
  box-shadow: 0 0 0 3.5px rgba(54, 99, 176, 0.1), 0 0 12px rgba(54, 99, 176, 0.08);
  background: #fff;
}

.lp-pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.lp-pw-wrap .lp-field-input {
  padding-right: 44px;
}

.lp-pw-toggle {
  position: absolute;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  border-radius: 6px;
  padding: 0;
  transition: color 0.15s;
}

.lp-pw-toggle:hover {
  color: var(--ink);
}

.lp-pw-toggle svg {
  width: 18px;
  height: 18px;
}

.lp-error {
  font-size: 0.85rem;
  color: var(--warn);
  background: rgba(220, 38, 38, 0.06);
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: 8px;
  padding: 9px 12px;
  margin-top: -4px;
}

.lp-submit {
  width: 100%;
  padding: 13px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 12px;
  margin-top: 4px;
}

.lp-auth-pane .auth-current {
  width: 100%;
}

.demo-creds {
  margin-top: 28px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.demo-creds summary {
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  letter-spacing: 0.03em;
}

.demo-creds summary:hover {
  color: var(--text);
}

.demo-creds-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.8rem;
}

.demo-creds-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  padding: 4px 8px 4px 0;
  border-bottom: 1px solid var(--border);
}

.demo-creds-table td {
  padding: 5px 8px 5px 0;
  color: var(--text);
  font-family: monospace;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}

.demo-creds-table tr:last-child td {
  border-bottom: none;
}

/* ── Manage Users ──────────────────────────────────────────── */
#usersTable {
  min-width: 560px;
}

.user-row-inactive td {
  opacity: 0.45;
}

.user-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.user-name-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-username {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
}

.user-staffname {
  font-size: 0.78rem;
  color: var(--muted);
}

.user-role-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.user-role-group .role-pill {
  margin-left: 0;
}

.role-pill-admin {
  background: rgba(54, 99, 176, 0.12);
  border-color: rgba(54, 99, 176, 0.28);
  color: #155e75;
}

.su-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(54, 99, 176, 0.1);
  border: 1px solid rgba(54, 99, 176, 0.22);
  color: #155e75;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.user-dash {
  color: var(--muted);
}

.user-toggle-btn {
  font-size: 0.8rem;
  padding: 5px 14px;
  border-radius: 999px;
  font-weight: 600;
  min-width: 96px;
  text-align: center;
}

.user-su-btn {
  background: rgba(54, 99, 176, 0.06);
  border-color: rgba(54, 99, 176, 0.18);
  color: var(--brand);
}

.user-su-btn.is-granted {
  background: rgba(54, 99, 176, 0.13);
  border-color: rgba(54, 99, 176, 0.35);
  color: var(--brand-dark);
}

.user-su-btn:hover:not(:disabled) {
  background: rgba(54, 99, 176, 0.16);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(54, 99, 176, 0.2);
}

.user-active-btn {
  background: rgba(34, 150, 90, 0.08);
  border-color: rgba(34, 150, 90, 0.25);
  color: #197044;
}

.user-active-btn:hover:not(:disabled) {
  background: rgba(34, 150, 90, 0.14);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(34, 150, 90, 0.15);
}

.user-active-btn.is-active {
  background: rgba(100, 100, 112, 0.07);
  border-color: rgba(100, 100, 112, 0.2);
  color: #555;
}

.user-active-btn.is-active:hover:not(:disabled) {
  background: rgba(100, 100, 112, 0.12);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.user-admin-btn {
  background: rgba(37, 99, 180, 0.06);
  border-color: rgba(37, 99, 180, 0.2);
  color: #2563b4;
}

.user-admin-btn:hover:not(:disabled) {
  background: rgba(37, 99, 180, 0.12);
  border-color: rgba(37, 99, 180, 0.38);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37, 99, 180, 0.18);
}

.user-admin-btn.is-admin {
  background: rgba(37, 99, 180, 0.09);
  border-color: rgba(37, 99, 180, 0.3);
  color: #1a4f96;
}

.user-admin-btn.is-admin:hover:not(:disabled) {
  background: rgba(37, 99, 180, 0.16);
  box-shadow: 0 4px 10px rgba(37, 99, 180, 0.2);
}

.user-delete-btn {
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.2);
  color: var(--warn, #dc2626);
}

.user-delete-btn:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.13);
  border-color: rgba(220, 38, 38, 0.38);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.18);
}

.users-add-card {
  margin-top: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  background: linear-gradient(135deg, rgba(246, 250, 252, 0.7) 0%, rgba(255, 255, 255, 0.97) 100%);
  max-width: 640px;
}

.users-add-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.users-add-card-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
}

.users-add-close {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.users-add-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

@media (max-width: 700px) {
  .users-add-fields {
    grid-template-columns: 1fr;
  }
}

/* Email Contacts panel */
.email-contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.email-contact-group {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}

.email-contact-group-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 10px;
}

.ec-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.ec-row input {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.88rem;
  background: #fff;
  color: var(--ink);
  width: 100%;
}

.ec-row input:focus {
  outline: none;
  border-color: rgba(54, 99, 176, 0.5);
  box-shadow: 0 0 0 3px rgba(54, 99, 176, 0.1);
}

.ec-remove-btn {
  padding: 5px 9px;
  min-height: 0;
  font-size: 0.8rem;
  border-radius: 7px;
  flex-shrink: 0;
}

.ec-add-btn {
  margin-top: 4px;
}

@media (max-width: 600px) {
  .ec-row {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
  }
  .ec-row input:first-child { grid-column: 1; grid-row: 1; }
  .ec-row input:nth-child(2) { grid-column: 1; grid-row: 2; }
  .ec-remove-btn { grid-column: 2; grid-row: 1 / 3; align-self: center; }
}

.hero.compact h1 {
  font-size: clamp(1.45rem, 2.2vw, 2.1rem);
}

.hero h1 {
  margin: 8px 0 6px;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(1.65rem, 2.8vw, 2.55rem);
  font-weight: 400;
  background: linear-gradient(135deg, var(--ink) 20%, var(--brand) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.01em;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #3663b0;
  font-size: 0.85rem;
}

.subhead {
  margin: 0;
  color: var(--muted);
}

.panel {
  background: var(--paper-strong);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px;
  backdrop-filter: blur(10px) saturate(125%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.panel:hover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(77, 114, 156, 0.58);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.panel-header h2 {
  margin: 0;
  font-size: 1.06rem;
  letter-spacing: 0.01em;
  font-weight: 600;
  background: linear-gradient(135deg, var(--ink) 0%, var(--muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.admin-grid,
.period-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
}

.period-grid {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

input,
select,
textarea,
button {
  font-family: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(95, 128, 167, 0.46);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(244, 250, 255, 0.82));
  color: var(--ink);
  padding: 9px 10px;
  min-height: 42px;
  transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(77, 114, 156, 0.72);
  box-shadow: 0 0 0 3px rgba(123, 167, 219, 0.18);
  background: rgba(255, 255, 255, 0.98);
}

textarea {
  resize: vertical;
}

.btn {
  border: 1px solid rgba(95, 128, 167, 0.42);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(243, 249, 255, 0.86));
  color: var(--ink);
  padding: 9px 12px;
  min-height: 42px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(77, 114, 156, 0.62);
  box-shadow: 0 8px 16px rgba(19, 36, 56, 0.12);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(150deg, rgba(55, 122, 182, 0.9), rgba(38, 93, 147, 0.88));
  color: #fff;
  border-color: rgba(33, 78, 126, 0.5);
  box-shadow: 0 8px 14px rgba(28, 84, 141, 0.22);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 10px 20px rgba(28, 84, 141, 0.26);
}

.btn-danger {
  color: var(--warn);
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(220, 38, 38, 0.08);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.12);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
  min-height: 48px;
  font-weight: 600;
  border-radius: 12px;
}

.btn-ink {
  background: var(--ink);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(15, 23, 42, 0.2);
}

.btn-ink:hover:not(:disabled) {
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.35);
}

.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.shell-topbar {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 340px);
  gap: 12px;
  align-items: center;
  position: relative;
  z-index: 90;
}

.auth-stack {
  display: grid;
  gap: 8px;
}

.compact-auth {
  grid-template-columns: repeat(3, minmax(130px, 1fr));
}

.period-picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 340px;
  position: relative;
  overflow: visible;
  background: linear-gradient(135deg, rgba(54, 99, 176, 0.09) 0%, rgba(44, 83, 154, 0.06) 100%);
  border: 1.5px solid rgba(54, 99, 176, 0.35);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
}

.period-picker-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--brand-dark);
}

.period-picker select {
  font-weight: 500;
  font-size: 0.88rem;
  border-color: rgba(54, 99, 176, 0.25);
  background: rgba(255, 255, 255, 0.88);
  min-width: 0;
}

.period-picker select.period-picker-expanded {
  position: absolute;
  left: 14px;
  right: 14px;
  top: calc(100% - 12px);
  z-index: 120;
  overflow-y: auto;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  border-color: rgba(54, 99, 176, 0.35);
}

.period-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 2px 9px;
  width: fit-content;
  line-height: 1.6;
}

.period-status-badge.badge-draft {
  background: rgba(234, 179, 8, 0.14);
  color: #854d0e;
  border: 1px solid rgba(234, 179, 8, 0.45);
}

.period-status-badge.badge-finalized {
  background: rgba(22, 163, 74, 0.11);
  color: #166534;
  border: 1px solid rgba(22, 163, 74, 0.38);
}

.period-status-badge.badge-none {
  display: none;
}

.sheet-nav {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px;
  position: sticky;
  top: 8px;
  z-index: 20;
}

.sheet-tab {
  text-decoration: none;
  border: 1px solid rgba(95, 128, 167, 0.48);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(244, 250, 255, 0.84));
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: all 0.2s ease;
}

.sheet-tab:hover {
  border-color: rgba(77, 114, 156, 0.62);
  box-shadow: 0 4px 10px rgba(19, 36, 56, 0.08);
}

.sheet-tab.is-active {
  background: linear-gradient(150deg, rgba(55, 122, 182, 0.9), rgba(38, 93, 147, 0.88));
  color: #fff;
  border-color: rgba(33, 78, 126, 0.5);
  box-shadow: 0 8px 14px rgba(28, 84, 141, 0.22);
}

.card-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  margin-top: 10px;
}

.card {
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(247, 252, 255, 0.84));
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 6px 14px rgba(19, 36, 56, 0.07);
}

.card:hover {
  border-color: rgba(77, 114, 156, 0.52);
  box-shadow: 0 10px 20px rgba(19, 36, 56, 0.1);
  transform: translateY(-1px);
}

.card h3 {
  margin: 0 0 6px;
}

.card p {
  margin: 0 0 10px;
  color: var(--muted);
}

.roster-summary-card {
  margin-top: 12px;
}

.roster-summary-wrap table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
}

.roster-summary-wrap th:first-child,
.roster-summary-wrap td:first-child {
  width: 30ch;
  white-space: nowrap;
}

.roster-summary-wrap th:not(:first-child),
.roster-summary-wrap td:not(:first-child) {
  width: calc((100% - 30ch) / 3);
  text-align: center;
  vertical-align: middle;
}

.roster-row-weekend td {
  background: rgba(65, 65, 72, 0.08);
}

.roster-row-holiday td {
  background: rgba(147, 208, 129, 0.25);
}

.roster-row-missing td {
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.35);
}

.roster-missing-note {
  color: var(--warn);
  margin-bottom: 8px;
}

.date-cell {
  display: inline-grid;
  grid-template-columns: 3ch auto;
  gap: 0.55rem;
  align-items: baseline;
  min-width: 15ch;
  font-variant-numeric: tabular-nums;
}

.date-holiday-name {
  display: inline;
  font-size: 0.72rem;
  color: #6b7280;
  white-space: nowrap;
  margin-left: 0.4em;
}

.date-dow {
  font-weight: 700;
  color: #374151;
  text-align: left;
}

.date-main {
  color: var(--ink);
  white-space: nowrap;
}

.inline-grid {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 300px);
  gap: 10px;
  align-items: end;
}

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

.auth-actions {
  align-items: end;
}

.auth-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.auth-current p {
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  min-height: 42px;
}

#currentUser {
  margin-left: 6px;
}

.role-pill {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(54, 99, 176, 0.08);
  border: 1px solid rgba(54, 99, 176, 0.22);
  color: #2c539a;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 4px 0 14px;
  padding: 10px;
  border: 1px solid rgba(95, 128, 167, 0.45);
  border-radius: 14px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.44), rgba(245, 251, 255, 0.3));
  box-shadow: 0 8px 14px rgba(18, 39, 61, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.template-setup-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.template-gen-row-top {
  margin-bottom: 10px;
}

.template-gen-label-week {
  display: grid;
  gap: 6px;
  max-width: 260px;
  color: var(--muted);
  font-size: 0.88rem;
}

.template-gen-row-bottom {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.template-generation-group,
.selected-period-rate-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
  margin-bottom: 12px;
}

.template-generation-group {
  background: linear-gradient(135deg, rgba(239, 244, 252, 0.9) 0%, rgba(248, 251, 255, 0.96) 100%);
  border-color: rgba(74, 96, 140, 0.26);
  box-shadow: 0 3px 12px rgba(42, 64, 99, 0.08);
  transition: all 0.3s ease;
}

.template-generation-group:hover {
  box-shadow: 0 6px 18px rgba(42, 64, 99, 0.12), 0 0 12px rgba(74, 96, 140, 0.08);
  border-color: rgba(74, 96, 140, 0.38);
}

.template-generation-title {
  font-weight: 700;
  color: #334e7d;
}

.template-generate-action {
  align-self: end;
  display: flex;
  justify-content: flex-start;
}

.template-setup-outer {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 12px;
}

.template-setup-outer .template-generation-group {
  flex: 1 1 auto;
  margin-bottom: 0;
}

.template-setup-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.rate-inline {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.selected-period-settings-compact {
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(248, 244, 236, 0.9) 0%, rgba(255, 251, 245, 0.98) 100%);
  border: 1.5px solid rgba(163, 132, 92, 0.3);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(112, 86, 56, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  transition: box-shadow 0.3s ease;
}

.selected-period-settings-compact:hover {
  box-shadow: 0 6px 22px rgba(112, 86, 56, 0.14), 0 0 12px rgba(163, 132, 92, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.selected-period-settings-title {
  margin: 0 0 14px;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7b4f25;
  font-weight: 700;
  display: flex;
  align-items: center;
}

.selected-period-settings-inline {
  display: grid;
  grid-template-columns: repeat(3, minmax(155px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.selected-period-settings-inline label {
  gap: 6px;
  font-size: 0.78rem;
  color: #6c4d2c;
  font-weight: 500;
}

.selected-period-settings-inline input {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid rgba(163, 132, 92, 0.32);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.selected-period-settings-inline input:focus {
  outline: none;
  border-color: rgba(163, 132, 92, 0.6);
  box-shadow: 0 0 0 3px rgba(163, 132, 92, 0.14);
  background: rgba(255, 255, 255, 0.95);
}

.selected-period-settings-inline .btn {
  min-height: 40px;
  padding: 8px 20px;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.selected-period-settings-inline .btn.btn-lg {
  min-height: 48px;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 1rem;
}

.selected-period-settings-inline .btn:hover {
  transform: translateY(-1px);
}

.selected-period-settings-note {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: #6c4d2c;
  font-weight: 500;
}

.tables-section-group {
  display: grid;
  gap: 18px;
}

.tables-section {
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(246, 250, 252, 0.6) 0%, rgba(255, 255, 255, 0.95) 100%);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.3s ease;
}

.tables-section:hover {
  border-color: rgba(54, 99, 176, 0.15);
  box-shadow: 0 4px 16px rgba(54, 99, 176, 0.08);
}

.tables-section-title {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #155e75;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.tables-rates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

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

.tables-rate {
  display: grid;
  gap: 6px;
}

.label-text {
  font-weight: 500;
  color: #3663b0;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.tables-rate input,
.tables-section textarea {
  border: 1px solid rgba(54, 99, 176, 0.15);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.tables-rate input:focus,
.tables-section textarea:focus {
  outline: none;
  border-color: rgba(54, 99, 176, 0.4);
  box-shadow: 0 0 0 3px rgba(54, 99, 176, 0.08);
  background: rgba(255, 255, 255, 0.97);
}

.tables-section textarea {
  resize: vertical;
  min-height: 140px;
  font-family: "Space Grotesk", "Segoe UI", monospace;
  line-height: 1.5;
}

@media (max-width: 1080px) {
  .tables-specialties-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .tables-section {
    padding: 12px;
  }
  
  .tables-rates-grid {
    grid-template-columns: 1fr;
  }
  
  .tables-specialties-grid {
    grid-template-columns: 1fr;
  }
}

.generated-templates-table {
  min-width: 980px;
}

.generated-templates-header {
  padding-top: 8px;
}

.generated-templates-wrap {
  max-height: 460px;
  overflow-y: auto;
}

/* ── Contract Type Rules table ─────────────────────────── */
.tables-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.tables-section-header .tables-section-title {
  margin: 0;
}

.contract-rules-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.contract-rules-table th,
.contract-rules-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.contract-rules-table th {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #3663b0;
  background: rgba(54, 99, 176, 0.04);
}

.contract-rules-table code {
  background: rgba(54, 99, 176, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.83em;
}

.ctr-preop-label {
  align-items: center;
  gap: 8px;
}
/* ─────────────────────────────────────────────────────── */

.template-selected-row td {
  background: rgba(54, 99, 176, 0.12);
  font-weight: 600;
}

.tab {
  --tab-accent: #3663b0;
  border: 1px solid rgba(95, 128, 167, 0.5);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(245, 251, 255, 0.62));
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: all 0.2s ease;
}

.tab:hover {
  border-color: color-mix(in srgb, var(--tab-accent) 38%, rgba(15, 23, 42, 0.18));
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.tab.is-active {
  background: linear-gradient(
    140deg,
    color-mix(in srgb, var(--tab-accent) 92%, #ffffff 8%) 0%,
    color-mix(in srgb, var(--tab-accent) 72%, #0f172a 28%) 100%
  );
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 14px color-mix(in srgb, var(--tab-accent) 36%, transparent);
}

.tab-template {
  --tab-accent: #0f766e;
}

.tab-settings {
  --tab-accent: #1d4ed8;
}

.tab-staff {
  --tab-accent: #be123c;
}

.tab-users {
  --tab-accent: #7c3aed;
}

.tab-contacts {
  --tab-accent: #c2410c;
}

.tab-with-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tab-help-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(194, 65, 12, 0.3);
  background: rgba(194, 65, 12, 0.1);
  color: #9a3412;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  padding: 0;
}

.tab-help-btn:hover {
  border-color: rgba(194, 65, 12, 0.45);
  background: rgba(194, 65, 12, 0.16);
}

#panelTemplate,
#panelTables,
#panelStaff,
#panelUsers,
#panelContacts {
  border-radius: 14px;
  padding: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

#panelTemplate {
  background: linear-gradient(180deg, rgba(240, 253, 250, 0.9) 0%, rgba(255, 255, 255, 0.98) 22%);
}

#panelTables {
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.9) 0%, rgba(255, 255, 255, 0.98) 22%);
}

#panelStaff {
  background: linear-gradient(180deg, rgba(255, 241, 242, 0.9) 0%, rgba(255, 255, 255, 0.98) 22%);
}

#panelUsers {
  background: linear-gradient(180deg, rgba(245, 243, 255, 0.9) 0%, rgba(255, 255, 255, 0.98) 22%);
}

#panelContacts {
  background: linear-gradient(180deg, rgba(255, 247, 237, 0.9) 0%, rgba(255, 255, 255, 0.98) 22%);
}

@media (max-width: 760px) {
  .tabs {
    padding: 8px;
    gap: 8px;
  }

  .tab {
    padding: 8px 12px;
    font-size: 0.86rem;
  }
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(95, 128, 167, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

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

thead th {
  background: linear-gradient(180deg, rgba(224, 238, 255, 0.8), rgba(210, 229, 252, 0.62));
  border-bottom: 1px solid rgba(95, 128, 167, 0.48);
}

th,
td {
  border-bottom: 1px solid rgba(95, 128, 167, 0.2);
}

.claim-entry-panel {
  display: grid;
  gap: 12px;
  position: relative;
}

.claims-toolbar {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
}

.claims-toolbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.claims-week-tabs {
  margin: 0;
}

.claims-toolbar-bottom {
  display: grid;
  grid-template-columns: 1fr minmax(180px, 280px);
  gap: 10px;
  align-items: start;
}

.claims-title-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.claims-week-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}

.claims-filter {
  justify-self: end;
  max-width: 280px;
  width: 100%;
}

.claims-table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  max-height: 68vh;
}

.claims-day-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  padding: 8px;
}

.claims-day-nav-label {
  margin: 0;
  min-width: 260px;
  text-align: center;
  font-weight: 600;
  color: var(--ink);
}

.quick-add-claim {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 35;
  border-radius: 999px;
  padding: 12px 16px;
  box-shadow: 0 8px 28px rgba(54, 99, 176, 0.4), 0 0 20px rgba(54, 99, 176, 0.18);
  transition: all 0.3s ease;
}

.quick-add-claim:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 44px rgba(54, 99, 176, 0.55), 0 0 32px rgba(54, 99, 176, 0.25);
}

.claims-table {
  min-width: 900px;
}

.claims-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f0f9ff;
  white-space: normal;
  line-height: 1.3;
  vertical-align: bottom;
}

.claims-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.65);
}

.claims-table th:nth-child(1) {
  min-width: 86px;
}

.claims-table th:nth-child(2) {
  min-width: 170px;
}

.claims-table th:nth-child(3),
.claims-table th:nth-child(4) {
  min-width: 74px;
}

.claims-table th:nth-child(5) {
  min-width: 68px;
}

.claims-table th:nth-child(6),
.claims-table th:nth-child(7) {
  min-width: 66px;
}

.claims-table th:nth-child(8) {
  min-width: 75px;
}

.claims-table td:nth-child(6),
.claims-table td:nth-child(7) {
  white-space: nowrap;
}

.claims-table th:nth-child(9) {
  min-width: 93px;
}

.claims-table th:nth-child(10) {
  min-width: 62px;
}

.contract-claims-table th:nth-child(1) {
  min-width: 95px;
}

.contract-claims-table th:nth-child(2),
.contract-claims-table th:nth-child(3) {
  min-width: 105px;
}

.contract-claims-table th:nth-child(4),
.contract-claims-table th:nth-child(5) {
  min-width: 145px;
}

.contract-claims-table th:nth-child(6),
.contract-claims-table th:nth-child(7),
.contract-claims-table th:nth-child(8),
.contract-claims-table th:nth-child(9) {
  min-width: 90px;
}

.contract-claims-table th:nth-child(10) {
  min-width: 86px;
}

#contractClaimsTable-wrap {
  overflow-x: auto;
  overflow-y: visible;
}

.contract-claims-table {
  min-width: 780px;
  width: 100%;
  table-layout: auto;
}

.contract-claims-table td,
.contract-claims-table th {
  white-space: normal;
  word-break: break-word;
}

.contract-times-line {
  line-height: 1.35;
}

.claims-table td input,
.claims-table td select {
  min-width: 100%;
  padding: 8px 9px;
}

.btn-sm {
  padding: 5px 9px;
  font-size: 0.8rem;
  border-radius: 7px;
}

.action-cell {
  display: flex;
  gap: 5px;
  align-items: center;
  white-space: nowrap;
}

tr.is-editing td {
  background: #f0f9ff;
}

.claims-table td .btn {
  white-space: nowrap;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  display: grid;
  place-items: center;
  z-index: 320;
  padding: 20px;
}

.modal-card {
  width: min(780px, 96vw);
  border: 1px solid rgba(95, 128, 167, 0.42);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(246, 252, 255, 0.9));
  padding: 18px;
  box-shadow: 0 18px 40px rgba(19, 36, 56, 0.18);
  display: grid;
  gap: 14px;
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-card h3 {
  margin: 0;
}

.admin-manual-card {
  width: min(980px, 96vw);
  max-height: calc(100vh - 56px);
  align-self: start;
  overflow: auto;
}

.admin-manual-content {
  overflow: visible;
  display: grid;
  gap: 12px;
  padding-right: 0;
}

#adminManualModal {
  place-items: start center;
  padding-top: 28px;
  padding-bottom: 20px;
  overflow: auto;
}

.admin-manual-section {
  border: 1px solid rgba(54, 99, 176, 0.12);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(246, 250, 252, 0.7) 0%, rgba(255, 255, 255, 0.98) 100%);
  overflow: visible;
}

.admin-manual-section summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  color: #155e75;
  font-size: 0.95rem;
  font-weight: 700;
}

.admin-manual-section summary::-webkit-details-marker {
  display: none;
}

.admin-manual-section summary::after {
  content: "+";
  float: right;
  color: #3663b0;
  font-size: 1rem;
}

.admin-manual-section[open] summary::after {
  content: "-";
}

.admin-manual-section > :not(summary) {
  padding: 2px 14px 18px;
}

.admin-manual-quickstart {
  background: rgba(54, 99, 176, 0.05);
  border-top: 1px solid rgba(54, 99, 176, 0.08);
  margin-top: 0;
}

.admin-manual-section p {
  margin: 0;
}

.admin-manual-list {
  margin: 0;
  padding-left: 0;
  display: grid;
  gap: 6px;
  list-style-position: inside;
}

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

.modal-grid input,
.modal-grid select {
  width: 100%;
}

.dial-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.modal-time-layout {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.modal-time-block {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.modal-time-block-full {
  grid-column: 1 / -1;
}

.modal-time-title {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
  color: #3663b0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dial-pair-labeled {
  gap: 8px;
}

.dial-field {
  gap: 4px;
  font-size: 0.78rem;
  color: var(--muted);
}

.modal-actions {
  justify-content: flex-end;
}

.roster-warn {
  background: #fff8e1;
  border: 1px solid #f5a623;
  border-radius: 4px;
  color: #7a4f00;
  font-size: 0.84rem;
  padding: 8px 12px;
  margin-bottom: 8px;
}

.field-error {
  color: #dc2626;
  font-size: 0.72rem;
  display: block;
  margin-top: 2px;
  line-height: 1.2;
}

.field-invalid {
  border-color: #dc2626 !important;
  outline-color: #dc2626 !important;
}

th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px;
  font-size: 0.86rem;
  vertical-align: middle;
}

th {
  background: rgba(255, 255, 255, 0.78);
}

.calc {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.kpi-grid-compact {
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  margin-top: 8px;
  margin-bottom: 0;
}

.card .kpi p,
.card .kpi strong {
  overflow-wrap: anywhere;
}

.kpi {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(246, 250, 252, 0.6) 100%);
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.kpi:hover {
  border-color: rgba(54, 99, 176, 0.22);
  box-shadow: 0 8px 24px rgba(54, 99, 176, 0.14), 0 0 16px rgba(54, 99, 176, 0.08);
  transform: translateY(-2px);
}

.kpi p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.kpi strong {
  display: block;
  margin-top: 6px;
  font-size: 1.14rem;
}

.report-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  overflow: auto;
  min-height: 150px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  transition: all 0.3s ease;
}

.report-box:hover {
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
  border-color: rgba(54, 99, 176, 0.15);
}

.report-box table {
  min-width: 0;
}

/* Summary table — compact, professional 3-column layout */
.summary-table-wrap {
  padding: 0;
  min-height: 0;
  overflow: hidden;
}

.summary-table-wrap table {
  min-width: 0;
  width: 100%;
  border-radius: 0;
}

.summary-table-wrap th,
.summary-table-wrap td {
  padding: 9px 16px;
  font-size: 0.875rem;
}

.summary-table-wrap thead th {
  background: #f0f9ff;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 2px solid rgba(54, 99, 176, 0.15);
}

.summary-table-wrap th:not(:first-child),
.summary-table-wrap td:not(:first-child) {
  text-align: right;
}

.summary-table-wrap tbody tr:nth-child(even) td {
  background: rgba(240, 249, 255, 0.5);
}

.summary-table-wrap tbody tr:hover td {
  background: rgba(207, 250, 254, 0.45);
  transition: background 0.15s ease;
}

.summary-table-wrap tbody tr:last-child td {
  border-bottom: none;
}

.summary-allowance-badge {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(54, 99, 176, 0.22);
  background: rgba(207, 250, 254, 0.7);
  color: #164e63;
  font-size: 0.84rem;
}

.detail-table tbody tr.detail-row-availability td {
  background: #ecfeff;
}

.hidden {
  display: none;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.modal-grid-full {
  grid-column: 1 / -1 !important;
}

.contract-travel-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0;
  padding: 4px 0;
  background: rgba(54, 99, 176, 0.05);
  border-radius: 6px;
  border: 1px solid rgba(54, 99, 176, 0.1);
}

.contract-travel-checkbox input[type="checkbox"] {
  width: 13px;
  min-width: 13px;
  height: 13px;
  cursor: pointer;
  accent-color: var(--brand);
}

.contract-travel-checkbox span {
  font-weight: 500;
  color: #3663b0;
  user-select: none;
}

.contract-cardiac-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid rgba(54, 99, 176, 0.14);
  background: rgba(54, 99, 176, 0.06);
}

.contract-inline-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 27px;
}

#addContractPreOpGroup:not(.hidden) {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: -4px;
}

#addContractPreOpGroup.hidden {
  display: none;
}

#addContractPreOpGroup .contract-inline-checkbox {
  margin-top: 0;
  white-space: nowrap;
}

#addContractPreOpGroup .contract-preop-time {
  display: grid;
  gap: 4px;
  min-width: 200px;
  max-width: 240px;
  margin: 0;
}

#addContractModal .modal-card {
  width: min(720px, 96vw);
  gap: 10px;
}

#addContractModal .contract-claim-grid {
  gap: 8px;
}

#addContractModal #addContractCardiacExtras .contract-cardiac-grid {
  grid-template-columns: minmax(180px, 240px);
}

#contractTypeRuleModal .modal-card {
  width: min(640px, 96vw);
  gap: 10px;
}

#contractTypeRuleModal .contract-type-grid {
  gap: 8px;
  align-items: end;
}

#contractTypeRuleModal .contract-type-grid .contract-inline-checkbox {
  margin-top: 0;
  min-height: 40px;
}

#contractTypeRuleModal #ctrCaseFields,
#contractTypeRuleModal #ctrSessionFields {
  min-width: 0;
}

.contract-inline-checkbox input[type="checkbox"] {
  width: 13px;
  min-width: 13px;
  height: 13px;
  accent-color: var(--brand);
}

.contract-note {
  font-size: 0.72rem;
  color: var(--muted);
}

#addContractCaseTimes {
  display: grid;
  gap: 8px;
}

.contract-case-time-row {
  border: 1px solid rgba(54, 99, 176, 0.15);
  border-radius: 10px;
  background: rgba(54, 99, 176, 0.04);
  padding: 8px;
}

.contract-case-label {
  margin: 0 0 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #3663b0;
}

@media (max-width: 1080px) {
  .lp-auth-pane {
    width: 420px;
  }

  .shell-topbar,
  .inline-grid,
  .auth-grid,
  .admin-grid,
  .period-grid,
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .template-setup-grid,
  .claims-toolbar-bottom {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .template-gen-row-bottom {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .template-gen-label-week {
    max-width: 100%;
  }

  .template-setup-outer {
    flex-direction: column;
    align-items: stretch;
  }

  .template-setup-outer .template-generation-group {
    max-width: 100%;
  }

  .template-setup-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .selected-period-settings-inline {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

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

  .modal-time-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .lp-body {
    flex-direction: column;
  }

  .lp-brand {
    flex: none;
    padding: 48px 28px;
  }

  .lp-auth-pane {
    width: 100%;
    min-width: 0;
    padding: 44px 28px;
  }

  .lp-title {
    font-size: 2.8rem;
  }

  .bg-shape {
    display: none;
  }

  .shell {
    width: min(1280px, 96vw);
    margin-top: 14px;
    gap: 10px;
  }

  .hero h1,
  .hero.compact h1 {
    font-size: clamp(1.35rem, 6vw, 1.75rem);
    line-height: 1.2;
  }

  .subhead {
    font-size: 0.9rem;
  }

  .shell-topbar,
  .inline-grid,
  .auth-grid,
  .admin-grid,
  .period-grid,
  .kpi-grid,
  .template-setup-grid,
  .template-gen-row-bottom,
  .tables-layout,
  .claims-toolbar-bottom {
    grid-template-columns: 1fr;
  }

  .template-gen-label-week {
    max-width: 100%;
  }

  .template-setup-outer {
    flex-direction: column;
    align-items: stretch;
  }

  .template-setup-outer .template-generation-group {
    max-width: 100%;
  }

  .template-setup-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .claims-table-wrap {
    max-height: 72vh;
  }

  .period-picker {
    max-width: 100%;
    padding: 8px 12px;
  }

  .sheet-tab {
    padding: 7px 11px;
    font-size: 0.78rem;
  }

  .sheet-nav {
    padding: 8px;
  }

  .auth-current {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .auth-current p {
    word-break: break-word;
    font-size: 0.85rem;
  }

  .kpi-grid,
  .kpi-grid-compact {
    grid-template-columns: repeat(2, 1fr);
  }

  .selected-period-settings-inline {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .selected-period-settings-inline .btn {
    width: 100%;
  }

  .claims-toolbar-top,
  .claims-day-nav {
    flex-wrap: wrap;
  }

  .claims-day-nav-label {
    min-width: 0;
    width: 100%;
    order: 1;
  }

  .claims-day-nav #btnPrevDay,
  .claims-day-nav #btnNextDay {
    order: 2;
  }

  .claims-table {
    min-width: 0;
  }

  .table-wrap,
  .report-box {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 100%;
    width: 100%;
  }

  .table-wrap > table,
  .report-box > table {
    width: max(100%, max-content);
    min-width: max-content;
  }

  .roster-summary-wrap > table {
    width: 100%;
    min-width: 0;
  }

  .report-box table {
    min-width: max-content;
  }

  th,
  td {
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 0.8rem;
    padding: 6px;
  }

  .claims-table th,
  .claims-table td,
  .contract-claims-table th,
  .contract-claims-table td,
  .generated-templates-table th,
  .generated-templates-table td,
  #usersTable th,
  #usersTable td,
  .contract-rules-table th,
  .contract-rules-table td {
    white-space: nowrap;
  }

  .claims-table th,
  .claims-table td {
    min-width: 110px !important;
  }

  .claims-table td input,
  .claims-table td select {
    min-width: 92px;
    width: 100%;
    font-size: 0.8rem;
    padding: 7px;
  }

  .modal-card {
    width: min(760px, calc(100vw - 14px));
    max-height: calc(100dvh - 18px);
    overflow: auto;
    padding: 12px;
    border-radius: 12px;
  }

  .modal-overlay {
    place-items: start center;
    overflow-y: auto;
    padding: calc(8px + env(safe-area-inset-top)) 7px calc(8px + env(safe-area-inset-bottom));
  }

  .sheet-nav {
    top: 0;
    border-radius: 12px;
  }

  .quick-add-claim {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    padding: 11px 14px;
  }

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

  .panel {
    padding: 12px;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  #panelTemplate,
  #panelTables,
  #panelStaff,
  #panelUsers,
  #panelContacts {
    padding: 10px;
    overflow: visible;
  }

  #adminTabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding: 8px;
  }

  #adminTabs .tab,
  #adminTabs .tab-with-help {
    flex: 0 0 auto;
  }

  #adminTabs .tab-with-help {
    display: inline-flex;
    align-items: center;
  }

  .generated-templates-wrap {
    max-height: none;
  }

  .email-contacts-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .email-contact-group {
    padding: 12px;
  }

  .tables-section {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .contract-rules-table {
    min-width: 700px;
  }

  .tables-section > .contract-rules-table {
    width: max(100%, max-content);
  }
}

/* ── Generate Email Bar & Modal ──────────────────────────────────────────── */

.generate-email-bar {
  display: flex;
  justify-content: flex-end;
  padding: 12px 0 4px;
}

.generate-email-card {
  width: min(800px, 96vw);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.modal-card-header h3 {
  margin: 0;
}

.modal-close-x {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.modal-close-x:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--ink);
}

.gen-email-setup {
  display: grid;
  grid-template-columns: minmax(180px, 220px) 1fr;
  gap: 12px;
  align-items: start;
}

.gen-email-field-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.gen-email-select {
  width: 100%;
}

.gen-email-recipients {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
  margin: 0;
  height: 100%;
  box-sizing: border-box;
}

.gen-email-recipients legend {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 6px;
}

.gen-email-recipient-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}

.gen-email-recipient-row {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.86rem;
}

.gen-email-recipient-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.gen-email-recipient-row input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.gen-email-recipient-note {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 400;
}

.gen-email-loading {
  font-size: 0.86rem;
  color: var(--muted);
}

.gen-email-preview {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  background: rgba(255,255,255,0.6);
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 12px 14px;
}

.gen-email-preview-row {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 8px;
  align-items: start;
}

.gen-email-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  padding-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.gen-email-to-text {
  font-size: 0.9rem;
  color: var(--ink);
  padding-top: 5px;
  word-break: break-all;
}

.gen-email-copy-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.gen-email-subject-input {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
}

.gen-email-body-area {
  flex: 1;
  min-width: 0;
  height: 200px;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.78rem;
  resize: vertical;
  white-space: pre;
  overflow-x: auto;
}

.gen-email-body-row {
  align-items: start;
}

.gen-email-send-actions {
  padding-top: 4px;
  border-top: 1px solid var(--line);
  margin-top: 2px;
}

.gen-email-paste-hint {
  margin: 6px 2px 0;
  font-size: 0.78rem;
  color: var(--text-muted, #6b7280);
  font-style: italic;
}

.gen-email-body-html {
  flex: 1;
  min-width: 0;
  min-height: 140px;
  max-height: 200px;
  overflow-y: auto;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.6;
  background: var(--surface, #f8f9fc);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  box-sizing: border-box;
  color: var(--ink);
  white-space: normal;
  word-break: break-word;
}

.gen-email-attachment-note {
  margin: 12px 0 0;
  padding: 8px 12px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 6px;
  font-size: 0.83rem;
  color: var(--text-secondary, #374151);
}

/* Payroll email modal: no specialty column, stack full-width */
#payrollEmailModal .generate-email-card,
#cdrEmailModal .generate-email-card {
  width: min(860px, 96vw);
}

#payrollEmailModal .gen-email-setup,
#cdrEmailModal .gen-email-setup {
  grid-template-columns: 1fr;
}

#payrollEmailModal .gen-email-recipients,
#cdrEmailModal .gen-email-recipients {
  height: auto;
}

#payrollEmailModal .gen-email-recipient-list,
#cdrEmailModal .gen-email-recipient-list {
  gap: 6px;
}

#payrollEmailModal .gen-email-recipient-row,
#cdrEmailModal .gen-email-recipient-row {
  font-size: 0.88rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}

#payrollEmailModal .gen-email-recipient-note,
#cdrEmailModal .gen-email-recipient-note {
  font-size: 0.82rem;
  white-space: normal;
  overflow-wrap: break-word;
}

@media (max-width: 640px) {
  .gen-email-setup {
    grid-template-columns: 1fr;
  }

  .gen-email-preview-row {
    grid-template-columns: 1fr;
  }

  .gen-email-copy-row {
    flex-direction: column;
  }
}

/* ── Clinical Director Report ─────────────────────────────────────────────── */

/* ── CDR collapsible toggle bar ─────────────────────────────────────────── */

.cdr-panel {
  padding: 0;
  overflow: hidden;
}

.cdr-toggle-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-radius: 12px;
}

.cdr-toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  padding: 0;
  color: #fff;
  min-width: 0;
}

.cdr-toggle-btn:focus-visible {
  outline: 2px solid rgba(255,255,255,0.7);
  outline-offset: 3px;
  border-radius: 4px;
}

.cdr-toggle-chevron {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.85);
  transition: transform 0.22s ease;
  flex-shrink: 0;
}

.cdr-toggle-btn[aria-expanded="true"] .cdr-toggle-chevron {
  transform: rotate(90deg);
}

.cdr-toggle-labels {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cdr-toggle-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  display: block;
}

.cdr-toggle-sub {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.72);
}

.cdr-pdf-btn {
  flex-shrink: 0;
  background: rgba(255,255,255,0.18) !important;
  border: 1px solid rgba(255,255,255,0.4) !important;
  color: #fff !important;
}

.cdr-pdf-btn:hover {
  background: rgba(255,255,255,0.28) !important;
}

#cdrBody {
  padding: 20px;
}

.panel-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 2px;
  color: var(--ink);
}

.panel-sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}

.cdr-placeholder,
.cdr-loading,
.cdr-no-activity {
  color: var(--muted);
  font-size: 0.88rem;
  padding: 16px 0;
  margin: 0;
}

.cdr-period-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 14px;
  background: var(--brand-light);
  border: 1px solid rgba(54, 99, 176, 0.15);
  border-radius: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.cdr-period-label {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink);
}

.cdr-period-rate {
  font-size: 0.8rem;
  color: var(--muted);
}

.cdr-week {
  margin-bottom: 36px;
}

.cdr-week-heading {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--brand-dark);
  border-left: 5px solid var(--brand);
  background: rgba(54, 99, 176, 0.09);
  padding: 10px 16px;
  border-radius: 0 6px 6px 0;
  margin: 0 0 16px;
}

.cdr-week-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  background: #f6f9ff;
  border: 1px solid rgba(54, 99, 176, 0.14);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 18px;
}

.cdr-total-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
  padding-left: 10px;
}

.cdr-total-item:not(:first-child)::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: rgba(54, 99, 176, 0.18);
}

.cdr-total-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.cdr-total-value {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--ink);
}

.cdr-total-value.cdr-fee {
  color: var(--brand);
}

.cdr-day {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}

.cdr-day-heading {
  font-size: 0.85rem;
  font-weight: 600;
  background: transparent;
  border-bottom: 1px solid rgba(54, 99, 176, 0.2);
  padding: 6px 4px;
  margin: 0;
  color: #4b5563;
  letter-spacing: 0;
  text-transform: none;
}

.cdr-role-group {
  display: grid;
  grid-template-columns: 134px 1fr;
  border-bottom: 1px solid var(--border);
}

.cdr-role-group:last-child {
  border-bottom: none;
}

.cdr-role-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--brand);
  padding: 10px 12px;
  background: rgba(54, 99, 176, 0.04);
  border-right: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  white-space: nowrap;
}

/* Role colour coding */
.cdr-role--first  .cdr-role-badge { color: #1e40af; background: rgba(30,  64, 175, 0.06); border-right-color: rgba(30,  64, 175, 0.2); }
.cdr-role--second .cdr-role-badge { color: #0f766e; background: rgba(15, 118, 110, 0.06); border-right-color: rgba(15, 118, 110, 0.2); }
.cdr-role--third  .cdr-role-badge { color: #6d28d9; background: rgba(109, 40, 217, 0.06); border-right-color: rgba(109, 40, 217, 0.2); }
.cdr-role--not    .cdr-role-badge { color: #64748b; background: rgba(100, 116, 139, 0.06); border-right-color: rgba(100, 116, 139, 0.2); }

.cdr-role-entries {
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cdr-staff-entry {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cdr-staff-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
}

.cdr-sessions {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cdr-session-row {
  display: grid;
  grid-template-columns: 150px 130px 70px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 0.83rem;
  color: #374151;
  padding: 3px 4px;
  border-radius: 4px;
}

.cdr-sessions .cdr-session-row:nth-child(even) {
  background: rgba(54, 99, 176, 0.04);
}

.cdr-session-addl {
  font-size: 0.74rem;
  color: #0f766e;
  font-weight: 500;
  white-space: nowrap;
}

.cdr-session-specialty {
  color: var(--ink);
}

.cdr-session-times {
  color: #4b5563;
  font-variant-numeric: tabular-nums;
}

.cdr-session-hours {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
}

.cdr-type-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 99px;
  white-space: nowrap;
}

.cdr-type-overrun {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.cdr-type-acute {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.cdr-session-total {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--brand);
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed var(--border);
  text-align: right;
  max-width: 300px;
}

/* ── Print / PDF export ──────────────────────────────────────────────────── */

@media print {
  body > * { visibility: hidden; }

  .shell { visibility: visible; position: static; }
  .shell > *:not(#clinicalDirectorSection) { display: none; }

  #clinicalDirectorSection {
    visibility: visible;
    display: block;
    box-shadow: none;
    border: none;
    padding: 0;
    margin: 0;
  }

  .cdr-toggle-bar { display: none !important; }
  #cdrBody        { display: block !important; visibility: visible !important; padding: 0; }
  #btnExportPDF   { display: none !important; }

  .cdr-week { break-inside: avoid; }
  .cdr-day  { break-inside: avoid; }

  .cdr-week-totals { background: #fff; border: 1px solid #ccc; }
  .cdr-week-heading { background: #f0f4fb !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cdr-day-heading  { background: transparent !important; color: #374151 !important; border-bottom: 1px solid #d1d5db !important; }
  .cdr-role-badge   { background: #fff; }
}

@media (max-width: 760px) {
  .cdr-week-totals {
    grid-template-columns: repeat(2, 1fr);
  }

  .cdr-session-row {
    grid-template-columns: 1fr 1fr 70px auto;
  }

  .cdr-role-group {
    grid-template-columns: 1fr;
  }

  .cdr-role-badge {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

/* ── CDR Contract Claims section ────────────────────────────────────────── */

.cdr-contract-section {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 2px solid var(--brand);
}

.cdr-ct-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.cdr-ct {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  color: var(--text);
  min-width: 760px;
}

.cdr-ct thead tr {
  background: var(--brand);
  color: #fff;
}

.cdr-ct th {
  padding: 8px 10px;
  font-weight: 600;
  white-space: nowrap;
  text-align: left;
}

.cdr-ct th.num,
.cdr-ct td.num {
  text-align: right;
}

.cdr-ct tbody tr:nth-child(even) {
  background: var(--brand-light);
}

.cdr-ct tbody tr:not(.cdr-ct-grand-row):hover {
  background: rgba(54, 99, 176, 0.12);
}

.cdr-ct td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.cdr-ct-name {
  font-weight: 600;
  white-space: nowrap;
}

.cdr-ct-spec {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.cdr-ct-date {
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.78rem;
}

.cdr-ct-times {
  font-size: 0.78rem;
}

.cdr-ct-total-col {
  font-weight: 700;
  color: var(--brand-dark);
}

.cdr-ct-payable-col {
  font-weight: 700;
  white-space: nowrap;
}

.cdr-ct-grand-row {
  background: #eef2f7 !important;
  color: #1f2937;
  border-top: 2px solid #cbd5e1;
}

.cdr-ct-grand-row td {
  border-bottom: none;
  padding: 9px 10px;
  font-weight: 700;
  font-size: 0.88rem;
}

.cdr-ct-grand-row .cdr-ct-total-col,
.cdr-ct-grand-row .cdr-fee {
  color: #0f172a;
}

@media print {
  .cdr-ct-grand-row { background: #eef2f7 !important; color: #1f2937 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cdr-ct thead tr  { background: #3663b0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cdr-ct tbody tr:nth-child(even) { background: #f0f4fb !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ─── Payroll Report table ─────────────────────────────────────────────────── */
.pr-table-wrap {
  overflow-x: auto;
  margin-bottom: 24px;
}

.pr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  color: var(--text);
  min-width: 700px;
}

.pr-table thead tr {
  background: var(--brand);
  color: #fff;
}

.pr-table th {
  padding: 8px 10px;
  font-weight: 600;
  white-space: nowrap;
  text-align: left;
}

.pr-table th.num,
.pr-table td.num {
  text-align: right;
}

.pr-table tbody tr:nth-child(even) {
  background: var(--brand-light);
}

.pr-table tbody tr:not(.pr-total-row):hover {
  background: rgba(54, 99, 176, 0.12);
}

.pr-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.pr-date {
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.78rem;
}

.pr-name {
  font-weight: 600;
  white-space: nowrap;
}

.pr-amount {
  font-weight: 700;
  color: var(--brand-dark);
  white-space: nowrap;
}

.pr-total-row {
  background: #eef2f7 !important;
  color: #1f2937;
  border-top: 2px solid #cbd5e1;
}

.pr-total-row td {
  border-bottom: none;
  padding: 9px 10px;
  font-weight: 700;
  font-size: 0.88rem;
}

.pr-total-row .pr-amount {
  color: #0f172a;
}

@media print {
  .pr-total-row { background: #eef2f7 !important; color: #1f2937 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pr-table thead tr { background: #3663b0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pr-table tbody tr:nth-child(even) { background: #f0f4fb !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ── Payroll print mode ──────────────────────────────────────────────────── */
@media print {
  body.payroll-print .shell > *:not(#payrollSection) { display: none !important; }
  body.payroll-print #clinicalDirectorSection         { display: none !important; }

  body.payroll-print #payrollSection {
    visibility: visible !important;
    display: block !important;
    box-shadow: none;
    border: none;
    padding: 0;
    margin: 0;
  }

  body.payroll-print .cdr-toggle-bar  { display: none !important; }
  body.payroll-print #payrollBody     { display: block !important; visibility: visible !important; padding: 0; }
  body.payroll-print .pr-table-wrap   { overflow: visible !important; }
  body.payroll-print #btnPayrollPDF   { display: none !important; }
  body.payroll-print #btnPayrollXLSX  { display: none !important; }

  /* Force the shell and all containers to fill the full page width */
  body.payroll-print,
  body.payroll-print .shell,
  body.payroll-print .panel,
  body.payroll-print .cdr-panel,
  body.payroll-print #payrollSection,
  body.payroll-print #payrollBody,
  body.payroll-print #payrollReport,
  body.payroll-print .cdr-report-inner {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }

  body.payroll-print .cdr-period-header { display: flex; }
  body.payroll-print .cdr-week-heading  { break-before: auto; }
  body.payroll-print .pr-table          { break-inside: auto; min-width: 0 !important; width: 100% !important; table-layout: fixed !important; }
  body.payroll-print .pr-table tr       { break-inside: avoid; }
  body.payroll-print .pr-table-wrap     { min-width: 0 !important; overflow: visible !important; width: 100% !important; }
}

