/* Midnight Court applies to the workspace. The owner guide and local demo use their own styles. */
body {
  --night: #0d1b22;
  --night-panel: #162b30;
  --night-line: #365254;
  --night-ink: #f2f7f4;
  --night-muted: #c6d8d3;
  --night-lime: #dbf584;
  background: var(--night);
}

.sidebar { background: linear-gradient(165deg, #10262b, #132e32 72%, #0d2026); }
.topbar { border-color: var(--night-line); }
.topbar .crumb, .main > .footer, #app > .toolbar .muted { color: var(--night-muted); }
#app > .section, #app > .pagehead h1 { color: var(--night-ink); }
#app > .pagehead p { color: var(--night-muted); }
#app > .pagehead .eyebrow { color: var(--night-lime); }

.hero.midnight-hero {
  min-height: 0;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  gap: clamp(20px, 4vw, 48px);
  padding: clamp(24px, 4vw, 48px);
  border: 1px solid var(--night-line);
  border-radius: 16px;
  background: radial-gradient(ellipse at 86% 20%, #1a413c, transparent 66%), #13262b;
  color: var(--night-ink);
}
.midnight-hero::before, .midnight-hero::after { display: none; }
.midnight-hero .hero-copy { min-width: 0; padding: 0; overflow-wrap: anywhere; }
.midnight-hero .eyebrow { color: #b6d9cd; }
.midnight-hero h1 { font-size: clamp(2.4rem, 5vw, 4.5rem); }
.midnight-hero h1 em { color: var(--night-lime); font-style: italic; }
.midnight-hero p { color: var(--night-muted); }
.midnight-art {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--night-line);
  border-radius: 12px;
  background: #193b33;
}
.midnight-art img {
  display: block;
  width: 100%;
  height: auto;
  filter: brightness(.72) saturate(.72) hue-rotate(12deg);
}

.midnight-next {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 20px;
  padding: 17px 20px;
  margin-top: 16px;
  background: var(--night-panel);
  border: 1px solid var(--night-line);
  border-radius: 12px;
  color: var(--night-ink);
  overflow-wrap: anywhere;
}
.midnight-next-date {
  display: grid;
  gap: 2px;
  padding-right: 16px;
  border-right: 1px solid var(--night-line);
  color: var(--night-lime);
  white-space: nowrap;
}
.midnight-next-date span { font-size: .8rem; }
.midnight-next h2 { margin: 2px 0; font-size: 1.25rem; }
.midnight-next p { margin: 0; color: var(--night-muted); }
.midnight-next .eyebrow { color: var(--night-muted); }
.midnight-hero .primary, .midnight-next .primary { background: var(--night-lime); color: #192512; }
.midnight-hero .primary:hover, .midnight-next .primary:hover { background: #ebfbbd; }
.midnight-hero :focus-visible, .midnight-next :focus-visible { outline: 3px solid var(--night-lime); outline-offset: 4px; }

@media (max-width: 680px) {
  .hero.midnight-hero { grid-template-columns: minmax(0, 1fr); }
  .midnight-next { grid-template-columns: auto minmax(0, 1fr); padding: 14px; }
  .midnight-next .primary { grid-column: 2; justify-self: start; }
}

/* Use the same navigation groups in the sidebar and the mobile menu. */
.sidebar .brand { padding-bottom: 19px; }
.sidebar .nav-label { margin-bottom: 6px; }
.grouped-nav { gap: 3px; }
.grouped-nav button { min-height: 42px; padding: 8px 10px; gap: 9px; }
.grouped-nav button .symbol { flex: 0 0 19px; width: 19px; font-size: 16px; }
.grouped-nav .nav-group { border-top: 1px solid var(--night-line); }
.grouped-nav .nav-group summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: .86rem;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}
.grouped-nav .nav-group summary::-webkit-details-marker { display: none; }
.grouped-nav .nav-group summary::after {
  content: '';
  width: 7px;
  height: 7px;
  margin-right: 3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
}
.grouped-nav .nav-group[open] summary::after { transform: rotate(45deg); }
.sidebar .nav-group summary:hover, .sidebar .nav-group summary:focus-visible { background: #ffffff14; }
.sidebar .nav-group-current { color: var(--night-lime); }
.grouped-nav .nav-group-items { display: grid; gap: 2px; padding: 0 0 5px 8px; }
.sidebar .grouped-nav button.active::before { background: var(--night-lime); }
.sidebar .sidebar-bottom { padding-top: 14px; }
.navigation-dialog .grouped-nav button { color: var(--ink); }
.navigation-dialog .grouped-nav button:hover,
.navigation-dialog .grouped-nav button.active,
.navigation-dialog summary:hover { background: #e5f3ef; }
.navigation-dialog .nav-group { border-color: var(--line); }
.navigation-dialog .nav-group-current { color: #216458; }
.navigation-dialog .grouped-nav a { text-decoration: underline; }

@media (max-width: 900px) {
  .layout { display: block; }
  .sidebar { display: none; }
  .main { padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
  .mobile-nav {
    display: flex;
    position: fixed;
    z-index: 10;
    inset: auto 0 0;
    justify-content: space-around;
    padding: 6px 6px max(9px, env(safe-area-inset-bottom));
    background: #10262b;
    border-top: 1px solid var(--night-line);
  }
  .mobile-nav button {
    display: grid;
    place-items: center;
    min-width: 44px;
    min-height: 44px;
    padding: 5px 8px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--night-muted);
  }
  .mobile-nav button.active { background: #284342; color: var(--night-ink); }
  .mobile-nav button .symbol { font-size: 17px; }
  .mobile-nav button .text { font-size: .69rem; }
  .navigation-dialog .grouped-nav button { justify-content: flex-start; }
}

/* Give each section a layout that fits the work members do there. */
.rich-overview { padding: clamp(18px, 3vw, 34px) 0 6px; }
.rich-overview h1 { max-width: 24ch; font-size: clamp(2.3rem, 5vw, 4rem); }
.rich-overview-links, .rich-filters, .rich-filter-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.rich-overview-links { margin-top: 18px; }
.rich-next-actions { justify-content: flex-end; }
.rich-next-empty { grid-template-columns: minmax(0, 1fr) auto; }
.rich-filters, .rich-filter-note { margin: 0 0 18px; }
.rich-filter-note, .rich-date-group > h2, .rich-history > summary { color: var(--night-ink); }
.rich-filters button[aria-pressed="true"] { background: var(--night-lime); color: #192512; }
.rich-date-group { margin-bottom: 24px; }
.rich-date-group > h2 { font-size: 1.15rem; margin: 0 0 10px; }
.rich-history { margin-top: 20px; }
.rich-history > summary { padding: 12px 0; font-weight: 700; cursor: pointer; }
.rich-record h3, .rich-overview ~ .grid .card h3 { margin: 8px 0 6px; overflow-wrap: anywhere; }
.rich-meta, .rich-court-next { color: #47615b; }
.rich-record .panel-heading { gap: 6px; flex-wrap: wrap; }
.rich-private { background: #f1e8fa; color: #543964; }
.rich-court { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; align-items: start; }
.rich-court-mark { display: grid; place-items: center; aspect-ratio: 1; background: #173b32; border-radius: 12px; }
.rich-court-mark span { position: relative; width: 70%; height: 50%; border: 1.5px solid #c7e9c4; border-radius: 3px; }
.rich-court-mark span::before, .rich-court-mark span::after { content: ''; position: absolute; background: #c7e9c4; }
.rich-court-mark span::before { width: 1px; height: 100%; left: 50%; }
.rich-court-mark span::after { height: 1px; width: 100%; top: 50%; }
.rich-account, .rich-signin-steps, .rich-setup { margin-bottom: 20px; }
.rich-account { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.rich-account h2 { margin: 4px 0; }
.rich-signin-steps { background: var(--night-panel); color: var(--night-ink); border: 1px solid var(--night-line); border-radius: 12px; padding: 14px 17px; }
.rich-setup h2 { margin: 0; }
.rich-setup ol { padding: 0; margin: 10px 0 0; list-style: none; }
.rich-setup li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 7px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.rich-setup li small { display: block; color: #47615b; }
.rich-record .actionrow { gap: 7px; }
.rich-filters button, .rich-record .actionrow button, .rich-record .actionrow a { min-height: 42px; }
@media (max-width: 680px) {
  .rich-next-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .midnight-next.rich-next-empty { grid-template-columns: minmax(0,1fr); }
  .rich-next-empty .primary { grid-column: 1; }
  .rich-next-actions .primary { grid-column: auto; }
  .rich-court { grid-template-columns: 58px minmax(0,1fr); gap: 12px; }
}

/* Shared theme tokens keep the workspace and appearance preview in sync. */
body, .appearance-preview, .theme-chip {
  --group-canvas: #0d1b22;
  --group-panel: #162b30;
  --group-line: #365254;
  --group-heading: #f2f7f4;
  --group-muted: #c6d8d3;
  --group-highlight: #dbf584;
  --group-sidebar: linear-gradient(165deg, #10262b, #132e32 72%, #0d2026);
  --group-nav: #10262b;
  --group-nav-hover: #284342;
  --group-card: #fff;
  --group-card-border: #e3e9e7;
  --group-heading-font: Inter, system-ui, sans-serif;
}
[data-theme="glass"] {
  --group-canvas: radial-gradient(ellipse at 85% 0%, #21524a 0%, #112b31 42%, #0b1d26 86%);
  --group-panel: #1d373e;
  --group-line: #52727a;
  --group-sidebar: linear-gradient(165deg, #122f36, #1d4449 70%, #10252d);
  --group-nav: #15343a;
  --group-nav-hover: #2c4e52;
  --group-card: #effaf7;
  --group-card-border: #c4ded7;
}
[data-theme="club"] {
  --group-canvas: #eef3e7;
  --group-panel: #e0ebd5;
  --group-line: #96aa92;
  --group-heading: #153824;
  --group-muted: #345440;
  --group-highlight: #23593a;
  --group-sidebar: linear-gradient(165deg, #193d2c, #25513a 72%, #193726);
  --group-nav: #193d2c;
  --group-nav-hover: #38644a;
  --group-card: #fffefa;
  --group-card-border: #d4dfce;
}
[data-theme="bulletin"] {
  --group-canvas: #f6eee3;
  --group-panel: #f1dfd0;
  --group-line: #b99b8d;
  --group-heading: #472b36;
  --group-muted: #64483f;
  --group-highlight: #78483c;
  --group-sidebar: linear-gradient(165deg, #472d3b, #583646 72%, #3a2630);
  --group-nav: #472d3b;
  --group-nav-hover: #714d60;
  --group-card: #fffaf3;
  --group-card-border: #e2ccbc;
  --group-heading-font: Georgia, serif;
}
body[data-group-theme] {
  --night: var(--group-canvas);
  --night-panel: var(--group-panel);
  --night-line: var(--group-line);
  --night-ink: var(--group-heading);
  --night-muted: var(--group-muted);
  --night-lime: var(--group-highlight);
}
body[data-group-theme] .sidebar { background: var(--group-sidebar); }
body[data-group-theme] .sidebar .nav-group-current { color: #e0f6ac; }
body[data-group-theme] .sidebar .grouped-nav button.active::before { background: #e0f6ac; }
body[data-group-theme] .mobile-nav { background: var(--group-nav); }
body[data-group-theme] .mobile-nav button { color: #dcebe3; }
body[data-group-theme] .mobile-nav button.active { background: var(--group-nav-hover); color: #fff; }
body[data-group-theme] .main .card { background: var(--group-card); border-color: var(--group-card-border); }
body[data-group-theme] .main :is(.pagehead h1, .section h2, .midnight-next h2) { font-family: var(--group-heading-font); }
body[data-group-theme] .main .primary, .appearance-preview .primary {
  background: var(--green);
  color: var(--group-accent-ink);
}
body[data-group-theme] .main .primary:hover { box-shadow: 0 0 0 2px var(--group-line); }
body[data-group-theme] .main :is(button,a,summary):focus-visible {
  outline: 3px solid #247d70;
  outline-offset: 3px;
}
body[data-group-theme] .rich-filters button[aria-pressed="true"] {
  background: var(--green);
  color: var(--group-accent-ink);
}
@supports (backdrop-filter: blur(10px)) {
  body[data-group-theme][data-theme="glass"] .main .card:not(:is(form,.empty)) {
    background: rgb(239 250 247 / 93%);
    backdrop-filter: blur(12px);
  }
  body[data-group-theme][data-theme="glass"] .midnight-next,
  .appearance-preview[data-theme="glass"] .appearance-preview-body {
    background: rgb(37 66 72 / 80%);
    backdrop-filter: blur(14px);
  }
}

.modal.appearance-dialog { width: min(calc(100% - 24px), 940px); }
.appearance-dialog form > .formgrid { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); }
.appearance-dialog form > .formgrid > :not(.appearance-preview) { grid-column: 1; min-width: 0; }
.appearance-fieldset {
  margin: 0;
  padding: 12px;
  border: 1px solid #c9d9d2;
  border-radius: 12px;
}
.appearance-fieldset legend, .appearance-extra summary { font-weight: 750; }
.appearance-fieldset legend { padding: 0 6px; }
.appearance-fieldset p { margin: 0 0 10px; }
.theme-options { display: grid; gap: 6px; }
.theme-option { display: grid; grid-template-columns: auto 38px minmax(0,1fr); align-items: center; gap: 9px; padding: 8px; border: 1px solid #dbe6e1; border-radius: 9px; cursor: pointer; }
.theme-option:has(input:checked) { border-color: #30786b; background: #ecf6f1; }
.theme-option small { display: block; font-weight: 400; color: #47615b; }
.theme-chip { display: grid; place-items: end; width: 38px; height: 28px; padding: 5px; border-radius: 5px; background: var(--group-canvas); border: 1px solid var(--group-line); }
.theme-chip i { width: 12px; height: 5px; border-radius: 3px; background: var(--group-highlight); }
.appearance-accent { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.appearance-accent .field { display: flex; align-items: center; margin: 0; }
.appearance-accent input[type="color"] { width: 48px; height: 40px; padding: 4px; }
.appearance-extra summary { cursor: pointer; padding: 8px 0; }
.appearance-dialog form > .formgrid > .appearance-preview {
  grid-column: 2;
  grid-row: 1 / span 4;
  align-self: start;
  position: sticky;
  top: 0;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--group-line);
  border-radius: 12px;
  color: var(--group-heading);
  background: var(--group-canvas);
}
.appearance-preview-label { margin-bottom: 10px; font-size: .82rem; font-weight: 750; }
.appearance-preview-body { padding: 15px; border: 1px solid var(--group-line); border-radius: 10px; background: var(--group-panel); overflow-wrap: anywhere; }
.appearance-preview [data-preview="name"] { font-weight: 750; }
.appearance-preview p { color: var(--group-muted); margin: 5px 0 10px; white-space: pre-wrap; }
.appearance-preview h3 { margin: 6px 0; font-family: var(--group-heading-font); }
.appearance-preview .primary { margin-top: 6px; }
@media (max-width: 680px) {
  .appearance-dialog form > .formgrid { grid-template-columns: minmax(0, 1fr); }
  .appearance-dialog form > .formgrid > .appearance-preview { position: static; grid-column: 1; grid-row: 3; }
}
.appearance-dialog .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 1;
  padding: 10px 0;
  background: var(--paper);
  border-top: 1px solid var(--line);
}

.optional-player-image {float:right; width:80px; height:80px; object-fit:contain; margin:0 0 12px 16px; border-radius:16px;}
