:root {
  font:
    16px system-ui,
    sans-serif;
  color: #18343f;
  background: #eef3f5;
  --blue: #123e53;
  --gold: #d5aa40;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
header {
  background: var(--blue);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  border-bottom: 4px solid var(--gold);
}
header label {
  margin-left: auto;
}
header input {
  width: auto;
}
main {
  max-width: 1350px;
  margin: auto;
  padding: 20px;
}
nav,
.filters,
.pager,
.actions {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}
.panel,
.card {
  padding: 20px;
  background: white;
  border: 1px solid #cad6dc;
  border-radius: 12px;
  margin: 16px 0;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(285px, 1fr));
  gap: 14px;
}
.grid .card {
  margin: 0;
}
h1,
h2,
h3 {
  color: var(--blue);
}
label {
  display: block;
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 8px 0;
}
input,
select,
textarea,
button {
  font: inherit;
  padding: 10px;
  border: 1px solid #a6bac4;
  border-radius: 6px;
  max-width: 100%;
}
.operation-drawer {
  margin: 16px 0;
  padding: 14px;
  border: 1px solid #cad6dc;
  border-radius: 10px;
  background: #fff;
}
.operation-drawer > summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 650;
  min-height: 32px;
}
.operation-drawer fieldset {
  max-height: 340px;
  overflow: auto;
  border: 1px solid #cad6dc;
  border-radius: 8px;
  padding: 12px;
}
.operation-drawer fieldset label {
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.operation-drawer .notice:empty { display: none; }
.lvt-photo { display: block; max-width: 100%; max-height: 600px; object-fit: contain; margin: 12px auto; border-radius: 8px; }
.lvt-photo[hidden] { display: none; }
input,
select,
textarea {
  display: block;
  width: 100%;
  background: white;
  color: #173a49;
}
textarea {
  min-height: 90px;
}
input[type="checkbox"] {
  display: inline;
  width: auto;
}
button {
  cursor: pointer;
  background: var(--blue);
  color: white;
  min-height: 44px;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
.secondary {
  background: white;
  color: var(--blue);
}
.notice {
  background: #fff8df;
  padding: 14px;
  border-left: 4px solid var(--gold);
}
.error {
  color: #9c2020;
}
.muted {
  color: #536974;
  font-size: 0.9rem;
}
dl {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) 2fr;
  gap: 8px;
  font-size: 0.9rem;
}
dt {
  font-weight: 600;
}
dd {
  margin: 0;
  overflow-wrap: anywhere;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.8rem;
  max-height: 400px;
  overflow: auto;
}
.scroll {
  overflow: auto;
  max-height: 500px;
}
table {
  border-collapse: collapse;
  font-size: 0.85rem;
  width: 100%;
}
td,
th {
  padding: 8px;
  text-align: left;
  border: 1px solid #cad6dc;
  white-space: pre-wrap;
  min-width: 75px;
}
th {
  background: #123e53;
  color: white;
  position: sticky;
  top: 0;
}
.badge {
  border-radius: 6px;
  background: #edf2f5;
  padding: 5px 8px;
  display: inline-block;
  font-size: 0.85rem;
  margin: 4px;
}
.light {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin: 0 5px;
  animation: pulse 1.5s infinite;
}
.green {
  background: #167244;
}
.red {
  background: #b02530;
}
.legend {
  font-size: 0.85rem;
}
.metrics {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.metric {
  background: #eef4f6;
  padding: 14px;
  border-radius: 8px;
  min-width: 150px;
}
.metric strong {
  display: block;
  font-size: 1.6rem;
}
.book {
  border-left: 4px solid var(--gold);
  padding-left: 14px;
}
.formgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}
.formgrid label:has(textarea) {
  grid-column: 1/-1;
}
details {
  margin: 14px 0;
}
summary {
  cursor: pointer;
  font-weight: 600;
}
svg {
  width: 100%;
  max-height: 260px;
}
dialog {
  max-width: 95vw;
  width: 850px;
  border: 1px solid #879eab;
  border-radius: 12px;
}
body.no-motion .light {
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  .light {
    animation: none;
  }
}
@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}
[hidden] {
  display: none !important;
}
@media (max-width: 600px) {
  main {
    padding: 12px;
  }
  header {
    gap: 8px;
    padding: 14px;
  }
  .panel {
    padding: 14px;
  }
  dl {
    grid-template-columns: 1fr;
  }
  dd {
    margin-bottom: 8px;
  }
  .filters > * {
    width: 100%;
  }
}

/* The operation beacon belongs outside the card; RTI changes only the card itself. */
.asset-entry {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
}
.asset-entry > .asset-card {
  margin: 0;
  flex: 1;
  min-width: 0;
}
.operation-indicator {
  --beacon-color: #536974;
  --beacon-rgb: 83 105 116;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  align-self: flex-start;
  max-width: 100%;
  padding: 8px 11px;
  border: 1px solid #bdcbd2;
  border-radius: 10px;
  color: #344d58;
  background: #f5f8f9;
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.operation-indicator::before {
  content: "";
  display: inline-block;
  flex: 0 0 13px;
  width: 13px;
  height: 13px;
  border: 2px solid var(--beacon-color);
  border-radius: 50%;
  background: var(--beacon-color);
}
.operation-indicator[data-tone="green"],
.operation-indicator.green {
  --beacon-color: #167244;
  --beacon-rgb: 22 114 68;
  color: #104e30;
  background: #edf8f1;
  border-color: #8bb99c;
}
.operation-indicator[data-tone="red"],
.operation-indicator.red {
  --beacon-color: #a4212e;
  --beacon-rgb: 164 33 46;
  color: #851a28;
  background: #fff0f1;
  border-color: #d6a0a6;
}
.operation-indicator[data-tone="neutral"]::before {
  background: transparent;
}
.operation-indicator.animated:not([data-tone="neutral"])::before {
  animation: operation-beacon-pulse 2.8s ease-in-out infinite;
}
.operation-indicator .operation-reason {
  font-weight: 400;
}
.asset-card.has-open-rti {
  color: white;
  background: #8f1e2b;
  border: 2px solid #6c1020;
}
.asset-card.has-open-rti h2,
.asset-card.has-open-rti h3,
.asset-card.has-open-rti h4,
.asset-card.has-open-rti .muted,
.asset-card.has-open-rti a {
  color: white;
}
.asset-card.has-open-rti .badge {
  color: white;
  background: #721321;
  border: 1px solid #edbdc3;
}
.asset-card.has-open-rti button,
.asset-card.has-open-rti .secondary {
  color: #7c1421;
  background: white;
  border-color: white;
}
.asset-card.has-open-rti button:focus-visible,
.asset-card.has-open-rti a:focus-visible {
  outline: 3px solid #ffe09a;
  outline-offset: 3px;
}
.asset-card.has-open-rti .light {
  background: white;
  animation: none;
}
.asset-card.has-open-rti .notice {
  color: white;
  background: #721321;
  border-color: #ffe09a;
}
body.no-motion .operation-indicator::before {
  animation: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .operation-indicator::before {
    animation: none !important;
  }
}
@keyframes operation-beacon-pulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgb(var(--beacon-rgb) / 0);
  }
  50% {
    opacity: 0.65;
    box-shadow: 0 0 0 6px rgb(var(--beacon-rgb) / 0.16);
  }
}
