:root {
  color-scheme: light;
  --ink: #1f2528;
  --muted: #667076;
  --line: #d9dedf;
  --panel: #ffffff;
  --wash: #f4f7f4;
  --sage: #55786c;
  --teal: #1f6f78;
  --coral: #c85d4a;
  --gold: #a77823;
  --blue: #426b9e;
  --shadow: 0 18px 42px rgba(39, 48, 45, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(85, 120, 108, 0.11), transparent 38%),
    linear-gradient(315deg, rgba(200, 93, 74, 0.09), transparent 32%),
    var(--wash);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  -webkit-text-size-adjust: 100%;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 22px;
  min-height: 100vh;
  padding: 22px;
}

.sidebar,
.workspace,
.dashboard-strip {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(217, 222, 223, 0.9);
  box-shadow: var(--shadow);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
  border-radius: 8px;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
  border-radius: 8px;
  min-width: 0;
}

.dashboard-strip {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 18px 20px 20px;
  border-radius: 8px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--sage);
  color: #fff;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.45rem;
  line-height: 1.1;
}

h2 {
  font-size: 1.2rem;
  line-height: 1.2;
}

.brand p,
.eyebrow,
.summary-label,
.field span,
.meta {
  color: var(--muted);
}

.eyebrow {
  margin-bottom: 4px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.week-panel,
.summary-panel,
.dashboard-panel {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.section-heading,
.toolbar,
.toolbar-actions,
.quick-filters,
.view-tabs,
.roster-header,
.roster-player,
.player-top,
.player-actions,
.status-row,
.dialog-header,
.dialog-actions {
  display: flex;
  align-items: center;
}

.section-heading,
.toolbar,
.player-top,
.dialog-header {
  justify-content: space-between;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.field span {
  font-size: 0.83rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  outline: none;
}

input,
select {
  min-height: 44px;
  padding: 0 11px;
}

textarea {
  resize: vertical;
  padding: 10px 11px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(31, 111, 120, 0.16);
}

.summary-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.summary-panel div {
  min-width: 0;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(244, 247, 244, 0.7);
}

.summary-number {
  display: block;
  font-size: 1.55rem;
  font-weight: 850;
  line-height: 1;
}

.summary-label {
  display: block;
  margin-top: 5px;
  font-size: 0.75rem;
  font-weight: 700;
}

.week-list {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 2px 4px;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.week-card {
  display: grid;
  flex: 0 0 min(320px, 82vw);
  gap: 9px;
  width: min(320px, 82vw);
  min-height: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.week-card.is-selected {
  border-color: rgba(31, 111, 120, 0.48);
  background: #eaf3f0;
}

.week-card-date {
  font-size: 0.95rem;
  font-weight: 850;
}

.week-card-roster {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.week-roster-name {
  display: inline-flex;
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 999px;
  background: #eef2f0;
  color: #395750;
  font-size: 0.72rem;
  font-weight: 800;
}

.week-roster-name.is-confirmed {
  background: #dcefe9;
  color: #284f48;
}

.week-roster-name.is-maybe {
  background: #fff0d9;
  color: #765313;
}

.week-roster-name.is-out {
  background: #fde8e3;
  color: #8c392c;
}

.week-roster-empty {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

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

.sync-status {
  margin-top: -8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.sync-status[data-tone="warning"] {
  color: #8c392c;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: min(100%, 260px);
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.search-wrap input {
  border: 0;
  min-height: 42px;
  padding: 0;
  box-shadow: none;
}

.quick-filters {
  flex-wrap: wrap;
  gap: 8px;
}

.view-tabs {
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(244, 247, 244, 0.72);
}

.tab-button {
  flex: 1 1 0;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.tab-button.is-active {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(39, 48, 45, 0.08);
}

.view-panel {
  display: none;
}

.view-panel.is-active {
  display: grid;
  gap: 18px;
}

.primary-button,
.secondary-button,
.danger-button,
.filter-button,
.icon-button,
.status-button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
}

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

.secondary-button,
.filter-button {
  padding: 0 13px;
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.danger-button {
  padding: 0 13px;
  background: #fff;
  color: #9a3325;
  border-color: rgba(200, 93, 74, 0.45);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  padding: 0;
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
  font-size: 1.3rem;
  line-height: 1;
}

.filter-button.is-active {
  background: #e4efec;
  border-color: rgba(85, 120, 108, 0.38);
  color: #284f48;
}

.board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
  align-content: start;
}

.player-card {
  display: grid;
  gap: 14px;
  min-height: 235px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.player-card.is-inactive {
  background: #f7f7f5;
  opacity: 0.78;
}

.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
}

.player-name-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.player-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.02rem;
  font-weight: 850;
}

.meta {
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.84rem;
}

.player-actions {
  gap: 6px;
}

.status-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.status-button {
  width: 100%;
  padding: 0 8px;
  background: #fff;
  border-color: var(--line);
  color: var(--muted);
}

.status-button.is-selected[data-response="confirmed"] {
  background: #e1f0ec;
  border-color: rgba(85, 120, 108, 0.42);
  color: #284f48;
}

.status-button.is-selected[data-response="maybe"] {
  background: #fff0d9;
  border-color: rgba(167, 120, 35, 0.35);
  color: #765313;
}

.status-button.is-selected[data-response="out"] {
  background: #fde8e3;
  border-color: rgba(200, 93, 74, 0.38);
  color: #8c392c;
}

.details {
  display: grid;
  gap: 9px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.week-actions,
.roster-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  padding: 5px 8px;
  border-radius: 999px;
  background: #eef2f0;
  color: #395750;
  font-size: 0.75rem;
  font-weight: 800;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 40px 20px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  text-align: center;
  color: var(--muted);
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.roster-header {
  justify-content: space-between;
  gap: 12px;
}

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

.roster-player {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.roster-player-main {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) minmax(120px, 1fr) minmax(90px, 0.7fr) minmax(90px, 0.7fr) minmax(100px, 0.8fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.roster-cell {
  min-width: 0;
}

.roster-label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
  text-transform: uppercase;
}

.roster-value {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-notes {
  grid-column: 1 / -1;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

dialog {
  width: min(560px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 26px 70px rgba(31, 37, 40, 0.28);
}

dialog::backdrop {
  background: rgba(31, 37, 40, 0.36);
}

.dialog-form {
  padding: 20px;
}

.dialog-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

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

.dialog-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(340px, calc(100vw - 28px));
  padding: 12px 14px;
  border: 1px solid rgba(31, 111, 120, 0.28);
  border-radius: 8px;
  background: #1f2528;
  color: #fff;
  box-shadow: 0 18px 42px rgba(31, 37, 40, 0.24);
  font-size: 0.9rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

  .sidebar,
  .workspace,
  .dashboard-strip {
    padding: 16px;
  }

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

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

  .primary-button,
  .secondary-button,
  .toolbar-actions > *,
  .search-wrap {
    flex: 1 1 100%;
  }

  .quick-filters {
    flex-wrap: nowrap;
    margin: 0 -16px;
    padding: 0 16px 4px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .quick-filters::-webkit-scrollbar {
    display: none;
  }

  .filter-button {
    flex: 0 0 auto;
  }

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

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

  .roster-player {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

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

  .dashboard-strip {
    order: -1;
  }
}

@media (max-width: 520px) {
  body {
    background: var(--wash);
  }

  .app-shell {
    gap: 12px;
    padding: 10px;
  }

  .sidebar,
  .workspace {
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(39, 48, 45, 0.09);
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  h1 {
    font-size: 1.22rem;
  }

  h2 {
    font-size: 1.08rem;
  }

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

  .summary-panel div {
    padding: 10px 8px;
  }

  .summary-number {
    font-size: 1.3rem;
  }

  .summary-label {
    font-size: 0.68rem;
  }

  .field-grid,
  .status-row,
  .roster-player-main {
    grid-template-columns: 1fr;
  }

  .view-tabs {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .tab-button {
    font-size: 0.9rem;
  }

  .roster-value {
    white-space: normal;
  }

  .player-card {
    min-height: auto;
    padding: 14px;
  }

  .avatar {
    width: 40px;
    height: 40px;
  }

  .player-top {
    align-items: flex-start;
  }

  .player-name-wrap {
    max-width: calc(100% - 52px);
  }

  dialog {
    width: 100vw;
    max-width: none;
    max-height: min(88vh, 760px);
    margin: auto 0 0;
    border-radius: 8px 8px 0 0;
  }

  .dialog-form {
    max-height: min(88vh, 760px);
    overflow: auto;
    padding: 16px;
  }

  .dialog-actions {
    grid-template-columns: 1fr;
  }

  .dialog-actions span {
    display: none;
  }

  .toast {
    right: 10px;
    bottom: 10px;
    left: 10px;
    max-width: none;
  }
}
