html,
body {
  margin: 0;
  padding: 0;
}

.isu-stack > * + * {
  margin-top: 1.1rem;
}

.isu-stack-lg > * + * {
  margin-top: 1.5rem;
}

.isu-page-title {
  margin: 0 0 0.65rem 0;
}

.isu-page-subtitle {
  margin: 0 0 1.25rem 0;
}

.isu-inline-actions {
  display: flex;
  gap: 0.75rem;
  row-gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.isu-inline-actions-wide .isu-btn-primary,
.isu-inline-actions-wide .isu-btn-secondary,
.isu-inline-actions-wide .isu-btn-outline,
.isu-inline-actions-wide .isu-btn-danger {
  min-width: 10.5rem;
}

.isu-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.isu-toolbar .isu-page-title {
  margin-bottom: 0;
}

.isu-nav-content {
  width: 100%;
  position: relative;
}

.isu-nav-links {
  width: 100%;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
}

.isu-nav-links-left,
.isu-nav-links-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.isu-nav-links-right {
  margin-left: auto;
}

.isu-nav-mobile-header {
  display: none;
  width: 100%;
  justify-content: flex-start;
}

.isu-nav-toggle {
  min-width: 2.6rem;
  min-height: 2.3rem;
  padding: 0.35rem 0.55rem;
}

.isu-nav-toggle-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.isu-role-chip {
  font-weight: 700;
  border: 1px solid #d6dde8;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  background: #f7f9fc;
}

[data-theme="dark"] .isu-role-chip {
  border-color: var(--border-secondary);
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.isu-theme-toggle {
  min-width: 2.45rem;
  min-height: 2.2rem;
  padding: 0.2rem 0.45rem;
  justify-content: center;
}

.isu-theme-toggle-icon {
  font-size: 1.08rem;
  line-height: 1;
}

.isu-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.isu-form-group-inline {
  margin: 0;
}

.isu-form-group-inline .isu-form-label {
  margin-bottom: 0.4rem;
}

.isu-form-actions,
.isu-inline-actions.isu-inline-actions-end {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  margin-left: auto;
}

.isu-team-quick-add {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: end;
  gap: 0.75rem;
}

.isu-team-quick-field {
  margin: 0;
}

.isu-team-quick-add .isu-btn-primary {
  align-self: end;
  margin: 0;
}

.isu-match-setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 1.25rem;
}

.isu-match-date-row {
  grid-column: 1 / -1;
  max-width: 24rem;
}

.isu-match-managers-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 1.25rem;
}

.isu-match-form-section {
  display: grid;
  gap: 1rem;
}

.isu-match-form-heading {
  margin: 0;
}

.isu-manager-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 0.55rem;
  padding: 0.7rem;
  border: 1px solid #d6dde8;
  border-radius: 0.75rem;
  background: #f7f9fc;
  max-height: 15rem;
  overflow: auto;
}

[data-theme="dark"] .isu-manager-picker {
  background: var(--bg-secondary);
  border-color: var(--border-secondary);
}

.isu-manager-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid #d6dde8;
  border-radius: 0.6rem;
  background: #fff;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
}

[data-theme="dark"] .isu-manager-option {
  background: var(--bg-tertiary);
  border-color: var(--border-secondary);
  color: var(--text-secondary);
}

[data-theme="dark"] .isu-manager-option:hover {
  background: var(--bg-hover);
}

.isu-manager-option input {
  margin-top: 0.18rem;
}

.isu-form-help {
  margin: 0.45rem 0 0 0;
  color: #445066;
  font-size: 0.9rem;
}

[data-theme="dark"] .isu-form-help {
  color: var(--text-tertiary);
}

@media (max-width: 900px) {
  .isu-nav-mobile-header {
    display: flex;
    margin-bottom: 0;
    position: relative;
    z-index: 21;
  }

  .isu-nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 0.45rem);
    left: 0;
    right: 0;
    z-index: 20;
    background: #fff;
    border: 1px solid #d6dde8;
    border-radius: 0.85rem;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.14);
    padding: 0.85rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .isu-nav-links.is-open {
    display: flex;
  }

  .isu-nav-links-left,
  .isu-nav-links-right {
    width: 100%;
    margin-left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }

  .isu-nav-links-left {
    justify-content: flex-start;
  }

  .isu-nav-links-right {
    justify-content: flex-start;
    align-items: stretch;
    padding-top: 0.75rem;
    border-top: 1px solid #d6dde8;
  }

  .isu-nav-links .isu-nav-link {
    font-size: 0.95rem;
    padding: 0.18rem 0.12rem;
  }

  .isu-nav-links-right .isu-caption {
    font-size: 0.82rem;
  }

  .isu-nav-links-right form {
    width: 100%;
  }

  .isu-nav-links-right .isu-btn-outline {
    width: 100%;
    justify-content: center;
    min-height: 2.15rem;
    padding: 0.38rem 0.74rem;
    font-size: 0.9rem;
  }

  .isu-team-quick-add {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .isu-team-quick-add .isu-btn-primary {
    justify-self: end;
  }

  .isu-form-actions,
  .isu-inline-actions.isu-inline-actions-end {
    justify-content: flex-end;
  }

  .isu-form-actions-mobile-sticky {
    position: sticky;
    bottom: 0;
    z-index: 12;
    background: #fff;
    border-top: 1px solid #d6dde8;
    padding-top: 0.75rem;
    padding-bottom: calc(0.55rem + env(safe-area-inset-bottom));
  }

  [data-theme="dark"] .isu-form-actions-mobile-sticky {
    background: var(--bg-secondary);
    border-top-color: var(--border-secondary);
  }

  .isu-match-setup-grid,
  .isu-match-managers-grid {
    grid-template-columns: 1fr;
  }

  .isu-match-date-row {
    max-width: none;
  }

  .isu-manager-picker {
    grid-template-columns: 1fr;
    max-height: 12rem;
  }
}

@media (max-width: 900px) {
  [data-theme="dark"] .isu-nav-links {
    background: var(--bg-secondary);
    border-color: var(--border-secondary);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.45);
  }

  [data-theme="dark"] .isu-nav-links-right {
    border-top-color: var(--border-secondary);
  }

  [data-theme="dark"] .isu-nav-links .isu-nav-link {
    color: var(--text-secondary);
  }

  [data-theme="dark"] .isu-nav-links .isu-nav-link:hover,
  [data-theme="dark"] .isu-nav-links .isu-nav-link.active {
    color: var(--isu-primary-light);
  }

  [data-theme="dark"] .isu-nav-links-right .isu-caption {
    color: var(--text-secondary);
  }
}

@media (min-width: 901px) {
  .isu-nav-mobile-header {
    display: none;
  }

  .isu-nav-links {
    display: flex !important;
  }

  .isu-nav-links-right {
    margin-left: auto;
  }
}

.isu-main-alerts {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1.25rem 0;
}

.isu-main-alerts .isu-alert-success,
.isu-main-alerts .isu-alert-error,
.isu-main-alerts .isu-alert-info {
  display: flex;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 0.6rem 0.9rem;
  border-radius: 0.75rem;
  border: 1px solid transparent;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.isu-main-alerts .isu-alert-success {
  color: #0d7a47;
  background: #effcf5;
  border-color: #9adcb6;
}

.isu-main-alerts .isu-alert-error {
  color: #9f1239;
  background: #fff1f2;
  border-color: #f7a6b2;
}

.isu-main-alerts .isu-alert-info {
  color: #0f4d92;
  background: #eef5ff;
  border-color: #adcaf7;
}

.isu-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.isu-table-wrapper-fit {
  overflow-x: hidden;
}

.isu-table-responsive {
  width: 100%;
}

.isu-table-compact-mobile {
  width: 100%;
}

.isu-table tbody tr.isu-row-win {
  background: #effcf5;
}

.isu-table tbody tr.isu-row-loss {
  background: #fff1f2;
}

.isu-table tbody tr.isu-row-win:hover {
  background: #ddf7ea;
}

.isu-table tbody tr.isu-row-loss:hover {
  background: #ffe5ea;
}

[data-theme="dark"] .isu-table tbody tr.isu-row-win {
  background: #163527;
}

[data-theme="dark"] .isu-table tbody tr.isu-row-loss {
  background: #4a1f2f;
}

[data-theme="dark"] .isu-table tbody tr.isu-row-win:hover {
  background: #1d4431;
}

[data-theme="dark"] .isu-table tbody tr.isu-row-loss:hover {
  background: #5a2538;
}

[data-theme="dark"] .isu-table tbody tr.isu-row-win td,
[data-theme="dark"] .isu-table tbody tr.isu-row-loss td {
  color: #f3f4f6;
}

.isu-table tbody tr.isu-market-up td:nth-child(6),
.isu-table tbody tr.isu-market-up td:nth-child(7) {
  color: #0d7a47;
  font-weight: 700;
}

.isu-table tbody tr.isu-market-down td:nth-child(6),
.isu-table tbody tr.isu-market-down td:nth-child(7) {
  color: #b42318;
  font-weight: 700;
}

.isu-market-meta {
  margin: 0.65rem 0 0 0;
  color: #445066;
}

.isu-actions-column {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.isu-align-right {
  text-align: right;
}

.isu-cell-actions {
  text-align: right;
}

.isu-inline-actions-end {
  justify-content: flex-end;
  width: 100%;
}

.isu-home-quick-actions {
  width: 100%;
}

.isu-form-actions-mobile-sticky {
  position: static;
}

.isu-cell-actions form {
  margin: 0;
}

.isu-team-actions {
  justify-content: flex-end;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: nowrap;
}

.isu-team-actions form {
  margin: 0;
}

.isu-match-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: nowrap;
}

.isu-match-actions form {
  margin: 0;
}

.isu-row-actions {
  display: flex;
  gap: 0.75rem;
  row-gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.isu-row-form {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: wrap;
}

.isu-daily-filter-form {
  display: grid;
  grid-template-columns: minmax(180px, 220px) auto;
  gap: 0.65rem;
  align-items: end;
}

.isu-daily-filter-form .isu-form-group-inline {
  margin: 0;
}

.isu-daily-filter-button {
  display: flex;
  align-items: end;
}

.isu-daily-filter-button .isu-btn-secondary {
  min-height: 2.95rem;
}

.isu-user-actions {
  display: grid;
  gap: 0.65rem;
}

.isu-role-form {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.isu-role-form .isu-select {
  min-width: 13rem;
}

.isu-user-action-buttons {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: nowrap;
}

.isu-user-action-buttons form {
  margin: 0;
}

.isu-btn-primary,
.isu-btn-secondary,
.isu-btn-outline,
.isu-btn-danger {
  font-weight: 700;
  border-radius: 0.7rem;
  padding: 0.58rem 1rem;
  min-height: 2.5rem;
  transition: transform 0.12s ease, box-shadow 0.2s ease;
}

.isu-btn-primary:hover,
.isu-btn-secondary:hover,
.isu-btn-outline:hover,
.isu-btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(23, 35, 58, 0.15);
}

.isu-btn-primary:focus-visible,
.isu-btn-secondary:focus-visible,
.isu-btn-outline:focus-visible,
.isu-btn-danger:focus-visible {
  outline: 3px solid rgba(31, 111, 235, 0.32);
  outline-offset: 2px;
}

.isu-btn-danger {
  border: 1px solid #c62828;
  background: #c62828;
  color: #fff;
}

.isu-btn-danger:hover {
  background: #b71c1c;
  border-color: #b71c1c;
}

.isu-btn-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.isu-btn-compact {
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 0.55rem;
  padding: 0.34rem 0.62rem;
  min-height: 2rem;
}

.isu-mt {
  margin-top: 1rem;
}

.isu-empty-note {
  margin: 0;
}

@media (min-width: 901px) {
  .isu-matches-table {
    width: 100%;
    table-layout: fixed;
  }

  .isu-matches-table th,
  .isu-matches-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .isu-matches-table th,
  .isu-matches-table td {
    padding: 0.58rem 0.62rem;
  }

  .isu-matches-table th:nth-child(1),
  .isu-matches-table td:nth-child(1) {
    width: 12%;
  }

  .isu-matches-table th:nth-child(2),
  .isu-matches-table td:nth-child(2) {
    width: 22%;
  }

  .isu-matches-table th:nth-child(3),
  .isu-matches-table td:nth-child(3) {
    width: 6%;
  }

  .isu-matches-table th:nth-child(4),
  .isu-matches-table td:nth-child(4) {
    width: 20%;
  }

  .isu-matches-table th:nth-child(5),
  .isu-matches-table td:nth-child(5) {
    width: 20%;
  }

  .isu-matches-table th:nth-child(6),
  .isu-matches-table td:nth-child(6) {
    width: 10%;
  }

  .isu-matches-table th:nth-child(7),
  .isu-matches-table td:nth-child(7) {
    width: 10%;
  }

  .isu-matches-table .isu-cell-actions {
    overflow: visible;
    text-overflow: clip;
  }

  .isu-matches-table .isu-match-actions {
    gap: 0.3rem;
  }

  .isu-matches-table .isu-btn-compact {
    font-size: 0.8rem;
    padding: 0.25rem 0.46rem;
    min-height: 1.8rem;
  }
}

@media (max-width: 900px) {
  .isu-table-responsive thead {
    display: none;
  }

  .isu-table-responsive,
  .isu-table-responsive tbody,
  .isu-table-responsive tr,
  .isu-table-responsive td {
    display: block;
    width: 100%;
  }

  .isu-table-responsive tbody {
    display: grid;
    gap: 0.85rem;
  }

  .isu-table-responsive tr {
    border: 1px solid #d6dde8;
    border-radius: 0.9rem;
    padding: 0.8rem 0.9rem;
    background: #fff;
  }

  .isu-table-responsive tr.isu-row-win {
    background: #effcf5;
    border-color: #9adcb6;
  }

  .isu-table-responsive tr.isu-row-loss {
    background: #fff1f2;
    border-color: #f7a6b2;
  }

  .isu-table-responsive td {
    border: 0;
    padding: 0.3rem 0;
    display: grid;
    grid-template-columns: minmax(92px, 42%) 1fr;
    column-gap: 0.7rem;
    align-items: start;
    text-align: left;
  }

  .isu-table-responsive td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #2e3a4f;
  }

  .isu-table-responsive .isu-actions-column,
  .isu-table-responsive .isu-cell-actions {
    border-top: 1px dashed #d6dde8;
    margin-top: 0.55rem;
    padding-top: 0.65rem;
  }

  .isu-table-responsive .isu-actions-column::before,
  .isu-table-responsive .isu-cell-actions::before {
    content: none;
  }

  .isu-table-responsive .isu-match-actions,
  .isu-table-responsive .isu-team-actions,
  .isu-table-responsive .isu-user-action-buttons {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .isu-table-responsive .isu-team-actions,
  .isu-table-responsive .isu-user-action-buttons {
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
  }

  .isu-table-responsive .isu-team-actions .isu-btn-compact,
  .isu-table-responsive .isu-user-action-buttons .isu-btn-compact {
    white-space: nowrap;
    font-size: 0.8rem;
    padding: 0.28rem 0.5rem;
    min-height: 1.85rem;
  }

  [data-theme="dark"] .isu-table-responsive tr {
    background: var(--bg-tertiary);
    border-color: var(--border-secondary);
  }

  [data-theme="dark"] .isu-table-responsive tr.isu-row-win {
    background: #163527;
    border-color: #2e6b4e;
  }

  [data-theme="dark"] .isu-table-responsive tr.isu-row-loss {
    background: #4a1f2f;
    border-color: #7a3b53;
  }

  [data-theme="dark"] .isu-table-responsive td {
    color: var(--text-secondary);
  }

  [data-theme="dark"] .isu-table-responsive td::before {
    color: var(--text-primary);
  }

  [data-theme="dark"] .isu-table-responsive .isu-actions-column,
  [data-theme="dark"] .isu-table-responsive .isu-cell-actions {
    border-top-color: var(--border-secondary);
  }
}

@media (max-width: 576px) {
  .isu-card {
    padding: 1rem;
  }

  .isu-toolbar {
    align-items: stretch;
  }

  .isu-toolbar .isu-inline-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .isu-inline-actions-wide .isu-btn-primary,
  .isu-inline-actions-wide .isu-btn-secondary,
  .isu-inline-actions-wide .isu-btn-outline,
  .isu-inline-actions-wide .isu-btn-danger {
    min-width: 0;
  }

  .isu-home-quick-actions {
    flex-wrap: nowrap;
    gap: 0.45rem;
  }

  .isu-home-quick-actions .isu-btn-primary,
  .isu-home-quick-actions .isu-btn-secondary,
  .isu-home-quick-actions .isu-btn-outline {
    flex: 1 1 0;
    width: 100%;
    padding: 0.44rem 0.3rem;
    min-height: 2.2rem;
    font-size: 0.82rem;
    white-space: nowrap;
    text-align: center;
  }

  .isu-table-responsive td {
    grid-template-columns: minmax(78px, 40%) 1fr;
  }

  .isu-manager-option {
    font-size: 0.92rem;
  }

  .isu-daily-filter-form {
    grid-template-columns: 1fr auto;
  }

  .isu-daily-filter-form .isu-input {
    min-width: 0;
  }
}

@media (max-width: 900px) {
  .isu-table-compact-mobile {
    min-width: 0;
    table-layout: fixed;
    font-size: 0.7rem;
  }

  .isu-table-compact-mobile th,
  .isu-table-compact-mobile td {
    padding: 0.38rem 0.22rem;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.15;
  }

  .isu-table-compact-mobile th,
  .isu-table-compact-mobile td {
    text-align: center;
  }

  .isu-table-compact-mobile th:nth-child(2),
  .isu-table-compact-mobile td:nth-child(2) {
    width: 26%;
    text-align: left;
  }

  .isu-table-compact-mobile th:nth-child(1),
  .isu-table-compact-mobile td:nth-child(1) {
    width: 8%;
  }

  .isu-table-compact-mobile td:nth-child(2) .isu-nav-link {
    font-size: 0.68rem;
    line-height: 1.1;
  }
}
