:root {
  --target-red: #cc0000;
  --target-red-dark: #9f0000;
  --target-red-soft: #fff0f0;
  --ink: #1e1e24;
  --muted: #6b6f76;
  --line: #e8e8ec;
  --paper: #ffffff;
  --bg: #f7f7f9;
  --success: #147a3e;
  --success-soft: #eaf7ef;
  --warning: #b35b00;
  --warning-soft: #fff4e6;
  --danger: #a11515;
  --danger-soft: #fff0f0;
  --shadow: 0 12px 30px rgba(30, 30, 36, 0.08);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(204, 0, 0, 0.12), transparent 34rem),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 40%, #f2f2f5 100%);
  min-height: 100vh;
}

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

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(204, 0, 0, 0.25);
  outline-offset: 2px;
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 12px;
  margin: -18px -18px 14px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(232, 232, 236, 0.8);
}

.brand-mark {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--target-red), var(--target-red-dark));
  font-weight: 900;
  letter-spacing: -0.04em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.topbar h1,
.hero-card h2,
.section-head h2,
.card h3 {
  margin: 0;
  line-height: 1.05;
}

.topbar h1 {
  font-size: clamp(1.45rem, 4vw, 2.1rem);
  letter-spacing: -0.04em;
}

.eyebrow,
.hero-label {
  margin: 0 0 4px;
  color: var(--target-red);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ghost-btn,
.secondary-btn,
.primary-btn,
.success-btn,
.warning-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 800;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.ghost-btn:hover,
.secondary-btn:hover,
.primary-btn:hover,
.success-btn:hover,
.warning-btn:hover,
.danger-btn:hover {
  transform: translateY(-1px);
}

.ghost-btn {
  margin-left: auto;
  color: var(--target-red);
  background: var(--target-red-soft);
}

.primary-btn {
  color: #fff;
  background: var(--target-red);
  box-shadow: 0 10px 24px rgba(204, 0, 0, 0.25);
}

.primary-btn:hover {
  background: var(--target-red-dark);
}

.secondary-btn {
  color: var(--target-red);
  background: #fff;
  border: 1px solid rgba(204, 0, 0, 0.22);
}

.success-btn {
  color: #fff;
  background: var(--success);
}

.warning-btn {
  color: #fff;
  background: var(--warning);
}

.danger-btn {
  color: #fff;
  background: var(--danger);
}

.full {
  width: 100%;
}

.hero-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: clamp(20px, 4vw, 34px);
  color: #fff;
  background:
    linear-gradient(135deg, rgba(204, 0, 0, 0.98), rgba(131, 0, 0, 0.98)),
    var(--target-red);
  border-radius: calc(var(--radius) + 8px);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.hero-card::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 230px;
  height: 230px;
  border-radius: 999px;
  border: 34px solid rgba(255, 255, 255, 0.18);
}

.hero-card h2 {
  font-size: clamp(1.65rem, 5vw, 3rem);
  letter-spacing: -0.06em;
}

.hero-card p {
  margin: 10px 0 0;
  max-width: 680px;
  color: rgba(255, 255, 255, 0.9);
}

.hero-card .primary-btn {
  position: relative;
  z-index: 2;
  color: var(--target-red);
  background: #fff;
  box-shadow: none;
}

.hero-label {
  color: #fff;
  opacity: 0.92;
}

.tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 14px 2px 18px;
  scrollbar-width: thin;
}

.tab-btn {
  white-space: nowrap;
  padding: 11px 15px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 850;
}

.tab-btn.active {
  color: #fff;
  background: var(--target-red);
  border-color: var(--target-red);
  box-shadow: 0 10px 24px rgba(204, 0, 0, 0.16);
}

.tab-panel {
  display: none;
  animation: fadeIn 0.18s ease-out;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 10px 0 14px;
}

.section-head h2 {
  font-size: clamp(1.45rem, 4vw, 2.1rem);
  letter-spacing: -0.045em;
}

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

.stat-card,
.card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(232, 232, 236, 0.94);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 18px;
}

.stat-card .value {
  display: block;
  margin-top: 8px;
  font-size: 2.3rem;
  line-height: 1;
  font-weight: 950;
  letter-spacing: -0.06em;
}

.stat-card .label {
  color: var(--muted);
  font-weight: 800;
  font-size: 0.86rem;
}

.card {
  padding: 18px;
  margin-bottom: 14px;
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card h3 {
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 9px;
  color: var(--target-red);
  background: var(--target-red-soft);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 850;
  white-space: nowrap;
}

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

label,
legend {
  display: block;
  margin: 0 0 7px;
  font-size: 0.82rem;
  color: var(--ink);
  font-weight: 850;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
}

textarea {
  resize: vertical;
  min-height: 96px;
}

.search-card {
  display: grid;
  gap: 11px;
}

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

.form-grid.compact {
  margin-bottom: 14px;
}

.wide {
  grid-column: 1 / -1;
}

.fieldset-card {
  border: 1px dashed rgba(204, 0, 0, 0.28);
  border-radius: 18px;
  padding: 14px;
  background: var(--target-red-soft);
}

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

.checkbox-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-weight: 750;
  font-size: 0.88rem;
}

.checkbox-chip input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  accent-color: var(--target-red);
}

.step-list {
  margin: 0;
  padding-left: 22px;
}

.step-list li {
  margin: 0 0 10px;
  padding-left: 3px;
  font-weight: 730;
}

.stack-list,
.activity-list,
.queue-list,
.notes-list {
  display: grid;
  gap: 10px;
}

.list-item,
.activity-item,
.queue-item,
.note-item {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
}

.list-item strong,
.activity-item strong,
.queue-item strong,
.note-item strong {
  display: block;
  margin-bottom: 4px;
}

.meta-line {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge.found,
.badge.resolved {
  color: var(--success);
  background: var(--success-soft);
}

.badge.not_found,
.badge.open {
  color: var(--danger);
  background: var(--danger-soft);
}

.badge.assist_needed,
.badge.working,
.badge.audit {
  color: var(--warning);
  background: var(--warning-soft);
}

.action-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.action-row.wrap {
  flex-wrap: wrap;
}

.queue-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.queue-actions button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.8rem;
}

.muted {
  color: var(--muted);
  line-height: 1.5;
}

.empty-state:empty::before {
  content: "No data yet. Start by logging a rescue or adding a team note.";
  display: block;
  color: var(--muted);
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: #fff;
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

.footer-note {
  padding: 22px 4px 8px;
  color: var(--muted);
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
}

.footer-note span {
  color: var(--target-red);
  font-weight: 950;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 100;
  max-width: min(92vw, 520px);
  padding: 12px 16px;
  color: #fff;
  background: var(--ink);
  border-radius: 999px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
  transform: translate(-50%, 90px);
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
  font-weight: 750;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.modal {
  width: min(92vw, 460px);
  border: 0;
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.22);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.modal h3 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.modal p {
  color: var(--muted);
  line-height: 1.55;
}

#auditSummary {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  min-height: 220px;
}

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

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

@media (max-width: 620px) {
  .app-shell {
    padding: 12px;
  }

  .topbar {
    margin: -12px -12px 12px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    font-size: 0.92rem;
  }

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

  .hero-card .primary-btn {
    width: 100%;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-head .secondary-btn {
    width: 100%;
  }

  .stat-grid,
  .checklist-grid {
    grid-template-columns: 1fr;
  }

  .action-row {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar .ghost-btn {
    padding-inline: 12px;
  }
}
.top-actions{display:flex;align-items:center;gap:10px;margin-left:auto;flex-wrap:wrap;justify-content:flex-end}.inline-login{display:grid;grid-template-columns:1fr 1fr auto;gap:10px;width:min(620px,100%)}.inline-login input{min-width:0}.toast{position:fixed;left:50%;bottom:22px;transform:translateX(-50%);background:#111827;color:#fff;padding:12px 16px;border-radius:999px;box-shadow:0 12px 30px rgba(0,0,0,.24);z-index:9999;font-weight:800}.stack-list:empty::before,.activity-list:empty::before{content:'No entries yet.';display:block;color:#64748b;padding:10px 0}.full-span{grid-column:1/-1}.mini-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}.link-btn{border:0;background:transparent;color:#cc0000;font-weight:800;cursor:pointer;padding:0}.status-dot{display:inline-block;width:8px;height:8px;border-radius:999px;background:#cc0000;margin-right:6px}.muted{color:#64748b}.danger-text{color:#b91c1c;font-weight:800}.success-text{color:#166534;font-weight:800}@media(max-width:720px){.inline-login{grid-template-columns:1fr}.top-actions{width:100%;justify-content:flex-start}.tab-btn{font-size:13px}}
.stat-card span{display:block;color:var(--muted);font-weight:800;font-size:.86rem}.stat-card strong{display:block;margin-top:8px;font-size:2.3rem;line-height:1;font-weight:950;letter-spacing:-.06em}.small{padding:8px 10px!important;border-radius:12px!important;font-size:.82rem!important}.stack-item{padding:13px;border:1px solid var(--line);border-radius:17px;background:#fff}.stack-item strong{display:block;margin-bottom:4px}.tab-panel{display:none}.tab-panel.active{display:block}

/* v3 Scan Assist */
.status-line {
  margin: 10px 0 14px;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--muted);
  background: #f4f4f6;
  border: 1px solid var(--line);
  font-size: 0.92rem;
  font-weight: 650;
}
.scan-preview-wrap {
  margin: 10px 0 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  max-height: 320px;
}
.scan-preview-wrap img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
}
.compact-form {
  grid-template-columns: 1fr;
  gap: 12px;
}
.scan-actions {
  margin-top: 14px;
}
input[type="file"] {
  width: 100%;
  padding: 12px;
  border: 1px dashed rgba(204, 0, 0, 0.35);
  border-radius: 16px;
  background: var(--target-red-soft);
}
.small {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 0.86rem;
}
@media (max-width: 720px) {
  .scan-actions .secondary-btn,
  .scan-actions .warning-btn,
  .scan-actions .success-btn {
    width: 100%;
  }
}

/* v4 Schedule Planner */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}
.schedule-table th,
.schedule-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.schedule-table th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #fafafa;
}
.time-edit,
.notes-edit {
  width: 100%;
  min-width: 92px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.notes-edit {
  min-width: 170px;
}
.warning-line {
  padding: 11px 12px;
  border-radius: 14px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  font-weight: 750;
}
.coverage-grid {
  display: grid;
  grid-template-columns: 0.9fr 0.7fr 1.2fr 1.2fr;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  font-size: 0.92rem;
}
.coverage-grid > div {
  padding: 9px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.coverage-grid > div:nth-child(4n) {
  border-right: 0;
}
.coverage-head {
  color: var(--target-red);
  font-weight: 900;
  background: var(--target-red-soft) !important;
}
.small-text {
  font-size: 0.8rem;
}

/* v5.5.1 Compact Find Assist Log Outcome button */
.search-card .compact-log-outcome {
  width: auto;
  min-height: 36px;
  padding: 8px 14px;
  font-size: 0.9rem;
  align-self: start;
  justify-self: start;
  box-shadow: 0 6px 14px rgba(204, 0, 0, 0.18);
}

@media (max-width: 720px) {
  .search-card .compact-log-outcome {
    width: auto;
    max-width: max-content;
  }
}

@media print {
  body { background: #fff; }
  .topbar, .hero-card, .tabs, #scheduleForm, #autoScheduleBtn, #printScheduleBtn, .toast, .tab-panel:not(#schedulePlanner) { display: none !important; }
  #appPanel, #schedulePlanner, .tab-panel.active { display: block !important; }
  .app-shell { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .schedule-table { min-width: 0; font-size: 11px; }
  .schedule-table input { border: 0; padding: 0; }
}

/* v4.2 dedicated login flow */
body.login-mode {
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,0.22), transparent 18rem),
    radial-gradient(circle at 78% 0%, rgba(255,255,255,0.18), transparent 22rem),
    linear-gradient(135deg, var(--target-red), var(--target-red-dark));
}

body.login-mode .app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-screen {
  width: min(620px, 100%);
}

.login-card {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 5vw, 42px);
  color: var(--ink);
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(255,255,255,0.65);
  border-radius: 32px;
  box-shadow: 0 28px 70px rgba(0,0,0,0.26);
}

.login-card::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 210px;
  height: 210px;
  border-radius: 999px;
  border: 30px solid rgba(204,0,0,0.08);
  pointer-events: none;
}

.login-brand-row {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.brand-mark.large {
  width: 64px;
  height: 64px;
  flex-basis: 64px;
  font-size: 1.2rem;
}

.login-card h1 {
  margin: 0;
  max-width: 460px;
  line-height: 1.02;
  letter-spacing: -0.055em;
  font-size: clamp(2rem, 7vw, 3.6rem);
}

.login-copy {
  position: relative;
  z-index: 1;
  margin: 0 0 22px;
  max-width: 520px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.5;
}

.login-form {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
}

.login-form label {
  font-weight: 850;
  color: var(--ink);
}

.login-form input {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.install-note {
  position: relative;
  z-index: 1;
  margin: 18px 0 0;
  padding: 12px 14px;
  color: var(--muted);
  background: var(--target-red-soft);
  border: 1px solid rgba(204,0,0,0.12);
  border-radius: 16px;
  font-size: 0.92rem;
}

body.app-mode .topbar {
  display: flex;
}

@media (max-width: 640px) {
  .login-brand-row {
    align-items: flex-start;
  }
  .login-card {
    border-radius: 24px;
  }
}


/* v4.3 login header fix: never show command-center header on the login screen. */
[hidden] {
  display: none !important;
}

body.login-mode #appTopbar,
body.login-mode .topbar {
  display: none !important;
}
/* v4.6 Store Memory cards */
.memory-item .pill{display:inline-flex;margin:2px 0 6px 0}.success-pill{color:#166534!important;background:#dcfce7!important;border-color:#bbf7d0!important}.danger-pill{color:#991b1b!important;background:#fee2e2!important;border-color:#fecaca!important}

/* v4.7 OCR cleanup UI */
.raw-ocr-details { margin-top: 12px; }
.raw-ocr-details summary { cursor: pointer; font-weight: 800; margin-bottom: 8px; color: var(--muted); }
#scanCleanText { font-weight: 700; background: #fff; border-color: rgba(204,0,0,.25); }

/* v5.0 usability cleanup */
.schedule-mobile-cards {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}
.schedule-person-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #fff, #fffafa);
}
.schedule-person-card strong {
  font-size: 1.05rem;
}
.schedule-person-card p {
  margin: 3px 0 0;
}
.schedule-shift-time {
  font-weight: 900;
  color: var(--target-red);
  font-size: 1.1rem;
}
.break-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.break-chip-row span {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--ink);
  background: var(--target-red-soft);
  border: 1px solid rgba(204,0,0,0.12);
  font-size: 0.9rem;
}
.note-only-card p:first-child {
  margin-top: 0;
  font-size: 1.02rem;
  line-height: 1.45;
}
.simple-notes-list .stack-item strong,
.note-only-card strong {
  display: none;
}
@media (max-width: 760px) {
  .hero-card {
    grid-template-columns: 1fr;
  }
  .schedule-card .table-wrap {
    display: none;
  }
  .coverage-grid {
    font-size: 0.82rem;
    grid-template-columns: .8fr .6fr 1fr 1fr;
  }
  .coverage-grid > div {
    padding: 8px 6px;
  }
  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .topbar {
    align-items: flex-start;
  }
  .top-actions {
    display: grid;
    gap: 8px;
    justify-items: end;
  }
}
@media (min-width: 761px) {
  .schedule-mobile-cards {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

.memory-byline { margin: 6px 0; font-size: 0.92rem; color: var(--ink); }
.memory-byline strong { color: var(--red); }
.form-help {
  margin: -6px 0 0;
  font-size: 0.92rem;
  line-height: 1.35;
}

/* v5.5 hamburger navigation, dark mode, and compact command layout */
:root {
  --menu-width: min(220px, 58vw);
}

body.dark-mode {
  --ink: #f7f7fb;
  --muted: #b6bac6;
  --line: #303442;
  --paper: #181b23;
  --bg: #101218;
  --target-red-soft: rgba(204, 0, 0, 0.18);
  --success-soft: rgba(20, 122, 62, 0.18);
  --warning-soft: rgba(179, 91, 0, 0.2);
  --danger-soft: rgba(161, 21, 21, 0.22);
  background:
    radial-gradient(circle at top left, rgba(204, 0, 0, 0.22), transparent 30rem),
    linear-gradient(180deg, #11131a 0%, #0e1016 100%);
}

body.dark-mode .card,
body.dark-mode .login-card,
body.dark-mode .stack-item,
body.dark-mode .activity-item,
body.dark-mode .schedule-mobile-card,
body.dark-mode .stat-card {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line);
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  color: var(--ink);
  background: #11131a;
  border-color: var(--line);
}

body.dark-mode .secondary-btn,
body.dark-mode .ghost-btn {
  color: #ff6b6b;
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
}

body.dark-mode .topbar,
body.dark-mode .side-menu {
  background: rgba(24, 27, 35, 0.96);
  border-color: var(--line);
  color: var(--ink);
}

body.dark-mode .menu-backdrop {
  background: rgba(0,0,0,0.62);
}

.topbar {
  transition: transform .24s ease, background-color .2s ease, border-color .2s ease;
}

.topbar.topbar-hidden {
  transform: translateY(-115%);
}

.brand-mark.compact {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  font-size: .95rem;
}

.topbar-home-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-align: left;
  cursor: pointer;
  border-radius: 12px;
}

.topbar-home-link:focus-visible {
  outline: 3px solid rgba(204, 0, 0, .3);
  outline-offset: 4px;
}

.topbar-home-link:active {
  transform: translateY(1px);
}

.topbar-app-name {
  display: block;
  font-size: clamp(1.15rem, 3.4vw, 1.55rem);
  font-weight: 800;
  line-height: 1.05;
}

.topbar-title {
  min-width: 0;
}

.topbar-title h1 {
  font-size: clamp(1.15rem, 3.4vw, 1.55rem);
}

.topbar-title .eyebrow {
  margin-top: 2px;
  margin-bottom: 0;
  white-space: nowrap;
}

.menu-toggle {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 14px;
  background: var(--target-red);
  box-shadow: 0 8px 18px rgba(204,0,0,.22);
}

.menu-toggle span {
  width: 20px;
  height: 2px;
  border-radius: 99px;
  background: #fff;
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(17,24,39,.42);
  backdrop-filter: blur(2px);
}

.side-menu {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  width: var(--menu-width);
  padding: 16px;
  background: rgba(255,255,255,.98);
  border-right: 1px solid var(--line);
  box-shadow: 18px 0 45px rgba(0,0,0,.18);
  overflow-y: auto;
}

.side-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 2px 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.side-menu-head strong {
  font-size: 1.35rem;
  letter-spacing: -.04em;
}

.side-menu .menu-link,
.side-menu .tab-btn {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  min-height: 48px;
  margin: 8px 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
  box-shadow: none;
  text-align: left;
}

.side-menu .tab-btn.active {
  color: #fff;
  background: var(--target-red);
  border-color: var(--target-red);
}

.tabs {
  display: none !important;
}

#appPanel {
  padding-top: 4px;
}

body.menu-open {
  overflow: hidden;
}

@media (max-width: 720px) {
  .topbar {
    gap: 10px;
    padding: 10px 12px;
  }

  .top-actions {
    width: auto !important;
    margin-left: auto;
    justify-content: flex-end !important;
    gap: 6px;
  }

  #userPill {
    display: none;
  }

  #darkModeBtn,
  #logoutBtn {
    min-height: 36px;
    padding: 8px 10px !important;
  }

  .brand-mark.compact {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .topbar-home-link {
    gap: 8px;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .topbar-home-link .topbar-title {
    overflow: hidden;
  }

  .topbar-app-name {
    font-size: 1.1rem;
  }
}

@media print {
  .side-menu, .menu-backdrop, #menuToggle, #darkModeBtn { display: none !important; }
}


/* v5.5.2 Find Assist cleanup: Store Memory first + compact inline Before You INF checks */
.find-assist-results {
  align-items: start;
}

.checklist-grid {
  grid-template-columns: 1fr;
  gap: 6px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.25;
}

.check-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  flex: 0 0 16px;
  margin: 0;
  accent-color: var(--target-red);
}

.check-item:hover {
  border-color: rgba(204, 0, 0, 0.35);
}

@media (max-width: 720px) {
  .check-item {
    padding: 7px 8px;
    font-size: 0.86rem;
    border-radius: 9px;
  }

  .check-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    min-width: 15px;
    min-height: 15px;
    flex-basis: 15px;
  }
}


/* v5.5.4: narrower slide-out menu drawer, while restoring normal hamburger icon size */
:root {
  --menu-width: min(220px, 58vw);
}

.side-menu {
  padding: 14px 12px;
}

.side-menu-head {
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.side-menu-head strong {
  font-size: 1.08rem;
}

.side-menu .menu-link,
.side-menu .tab-btn {
  min-height: 42px;
  margin: 6px 0;
  padding: 10px 10px;
  border-radius: 12px;
  font-size: .92rem;
  line-height: 1.15;
}

@media (max-width: 420px) {
  :root { --menu-width: min(210px, 56vw); }
}


/* v5.5.6 mobile schedule break/lunch editing for leaders/admins */
.schedule-edit-card {
  border-color: rgba(204, 0, 0, 0.18);
}
.mobile-break-edit-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
}
.mobile-break-edit-grid label,
.mobile-notes-edit {
  display: grid;
  gap: 5px;
  font-weight: 900;
  color: var(--muted);
  font-size: 0.85rem;
}
.mobile-break-edit-grid select,
.mobile-notes-edit input {
  width: 100%;
  min-height: 42px;
  border-radius: 14px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-weight: 800;
}
.schedule-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.schedule-card-actions .small {
  padding: 9px 12px;
  min-height: 38px;
}
@media (min-width: 520px) {
  .mobile-break-edit-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}


/* v5.5.7 compact one-line schedule list */
.schedule-compact-list {
  display: grid;
  gap: 5px;
  margin: 8px 0 14px;
}
.schedule-compact-row {
  display: grid;
  grid-template-columns: minmax(74px, 1.15fr) minmax(72px, 1fr) minmax(38px, .58fr) minmax(48px, .72fr) minmax(38px, .58fr);
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  font-size: 0.82rem;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
}
.schedule-compact-row > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.schedule-compact-head {
  padding-top: 4px;
  padding-bottom: 4px;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  font-size: 0.66rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.compact-person strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
.compact-person small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
}
.compact-person .compact-note {
  color: var(--target-red);
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0;
}
body.dark-mode .compact-person .compact-note {
  color: #ff8b8b;
}
.compact-shift {
  color: var(--target-red);
  font-weight: 950;
}
.compact-break,
.compact-lunch {
  font-weight: 850;
}
.schedule-edit-heading {
  margin: 12px 0 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
body.dark-mode .schedule-compact-row {
  background: rgba(255,255,255,0.04);
}
body.dark-mode .schedule-compact-head {
  background: transparent;
}
@media (max-width: 480px) {
  .schedule-compact-row {
    grid-template-columns: minmax(66px, 1.12fr) minmax(62px, .94fr) minmax(34px, .5fr) minmax(44px, .64fr) minmax(34px, .5fr);
    gap: 4px;
    padding: 6px 7px;
    border-radius: 10px;
    font-size: 0.73rem;
  }
  .compact-person small {
    font-size: 0.6rem;
  }
}

/* v5.5.9: use the compact/mobile schedule edit cards for desktop and mobile; hide duplicate desktop table */
#schedulePlanner .table-wrap {
  display: none !important;
}

#schedulePlanner .schedule-mobile-cards {
  display: grid !important;
}

@media (min-width: 761px) {
  #schedulePlanner .schedule-mobile-cards {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    align-items: start;
  }
}


/* v5.5.11: compact working list + single table editor, no duplicate edit cards */
#schedulePlanner .schedule-mobile-cards,
#schedulePlanner #scheduleMobileCards {
  display: none !important;
}

#schedulePlanner .table-wrap {
  display: block !important;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Make the "who is working" list truly compact and readable on mobile. */
#scheduleCompactList.schedule-compact-list,
#schedulePlanner .schedule-compact-list {
  display: grid !important;
  gap: 3px;
  margin: 6px 0 12px;
  width: 100%;
}

#scheduleCompactList .schedule-compact-row,
#schedulePlanner .schedule-compact-row {
  display: grid !important;
  grid-template-columns: minmax(72px, 1.25fr) minmax(78px, 1fr) minmax(42px, .55fr) minmax(54px, .7fr) minmax(42px, .55fr);
  align-items: center;
  gap: 5px;
  width: 100%;
  padding: 5px 7px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  font-size: 0.78rem;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
}

#scheduleCompactList .schedule-compact-head,
#schedulePlanner .schedule-compact-head {
  padding-top: 2px;
  padding-bottom: 3px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 0.62rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#scheduleCompactList .schedule-compact-row > span,
#schedulePlanner .schedule-compact-row > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

#scheduleCompactList .compact-person strong,
#schedulePlanner .compact-person strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 950;
}

#scheduleCompactList .compact-person small,
#schedulePlanner .compact-person small {
  display: inline;
  margin-left: 0;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 750;
}

#scheduleCompactList .compact-person .compact-note,
#schedulePlanner .compact-person .compact-note {
  display: block;
  margin-top: 1px;
  color: var(--target-red);
  font-size: 0.6rem;
  font-weight: 850;
}

#scheduleCompactList .compact-shift,
#schedulePlanner .compact-shift {
  color: var(--target-red);
  font-weight: 950;
}

#schedulePlanner .schedule-card .table-wrap,
#schedulePlanner .schedule-table-wrap {
  overflow-x: auto;
}

/* Keep the editable table as the only editing surface. */
#schedulePlanner table select {
  min-width: 104px;
  padding-right: 30px;
}

#schedulePlanner table input[data-sched-field="notes"] {
  min-width: 150px;
}

@media (max-width: 520px) {
  #scheduleCompactList .schedule-compact-row,
  #schedulePlanner .schedule-compact-row {
    grid-template-columns: minmax(62px, 1.15fr) minmax(64px, .9fr) minmax(32px, .45fr) minmax(43px, .58fr) minmax(32px, .45fr);
    gap: 3px;
    padding: 5px 4px;
    font-size: 0.68rem;
  }

  #scheduleCompactList .schedule-compact-head,
  #schedulePlanner .schedule-compact-head {
    font-size: 0.54rem;
  }

  #scheduleCompactList .compact-person small,
  #schedulePlanner .compact-person small,
  #scheduleCompactList .compact-person .compact-note,
  #schedulePlanner .compact-person .compact-note {
    font-size: 0.52rem;
  }
}


/* v5.5.12: schedule auto-refresh support + readable break/lunch selectors */
#schedulePlanner table select,
#schedulePlanner table input,
#schedulePlanner .table-wrap select {
  font-size: 0.86rem;
  min-width: 116px;
  max-width: 128px;
  padding: 8px 28px 8px 9px;
  min-height: 40px;
  border-radius: 12px;
  line-height: 1.1;
}

#schedulePlanner table td {
  vertical-align: middle;
}

#schedulePlanner table th,
#schedulePlanner table td {
  padding-left: 8px;
  padding-right: 8px;
}

#schedulePlanner table input[data-sched-field="notes"] {
  min-width: 150px;
  max-width: none;
}

@media (max-width: 760px) {
  #schedulePlanner table select,
  #schedulePlanner .table-wrap select {
    font-size: 0.78rem;
    min-width: 104px;
    max-width: 112px;
    padding-left: 7px;
    padding-right: 24px;
  }
}


/* v5.5.13: Team Members see compact schedule only; Leader/Admin sees compact list + edit table */
#schedulePlanner .table-wrap[hidden] {
  display: none !important;
}


/* v5.5.14: team note delete button for Leader/Admin */
.note-only-card .danger-btn {
  margin-top: 8px;
  width: fit-content;
}


/* v5.5.15: INF Assist Leader/Admin in-app notification */
.assist-alert-banner {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(680px, calc(100vw - 24px));
  padding: 12px;
  border: 2px solid rgba(204, 0, 0, 0.32);
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 18px 45px rgba(0,0,0,0.22);
  transform: translate(-50%, 150%);
  opacity: 0;
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease;
}

.assist-alert-banner.show {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

.assist-alert-banner strong {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.25;
}

.assist-alert-banner .ghost-btn {
  font-size: 1.15rem;
  padding: 7px 10px;
}

body.dark-mode .assist-alert-banner {
  background: #171a21;
  color: #f5f7fb;
  border-color: rgba(255, 113, 113, 0.45);
}

@media (max-width: 560px) {
  .assist-alert-banner {
    left: 10px;
    right: 10px;
    bottom: 12px;
    transform: translateY(150%);
    max-width: none;
    flex-wrap: wrap;
  }
  .assist-alert-banner.show {
    transform: translateY(0);
  }
  .assist-alert-banner strong {
    flex-basis: 100%;
  }
}


/* v5.6: PWA install + notification tools */
.pwa-card {
  border-color: rgba(204, 0, 0, 0.18);
}

.pwa-card .action-row {
  margin-top: 10px;
}

#pwaStatusText {
  margin-top: 12px;
  line-height: 1.35;
}


/* v5.6.4: iPhone visual fallback for INF Assist alerts */
body.assist-alert-active::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 180;
  pointer-events: none;
  border: 8px solid rgba(204, 0, 0, 0.75);
  box-shadow: inset 0 0 0 9999px rgba(204, 0, 0, 0.055);
  animation: assistScreenPulse 1.1s ease-in-out infinite;
}

body.assist-alert-flash .topbar,
body.assist-alert-active .topbar {
  box-shadow: 0 12px 36px rgba(204, 0, 0, 0.32);
}

.assist-visual-alert {
  position: fixed;
  top: 72px;
  left: 50%;
  z-index: 220;
  width: min(720px, calc(100vw - 24px));
  transform: translate(-50%, -130%);
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
}

.assist-visual-alert.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.assist-visual-alert-card {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 3px solid #cc0000;
  border-radius: 20px;
  background: #fff;
  color: #1e1e24;
  box-shadow: 0 18px 55px rgba(0,0,0,0.28);
}

.assist-pulse-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #cc0000;
  box-shadow: 0 0 0 rgba(204,0,0,0.72);
  animation: assistDotPulse 1s infinite;
}

.assist-visual-alert-copy strong {
  display: block;
  font-size: 1rem;
  line-height: 1.2;
}

.assist-visual-alert-copy p {
  margin: 4px 0 0;
  color: #565b63;
  font-size: 0.86rem;
  font-weight: 750;
}

.assist-visual-alert-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tab-btn.needs-attention,
.menu-link.needs-attention {
  background: #cc0000 !important;
  color: #fff !important;
  animation: assistButtonPulse 1s infinite;
}

@keyframes assistScreenPulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

@keyframes assistDotPulse {
  0% { box-shadow: 0 0 0 0 rgba(204,0,0,0.72); }
  70% { box-shadow: 0 0 0 14px rgba(204,0,0,0); }
  100% { box-shadow: 0 0 0 0 rgba(204,0,0,0); }
}

@keyframes assistButtonPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.025); }
}

body.dark-mode .assist-visual-alert-card {
  background: #171a21;
  color: #f5f7fb;
  border-color: #ff5656;
}

body.dark-mode .assist-visual-alert-copy p {
  color: #cdd3df;
}

@media (max-width: 640px) {
  .assist-visual-alert {
    top: 64px;
    width: calc(100vw - 18px);
  }

  .assist-visual-alert-card {
    grid-template-columns: 18px 1fr;
  }

  .assist-visual-alert-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .assist-visual-alert-actions button {
    flex: 1 1 130px;
  }
}


/* v5.7: photo capture, previews, Store Memory thumbnails, and lightbox */
.photo-upload-block {
  display: grid;
  gap: 10px;
}

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

.photo-picker-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  cursor: pointer;
}

.photo-file-input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.photo-preview-wrap {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.photo-preview {
  display: block;
  width: min(100%, 360px);
  max-height: 300px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.photo-help {
  margin: 0;
  font-size: 0.8rem;
}

.memory-photo-btn {
  display: block;
  width: min(100%, 340px);
  margin: 8px 0;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  overflow: hidden;
}

.memory-photo-thumb {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0,0,0,0.9);
}

.photo-lightbox[hidden] {
  display: none !important;
}

.photo-lightbox img {
  max-width: min(96vw, 1200px);
  max-height: 90vh;
  object-fit: contain;
  border-radius: 14px;
  background: #111;
}

.photo-lightbox-close {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 501;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: rgba(255,255,255,0.95);
  color: #111;
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1;
}

body.photo-lightbox-open {
  overflow: hidden;
}

.note-only-card .memory-photo-btn,
.rescue-log-card .memory-photo-btn {
  width: min(100%, 420px);
}

@media (max-width: 520px) {
  .photo-action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .photo-picker-btn {
    width: 100%;
    min-width: 0;
    padding-left: 8px;
    padding-right: 8px;
  }

  .memory-photo-btn {
    width: 100%;
  }

  .memory-photo-thumb {
    max-height: 180px;
  }

  .photo-lightbox {
    padding: 12px;
  }
}


/* v5.7.5 unified iPhone rescue photo control */
.photo-source-input {
  display: block;
  width: 100%;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.photo-selected-status {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--muted);
}

#rescueForm .photo-file-input {
  display: none !important;
}


/* v5.7.6: compact Rescue/Store Memory photo thumbnails */
.memory-photo-btn {
  width: 112px !important;
  max-width: 112px !important;
  margin: 8px 0 !important;
  border-radius: 12px !important;
  overflow: hidden;
  cursor: pointer;
}

.memory-photo-thumb {
  display: block;
  width: 112px !important;
  height: 84px !important;
  max-height: 84px !important;
  object-fit: cover;
  border-radius: 12px !important;
}

.note-only-card .memory-photo-btn,
.rescue-log-card .memory-photo-btn,
.memory-item .memory-photo-btn {
  width: 112px !important;
  max-width: 112px !important;
}

@media (max-width: 640px) {
  .memory-photo-btn,
  .note-only-card .memory-photo-btn,
  .rescue-log-card .memory-photo-btn,
  .memory-item .memory-photo-btn {
    width: 88px !important;
    max-width: 88px !important;
  }

  .memory-photo-thumb {
    width: 88px !important;
    height: 66px !important;
    max-height: 66px !important;
  }
}


/* v5.7.7: mobile-only compact photo thumbnails */
@media (max-width: 900px) {
  .memory-item .memory-photo-btn,
  .rescue-log-card .memory-photo-btn,
  .note-only-card .memory-photo-btn,
  button.memory-photo-btn {
    display: inline-block !important;
    width: 76px !important;
    max-width: 76px !important;
    min-width: 76px !important;
    height: 57px !important;
    max-height: 57px !important;
    margin: 8px 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border-radius: 10px !important;
    vertical-align: top;
  }

  .memory-item .memory-photo-thumb,
  .rescue-log-card .memory-photo-thumb,
  .note-only-card .memory-photo-thumb,
  img.memory-photo-thumb {
    display: block !important;
    width: 76px !important;
    max-width: 76px !important;
    min-width: 76px !important;
    height: 57px !important;
    max-height: 57px !important;
    min-height: 57px !important;
    object-fit: cover !important;
    border-radius: 10px !important;
  }
}


/* v5.8 Fast Find Workflow */
.my-shift-mini {
  padding: 14px 16px;
}

.my-shift-mini .card-title-row {
  margin-bottom: 8px;
}

.my-shift-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.my-shift-grid > div {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2, rgba(127,127,127,0.06));
}

.my-shift-grid span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.my-shift-grid strong {
  display: block;
  margin-top: 2px;
  font-size: 0.96rem;
}

.my-shift-note {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.recent-search-wrap {
  margin-top: 10px;
}

.mini-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.76rem;
  font-weight: 850;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.recent-search-chips,
.quick-location-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.recent-search-chip,
.quick-location-chips button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.quick-location-chips button.selected {
  background: #cc0000;
  border-color: #cc0000;
  color: #fff;
}

.fast-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
}

.fast-action-btn {
  min-height: 48px;
  font-weight: 900;
}

.quick-rescue-card {
  border: 2px solid rgba(204,0,0,0.28);
}

.quick-item-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 4px 0 14px;
}

.quick-rescue-extra {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
  margin-top: 14px;
}

.quick-save-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

#quickOtherLocationWrap {
  margin-top: 10px;
}

@media (max-width: 640px) {
  .my-shift-grid {
    grid-template-columns: repeat(4, minmax(62px, 1fr));
    gap: 5px;
    overflow-x: auto;
  }

  .my-shift-grid > div {
    padding: 7px 6px;
  }

  .my-shift-grid span {
    font-size: 0.64rem;
  }

  .my-shift-grid strong {
    font-size: 0.82rem;
    white-space: nowrap;
  }

  .fast-action-grid {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .fast-action-btn {
    min-height: 46px;
  }

  .quick-location-chips {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .quick-location-chips button {
    padding: 9px 5px;
    font-size: 0.76rem;
  }

  .quick-rescue-extra {
    grid-template-columns: 1fr;
  }

  .quick-save-row {
    align-items: stretch;
    flex-direction: column;
  }

  .quick-save-row button {
    width: 100%;
  }
}


/* v5.8.1 Photo Safety + Moderation */
.photo-policy {
  margin: 0;
  padding: 9px 11px;
  border: 1px solid rgba(204, 0, 0, 0.22);
  border-radius: 12px;
  background: rgba(204, 0, 0, 0.055);
  font-size: 0.82rem;
  line-height: 1.35;
}

.photo-accountability {
  margin: 4px 0 0;
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 700;
}

.photo-moderation-actions {
  margin-top: 6px;
  gap: 6px;
}

.photo-review-card {
  display: grid;
  gap: 8px;
}

.photo-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.photo-permission-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.photo-permission-row > div {
  min-width: 0;
}

@media (max-width: 640px) {
  .photo-permission-row {
    align-items: stretch;
    flex-direction: column;
  }

  .photo-permission-row button {
    width: 100%;
  }

  .photo-moderation-actions {
    flex-wrap: wrap;
  }
}


/* v5.8.2 guided Fast Find modal workflow */
.quick-rescue-modal {
  position: fixed;
  inset: 0;
  z-index: 420;
  display: grid;
  place-items: center;
  padding: 18px;
}

.quick-rescue-modal[hidden] {
  display: none !important;
}

.quick-rescue-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 18, 0.68);
  backdrop-filter: blur(3px);
}

.quick-rescue-card {
  position: relative;
  z-index: 1;
  width: min(680px, 100%);
  max-height: min(88vh, 760px);
  overflow-y: auto;
  margin: 0 !important;
  box-shadow: 0 24px 70px rgba(0,0,0,0.35);
}

body.quick-rescue-open {
  overflow: hidden;
}

.quick-question-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 900;
  font-size: 1rem;
}

.quick-question-help {
  margin: -2px 0 10px;
}

.quick-check-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-check-chips button,
.quick-location-chips button {
  min-height: 42px;
}

.quick-check-chips button.selected,
.quick-location-chips button.selected {
  box-shadow: inset 0 0 0 2px currentColor;
  transform: translateY(-1px);
}

.memory-actions {
  margin-top: 9px;
  align-items: center;
}

.memory-actions .success-btn {
  font-weight: 900;
}

@media (max-width: 640px) {
  .quick-rescue-modal {
    align-items: end;
    padding: 0;
  }

  .quick-rescue-card {
    width: 100%;
    max-height: 88vh;
    border-radius: 20px 20px 0 0 !important;
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

  .quick-check-chips,
  .quick-location-chips {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-check-chips button,
  .quick-location-chips button {
    width: 100%;
    min-width: 0;
  }

  .memory-actions {
    display: flex;
    flex-wrap: wrap;
  }
}


/* v5.8.3: Not Found selected checks turn red */
#quickCheckedChips button.selected {
  background: #c62828 !important;
  border-color: #c62828 !important;
  color: #ffffff !important;
  box-shadow: inset 0 0 0 2px #c62828 !important;
}

#quickCheckedChips button.selected:hover,
#quickCheckedChips button.selected:focus {
  background: #b71c1c !important;
  border-color: #b71c1c !important;
  color: #ffffff !important;
}


/* v5.8.5 login memory + clear errors */
.login-error {
  margin: 2px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(198, 40, 40, 0.35);
  border-radius: 12px;
  background: rgba(198, 40, 40, 0.08);
  color: #c62828;
  font-weight: 800;
  line-height: 1.35;
}

.login-error[hidden] {
  display: none !important;
}


/* v5.8.6 simple Find Assist OCR helper */
.find-ocr-helper {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.find-ocr-head strong {
  display: block;
  font-size: 0.96rem;
}

.find-ocr-head p {
  margin: 3px 0 0;
}

.find-ocr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.find-ocr-status {
  margin-top: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(0,0,0,0.05);
  font-size: 0.83rem;
  font-weight: 700;
}

.find-ocr-status.error {
  background: rgba(198,40,40,0.09);
  color: #c62828;
}

.find-ocr-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 8px;
  margin-top: 10px;
}

.find-ocr-result > div {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.find-ocr-result span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.find-ocr-result strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .find-ocr-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .find-ocr-actions .photo-picker-btn {
    width: 100%;
    text-align: center;
  }

  .find-ocr-result {
    grid-template-columns: 1fr;
  }
}


/* v5.8.8 compact Find Assist actions + expandable Store Memory list */

/* Recent Searches removed in v5.8.8 */
.recent-search-wrap,
.recent-search-chips {
  display: none !important;
}

/* Always keep the three primary actions on one row. */
.fast-action-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 6px !important;
}

.fast-action-btn {
  min-height: 42px !important;
  padding: 8px 6px !important;
  font-size: 0.86rem !important;
  white-space: nowrap;
}

/* Compact Store Memory list */
#matchingNotes.stack-list {
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.memory-list-item {
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.memory-list-item:last-child {
  border-bottom: 0;
}

.memory-list-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  cursor: pointer;
  list-style: none;
}

.memory-list-summary::-webkit-details-marker {
  display: none;
}

.memory-list-summary::after {
  content: "›";
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.memory-list-item[open] .memory-list-summary::after {
  transform: rotate(90deg);
}

.memory-list-item-name {
  min-width: 0;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.memory-list-meta {
  grid-column: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.memory-list-meta .pill {
  margin: 0 !important;
  font-size: 0.68rem;
  padding: 3px 7px;
}

.memory-list-meta time {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.memory-list-details {
  padding: 0 12px 12px;
  border-top: 1px dashed var(--line);
}

.memory-detail-dept {
  margin: 10px 0 5px;
  font-weight: 800;
}

.memory-list-details p {
  margin-top: 6px;
  margin-bottom: 6px;
}

.memory-list-details .memory-photo-btn {
  margin-top: 8px !important;
}

@media (max-width: 640px) {
  .fast-action-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 5px !important;
  }

  .fast-action-btn {
    min-height: 40px !important;
    padding: 7px 3px !important;
    font-size: 0.74rem !important;
    letter-spacing: -0.01em;
  }

  .memory-list-summary {
    padding: 10px;
    gap: 7px;
  }

  .memory-list-item-name {
    font-size: 0.9rem;
  }

  .memory-list-meta time {
    font-size: 0.7rem;
  }

  .memory-list-details {
    padding: 0 10px 10px;
  }
}


/* v5.8.11 My Shift in header + simplified search label */
.header-my-shift {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  margin-left: auto;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.header-shift-label {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.header-shift-times {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
  font-size: 0.74rem;
  font-weight: 700;
}

.header-shift-times span {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}

.header-shift-main {
  font-weight: 900;
  color: var(--text);
}

.header-shift-empty {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .topbar {
    flex-wrap: wrap;
  }

  .header-my-shift {
    order: 4;
    width: 100%;
    margin-left: 0;
    justify-content: center;
    padding: 6px 8px;
  }

  .header-shift-times {
    gap: 7px;
    font-size: 0.7rem;
    overflow-x: auto;
  }
}

@media (max-width: 640px) {
  .header-my-shift {
    gap: 7px;
    border-radius: 10px;
  }

  .header-shift-label {
    font-size: 0.64rem;
  }

  .header-shift-times {
    gap: 6px;
    font-size: 0.66rem;
  }
}


/* v5.8.12: keep Find Assist Clear button on heading row on mobile */
.find-assist-head {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  flex-direction: row !important;
}

.find-assist-head > div {
  min-width: 0;
}

.find-assist-head #clearFindBtn {
  flex: 0 0 auto;
  width: auto !important;
  min-width: 72px;
  margin: 0 !important;
}

@media (max-width: 640px) {
  .find-assist-head {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  .find-assist-head #clearFindBtn {
    width: auto !important;
    min-width: 68px;
    min-height: 38px;
    padding: 7px 12px;
    font-size: 0.8rem;
  }
}


/* v5.8.13 compact Scan + Clear header actions */
.find-assist-head-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.find-assist-head-actions .secondary-btn {
  width: auto !important;
  min-width: 68px;
  margin: 0 !important;
}

@media (max-width: 640px) {
  .find-assist-head-actions {
    gap: 5px;
  }

  .find-assist-head-actions .secondary-btn {
    min-width: 62px;
    min-height: 38px;
    padding: 7px 10px;
    font-size: 0.78rem;
  }
}

/* Visible Scan Item Label panel removed in v5.8.13 */
.find-ocr-helper {
  display: none !important;
}

/* v5.9.2 Passkey / Face ID login */
.login-passkey-divider{display:flex;align-items:center;gap:10px;margin:5px 0;color:var(--muted);font-size:.78rem;font-weight:800;text-transform:uppercase}
.login-passkey-divider::before,.login-passkey-divider::after{content:"";height:1px;background:var(--line);flex:1}
.passkey-login-btn{min-height:48px;font-weight:900}
.passkey-login-help{margin:0;font-size:.78rem;line-height:1.35;text-align:center}
.passkey-settings-card{border:1px solid rgba(204,0,0,.18)}
.passkey-list{display:grid;gap:8px;margin-top:12px}
.passkey-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 12px;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
.passkey-row>div{min-width:0}.passkey-row strong,.passkey-row p{overflow-wrap:anywhere}.passkey-row p{margin:3px 0 0;font-size:.8rem}
@media(max-width:640px){.passkey-row{align-items:stretch;flex-direction:column}.passkey-row button{width:100%}}
\n\n/* v5.9.3 Find Assist barcode generator */
.find-barcode-card { margin-top:10px; padding:10px; border:1px solid var(--line); border-radius:12px; background:var(--surface); }
.find-barcode-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:8px; font-size:.78rem; font-weight:900; }
.find-barcode-scroll { overflow-x:auto; padding:6px; border-radius:10px; background:#fff; -webkit-overflow-scrolling:touch; }
.find-barcode-svg { display:block; min-width:max-content; max-width:none; margin:0 auto; }
.find-barcode-value { margin:7px 0 0; text-align:center; font-size:.82rem; font-weight:800; overflow-wrap:anywhere; }
.find-barcode-status { margin:6px 0 0; text-align:center; font-size:.76rem; }
@media (max-width:640px) { .find-barcode-card { padding:8px; } .find-barcode-svg { min-height:72px; } }


/* v5.9.4 Tools page barcode generator */
.tools-barcode-card { max-width: 760px; }
.tools-barcode-form { display:grid; gap:7px; margin-top:14px; }
.tools-barcode-input-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; align-items:stretch; }
.tools-barcode-input-row .secondary-btn { width:auto; min-width:76px; }
.tools-barcode-output { margin-top:14px; padding:12px; border:1px solid var(--line); border-radius:12px; background:var(--surface); }
.tools-barcode-scroll { overflow-x:auto; padding:10px; border-radius:10px; background:#fff; -webkit-overflow-scrolling:touch; }
.tools-barcode-svg { display:block; min-width:max-content; max-width:none; margin:0 auto; }
.tools-barcode-value { margin:8px 0 0; text-align:center; font-size:.88rem; font-weight:900; overflow-wrap:anywhere; }
.tools-barcode-status { margin:6px 0 0; text-align:center; font-size:.78rem; }
@media (max-width:640px) {
  .tools-barcode-input-row { grid-template-columns:minmax(0,1fr) auto; }
  .tools-barcode-input-row .secondary-btn { min-width:68px; padding-left:10px; padding-right:10px; }
}


/* v5.9.5 compact responsive barcode sizing */
.tools-barcode-scroll { overflow-x: hidden; }
.tools-barcode-svg { display:block; width:auto; max-width:100% !important; height:auto; min-width:0; margin:0 auto; }
@media (max-width:640px) { .tools-barcode-output { padding:8px; } .tools-barcode-scroll { padding:6px; } }


/* v5.9.6 My Shift header color hierarchy + role */
.header-shift-role { color: var(--success); font-weight: 950; }
.header-shift-main { color: var(--target-red) !important; font-weight: 950; }
.header-shift-break { color: var(--ink); }
.header-shift-break b { color: var(--warning); font-weight: 950; }
body.dark-mode .header-shift-role { color: #61d891; }
body.dark-mode .header-shift-main { color: #ff6b6b !important; }
body.dark-mode .header-shift-break { color: var(--ink); }
body.dark-mode .header-shift-break b { color: #ffb35c; }
@media (max-width: 640px) {
  .header-shift-times { flex-wrap: wrap; justify-content: center; white-space: normal; overflow-x: visible; row-gap: 3px; }
  .header-shift-role { width: 100%; justify-content: center; font-size: 0.67rem; }
}


/* v5.9.7 Find Assist voice-to-text search */
.find-voice-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; align-items:stretch; }
.voice-search-btn { min-width:92px; display:inline-flex; align-items:center; justify-content:center; gap:6px; white-space:nowrap; }
.voice-search-btn.listening { background:var(--target-red); border-color:var(--target-red); color:#fff; animation:voicePulse 1.1s ease-in-out infinite; }
.voice-search-btn.unsupported { opacity:.65; }
.voice-search-status { margin:7px 0 0; font-size:.78rem; }
@keyframes voicePulse { 0%,100%{box-shadow:0 0 0 0 rgba(204,0,0,.2)} 50%{box-shadow:0 0 0 6px rgba(204,0,0,0)} }
@media (max-width:640px){ .voice-search-btn{min-width:52px;padding-left:10px;padding-right:10px}.voice-search-label{display:none}.voice-search-icon{font-size:1.05rem} }
@media (prefers-reduced-motion:reduce){ .voice-search-btn.listening{animation:none} }

/* v5.9.8 voice permission recovery */
.voice-search-btn.listening { touch-action: manipulation; }

/* v5.9.9 Schedule Scan Import */
.schedule-scan-modal[hidden]{display:none!important}.schedule-scan-modal{position:fixed;inset:0;z-index:1200;display:grid;place-items:center;padding:18px}.schedule-scan-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.62);backdrop-filter:blur(2px)}.schedule-scan-card{position:relative;z-index:1;width:min(920px,100%);max-height:calc(100vh - 36px);overflow:auto;margin:0}.schedule-scan-title-row{position:sticky;top:-1px;z-index:4;background:var(--surface);padding-bottom:10px;border-bottom:1px solid var(--line)}.schedule-scan-progress{display:flex;align-items:center;gap:14px;padding:20px 0}.schedule-scan-spinner{width:28px;height:28px;flex:0 0 auto;border:3px solid var(--line);border-top-color:var(--target-red);border-radius:50%;animation:scheduleScanSpin .8s linear infinite}@keyframes scheduleScanSpin{to{transform:rotate(360deg)}}.schedule-scan-summary{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:12px 0 4px}.schedule-scan-summary p{margin:0;font-weight:900}.schedule-scan-help{margin:8px 0 12px;font-size:.82rem}.schedule-scan-rows{display:grid;gap:10px}.schedule-scan-row{display:grid;grid-template-columns:auto minmax(0,1fr);gap:10px;align-items:start;padding:12px;border:1px solid var(--line);border-radius:14px;background:var(--surface)}.schedule-scan-row.is-duplicate{border-color:rgba(198,40,40,.45)}.schedule-scan-select{padding-top:26px}.schedule-scan-select input{width:20px;height:20px}.schedule-scan-row-main{min-width:0}.schedule-scan-person-line{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:end}.schedule-scan-time-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:8px}.schedule-scan-row label{display:grid;gap:5px}.schedule-scan-row label>span{font-size:.74rem;font-weight:900;color:var(--muted)}.schedule-scan-footer{justify-content:flex-end;margin-top:16px}.danger-pill{background:rgba(198,40,40,.12);color:#c62828;border-color:rgba(198,40,40,.28)}body.modal-open{overflow:hidden}@media(max-width:700px){.schedule-scan-modal{padding:0;place-items:stretch}.schedule-scan-card{width:100%;max-height:100vh;min-height:100vh;border-radius:0;padding:14px}.schedule-scan-summary{align-items:stretch;flex-direction:column}.schedule-scan-summary .action-row{display:grid;grid-template-columns:minmax(0,1fr) auto}.schedule-scan-person-line{grid-template-columns:1fr}.schedule-scan-time-grid{grid-template-columns:1fr 1fr}.schedule-scan-time-grid label:last-child{grid-column:1/-1}.schedule-scan-footer{display:grid;grid-template-columns:1fr 1fr}}@media(prefers-reduced-motion:reduce){.schedule-scan-spinner{animation:none}}

/* v5.9.10: Print Schedule prints only the Team Schedule section */
@media print {
  #schedulePlanner > :not(.schedule-card) {
    display: none !important;
  }

  #schedulePlanner .schedule-card {
    width: 100% !important;
    margin: 0 !important;
    padding: 14px !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  /* Print the clean Team Schedule list only, not the duplicate editing table. */
  #schedulePlanner .schedule-card .schedule-mobile-cards,
  #schedulePlanner .schedule-card .table-wrap {
    display: none !important;
  }

  #schedulePlanner .schedule-compact-list,
  #schedulePlanner #scheduleCompactList {
    display: grid !important;
    width: 100% !important;
    margin: 6px 0 0 !important;
  }

  #schedulePlanner .schedule-compact-row {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* v5.9.11: Team Schedule role column + stronger print/readability hierarchy */
#scheduleCompactList .schedule-compact-row,
#schedulePlanner .schedule-compact-row {
  grid-template-columns:
    minmax(90px, 1.25fr)
    minmax(62px, .8fr)
    minmax(82px, 1fr)
    minmax(42px, .55fr)
    minmax(52px, .68fr)
    minmax(42px, .55fr);
}

#scheduleCompactList .schedule-compact-head,
#schedulePlanner .schedule-compact-head {
  color: #000;
  font-size: 0.75rem;
  font-weight: 950;
  letter-spacing: 0.035em;
}

#scheduleCompactList .compact-person strong,
#schedulePlanner .compact-person strong {
  color: #000;
  font-weight: 950;
}

#scheduleCompactList .compact-role,
#schedulePlanner .compact-role {
  color: #1b7f3a;
  font-weight: 950;
}

#scheduleCompactList .compact-break,
#scheduleCompactList .compact-lunch,
#schedulePlanner .compact-break,
#schedulePlanner .compact-lunch {
  color: #000;
  font-weight: 950;
}

@media (max-width: 520px) {
  #scheduleCompactList .schedule-compact-row,
  #schedulePlanner .schedule-compact-row {
    grid-template-columns:
      minmax(62px, 1.1fr)
      minmax(46px, .72fr)
      minmax(58px, .86fr)
      minmax(30px, .44fr)
      minmax(40px, .56fr)
      minmax(30px, .44fr);
    gap: 3px;
  }

  #scheduleCompactList .schedule-compact-head,
  #schedulePlanner .schedule-compact-head {
    font-size: 0.62rem;
  }
}

@media print {
  #schedulePlanner .schedule-compact-row {
    grid-template-columns:
      minmax(110px, 1.3fr)
      minmax(80px, .85fr)
      minmax(92px, 1fr)
      minmax(54px, .55fr)
      minmax(68px, .7fr)
      minmax(54px, .55fr) !important;
    gap: 10px !important;
    font-size: 11pt !important;
  }

  #schedulePlanner .schedule-compact-head {
    color: #000 !important;
    font-size: 10pt !important;
    font-weight: 950 !important;
  }

  #schedulePlanner .compact-person strong {
    color: #000 !important;
    font-weight: 950 !important;
  }

  #schedulePlanner .compact-role {
    color: #1b7f3a !important;
    font-weight: 950 !important;
  }

  #schedulePlanner .compact-break,
  #schedulePlanner .compact-lunch {
    color: #000 !important;
    font-weight: 950 !important;
  }
}

/* v5.9.11: Team Schedule title emphasis */
#schedulePlanner .schedule-card > .card-title-row h3 {
  color: #000;
  font-size: 1.35rem;
  font-weight: 950;
}

@media print {
  #schedulePlanner .schedule-card > .card-title-row h3 {
    color: #000 !important;
    font-size: 16pt !important;
    font-weight: 950 !important;
  }
}


/* v5.9.12: Schedule action buttons remain usable on desktop and mobile. */
#schedulePlanner .section-head .action-row {
  flex-wrap: wrap;
}

@media (max-width: 700px) {
  #schedulePlanner .section-head .action-row {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  #schedulePlanner .section-head .action-row > button {
    width: 100%;
    min-width: 0;
  }
}

@media print {
  #previewScheduleBtn {
    display: none !important;
  }
}

/* v5.9.13: Improve Team Schedule readability in dark mode without affecting preview/print documents. */
body.dark-mode #schedulePlanner .schedule-card {
  background: #181b23;
  border-color: #3b4150;
}

body.dark-mode #schedulePlanner .schedule-card > .card-title-row h3 {
  color: #ffffff;
}

body.dark-mode #scheduleCompactList .schedule-compact-row,
body.dark-mode #schedulePlanner .schedule-compact-row {
  background: #20242e;
  border-color: #3b4150;
  color: #f7f7fb;
}

body.dark-mode #scheduleCompactList .schedule-compact-head,
body.dark-mode #schedulePlanner .schedule-compact-head {
  background: #292e3a;
  border-color: #464d5d;
  color: #ffffff;
}

body.dark-mode #scheduleCompactList .compact-person strong,
body.dark-mode #schedulePlanner .compact-person strong,
body.dark-mode #scheduleCompactList .compact-break,
body.dark-mode #scheduleCompactList .compact-lunch,
body.dark-mode #schedulePlanner .compact-break,
body.dark-mode #schedulePlanner .compact-lunch {
  color: #ffffff;
}

body.dark-mode #scheduleCompactList .compact-role,
body.dark-mode #schedulePlanner .compact-role {
  color: #61d891;
}

body.dark-mode #scheduleCompactList .compact-shift,
body.dark-mode #schedulePlanner .compact-shift {
  color: #ff7b7b;
}


/* v5.9.16: compact mobile Team Schedule layout */
.compact-person-role-mobile {
  display: none;
}

@media (max-width: 520px) {
  #scheduleCompactList .schedule-compact-row,
  #schedulePlanner .schedule-compact-row {
    grid-template-columns:
      minmax(94px, 1.55fr)
      minmax(62px, 1fr)
      minmax(42px, .68fr)
      minmax(52px, .82fr)
      minmax(42px, .68fr);
    gap: 2px;
    padding: 5px 3px;
    font-size: 0.72rem;
  }

  #scheduleCompactList .compact-desktop-name,
  #scheduleCompactList .compact-desktop-role,
  #schedulePlanner .compact-desktop-name,
  #schedulePlanner .compact-desktop-role {
    display: none !important;
  }

  #scheduleCompactList .compact-person-role-mobile,
  #schedulePlanner .compact-person-role-mobile {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #000;
    font-style: normal;
  }

  #scheduleCompactList .compact-person-role-mobile strong,
  #schedulePlanner .compact-person-role-mobile strong {
    color: #000;
    font-weight: 950;
  }

  #scheduleCompactList .compact-person-role-mobile b,
  #schedulePlanner .compact-person-role-mobile b {
    color: var(--muted);
    font-weight: 800;
  }

  #scheduleCompactList .compact-person-role-mobile em,
  #schedulePlanner .compact-person-role-mobile em {
    color: #1b7f3a;
    font-style: normal;
    font-weight: 950;
  }

  #scheduleCompactList .compact-person-role-mobile .compact-note,
  #schedulePlanner .compact-person-role-mobile .compact-note {
    display: none;
  }

  #scheduleCompactList .schedule-compact-head,
  #schedulePlanner .schedule-compact-head {
    font-size: 0.56rem;
    letter-spacing: 0.02em;
  }

  #scheduleCompactList .compact-shift,
  #schedulePlanner .compact-shift,
  #scheduleCompactList .compact-break,
  #scheduleCompactList .compact-lunch,
  #schedulePlanner .compact-break,
  #schedulePlanner .compact-lunch {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
  }

  body.dark-mode #scheduleCompactList .compact-person-role-mobile,
  body.dark-mode #schedulePlanner .compact-person-role-mobile,
  body.dark-mode #scheduleCompactList .compact-person-role-mobile strong,
  body.dark-mode #schedulePlanner .compact-person-role-mobile strong {
    color: #fff;
  }

  body.dark-mode #scheduleCompactList .compact-person-role-mobile em,
  body.dark-mode #schedulePlanner .compact-person-role-mobile em {
    color: #61d891;
  }
}
