:root {
  color-scheme: dark;
  --bg: #071017;
  --panel: #0d1b25;
  --panel-2: #102638;
  --line: #20394b;
  --line-strong: #2d86bf;
  --text: #eef7ff;
  --muted: #91a8bb;
  --cyan: #39b7ff;
  --cyan-soft: rgba(57, 183, 255, 0.14);
  --danger-soft: rgba(214, 64, 69, 0.18);
  --unknown: #4b535b;
  --scout: #2678d9;
  --friendly: #23a15b;
  --enemy: #d64045;
  --reserved: #d4a21f;
  --watch-needed: #df8b27;
  --watch-assigned: #e0b32c;
  --focus: #f2f5f4;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(57, 183, 255, 0.13), transparent 28rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 22rem),
    var(--bg);
  color: var(--text);
}

button {
  color: inherit;
  font: inherit;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(100%, 1040px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  display: grid;
  gap: 14px;
}

.access-locked {
  display: grid;
  place-items: center;
}

.access-lock {
  width: min(720px, calc(100vw - 32px));
  align-self: center;
  border: 1px solid rgba(57, 169, 225, 0.34);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(8, 27, 39, 0.96), rgba(6, 12, 18, 0.98));
  box-shadow: 0 0 40px rgba(57, 183, 255, 0.16);
  overflow: hidden;
}

.access-lock-art {
  display: block;
  width: 100%;
  max-height: min(56vh, 500px);
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center;
}

.access-lock-copy {
  padding: clamp(20px, 4vw, 30px);
}

.access-lock h1 {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 4vw, 2.3rem);
}

.access-lock p {
  margin: 8px 0;
  color: var(--muted);
  font-weight: 750;
}

.access-public-link {
  display: inline-flex;
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid rgba(207, 158, 82, 0.58);
  border-radius: 4px;
  color: #dfbd7d;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-decoration: none;
  text-transform: uppercase;
  background: rgba(122, 78, 31, 0.12);
}

.access-public-link:hover,
.access-public-link:focus-visible {
  color: #f5dfb7;
  border-color: #e0b66d;
  background: rgba(122, 78, 31, 0.24);
}

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

.brand-lockup {
  display: block;
  width: min(100%, 420px);
  min-width: 0;
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
  max-width: 420px;
  object-fit: contain;
  object-position: left center;
  background: transparent;
}

.eyebrow,
.label {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.7rem, 5vw, 2.6rem);
  line-height: 1;
  text-transform: uppercase;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.top-stats {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.galaxy-switcher {
  display: grid;
  min-width: 94px;
  align-content: center;
  gap: 2px;
  border: 1px solid rgba(57, 183, 255, 0.5);
  border-radius: 8px;
  background: rgba(8, 27, 39, 0.94);
  padding: 7px 10px;
}

.galaxy-switcher span {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.galaxy-switcher select {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 950;
  outline: none;
}

.galaxy-switcher select:disabled {
  opacity: 1;
}

.galaxy-switcher option {
  background: #081b27;
  color: var(--text);
}

.stat-card {
  min-width: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 24, 34, 0.86);
  padding: 9px 12px;
  box-shadow: inset 0 0 22px rgba(57, 183, 255, 0.04);
}

.stat-card strong,
.stat-kicker {
  display: block;
}

.stat-kicker {
  color: var(--text);
  font-weight: 950;
}

.stat-card strong {
  margin-top: 2px;
  color: #b8c9d7;
  font-size: 0.78rem;
}

.sync-pill {
  min-width: 86px;
  padding: 16px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(12, 24, 34, 0.86);
  color: var(--muted);
  text-align: center;
  font-size: 0.82rem;
  font-weight: 800;
}

.sync-pill.live {
  color: #bdeccf;
  border-color: rgba(35, 161, 91, 0.62);
}

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

.toolbar.legend {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.workspace-section {
  min-width: 0;
}

.map-section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 17, 24, 0.34);
}

.workspace-summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  list-style: none;
  border-bottom: 1px solid transparent;
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 900;
}

.workspace-summary::-webkit-details-marker {
  display: none;
}

.workspace-summary::before {
  content: "\25B8";
  color: var(--muted);
  font-size: 0.8rem;
  transition: transform 140ms ease;
}

.workspace-section[open] > .workspace-summary {
  border-bottom-color: var(--line);
}

.workspace-section[open] > .workspace-summary::before {
  transform: rotate(90deg);
}

.workspace-summary em {
  margin-left: auto;
  color: var(--muted);
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 800;
}

.workspace-section-body {
  min-width: 0;
}

.map-workspace-body {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.legend-item {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(18, 43, 61, 0.92), rgba(10, 22, 31, 0.92));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px;
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
}

.tool-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(18, 43, 61, 0.92), rgba(10, 22, 31, 0.92));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
}

.tool-button.active {
  outline: 2px solid var(--focus);
  border-color: transparent;
}

.flag-chip {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  font-size: 0.78rem;
  font-weight: 950;
}

.unknown { background-color: var(--unknown); }
.scout { background-color: var(--scout); }
.friendly { background-color: var(--friendly); }
.enemy { background-color: var(--enemy); }
.reserved { background-color: var(--reserved); color: #1e1806; }
.app { background-color: var(--friendly); }
.needed { background-color: var(--watch-needed); color: #251605; }

.board-wrap {
  position: relative;
  align-self: center;
  width: min(100%, calc(100vh - 210px));
  max-width: 720px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
}

.grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  grid-template-rows: repeat(10, minmax(0, 1fr));
  width: 100%;
  height: 100%;
  border: 1px solid var(--line);
  background: #0e1012;
  box-shadow: 0 0 0 1px rgba(57, 183, 255, 0.06), 0 18px 70px rgba(0, 0, 0, 0.35);
}

.cell {
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0;
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: start;
  padding: 5px;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease, outline-color 120ms ease;
}

.cell.empty {
  background: #15191d;
  color: var(--muted);
  cursor: default;
  opacity: 0.72;
}

.cell.unknown {
  background-color: #343c43;
}

.cell.has-friendly {
  box-shadow: inset 4px 0 0 var(--friendly);
}

.cell.has-enemy {
  background: linear-gradient(135deg, rgba(214, 64, 69, 0.36), #343c43 48%);
}

.cell.has-scout {
  box-shadow: inset 0 4px 0 var(--scout);
}

.cell.has-reserved::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--reserved);
}

.cell:hover,
.cell:focus-visible {
  z-index: 2;
  outline: 2px solid var(--focus);
  outline-offset: -2px;
  filter: brightness(1.16);
}

.cell.selected {
  z-index: 3;
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

.cell.highlighted-target {
  z-index: 2;
  box-shadow: inset 0 0 0 2px #f4c542, 0 0 0 2px rgba(244, 197, 66, 0.3);
}

.cell.empty:hover,
.cell.empty:focus-visible {
  z-index: auto;
  outline: none;
  filter: none;
}

.coord {
  font-size: clamp(0.55rem, 1.9vw, 0.78rem);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.42);
}

.intel-count {
  align-self: center;
  justify-self: center;
  color: rgba(255, 255, 255, 0.72);
  font-size: clamp(0.5rem, 1.55vw, 0.7rem);
  font-weight: 850;
  line-height: 1;
}

.flags {
  align-self: end;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2px;
  width: 100%;
}

.flags span {
  min-width: 0;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.22);
  color: rgba(255, 255, 255, 0.26);
  font-size: clamp(0.45rem, 1.55vw, 0.66rem);
  font-weight: 950;
  line-height: 1.35;
  text-align: center;
}

.flags span.on-f { background: var(--friendly); color: white; }
.flags span.on-e { background: var(--enemy); color: white; }
.flags span.on-s { background: var(--scout); color: white; }
.flags span.on-r { background: var(--reserved); color: #1e1806; }
.flags span.on-a { background: var(--friendly); color: white; }
.flags span.on-f { background: var(--scout); color: white; }
.flags span.on-s-needed { background: var(--watch-needed); color: #251605; }
.flags span.on-s-assigned { background: var(--watch-assigned); color: #251d05; }

.cell.has-app { box-shadow: inset 4px 0 0 var(--friendly); }
.cell.has-friendly { box-shadow: inset 0 4px 0 var(--scout); }
.cell.has-enemy { background: linear-gradient(135deg, rgba(214, 64, 69, 0.34), rgba(57, 62, 68, 0.9)); }
.cell.has-scout-needed { outline: 1px solid rgba(223, 139, 39, 0.72); outline-offset: -2px; }
.cell.has-scout-assigned { box-shadow: inset 0 -4px 0 var(--watch-assigned); }

.details-panel {
  display: grid;
  grid-template-columns: 0.8fr 1fr 1fr 1.1fr 1.1fr;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.sector-panel details,
.claims-panel details,
.operations-panel details,
.incoming-panel details,
.intel-panel details,
.attack-setup-panel,
.bulk-panel,
.parsed-panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(57, 183, 255, 0.065), rgba(8, 17, 24, 0.78)),
    rgba(11, 22, 31, 0.92);
  box-shadow: inset 0 0 26px rgba(57, 183, 255, 0.045), 0 12px 32px rgba(0, 0, 0, 0.18);
}

.watch-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.watch-action-summary {
  min-height: 48px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--watch-needed);
  border-radius: 8px;
  background: rgba(9, 25, 36, 0.9);
}

.watch-action-summary[hidden] {
  display: none;
}

.watch-action-summary .command-button,
.watch-action-summary .ghost-button {
  min-width: 132px;
}

.sector-panel details::before,
.claims-panel details::before,
.operations-panel details::before,
.incoming-panel details::before,
.intel-panel details::before,
.attack-setup-panel::before,
.bulk-panel::before,
.parsed-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 4px 0 0 rgba(57, 183, 255, 0.5);
}

.intel-panel {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.intel-panel summary {
  cursor: pointer;
  padding: 11px 12px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 850;
}

.mini-instructions {
  margin: 0 12px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(14, 16, 18, 0.78);
  padding: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.mini-instructions strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
}

.mini-instructions ol {
  margin: 0;
  padding-left: 18px;
}

.mini-instructions li + li {
  margin-top: 4px;
}

.mini-instructions code {
  color: var(--text);
  font-size: 0.78rem;
}

.intel-panel textarea {
  width: calc(100% - 24px);
  min-height: 116px;
  margin: 0 12px 10px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #0e1012;
  color: var(--text);
  padding: 10px;
  font: 0.82rem/1.35 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.import-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.command-button {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #24313b;
  padding: 7px 13px;
  color: var(--text);
  font-weight: 850;
  cursor: pointer;
}

.details-panel > div {
  min-width: 0;
}

.details-panel strong {
  display: block;
  min-height: 1.2em;
  overflow: hidden;
  color: var(--text);
  font-size: 0.94rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sector-panel {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.sector-panel summary,
.claims-panel summary,
.operations-panel summary,
.incoming-panel summary {
  cursor: pointer;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 11px 12px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 850;
}

.sector-panel summary strong,
.claims-panel summary strong,
.operations-panel summary strong,
.incoming-panel summary strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sector-panel summary em,
.claims-panel summary em,
.operations-panel summary em,
.incoming-panel summary em {
  color: var(--muted);
  font-style: normal;
  font-size: 0.8rem;
  font-weight: 800;
  text-align: right;
}

.sector-lists {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 10px;
  padding: 0 12px 12px;
}

.base-list,
.system-list,
.astro-list {
  min-height: 44px;
  max-height: 150px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(14, 16, 18, 0.58);
  padding: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.base-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.base-row:last-child {
  border-bottom: 0;
}

.base-row strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.base-row span {
  color: var(--muted);
}

.base-guild {
  color: var(--text);
  font-weight: 900;
}

.coordinate-row-actions {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.history-link {
  border: 0;
  background: transparent;
  padding: 2px 0;
  color: var(--cyan);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.system-list {
  display: flex;
  align-content: flex-start;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 5px;
}

.system-chip {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #20262b;
  padding: 3px 6px;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 850;
}

.claims-panel,
.operations-panel {
  padding-top: 0;
}

.bulk-panel,
.attack-setup-panel,
.parsed-panel {
  padding: 14px 18px 16px;
}

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.05rem;
  text-transform: uppercase;
}

.panel-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
}

.ghost-button,
.row-claim-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(20, 43, 59, 0.88);
  color: #bfe7ff;
  padding: 7px 13px;
  font-weight: 900;
  cursor: pointer;
}

.ghost-button:hover,
.row-claim-button:hover {
  border-color: var(--cyan);
  color: var(--text);
}

.row-claim-button:disabled {
  cursor: default;
  opacity: 0.58;
}

.bulk-panel textarea {
  width: 100%;
  min-height: 230px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(4, 11, 17, 0.88);
  color: #bcd3e4;
  padding: 12px;
  font: 0.9rem/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.panel-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: -10px;
  padding-right: 8px;
}

.panel-foot span,
.parsed-counts span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(11, 24, 34, 0.92);
  color: #b8c9d7;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 900;
}

.parsed-counts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.setup-controls {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.setup-controls label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 950;
  text-transform: uppercase;
}

.setup-controls select,
.target-row select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(5, 12, 18, 0.92);
  color: var(--text);
  padding: 5px 8px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 850;
}

#attackWindowSummary,
.finalize-status {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

.finalize-status {
  margin: -3px 0 10px;
}

.parsed-counts span:nth-child(2) {
  border-color: rgba(214, 64, 69, 0.45);
  background: rgba(214, 64, 69, 0.14);
  color: #ff9898;
}

.target-table {
  max-height: 390px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(5, 12, 18, 0.82);
  color: var(--muted);
}

.target-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(110px, 0.8fr) minmax(120px, 1fr) minmax(90px, 0.7fr) minmax(98px, 0.7fr) minmax(88px, 0.6fr) minmax(86px, 0.5fr);
  gap: 10px;
  align-items: center;
  min-width: 850px;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
}

.target-row:not(.target-head) {
  background: linear-gradient(90deg, rgba(214, 64, 69, 0.12), rgba(214, 64, 69, 0.035));
}

.target-row:last-child {
  border-bottom: 0;
}

.target-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(16, 33, 45, 0.98);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.target-row strong {
  color: var(--text);
}

.target-row mark {
  display: inline-flex;
  min-width: 76px;
  justify-content: center;
  border: 1px solid currentColor;
  border-radius: 6px;
  background: transparent;
  padding: 3px 7px;
  font-size: 0.76rem;
  font-weight: 950;
}

.target-row mark.stale {
  color: #ff7777;
  background: rgba(214, 64, 69, 0.13);
}

.target-row mark.fresh {
  color: #8ee8b0;
  background: rgba(35, 161, 91, 0.11);
}

.target-row mark.claimed {
  color: #f4c542;
  background: rgba(212, 162, 31, 0.13);
}

.claim-form {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) 0.8fr minmax(0, 1fr) auto;
  gap: 8px;
  padding: 0 12px 10px;
}

.claim-form input,
.claim-form select {
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #0e1012;
  color: var(--text);
  padding: 7px 9px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 750;
}

.claim-list,
.operation-list {
  margin: 0 12px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(14, 16, 18, 0.58);
  padding: 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.claim-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.operation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.operation-row:last-child {
  border-bottom: 0;
}

.operation-row strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operation-row span {
  color: var(--muted);
}

.operation-time {
  color: var(--text);
  font-weight: 900;
  text-align: right;
}

.claim-row:last-child {
  border-bottom: 0;
}

.claim-row.expired {
  opacity: 0.62;
}

.claim-row strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.claim-time {
  color: var(--text);
  font-weight: 900;
  text-align: right;
}

.claim-time span {
  color: var(--muted);
  font-size: 11px;
}

.unclaim-button {
  min-height: 26px;
  margin-top: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #1d2831;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.unclaim-button:hover {
  color: var(--text);
}

.incoming-panel,
.attack-panel {
  padding-top: 0;
}

.confirm-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 0 12px 10px;
}

.confirm-form textarea {
  min-height: 58px;
  resize: vertical;
}

.confirm-form textarea,
.confirm-form input {
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #0e1012;
  color: var(--text);
  padding: 8px 9px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
}

.confirm-form span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.incoming-board,
.attack-board {
  margin: 0 12px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(14, 16, 18, 0.58);
  padding: 6px 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.incoming-board pre {
  margin: 0;
  overflow-x: auto;
  white-space: pre;
  color: var(--text);
  font-family: "Roboto Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.45;
}

.incoming-more {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.attack-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.attack-row:last-child {
  border-bottom: 0;
}

.attack-row strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attack-meta {
  display: block;
  color: var(--muted);
}

.attack-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  border-radius: 999px;
  padding: 4px 8px;
  background: #293139;
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
}

.attack-status.confirmed {
  background: rgba(34, 197, 94, 0.2);
  color: #7ee39c;
}

.attack-actions {
  display: grid;
  gap: 5px;
  justify-items: end;
}

.signed-session .legacy-operational {
  display: none;
}

.shared-attacks-panel,
.shared-incoming-panel,
.shared-scouting-panel {
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(9, 25, 36, 0.9);
  padding: 14px;
}

details.shared-attacks-panel,
details.shared-incoming-panel,
details.shared-scouting-panel {
  overflow: hidden;
  padding: 0;
}

details.shared-attacks-panel > .workspace-section-body,
details.shared-incoming-panel > .workspace-section-body,
details.shared-scouting-panel > .workspace-section-body {
  padding: 0 14px 14px;
}

.shared-attacks-panel h2,
.shared-incoming-panel h2,
.shared-scouting-panel h2,
.shared-attack-card h3,
.shared-incoming-card h3,
.shared-scout-card h3 {
  margin: 0;
  letter-spacing: 0;
}

.shared-attacks-panel p,
.shared-incoming-panel p,
.shared-scouting-panel p {
  margin: 4px 0 0;
  color: var(--muted);
}

.shared-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 850;
}

.shared-attack-create {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(180px, 1fr) 80px auto;
  gap: 8px;
  margin: 12px 0;
}

.shared-attack-create textarea {
  grid-column: 1 / -1;
  min-height: 68px;
  resize: vertical;
}

.shared-attack-create input,
.shared-attack-create textarea,
.shared-attack-manage textarea,
.shared-incoming-report input,
.shared-incoming-report textarea {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #071119;
  color: var(--text);
  padding: 9px 10px;
  font: inherit;
}

.shared-view-status {
  min-height: 24px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

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

.shared-attack-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 14, 20, 0.76);
  padding: 12px;
}

.shared-attack-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.shared-kicker {
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 900;
}

.shared-attack-time {
  text-align: right;
}

.shared-attack-time strong,
.shared-attack-time span {
  display: block;
}

.shared-attack-time span,
.shared-attack-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.shared-targets {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.shared-target {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(12, 31, 44, 0.62);
}

.shared-target summary {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  padding: 9px 10px;
}

.shared-target summary span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.shared-waves {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 0 8px 8px;
}

.shared-wave,
.shared-release,
.danger-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #182b3a;
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
}

.shared-wave span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
}

.shared-wave.open:hover,
.shared-wave.mine {
  border-color: var(--cyan);
  background: rgba(31, 116, 168, 0.42);
}

.shared-wave.claimed,
.shared-wave.sent {
  opacity: 0.68;
}

.shared-wave.sent {
  border-color: var(--friendly);
}

.shared-wave-owned {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

.shared-release {
  min-height: 26px;
  color: var(--muted);
  font-size: 0.72rem;
}

.shared-attack-manage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  margin-top: 10px;
}

.shared-attack-manage textarea {
  min-height: 42px;
  resize: vertical;
}

.danger-button {
  border-color: rgba(214, 64, 69, 0.55);
  background: var(--danger-soft);
}

.shared-empty {
  padding: 8px;
}

.shared-report-box {
  margin: 12px 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(5, 14, 20, 0.62);
}

.shared-report-box > summary {
  cursor: pointer;
  padding: 10px 12px;
  color: var(--text);
  font-weight: 900;
}

.shared-incoming-report {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 0 10px 10px;
}

.shared-incoming-report #sharedIncomingNote {
  grid-column: span 2;
}

.shared-incoming-report textarea {
  grid-column: 1 / -1;
  min-height: 72px;
  resize: vertical;
}

.shared-incoming-report .command-button {
  grid-column: 1 / -1;
  justify-self: end;
}

.shared-incoming-list {
  display: grid;
  gap: 8px;
}

.shared-incoming-card {
  border: 1px solid rgba(214, 64, 69, 0.48);
  border-left: 4px solid var(--enemy);
  border-radius: 8px;
  background: rgba(38, 13, 17, 0.48);
  padding: 11px;
}

.shared-incoming-card.is-covered {
  border-color: rgba(34, 197, 94, 0.42);
  border-left-color: var(--friendly);
  background: rgba(9, 36, 25, 0.42);
}

.shared-incoming-card > header,
.shared-incoming-card > footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.incoming-route {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
  margin-top: 9px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.incoming-route span,
.incoming-route em,
.incoming-facts {
  color: var(--muted);
  font-size: 0.8rem;
}

.incoming-route em {
  font-style: normal;
  text-align: right;
}

.incoming-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 8px 0;
}

.incoming-facts strong {
  color: var(--text);
}

.incoming-state {
  align-self: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 0.74rem;
  font-weight: 900;
}

.incoming-state.open {
  border-color: rgba(214, 64, 69, 0.55);
  color: #ff9397;
}

.incoming-state.covered {
  border-color: rgba(34, 197, 94, 0.48);
  color: #7ee39c;
}

.incoming-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.incoming-actions button {
  min-height: 34px;
}

.shared-scout-create {
  margin: 12px 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(5, 14, 20, 0.62);
}

.shared-scout-create > summary {
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 900;
}

.shared-scout-create form {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(150px, 0.7fr) auto;
  gap: 8px;
  padding: 0 10px 10px;
}

.shared-scout-create input,
.shared-scout-create select,
.shared-scout-create textarea {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #071119;
  color: var(--text);
  padding: 9px 10px;
  font: inherit;
}

.shared-scout-create textarea {
  grid-column: 1 / -1;
  min-height: 72px;
  resize: vertical;
}

.shared-watch-summary {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(12, 31, 44, 0.62);
  padding: 9px 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.shared-watch-summary strong {
  color: var(--text);
}

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

.battle-history-summary,
.battle-history-list {
  display: grid;
  gap: 8px;
}

.battle-history-list {
  max-height: min(62vh, 620px);
  overflow: auto;
  overscroll-behavior: contain;
}

.battle-history-summary {
  margin: 10px 0;
}

.occupation-row,
.battle-history-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 14, 20, 0.76);
  padding: 10px 12px;
}

.occupation-row {
  border-left: 4px solid var(--reserved);
  display: grid;
  gap: 3px;
}

.occupation-row.is-ended {
  border-left-color: var(--friendly);
}

.occupation-row.is-inconsistent {
  border-color: rgba(214, 64, 69, 0.55);
  border-left-color: var(--enemy);
  background: rgba(58, 18, 22, 0.5);
}

.occupation-row span,
.battle-history-card p,
.battle-history-card small,
.battle-history-card time {
  color: var(--muted);
  font-size: 0.82rem;
}

.battle-history-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.battle-history-card header div {
  display: grid;
  gap: 2px;
}

.battle-history-card p {
  margin: 8px 0 4px;
  font-weight: 750;
}

.battle-history-card small {
  display: block;
  margin-top: 4px;
}

.shared-scout-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 14, 20, 0.76);
  padding: 11px;
}

.shared-scout-card > header,
.shared-scout-card > footer,
.shared-scout-target {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.shared-scout-card > header span,
.shared-scout-target span {
  color: var(--muted);
  font-size: 0.78rem;
}

.shared-scout-targets {
  display: grid;
  gap: 5px;
  max-height: 360px;
  overflow: auto;
  margin: 9px 0;
}

.shared-scout-target {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(12, 31, 44, 0.62);
  padding: 6px 8px;
}

.shared-scout-target.mine {
  border-color: var(--friendly);
  background: rgba(9, 36, 25, 0.42);
}

.shared-scout-target button {
  min-height: 32px;
}

.astro-row {
  display: grid;
  grid-template-columns: minmax(100px, auto) minmax(0, 1fr) auto auto;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.astro-row:last-child {
  border-bottom: 0;
}

.astro-row strong {
  color: var(--text);
}

.astro-row em {
  color: var(--muted);
  font-style: normal;
}

@media (min-width: 1180px) {
  .app-shell {
    width: min(100%, 1680px);
    padding-right: clamp(24px, 3.5vw, 64px);
    padding-left: clamp(24px, 3.5vw, 64px);
  }

  .topbar {
    justify-content: flex-start;
  }

  .top-stats {
    margin-left: clamp(22px, 3vw, 56px);
  }

  .toolbar.legend {
    width: min(100%, 1040px);
  }

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

  .base-list,
  .system-list,
  .astro-list {
    max-height: 220px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    gap: 12px;
  }

  .topbar,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-lockup {
    width: 100%;
  }

  .brand-logo {
    max-height: none;
  }

  .top-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .galaxy-switcher,
  .stat-card {
    min-width: 0;
  }

  .map-workspace-body {
    gap: 12px;
    padding: 0;
  }

  .map-section {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .map-section > .workspace-summary {
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .stat-card {
    min-width: 0;
    padding: 8px;
  }

  .sync-pill {
    min-width: 0;
    padding: 14px 8px;
  }

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

  .tool-button {
    min-height: 40px;
    font-size: 0.78rem;
  }

  .board-wrap {
    width: min(100%, calc(100vh - 250px));
    min-width: 0;
  }

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

  .watch-action-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .watch-action-summary .command-button,
  .watch-action-summary .ghost-button {
    width: 100%;
  }

  .parsed-counts {
    justify-content: flex-start;
  }

  .sector-lists {
    grid-template-columns: 1fr;
  }

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

  .claim-form #claimButton {
    grid-column: span 2;
  }

  .confirm-form,
  .attack-row {
    grid-template-columns: 1fr;
  }

  .shared-attack-create,
  .shared-attack-manage {
    grid-template-columns: 1fr;
  }

  .shared-incoming-report {
    grid-template-columns: 1fr 1fr;
  }

  .shared-incoming-report #sharedIncomingNote {
    grid-column: 1 / -1;
  }

  .shared-scout-create form {
    grid-template-columns: 1fr;
  }

  .shared-scout-create textarea {
    grid-column: auto;
  }

  .shared-scout-card > header,
  .shared-scout-card > footer,
  .shared-scout-target {
    align-items: stretch;
    flex-direction: column;
  }

  .shared-incoming-card > header,
  .shared-incoming-card > footer {
    align-items: stretch;
    flex-direction: column;
  }

  .incoming-route {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .incoming-route em {
    grid-column: 2;
    text-align: left;
  }

  .incoming-actions {
    justify-content: stretch;
  }

  .incoming-actions button {
    flex: 1 1 auto;
  }

  .shared-attack-create textarea {
    grid-column: auto;
  }

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

  .shared-attack-card > header {
    flex-direction: column;
  }

  .astro-row {
    grid-template-columns: minmax(100px, auto) minmax(0, 1fr);
  }

  .astro-row em,
  .astro-row .history-link {
    grid-column: 2;
    justify-self: start;
  }

  .battle-history-card header {
    flex-direction: column;
  }

  .shared-attack-time {
    text-align: left;
  }

  .attack-actions {
    justify-items: stretch;
  }
}

@media (max-width: 380px) {
  .top-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tool-button span:last-child {
    display: none;
  }

  .tool-button {
    min-height: 38px;
  }
}

.cosmos-brand{display:flex;align-items:center;gap:14px}.cosmos-brand img{border-radius:50%}.cosmos-brand strong{display:block;font-size:25px}.cosmos-brand span{display:block;opacity:.7;font-size:13px}
