/* MIL Companion: a small app window. Same tokens as mil.css (coal, cream, lime). */
/* Contrast within the Medware palette: moss page, coal header and boxes, the map darkest. */
body.companion { background: var(--moss-2); }
body.companion .c-top { background: var(--coal); }
body.companion .c-panel { background: var(--coal); border-color: var(--hair); }
body.companion .c-hint { color: var(--lime-soft); opacity: .8; }
/* The window never scrolls: header, then the map at 16:9, then the boxes fill what is left and scroll inside. */
body.companion { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
.grow { flex: 1; }
.c-top { display: flex; align-items: center; gap: 10px; padding: 10px clamp(20px, 4vw, 64px); border-bottom: 1px solid var(--hair-soft); position: sticky; top: 0; background: var(--coal); z-index: 2; }
.c-logo { display: inline-flex; align-items: center; gap: 8px; color: var(--cream); text-decoration: none; font-weight: 750; font-size: 14px; letter-spacing: .01em; }
.c-logo img { width: 22px; height: 22px; border-radius: 5px; }
.c-status { display: inline-flex; align-items: center; gap: 6px; font: 500 12px var(--mono); color: var(--grey); }
.c-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--grey); }
.c-status.on i { background: var(--lime); box-shadow: 0 0 8px var(--lime); }
.c-status.warn i { background: var(--warn); }
.c-status.bad i { background: var(--bad); }
.c-main { flex: 1; display: flex; padding: 20px clamp(20px, 4vw, 64px); min-height: 0; overflow: auto; }
.c-card { margin: 8vh auto; max-width: 440px; width: 100%; border: 1px solid var(--hair); border-radius: 11px; padding: 24px; display: grid; gap: 12px; align-content: start; }
.c-card h2 { margin: 0; font-size: 22px; }
.c-form { display: grid; gap: 12px; margin-top: 8px; }
.c-form label { display: grid; gap: 6px; font-weight: 600; font-size: 13px; }
.c-form input { font: inherit; padding: 11px 12px; border-radius: 8px; border: 1px solid var(--hair); background: var(--coal-2); color: var(--cream); }
/* Map on top at a fixed aspect ratio (never shrinks to nothing), the boxes under it at a set height and scrolling. */
/* Map and boxes share one centred column, at most 1440px wide. */
.c-grid { flex: 1; width: 100%; max-width: min(1440px, max(720px, calc((100dvh - 330px) * 16 / 9))); margin-inline: auto; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); min-height: 0; }
.c-map { display: grid; gap: 8px; }
.c-map iframe { width: min(100%, calc((100dvh - 330px) * 16 / 9)); min-width: min(100%, 420px); margin-inline: auto; aspect-ratio: 16 / 9; height: auto; border: 1px solid var(--hair); border-radius: 11px; background: #121715; display: block; }
.c-hint { margin: 0; }
.c-side { display: grid; gap: 12px; grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr); min-height: 0; }
.c-side > .c-panel { min-height: 0; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.c-side > .c-panel > ol, .c-side > .c-panel > ul { overflow-y: auto; min-height: 0; align-content: start; }
.c-panel { border: 1px solid var(--hair-soft); border-radius: 11px; padding: 12px 14px; display: grid; gap: 8px; }
.c-panel p { margin: 0; }
.c-panel a { color: var(--lime); }
.c-detail-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.c-calls, .c-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.c-calls li button { width: 100%; text-align: left; background: none; border: 0; color: var(--cream); font: inherit; padding: 8px 6px; border-radius: 7px; cursor: pointer; display: grid; gap: 2px; }
.c-calls li button:hover, .c-calls li button[aria-current="true"] { background: var(--row-hover); }
.c-calls .k { font-weight: 700; font-size: 13px; }
.c-calls .m { font: 500 11.5px var(--mono); color: var(--grey); }
.c-calls .v-flagged .k::after { content: " · some withheld"; color: var(--warn); font-weight: 500; }
.c-calls .v-rejected .k::after { content: " · rejected"; color: var(--bad); font-weight: 500; }
.c-calls .live .m::before { content: "running · "; color: var(--lime); }
.c-steps li { border-left: 2px solid var(--hair); padding: 4px 0 4px 10px; font-size: 13px; }
.c-steps li.sel { border-left-color: var(--lime); background: rgba(189, 203, 145, .07); }
.c-steps li.bad { border-left-color: var(--bad); }
.c-steps li.warn { border-left-color: var(--warn); }
.c-steps .s { display: flex; justify-content: space-between; gap: 8px; }
.c-steps .s span:last-child { font: 500 11px var(--mono); color: var(--grey); white-space: nowrap; }
.c-recs { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.c-recs li { font-size: 12.5px; color: var(--text-muted); border: 0; padding: 0; }
.c-recs a { color: var(--lime); text-underline-offset: 2px; }
.c-recs .t { font: 500 10.5px var(--mono); color: var(--grey); text-transform: uppercase; letter-spacing: .06em; margin-right: 6px; }
/* Compact: a small always-visible window, just the map and the running query. */
body.compact .c-grid { grid-template-columns: minmax(0, 1fr); }
body.compact .c-side .c-panel:last-child, body.compact .c-hint { display: none; }
body.compact .c-side { grid-template-columns: minmax(0, 1fr); }

@media (max-width: 820px) {
  .c-side { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 3fr) minmax(0, 2fr); }
  .c-map iframe { aspect-ratio: 4 / 3; }
}
