:root {
  color-scheme: dark;
  --bg: #101211;
  --panel: #171b1a;
  --panel-strong: #1d2422;
  --line: #30403c;
  --line-soft: rgba(255, 255, 255, 0.1);
  --text: #eef3ee;
  --muted: #9ca9a2;
  --teal: #4ed6c1;
  --teal-soft: rgba(78, 214, 193, 0.18);
  --gold: #d4a84b;
  --rose: #e2767e;
  --violet: #8f91ff;
  --green: #7ed98d;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 6%, rgba(78, 214, 193, 0.14), transparent 28rem),
    radial-gradient(circle at 84% 0%, rgba(212, 168, 75, 0.12), transparent 24rem),
    linear-gradient(150deg, #0f1110 0%, #141817 44%, #111312 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(1520px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  min-width: 0;
  padding: 4px 2px 18px;
}

.topbar > div:first-child {
  flex: 1 1 300px;
  min-width: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.55rem, 2.6vw, 2.45rem);
  line-height: 1.05;
  letter-spacing: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 1rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar__meta {
  min-width: 178px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 27, 26, 0.8);
  text-align: right;
  box-shadow: var(--shadow);
}

.topbar__meta span {
  display: block;
  color: var(--teal);
  font-size: 1.35rem;
  font-weight: 850;
  line-height: 1.05;
}

.topbar__meta small {
  color: var(--muted);
}

.topbar__actions {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  flex: 1 1 620px;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.freshness-badge {
  display: grid;
  align-content: center;
  min-width: 190px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 27, 26, 0.8);
  padding: 10px 12px;
  box-shadow: var(--shadow);
}

.freshness-badge strong,
.freshness-badge small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.freshness-badge strong {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.92rem;
  line-height: 1.1;
}

.freshness-badge strong::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 168, 75, 0.15);
}

.freshness-badge small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.freshness-badge[data-freshness="fresh"] {
  border-color: rgba(126, 217, 141, 0.48);
}

.freshness-badge[data-freshness="fresh"] strong::before {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(126, 217, 141, 0.15);
}

.freshness-badge[data-freshness="aging"] {
  border-color: rgba(212, 168, 75, 0.5);
}

.freshness-badge[data-freshness="stale"],
.freshness-badge[data-freshness="unknown"] {
  border-color: rgba(226, 118, 126, 0.54);
}

.freshness-badge[data-freshness="stale"] strong::before,
.freshness-badge[data-freshness="unknown"] strong::before {
  background: var(--rose);
  box-shadow: 0 0 0 3px rgba(226, 118, 126, 0.15);
}

.tool-trigger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 250px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(23, 27, 26, 0.8);
  padding: 10px 12px;
  text-align: left;
  box-shadow: var(--shadow);
}

.tool-trigger:hover,
.tool-trigger:focus-visible,
.tool-trigger[aria-expanded="true"] {
  border-color: var(--teal);
  background: #16201e;
  outline: none;
}

.tool-trigger span,
.tool-trigger strong,
.tool-trigger small {
  display: block;
  min-width: 0;
}

.tool-trigger strong {
  font-size: 0.92rem;
  line-height: 1.1;
}

.tool-trigger small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.tool-trigger b {
  color: var(--teal);
  font-size: 1.04rem;
  line-height: 1;
  white-space: nowrap;
}

.tool-drawer {
  margin-bottom: 16px;
}

body.is-ccu-mode .topbar,
body.is-ccu-mode .planner-grid,
body.is-ccu-mode footer {
  display: none;
}

body.is-ccu-mode .tool-drawer {
  margin-bottom: 0;
}

body.is-ccu-mode .ccu-panel--drawer {
  min-height: calc(100vh - 44px);
  max-height: none;
}

.ccu-panel--drawer {
  max-height: min(760px, calc(100vh - 120px));
  overflow: auto;
}

.ccu-panel__head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.planner-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.selection-panel,
.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 27, 26, 0.88);
  box-shadow: var(--shadow);
}

.selection-panel {
  position: static;
  max-height: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.panel {
  padding: 16px;
}

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

.icon-button,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 750;
  letter-spacing: 0;
  line-height: 1;
}

.icon-button {
  width: 40px;
  flex: 0 0 40px;
  color: var(--text);
  background: #222927;
  border-color: var(--line);
}

.primary-button {
  color: #071110;
  background: var(--teal);
  border-color: var(--teal);
  padding: 0 14px;
}

.secondary-button {
  color: var(--text);
  background: #222927;
  border-color: var(--line);
  padding: 0 14px;
}

.icon-button:hover,
.primary-button:hover,
.secondary-button:hover,
.ship-card:hover {
  filter: brightness(1.08);
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.field input,
.field select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #101413;
  padding: 0 12px;
  line-height: 1.2;
  outline: none;
}

.field select {
  appearance: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

.input-affix {
  display: flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101413;
  overflow: hidden;
}

.input-affix span {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  flex: 0 0 auto;
  padding: 0 10px;
  color: var(--muted);
  line-height: 1;
}

.input-affix input {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0 10px 0 0;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 14px 0;
}

.segment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #101413;
  font-weight: 800;
  line-height: 1;
}

.segment.is-active {
  color: #071110;
  background: var(--gold);
  border-color: var(--gold);
}

.ship-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  max-height: 430px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.ship-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  width: 100%;
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  background: #111615;
  padding: 12px;
  text-align: left;
}

.ship-card.is-selected {
  border-color: var(--teal);
  background:
    linear-gradient(135deg, rgba(78, 214, 193, 0.16), rgba(143, 145, 255, 0.08)),
    #111615;
}

.ship-card__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.ship-card__top > span:first-child {
  min-width: 0;
}

.ship-card strong {
  display: block;
  font-size: 0.98rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.ship-card small {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.price-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 28px;
  padding: 5px 8px;
  border-radius: 999px;
  color: #071110;
  background: var(--teal);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
}

.ship-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 7px;
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1;
}

.tag.is-value-good {
  border-color: rgba(126, 217, 141, 0.48);
  color: #b9efc2;
  background: rgba(126, 217, 141, 0.1);
}

.tag.is-value-bad {
  border-color: rgba(226, 118, 126, 0.48);
  color: #ffd0d5;
  background: rgba(226, 118, 126, 0.1);
}

.tag.is-value-neutral {
  border-color: rgba(212, 168, 75, 0.5);
  color: #f0d48f;
  background: rgba(212, 168, 75, 0.1);
}

.workspace {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.visual-summary {
  position: relative;
  min-height: 330px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #161a19;
  box-shadow: var(--shadow);
}

.visual-summary img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.visual-summary__overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(9, 12, 11, 0.92), rgba(9, 12, 11, 0.42) 52%, rgba(9, 12, 11, 0.72)),
    linear-gradient(0deg, rgba(9, 12, 11, 0.84), transparent 54%);
}

.visual-summary__content {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 330px;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  padding: 24px;
}

.visual-summary h2 {
  max-width: 620px;
  font-size: clamp(1.55rem, 3.4vw, 3.35rem);
  line-height: 1;
}

.visual-summary p:not(.eyebrow) {
  margin-top: 10px;
  color: #d4ddd7;
  font-size: 1rem;
}

.visual-summary .bundle-value {
  display: none;
  width: fit-content;
  max-width: 720px;
  border: 1px solid rgba(78, 214, 193, 0.3);
  border-radius: 8px;
  background: rgba(9, 12, 11, 0.72);
  color: var(--text);
  padding: 9px 11px;
  font-size: 0.88rem;
  font-weight: 750;
}

.visual-summary .bundle-value.is-visible {
  display: block;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 650px;
}

.summary-strip div {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(10, 13, 12, 0.72);
  padding: 12px;
}

.summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.summary-strip strong {
  display: block;
  margin-top: 5px;
  color: var(--teal);
  font-size: clamp(1rem, 2vw, 1.45rem);
  line-height: 1.1;
}

.details-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.85fr);
  gap: 16px;
}

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

.budget-note {
  grid-column: 1 / -1;
  border: 1px solid rgba(212, 168, 75, 0.35);
  border-radius: 8px;
  color: #d7ded9;
  background: rgba(212, 168, 75, 0.08);
  padding: 10px 12px;
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.35;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 750;
}

.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: #071110;
  background: var(--green);
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1;
}

.status-pill.is-short {
  background: var(--rose);
}

.status-pill.is-ready {
  background: var(--gold);
}

.total-display {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #111615;
  padding: 14px;
}

.total-display span,
.total-display small {
  color: var(--muted);
  font-weight: 750;
}

.total-display strong {
  display: block;
  margin: 4px 0;
  color: var(--teal);
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  line-height: 1;
}

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

.pace-grid div {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #111615;
  padding: 10px;
}

.pace-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.pace-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--gold);
  font-size: 0.95rem;
  line-height: 1.15;
}

.meter {
  height: 12px;
  margin: 14px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #0b0d0d;
  border: 1px solid var(--line);
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--teal));
  transition: width 180ms ease;
}

.mini-ledger {
  display: grid;
  gap: 8px;
  margin: 0;
}

.mini-ledger div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line-soft);
  padding-top: 8px;
}

.mini-ledger dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.mini-ledger dd {
  margin: 0;
  font-weight: 850;
}

.lower-grid {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.9fr);
}

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

.ccu-panel {
  display: grid;
  gap: 14px;
}

.ccu-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr)) auto auto;
  gap: 12px;
  align-items: end;
}

.ccu-summary {
  display: grid;
  grid-template-columns: minmax(180px, 1.35fr) repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ccu-summary div {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #111615;
  padding: 12px;
}

.ccu-summary__primary {
  border-color: rgba(126, 217, 141, 0.46);
  background: #14201d;
}

.ccu-summary span,
.ccu-step small {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.ccu-summary strong {
  display: block;
  margin-top: 5px;
  color: var(--teal);
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  line-height: 1.1;
}

.ccu-summary div:not(.ccu-summary__primary) strong {
  color: var(--text);
  font-size: 1.05rem;
}

.ccu-summary__primary strong {
  color: #f4fffa;
  font-size: clamp(1.35rem, 2vw, 1.85rem);
}

.ccu-steps {
  display: grid;
  gap: 8px;
}

.ccu-step {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(0, 1.4fr) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #111615;
  padding: 10px;
}

.ccu-step.is-warbond {
  border-color: rgba(126, 217, 141, 0.42);
  background:
    linear-gradient(135deg, rgba(126, 217, 141, 0.08), transparent),
    #111615;
}

.ccu-step.is-saving {
  border-color: rgba(126, 217, 141, 0.72);
  box-shadow: 0 0 0 1px rgba(126, 217, 141, 0.24);
  background:
    linear-gradient(135deg, rgba(126, 217, 141, 0.18), rgba(78, 214, 193, 0.06) 58%, transparent),
    #111615;
}

.ccu-step.is-saving .ccu-step__index {
  background: var(--green);
}

.ccu-step.is-acquired {
  border-color: rgba(78, 214, 193, 0.54);
  background:
    linear-gradient(135deg, rgba(78, 214, 193, 0.08), transparent),
    #111615;
}

.ccu-step.is-acquired .ccu-step__index {
  background: var(--teal);
}

.ccu-step.is-invalid {
  border-color: rgba(226, 118, 126, 0.7);
  box-shadow: 0 0 0 1px rgba(226, 118, 126, 0.2);
}

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

.ccu-step__index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #071110;
  background: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
}

.ccu-route {
  min-width: 0;
}

.ccu-route strong,
.ccu-route small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ccu-step__fields {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(120px, 0.5fr) minmax(118px, 0.45fr) auto auto auto;
  gap: 8px;
  align-items: end;
  min-width: 0;
}

.ccu-step__fields .field {
  gap: 5px;
}

.ccu-step__fields .field input,
.ccu-step__fields .field select,
.ccu-step__fields .input-affix {
  min-height: 38px;
}

.ccu-usable {
  min-height: 38px;
  align-items: center;
  padding-bottom: 1px;
}

.ccu-have {
  min-height: 38px;
  align-items: center;
  padding-bottom: 1px;
}

.ccu-step__price {
  display: grid;
  justify-items: end;
  gap: 4px;
  text-align: right;
}

.ccu-step__price strong {
  display: block;
  color: var(--teal);
}

.ccu-save-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  color: #071110;
  background: var(--green);
  padding: 0 9px;
  font-size: 0.72rem;
  font-weight: 950;
  line-height: 1;
}

.ccu-error {
  max-width: 180px;
  color: #ffd0d5;
}

.ccu-empty {
  min-height: 72px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  padding: 12px;
}

.ccu-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.ccu-saved {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
}

.ccu-saved__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.ccu-saved__head small {
  text-transform: none;
}

.ccu-saved-list {
  display: grid;
  gap: 8px;
}

.ccu-saved-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #111615;
  padding: 10px;
}

.ccu-saved-card.is-active {
  border-color: rgba(78, 214, 193, 0.58);
  background: rgba(78, 214, 193, 0.08);
}

.ccu-saved-card strong,
.ccu-saved-card small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ccu-saved-card small {
  color: var(--muted);
}

.remove-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(226, 118, 126, 0.45);
  border-radius: 8px;
  color: #ffd8dc;
  background: rgba(226, 118, 126, 0.12);
  font-weight: 900;
  line-height: 1;
}

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

.scenario-empty {
  min-height: 92px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  padding: 12px;
}

.scenario-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #111615;
  padding: 10px;
}

.scenario-card strong,
.scenario-card small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scenario-card small {
  color: var(--muted);
}

.comparison-table {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
}

th,
td {
  border-top: 1px solid var(--line-soft);
  padding: 12px 10px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

td {
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

tr.is-selected-row td {
  color: var(--teal);
  background: rgba(78, 214, 193, 0.08);
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.78rem;
}

.footer__notes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  min-width: 0;
}

.donation-link {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid rgba(212, 168, 75, 0.5);
  border-radius: 8px;
  color: #f0d48f;
  background: rgba(212, 168, 75, 0.1);
  padding: 0 11px;
  font-size: 0.76rem;
  font-weight: 850;
  text-decoration: none;
}

.donation-link:hover,
.donation-link:focus-visible {
  border-color: var(--gold);
  background: rgba(212, 168, 75, 0.16);
  color: var(--text);
  outline: none;
}

@media (max-width: 1060px) {
  .details-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .ccu-controls,
  .ccu-summary {
    grid-template-columns: 1fr;
  }

  .ccu-step {
    grid-template-columns: 1fr;
  }

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

  .ccu-step__price {
    justify-items: start;
    text-align: left;
  }

  .ship-list {
    grid-template-columns: 1fr;
    max-height: 420px;
  }
}

@media (min-width: 1061px) and (max-width: 1220px) {
  .comparison-table {
    font-size: 0.82rem;
  }

  th,
  td {
    padding: 9px 7px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 14px;
  }

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

  .topbar > div:first-child {
    flex: 0 1 auto;
  }

  .topbar__actions {
    flex: 0 1 auto;
    flex-direction: column;
  }

  h1 {
    font-size: clamp(1.6rem, 8vw, 2.1rem);
  }

  .tool-trigger {
    width: 100%;
    min-width: 0;
  }

  .freshness-badge,
  .topbar__meta {
    width: 100%;
  }

  .topbar__meta {
    text-align: left;
  }

  .visual-summary,
  .visual-summary__content {
    min-height: 390px;
  }

  .visual-summary__content {
    padding: 18px;
  }

  .summary-strip,
  .form-grid,
  .pace-grid {
    grid-template-columns: 1fr;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 430px) {
  .app-shell {
    padding: 10px;
  }

  .selection-panel,
  .panel {
    padding: 12px;
  }

  .ccu-panel--drawer {
    max-height: none;
  }

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

  .segment {
    min-width: 0;
    padding: 0 6px;
    font-size: 0.9rem;
  }

  .ship-card {
    padding: 10px;
  }

  .ship-card__top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .ccu-step {
    grid-template-columns: 1fr;
  }

  .ccu-step__fields {
    grid-template-columns: 1fr;
  }

  .ccu-step__price {
    justify-items: start;
    text-align: left;
  }

  .price-pill {
    max-width: 8.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* App redesign */
:root {
  --bg: #0c1014;
  --panel: #111820;
  --panel-strong: #17212b;
  --line: #2a3945;
  --line-soft: rgba(255, 255, 255, 0.1);
  --text: #f3f7f5;
  --muted: #9ba9ad;
  --teal: #4ed6c1;
  --teal-soft: rgba(78, 214, 193, 0.16);
  --gold: #d8ad4d;
  --rose: #e8757d;
  --violet: #7aa6ff;
  --green: #78d889;
  --shadow: 0 22px 65px rgba(0, 0, 0, 0.35);
}

body {
  background:
    linear-gradient(180deg, rgba(14, 20, 27, 0.82), rgba(12, 16, 20, 1)),
    #0c1014;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  width: min(1520px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  padding: 0;
}

.topbar,
.tool-drawer,
.mobile-tabs,
.planner-grid,
footer {
  grid-column: 1;
  min-width: 0;
}

.topbar {
  align-items: center;
  padding: 18px 22px 0;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-logo {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 8px;
}

.topbar h1 {
  max-width: 520px;
  font-size: 2.1rem;
  line-height: 1;
}

.topbar__actions {
  flex: 1 1 560px;
  align-items: stretch;
}

.freshness-badge,
.tool-trigger,
.topbar__meta {
  min-height: 68px;
  border-color: var(--line);
  background: rgba(17, 24, 32, 0.86);
}

.freshness-badge {
  min-width: 244px;
}

.tool-trigger {
  min-width: 250px;
}

.topbar__meta span,
.tool-trigger b {
  color: var(--teal);
}

.mobile-tabs {
  display: none;
}

.planner-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 2fr);
  gap: 16px;
  padding: 16px 22px 0;
}

.visual-summary {
  grid-column: 1 / -1;
  min-height: 312px;
  border-color: var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.visual-summary__overlay {
  background:
    linear-gradient(90deg, rgba(12, 16, 20, 0.92), rgba(12, 16, 20, 0.62) 44%, rgba(12, 16, 20, 0.2)),
    linear-gradient(0deg, rgba(12, 16, 20, 0.72), transparent 60%);
}

.visual-summary__content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.36fr);
  align-items: end;
  min-height: 312px;
  padding: 24px;
}

.visual-summary h2 {
  max-width: 820px;
  font-size: 3.9rem;
  line-height: 0.98;
}

.visual-summary p:not(.eyebrow) {
  max-width: 620px;
  color: #d8e1de;
  line-height: 1.45;
}

.visual-summary .bundle-value {
  max-width: 720px;
  margin-top: 12px;
}

.summary-strip {
  grid-template-columns: 1fr;
  align-self: end;
}

.summary-strip div {
  border-color: rgba(78, 214, 193, 0.38);
  background: rgba(17, 24, 32, 0.82);
  text-align: right;
}

.summary-strip div:first-child {
  display: block;
}

.summary-strip strong {
  font-size: 2rem;
}

.selection-panel,
.panel {
  border-color: var(--line);
  background: rgba(17, 24, 32, 0.92);
  box-shadow: none;
}

.selection-panel {
  grid-column: 1;
  grid-row: 2;
  max-height: none;
  align-self: start;
}

.workspace {
  grid-column: 2;
  grid-row: 2;
  gap: 16px;
}

.details-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.72fr);
  gap: 16px;
}

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

.comparison-panel {
  margin-top: 0;
}

.field input,
.field select,
.input-affix {
  border-color: var(--line);
  background: #0d1217;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segment {
  flex: 1 1 106px;
  background: #0d1217;
}

.segment.is-active {
  border-color: var(--gold);
  color: #09100c;
  background: var(--gold);
}

.ship-list {
  grid-template-columns: 1fr;
  max-height: 820px;
}

.ship-card {
  min-height: auto;
  background: #0d1217;
  padding: 13px;
}

.ship-card__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.ship-card strong {
  font-size: 1.05rem;
}

.ship-card.is-selected {
  border-color: rgba(78, 214, 193, 0.68);
  background: rgba(78, 214, 193, 0.08);
}

.price-pill {
  min-width: 88px;
  min-height: 38px;
  background: var(--teal);
  font-size: 0.92rem;
  box-shadow: 0 0 0 3px rgba(78, 214, 193, 0.12);
}

.money-field {
  border: 1px solid rgba(78, 214, 193, 0.26);
  border-radius: 8px;
  background: rgba(78, 214, 193, 0.06);
  padding: 10px;
}

.money-field > span {
  color: #dff7f2;
}

.money-field .input-affix {
  min-height: 46px;
  border-color: rgba(78, 214, 193, 0.52);
  background: rgba(8, 12, 15, 0.72);
}

.money-field input {
  color: var(--teal);
  font-size: 1.05rem;
  font-weight: 900;
}

.money-field .input-affix span {
  color: var(--teal);
  font-weight: 900;
}

.status-pill.is-ready,
.status-chip,
.tag.is-value-good {
  color: #dff7f2;
  background: rgba(78, 214, 193, 0.1);
}

.total-display,
.pace-grid div,
.mini-ledger div,
.scenario-card,
.ccu-step,
.ccu-summary div,
.ccu-saved-card {
  border-color: var(--line);
  background: #0d1217;
}

.total-display strong,
.mini-ledger dd,
.ccu-summary strong,
.ccu-step__price strong,
.saved-item strong {
  color: var(--teal);
}

.pace-grid strong {
  color: var(--gold);
}

.meter span {
  background: linear-gradient(90deg, var(--gold), var(--teal));
}

.budget-note {
  border-color: rgba(122, 166, 255, 0.34);
  color: #dce7ff;
  background: rgba(122, 166, 255, 0.08);
}

.primary-button {
  color: #07110f;
  background: var(--teal);
  border-color: var(--teal);
}

.secondary-button,
.icon-button,
.remove-button {
  background: var(--panel);
}

.tool-drawer {
  padding: 16px 22px 0;
}

body.is-ccu-mode .mobile-tabs {
  display: none;
}

body.is-ccu-mode .tool-drawer {
  grid-column: 1 / -1;
  padding: 22px;
}

footer {
  padding: 0 22px 22px;
}

@media (max-width: 1220px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .topbar,
  .tool-drawer,
  .mobile-tabs,
  .planner-grid,
  footer {
    grid-column: 1;
  }

  .planner-grid {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.75fr);
  }

  .selection-panel {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .workspace {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}

@media (max-width: 820px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 12px 12px 0;
  }

  .topbar > div:first-child,
  .topbar__actions {
    flex: 0 1 auto;
  }

  .topbar h1 {
    font-size: 1.95rem;
  }

  .app-logo {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .topbar__actions {
    flex-direction: column;
  }

  .freshness-badge,
  .tool-trigger,
  .topbar__meta {
    width: 100%;
    min-height: 58px;
  }

  .mobile-tabs {
    position: sticky;
    top: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    background: rgba(12, 16, 20, 0.94);
    padding: 8px 12px;
  }

  .mobile-tabs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    background: #0d1217;
    font-weight: 850;
    text-decoration: none;
  }

  .mobile-tabs a.is-active {
    border-color: var(--gold);
    color: #09100c;
    background: var(--gold);
  }

  .planner-grid {
    grid-template-columns: 1fr;
    padding: 16px 12px 0;
  }

  .visual-summary,
  .visual-summary__content {
    min-height: 420px;
  }

  .visual-summary__overlay {
    background:
      linear-gradient(180deg, rgba(12, 16, 20, 0.62), rgba(12, 16, 20, 0.94)),
      linear-gradient(0deg, rgba(12, 16, 20, 0.82), transparent 58%);
  }

  .visual-summary__content {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .visual-summary h2 {
    font-size: 3rem;
  }

  .summary-strip div {
    text-align: left;
  }

  .selection-panel,
  .workspace {
    grid-column: 1;
  }

  .details-grid,
  .form-grid,
  .pace-grid {
    grid-template-columns: 1fr;
  }

  footer {
    padding: 0 12px 12px;
  }
}

@media (max-width: 430px) {
  .topbar h1 {
    font-size: 1.75rem;
  }

  .visual-summary h2 {
    font-size: 2.65rem;
  }

  .segment {
    flex-basis: 138px;
  }

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