/* Pakistan Army · Operator Command Panel — web (not Flutter app) */
:root {
  --dk: #0a2010;
  --g1: #0d3320;
  --g2: #1a5c38;
  --g3: #2e7d52;
  --gold: #d4af37;
  --goldf: #f0d060;
  --bg: #f0f4f0;
  --white: #fff;
  --red: #c62828;
  --orange: #e65100;
  --blue: #1565c0;
  --purple: #6a1b9a;
  --teal: #00695c;
  --text: #111;
  --muted: #666;
  --border: #dde8dd;
  --sidebar: 260px;
  --input-border: #ccc;
  --input-radius: 6px;
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Nunito", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

#sidebar {
  width: var(--sidebar);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--dk) 0%, #071510 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(212, 175, 55, 0.15);
}

.sb-header {
  padding: 20px 16px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sb-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sb-logo .ico {
  width: 40px;
  height: 40px;
  background: var(--g2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.sb-brand-sep {
  opacity: 0.75;
  font-weight: 600;
}

.sb-logo .ttl {
  font-family: "Cinzel", serif;
  color: var(--goldf);
  font-size: 0.78rem;
  line-height: 1.3;
}

.sb-logo .sub {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 2px;
}

.sb-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
}

.sb-av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--g2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.sb-un {
  color: white;
  font-size: 0.78rem;
  font-weight: 700;
}

.sb-role {
  font-size: 0.62rem;
  color: var(--gold);
  margin-top: 1px;
}

.sb-sec {
  font-size: 0.58rem;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 14px 16px 6px;
}

nav {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 10px;
}

nav::-webkit-scrollbar {
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.2s;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.82rem;
  font-weight: 700;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.nav-item.active {
  background: rgba(46, 125, 82, 0.25);
  color: var(--goldf);
  border-left-color: var(--gold);
}

.nav-item .ni {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.nav-item .nbadge {
  margin-left: auto;
  background: var(--red);
  color: white;
  font-size: 0.6rem;
  padding: 1px 6px;
  border-radius: 8px;
}

.sb-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 80, 80, 0.7);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
}

.logout-btn:hover {
  background: rgba(255, 0, 0, 0.1);
  color: #ff5252;
}

.classified-tag {
  text-align: center;
  font-size: 0.58rem;
  color: rgba(255, 255, 255, 0.2);
  letter-spacing: 1px;
  margin-top: 8px;
  font-family: "Orbitron", monospace;
}

#main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
}

.topbar-title {
  font-family: "Cinzel", serif;
  font-size: 1rem;
  color: var(--g1);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.global-search-wrap {
  position: relative;
}

.alert-pill {
  background: #ffebee;
  color: var(--red);
  font-size: 0.7rem;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  animation: blink 1.4s infinite;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

.search-top {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5f5f5;
  border-radius: 20px;
  padding: 5px 10px;
  font-size: 0.8rem;
  color: #aaa;
  min-width: 340px;
  border: 1px solid transparent;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.search-top:focus-within {
  background: #fff;
  border-color: rgba(21, 101, 192, 0.32);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
}

.search-top-ico {
  flex-shrink: 0;
  font-size: 0.92rem;
}

.search-top-input {
  flex: 1;
  min-width: 150px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.8rem;
  font-family: "Nunito", sans-serif;
  color: #2f3a2f;
}

.search-top-input::placeholder {
  color: #9ca6a1;
}

.search-top-clear {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: #edf2ef;
  color: #5b6b61;
  cursor: pointer;
  line-height: 1;
  font-size: 0.78rem;
  font-weight: 700;
}

.search-top-clear:hover {
  background: #e2eae5;
  color: #2f3a2f;
}

.global-search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(720px, 82vw);
  max-height: 62vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #dbe5df;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(7, 34, 23, 0.18);
  padding: 8px;
  z-index: 20;
}

.global-search-results-empty {
  padding: 12px;
  text-align: center;
  color: #7f8b84;
  font-size: 0.76rem;
  font-weight: 700;
}

.global-search-item {
  width: 100%;
  text-align: left;
  border: 1px solid #edf2ef;
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
  cursor: pointer;
  font-family: "Nunito", sans-serif;
  margin-bottom: 6px;
}

.global-search-item:hover {
  background: #f6fbf8;
  border-color: #d3e3da;
}

.global-search-item:last-child {
  margin-bottom: 0;
}

.global-search-item-module {
  font-size: 0.63rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #2e7d52;
  font-weight: 800;
}

.global-search-item-title {
  margin-top: 2px;
  font-size: 0.8rem;
  font-weight: 800;
  color: #223229;
}

.global-search-item-sub {
  margin-top: 1px;
  font-size: 0.71rem;
  color: #6f7b74;
}

.content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 20px 24px;
}

.content::-webkit-scrollbar {
  width: 6px;
}

.content::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.page-header h2 {
  font-family: "Cinzel", serif;
  font-size: 1.1rem;
  color: var(--g1);
}

.btn {
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  border: none;
  font-family: "Nunito", sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--g2), var(--dk));
  color: white;
  box-shadow: 0 3px 12px rgba(26, 92, 56, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-red {
  background: linear-gradient(135deg, var(--red), #7f0000);
  color: white;
}

.btn-outline {
  background: white;
  border: 2px solid var(--g2);
  color: var(--g2);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.72rem;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  background: white;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  border-left: 4px solid;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-card .snum {
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
}

.stat-card .slbl {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 700;
}

.stat-card .sico {
  font-size: 1.8rem;
}

button.stat-card.dashboard-stat-nav {
  width: 100%;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
  border: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  border-left: 4px solid;
  transition: box-shadow 0.15s, transform 0.08s;
}

button.stat-card.dashboard-stat-nav:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

button.stat-card.dashboard-stat-nav:active {
  transform: scale(0.99);
}

.report-type-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

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

@media (max-width: 480px) {
  .report-type-row {
    grid-template-columns: 1fr;
  }
}

.report-type-btn {
  font-family: "Nunito", sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid #ddd;
  background: #fff;
  color: #444;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
  text-align: center;
  line-height: 1.25;
}

.report-type-btn:hover {
  border-color: var(--g2);
  background: #f8fdf8;
}

.report-type-btn.active {
  border-color: var(--red);
  background: linear-gradient(180deg, #fff5f5 0%, #fff 100%);
  color: var(--red);
  box-shadow: 0 2px 8px rgba(198, 40, 40, 0.12);
}

.card {
  background: white;
  border-radius: 14px;
  padding: 18px;
  min-width: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  margin-bottom: 14px;
}

.card-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--g1);
  margin-bottom: 14px;
  font-family: "Orbitron", monospace;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

thead tr {
  background: var(--g1);
}

thead th {
  color: rgba(255, 255, 255, 0.85);
  padding: 10px 12px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
}

tbody tr {
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
}

tbody tr:hover {
  background: #f8fdf8;
}

tbody td {
  padding: 10px 12px;
  color: #333;
}

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 8px;
  font-size: 0.62rem;
  font-weight: 800;
}

.tag-red {
  background: #ffebee;
  color: var(--red);
}

.tag-green {
  background: #e8f5ec;
  color: var(--g2);
}

.tag-orange {
  background: #fff3e0;
  color: var(--orange);
}

.tag-blue {
  background: #e3f2fd;
  color: var(--blue);
}

.tag-purple {
  background: #f3e5f5;
  color: var(--purple);
}

.tag-teal {
  background: #e0f2f1;
  color: var(--teal);
}

/* Database — Tashkeel commanders (commanders list only) */
.tashkeel-commanders-table thead th:last-child,
.tashkeel-commanders-table tbody td:last-child {
  text-align: center;
  vertical-align: middle;
}

.tashkeel-commanders-table .db-officer-action-btns {
  justify-content: center;
  width: 100%;
}

/* Database — Tashkeel commanders */
.tashkeel-officers-table tbody tr {
  cursor: default;
}

.tashkeel-officers-table tbody tr:hover {
  background: #f8fdf8;
}

.db-sr-photo-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.db-officer-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(180deg, #e3f2fd 0%, #bbdefb 100%);
  border: 2px solid #90caf9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--blue);
}

.db-officer-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.db-officer-action-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.db-officer-action-btns .btn {
  font-size: 0.65rem;
  padding: 5px 10px;
}

.commander-members-modal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
}

.commander-members-modal-table th,
.commander-members-modal-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.commander-members-modal-table thead th {
  background: #f5f5f5;
  font-weight: 700;
  font-size: 0.68rem;
}

.commander-members-empty {
  text-align: center;
  padding: 24px;
  color: #888;
  font-size: 0.82rem;
}

.db-members-page-sub {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: #666;
  max-width: 640px;
  line-height: 1.45;
}

.personnel-footer--split {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}

.personnel-footer--split .btn-delete-commander {
  margin-right: auto;
}

.tabs {
  display: flex;
  gap: 4px;
  background: #f0f4f0;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 16px;
  width: fit-content;
}

.tab {
  padding: 7px 16px;
  border-radius: 9px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  color: #666;
}

.tab.active {
  background: white;
  color: var(--g1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.module-tile {
  border-radius: 16px;
  padding: 18px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.module-tile:hover {
  transform: translateY(-3px);
}

.module-tile .mico {
  font-size: 1.8rem;
}

.module-tile .mtitle {
  font-size: 0.82rem;
  font-weight: 800;
  color: white;
}

.module-tile .mcnt {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.7);
}

.module-tile .marrow {
  position: absolute;
  top: 12px;
  right: 14px;
  color: rgba(255, 255, 255, 0.4);
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  height: 92px;
  margin-bottom: 8px;
  padding: 6px 2px 0;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(8, 64, 49, 0.04), rgba(8, 64, 49, 0.01));
}

.bc-bar {
  flex: 1;
  border-radius: 10px 10px 3px 3px;
  background: linear-gradient(180deg, var(--g3), var(--g1));
  min-height: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 8px 16px rgba(6, 68, 52, 0.16);
  transition: height 0.35s ease, filter 0.2s ease, transform 0.2s ease;
  animation: dashBarRise 0.4s ease both;
}

.bc-bar.hl {
  background: linear-gradient(180deg, var(--goldf), var(--gold));
}

.bc-bar.is-peak {
  filter: saturate(1.15);
}

.bc-bar.is-low {
  opacity: 0.78;
}

.bc-bar:hover {
  transform: translateY(-2px);
}

.bc-labels {
  display: flex;
  gap: 8px;
}

.bc-label {
  flex: 1;
  font-size: 0.58rem;
  color: #aaa;
  text-align: center;
}

.dash-quick-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid rgba(2, 44, 34, 0.08);
  background: linear-gradient(180deg, #ffffff 0%, #f7fcfa 100%);
  box-shadow: 0 12px 30px rgba(3, 41, 31, 0.1);
  position: relative;
  overflow: hidden;
}

.dash-quick-card::after {
  content: "";
  position: absolute;
  right: -90px;
  top: -90px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(28, 136, 102, 0.1) 0%, rgba(28, 136, 102, 0) 70%);
  pointer-events: none;
}

.dash-quick-summary {
  display: grid;
  grid-template-columns: minmax(140px, 0.9fr) 1.6fr;
  gap: 10px;
  align-items: stretch;
}

.dash-quick-total {
  border: 1px solid rgba(2, 44, 34, 0.12);
  border-radius: 14px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #f5fbf8, #eaf5f0);
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.dash-quick-total-num {
  font-size: 2rem;
  line-height: 1;
  font-weight: 900;
  color: var(--g2);
  letter-spacing: -0.02em;
}

.dash-quick-total-label {
  margin-top: 4px;
  font-size: 0.72rem;
  color: #61736d;
  font-weight: 700;
}

.dash-quick-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 8px;
}

.dash-quick-chip {
  border: 1px solid rgba(2, 44, 34, 0.12);
  border-radius: 12px;
  padding: 9px 10px;
  background: linear-gradient(180deg, #ffffff, #f6faf8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.72rem;
  color: #6d6d6d;
  font-weight: 700;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  position: relative;
}

.dash-quick-chip::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 12px 0 0 12px;
  opacity: 0.3;
}

.dash-quick-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(2, 44, 34, 0.25);
  box-shadow: 0 6px 14px rgba(3, 41, 31, 0.1);
}

.dash-quick-chip strong {
  font-size: 0.95rem;
  color: var(--g1);
}

.dash-quick-chip.is-zero {
  opacity: 0.75;
  background: linear-gradient(180deg, #fbfcfc, #f4f7f6);
}

.dash-quick-chip.is-active {
  border-color: rgba(2, 44, 34, calc(0.18 + (var(--chip-pop, 0.25) * 0.28)));
  box-shadow: 0 6px 14px rgba(3, 41, 31, calc(0.05 + (var(--chip-pop, 0.25) * 0.12)));
}

.dash-quick-chip:nth-child(1)::before {
  background: #0b7f61;
}
.dash-quick-chip:nth-child(2)::before {
  background: #a64900;
}
.dash-quick-chip:nth-child(3)::before {
  background: #0b5aa7;
}
.dash-quick-chip:nth-child(4)::before {
  background: #6a1b9a;
}
.dash-quick-chip:nth-child(5)::before {
  background: #146c43;
}
.dash-quick-chip:nth-child(6)::before {
  background: #a11f2e;
}

.dash-quick-chart-title {
  font-size: 0.74rem;
  font-weight: 700;
  color: #6f7f79;
}

.dash-quick-card .bar-chart {
  margin-top: 4px;
}

.dash-quick-card .bc-bar {
  border-radius: 8px 8px 2px 2px;
}

@keyframes dashBarRise {
  from {
    transform: scaleY(0.3);
    transform-origin: bottom;
    opacity: 0.35;
  }
  to {
    transform: scaleY(1);
    transform-origin: bottom;
    opacity: 1;
  }
}

/* ── Modal base ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: white;
  border-radius: 18px;
  max-width: 800px;
  width: 100%;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal.modal-personnel {
  max-width: min(1180px, 98vw);
  max-height: 92vh;
}

.modal.modal-report-detail {
  max-width: min(880px, 98vw);
  max-height: 88vh;
}

.modal.modal-report-detail.modal-member-record {
  max-width: min(1040px, 98vw);
}

.member-record-readonly-wrap {
  max-height: min(72vh, 680px);
  overflow-y: auto;
  padding-right: 6px;
}

.member-record-readonly-main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 12px;
}

@media (min-width: 768px) {
  .member-record-readonly-main {
    grid-template-columns: 1fr minmax(168px, 208px);
  }
}

.member-record-photo-aside {
  border: 2px dashed #cfd8dc;
  border-radius: 12px;
  background: #fafafa;
  padding: 14px 12px;
  text-align: center;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.member-record-photo-img {
  max-width: 100%;
  max-height: 220px;
  border-radius: 10px;
  object-fit: contain;
}

.member-record-photo-placeholder strong {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #555;
}

.member-record-photo-placeholder .member-record-photo-avatar {
  width: 72px;
  height: 72px;
  margin: 0 auto 4px;
  font-size: 1.1rem;
}

.member-record-photo-caption {
  display: block;
  font-size: 0.72rem;
  color: #888;
}

.member-record-details-empty {
  border-style: dashed;
}

.pf-placeholder {
  color: #999;
  font-style: italic;
  font-weight: 600;
}

.member-record-files .member-record-files-list {
  flex: 1;
  min-width: 0;
}

.member-record-status-grid.profile-fields {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  margin-bottom: 8px;
}

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

@media (min-width: 900px) {
  .report-detail-fields {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

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

.report-detail-section-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--g1);
  margin: 16px 0 8px;
  font-family: "Orbitron", monospace;
}

.report-detail-narrative {
  font-size: 0.8rem;
  line-height: 1.55;
  color: #333;
  background: #f8f8f8;
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid #eee;
}

.member-record-details-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.report-files-box {
  border: 1px solid #eee;
  border-radius: 10px;
  overflow: hidden;
  background: #fafafa;
}

.report-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  font-size: 0.76rem;
}

.report-file-row:last-child {
  border-bottom: none;
}

.report-file-row--readonly {
  justify-content: flex-start;
}

.member-record-files--readonly {
  margin-top: 8px;
}

.member-record-files--readonly .pr-files-slots-row {
  margin-top: 0;
}

.report-file-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.report-file-name {
  font-weight: 800;
  color: #222;
  word-break: break-all;
}

.report-file-info {
  font-size: 0.65rem;
  color: #888;
}

.report-files-empty {
  margin: 0;
  padding: 14px;
  font-size: 0.78rem;
  color: #888;
  text-align: center;
}

.report-detail-actions {
  flex-wrap: wrap;
}

.report-detail-actions-spacer {
  flex: 1;
  min-width: 8px;
}

/* Reports page: Details / View opens full record — comfortable tap targets on small screens */
#p-incidents .card table tbody td:last-child .btn {
  min-height: 40px;
  padding: 8px 14px;
  white-space: nowrap;
}

.report-edit-readonly {
  background: #f0f0f0 !important;
  color: #666 !important;
  cursor: default;
}

.report-edit-files-hint {
  font-size: 0.68rem;
  color: #888;
  margin: 8px 0 0;
  font-style: italic;
}

.report-add-attachments .report-add-attachments-input {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  font-size: 0.8rem;
  border: 1px dashed var(--border);
  border-radius: var(--input-radius);
  background: #fafcfa;
  cursor: pointer;
}

.report-add-attachments-hint {
  margin: 8px 0 0;
  font-size: 0.68rem;
  color: #666;
  line-height: 1.4;
}

.op-table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  white-space: normal;
}

/* Operations table: keep columns compact and visually left-balanced. */
#p-operations .card table {
  table-layout: fixed;
}

#p-operations .card thead th,
#p-operations .card tbody td {
  padding: 10px 8px;
  text-align: left;
  vertical-align: middle;
}

#p-operations .card thead th:nth-child(1),
#p-operations .card tbody td:nth-child(1) {
  width: 8%;
}

#p-operations .card thead th:nth-child(2),
#p-operations .card tbody td:nth-child(2) {
  width: 18%;
}

#p-operations .card thead th:nth-child(3),
#p-operations .card tbody td:nth-child(3) {
  width: 16%;
}

#p-operations .card thead th:nth-child(4),
#p-operations .card tbody td:nth-child(4),
#p-operations .card thead th:nth-child(5),
#p-operations .card tbody td:nth-child(5),
#p-operations .card thead th:nth-child(6),
#p-operations .card tbody td:nth-child(6),
#p-operations .card thead th:nth-child(7),
#p-operations .card tbody td:nth-child(7) {
  width: 8%;
  white-space: nowrap;
}

#p-operations .card thead th:nth-child(8),
#p-operations .card tbody td:nth-child(8) {
  width: 13%;
}

#p-operations .card thead th:nth-child(9),
#p-operations .card tbody td:nth-child(9) {
  width: 10%;
  padding-right: 4px;
}

#p-operations .card tbody td.op-table-actions {
  justify-content: flex-end;
  align-items: flex-end;
  text-align: right;
  padding-right: 2px;
  flex-direction: column;
  gap: 8px;
}

#p-operations .card tbody td.op-table-actions .btn {
  min-width: 88px;
  justify-content: center;
}

#p-operations .card tbody td:nth-child(2),
#p-operations .card tbody td:nth-child(3),
#p-operations .card tbody td:nth-child(8) {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Prism Data — stat cards act as category toggles */
button.stat-card.prism-stat-btn {
  width: 100%;
  margin: 0;
  border: none;
  border-left: 4px solid;
  border-radius: 14px;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.08s, background 0.15s;
}

button.prism-stat-btn:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

button.prism-stat-btn:active {
  transform: scale(0.99);
}

button.prism-stat-btn:focus-visible {
  outline: 2px solid var(--g2);
  outline-offset: 2px;
}

button.prism-stat-btn.prism-stat-btn--active {
  border-left-width: 8px;
  transform: translateY(-1px);
}

button.prism-stat-btn.prism-stat-btn--active[data-prism-type="cdr"] {
  background: linear-gradient(180deg, rgba(106, 27, 154, 0.08) 0%, #fff 100%);
  box-shadow:
    0 0 0 2px rgba(106, 27, 154, 0.35),
    0 6px 18px rgba(106, 27, 154, 0.18);
}
button.prism-stat-btn.prism-stat-btn--active[data-prism-type="ipdr"] {
  background: linear-gradient(180deg, rgba(21, 101, 192, 0.08) 0%, #fff 100%);
  box-shadow:
    0 0 0 2px rgba(21, 101, 192, 0.35),
    0 6px 18px rgba(21, 101, 192, 0.18);
}
button.prism-stat-btn.prism-stat-btn--active[data-prism-type="ops"] {
  background: linear-gradient(180deg, rgba(230, 81, 0, 0.08) 0%, #fff 100%);
  box-shadow:
    0 0 0 2px rgba(230, 81, 0, 0.35),
    0 6px 18px rgba(230, 81, 0, 0.18);
}

/* Operations lifecycle filter cards — share the Prism active-state look
   so clicking "Active" / "Developing" / "Completed" paints the card with
   a tinted background + glow matching the card's left-border colour. */
button.prism-stat-btn.prism-stat-btn--active[data-op-lifecycle="Active"] {
  background: linear-gradient(180deg, rgba(26, 92, 56, 0.08) 0%, #fff 100%);
  box-shadow:
    0 0 0 2px rgba(26, 92, 56, 0.35),
    0 6px 18px rgba(26, 92, 56, 0.18);
}
button.prism-stat-btn.prism-stat-btn--active[data-op-lifecycle="Developing"] {
  background: linear-gradient(180deg, rgba(230, 81, 0, 0.08) 0%, #fff 100%);
  box-shadow:
    0 0 0 2px rgba(230, 81, 0, 0.35),
    0 6px 18px rgba(230, 81, 0, 0.18);
}
button.prism-stat-btn.prism-stat-btn--active[data-op-lifecycle="Completed"] {
  background: linear-gradient(180deg, rgba(21, 101, 192, 0.08) 0%, #fff 100%);
  box-shadow:
    0 0 0 2px rgba(21, 101, 192, 0.35),
    0 6px 18px rgba(21, 101, 192, 0.18);
}

button.prism-stat-btn.prism-stat-btn--active .snum {
  transform: scale(1.04);
  transform-origin: left center;
}
button.prism-stat-btn.prism-stat-btn--active .sico {
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.12));
  transform: scale(1.06);
}

button.prism-stat-btn .snum,
button.prism-stat-btn .sico {
  transition: transform 0.18s ease, filter 0.18s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.modal-title {
  font-family: "Nunito", sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal-title--personnel {
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 0.92rem;
  color: #2d2d2d;
}

.modal-close {
  cursor: pointer;
  font-size: 1.3rem;
  color: #aaa;
  background: none;
  border: none;
  padding: 4px;
  line-height: 1;
}

.modal-body-scroll {
  overflow-y: auto;
  padding: 20px 22px 22px;
  flex: 1;
}

.modal-body-scroll::-webkit-scrollbar {
  width: 6px;
}

.modal-body-scroll::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

/* ── Personnel record form (design match — 5×5 grid + photo column) ── */
.pr-field label {
  display: block;
  font-size: 0.62rem;
  font-weight: 800;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 5px;
}

.pr-field input,
.pr-field select,
.pr-field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--input-border);
  border-radius: var(--input-radius);
  font-size: 0.78rem;
  font-family: "Nunito", sans-serif;
  background: #fafafa;
  outline: none;
}

.pr-field input:focus,
.pr-field select:focus,
.pr-field textarea:focus {
  border-color: var(--g2);
  background: var(--white);
}

.pr-field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.pr-field textarea {
  min-height: 56px;
  resize: vertical;
}

/* Main layout: left = 5×5 fields, right = photo (aligned with full form height) */
.pr-form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(152px, 188px);
  gap: 16px 20px;
  align-items: stretch;
}

.pr-fields-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px 14px;
  align-content: start;
}

.pr-field.pr-field-wide {
  grid-column: 1 / -1 !important;
}

.pr-family-tree-field .pr-family-tree-box {
  border-color: #d7e8de;
}

.pr-family-tree-field [data-family-tree-list="1"]::-webkit-scrollbar {
  width: 6px;
}

.pr-family-tree-field [data-family-tree-list="1"]::-webkit-scrollbar-thumb {
  background: #c9d8cf;
  border-radius: 999px;
}

.pr-cal-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.pr-cal-wrap .pr-date-native {
  width: 100%;
  padding-right: 34px;
  min-height: 36px;
  color-scheme: light;
}

.pr-cal-ico {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #888;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pr-photo-aside {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  min-height: 100%;
}

.pr-photo-frame {
  flex: 1;
  min-height: 280px;
  border: 2px dashed #9e9e9e;
  border-radius: 12px;
  background: #fafcff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.pr-photo-frame:hover {
  border-color: var(--g2);
  background: #f4f9f6;
}

.pr-photo-circle {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: linear-gradient(180deg, #e3f2fd 0%, #bbdefb 100%);
  border: 2px solid #90caf9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pr-photo-silhouette {
  width: 52px;
  height: 52px;
  color: var(--blue);
  opacity: 0.75;
}

.pr-photo-meta {
  text-align: center;
  margin-top: 14px;
  font-size: 0.65rem;
  color: var(--muted);
  line-height: 1.45;
}

.pr-photo-meta strong {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.pr-photo-meta span {
  display: block;
}

@media (max-width: 1024px) {
  .pr-form-layout {
    grid-template-columns: 1fr;
  }

  .pr-photo-aside {
    order: -1;
  }

  .pr-photo-frame {
    min-height: 200px;
    flex-direction: row;
    gap: 20px;
    justify-content: center;
  }

  .pr-photo-meta {
    margin-top: 0;
    text-align: left;
  }

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

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

.pr-status-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
  margin-bottom: 12px;
}

.pr-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  border: 2px solid var(--g2);
  color: var(--g2);
  font-size: 0.72rem;
  font-weight: 800;
  background: #f8fdf8;
}

.pr-status-pill--select {
  margin: 0;
  cursor: default;
}

.pr-status-select {
  min-width: 160px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid var(--g2);
  color: var(--g2);
  font-family: "Nunito", sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  background: #fff;
  cursor: pointer;
  outline: none;
}

.pr-status-select:focus {
  box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.25);
}

.pr-details-block {
  margin-bottom: 16px;
}

.pr-details-block textarea {
  width: 100%;
  min-height: 88px;
  padding: 10px 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--input-radius);
  font-family: "Nunito", sans-serif;
  font-size: 0.8rem;
  background: #fafafa;
  resize: vertical;
  line-height: 1.45;
}

.pr-files-section {
  margin-top: 4px;
}

.pr-files-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.pr-files-toolbar--upload-only {
  justify-content: flex-start;
}

.pr-files-slots-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.pr-files-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #444;
  flex-shrink: 0;
}

.pr-files-slots-row .file-slots {
  flex: 1;
  min-width: 0;
}

.btn-file-dl {
  background: white;
  border: 2px solid var(--g2);
  color: var(--g2);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  font-family: "Nunito", sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-file-up {
  background: linear-gradient(135deg, var(--g2), var(--dk));
  color: white;
  border: none;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  font-family: "Nunito", sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.file-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.file-slot {
  width: 36px;
  height: 36px;
  border: 1.5px solid #90caf9;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--blue);
  background: #fafcff;
  cursor: pointer;
}

.personnel-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid #eee;
}

.personnel-footer .btn-cancel {
  background: white;
  border: 2px solid var(--g2);
  color: var(--g2);
  padding: 10px 22px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: "Nunito", sans-serif;
}

.personnel-footer .btn-save {
  background: linear-gradient(135deg, var(--g2), var(--dk));
  color: white;
  border: none;
  padding: 10px 22px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: "Nunito", sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px;
  border: 1.5px solid #ddd;
  border-radius: 9px;
  font-size: 0.8rem;
  font-family: "Nunito", sans-serif;
}

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

.upload-zone {
  border: 2px dashed #ccc;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  font-size: 0.8rem;
  color: #aaa;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.upload-zone:hover,
.upload-zone:focus {
  border-color: var(--g2, #2e7d32);
  color: #6c7a6c;
  outline: none;
}
.prism-upload-zone--drag {
  border-color: var(--g2, #2e7d32);
  background: rgba(46, 125, 50, 0.06);
  color: #2e7d32;
}
.prism-upload-zone--filled {
  border-style: solid;
  border-color: #b7d3b8;
  background: #f6faf6;
  text-align: left;
  padding: 12px;
  cursor: default;
}
.prism-upload-zone--filled .report-file-row {
  align-items: center;
}
.prism-upload-selected-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.prism-upload-selected-row .report-file-meta {
  flex: 1 1 auto;
  min-width: 0;
}
.prism-upload-selected-row .report-file-meta .report-file-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prism-upload-selected-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
}

/* Inline validation error state used by the Prism Add/Edit forms. */
.form-group.form-field-error > input,
.form-group.form-field-error > select,
.form-group.form-field-error > textarea {
  border-color: #d93025 !important;
  background: #fff7f6;
  box-shadow: 0 0 0 2px rgba(217, 48, 37, 0.12);
}
.form-group.form-field-error > label {
  color: #b02a1f;
}
.form-field-error-msg {
  color: #b02a1f;
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 4px;
  line-height: 1.25;
  display: block;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px solid #eee;
  margin-top: 14px;
}

.ai-hero {
  background: linear-gradient(135deg, var(--dk), #1a237e);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 14px;
  text-align: center;
}

.ai-orb {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--goldf));
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.ai-htitle {
  font-family: "Orbitron", monospace;
  color: white;
  font-size: 0.9rem;
}

.ai-hsub {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 4px;
}

.chat-box {
  height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.msg {
  max-width: 80%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 0.78rem;
  line-height: 1.5;
}

.msg.bot {
  background: #f5f5f5;
  align-self: flex-start;
}

.msg.user {
  background: linear-gradient(135deg, var(--g2), var(--dk));
  color: white;
  align-self: flex-end;
}

.chat-input-row {
  display: flex;
  gap: 8px;
}

.chat-input {
  flex: 1;
  border: 1.5px solid #ddd;
  border-radius: 20px;
  padding: 9px 16px;
  font-size: 0.8rem;
  font-family: "Nunito", sans-serif;
}

.send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--g2), var(--dk));
  color: white;
  border: none;
  cursor: pointer;
}

.ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.ai-chip {
  background: white;
  border: 1.5px solid #ddd;
  border-radius: 16px;
  padding: 5px 12px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--g1);
  cursor: pointer;
}

.zone-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.zone-lbl {
  font-size: 0.7rem;
  font-weight: 700;
  width: 200px;
  flex-shrink: 0;
  line-height: 1.25;
}

.zone-bar {
  flex: 1;
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}

.zone-fill {
  height: 100%;
  border-radius: 4px;
}

.zone-tag {
  width: 70px;
  flex-shrink: 0;
  text-align: right;
}

.profile-fields {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.pf-item {
  background: #f8f8f8;
  border-radius: 9px;
  padding: 8px 10px;
}

.pf-label {
  font-size: 0.6rem;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

.pf-val {
  font-size: 0.78rem;
  font-weight: 700;
}

/* Firebase auth gate — avoid flashing the portal before the operator session is verified */
body.auth-checking {
  visibility: hidden;
}

body.auth-ready {
  visibility: visible;
}

/* ─── Threat response (status boxes + tags) ─── */
.tr-filter-section {
  margin-bottom: 16px;
}

.tr-filter-section-title {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 8px;
}

.tr-status-grid--section {
  margin-bottom: 0;
}

.tr-page-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 12px;
  line-height: 1.45;
}

.tr-page-hint code {
  font-size: 0.68rem;
  background: #f0f0f0;
  padding: 1px 5px;
  border-radius: 4px;
}

.tr-status-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

@media (max-width: 1100px) {
  .tr-status-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .tr-status-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.tr-status-box {
  border-width: 3px;
  border-style: solid;
  border-radius: 6px;
  background: #fff;
  padding: 12px 8px;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 3px;
  letter-spacing: 0.04em;
  cursor: pointer;
  text-align: center;
  line-height: 1.2;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  color: #111;
}

.tr-status-box:hover {
  transform: translateY(-2px);
}

.tr-status-box.is-active {
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.12), 0 6px 14px rgba(0, 0, 0, 0.08);
}

.tr-status-box__line {
  display: block;
}

.tr-status-box__slash {
  display: inline;
  font-weight: 900;
}

.tr-status-box--eliminated {
  border-color: #c62828;
}

.tr-status-box--arrested {
  border-color: #1565c0;
}

.tr-status-box--apprehended {
  border-color: #1565c0;
}

.tr-status-box--active {
  border-color: #7cb342;
}

.tr-status-box--ssg {
  border-color: #d4c77e;
  color: #8d6e3a;
}

.tr-status-box--sst {
  border-color: #b0bec5;
  color: #546e7a;
}

.tr-status-box--tech {
  border-color: #6d4c41;
  color: #4e342e;
}

.tr-status-box--arial {
  border-color: #4682b4;
  color: #2f5f8f;
}

.tr-status-box--aerial {
  border-color: #4682b4;
  color: #2f5f8f;
}

.tr-status-box--actionable {
  border-color: #00897b;
  color: #00695c;
}

.tr-status-box--hot {
  border-color: #c62828;
  color: #b71c1c;
}

.tr-status-box--matured {
  border-color: #26c6da;
  color: #5d4037;
}

.tr-status-box--developing {
  border-color: #f48fb1;
  color: #5d4037;
}

.tr-status-box--all {
  border-color: #424242;
  color: #212121;
}

.tr-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: none;
}

.tr-tag--eliminated {
  background: rgba(198, 40, 40, 0.12);
  color: #b71c1c;
  border: 1px solid rgba(198, 40, 40, 0.35);
}

.tr-tag--arrested {
  background: rgba(21, 101, 192, 0.1);
  color: #0d47a1;
  border: 1px solid rgba(21, 101, 192, 0.35);
}

.tr-tag--apprehended {
  background: rgba(21, 101, 192, 0.1);
  color: #0d47a1;
  border: 1px solid rgba(21, 101, 192, 0.35);
}

.tr-tag--active {
  background: rgba(124, 179, 66, 0.15);
  color: #33691e;
  border: 1px solid rgba(124, 179, 66, 0.4);
}

.tr-tag--ssg {
  background: rgba(212, 199, 126, 0.25);
  color: #6d4c1a;
  border: 1px solid rgba(141, 110, 58, 0.35);
}

.tr-tag--sst {
  background: rgba(176, 190, 197, 0.25);
  color: #455a64;
  border: 1px solid rgba(84, 110, 122, 0.35);
}

.tr-tag--tech {
  background: rgba(109, 76, 65, 0.12);
  color: #4e342e;
  border: 1px solid rgba(109, 76, 65, 0.35);
}

.tr-tag--arial {
  background: rgba(70, 130, 180, 0.12);
  color: #1e4d7a;
  border: 1px solid rgba(70, 130, 180, 0.4);
}

.tr-tag--aerial {
  background: rgba(70, 130, 180, 0.12);
  color: #1e4d7a;
  border: 1px solid rgba(70, 130, 180, 0.4);
}

.tr-tag--actionable {
  background: rgba(0, 137, 123, 0.12);
  color: #00695c;
  border: 1px solid rgba(0, 137, 123, 0.35);
}

.tr-tag--hot {
  background: rgba(198, 40, 40, 0.12);
  color: #b71c1c;
  border: 1px solid rgba(198, 40, 40, 0.35);
}

.tr-tag--matured {
  background: rgba(38, 198, 218, 0.12);
  color: #5d4037;
  border: 1px solid rgba(38, 198, 218, 0.4);
}

.tr-tag--developing {
  background: rgba(244, 143, 177, 0.18);
  color: #5d4037;
  border: 1px solid rgba(244, 143, 177, 0.45);
}

/* ─── Threat Assessment page ─── */
.ta-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ta-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.ta-view-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.ta-view-select {
  min-width: 220px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  background: #fff;
  cursor: pointer;
}

.ta-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-left: auto;
}

.ta-page-title {
  margin: 0;
  font-size: 1.35rem;
}

.ta-zones-card .ta-zone-list {
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.ta-map-card {
  margin-bottom: 14px;
}

.ta-report-card {
  margin-bottom: 12px;
  padding-bottom: 2px;
}

.ta-report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.ta-report-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ta-report-controls input[type="date"] {
  min-width: 170px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  background: #fff;
}

.ta-report-content {
  display: block;
}

.ta-report-block {
  background: #f7f8f9;
  border: 1px solid #e5e8ec;
  border-radius: 10px;
  padding: 10px;
}

.ta-report-block-title {
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: #1e2b35;
}

.ta-report-line {
  font-size: 0.74rem;
  color: #334;
  margin: 5px 0;
}

.ta-report-empty {
  font-size: 0.75rem;
  color: var(--muted);
}

.ta-map-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.ta-map-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 10px;
  line-height: 1.4;
}

.ta-map-frame-wrap {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
  background: #e8e8e8;
  min-height: min(72vh, 820px);
  height: min(72vh, 820px);
}

.ta-map-iframe {
  display: block;
  width: 100%;
  height: 260px;
  border: 0;
}

.ta-map-canvas {
  width: 100%;
  height: 100%;
}

.ta-map-popup {
  max-width: 280px;
  font-size: 0.78rem;
  line-height: 1.35;
}

@media (max-width: 720px) {
  .ta-header-right {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }

  .ta-view-select {
    min-width: 0;
    flex: 1;
  }

  .ta-report-content {
    grid-template-columns: 1fr;
  }
}

/* Reports → Incident table: description one-line + clickable … */
.incident-desc-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 18rem;
  min-width: 6rem;
}

.incident-desc-truncate {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.incident-desc-more {
  flex-shrink: 0;
  margin: 0;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--g2);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  line-height: 1.2;
}

.incident-desc-more:hover {
  color: var(--red);
}

/* Reports + Threat response visual polish */
#p-incidents .card,
#p-commanders .card {
  border: 1px solid #e6ece6;
  box-shadow: 0 6px 18px rgba(9, 30, 20, 0.06);
}

#p-incidents .card table,
#p-commanders .card table {
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

#p-incidents .card thead th,
#p-commanders .card thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  letter-spacing: 0.02em;
  font-weight: 800;
}

#p-incidents .card tbody tr:nth-child(even),
#p-commanders .card tbody tr:nth-child(even) {
  background: #fcfdfc;
}

#p-incidents .card tbody tr:hover,
#p-commanders .card tbody tr:hover {
  background: #f2f8f3;
}

#p-incidents .card tbody td,
#p-commanders .card tbody td {
  vertical-align: top;
  line-height: 1.45;
}

/* Threat response rows: keep text centered vertically. */
#p-commanders .card tbody td {
  vertical-align: middle;
}

/* Action column aligns to row middle like the rest of fields. */
#p-commanders .card tbody td.op-table-actions {
  vertical-align: middle;
  justify-content: center;
}

#p-commanders .op-table-actions {
  text-align: right;
  white-space: normal;
}

#p-commanders .op-table-actions .btn {
  min-width: 88px;
  justify-content: center;
}

/* Threat response (operations-style columns): keep right-side fields aligned and readable. */
#p-commanders table.tr-layout-ops {
  table-layout: fixed;
}

/* Compact threat response rows to reduce excess whitespace. */
#p-commanders table.tr-layout-ops thead th {
  padding: 8px 10px;
}

#p-commanders table.tr-layout-ops tbody td {
  padding: 8px 10px;
}

#p-commanders table.tr-layout-ops thead th:nth-child(1),
#p-commanders table.tr-layout-ops tbody td:nth-child(1) {
  width: 9%;
}

#p-commanders table.tr-layout-ops thead th:nth-child(2),
#p-commanders table.tr-layout-ops tbody td:nth-child(2) {
  width: 20%;
}

#p-commanders table.tr-layout-ops thead th:nth-child(3),
#p-commanders table.tr-layout-ops tbody td:nth-child(3) {
  width: 18%;
}

#p-commanders table.tr-layout-ops thead th:nth-child(4),
#p-commanders table.tr-layout-ops tbody td:nth-child(4) {
  width: 10%;
}

#p-commanders table.tr-layout-ops thead th:nth-child(5),
#p-commanders table.tr-layout-ops tbody td:nth-child(5) {
  width: 8%;
}

#p-commanders table.tr-layout-ops thead th:nth-child(6),
#p-commanders table.tr-layout-ops tbody td:nth-child(6) {
  width: 9%;
}

#p-commanders table.tr-layout-ops thead th:nth-child(7),
#p-commanders table.tr-layout-ops tbody td:nth-child(7) {
  width: 8%;
}

#p-commanders table.tr-layout-ops thead th:nth-child(8),
#p-commanders table.tr-layout-ops tbody td:nth-child(8) {
  width: 13%;
}

#p-commanders table.tr-layout-ops thead th:nth-child(9),
#p-commanders table.tr-layout-ops tbody td:nth-child(9) {
  width: 14%;
}

#p-commanders table.tr-layout-ops tbody td:nth-child(4),
#p-commanders table.tr-layout-ops tbody td:nth-child(5),
#p-commanders table.tr-layout-ops tbody td:nth-child(6),
#p-commanders table.tr-layout-ops tbody td:nth-child(7),
#p-commanders table.tr-layout-ops tbody td:nth-child(9) {
  white-space: nowrap;
}

#p-commanders table.tr-layout-ops tbody td:nth-child(8) {
  vertical-align: middle;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Keep all Threat Response remarks perfectly centered like other columns. */
#p-commanders table tbody td:nth-child(8) {
  vertical-align: middle;
}

#p-commanders .incident-desc-cell {
  display: table-cell;
  vertical-align: middle;
  white-space: nowrap;
}

#p-commanders .incident-desc-cell .incident-desc-truncate {
  display: inline-block;
  vertical-align: middle;
  max-width: calc(100% - 22px);
}

#p-commanders .incident-desc-cell .incident-desc-more {
  display: inline-block;
  vertical-align: middle;
}

#p-commanders table.tr-layout-ops .op-table-actions {
  display: table-cell;
  vertical-align: middle;
  text-align: left;
  width: 14%;
  padding-right: 10px;
}

#p-commanders table.tr-layout-ops td.op-table-actions .btn {
  display: block;
  width: 88px;
  max-width: 100%;
  min-width: 0;
  margin-left: 8px;
  margin-right: 0;
  margin-top: 4px;
}

#p-commanders table.tr-layout-ops td.op-table-actions .btn:first-child {
  margin-top: 0;
}

#p-commanders table.tr-layout-ops td.op-table-actions .tr-add-eliminated-btn {
  width: 124px;
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal;
  line-height: 1.2;
  padding: 6px 9px;
  font-size: 0.68rem;
}

/* Keep date cells compact and legible. */
#p-incidents .card tbody td:nth-child(5),
#p-commanders tbody tr[data-tr-format="operation"] td:nth-child(4) {
  white-space: nowrap;
  font-weight: 700;
  color: #3d4c3d;
}

/* Threat response operation remarks: readable but not overwhelming. */
#p-commanders tbody tr[data-tr-format="operation"] td:nth-child(8) {
  max-width: 360px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Action buttons look cleaner in listing rows. */
#p-incidents .op-table-actions .btn {
  border-radius: 999px;
  min-width: 64px;
  justify-content: center;
  padding: 6px 12px;
  font-weight: 800;
}

/* Additional responsive tuning for tablet/mobile usability */
@media (max-width: 1100px) {
  :root {
    --sidebar: 220px;
  }

  .topbar {
    padding: 0 14px;
  }

  .content {
    padding: 12px;
  }

  .page-header {
    gap: 10px;
  }

  /* Keep reports tables usable on laptop-width screens. */
  #p-incidents .card {
    overflow-x: auto;
  }

  #p-incidents table {
    min-width: 980px;
  }

  /* Keep Threat response table usable on tablet/laptop widths. */
  #p-commanders .card {
    overflow-x: auto;
  }

  #p-commanders table {
    min-width: 920px;
  }
}

@media (max-width: 1024px) {
  /* Collapse sidebar earlier so content area remains practical. */
  :root {
    --sidebar: 88px;
  }

  .sb-logo .ttl,
  .sb-logo .sub,
  .sb-user,
  .sb-sec,
  .classified-tag {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 10px 8px;
    border-left: 0;
    font-size: 0;
  }

  .nav-item .ni {
    margin: 0;
  }

  .logout-btn {
    justify-content: center;
    font-size: 0;
  }

  .content {
    padding: 10px;
  }

  .card {
    padding: 10px;
  }
}

@media (max-width: 900px) {
  .search-top {
    min-width: 220px;
    padding: 5px 8px;
  }

  .stats-row {
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 10px;
  }

  #p-dashboard > div[style*="grid-template-columns:1fr 1fr"],
  #p-threats > div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

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

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

  .page-header h2 {
    font-size: 1.05rem;
  }

  .page-header .btn {
    white-space: nowrap;
  }
}

@media (max-width: 640px) {
  .dash-quick-breakdown {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 460px) {
  .dash-quick-breakdown {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  :root {
    --sidebar: 84px;
  }

  .sb-logo .ttl,
  .sb-logo .sub,
  .sb-user,
  .sb-sec,
  .classified-tag {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 10px 8px;
    border-left: 0;
    font-size: 0;
  }

  .nav-item .ni {
    margin: 0;
  }

  .logout-btn {
    justify-content: center;
    font-size: 0;
  }

  .topbar-title {
    font-size: 0.9rem;
  }

  .topbar-right {
    gap: 8px;
  }

  .card {
    padding: 10px;
  }

  .report-type-row {
    gap: 8px;
  }

  .report-type-btn {
    min-width: 130px;
    font-size: 0.72rem;
  }

  #p-database .card,
  #p-database-members .card,
  #p-incidents .card,
  #p-operations .card,
  #p-cdr .card,
  #p-commanders .card,
  #p-prism-ops-table .card {
    overflow-x: auto;
  }

  #p-database table,
  #p-database-members table,
  #p-incidents table,
  #p-operations table,
  #p-cdr table,
  #p-commanders table,
  #p-prism-ops-table table {
    min-width: 760px;
  }
}

@media (max-width: 560px) {
  .search-top {
    min-width: 160px;
  }

  .search-top-input::placeholder {
    font-size: 0.72rem;
  }

  .global-search-results {
    width: min(96vw, 420px);
    right: -38px;
  }

  .topbar {
    height: auto;
    min-height: 56px;
    padding: 8px 10px;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header .btn {
    width: 100%;
  }

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

  .ta-report-controls {
    width: 100%;
  }

  .ta-report-controls .ta-view-select,
  .ta-report-controls input[type="date"] {
    width: 100%;
    min-width: 0;
  }
}

/* HM — database save status (always visible on HM page) */
.hm-save-status {
  margin: 0 0 12px;
  padding: 11px 14px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.9rem;
  line-height: 1.4;
}
.hm-save-status[data-state="saving"] {
  background: rgba(21, 101, 192, 0.1);
  border: 1px solid rgba(21, 101, 192, 0.35);
  color: #0d47a1;
}
.hm-save-status[data-state="ok"] {
  background: rgba(46, 125, 50, 0.12);
  border: 1px solid rgba(46, 125, 50, 0.45);
  color: #1b5e20;
}
.hm-save-status[data-state="error"] {
  background: rgba(198, 40, 40, 0.12);
  border: 2px solid var(--red);
  color: #5c0000;
}
.hm-inline-save-error,
.hm-modal-db-error {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid var(--red);
  background: rgba(198, 40, 40, 0.1);
  color: #5c0000;
  font-weight: 800;
  font-size: 0.86rem;
  line-height: 1.35;
}
