:root {
  color-scheme: light;
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-soft: #eef4f2;
  --ink: #1d2528;
  --muted: #667275;
  --line: #d9dfdc;
  --accent: #1f7a68;
  --accent-strong: #16594d;
  --accent-soft: #dff1ec;
  --sidebar-bg: #172124;
  --warn: #b35b14;
  --warn-soft: #fff0df;
  --danger: #b43d3d;
  --danger-soft: #ffe7e7;
  --blue: #2c628f;
  --blue-soft: #e4eff7;
  --shadow: 0 18px 50px rgba(29, 37, 40, 0.09);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  background:
    linear-gradient(135deg, rgba(31, 122, 104, 0.08), transparent 38%),
    linear-gradient(45deg, rgba(44, 98, 143, 0.08), transparent 42%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.auth-locked {
  display: none !important;
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(73, 182, 156, 0.18), rgba(244, 196, 48, 0.12)),
    var(--bg);
}

.auth-card {
  width: min(560px, 100%);
  display: grid;
  gap: 18px;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.auth-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-header h1,
.auth-header p {
  margin: 0;
}

.auth-header p:not(.eyebrow) {
  color: var(--muted);
  margin-top: 6px;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label,
.admin-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.auth-form input,
.admin-form input,
.admin-form select {
  min-height: 42px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
}

.checkbox-line {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-line input {
  min-height: auto;
}

.auth-secret {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius);
  background: #f7fbfa;
  border: 1px solid var(--line);
}

.auth-secret strong {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  word-break: break-all;
  letter-spacing: 1px;
}

.auth-secret small,
.auth-note {
  color: var(--muted);
  line-height: 1.45;
}

.auth-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.auth-user-card {
  display: grid;
  gap: 10px;
}

.auth-user-card .secondary-button {
  width: 100%;
  justify-content: center;
}

.app-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 100vh;
  min-width: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  background: var(--sidebar-bg);
  color: #f8fbfa;
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: #49b69c;
  color: #10201d;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #b6c7c4;
  font-size: 13px;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #dce8e5;
  padding: 0 12px;
  text-align: left;
}

.nav-item span {
  width: 22px;
  color: #88d8c6;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.sidebar-card {
  margin-top: auto;
  padding: 16px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.11);
}

.sidebar-card strong,
.sidebar-card small {
  display: block;
}

.sidebar-card strong {
  margin-top: 8px;
}

.sidebar-card small {
  color: #b6c7c4;
  margin-top: 4px;
}

.workspace {
  padding: 28px;
  max-width: none;
  width: 100%;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.topbar > div {
  min-width: 0;
}

.topbar h1,
.section-header h2,
.modal-header h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
}

.topbar-actions,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar .eyebrow {
  color: #88d8c6;
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  min-height: 40px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 750;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.primary-button {
  background: var(--accent);
  color: white;
  padding: 0 16px;
}

.secondary-button {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
  padding: 0 14px;
}

.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #ffc7c7;
  padding: 0 14px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
  font-size: 20px;
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  min-height: 132px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.stat-card span,
.stat-card small,
.muted {
  color: var(--muted);
}

.stat-card span,
.stat-card small {
  display: block;
}

.stat-card strong {
  display: block;
  margin: 14px 0 8px;
  font-size: 32px;
  letter-spacing: 0;
}

.tool-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 220px 190px;
  gap: 10px;
  margin-bottom: 18px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
}

.search-box input,
.tool-row select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.tool-row select {
  min-height: 46px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
}

.section-panel {
  display: none;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.section-panel.current {
  display: block;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 22px;
}

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

.platform-overview {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.platform-summary {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

.platform-summary-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.platform-summary-head strong,
.platform-summary-head small {
  display: block;
}

.platform-summary-head small {
  color: var(--muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platform-badge {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 900;
  font-size: 12px;
}

.platform-summary-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.platform-summary-stats span {
  padding: 6px 8px;
  border-radius: var(--radius);
  background: #f6f8f7;
  color: var(--muted);
  font-size: 12px;
}

.promo-card {
  display: grid;
  gap: 14px;
  min-height: 234px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

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

.promo-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.promo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.pill.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.pill.planned {
  background: var(--blue-soft);
  color: var(--blue);
}

.pill.risk {
  background: var(--warn-soft);
  color: var(--warn);
}

.pill.done {
  background: #eceeed;
  color: var(--muted);
}

.price-line {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.price-line strong {
  font-size: 26px;
}

.price-line del {
  color: var(--muted);
}

.progress-wrap {
  display: grid;
  gap: 8px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.progress {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #e6ebe9;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.campaign-table-wrap {
  overflow-x: auto;
  max-width: 100%;
}

.campaign-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}

.campaign-table th,
.campaign-table td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.campaign-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: #f9faf8;
}

.campaign-table tr:last-child td {
  border-bottom: 0;
}

.library-layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.family-grid {
  display: grid;
  gap: 10px;
}

.family-card {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 13px;
  text-align: left;
}

.family-card.selected,
.family-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.family-card span,
.family-card small {
  color: var(--muted);
}

.family-detail {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.event-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.switch-event-board {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.event-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.event-chip {
  display: grid;
  gap: 4px;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8faf9;
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.event-chip.high {
  border-color: #f5c2c2;
  background: #ffecec;
}

.event-chip.medium {
  border-color: #f2d9a6;
  background: #fff5dd;
}

.event-chip.low {
  border-color: #c6e4da;
  background: #ebf8f2;
}

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

.portfolio-scale {
  display: grid;
  grid-template-columns: 220px repeat(4, 1fr);
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.portfolio-scale span:first-child {
  opacity: 0;
}

.portfolio-lanes {
  display: grid;
  gap: 10px;
}

.portfolio-lane {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.portfolio-lane.event-lane {
  grid-template-columns: 208px minmax(0, 1fr);
}

.lane-actions {
  display: grid;
  gap: 6px;
  align-content: center;
}

.portfolio-bar {
  position: absolute;
  display: grid;
  align-content: center;
  gap: 1px;
  height: 28px;
  min-width: 34px;
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  padding: 0 8px;
  text-align: left;
}

.portfolio-bar span,
.portfolio-bar small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portfolio-bar span {
  font-size: 11px;
  font-weight: 800;
}

.portfolio-bar small {
  font-size: 10px;
  opacity: 0.85;
}

.portfolio-bar.family {
  background: var(--accent);
}

.portfolio-bar.family.near-event {
  background: var(--warn);
}

.portfolio-bar.risk-bar {
  background: var(--warn);
}

.portfolio-bar.family.xbox {
  background: var(--blue);
}

.portfolio-bar.family.playstation {
  background: #315aa6;
}

.portfolio-bar.family.steam {
  background: #355e9a;
}

.portfolio-bar.family.epic {
  background: #7a4fbd;
}

.portfolio-bar.event {
  background: #5479b8;
}

.portfolio-bar.event.high {
  background: #b43d3d;
}

.portfolio-bar.event.medium {
  background: #b37a22;
}

.portfolio-bar.event.low {
  background: #2c8a6f;
}

.event-warning {
  display: block;
  color: var(--warn);
  font-size: 12px;
}

.family-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.family-detail-header h2 {
  margin: 0;
}

.family-detail-header span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.title-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.title-chip {
  display: grid;
  gap: 4px;
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 11px;
  text-align: left;
}

.title-chip strong,
.title-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.family-schedule-wrap {
  overflow: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.family-schedule {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.family-schedule th,
.family-schedule td {
  width: 50px;
  min-width: 50px;
  max-width: 50px;
  height: 28px;
  border: 1px solid #dce2df;
  padding: 0;
  text-align: center;
  font-size: 12px;
}

.family-schedule thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #d7efd6;
  color: #081310;
  font-weight: 800;
  padding: 6px;
  line-height: 1.15;
  overflow-wrap: anywhere;
  white-space: normal;
}

.family-schedule thead tr:nth-child(2) th {
  background: #bddcf8;
}

.family-schedule thead tr:nth-child(3) th {
  background: #ffe69c;
}

.family-schedule .date-head,
.family-schedule tbody th {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 88px;
  min-width: 88px;
  max-width: 88px;
  background: #f9faf8;
}

.family-schedule tbody th {
  color: var(--muted);
  font-weight: 750;
}

.family-schedule button {
  width: 100%;
  height: 100%;
  min-height: 28px;
  border: 0;
  background: transparent;
  color: inherit;
}

.schedule-cell.promo-cell {
  background: #b9d2f5;
}

.schedule-cell.cooldown-cell {
  background: #b9b9b9;
}

.schedule-cell.start-cell {
  background: #ff1212;
  color: #ffffff;
  font-weight: 900;
}

.family-schedule tr.today-row th,
.family-schedule tr.today-row td {
  box-shadow: inset 0 0 0 999px rgba(255, 245, 0, 0.45);
}

.game-cell strong,
.game-cell span {
  display: block;
}

.game-cell span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.small-button {
  min-height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
  font-weight: 750;
}

.timeline {
  display: grid;
  gap: 12px;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.calendar-scale {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 10px;
  padding-left: 186px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.calendar-lanes {
  display: grid;
  gap: 10px;
  overflow-x: visible;
  padding-bottom: 4px;
}

.calendar-lane {
  display: grid;
  grid-template-columns: 174px minmax(620px, 1fr);
  gap: 12px;
  align-items: stretch;
}

.lane-label {
  display: grid;
  align-content: center;
  gap: 4px;
  min-height: 64px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

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

.lane-track {
  position: relative;
  min-height: 64px;
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(29, 37, 40, 0.09) 1px, transparent 1px) 0 0 / 33.333% 100%,
    #f7f9f8;
  border: 1px solid var(--line);
}

.calendar-bar {
  position: absolute;
  display: grid;
  align-content: center;
  gap: 1px;
  height: 30px;
  min-width: 44px;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: var(--blue);
  color: #ffffff;
  padding: 0 9px;
  text-align: left;
  box-shadow: 0 8px 18px rgba(44, 98, 143, 0.2);
}

.calendar-bar span,
.calendar-bar small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-bar span {
  font-size: 12px;
  font-weight: 800;
}

.calendar-bar small {
  font-size: 10px;
  opacity: 0.86;
}

.calendar-bar.switch-bar {
  background: var(--accent);
  box-shadow: 0 8px 18px rgba(31, 122, 104, 0.2);
}

.calendar-bar.xbox-bar {
  background: var(--blue);
  box-shadow: 0 8px 18px rgba(44, 91, 166, 0.18);
}

.calendar-bar.playstation-bar {
  background: #315aa6;
  box-shadow: 0 8px 18px rgba(49, 90, 166, 0.18);
}

.calendar-bar.steam-bar {
  background: #355e9a;
  box-shadow: 0 8px 18px rgba(53, 94, 154, 0.2);
}

.calendar-bar.epic-bar {
  background: #7a4fbd;
  box-shadow: 0 8px 18px rgba(122, 79, 189, 0.2);
}

.calendar-bar.event-bar {
  border: 2px dashed rgba(255, 255, 255, 0.58);
  filter: saturate(0.85);
}

.calendar-bar.risk-bar {
  background: var(--warn);
}

.timeline-item {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr) 120px;
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.timeline-date {
  color: var(--muted);
  font-size: 13px;
}

.timeline-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: #e6ebe9;
}

.timeline-bar {
  position: absolute;
  top: 0;
  height: 100%;
  min-width: 10px;
  border-radius: 999px;
  background: var(--blue);
}

.switch-starts {
  margin-top: 22px;
}

.xbox-rule-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.xbox-rule-card {
  display: grid;
  gap: 5px;
  min-height: 104px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.xbox-rule-card strong {
  font-size: 18px;
}

.xbox-rule-card span,
.xbox-rule-card small {
  color: var(--muted);
}

.playstation-rule-card {
  border-color: #d6e0f2;
  background: #f6f8fc;
}

.playstation-calendar .deadline-cell button {
  background: #f6c400;
  color: #1f2a33;
  font-weight: 900;
}

.playstation-table {
  min-width: 1180px;
}

.xbox-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 16px;
  align-items: start;
}

.xbox-main,
.xbox-side {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.xbox-check-panel {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.xbox-check-panel h2 {
  margin: 0;
  font-size: 18px;
}

.xbox-timeline {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.xbox-scale {
  min-width: 720px;
}

.xbox-lane {
  grid-template-columns: 170px minmax(520px, 1fr);
}

.portfolio-bar.xbox.ok {
  background: var(--blue);
}

.portfolio-bar.xbox.warning {
  background: var(--warn);
}

.xbox-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.xbox-calendar-wrap {
  display: grid;
  gap: 10px;
}

.xbox-family-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.xbox-family-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.xbox-daily-wrap {
  max-height: 640px;
}

.xbox-daily-calendar th,
.xbox-daily-calendar td {
  width: 84px;
  min-width: 84px;
  max-width: 84px;
}

.xbox-daily-calendar thead th {
  background: #e6eff8;
}

.xbox-daily-calendar thead tr:nth-child(2) th {
  background: #d8eadf;
}

.xbox-daily-calendar thead tr:nth-child(3) th {
  background: #fff0c7;
  font-size: 11px;
}

.schedule-cell.warning-cell {
  outline: 2px solid var(--warn);
  outline-offset: -2px;
}

.xbox-warning-list {
  display: grid;
  gap: 8px;
}

.xbox-warning {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 58px;
  border: 1px solid #f0c491;
  border-radius: 6px;
  background: var(--warn-soft);
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.xbox-warning.static {
  min-height: auto;
}

.xbox-warning span {
  color: var(--warn);
  font-size: 13px;
}

.xbox-form-rules {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.xbox-form-summary,
.xbox-ok {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #f7f9f8;
}

.xbox-form-summary span,
.xbox-ok {
  color: var(--muted);
  font-size: 13px;
}

.switch-rule-summary {
  margin-top: 12px;
}

.switch-rule-summary ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.rule-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.compact-empty {
  min-height: 112px;
}

.compact-header {
  margin-top: 6px;
}

.switch-start-list {
  display: grid;
  gap: 14px;
}

.start-day {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

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

.start-day > header strong,
.start-day > header span {
  display: block;
}

.start-day > header span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

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

.region-column {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 122px;
  padding: 12px;
  border-radius: var(--radius);
  background: #f7f9f8;
  border: 1px solid var(--line);
}

.region-column h3 {
  margin: 0;
  font-size: 15px;
}

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

.version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px;
  text-align: left;
}

.version-row span,
.version-row strong,
.version-row small {
  display: block;
  min-width: 0;
}

.version-row strong,
.version-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.version-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.version-row em,
.cooldown-note {
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
}

.cooldown-ok {
  color: var(--accent-strong);
}

.cooldown-risk,
.cooldown-note {
  color: var(--warn);
}

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

.task-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.task-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.task-card h3 {
  margin: 0;
}

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

.task-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  background: #f7f9f8;
}

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

.modal {
  width: min(980px, calc(100vw - 28px));
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(14, 20, 22, 0.48);
  backdrop-filter: blur(2px);
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 18px;
}

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

form label,
.checklist-fieldset {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

form input,
form select,
form textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fbfcfb;
  padding: 9px 11px;
}

form textarea {
  resize: vertical;
  margin-top: 14px;
}

.form-span {
  margin-top: 14px;
}

.switch-options {
  display: none;
  margin: 14px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7f9f8;
}

.switch-mode .switch-options {
  display: grid;
}

.switch-options legend {
  padding: 0 6px;
  color: var(--ink);
}

.inline-check,
.region-checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.inline-check input,
.region-checks input {
  width: 18px;
  height: 18px;
  min-height: auto;
  accent-color: var(--accent);
}

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

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

.checklist-fieldset {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 14px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.checklist-fieldset legend {
  padding: 0 6px;
  color: var(--ink);
}

.checklist-fieldset label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.checklist-fieldset input {
  width: 18px;
  height: 18px;
  min-height: auto;
  accent-color: var(--accent);
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 20px;
}

.modal-actions .danger-button {
  margin-right: auto;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 190px;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.empty-state strong {
  color: var(--ink);
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
}

.admin-box {
  min-width: 0;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

.admin-form {
  grid-template-columns: 1fr;
}

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

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.settings-box {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

.settings-box label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.settings-box input {
  min-height: 42px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
}

.settings-platforms label {
  grid-template-columns: 1fr 72px;
  align-items: center;
}

.settings-actions {
  grid-column: 1 / -1;
}

.hidden {
  display: none !important;
}

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

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .nav {
    display: flex;
    flex: 1 1 420px;
    overflow-x: auto;
  }

  .nav-item {
    width: auto;
    white-space: nowrap;
  }

  .sidebar-card {
    margin: 0;
  }

  .stats-grid,
  .priority-grid,
  .task-board,
  .region-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .library-layout {
    grid-template-columns: 1fr;
  }

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

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

  .xbox-layout {
    grid-template-columns: 1fr;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

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

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

  .portfolio-scale {
    grid-template-columns: 1fr repeat(4, minmax(120px, 1fr));
    min-width: 760px;
  }

  .portfolio-lanes {
    min-width: 760px;
  }

  .portfolio-lane,
  .portfolio-lane.event-lane {
    grid-template-columns: 180px minmax(420px, 1fr);
  }

  .lane-actions {
    display: none;
  }
}

@media (max-width: 760px) {
  .sidebar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 18px;
  }

  .nav {
    width: 100%;
    max-width: 100%;
    flex: none;
  }

  .workspace {
    padding: 18px;
  }

  .topbar,
  .section-header,
  .timeline-item {
    align-items: stretch;
    flex-direction: column;
    display: flex;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .primary-button {
    flex: 1;
    min-width: 0;
  }

  .stats-grid,
  .priority-grid,
  .task-board,
  .region-grid,
  .platform-overview,
  .form-grid,
  .checklist-fieldset,
  .region-checks,
  .switch-selector-grid,
  .family-grid,
  .xbox-family-grid,
  .tool-row {
    grid-template-columns: 1fr;
  }

  .xbox-family-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .event-list {
    grid-template-columns: 1fr;
  }

  .xbox-rule-grid {
    grid-template-columns: 1fr;
  }

  .xbox-lane {
    grid-template-columns: 1fr;
    min-width: 720px;
  }

  .stat-card {
    min-height: 112px;
  }

  .timeline-item {
    gap: 10px;
  }

  .calendar-scale {
    min-width: 760px;
    padding-left: 0;
  }

  .calendar-lanes {
    min-width: 760px;
  }

  .calendar-lane {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .start-day > header {
    align-items: stretch;
    flex-direction: column;
  }

  .family-detail-header {
    align-items: stretch;
    flex-direction: column;
  }
}
