:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #66707c;
  --line: #d9e0e8;
  --panel: #ffffff;
  --wash: #f5f7fa;
  --red: #d43f3a;
  --yellow: #f0b429;
  --gold-wash: #fff8e6;
  --blue: #2b6cb0;
  --green: #23856d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--wash);
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 28px clamp(18px, 4vw, 48px);
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--red);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
}

h1, h2, p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 48px);
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  margin-bottom: 14px;
}

main {
  padding: 24px clamp(18px, 4vw, 48px) 48px;
}

.toast {
  position: fixed;
  top: 96px;
  right: clamp(18px, 4vw, 48px);
  z-index: 20;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 18px 40px rgba(21, 29, 40, 0.16);
  padding: 12px 14px;
  font-weight: 800;
  transform: translateY(-12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.warning {
  border-color: #e3bc69;
  background: #fff8e8;
  color: #6d4500;
}

.toast.info {
  border-color: #8bbce8;
  background: #edf5ff;
  color: #17466f;
}

.tabbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0 14px;
  background: var(--wash);
}

.tab-button {
  width: auto;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 800;
}

.tab-button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.hidden-tab {
  display: none !important;
}

.focus-view {
  grid-template-columns: 1fr;
}

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

.summary span, .tag, .confidence {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
}

.toolbar {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 12px;
  margin-bottom: 18px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input[type="checkbox"] {
  width: auto;
}

.calendar-shell, .panel, .release-card, .pokemon-center-alert {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pokemon-center-alert {
  display: grid;
  grid-template-columns: minmax(220px, 0.45fr) 1fr;
  gap: 18px;
  align-items: start;
  padding: 16px;
  margin-bottom: 18px;
  background: var(--gold-wash);
  border-color: #efcf74;
}

.pokemon-center-alert h2 {
  margin-bottom: 0;
}

.pokemon-center-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.pokemon-center-card {
  background: #fff;
  border: 1px solid #efcf74;
  border-radius: 8px;
  padding: 12px;
}

.pokemon-center-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.pokemon-center-card p {
  color: var(--muted);
  line-height: 1.35;
  margin-bottom: 0;
  font-size: 13px;
}

.calendar-shell {
  padding: 16px;
  margin-bottom: 22px;
}

.month-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
  border: 1px solid transparent;
}

.legend-dot.availability-orderable {
  background: #25a45a;
}

.legend-dot.availability-scheduled {
  background: #c78916;
}

.legend-dot.availability-listed {
  background: #397ec2;
}

.legend-dot.availability-sold-out {
  background: #d43f3a;
}

.legend-dot.availability-unknown {
  background: #aab4bf;
}

.month-title h2 {
  margin: 0;
  font-size: 22px;
}

button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.text-button {
  width: auto;
  min-width: 120px;
  height: 40px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 800;
}

.text-button.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.tier-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 8px 10px;
}

.inline-toggle {
  display: inline-flex;
  align-items: center;
  align-self: end;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 10px 12px;
  white-space: nowrap;
}

.urgent-path-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.urgent-path-row {
  border: 1px solid #efcf74;
  border-left: 4px solid #d43f3a;
  border-radius: 8px;
  background: #fff8e8;
  padding: 10px 12px;
}

.urgent-path-row p {
  margin: 4px 0 0;
  color: #6d4500;
  font-size: 13px;
}

.ops-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.3fr);
  gap: 18px;
  margin-bottom: 18px;
}

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

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

.metric, .readiness-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.metric strong, .readiness-card strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.path-edit {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(4, auto);
  gap: 6px;
  grid-column: 1 / -1;
}

.path-edit input {
  padding: 8px 10px;
}

.small-button {
  width: auto;
  height: 34px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.metric.warning {
  border-color: #e4b74a;
  background: #fff8e6;
}

.queue-summary {
  border: 1px solid #bfd3ea;
  border-radius: 8px;
  background: #edf5ff;
  padding: 12px;
}

.queue-summary.warning {
  border-color: #e4b74a;
  background: #fff8e6;
}

.queue-summary p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.orderable-strip {
  margin: 10px 0 12px;
}

.compact-heading {
  margin-bottom: 8px;
}

.compact-heading h3 {
  margin: 0;
  font-size: 16px;
}

.orderable-actions {
  display: grid;
  gap: 8px;
}

.orderable-pill {
  display: grid;
  grid-template-columns: minmax(120px, 0.35fr) 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid #7cc9a4;
  border-left: 4px solid #25a45a;
  border-radius: 8px;
  background: #f0fbf5;
  color: #0f5e32;
  padding: 10px 12px;
  text-decoration: none;
}

.orderable-pill span {
  color: #1f6f43;
  font-size: 13px;
  font-weight: 700;
}

.selected-release {
  color: var(--muted);
  margin-bottom: 12px;
}

.buy-plan-list, .ledger-list, .cockpit-list {
  display: grid;
  gap: 10px;
}

.buy-row, .ledger-row, .cockpit-row, .seek-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.buy-row:first-child, .ledger-row:first-child, .cockpit-row:first-child, .seek-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.buy-row.availability-orderable, .cockpit-row.availability-orderable {
  border-left: 4px solid #25a45a;
  background: #f0fbf5;
  padding-left: 10px;
}

.buy-row.availability-scheduled, .cockpit-row.availability-scheduled {
  border-left: 4px solid #c78916;
  background: repeating-linear-gradient(135deg, #fff6df 0, #fff6df 12px, #f7e9c5 12px, #f7e9c5 24px);
  padding-left: 10px;
}

.buy-row.availability-listed, .cockpit-row.availability-listed {
  border-left: 4px solid #397ec2;
  background: repeating-linear-gradient(135deg, #f1f7ff 0, #f1f7ff 12px, #e7f1fb 12px, #e7f1fb 24px);
  padding-left: 10px;
}

.buy-row.availability-sold-out, .cockpit-row.availability-sold-out {
  border-left: 4px solid #d43f3a;
  background: #fff1ee;
  padding-left: 10px;
}

.buy-row.availability-unknown, .cockpit-row.availability-unknown {
  border-left: 4px solid #aab4bf;
  background: #f5f7f9;
  padding-left: 10px;
}

.seek-row.availability-orderable {
  border-left: 4px solid #23856d;
  border-top: 1px solid #7cc9a4;
  border-right: 1px solid #7cc9a4;
  border-bottom: 1px solid #7cc9a4;
  border-radius: 8px;
  background: #ecfbf2;
  box-shadow: 0 8px 22px rgba(37, 164, 90, 0.12);
  padding-left: 10px;
}

.seek-row.availability-orderable .tag:first-of-type {
  background: #dff7ea;
  border-color: #7cc9a4;
  color: #0f5e32;
}

.seek-row.availability-listed {
  border-left: 4px solid #397ec2;
  background: #f1f7ff;
  padding-left: 10px;
}

.seek-row.availability-sold-out {
  border-left: 4px solid #d43f3a;
  background: #fff1ee;
  padding-left: 10px;
}

.seek-row.availability-unknown, .seek-row.availability-wrong {
  border-left: 4px solid #aab4bf;
  background: #f5f7f9;
  padding-left: 10px;
}

.seek-row.marketplace-warning {
  border-left: 4px solid #c78916;
  background: #fff8e8;
  padding-left: 10px;
}

.buy-row p, .ledger-row p, .cockpit-row p, .seek-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.mini-select {
  max-width: 130px;
  padding: 8px;
}

.ledger-panel {
  margin-top: 16px;
}

.cockpit-panel {
  margin-bottom: 18px;
}

.cockpit-row {
  grid-template-columns: minmax(180px, 1fr) auto auto auto auto;
}

.tier-badge {
  border: 1px solid #bfd3ea;
  background: #edf5ff;
  color: #17466f;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
}

.status-tag.availability-orderable {
  border-color: #7cc9a4;
  background: #dff7ea;
  color: #0f5e32;
}

.status-tag.availability-scheduled {
  border-color: #e3bc69;
  background: #fff1c8;
  color: #6d4500;
}

.status-tag.availability-listed {
  border-color: #8bbce8;
  background: #dbeeff;
  color: #17466f;
}

.status-tag.availability-sold-out {
  border-color: #f0a69b;
  background: #ffe3dd;
  color: #8a271b;
}

.status-tag.availability-unknown, .status-tag.availability-wrong {
  border-color: #cbd4de;
  background: #eef1f4;
  color: #52606d;
}

.calendar-weekdays, .calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.calendar-weekdays span {
  padding: 6px;
}

.calendar-grid {
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.day {
  min-height: 118px;
  background: #fff;
  padding: 7px;
}

.day.has-orderable {
  background: #eefaf4;
  box-shadow: inset 0 0 0 2px #7cc9a4;
}

.day.has-scheduled {
  background: #fff8e8;
  box-shadow: inset 0 0 0 1px #e3bc69;
}

.day.has-listed {
  background: #edf5ff;
  box-shadow: inset 0 0 0 1px #8bbce8;
}

.day.has-sold-out {
  background: #fff1ee;
  box-shadow: inset 0 0 0 1px #f0a69b;
}

.day.outside {
  background: #f1f4f7;
  color: #9aa4af;
}

.day-number {
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.event-chip {
  display: block;
  width: 100%;
  height: auto;
  border: 0;
  margin: 4px 0;
  padding: 5px 6px;
  border-radius: 5px;
  background: #eaf2fb;
  color: #173f68;
  font-size: 11px;
  line-height: 1.25;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-chip span, .event-chip small {
  display: block;
}

.event-chip small {
  margin-top: 3px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.event-chip.in-store {
  background: #e7f5ef;
  color: #0f5e4b;
}

.event-chip.watch {
  background: #fff4d6;
  color: #744d00;
}

.event-chip.pokemon-center {
  background: #ffe8a3;
  color: #5b3b00;
  border-left: 3px solid var(--yellow);
}

.event-chip.availability-orderable {
  background: #dff7ea;
  color: #0f5e32;
  border-left: 3px solid #25a45a;
}

.event-chip.availability-scheduled {
  background: repeating-linear-gradient(135deg, #fff1c8 0, #fff1c8 10px, #f6e2aa 10px, #f6e2aa 20px);
  color: #6d4500;
  border-left: 3px solid #c78916;
}

.event-chip.availability-listed {
  background: repeating-linear-gradient(135deg, #e2f0ff 0, #e2f0ff 10px, #d4e8fb 10px, #d4e8fb 20px);
  color: #17466f;
  border-left: 3px solid #397ec2;
}

.event-chip.availability-sold-out {
  background: #ffe3dd;
  color: #8a271b;
  border-left: 3px solid #d43f3a;
}

.event-chip.availability-unknown {
  background: #eef1f4;
  color: #52606d;
  border-left: 3px solid #aab4bf;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.8fr);
  gap: 22px;
  align-items: start;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.section-heading span {
  color: var(--muted);
  font-size: 12px;
}

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

.release-card {
  padding: 16px;
}

.release-card.pokemon-center {
  border-color: #efcf74;
  box-shadow: inset 4px 0 0 var(--yellow);
}

.priority-tag {
  border: 1px solid #e5b832;
  background: #fff2c2;
  color: #5b3b00;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
}

.source-item.high-priority h3 a {
  color: #8a5c00;
}

.release-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.release-actions {
  margin-top: 10px;
}

.release-meta, .store-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.release-card p, .source-item p, .store-item p {
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 10px;
}

.panel {
  padding: 16px;
  margin-bottom: 14px;
}

.source-list, .store-list {
  display: grid;
  gap: 12px;
}

.source-item, .store-item {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.source-item:first-child, .store-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.source-item h3, .store-item h3 {
  font-size: 14px;
  margin: 0 0 6px;
}

.empty {
  border: 1px dashed var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  color: var(--muted);
}

.empty.compact {
  padding: 10px 12px;
  font-size: 13px;
}

@media (max-width: 860px) {
  .topbar, .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .toolbar, .content-grid, .pokemon-center-alert, .ops-grid, .budget-grid, .metric-grid, .readiness-grid, .path-edit {
    grid-template-columns: 1fr;
  }

  .buy-row, .ledger-row, .cockpit-row, .seek-row {
    grid-template-columns: 1fr;
  }

  .calendar-weekdays {
    display: none;
  }

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

  .day {
    min-height: 86px;
  }
}
