:root {
  color-scheme: dark;
  --bg: #050f23;
  --panel: #0b1e3d;
  --panel-2: #112a54;
  --text: #e5efff;
  --muted: #9cb4d8;
  --accent: #3b82f6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: radial-gradient(1000px 500px at 10% -20%, #123066 0%, var(--bg) 60%);
  color: var(--text);
}

.app {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.stack {
  display: grid;
  gap: 12px;
}

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

.topbar h1 {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
}

.chip {
  border: 1px solid #1d4ed8;
  color: #bfdbfe;
  background: #0a2146;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
}

.chip-beta {
  border-color: rgba(250, 204, 21, 0.7);
  color: #fde68a;
  background: rgba(181, 83, 0, 0.18);
}

.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid #173b78;
  border-radius: 14px;
  padding: 14px;
}

.panel h2 {
  margin: 0 0 6px;
  font-size: 1rem;
}

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

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.watch-sheet-file-input {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.hint {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

.grid {
  display: grid;
  gap: 10px;
}

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

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

label {
  display: grid;
  gap: 5px;
  color: #c7ddff;
  font-size: 0.78rem;
  letter-spacing: 0.1px;
}

input,
select {
  width: 100%;
  border: 1px solid #315ca2;
  border-radius: 10px;
  background: #081a35;
  color: #dbeafe;
  padding: 10px 11px;
  font: 13px/1.4 Inter, Arial, sans-serif;
  outline: none;
}

input:focus,
select:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding-top: 6px;
}

#pdfEndpoint {
  min-width: min(420px, 100%);
  flex: 1 1 280px;
}

button {
  border: 1px solid #2563eb;
  color: #dbeafe;
  background: linear-gradient(180deg, #1d4ed8, #1e40af);
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.08);
}

.btn-spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(219, 234, 255, 0.35);
  border-top-color: rgba(219, 234, 255, 1);
  display: inline-block;
  margin-left: 10px;
  vertical-align: middle;
  animation: spin 0.9s linear infinite;
}

.btn-spinner[hidden] {
  display: none !important;
}

.outside-value:hover {
  text-decoration: none;
}

button.is-loading .btn-spinner {
  display: inline-block;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.btn-primary-action {
  position: relative;
  min-width: 190px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(147, 197, 253, 0.55);
  background: linear-gradient(180deg, #1f5de3 0%, #1d4ed8 55%, #1a43b7 100%);
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  letter-spacing: 0.2px;
}

.btn-primary-action:hover {
  filter: none;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(17, 24, 39, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn-primary-action:active {
  transform: translateY(0);
}

.btn-primary-action .btn-icon {
  font-size: 0.92rem;
  opacity: 0.95;
}

.btn-primary-action.is-loading {
  cursor: wait;
}

.btn-primary-action.is-loading .btn-icon {
  display: none;
}

.card {
  border: 1px solid #2a5396;
  border-radius: 14px;
  padding: 14px;
  margin-top: 10px;
  background: linear-gradient(180deg, #0b2145, #081b38);
  box-shadow: 0 10px 22px rgba(2, 8, 23, 0.28);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #1b3d79;
}

.card-head strong {
  letter-spacing: 0.2px;
  font-size: 0.98rem;
}

.beat-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.head-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #9cb4d8;
  flex: 0 0 auto;
}

.beat-box {
  font-family: 'Quantico', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.6rem;
  letter-spacing: 0.45px;
  color: #ffffff;
  line-height: 1.0;
  background: #000000;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.beat-title strong:not(.beat-box) {
  color: inherit;
  line-height: inherit;
}

.card-head strong.beat-box {
  /* Override `.card-head strong { font-size: ... }` */
  font-size: 1.6rem;
  letter-spacing: 0.45px;
  line-height: 1.0;
}

.beat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  flex: 1 1 auto;
}

.beat-officers {
  max-width: 44vw;
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  align-items: end;
}

.beat-officers strong {
  color: #e5efff;
  font-size: 1.2rem !important;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.beat-officers > span {
  font-size: 0.64rem;
  color: #9cb4d8;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  line-height: 1;
  margin-bottom: 0;
}

.outside-no-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icc-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.outside-value {
  font-family: 'Quantico', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.6rem !important;
  letter-spacing: 0.45px;
  font-weight: 600 !important;
  color: #f8fbff !important;
  line-height: 1.0 !important;
  text-decoration: none !important;
  display: inline-block;
  vertical-align: middle;
  margin-top: 0;
}

.outside-value.outside-invalid {
  color: #ef4444 !important;
}

.icc-icon {
  color: #9cb4d8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.icc-inline-value {
  font-family: 'Quantico', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.1rem;
  font-weight: 600;
  color: #f8fbff;
  line-height: 1.0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 12ch;
}

.icc-inline-value.icc-yes {
  color: #34d399; /* green */
}

.icc-inline-value.icc-ticket {
  color: #fde68a; /* yellow */
}

.icc-inline-value.icc-none {
  color: #c4b5fd; /* light purple */
}

.icc-inline-value.icc-error {
  color: #ef4444; /* red */
}

.icc-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(2, 8, 23, 0.74);
  display: none;
  padding: 18px;
}

.icc-modal-backdrop.is-open {
  display: grid;
  place-items: center;
}

.icc-modal {
  width: min(420px, 100%);
  background: linear-gradient(180deg, #0d2550, #0a1e43);
  border: 1px solid #295394;
  border-radius: 14px;
  padding: 14px;
  display: grid;
  gap: 10px;
  box-shadow: 0 18px 42px rgba(2, 8, 23, 0.56);
}

.icc-modal label,
.icc-modal [data-icc-note-label] {
  font-size: 1rem;
}

.icc-modal h3 {
  margin: 0;
  font-size: 0.98rem;
}

.icc-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

body.modal-open {
  overflow: hidden;
}

.watch-sheet-import-modal {
  width: min(520px, 100%);
  max-height: min(85vh, 720px);
  display: flex;
  flex-direction: column;
}

.watch-sheet-import-hint {
  margin: 0;
}

.watch-sheet-import-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.watch-sheet-import-toolbar .btn-quiet {
  padding: 5px 9px;
  font-size: 0.75rem;
}

.watch-sheet-beat-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(50vh, 420px);
  overflow-y: auto;
  padding: 2px 0;
}

.watch-sheet-beat-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #2a5396;
  border-radius: 10px;
  background: rgba(8, 22, 48, 0.55);
  cursor: pointer;
}

.watch-sheet-beat-row:hover {
  border-color: #3b6eb8;
}

.watch-sheet-beat-row input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: #3b82f6;
}

.watch-sheet-beat-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.watch-sheet-beat-no {
  font-size: 0.95rem;
  letter-spacing: 0.4px;
}

.watch-sheet-beat-officers {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

.watch-sheet-import-modal .btn-primary-action:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.icc-modal-error {
  margin: -2px 0 0;
  color: #ef4444;
  font-size: 0.8rem;
}

.icc-modal input.is-invalid {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

.outside-input {
  width: 90px;
  min-height: 30px;
  padding: 6px 8px;
  text-align: left;
}

.subtle {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 10px 0 0;
}

.field-group {
  margin-top: 12px;
  padding-top: 12px;
  border-top: none;
}

.field-group:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-grid > .field-group {
  margin-top: 0;
  padding-top: 0;
}

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

.field-group h3 {
  margin: 0 0 8px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #a7c8ff;
}

.btn-quiet {
  background: #102749;
  border-color: #456ca8;
  color: #d5e6ff;
  padding: 6px 10px;
  font-size: 0.8rem;
}

.btn-quiet:hover {
  background: #17345f;
}

.block-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin-top: 2px;
}

.block-summary .summary-contacts {
  grid-column: 1 / -1;
}

.block-summary p {
  margin: 0;
  display: grid;
  gap: 2px;
}

.block-summary span {
  font-size: 0.7rem;
  color: #9cb4d8;
  text-transform: uppercase;
  letter-spacing: 0.55px;
}

.block-summary strong {
  font-size: 0.85rem;
  color: #e5efff;
  font-weight: 600;
}

.block-body {
  margin-top: 12px;
}

.block-card.is-collapsed .block-body {
  display: none;
}

.block-card:not(.is-collapsed) .block-summary {
  display: none;
}

.officers-mini {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 6px 10px;
}

.person-icon {
  color: #9cb4d8;
  display: inline-flex;
  flex: 0 0 auto;
}

.officer-mini-cell {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.officer-mini-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.officer-mini-cell strong {
  color: #e5efff;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.officer-mini-text span {
  color: #9cb4d8;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  line-height: 1;
}

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

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

.supervisor-summary p {
  margin: 0;
  display: grid;
  gap: 2px;
}

.supervisor-summary span {
  font-size: 0.7rem;
  color: #9cb4d8;
  text-transform: uppercase;
  letter-spacing: 0.55px;
}

.supervisor-summary strong {
  font-size: 0.85rem;
  color: #e5efff;
  font-weight: 600;
}

.supervisor-body {
  margin-top: 12px;
}

#supervisorPanel.is-collapsed .supervisor-body {
  display: none;
}

#supervisorPanel:not(.is-collapsed) .supervisor-summary {
  display: none;
}

/* Make supervisor fields look like inline officer fields (text + underline-on-hover). */
#supervisorPanel input {
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
  color: #e5efff;
  font: inherit;
  min-height: auto;
  outline: none;
  border-bottom: 1px solid rgba(96, 165, 250, 0.15) !important;
  box-shadow: none !important;
}

#supervisorPanel input:hover {
  border-bottom-color: rgba(96, 165, 250, 0.85) !important;
}

#supervisorPanel input:focus {
  border-bottom-color: rgba(96, 165, 250, 1) !important;
}

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

.officer-row {
  border: 1px solid rgba(120, 165, 235, 0.28);
  background: rgba(20, 48, 92, 0.42);
  border-radius: 10px;
  padding: 10px;
}

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

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

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

.inline-label {
  font-size: 0.7rem;
  color: #9cb4d8;
  letter-spacing: 0.45px;
  text-transform: uppercase;
}

.inline-value {
  text-align: left;
  border: none;
  background: transparent;
  color: #e5efff;
  border-radius: 0;
  padding: 0;
  font-size: 0.86rem;
  min-height: auto;
  font-weight: 500;
}

.inline-value:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.inline-value:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

.inline-input {
  min-height: 36px;
}

.block-delete-wrap {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.btn-danger {
  border: 1px solid #ef4444;
  background: #7f1d1d;
  color: #fee2e2;
  border-radius: 10px;
  padding: 9px 14px;
  font-weight: 600;
  width: min(320px, 100%);
}

.btn-danger:hover {
  background: #991b1b;
}

.topbar-start {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-end {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-back {
  border: 1px solid #315ca2;
  background: transparent;
  color: #bfdbfe;
  padding: 7px 10px;
  font-weight: 600;
}

.btn-back:hover {
  background: rgba(59, 130, 246, 0.12);
}

.saved-indicator {
  color: #86efac;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.home-hero h2 {
  margin-bottom: 4px;
}

.btn-full {
  width: 100%;
  margin-top: 8px;
}

.home-list-panel {
  padding-top: 10px;
}

.log-list {
  display: grid;
  gap: 10px;
}

.log-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.log-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 14px 14px 14px 16px;
  border-radius: 0;
}

.log-row-main:hover {
  filter: none;
  background: rgba(59, 130, 246, 0.08);
}

.log-row-text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.log-row-title {
  font-size: 1rem;
  color: #e5efff;
}

.log-row-sub,
.log-row-meta {
  font-size: 0.82rem;
  color: var(--muted);
}

.log-row-chevron {
  color: #93c5fd;
  font-size: 1.4rem;
  line-height: 1;
  flex: 0 0 auto;
}

.log-row-delete {
  border: none;
  border-left: 1px solid #173b78;
  border-radius: 0;
  background: transparent;
  color: #fca5a5;
  font-size: 1.35rem;
  line-height: 1;
  padding: 0 14px;
  min-width: 48px;
}

.log-row-delete:hover {
  filter: none;
  background: rgba(239, 68, 68, 0.12);
}

.log-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 28px 12px;
  text-align: center;
}

.log-empty-icon {
  font-size: 2rem;
  opacity: 0.85;
}

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

.confirm-copy {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.view-editor .home-view {
  display: none;
}

.view-home .editor-view {
  display: none;
}

