:root {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --text: #172033;
  --muted: #64748b;
  --line: #dbe3ef;
  --blue: #123d75;
  --blue2: #1d5fa7;
  --red: #b4232a;
  --red2: #8c1d23;
  --gold: #c99d2e;
  --green: #157347;
  --shadow: 0 18px 45px rgba(19, 41, 75, 0.11);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

body {
  overflow: hidden;
}

button, input, textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
}

.side-nav {
  background: linear-gradient(180deg, #0e294e 0%, #091827 100%);
  color: white;
  padding: 24px 18px;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,.09);
}

.brand-block {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 26px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--radius);
  background: rgba(255,255,255,.06);
}

.logo-mark {
  height: 54px;
  width: 54px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  font-weight: 900;
  letter-spacing: -1px;
  background:
    radial-gradient(circle at top left, #ffffff 0, #dbeafe 18%, transparent 19%),
    linear-gradient(135deg, var(--red), #163d70 55%, #0b1320);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 900;
}

.brand-subtitle {
  font-size: .83rem;
  color: #bfdbfe;
}

nav {
  display: grid;
  gap: 8px;
}

.nav-btn {
  width: 100%;
  text-align: left;
  border: 0;
  padding: 13px 14px;
  border-radius: 14px;
  cursor: pointer;
  color: #dbeafe;
  background: transparent;
  transition: .18s ease;
  font-weight: 750;
}

.nav-btn:hover,
.nav-btn.active {
  background: rgba(255,255,255,.12);
  color: #fff;
}

.status-box {
  margin-top: 24px;
  padding: 16px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
}

.status-label {
  color: #bfdbfe;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: 8px;
}

.status-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(36, 180, 126, .14);
  color: #bbf7d0;
  border: 1px solid rgba(187, 247, 208, .22);
  font-weight: 800;
  font-size: .82rem;
}

.status-box p {
  color: #dbeafe;
  line-height: 1.45;
  font-size: .86rem;
  margin-bottom: 0;
}

.main-content {
  height: 100vh;
  overflow-y: auto;
  padding: 28px 30px 46px;
}

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

.eyebrow,
.section-kicker {
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 900;
  font-size: .76rem;
  margin-bottom: 10px;
}

.section-kicker.spaced {
  margin-top: 20px;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: .95;
  letter-spacing: -0.055em;
  margin-bottom: 10px;
}

h2 {
  font-size: clamp(1.35rem, 2vw, 2.2rem);
  letter-spacing: -0.035em;
  margin-bottom: 12px;
}

h3 {
  font-size: 1.08rem;
  margin-bottom: 8px;
}

p {
  line-height: 1.65;
}

.topbar p {
  max-width: 900px;
  color: var(--muted);
  font-size: 1.04rem;
}

.top-actions,
.button-row,
.row-between {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.row-between {
  justify-content: space-between;
  margin-bottom: 14px;
}

button,
.file-label {
  border: 0;
  border-radius: 13px;
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 850;
  box-shadow: none;
}

.primary {
  background: linear-gradient(135deg, var(--blue), var(--blue2));
  color: white;
}

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

.add-btn {
  background: #eef4ff;
  color: var(--blue);
  border: 1px solid #cfddf5;
}

.danger-btn {
  background: #fff1f2;
  color: var(--red2);
  border: 1px solid #fecdd3;
}

.file-label {
  display: inline-flex;
  background: #f8fafc;
  color: var(--blue);
  border: 1px dashed #9bb5d6;
  align-items: center;
}

.file-label input {
  display: none;
}

.alert-strip {
  padding: 15px 18px;
  border: 1px solid #f3d899;
  background: #fff9e7;
  color: #694800;
  border-radius: var(--radius);
  margin-bottom: 18px;
  line-height: 1.55;
}

.page {
  display: none;
}

.active-page {
  display: block;
}

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

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

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

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  overflow: hidden;
}

.hero-card {
  background:
    linear-gradient(135deg, rgba(18,61,117,.08), rgba(180,35,42,.05)),
    #fff;
}

.impact-card {
  border-color: rgba(180,35,42,.19);
}

.impact-list {
  display: grid;
  gap: 12px;
}

.impact-list > div {
  padding: 16px;
  border-radius: 15px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.impact-num {
  display: block;
  color: var(--red);
  font-weight: 950;
  font-size: 1.38rem;
  letter-spacing: -0.03em;
  outline: none;
}

.impact-list small {
  color: var(--muted);
  font-weight: 700;
}

.signature-line {
  margin-top: 18px;
  padding: 13px 15px;
  background: #f8fafc;
  border: 1px dashed #b8c6db;
  border-radius: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.signature-line span {
  color: var(--muted);
  font-weight: 800;
}

.card.mini {
  min-height: 180px;
}

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

textarea {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  line-height: 1.55;
  color: var(--text);
  background: #fbfdff;
}

#summaryTextarea {
  min-height: 220px;
}

.story-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.story-card {
  border: 1px solid var(--line);
  background: #fbfdff;
  border-radius: 16px;
  padding: 17px;
  position: relative;
}

.story-card .step {
  height: 34px;
  width: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 950;
  color: white;
  background: var(--blue);
  margin-bottom: 10px;
}

.story-card h3,
.story-card p {
  outline: none;
}

.delete-mini {
  position: absolute;
  right: 9px;
  top: 9px;
  padding: 5px 8px;
  border-radius: 10px;
  background: #fff1f2;
  color: var(--red);
  border: 1px solid #fecdd3;
}

.cause-map {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}

.cause-node {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 17px;
  min-height: 150px;
}

.cause-node.danger {
  border-color: rgba(180,35,42,.26);
  background: #fff7f7;
}

.arrow {
  color: var(--red);
  font-size: 1.7rem;
  font-weight: 950;
}

.table-wrap {
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 850px;
  background: white;
}

th, td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

th {
  background: #f1f5f9;
  color: #334155;
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

td[contenteditable="true"] {
  outline: none;
}

td[contenteditable="true"]:focus,
[contenteditable="true"]:focus,
textarea:focus {
  box-shadow: inset 0 0 0 2px rgba(29, 95, 167, .22);
}

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

.evidence-card {
  border: 1px solid var(--line);
  background: #fbfdff;
  border-radius: 16px;
  padding: 16px;
  position: relative;
  min-height: 190px;
}

.evidence-card h3 {
  padding-right: 34px;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: .75rem;
  font-weight: 900;
  background: #eef4ff;
  color: var(--blue);
  border: 1px solid #cfddf5;
  margin-bottom: 10px;
}

.question-list,
.check-grid {
  display: grid;
  gap: 12px;
}

.question-list label,
.check-grid label {
  display: flex;
  gap: 10px;
  line-height: 1.45;
  padding: 12px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: #fbfdff;
}

.language-bank {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.copy-chip {
  background: #f8fafc;
  color: #26364d;
  border: 1px solid var(--line);
}

.total-box {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  font-size: 1.1rem;
}

.total-box strong {
  color: var(--red);
  font-size: 1.4rem;
}

.footer-note {
  color: var(--muted);
  font-size: .9rem;
  padding: 10px 4px 0;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: #10233d;
  color: white;
  padding: 12px 16px;
  border-radius: 13px;
  opacity: 0;
  transform: translateY(12px);
  transition: .22s ease;
  box-shadow: var(--shadow);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

body.readonly [contenteditable="true"],
body.readonly textarea,
body.readonly td[contenteditable="true"] {
  pointer-events: none;
  background: transparent;
}

body.readonly .add-btn,
body.readonly .delete-mini {
  display: none;
}

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

  body {
    overflow: auto;
  }

  .side-nav {
    height: auto;
    max-height: 42vh;
  }

  .main-content {
    height: auto;
    overflow: visible;
  }

  .grid.two,
  .grid.three,
  .story-flow,
  .evidence-grid {
    grid-template-columns: 1fr;
  }

  .cause-map {
    grid-template-columns: 1fr;
  }

  .arrow {
    transform: rotate(90deg);
    text-align: center;
  }
}

@media print {
  body {
    overflow: visible;
    background: white;
  }

  .app-shell {
    display: block;
  }

  .side-nav,
  .top-actions,
  .add-btn,
  .delete-mini,
  .footer-note,
  .toast {
    display: none !important;
  }

  .main-content {
    height: auto;
    overflow: visible;
    padding: 0;
  }

  .page {
    display: block !important;
    break-after: page;
  }

  .card {
    box-shadow: none;
    border: 1px solid #999;
    break-inside: avoid;
  }
}


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

.case-thread {
  border: 1px solid var(--line);
  background: #fbfdff;
  border-radius: 16px;
  padding: 16px;
  position: relative;
  min-height: 230px;
}

.case-thread h3,
.case-thread p,
.case-thread .thread-tag {
  outline: none;
}

.thread-tag {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: .75rem;
  font-weight: 900;
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
  margin-bottom: 10px;
}

.thread-meta {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: .9rem;
}

#claimsTable {
  min-width: 1250px;
}

@media (max-width: 1100px) {
  .case-library {
    grid-template-columns: 1fr;
  }
}


#monica .hero-card {
  background:
    linear-gradient(135deg, rgba(180,35,42,.07), rgba(18,61,117,.07)),
    #fff;
}

#monicaFilesTable {
  min-width: 1050px;
}


/* V2.2 Active Console Enhancements */
.custom-scroll,
.main-content,
.side-nav,
.card,
.table-wrap,
.popup-body {
  scrollbar-width: thin;
  scrollbar-color: #8aa9cf #eef4ff;
}

.custom-scroll::-webkit-scrollbar,
.main-content::-webkit-scrollbar,
.side-nav::-webkit-scrollbar,
.card::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar,
.popup-body::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.custom-scroll::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb,
.side-nav::-webkit-scrollbar-thumb,
.card::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb,
.popup-body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #123d75, #b4232a);
  border-radius: 999px;
}

.custom-scroll::-webkit-scrollbar-track,
.main-content::-webkit-scrollbar-track,
.side-nav::-webkit-scrollbar-track,
.card::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track,
.popup-body::-webkit-scrollbar-track {
  background: #eef4ff;
  border-radius: 999px;
}

.glow {
  box-shadow: 0 0 0 3px rgba(29, 95, 167, .12), 0 12px 30px rgba(18, 61, 117, .2);
}

.active-console-strip {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(260px, 380px) 1fr;
  gap: 14px;
  align-items: end;
  padding: 14px;
  margin-bottom: 18px;
  border: 1px solid rgba(18,61,117,.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px rgba(19, 41, 75, .08);
}

.quick-search label {
  display: block;
  color: var(--blue);
  font-size: .75rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 950;
  margin-bottom: 6px;
}

.quick-search input,
.section-filter {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 11px 13px;
  background: #fbfdff;
  color: var(--text);
  outline: none;
}

.quick-search input:focus,
.section-filter:focus {
  box-shadow: 0 0 0 3px rgba(29,95,167,.15);
  border-color: #9bb5d6;
}

.quick-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.popup-tab {
  background: #eef4ff;
  color: var(--blue);
  border: 1px solid #cfddf5;
  white-space: nowrap;
}

.popup-tab:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(18, 61, 117, .12);
}

.section-filter {
  margin-top: 10px;
  max-width: 420px;
}

.table-wrap {
  max-height: 58vh;
  overflow: auto;
}

.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 4;
}

.evidence-grid,
.case-library,
.story-flow,
.question-list,
.check-grid {
  max-height: 62vh;
  overflow: auto;
  padding-right: 8px;
}

textarea {
  max-height: 60vh;
  overflow: auto;
}

.card.scroll-card {
  max-height: 70vh;
  overflow: auto;
}

.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 15, 29, .72);
  padding: 24px;
}

.popup-overlay.show {
  display: flex;
}

.popup-window {
  width: min(1180px, 96vw);
  height: min(820px, 92vh);
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 35px 90px rgba(0, 0, 0, .38);
  border: 1px solid rgba(255,255,255,.18);
  display: grid;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
}

.popup-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(18,61,117,.08), rgba(180,35,42,.05)),
    #fff;
}

.popup-header h2 {
  margin-bottom: 0;
}

.popup-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.popup-tabbar {
  display: flex;
  gap: 8px;
  padding: 12px 22px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.popup-inner-tab {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--blue);
}

.popup-inner-tab.active {
  background: linear-gradient(135deg, var(--blue), var(--blue2));
  color: #fff;
}

.popup-body {
  overflow: auto;
  padding: 22px;
  background: #f5f8fc;
}

.popup-panel {
  display: none;
}

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

.popup-record-grid {
  display: grid;
  gap: 12px;
}

.popup-record {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 15px;
}

.popup-record strong {
  color: var(--blue);
}

.popup-note-area {
  width: 100%;
  min-height: 320px;
}

.search-hit {
  outline: 3px solid rgba(201,157,46,.42);
  background: #fff9e7 !important;
}

.hidden-by-filter {
  display: none !important;
}

.floating-tools {
  position: fixed;
  right: 20px;
  bottom: 82px;
  z-index: 1500;
  display: grid;
  gap: 10px;
}

.float-btn {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--blue), var(--blue2));
  color: #fff;
  border: 1px solid rgba(255,255,255,.24);
  box-shadow: 0 12px 26px rgba(18, 61, 117, .26);
  padding: 0;
}

.result-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff7ed;
  color: #9a3412;
  font-size: .82rem;
  font-weight: 850;
  border: 1px solid #fed7aa;
  margin-top: 8px;
}

@media (max-width: 1100px) {
  .active-console-strip {
    position: static;
    grid-template-columns: 1fr;
  }

  .quick-tabs {
    justify-content: flex-start;
  }

  .popup-overlay {
    padding: 10px;
  }

  .popup-window {
    height: 94vh;
    width: 98vw;
  }

  .popup-header {
    display: block;
  }

  .popup-actions {
    margin-top: 10px;
  }
}

@media print {
  .active-console-strip,
  .popup-overlay,
  .floating-tools {
    display: none !important;
  }
}


/* V2.3 Job-House Leverage / Demeanor Pattern */
#leverage .hero-card {
  background:
    linear-gradient(135deg, rgba(180,35,42,.08), rgba(18,61,117,.08)),
    #fff;
}

#leverageTable,
#demeanorTable {
  min-width: 1350px;
}

#leverage textarea {
  min-height: 280px;
}


/* V2.4 Aerial Mapping */
#mapping .hero-card {
  background:
    linear-gradient(135deg, rgba(18,61,117,.08), rgba(201,157,46,.08)),
    #fff;
}

.mapping-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.map-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 12px;
  background: #eef4ff;
  color: var(--blue);
  text-decoration: none;
  border: 1px solid #cfddf5;
  font-weight: 800;
}

.map-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(18, 61, 117, .12);
}

.map-note {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdff;
  margin-bottom: 14px;
}

.map-frame-wrap {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  min-height: 480px;
}

.property-map-frame {
  display: block;
  width: 100%;
  height: 560px;
  border: 0;
  background: #f3f6fb;
}

#mappingFilesTable {
  min-width: 1200px;
}


/* V2.5 House History / Public Records */
#history .hero-card {
  background:
    linear-gradient(135deg, rgba(18,61,117,.09), rgba(201,157,46,.07), rgba(180,35,42,.05)),
    #fff;
}

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

.property-fact-grid div {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fbfdff;
}

.property-fact-grid span {
  display: block;
  color: var(--muted);
  font-weight: 800;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 6px;
}

.property-fact-grid strong {
  display: block;
  color: var(--blue);
  line-height: 1.35;
}

#houseHistoryTable,
#entityRecordsTable,
#parcelTrackerTable,
#publicSourcesTable {
  min-width: 1250px;
}

#publicSourcesTable td:nth-child(3) {
  word-break: break-all;
}


/* V2.6 Photo Metadata Evidence */
#photos .hero-card {
  background:
    linear-gradient(135deg, rgba(18,61,117,.09), rgba(180,35,42,.05), rgba(21,115,71,.06)),
    #fff;
}

.drop-zone {
  border: 2px dashed #9bb5d6;
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  background: #fbfdff;
  transition: .18s ease;
}

.drop-zone.drag-over {
  border-color: var(--blue2);
  background: #eef4ff;
  transform: translateY(-1px);
}

.drop-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.big-file-label {
  margin-top: 10px;
  justify-content: center;
}

.photo-year-timeline {
  max-height: 48vh;
  overflow: auto;
  display: grid;
  gap: 14px;
  padding-right: 8px;
}

.photo-year-group {
  border: 1px solid var(--line);
  background: #fbfdff;
  border-radius: 16px;
  padding: 16px;
}

.photo-year-group h3 {
  color: var(--blue);
  margin-bottom: 10px;
}

.photo-year-items {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.photo-year-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  padding: 12px;
  font-size: .9rem;
  overflow-wrap: anywhere;
}

.photo-signal-good {
  color: #157347;
  font-weight: 900;
}

.photo-signal-warn {
  color: #9a3412;
  font-weight: 900;
}

.photo-signal-bad {
  color: #b4232a;
  font-weight: 900;
}

#photoMetadataTable {
  min-width: 1800px;
}

#photoMetadataTable td:nth-child(9) {
  font-family: Consolas, Monaco, monospace;
  font-size: .78rem;
  word-break: break-all;
}

@media (max-width: 1100px) {
  .photo-year-items {
    grid-template-columns: 1fr;
  }
}


/* V2.7 Image preview / popup */
.photo-preview-gallery {
  max-height: 50vh;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding-right: 8px;
}

.photo-preview-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(19, 41, 75, .06);
}

.photo-preview-thumb-wrap {
  aspect-ratio: 4 / 3;
  background: #eef4ff;
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
}

.photo-preview-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .18s ease;
}

.photo-preview-thumb-wrap:hover .photo-preview-thumb {
  transform: scale(1.03);
}

.photo-preview-empty {
  padding: 16px;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.photo-preview-info {
  padding: 12px;
  font-size: .9rem;
  overflow-wrap: anywhere;
}

.photo-preview-info strong {
  color: var(--blue);
}

.table-photo-preview {
  width: 74px;
  height: 58px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #eef4ff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.table-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.table-photo-preview.empty {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
  cursor: default;
  padding: 4px;
  text-align: center;
}

.image-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(5, 15, 29, .82);
}

.image-preview-overlay.show {
  display: flex;
}

.image-preview-window {
  width: min(1200px, 96vw);
  height: min(900px, 94vh);
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  box-shadow: 0 35px 90px rgba(0, 0, 0, .42);
}

.image-preview-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(18,61,117,.08), rgba(180,35,42,.05)), #fff;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.image-preview-body {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 380px);
  min-height: 0;
}

.image-preview-large {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f5f8fc;
}

.image-preview-meta {
  border-left: 1px solid var(--line);
  padding: 18px;
  overflow: auto;
  background: #fbfdff;
  line-height: 1.55;
}

.image-preview-meta .meta-row {
  padding: 10px 0;
  border-bottom: 1px dashed #d7e2f2;
}

.image-preview-meta .meta-row strong {
  color: var(--blue);
  display: block;
}

@media (max-width: 1200px) {
  .photo-preview-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .photo-preview-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .image-preview-body {
    grid-template-columns: 1fr;
  }
  .image-preview-meta {
    border-left: 0;
    border-top: 1px solid var(--line);
    max-height: 34vh;
  }
}

@media (max-width: 640px) {
  .photo-preview-gallery {
    grid-template-columns: 1fr;
  }
}


/* V2.8 Server Evidence Directory */
#serverdir .hero-card {
  background:
    linear-gradient(135deg, rgba(18,61,117,.09), rgba(21,115,71,.07), rgba(201,157,46,.05)),
    #fff;
}

.server-upload-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfdff;
  display: grid;
  gap: 10px;
}

.server-upload-panel select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 11px 13px;
  background: white;
  color: var(--text);
}

.server-status {
  border-radius: 12px;
  padding: 10px 12px;
  background: #eef4ff;
  border: 1px solid #cfddf5;
  color: var(--blue);
  font-weight: 750;
}

.directory-tree {
  max-height: 48vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfdff;
  padding: 16px;
  font-family: Consolas, Monaco, monospace;
  font-size: .92rem;
  line-height: 1.55;
}

.dir-line {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.dir-folder {
  color: var(--blue);
  font-weight: 900;
}

.dir-file {
  color: #334155;
}

.server-open-link {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 10px;
  background: #eef4ff;
  color: var(--blue);
  border: 1px solid #cfddf5;
  text-decoration: none;
  font-weight: 850;
}

.server-open-link:hover {
  box-shadow: 0 8px 16px rgba(18,61,117,.12);
}

#serverFilesTable {
  min-width: 1500px;
}

#serverFilesTable td:nth-child(7) {
  font-family: Consolas, Monaco, monospace;
  font-size: .78rem;
  word-break: break-all;
}


/* V2.8.1 uploader fix */
.photo-upload-status {
  margin-top: 10px;
  text-align: left;
}


/* V2.8.2 upload diagnostics */
.server-health-badge {
  grid-column: 1 / -1;
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: .82rem;
  font-weight: 900;
  border: 1px solid #fed7aa;
  color: #9a3412;
  background: #fff7ed;
}

.server-health-badge.ok {
  border-color: #bbf7d0;
  color: #157347;
  background: #ecfdf5;
}

.server-health-badge.bad {
  border-color: #fecdd3;
  color: #b4232a;
  background: #fff1f2;
}

.upload-debug-box {
  margin-top: 10px;
  border-radius: 12px;
  padding: 10px 12px;
  background: #0b1320;
  color: #dbeafe;
  font-family: Consolas, Monaco, monospace;
  font-size: .82rem;
  overflow-wrap: anywhere;
}


/* V2.8.3 runtime health/error patch */
.runtime-error-box {
  grid-column: 1 / -1;
  border-radius: 13px;
  padding: 10px 12px;
  background: #fff1f2;
  color: #b4232a;
  border: 1px solid #fecdd3;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.editable-cell {
  min-width: 90px;
  outline: none;
}

.table-delete {
  position: static !important;
  padding: 7px 10px;
}


/* V2.8.4 health hardening */
.tiny-health-btn {
  grid-column: 1 / -1;
  width: fit-content;
  padding: 7px 11px;
  font-size: .82rem;
}
.healthcheck-page {
  min-height: 100vh;
  background: #f3f5f9;
  color: #172033;
  font-family: Segoe UI, Arial, sans-serif;
  display: grid;
  place-items: center;
  padding: 28px;
}
.healthcheck-card {
  width: min(760px, 96vw);
  background: white;
  border: 1px solid #dbe3ef;
  border-radius: 22px;
  box-shadow: 0 18px 45px rgba(19, 41, 75, .11);
  padding: 26px;
}
.healthcheck-status {
  border-radius: 14px;
  padding: 14px;
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.healthcheck-status.ok {
  color: #157347;
  background: #ecfdf5;
  border-color: #bbf7d0;
}
.healthcheck-card a, .healthcheck-card button {
  display: inline-flex;
  margin-top: 12px;
  margin-right: 8px;
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  background: #123d75;
  color: white;
  text-decoration: none;
  font-weight: 850;
  cursor: pointer;
}
.healthcheck-code {
  background: #0b1320;
  color: #dbeafe;
  border-radius: 12px;
  padding: 12px;
  overflow: auto;
  margin-top: 12px;
}


/* V2.8.5 compact left shortcut navigation */
.side-nav {
  padding: 16px 12px;
}

.brand-block {
  gap: 10px;
  margin-bottom: 14px;
  padding: 9px;
  border-radius: 14px;
}

.logo-mark {
  height: 42px;
  width: 42px;
  border-radius: 12px;
  font-size: .92rem;
}

.brand-title {
  font-size: 1.05rem;
  line-height: 1.05;
}

.brand-subtitle {
  font-size: .72rem;
}

nav {
  gap: 4px;
}

.nav-btn {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: .82rem;
  line-height: 1.12;
  font-weight: 780;
}

.status-box {
  margin-top: 14px;
  padding: 11px;
  border-radius: 14px;
}

.status-label {
  font-size: .64rem;
  margin-bottom: 6px;
}

.status-pill {
  padding: 4px 8px;
  font-size: .72rem;
}

.status-box p {
  font-size: .74rem;
  line-height: 1.32;
}

/* Still readable, but fits way more tabs before the sidebar scrolls. */
@media (min-width: 1101px) {
  .side-nav {
    width: 290px;
  }
}


/* V2.9 Temporary Case Explorer */
#explorer .hero-card {
  background:
    linear-gradient(135deg, rgba(18,61,117,.09), rgba(201,157,46,.07), rgba(21,115,71,.06)),
    #fff;
}

.explorer-search-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 190px 220px auto;
  gap: 12px;
  align-items: end;
}

.explorer-label {
  display: block;
  color: var(--blue);
  font-size: .73rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 950;
  margin-bottom: 6px;
}

.explorer-search-input,
.explorer-select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 11px 13px;
  background: #fbfdff;
  color: var(--text);
  outline: none;
}

.explorer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.case-explorer-results,
.case-explorer-saved {
  max-height: 58vh;
  overflow: auto;
  display: grid;
  gap: 12px;
  padding-right: 8px;
}

.explorer-result-card {
  border: 1px solid var(--line);
  background: #fbfdff;
  border-radius: 16px;
  padding: 14px;
  overflow-wrap: anywhere;
}

.explorer-result-card h3 {
  color: var(--blue);
  margin-bottom: 6px;
}

.explorer-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.explorer-badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #cfddf5;
  background: #eef4ff;
  color: var(--blue);
  font-size: .72rem;
  font-weight: 900;
}

.explorer-snippet {
  border-left: 4px solid var(--gold);
  padding: 8px 10px;
  background: #fff9e7;
  border-radius: 0 10px 10px 0;
  font-size: .9rem;
  line-height: 1.45;
  margin: 8px 0;
}

.explorer-open-link {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 10px;
  background: #eef4ff;
  color: var(--blue);
  border: 1px solid #cfddf5;
  text-decoration: none;
  font-weight: 850;
}

#explorerSavedTable {
  min-width: 1450px;
}

@media (max-width: 1200px) {
  .explorer-search-grid {
    grid-template-columns: 1fr;
  }
}


/* V2.10 Case Explorer source manager */
.explorer-search-grid {
  grid-template-columns: minmax(260px, 1fr) 180px 210px 210px auto;
}

.explorer-source-grid {
  display: grid;
  grid-template-columns: minmax(190px, 260px) minmax(280px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.case-explorer-roots {
  max-height: 34vh;
  overflow: auto;
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-right: 8px;
}

.explorer-root-card {
  border: 1px solid var(--line);
  background: #fbfdff;
  border-radius: 16px;
  padding: 13px;
  overflow-wrap: anywhere;
}

.explorer-root-card h3 {
  color: var(--blue);
  margin-bottom: 6px;
}

.explorer-root-card code {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  background: #eef4ff;
  color: #172033;
  margin: 8px 0;
  white-space: pre-wrap;
}

.explorer-root-status-ok {
  color: #157347;
  font-weight: 900;
}

.explorer-root-status-bad {
  color: #b4232a;
  font-weight: 900;
}

@media (max-width: 1200px) {
  .explorer-search-grid,
  .explorer-source-grid {
    grid-template-columns: 1fr;
  }
}


/* V2.11 REALTOR Code / Ethics Links */
#realtorcode .hero-card {
  background:
    linear-gradient(135deg, rgba(18,61,117,.09), rgba(180,35,42,.06), rgba(201,157,46,.07)),
    #fff;
}

.code-link-stack {
  display: grid;
  gap: 10px;
}

#realtorCodeTable {
  min-width: 1450px;
}


/* Cloudflare controlled visibility package — keeps original GolfLinks design */
.hidden-by-visibility {
  display: none !important;
}

.cloud-admin-only {
  display: none;
}

body.cloud-admin-unlocked .cloud-admin-only {
  display: initial;
}

.cloud-control-panel {
  position: fixed;
  inset: 0;
  z-index: 2600;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(5, 15, 29, .76);
}

.cloud-control-panel.show {
  display: flex;
}

.cloud-control-inner {
  width: min(1040px, 96vw);
  max-height: 94vh;
  overflow: auto;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 35px 90px rgba(0, 0, 0, .42);
  border: 1px solid var(--line);
  padding: 22px;
}

.cloud-control-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.cloud-control-login,
.cloud-view-toggle {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 12px;
}

.cloud-control-login label {
  display: block;
  font-weight: 950;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .72rem;
  width: 100%;
}

.cloud-control-login input {
  min-width: 300px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 11px 13px;
  background: #fbfdff;
  color: var(--text);
}

.cloud-section-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.cloud-section-row {
  border: 1px solid var(--line);
  background: #fbfdff;
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 8px;
}

.cloud-section-row label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 950;
  color: var(--blue);
}

.cloud-section-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
}

.cloud-section-row small {
  color: var(--muted);
  line-height: 1.35;
}

.cloud-control-note {
  background: #fff9e7;
  border: 1px solid #f4d98a;
  color: #6b4a00;
  border-radius: 16px;
  padding: 14px;
  margin-top: 16px;
}

.viewer-hidden-badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fff1f2;
  color: var(--red);
  border: 1px solid #fecdd3;
  font-size: .7rem;
  font-weight: 900;
  margin-left: 8px;
}

.server-health-badge.ok {
  border-color: #bbf7d0;
  color: #157347;
  background: #ecfdf5;
}

.server-health-badge.bad {
  border-color: #fecdd3;
  color: #b4232a;
  background: #fff1f2;
}

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


/* V3.1 Daryl/Monica editor login lock */
.editor-login-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: .76rem;
  font-weight: 900;
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.editor-login-status.unlocked {
  border-color: #bbf7d0;
  background: #ecfdf5;
  color: #157347;
}

.editor-login-panel {
  position: fixed;
  inset: 0;
  z-index: 2800;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(5, 15, 29, .76);
}

.editor-login-panel.show {
  display: flex;
}

.editor-login-card {
  width: min(760px, 96vw);
  max-height: 94vh;
  overflow: auto;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 35px 90px rgba(0, 0, 0, .42);
  border: 1px solid var(--line);
  padding: 22px;
}

.login-note {
  color: var(--muted);
  line-height: 1.6;
  margin-top: 0;
}

.login-grid {
  display: grid;
  grid-template-columns: 220px minmax(260px, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.login-grid label {
  display: grid;
  gap: 6px;
  color: var(--blue);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 950;
}

.login-grid input,
.login-grid select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 11px 13px;
  background: #fbfdff;
  color: var(--text);
  letter-spacing: 0;
  text-transform: none;
  font-size: .96rem;
  font-weight: 700;
}

body:not(.editor-unlocked) [contenteditable="true"] {
  outline: none !important;
}

body:not(.editor-unlocked) .cloud-editor-only,
body:not(.editor-unlocked) #openCommandCenterBtn,
body:not(.editor-unlocked) #printBtn,
body:not(.editor-unlocked) #exportBtnTop,
body:not(.editor-unlocked) #editToggle {
  display: none !important;
}

body:not(.editor-unlocked) .table-delete,
body:not(.editor-unlocked) .add-btn,
body:not(.editor-unlocked) .danger-btn.table-delete {
  display: none !important;
}

body.editor-unlocked .cloud-editor-only {
  display: inline-flex !important;
}

.locked-edit-shield {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 2200;
  background: #0b1320;
  color: white;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 850;
  box-shadow: 0 18px 45px rgba(0,0,0,.22);
  display: none;
}

body:not(.editor-unlocked) .locked-edit-shield {
  display: none;
}

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