/*
 * Open Play operator workspace.
 * Session creation, court-ledger controls, and compact action menus are kept
 * separate from the shared admin design system to reduce cross-screen regressions.
 */

.openplay-workspace-tabs {
  display: inline-flex;
  max-width: 100%;
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid #d7dfe2;
  border-radius: 9px;
  background: #edf1f2;
  scrollbar-width: none;
}

.openplay-workspace-tabs::-webkit-scrollbar { display: none; }

.openplay-workspace-tabs button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #5d6b74;
  font-size: 12px;
  font-weight: 850;
}

.openplay-workspace-tabs button span {
  display: inline-grid;
  min-width: 22px;
  min-height: 22px;
  margin-left: 6px;
  place-items: center;
  border-radius: 999px;
  background: #dce3e6;
  color: #4f5e67;
  font-size: 11px;
}

.openplay-workspace-tabs button[aria-selected="true"] {
  background: #121c24;
  color: #fff;
  box-shadow: 0 5px 14px rgba(18, 28, 36, .15);
}

.openplay-workspace-tabs button[aria-selected="true"] span {
  background: #ffd21f;
  color: #17212a;
}

.openplay-workspace,
.openplay-workspace-panel { min-width: 0; }

.openplay-creation-step {
  display: grid;
  gap: 16px;
  padding: 21px 22px;
  border: 1px solid #d7e0e3;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(22, 36, 44, .04);
}

.openplay-session-detail-fields {
  align-items: start;
}

.openplay-session-detail-fields > .field {
  align-content: start;
}

.openplay-session-detail-fields > .field > input,
.openplay-session-detail-fields > .field > select {
  height: var(--control-md);
  min-height: var(--control-md);
}

.openplay-step-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e6ebed;
}

.openplay-step-heading > span {
  display: grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  background: #17242c;
  color: #ffd21f;
  font-size: 13px;
  font-weight: 950;
}

.openplay-step-heading h4 {
  margin: 0;
  color: #17242c;
  font-size: 17px;
  letter-spacing: -.02em;
}

.openplay-step-heading p {
  margin: 4px 0 0;
  color: #68767f;
  font-size: 13px;
  line-height: 1.5;
}

.openplay-session-editor .openplay-creation-step:nth-of-type(2) {
  grid-template-columns: minmax(230px, .38fr) minmax(0, .62fr);
  align-items: stretch;
}

.openplay-session-editor .openplay-creation-step:nth-of-type(2) .openplay-step-heading {
  grid-column: 1 / -1;
}

.openplay-court-ledger {
  display: grid;
  gap: 11px;
}

.openplay-court-ledger-state {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 18px;
  border: 1px dashed #bdc9ce;
  border-radius: 9px;
  background: #fff;
  color: #65747d;
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

.openplay-court-ledger-state.is-empty {
  color: #7d514b;
  border-color: #e1c5c0;
  background: #fff7f5;
}

.openplay-ledger-legend,
.openplay-ledger-events {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: #64727b;
  font-size: 12px;
}

.openplay-ledger-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
}

.openplay-ledger-legend i {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: #e3f5ef;
}

.openplay-ledger-legend i.occupied { background: #f4dedb; }

.openplay-ledger-slots {
  display: grid;
  grid-template-columns: repeat(8, minmax(72px, 1fr));
  gap: 8px;
}

.openplay-ledger-slot {
  min-height: 58px;
  display: grid;
  gap: 3px;
  place-items: center;
  padding: 7px;
  border: 1px solid #b9dcd1;
  border-radius: 8px;
  background: #f1fbf7;
  color: #185f50;
}

.openplay-ledger-slot span { font-size: 13px; font-weight: 900; }
.openplay-ledger-slot small { font-size: 11px; font-weight: 750; }
.openplay-ledger-slot:hover:not(:disabled),
.openplay-ledger-slot:focus-visible { border-color: #17242c; box-shadow: 0 0 0 3px rgba(23, 36, 44, .1); }
.openplay-ledger-slot.is-selected { color: #fff; border-color: #17242c; background: #17242c; box-shadow: inset 0 -3px 0 #ffd21f; }
.openplay-ledger-slot.is-occupied { color: #8b5e57; border-color: #ead3cf; background: #f8eeee; opacity: .72; }

.openplay-ledger-events {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f0f3f4;
}

.openplay-ledger-events span { line-height: 1.5; }

.openplay-selected-time {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px 14px;
  min-height: 100%;
  padding: 15px 17px;
  border-left: 4px solid #1d9b78;
  border-radius: 8px;
  background: #eef9f5;
}

.openplay-selected-time > span {
  grid-row: span 2;
  color: #5c6b73;
  font-size: 12px;
  font-weight: 800;
}

.openplay-selected-time strong { color: #17242c; font-size: 20px; letter-spacing: -.02em; }
.openplay-selected-time strong em {
  display: inline-flex;
  min-height: 24px;
  margin-left: 9px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  color: #17664f;
  background: #dff3ec;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0;
  vertical-align: middle;
}
.openplay-selected-time small { color: #61727b; font-size: 12px; }
.openplay-selected-time.is-invalid { border-left-color: #c05245; background: #fff1ef; }

.openplay-duration-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.openplay-duration-button {
  min-height: 48px;
  border: 1px solid #d3dce0;
  border-radius: 8px;
  background: #fff;
  color: #485760;
  font-size: 13px;
  font-weight: 850;
}

.openplay-duration-button.is-selected {
  color: #17242c;
  border-color: #d7b800;
  background: #fff7c9;
  box-shadow: inset 0 -2px 0 #d7b800;
}

.openplay-duration-button:disabled { opacity: .38; cursor: not-allowed; }

.openplay-session-editor .openplay-editor-actions {
  justify-content: flex-end;
  padding-top: 2px;
}

.openplay-session-editor .openplay-editor-actions .primary {
  min-width: 190px;
  min-height: 48px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.openplay-ai-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid #d6e1df;
  border-left: 5px solid #ffd21f;
  border-radius: 11px;
  background: linear-gradient(120deg, #fffdf0, #f2faf7 62%, #f1f7fa);
}

.openplay-ai-intro h3,
.openplay-ai-result h3 { margin: 4px 0 6px; color: #17242c; font-size: 21px; }
.openplay-ai-intro p,
.openplay-ai-result-head p { max-width: 760px; margin: 0; color: #5c6b73; font-size: 13px; line-height: 1.65; }

.openplay-ai-privacy {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  background: #dff5ec;
  color: #176b55;
  font-size: 11px;
  font-weight: 900;
}

.openplay-ai-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
  padding: 17px;
  border: 1px solid #dce3e6;
  border-radius: 10px;
  background: #fafbfb;
}

.openplay-ai-form .full { grid-column: 1 / -1; }
.openplay-ai-form textarea { min-height: 72px; }

.openplay-ai-form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.openplay-ai-form-actions small {
  color: #66757d;
  font-size: 11px;
  line-height: 1.5;
}

.openplay-ai-empty {
  min-height: 150px;
  display: grid;
  place-content: center;
  gap: 5px;
  margin-top: 14px;
  border: 1px dashed #c8d2d6;
  border-radius: 10px;
  background: #fff;
  color: #66757d;
  text-align: center;
}

.openplay-ai-empty strong { color: #26343c; font-size: 15px; }
.openplay-ai-empty span { font-size: 12px; }

.openplay-ai-result {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.openplay-ai-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.openplay-ai-result-head > small {
  flex: 0 0 auto;
  color: #74818a;
  font-size: 10px;
  font-weight: 800;
}

.openplay-ai-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.openplay-ai-metrics > div {
  display: grid;
  gap: 4px;
  padding: 13px;
  border: 1px solid #dce3e6;
  border-radius: 9px;
  background: #fff;
}

.openplay-ai-metrics span { color: #6b7880; font-size: 11px; font-weight: 800; }
.openplay-ai-metrics strong { color: #17242c; font-size: 17px; }

.openplay-ai-warning,
.openplay-ai-notes {
  padding: 13px 15px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.6;
}

.openplay-ai-warning {
  border: 1px solid #ead68b;
  background: #fff9dc;
  color: #725a12;
}

.openplay-ai-notes {
  border: 1px solid #d6e1e4;
  background: #f4f8f8;
  color: #4e5e67;
}

.openplay-ai-warning strong,
.openplay-ai-notes strong { color: #26343c; }
.openplay-ai-warning ul,
.openplay-ai-notes ul { margin: 5px 0 0; padding-left: 18px; }

.openplay-ai-bulk-actions {
  position: sticky;
  z-index: 4;
  top: 136px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px;
  border: 1px solid #d5dee1;
  border-radius: 9px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 8px 22px rgba(18, 31, 40, .08);
  backdrop-filter: blur(8px);
}

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

.openplay-ai-suggestion {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  padding: 15px;
  border: 1px solid #d9e1e4;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(20, 33, 41, .04);
}

.openplay-ai-suggestion.is-created { border-color: #9fd3c2; background: #f3fbf8; }

.openplay-ai-check {
  display: grid;
  align-content: start;
  padding-top: 2px;
}

.openplay-ai-check input {
  width: 24px;
  height: 24px;
  min-height: 0;
  margin: 0;
  accent-color: #17242c;
}

.openplay-ai-suggestion-main { min-width: 0; }

.openplay-ai-suggestion-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.openplay-ai-suggestion-head > div {
  display: grid;
  gap: 3px;
}

.openplay-ai-suggestion-head > div span { color: #6b7880; font-size: 11px; font-weight: 800; }
.openplay-ai-suggestion-head > div strong { color: #17242c; font-size: 15px; }
.openplay-ai-suggestion h4 { margin: 12px 0 8px; color: #17242c; font-size: 17px; }
.openplay-ai-suggestion p { margin: 9px 0 12px; color: #5d6c74; font-size: 12px; line-height: 1.55; }

.openplay-ai-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.openplay-ai-tags span,
.openplay-ai-experimental,
.openplay-ai-recommended,
.openplay-ai-created {
  display: inline-flex;
  padding: 5px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 850;
}

.openplay-ai-tags span { color: #48616d; background: #edf3f5; }
.openplay-ai-experimental { color: #765d10; background: #fff2b8; }
.openplay-ai-recommended { color: #176b55; background: #dff5ec; }
.openplay-ai-created { color: #176b55; background: #d9f2e9; }

.openplay-ai-create-summary {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #dce3e6;
  border-radius: 9px;
  background: #fff;
}

.openplay-ai-create-summary span { font-size: 11px; font-weight: 800; }
.openplay-ai-create-summary .success { color: #176b55; }
.openplay-ai-create-summary .error { color: #a54135; }

.openplay-session-more {
  position: relative;
}

.openplay-session-more summary {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 8px 11px;
  border: 1px solid #d7dfe2;
  border-radius: 7px;
  background: #fff;
  color: #485760;
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  list-style: none;
}

.openplay-session-more summary::-webkit-details-marker { display: none; }
.openplay-session-more summary::after { content: "⋯"; margin-left: 7px; letter-spacing: 1px; }

.openplay-session-more-menu {
  position: absolute;
  z-index: 8;
  right: 0;
  top: calc(100% + 6px);
  width: 176px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid #d5dde1;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(19, 32, 40, .16);
}

.openplay-session-more-menu button { width: 100%; }

.session-external-chip {
  color: #725400 !important;
  border: 1px solid #ead170;
  background: #fff4bd !important;
}

.openplay-court-guard-note {
  margin: 9px 0 0;
  padding: 8px 10px;
  border: 1px solid #edcf65;
  border-radius: 8px;
  background: #fff8d8;
  color: #684f00;
  font-size: 11px;
  font-weight: 780;
  line-height: 1.45;
}

.openplay-external-confirmed-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 11px 13px;
  border: 1px solid #ead170;
  border-radius: 9px;
  background: #fff9dc;
  color: #6c5717;
}

.openplay-external-confirmed-summary strong {
  flex: 0 0 auto;
  color: #3f3412;
  font-size: 12px;
}

.openplay-external-confirmed-summary span {
  font-size: 11px;
  line-height: 1.5;
  text-align: right;
}

.openplay-roster-current {
  display: grid;
  gap: 7px;
}

.openplay-roster-section-head {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 4px;
}

.openplay-roster-section-head strong {
  color: #23313a;
  font-size: 12px;
  font-weight: 900;
}

.openplay-roster-section-head span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  color: #17644d;
  background: #e5f4ee;
  font-size: 11px;
  font-weight: 900;
}

.openplay-roster-history {
  overflow: hidden;
  margin-top: 4px;
  border: 1px solid #dce3e6;
  border-radius: 10px;
  background: #f7f9f9;
}

.openplay-roster-history summary {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 13px;
  color: #4d5d66;
  cursor: pointer;
  list-style: none;
}

.openplay-roster-history summary::-webkit-details-marker { display: none; }

.openplay-roster-history summary > span {
  display: grid;
  margin-right: auto;
  gap: 3px;
}

.openplay-roster-history summary strong {
  color: #34444d;
  font-size: 12px;
  font-weight: 900;
}

.openplay-roster-history summary small {
  color: #7b888e;
  font-size: 10px;
  font-weight: 750;
}

.openplay-roster-history summary b {
  display: inline-flex;
  min-height: 24px;
  flex: 0 0 auto;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  color: #66747b;
  background: #e8edef;
  font-size: 11px;
  font-weight: 900;
}

.openplay-roster-history summary::after {
  content: "⌄";
  flex: 0 0 auto;
  color: #738087;
  font-size: 16px;
  line-height: 1;
  transition: transform .16s ease;
}

.openplay-roster-history[open] summary::after { transform: rotate(180deg); }

.openplay-roster-history-list {
  display: grid;
  gap: 7px;
  padding: 10px;
  border-top: 1px solid #dce3e6;
  background: #f2f5f5;
}

.openplay-completed-count {
  min-height: 24px;
  margin: -2px 0;
  padding: 3px 7px;
  border: 1px solid #d5ba48;
  border-radius: 999px;
  background: #fff6c9;
  color: #43370d;
  font: inherit;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.1;
  cursor: pointer;
}

.openplay-completed-count:hover,
.openplay-completed-count:focus-visible {
  border-color: #9b7b00;
  background: #ffed99;
  outline: 2px solid rgba(155, 123, 0, .2);
  outline-offset: 2px;
}

.openplay-session-counts {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 10px;
  margin-top: 7px;
  color: #64717a;
  font-size: 12px;
  line-height: 1.35;
}

.openplay-session-count-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.openplay-session-count-item strong {
  display: inline;
  color: #26343d;
  font-size: inherit;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1080px) {
  .openplay-ledger-slots {
    grid-template-columns: repeat(6, minmax(70px, 1fr));
  }
  .openplay-session-editor .openplay-creation-step:nth-of-type(2) { grid-template-columns: 1fr; }
  .openplay-session-editor .openplay-creation-step:nth-of-type(2) .openplay-step-heading { grid-column: auto; }
}

@media (max-width: 720px) {
  .openplay-external-confirmed-summary {
    flex-direction: column;
    gap: 4px;
  }
  .openplay-external-confirmed-summary span { text-align: left; }
  .openplay-session-copy { overflow: hidden; }
  .openplay-session-copy h3 { overflow-wrap: anywhere; }
  .openplay-session-counts { align-items: flex-start; gap: 6px 8px; }
  .openplay-session-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }
  .openplay-session-actions > .openplay-roster-primary,
  .openplay-session-actions > .openplay-edit-primary {
    min-width: 0;
    width: 100%;
    flex: none;
  }
  .openplay-session-actions > .openplay-session-more {
    grid-column: 1 / -1;
    justify-self: start;
  }
  .openplay-roster-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 9px 12px;
  }
  .openplay-roster-row > div:nth-child(2) { text-align: right; }
  .openplay-roster-row .table-member-id-button {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .openplay-roster-row .table-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
    gap: 6px;
  }
  .openplay-roster-row .table-actions button {
    min-width: 0;
    width: 100%;
    padding-inline: 7px;
    flex: none;
  }
  .openplay-session-more { flex: 0 0 auto; }
  .openplay-session-more summary { min-height: 38px; }
  .openplay-session-more-menu {
    position: fixed;
    right: 14px;
    bottom: 14px;
    top: auto;
    width: min(260px, calc(100vw - 28px));
  }
  .openplay-workspace-tabs { display: flex; width: 100%; }
  .openplay-workspace-tabs button { flex: 1 0 auto; padding-inline: 12px; }
  .openplay-creation-step { gap: 13px; padding: 15px; border-radius: 12px; }
  .openplay-step-heading { align-items: flex-start; padding-bottom: 12px; }
  .openplay-step-heading h4 { font-size: 16px; }
  .openplay-step-heading p { font-size: 12px; }
  .openplay-creation-step > .form-grid { grid-template-columns: 1fr; }
  .openplay-ledger-slots {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .openplay-duration-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .openplay-selected-time { grid-template-columns: 1fr; }
  .openplay-selected-time > span { grid-row: auto; }
  .openplay-selected-time strong { font-size: 18px; }
  .openplay-session-editor .openplay-editor-actions { align-items: stretch; flex-direction: column; }
  .openplay-session-editor .openplay-editor-actions .primary,
  .openplay-session-editor .openplay-editor-actions .ghost { width: 100%; }
  .openplay-ai-intro,
  .openplay-ai-result-head { flex-direction: column; }
  .openplay-ai-privacy { white-space: normal; }
  .openplay-ai-form { grid-template-columns: 1fr; padding: 14px; }
  .openplay-ai-form .full { grid-column: auto; }
  .openplay-ai-form-actions { align-items: stretch; flex-direction: column; }
  .openplay-ai-form-actions button { width: 100%; }
  .openplay-ai-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .openplay-ai-bulk-actions { top: 112px; }
  .openplay-ai-bulk-actions button { flex: 1; }
  .openplay-ai-suggestions { grid-template-columns: 1fr; }
  .openplay-ai-suggestion { grid-template-columns: 30px minmax(0, 1fr); padding: 13px; }
}
