@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
  --sc-red: #c8102e;
  --sc-red-deep: #9a0c23;
  --sc-ink: #14181f;
  --sc-slate: #2c3440;
  --sc-muted: #5c6775;
  --sc-line: #d8dee6;
  --sc-paper: #f3f5f8;
  --sc-white: #ffffff;
  --sc-ok: #1f7a4d;
  --sc-warn: #b45309;
  --sc-lock: #8b1e2d;
  --radius: 10px;
  --shadow: 0 18px 50px rgba(20, 24, 31, 0.12);
  --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--sc-ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(200, 16, 46, 0.16), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(44, 52, 64, 0.12), transparent 50%),
    linear-gradient(180deg, #eef1f5 0%, var(--sc-paper) 40%, #e8ecf1 100%);
  line-height: 1.45;
}

button, input, select, textarea {
  font: inherit;
}

a { color: var(--sc-red); }

.hidden { display: none !important; }

/* —— Login —— */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.login-card {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background: var(--sc-white);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(20, 24, 31, 0.06);
}

.login-hero {
  position: relative;
  padding: 2.5rem 2.25rem;
  color: var(--sc-white);
  background:
    linear-gradient(155deg, rgba(20, 24, 31, 0.15), rgba(20, 24, 31, 0.55)),
    linear-gradient(160deg, var(--sc-red) 0%, var(--sc-red-deep) 48%, #5a0a16 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  text-align: left;
  min-height: 420px;
}

.login-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      -18deg,
      transparent,
      transparent 18px,
      rgba(255, 255, 255, 0.035) 18px,
      rgba(255, 255, 255, 0.035) 19px
    );
  pointer-events: none;
}

.login-hero > * { position: relative; }

.brand-mark {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 1.25rem;
}

.login-hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.4rem, 4vw, 3.4rem);
  line-height: 0.95;
  margin: 0 0 0.85rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.login-hero p {
  margin: 0;
  max-width: 28ch;
  color: rgba(255, 255, 255, 0.88);
  font-size: 1rem;
}

.login-form-pane {
  padding: 2.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.login-form-pane h2 {
  font-family: var(--font-display);
  font-size: 1.85rem;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.demo-note {
  font-size: 0.9rem;
  color: var(--sc-muted);
  background: #f7f8fa;
  border: 1px dashed var(--sc-line);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sc-muted);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  width: 100%;
  padding-right: 4.25rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--sc-muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--sc-ink);
  background: rgba(20, 24, 31, 0.06);
  outline: none;
}

.field input,
.field select,
.field textarea {
  border: 1px solid var(--sc-line);
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  background: #fff;
  color: var(--sc-ink);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid rgba(200, 16, 46, 0.25);
  border-color: var(--sc-red);
}

.field textarea { min-height: 84px; resize: vertical; }

.btn {
  appearance: none;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--sc-red);
  color: #fff;
}

.btn-primary:hover { background: var(--sc-red-deep); }

.btn-ghost {
  background: transparent;
  color: var(--sc-slate);
  border: 1px solid var(--sc-line);
}

.btn-ghost:hover { background: #f3f5f8; }

.btn-danger {
  background: #fff;
  color: var(--sc-lock);
  border: 1px solid #f0c9d0;
}

.btn-danger:hover { background: #fff5f6; }

#btn-season-lock-now,
#btn-start-season-lock-now,
#btn-clear-token,
[data-clear-type] {
  background: var(--sc-red);
  color: #fff;
  border-color: var(--sc-red);
}

#btn-season-lock-now:hover,
#btn-start-season-lock-now:hover,
#btn-clear-token:hover,
[data-clear-type]:hover {
  background: var(--sc-red-deep);
  border-color: var(--sc-red-deep);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.error-banner {
  background: #fff1f2;
  color: var(--sc-lock);
  border: 1px solid #f3c4cb;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  font-size: 0.92rem;
}

.account-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip {
  border: 1px solid var(--sc-line);
  background: #fff;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--sc-slate);
}

.chip:hover {
  border-color: var(--sc-red);
  color: var(--sc-red);
}

/* —— App shell —— */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

.sidebar {
  width: max-content;
  min-width: 240px;
  flex-shrink: 0;
  background: var(--sc-ink);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 1.15rem 0.85rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
  transition: width 0.2s ease, min-width 0.2s ease, max-width 0.2s ease, padding 0.2s ease;
}

.sidebar-collapse-btn {
  position: absolute;
  top: 0.7rem;
  right: 0.5rem;
  z-index: 2;
  width: 1.7rem;
  height: 1.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.sidebar-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.sidebar-collapse-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.sidebar-collapse-icon {
  display: block;
  width: 0.45rem;
  height: 0.45rem;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-left: 0.15rem;
}

.app-shell.sidebar-collapsed .sidebar-collapse-icon {
  transform: rotate(-135deg);
  margin-left: 0;
  margin-right: 0.15rem;
}

.sidebar-brand {
  position: relative;
  padding: 0.35rem 2.2rem 1.15rem 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 0.85rem;
}

.sidebar-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}

.sidebar-brand span {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
}

.sidebar-season {
  position: relative;
  margin: -0.55rem 0 0.85rem;
  padding: 0 0.65rem 0.15rem;
}

.sidebar-season select {
  width: 100%;
  min-width: 10.5rem;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font: inherit;
  font-size: 0.92rem;
}

.sidebar-season select:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.sidebar-season select option {
  color: #111;
}

.app-shell.sidebar-collapsed .sidebar {
  width: 3.25rem;
  min-width: 3.25rem;
  max-width: 3.25rem;
  padding-left: 0.55rem;
  padding-right: 0.55rem;
  overflow: hidden;
}

.app-shell.sidebar-collapsed .sidebar-brand,
.app-shell.sidebar-collapsed .sidebar-season,
.app-shell.sidebar-collapsed .sidebar-nav,
.app-shell.sidebar-collapsed .sidebar-footer {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-shell.sidebar-collapsed .sidebar-collapse-btn {
  right: 50%;
  transform: translateX(50%);
  top: 0.85rem;
}

.login-logo {
  display: block;
  max-width: 11rem;
  max-height: 3.5rem;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: left center;
  align-self: flex-start;
  margin: 0 0 0.85rem;
  /* Force a white mark on the dark hero, regardless of uploaded logo colors. */
  filter: brightness(0) invert(1);
}

.login-logo.hidden {
  display: none;
}

.branding-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 28rem) minmax(12rem, 1fr);
  gap: 1.5rem 2rem;
  align-items: stretch;
}

.branding-fields {
  min-width: 0;
}

.branding-fields .panel-head {
  margin-bottom: 1rem;
}

.branding-logo-preview {
  position: relative;
  min-height: 0;
  min-width: 0;
  border: 1px dashed var(--sc-line);
  border-radius: 12px;
  background: #f7f8fa;
  overflow: hidden;
}

.branding-logo-preview.hidden {
  display: none;
}

.branding-logo-preview img {
  position: absolute;
  inset: 1.25rem;
  width: calc(100% - 2.5rem);
  height: calc(100% - 2.5rem);
  object-fit: contain;
  object-position: center;
}

.branding-logo-clear {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 1;
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--sc-line);
  border-radius: 999px;
  background: #fff;
  color: var(--sc-slate);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.branding-logo-clear:hover {
  background: #fff5f6;
  border-color: #f0c9d0;
  color: var(--sc-red);
}

@media (max-width: 820px) {
  .branding-layout {
    grid-template-columns: 1fr;
  }

  .branding-logo-preview {
    min-height: 12rem;
  }
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 0.8rem;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-item.active {
  background: var(--sc-red);
  color: #fff;
}

.nav-item .nav-label {
  flex: 1;
}

.nav-section-label {
  margin: 0.85rem 0.8rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 0.75rem;
}

.sidebar-user {
  padding: 0.35rem 0.8rem 0.55rem;
  font-size: 0.85rem;
}

.sidebar-user .name {
  font-weight: 600;
}

.sidebar-user .meta {
  margin-top: 0.2rem;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.78rem;
}

.app-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid rgba(20, 24, 31, 0.08);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-brand {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
}

.topbar-brand strong {
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sc-ink);
}

.topbar-brand span {
  font-size: 0.85rem;
  color: var(--sc-muted);
}

.topbar-branding {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 2.25rem;
}

.topbar-logo-link {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  text-decoration: none;
  border-radius: 4px;
}

.topbar-logo-link.hidden,
.topbar-logo-link[hidden] {
  display: none !important;
}

.topbar-logo-link.is-linked {
  cursor: pointer;
}

.topbar-logo-link.is-linked:hover {
  opacity: 0.88;
}

.topbar-logo-link.is-linked:focus-visible {
  outline: 2px solid var(--sc-red);
  outline-offset: 3px;
}

.topbar-logo {
  display: block;
  max-height: 2.5rem;
  max-width: 10rem;
  width: auto;
  height: auto;
  object-fit: contain;
}

.topbar-logo.hidden,
.topbar-logo[hidden] {
  display: none !important;
}

.menu-toggle {
  display: none;
  appearance: none;
  border: 1px solid var(--sc-line);
  background: #fff;
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  font-weight: 600;
  cursor: pointer;
}

.sidebar-backdrop {
  display: none;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--sc-red);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.main {
  width: min(1120px, calc(100% - 2rem));
  margin: 1.5rem auto 2.5rem;
  display: grid;
  gap: 1.15rem;
}

.panel {
  background: var(--sc-white);
  border: 1px solid rgba(20, 24, 31, 0.07);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(20, 24, 31, 0.05);
  padding: 1.25rem 1.35rem;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.panel-head.panel-head-stacked {
  display: block;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.panel-head p {
  margin: 0.2rem 0 0;
  color: var(--sc-muted);
  font-size: 0.95rem;
}

.status-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.status-card {
  border-radius: 12px;
  padding: 1rem 1.1rem;
  border: 1px solid var(--sc-line);
  background: linear-gradient(180deg, #fff, #fafbfc);
}

.status-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.status-card .label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sc-muted);
}

.status-card .status-pill {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: rgba(20, 24, 31, 0.08);
  color: var(--sc-muted);
}

.status-card.open .status-pill {
  background: #ecf8f1;
  color: #145536;
}

.status-card.locked .status-pill {
  background: #fff0f2;
  color: var(--sc-lock);
}

.status-card .value {
  margin-top: 0.35rem;
  font-family: var(--font-display);
  font-size: 1.7rem;
  line-height: 1;
  text-transform: uppercase;
}

.status-card.open .value { color: var(--sc-ok); }
.status-card.locked .value { color: var(--sc-lock); }
.status-card .hint {
  margin-top: 0.45rem;
  font-size: 0.88rem;
  color: var(--sc-muted);
}

.lock-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  border-radius: 10px;
  font-weight: 500;
}

.lock-banner.open {
  background: #ecf8f1;
  color: #145536;
  border: 1px solid #c6e8d4;
}

.lock-banner.locked {
  background: #fff0f2;
  color: var(--sc-lock);
  border: 1px solid #f0c4cb;
}

.lock-banner .reg-token {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  background: rgba(20, 85, 54, 0.1);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.lock-banner.is-link {
  cursor: pointer;
  transition: filter 0.15s ease, box-shadow 0.15s ease;
}

.lock-banner.is-link:hover,
.lock-banner.is-link:focus-visible {
  filter: brightness(0.97);
  box-shadow: 0 0 0 2px rgba(20, 85, 54, 0.18);
  outline: none;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--sc-line);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th, td {
  text-align: left;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--sc-line);
  vertical-align: top;
}

th {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sc-muted);
  background: #f7f8fa;
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: #fafbfc; }

.priority {
  display: inline-flex;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.priority.required { background: #ffe8eb; color: var(--sc-lock); }
.priority.optional { background: #fff4e5; color: var(--sc-warn); }
.priority.nice-to-have { background: #eef1f5; color: var(--sc-muted); }

.mat-status {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
}

.mat-status-pending { background: #fff4e5; color: var(--sc-warn); }
.mat-status-approved { background: #e8f7ef; color: #1b7a45; }
.mat-status-rejected { background: #ffe8eb; color: var(--sc-lock); }

.materials-review-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  margin-top: 1rem;
}

.materials-review-bar .materials-search {
  flex: 0 1 14rem;
  min-width: 10rem;
}

.materials-review-bar .materials-bulk-actions {
  margin-left: auto;
}

.materials-review-bar #btn-open-material-modal {
  flex: 0 0 auto;
}

#material-modal {
  z-index: 90;
}

.materials-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.materials-bulk-actions.is-disabled .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.question-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.35rem;
}

.question-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  cursor: pointer;
}

.area-question-field label {
  font-weight: 700;
}

.area-questions-form .field textarea,
.area-questions-form .field select {
  width: 100%;
  margin-top: 0.35rem;
}

#materials-body tr.is-inactive {
  opacity: 0.78;
}

.row-actions {
  display: flex;
  gap: 0.35rem;
}

.row-actions .btn {
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.thread-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.45rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--sc-line);
  border-radius: 999px;
  background: var(--sc-white);
  color: var(--sc-slate);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.thread-toggle:hover,
.thread-toggle:focus-visible {
  border-color: var(--sc-red);
  color: var(--sc-red);
  outline: none;
}

.thread-toggle[aria-expanded="true"] {
  background: #f7f8fa;
  border-color: #b7c0cc;
}

.thread-toggle.has-unread {
  border-color: var(--sc-warn);
  color: var(--sc-warn);
}

.thread-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #eef1f5;
  color: var(--sc-muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.thread-badge-unread {
  background: #fff4e5;
  color: var(--sc-warn);
}

tr.is-thread-open td {
  background: #f3f6fa;
}

tr.thread-row td {
  background: #f7f8fa;
  padding: 0;
  border-bottom: 1px solid var(--sc-line);
}

tr.thread-row:hover td {
  background: #f7f8fa;
}

.material-thread {
  padding: 0.85rem 1rem 1rem;
}

.material-thread.is-loading {
  color: var(--sc-muted);
  font-size: 0.9rem;
}

.area-chat {
  padding: 0.15rem 0 0;
}

.area-chat .thread-list {
  max-height: min(28rem, 55vh);
  min-height: 8rem;
}

.settings-tab .thread-badge,
.modal-tab .thread-badge {
  margin-left: 0.4rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.thread-list {
  display: grid;
  gap: 0.65rem;
  max-height: 16rem;
  overflow-y: auto;
  margin-bottom: 0.75rem;
}

.thread-msg {
  background: var(--sc-white);
  border: 1px solid var(--sc-line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}

.thread-msg.is-mine {
  border-color: #c9d6e8;
  background: #f4f8fc;
}

.thread-msg-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  align-items: baseline;
  font-size: 0.78rem;
  color: var(--sc-muted);
  margin-bottom: 0.25rem;
}

.thread-msg-meta strong {
  color: var(--sc-ink);
  font-size: 0.85rem;
}

.thread-msg-role {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.68rem;
  color: var(--sc-red);
}

.thread-msg-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.92rem;
}

.thread-empty {
  margin: 0 0 0.75rem;
  color: var(--sc-muted);
  font-size: 0.9rem;
}

.thread-composer {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
}

.thread-composer textarea {
  flex: 1;
  min-height: 2.6rem;
  resize: vertical;
  border: 1px solid var(--sc-line);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
}

.thread-composer textarea:focus {
  outline: none;
  border-color: var(--sc-red);
  box-shadow: 0 0 0 2px rgba(200, 16, 46, 0.12);
}

.thread-composer .btn {
  flex: 0 0 auto;
}

.unread-chip {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #fff4e5;
  color: var(--sc-warn);
  font-size: 0.7rem;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: 2fr 0.7fr 0.7fr 1fr;
  gap: 0.75rem;
}

.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.form-grid .span-4 { grid-column: 1 / -1; }

.membership-list {
  display: grid;
  gap: 0.5rem;
}

.membership-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(7rem, 0.8fr) auto;
  gap: 0.5rem;
  align-items: center;
}

.membership-row select {
  width: 100%;
}

.membership-remove {
  min-width: 2.25rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  font-size: 1.15rem;
  line-height: 1;
}

.membership-add-btn {
  margin-top: 0.55rem;
}

.membership-summary {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.2rem;
}

.membership-summary li {
  font-size: 0.9rem;
  line-height: 1.35;
}

.area-carousel,
.area-carousel-head {
  display: grid;
  grid-template-columns: 2.4rem 1fr 2.4rem;
  gap: 0.55rem;
  align-items: center;
}

.area-carousel-head {
  margin-bottom: 0.85rem;
  align-items: start;
}

.area-carousel-head .panel-head {
  margin: 0;
}

.area-carousel-spacer {
  width: 2.4rem;
}

.area-carousel-btn {
  appearance: none;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  border: 1px solid var(--sc-line);
  background: #fff;
  color: var(--sc-ink);
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.area-carousel-btn:hover:not(:disabled) {
  border-color: rgba(200, 16, 46, 0.4);
  background: #fff7f8;
}

.area-carousel-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.area-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 260px);
  gap: 0.75rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 0.15rem 0.1rem 0.35rem;
  scrollbar-width: thin;
}

.area-grid .area-card {
  scroll-snap-align: start;
}

.area-grid .demo-note {
  grid-column: 1 / -1;
  min-width: 100%;
}

.area-card {
  border: 1px solid var(--sc-line);
  border-radius: 12px;
  padding: 1rem;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  text-align: left;
}

.area-card:hover {
  border-color: rgba(200, 16, 46, 0.45);
  box-shadow: 0 8px 20px rgba(20, 24, 31, 0.06);
}

.area-card.active {
  border-color: var(--sc-red);
  box-shadow: 0 0 0 2px rgba(200, 16, 46, 0.15);
}

.area-card .code {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sc-red);
}

.area-card h3 {
  margin: 0.35rem 0 0.2rem;
  font-size: 1.05rem;
}

.area-card .meta {
  font-size: 0.85rem;
  color: var(--sc-muted);
}

.admin-lock {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: end;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  background: var(--sc-ink);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 50;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.footer-note {
  text-align: center;
  color: var(--sc-muted);
  font-size: 0.8rem;
  padding: 0 1rem 1.5rem;
}

/* —— Modal —— */
body.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 24, 31, 0.55);
}

.modal-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.2rem;
  margin: 0 0 1rem;
  padding: 0;
  border-bottom: 1px solid var(--sc-line);
}

.modal-tab {
  appearance: none;
  position: relative;
  bottom: -1px;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--sc-muted);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.65rem 1rem 0.55rem;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  line-height: 1.2;
}

.modal-tab:hover {
  color: var(--sc-ink);
  background: rgba(20, 24, 31, 0.03);
}

.modal-tab.active {
  color: var(--sc-white);
  background: var(--sc-red);
  border-color: var(--sc-red);
}

.modal-tab.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--sc-red);
}

.modal-tab:focus-visible {
  outline: 2px solid var(--sc-red);
  outline-offset: 2px;
  z-index: 1;
}

.modal-tab-panel {
  margin-bottom: 0.25rem;
}

.modal-tab-hint {
  margin: 0 0 0.85rem;
  color: var(--sc-muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.modal-card {
  position: relative;
  width: min(480px, 100%);
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--sc-white);
  border-radius: 14px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(20, 24, 31, 0.08);
  padding: 1.25rem 1.35rem 1.35rem;
  animation: modalIn 0.18s ease;
}

.register-card {
  width: min(920px, 100%);
}

.reg-step-lead {
  margin: 0.35rem 0 1rem;
  color: var(--sc-muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.reg-progress {
  list-style: none;
  margin: 0 0 1.1rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}

.reg-progress li {
  position: relative;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sc-muted);
  padding: 0.55rem 0.35rem 0.65rem;
  border-bottom: 3px solid var(--sc-line);
}

.reg-progress li.is-current {
  color: var(--sc-ink);
  border-bottom-color: var(--sc-red);
}

.reg-progress li.is-done {
  color: var(--sc-ink);
  border-bottom-color: rgba(200, 16, 46, 0.45);
}

.reg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.reg-actions-start {
  justify-content: flex-start;
  margin-top: 0.85rem;
}

.reg-choice-actions {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.35rem;
}

.reg-choice-actions .btn {
  width: 100%;
  justify-content: center;
}

.reg-added-list,
.reg-review-areas {
  margin: 0;
  padding: 0;
  list-style: none;
}

.reg-added-list ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
}

.reg-added-list li,
.reg-review-areas li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--sc-line);
  border-radius: 10px;
  background: #f7f8fa;
}

.reg-added-list li span,
.reg-review-areas li span {
  display: block;
  color: var(--sc-muted);
  font-size: 0.88rem;
  margin-top: 0.15rem;
}

.reg-review-block {
  border: 1px solid var(--sc-line);
  border-radius: 12px;
  padding: 0.85rem 1rem 1rem;
  margin-bottom: 0.85rem;
  background: #fff;
}

.reg-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.reg-review-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.reg-review-dl {
  margin: 0;
  display: grid;
  gap: 0.55rem;
}

.reg-review-dl > div {
  display: grid;
  gap: 0.1rem;
}

.reg-review-dl dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sc-muted);
}

.reg-review-dl dd {
  margin: 0;
  font-size: 0.98rem;
}

.reg-review-areas {
  display: grid;
  gap: 0.45rem;
}

.reg-review-area-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.reg-empty {
  margin: 0;
  color: var(--sc-muted);
  font-size: 0.92rem;
}

@media (max-width: 560px) {
  .reg-review-areas li,
  .reg-added-list li {
    flex-direction: column;
    align-items: flex-start;
  }

  .reg-actions {
    flex-direction: column-reverse;
  }

  .reg-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

.modal-card-wide {
  width: min(640px, 100%);
}

.modal-card-xl {
  width: min(96vw, 1600px);
  max-width: calc(100vw - 2rem);
  max-height: min(92vh, 960px);
  overflow-x: hidden;
  overflow-y: auto;
}

.catalog-table-wrap {
  overflow-x: auto;
}

.catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.catalog-search {
  flex: 0 1 18rem;
  min-width: 12rem;
}

.catalog-area-filter {
  flex: 0 1 16rem;
  min-width: 11rem;
}

.catalog-area-filter select {
  max-width: 100%;
}

.catalog-toolbar-actions {
  margin-left: auto;
}

.materials-details {
  border: 1px solid var(--sc-line);
  border-radius: 10px;
  background: #f7f8fa;
  margin-bottom: 0.25rem;
}

.materials-details > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.85rem 1rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  user-select: none;
}

.materials-details > summary::-webkit-details-marker {
  display: none;
}

.materials-details > summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.55rem;
  color: var(--sc-muted);
  transition: transform 0.15s ease;
}

.materials-details[open] > summary::before {
  transform: rotate(90deg);
}

.materials-details[open] > summary {
  border-bottom: 1px solid var(--sc-line);
}

.materials-details > form {
  padding: 1rem;
  background: var(--sc-white);
  border-radius: 0 0 10px 10px;
}

.modal-card-xl .table-wrap {
  overflow: visible;
}

.modal-card-xl .catalog-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  margin: 0 -0.15rem;
  padding: 0 0.15rem;
}

.modal-card-xl table {
  min-width: 0;
  width: 100%;
  table-layout: auto;
}

.modal-card-xl .catalog-edit-table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.modal-card-xl .catalog-edit-table th,
.modal-card-xl .catalog-edit-table td {
  padding: 0.4rem 0.35rem;
  vertical-align: middle;
}

.modal-card-xl .catalog-edit-table th:nth-child(1),
.modal-card-xl .catalog-edit-table td:nth-child(1) { width: 13%; }
.modal-card-xl .catalog-edit-table th:nth-child(2),
.modal-card-xl .catalog-edit-table td:nth-child(2) { width: 12%; }
.modal-card-xl .catalog-edit-table th:nth-child(3),
.modal-card-xl .catalog-edit-table td:nth-child(3) { width: 10%; }
.modal-card-xl .catalog-edit-table th:nth-child(4),
.modal-card-xl .catalog-edit-table td:nth-child(4) { width: 10%; }
.modal-card-xl .catalog-edit-table th:nth-child(5),
.modal-card-xl .catalog-edit-table td:nth-child(5) { width: 6%; }
.modal-card-xl .catalog-edit-table th:nth-child(6),
.modal-card-xl .catalog-edit-table td:nth-child(6) { width: 8%; }
.modal-card-xl .catalog-edit-table th:nth-child(7),
.modal-card-xl .catalog-edit-table td:nth-child(7) { width: 14%; }
.modal-card-xl .catalog-edit-table th:nth-child(8),
.modal-card-xl .catalog-edit-table td:nth-child(8) { width: 8%; }
.modal-card-xl .catalog-edit-table th:nth-child(9),
.modal-card-xl .catalog-edit-table td:nth-child(9) { width: 10%; }
.modal-card-xl .catalog-edit-table th:nth-child(10),
.modal-card-xl .catalog-edit-table td:nth-child(10) { width: 5.5rem; }

.modal-card-xl td input:not([type="checkbox"]):not([type="radio"]),
.modal-card-xl td select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  appearance: none;
  border: 1px solid var(--sc-line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  background: #fff;
  color: var(--sc-ink);
  font: inherit;
  line-height: 1.3;
}

.modal-card-xl td select {
  appearance: auto;
  cursor: pointer;
}

.modal-card-xl td input[type="checkbox"],
.modal-card-xl th input[type="checkbox"],
.mat-select,
#materials-select-all {
  appearance: auto;
  -webkit-appearance: checkbox;
  width: 1.1rem;
  height: 1.1rem;
  min-width: 1.1rem;
  margin: 0.15rem 0 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  accent-color: var(--sc-red);
  cursor: pointer;
  vertical-align: middle;
}

.modal-card-xl td input:focus,
.modal-card-xl td select:focus {
  outline: 2px solid rgba(200, 16, 46, 0.25);
  border-color: var(--sc-red);
}

.modal-card-xl td .btn {
  white-space: nowrap;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.modal-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.modal-close {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--sc-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}

.modal-close:hover {
  background: #f3f5f8;
  color: var(--sc-ink);
}

.modal-lead {
  margin: 0 0 1rem;
  color: var(--sc-muted);
  font-size: 0.95rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 1.15rem;
  align-items: center;
  flex-wrap: wrap;
  position: sticky;
  bottom: -1.35rem;
  z-index: 3;
  padding: 0.75rem 0 0.15rem;
  background: var(--sc-white);
  box-shadow: 0 -12px 12px var(--sc-white);
}

.modal-actions #enroll-remove:not(.hidden),
.modal-actions #btn-delete-area:not(.hidden),
.modal-actions #btn-delete-supplier:not(.hidden),
.modal-actions #btn-admin-save-answers:not(.hidden) {
  margin-right: auto;
}

.modal-actions-end {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.account-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.account-summary-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.account-summary .label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sc-muted);
}

.account-summary .value {
  margin-top: 0.3rem;
  font-weight: 600;
  font-size: 1.05rem;
  word-break: break-word;
}

.password-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  max-width: 420px;
}

#token-form {
  max-width: none;
  width: 100%;
}

@media (max-width: 900px) {
  .account-summary-4 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .account-summary,
  .account-summary-4 {
    grid-template-columns: 1fr;
  }
}

.account-notify-list {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  max-width: 40rem;
}

#enroll-notify-areas,
#enroll-notify-admin {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.settings-toggle-field + .settings-toggle-field {
  margin-top: 0.35rem;
}

.account-notify-empty {
  margin: 0;
  color: var(--sc-muted);
}

.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.area-form {
  grid-template-columns: 6.5rem 1fr 1fr auto;
  align-items: end;
  max-width: 100%;
}

.area-form-actions {
  padding-bottom: 0.1rem;
}

.area-card .name-fr {
  font-size: 0.88rem;
  color: var(--sc-muted);
  margin-top: 0.15rem;
}

@media (max-width: 860px) {
  .login-card { grid-template-columns: 1fr; }
  .login-hero { min-height: 240px; }
  .status-row { grid-template-columns: 1fr; }
  .area-grid { grid-auto-columns: minmax(200px, 85%); }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .span-2,
  .form-grid .span-3,
  .form-grid .span-4 { grid-column: 1 / -1; }
  .topbar { flex-wrap: wrap; }
  .menu-toggle { display: inline-flex; }
  .sidebar-collapse-btn { display: none; }
  .app-shell.sidebar-collapsed .sidebar {
    width: max-content;
    min-width: 240px;
    max-width: none;
    padding-left: 0.85rem;
    padding-right: 0.85rem;
    overflow: visible;
  }
  .app-shell.sidebar-collapsed .sidebar-brand,
  .app-shell.sidebar-collapsed .sidebar-season,
  .app-shell.sidebar-collapsed .sidebar-nav,
  .app-shell.sidebar-collapsed .sidebar-footer {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.25);
  }
  .app-shell.nav-open .sidebar {
    transform: translateX(0);
  }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 24, 31, 0.45);
    z-index: 15;
  }
  .app-shell.nav-open .sidebar-backdrop {
    display: block;
  }
  .area-form {
    grid-template-columns: 1fr 1fr;
  }
  .area-form .field:first-child {
    grid-column: 1 / -1;
  }
  .area-form-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .area-form {
    grid-template-columns: 1fr;
  }
}

/* —— Settings tabs (browser-style) —— */
.settings-panel {
  padding-top: 0.85rem;
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.2rem;
  margin: 0 0 0;
  padding: 0 0.15rem;
  border-bottom: 1px solid var(--sc-line);
}

.membership-area-tabs {
  margin: 0 0 1rem;
  padding-bottom: 0;
}

.settings-tab {
  appearance: none;
  position: relative;
  bottom: -1px;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--sc-muted);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  padding: 0.7rem 1.15rem 0.65rem;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  line-height: 1.2;
}

.settings-tab:hover {
  color: var(--sc-ink);
  background: rgba(20, 24, 31, 0.03);
}

.settings-tab.active {
  color: var(--sc-white);
  background: var(--sc-red);
  border-color: var(--sc-red);
  box-shadow: none;
}

.settings-tab.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--sc-red);
}

.settings-tab:focus-visible {
  outline: 2px solid var(--sc-red);
  outline-offset: 2px;
  z-index: 1;
}

.settings-tab-panel {
  padding-top: 1.25rem;
}

.settings-tab-panel .panel-head {
  margin-top: 0;
}

.settings-divider {
  height: 1px;
  background: var(--sc-line);
  margin: 1.75rem 0 1.35rem;
}

.settings-details {
  border: 1px solid var(--sc-line);
  border-radius: 10px;
  background: #f7f8fa;
  margin-bottom: 0.75rem;
}

.settings-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  list-style: none;
  padding: 0.9rem 1rem;
  user-select: none;
}

.settings-details > summary::-webkit-details-marker {
  display: none;
}

.settings-details-title {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.settings-details-title::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.55rem;
  color: var(--sc-muted);
  transition: transform 0.15s ease;
}

.settings-details[open] .settings-details-title::before {
  transform: rotate(90deg);
}

.settings-details[open] > summary {
  border-bottom: 1px solid var(--sc-line);
}

.settings-details-body {
  padding: 1rem;
  background: var(--sc-white);
  border-radius: 0 0 10px 10px;
}

.settings-details > summary .role-pill {
  flex: 0 0 auto;
  pointer-events: none;
}

.settings-subsection-title {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.settings-details-body .settings-divider {
  margin: 1.25rem 0;
}

.data-toolbar [data-clear-type] {
  margin-left: auto;
  min-width: 7.5rem;
  box-sizing: border-box;
  text-align: center;
}

.data-toolbar [id^="btn-export-"] {
  min-width: 12.75rem;
  box-sizing: border-box;
  text-align: center;
}

.data-toolbar [id^="btn-import-"] {
  min-width: 12.75rem;
  box-sizing: border-box;
  text-align: center;
}

.recovery-key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.recovery-key-row .field {
  flex: 1 1 14rem;
  min-width: 0;
}

.recovery-key-row .btn {
  flex: 0 0 auto;
  margin-left: auto;
}

.seasons-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
  flex-wrap: nowrap;
}

.seasons-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex: 1 1 auto;
  min-width: 0;
}

.seasons-header .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.seasons-lead {
  margin: 0 0 1rem;
  color: var(--sc-muted);
  font-size: 0.95rem;
  max-width: 42rem;
}

#users-body .user-row {
  cursor: pointer;
}

#users-body .user-row td,
table:has(#users-body) th {
  vertical-align: middle;
}

#users-body .user-row:hover {
  background: rgba(200, 16, 46, 0.05);
}

#users-body .user-row:focus-visible {
  outline: 2px solid var(--sc-red);
  outline-offset: -2px;
}

#users-body .user-actions {
  white-space: nowrap;
}

#users-body .user-actions .btn {
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
  flex-wrap: wrap;
}

.table-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: wrap;
}

.table-toolbar-left .users-status-filter {
  margin-left: 0;
}

.table-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

.table-pager-label {
  font-size: 0.9rem;
  color: var(--sc-muted);
  min-width: 7rem;
  text-align: center;
}

.users-table-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin: -0.25rem 0 0.75rem;
  flex-wrap: wrap;
}

.users-search {
  flex: 1 1 14rem;
  min-width: 12rem;
  max-width: 22rem;
}

.users-search input {
  width: 100%;
  border: 1px solid var(--sc-line);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  background: #fff;
  color: var(--sc-ink);
}

.users-search input:focus {
  outline: 2px solid rgba(200, 16, 46, 0.25);
  border-color: var(--sc-red);
}

.users-status-filter {
  min-width: 9.5rem;
  margin: 0;
  flex: 0 0 auto;
}

.users-status-filter select {
  width: 100%;
  border: 1px solid var(--sc-line);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  background: #fff;
  color: var(--sc-ink);
}

#users-body .user-row.is-inactive {
  opacity: 0.62;
}

#users-body .user-actions .row-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

#users-body .btn-active-toggle {
  min-width: 6.25rem;
}

#suppliers-admin-body .supplier-row {
  cursor: pointer;
}

#suppliers-admin-body .supplier-row td {
  vertical-align: middle;
}

#suppliers-admin-body .supplier-row:hover {
  background: rgba(200, 16, 46, 0.04);
}

#suppliers-admin-body .supplier-row:focus-visible {
  outline: 2px solid rgba(200, 16, 46, 0.35);
  outline-offset: -2px;
}

#suppliers-admin-body tr.is-inactive {
  opacity: 0.62;
}

#suppliers-admin-body .btn-active-toggle {
  min-width: 6.25rem;
}

#areas-admin-body .area-row {
  cursor: pointer;
}

#areas-admin-body .area-row td {
  vertical-align: middle;
}

#areas-admin-body .area-row:hover {
  background: rgba(200, 16, 46, 0.04);
}

#areas-admin-body .area-row:focus-visible {
  outline: 2px solid rgba(200, 16, 46, 0.35);
  outline-offset: -2px;
}

#areas-admin-body tr.is-inactive {
  opacity: 0.62;
}

#areas-admin-body .btn-active-toggle {
  min-width: 6.25rem;
}

.venue-map-panel .panel-head {
  align-items: flex-start;
}

.venue-map-panel .toolbar {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.venue-map-empty {
  padding: 2.5rem 1.25rem;
  text-align: center;
  color: var(--sc-muted);
  border: 1px dashed var(--sc-line);
  border-radius: 0.75rem;
  background: #f8f9fb;
}

.venue-map-empty p {
  margin: 0;
}

.venue-map-hint {
  margin-top: 0.45rem !important;
  font-size: 0.92rem;
}

.venue-map-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.venue-map-zoom-controls .btn {
  min-width: 2.25rem;
  padding-left: 0.55rem;
  padding-right: 0.55rem;
}

.venue-map-zoom-label {
  min-width: 3.25rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--sc-slate);
  font-variant-numeric: tabular-nums;
}

.venue-map-viewer {
  position: relative;
  margin-top: 0.25rem;
}

.venue-map-chrome {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  pointer-events: none;
}

.venue-map-chrome .venue-map-zoom-controls,
.venue-map-chrome .btn {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.16);
}

.venue-map-chrome .venue-map-zoom-controls {
  padding: 0.2rem 0.3rem;
  border-radius: 0.55rem;
}

.venue-map-viewport {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 14rem);
  height: 70vh;
  overflow: hidden;
  border: 1px solid var(--sc-line);
  border-radius: 0.75rem;
  background: #dfe3ea;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.venue-map-hires {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  pointer-events: none;
  image-rendering: auto;
  box-shadow: none;
}

.venue-map-hires.is-stale,
.venue-map-hires.hidden {
  opacity: 0;
}

.venue-map-viewport.is-zoomed {
  cursor: grab;
}

.venue-map-viewport.is-dragging {
  cursor: grabbing;
}

.venue-map-stage {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.venue-map-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.venue-map-page {
  display: block;
  max-width: none;
  background: #fff;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.18);
}

.venue-map-status {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.78);
  color: #fff;
  font-size: 0.88rem;
  z-index: 2;
  pointer-events: none;
}

.venue-map-viewer:fullscreen,
.venue-map-viewer:-webkit-full-screen {
  width: 100%;
  height: 100%;
  margin: 0;
  background: #111;
  display: flex;
  flex-direction: column;
}

.venue-map-viewer:fullscreen .venue-map-viewport,
.venue-map-viewer:-webkit-full-screen .venue-map-viewport {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: #1a1a1a;
}

.reports-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.reports-section + .reports-section {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--sc-line);
}

.reports-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--sc-line);
  border-radius: 0.65rem;
  background: #f8f9fb;
}

.reports-group-title {
  font-weight: 700;
  color: var(--sc-ink);
}

.reports-group-btns {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.reports-group-btns .btn {
  min-width: 5.5rem;
  justify-content: center;
  text-align: center;
}

#btn-open-reports,
#btn-open-enroll,
#btn-open-add-area {
  min-width: 8.75rem;
  box-sizing: border-box;
  text-align: center;
  justify-content: center;
}

.settings-toggle-field {
  margin-top: 0;
}

.settings-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.settings-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.settings-toggle-ui {
  flex: 0 0 auto;
  width: 2.6rem;
  height: 1.45rem;
  margin-top: 0;
  border-radius: 999px;
  background: rgba(20, 24, 31, 0.18);
  position: relative;
  transition: background 0.18s ease;
}

.settings-toggle-ui::after {
  content: '';
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(20, 24, 31, 0.25);
  transition: transform 0.18s ease;
}

.settings-toggle input:checked + .settings-toggle-ui {
  background: var(--sc-ok, #2f7d4a);
}

.settings-toggle input:checked + .settings-toggle-ui::after {
  transform: translateX(1.15rem);
}

.settings-toggle input:focus-visible + .settings-toggle-ui {
  outline: 2px solid var(--sc-red, #c8102e);
  outline-offset: 2px;
}

.settings-toggle input:disabled + .settings-toggle-ui {
  opacity: 0.55;
}

.settings-toggle-compact {
  gap: 0.45rem;
  justify-content: flex-start;
}

.settings-toggle-compact .settings-toggle-ui {
  width: 2.2rem;
  height: 1.25rem;
}

.settings-toggle-compact .settings-toggle-ui::after {
  top: 0.15rem;
  left: 0.15rem;
  width: 0.95rem;
  height: 0.95rem;
}

.settings-toggle-compact input:checked + .settings-toggle-ui::after {
  transform: translateX(0.95rem);
}

.settings-toggle-state {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--sc-muted);
  min-width: 1.6rem;
}

.settings-toggle-compact input:checked ~ .settings-toggle-state {
  color: var(--sc-ok, #2f7d4a);
}

td .settings-toggle-compact {
  margin: 0;
}

.settings-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.settings-toggle-text strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--sc-ink, #14181f);
}

.settings-toggle-text span {
  font-size: 0.88rem;
  color: var(--sc-muted);
  line-height: 1.35;
}

.field-hint {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: var(--sc-muted);
  line-height: 1.4;
}

.field-hint code {
  font-size: 0.84em;
}

.email-smtp-row {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0.75rem;
}

@media (max-width: 700px) {
  .email-smtp-row {
    grid-template-columns: 1fr;
  }
}

#users-body .user-actions-note {
  color: var(--sc-muted);
  font-size: 0.88rem;
}

.th-sort {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.th-sort::after {
  content: '↕';
  font-size: 0.75em;
  opacity: 0.35;
  line-height: 1;
}

.th-sort.is-active[aria-sort="ascending"]::after {
  content: '↑';
  opacity: 0.9;
}

.th-sort.is-active[aria-sort="descending"]::after {
  content: '↓';
  opacity: 0.9;
}

.th-sort:hover,
.th-sort:focus-visible {
  color: var(--sc-red);
  outline: none;
}

#seasons-body .season-row {
  cursor: pointer;
}

#seasons-body .season-row td,
table:has(#seasons-body) th {
  vertical-align: middle;
}

#seasons-body .season-row:hover {
  background: rgba(200, 16, 46, 0.05);
}

#seasons-body .season-row:focus-visible {
  outline: 2px solid var(--sc-red);
  outline-offset: -2px;
}

#seasons-body .season-actions {
  white-space: nowrap;
}

#seasons-body .season-actions .btn {
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}

#seasons-body .season-phase-active {
  background: var(--sc-ok);
}

#seasons-body .season-phase-upcoming {
  background: var(--sc-slate);
}

#seasons-body .season-phase-ended,
#seasons-body .season-phase-unknown {
  background: var(--sc-muted);
}

#seasons-body .season-lock-cell {
  text-align: center;
  white-space: nowrap;
}

#seasons-body .season-lock-icon {
  font-size: 1.05rem;
  line-height: 1;
}

#seasons-body .season-lock-icon.is-locked {
  filter: grayscale(0);
}

#seasons-body .season-lock-icon.is-unlocked {
  opacity: 0.75;
}

#seasons-body td:nth-child(4),
#seasons-body td:nth-child(5),
table:has(#seasons-body) th:nth-child(4),
table:has(#seasons-body) th:nth-child(5),
table:has(#seasons-body) th:nth-child(6) {
  white-space: nowrap;
}

@media (max-width: 700px) {
  .seasons-header {
    flex-wrap: wrap;
  }
}

.field-with-action {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.field-with-action input {
  flex: 1 1 auto;
  min-width: 0;
}

.field-with-action .input-with-clear {
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: stretch;
}

.field-with-action .input-with-clear input {
  width: 100%;
  padding-right: 2.25rem;
}

.input-clear-btn {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  transform: translateY(-50%);
  width: 1.6rem;
  height: 1.6rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--sc-muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.input-clear-btn:hover {
  background: #eef1f5;
  color: var(--sc-slate);
}

.input-clear-btn.hidden {
  display: none !important;
}

.help-panel .panel-head {
  margin-bottom: 1rem;
}

.help-layout {
  display: grid;
  grid-template-columns: minmax(11rem, 15rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.help-topics {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0;
  padding: 0.45rem;
  border: 1px solid var(--sc-line);
  border-radius: 10px;
  background: #f7f8fa;
  position: sticky;
  top: 0.75rem;
  max-height: calc(100dvh - 8rem);
  overflow-y: auto;
}

.help-topic-btn {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.65rem;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--sc-ink);
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.help-topic-btn:hover {
  background: rgba(255, 255, 255, 0.75);
}

.help-topic-btn.active {
  background: var(--sc-white);
  box-shadow: 0 1px 2px rgba(20, 24, 31, 0.08);
  font-weight: 600;
}

.help-content {
  min-width: 0;
}

.help-article:not(.help-active) {
  display: none;
}

.help-article {
  background: var(--sc-white);
  border: 1px solid var(--sc-line);
  border-radius: 12px;
  padding: 1.15rem 1.25rem 1.25rem;
  margin: 0;
}

.help-article h3 {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.help-article p,
.help-article li {
  color: var(--sc-ink);
  font-size: 0.95rem;
  line-height: 1.55;
}

.help-article p {
  margin: 0 0 0.7rem;
}

.help-article ul,
.help-article ol {
  margin: 0;
  padding-left: 1.2rem;
}

.help-article li + li {
  margin-top: 0.4rem;
}

.help-article code {
  font-size: 0.88em;
}

.help-figure {
  margin: 0 0 1rem;
  border: 1px solid var(--sc-line);
  border-radius: 10px;
  overflow: hidden;
  background: #f7f8fa;
}

.help-figure img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.help-figure figcaption {
  padding: 0.55rem 0.75rem;
  color: var(--sc-muted);
  font-size: 0.85rem;
  line-height: 1.4;
  border-top: 1px solid var(--sc-line);
  background: var(--sc-white);
}

.help-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: help-step;
}

.help-steps > li {
  counter-increment: help-step;
  margin: 0 0 1.25rem;
  padding: 0 0 0 2.35rem;
  position: relative;
}

.help-steps > li::before {
  content: counter(help-step);
  position: absolute;
  left: 0;
  top: 0.05rem;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 999px;
  background: var(--sc-red, #c8102e);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.65rem;
  text-align: center;
}

.help-steps > li:last-child {
  margin-bottom: 0;
}

.help-steps h4 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.help-steps p {
  margin: 0 0 0.55rem;
}

.help-steps .help-figure {
  margin-top: 0.5rem;
}

.help-tip {
  margin: 1rem 0 0;
  padding: 0.65rem 0.75rem;
  border-left: 3px solid var(--sc-red, #c8102e);
  background: #fdf5f6;
  border-radius: 0 8px 8px 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

@media (max-width: 720px) {
  .help-layout {
    grid-template-columns: 1fr;
  }

  .help-topics {
    position: static;
    max-height: none;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .help-topic-btn {
    width: auto;
    flex: 1 1 auto;
    font-size: 0.85rem;
    padding: 0.5rem 0.7rem;
  }
}

.field-with-action .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .settings-tabs {
    gap: 0.1rem;
  }
  .settings-tab {
    font-size: 0.9rem;
    padding: 0.65rem 0.85rem 0.55rem;
  }
}


