﻿:root {
  --bg-main: #eef3f8;
  --bg-accent: #dce7f3;
  --surface: #ffffff;
  --surface-strong: #f6f9fc;
  --text: #162437;
  --text-muted: #5a6a80;
  --brand: #005aa9;
  --brand-strong: #003e77;
  --success: #1f8a5b;
  --warning: #ba8b00;
  --danger: #b43a39;
  --border: #d5deea;
  --shadow: 0 20px 38px rgba(16, 38, 66, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "IBM Plex Sans", "Source Sans 3", "Noto Sans", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at 10% 8%, rgba(0, 90, 169, 0.15), transparent 35%),
    radial-gradient(circle at 90% 0%, rgba(64, 130, 189, 0.2), transparent 30%),
    linear-gradient(180deg, var(--bg-main), var(--bg-accent));
}

.env-ribbon {
  width: 100%;
  text-align: center;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: #a63a00;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
  padding: 6px 10px;
}

.env-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 8px;
  margin-top: 4px;
  color: #fff;
  background: #a63a00;
}

.auth-env-pill {
  margin: 6px auto 10px;
}

body.env-test {
  background:
    radial-gradient(circle at 10% 8%, rgba(166, 58, 0, 0.16), transparent 35%),
    radial-gradient(circle at 90% 0%, rgba(210, 106, 0, 0.2), transparent 30%),
    linear-gradient(180deg, #f7efe8, #efe2d6);
}

body.env-test .app-topbar,
body.env-test .sidebar-nav,
body.env-test .account-badge,
body.env-test .season-badge,
body.env-test .card,
body.env-test table,
body.env-test .grid-form,
body.env-test .auth-card {
  border-color: #e0b59a;
}

body.env-test .sidebar-nav a.active {
  border-color: #cf7d4a;
  background: rgba(166, 58, 0, 0.14);
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  color: var(--brand-strong);
}

:focus-visible {
  outline: 2px solid rgba(0, 90, 169, 0.45);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -120px;
  z-index: 120;
  border-radius: 999px;
  border: 1px solid var(--brand-strong);
  background: var(--brand-strong);
  color: #fff;
  padding: 7px 11px;
}

.skip-link:focus {
  top: 10px;
}

.app-topbar {
  margin: 18px auto 0;
  width: min(96%, 1440px);
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-width: 0;
  flex: 1 1 auto;
  margin: 0;
  min-height: 172px;
}

.brand-logo {
  width: 168px;
  height: 168px;
  max-width: 100%;
  display: block;
  object-fit: contain;
  border-radius: 16px;
  padding: 8px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
}

.brand-copy h1 {
  margin: 0;
  font-size: clamp(2rem, 3.2vw, 3rem);
  line-height: 1.08;
  letter-spacing: 0.02em;
}

.brand-copy p {
  margin: 8px 0 0;
  font-size: clamp(1rem, 1.45vw, 1.35rem);
  color: var(--text-muted);
}

.brand-copy {
  text-align: center;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
}

.app-shell {
  width: min(96%, 1440px);
  margin: 14px auto 28px;
  padding: 0 4px;
  display: grid;
  grid-template-columns: minmax(220px, 270px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  padding: 12px;
  position: sticky;
  top: 14px;
}

body.role-admin .sidebar-nav {
  box-shadow: 0 20px 38px rgba(0, 62, 119, 0.13);
}

body.role-schedule_manager .sidebar-nav {
  box-shadow: 0 20px 38px rgba(31, 138, 91, 0.13);
}

body.role-rater .sidebar-nav {
  box-shadow: 0 20px 38px rgba(186, 139, 0, 0.13);
}

.nav-group {
  display: grid;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.nav-group:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.nav-group h3 {
  margin: 0 0 2px;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar-nav a,
.button-like,
button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--brand-strong);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 160ms ease;
  cursor: pointer;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 40px;
  text-align: left;
}

.sidebar-nav a:hover,
.button-like:hover,
button:hover {
  border-color: var(--brand);
  background: rgba(0, 90, 169, 0.08);
  color: var(--brand-strong);
}

.sidebar-nav a.active {
  border-color: var(--brand);
  background: rgba(0, 90, 169, 0.14);
  color: var(--brand-strong);
}

button[type="submit"],
.actions-row button,
.sidebar-nav form button {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

button[type="submit"]:hover,
.actions-row button:hover,
.sidebar-nav form button:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
  color: #fff;
}

.account-badge {
  display: grid;
  gap: 8px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 10px;
  box-shadow: var(--shadow);
  margin-left: auto;
  min-width: 250px;
}

.account-stack {
  margin-left: auto;
  display: grid;
  gap: 8px;
  min-width: 290px;
}

.season-badge {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 10px;
  box-shadow: var(--shadow);
}

.account-main {
  display: grid;
  gap: 8px;
}

.account-label {
  margin: 0 4px 0 0;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.account-user {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
}

.account-role {
  margin: 0 0 0 4px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #2d4765;
  background: #edf4fb;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 6px;
}

.account-meta {
  display: grid;
  gap: 3px;
  justify-items: end;
  text-align: right;
}

.account-logout {
  width: 100%;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.account-season-form {
  display: grid;
  gap: 6px;
}

.account-season-form label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.season-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.season-row select {
  min-width: 110px;
}

.season-row button {
  padding: 7px 10px;
}

.logout-link {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 600;
}

.logout-link:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
  color: #fff;
}

.page {
  width: min(96%, 1440px);
  margin: 14px auto 28px;
  padding: 0 4px;
}

.app-shell .page {
  width: 100%;
  margin: 0;
  padding: 0;
}

.page-header {
  display: grid;
  gap: 4px;
  margin: 0 0 12px;
}

.page-title {
  margin: 0;
  font-size: 1.32rem;
  letter-spacing: 0.01em;
}

.page-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

h1,
h2,
h3 {
  margin-top: 0;
}

h2 {
  font-size: 1.35rem;
  letter-spacing: 0.01em;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.card,
table,
.grid-form,
.auth-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.card {
  padding: 16px;
}

.card-links {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 0.83rem;
  font-weight: 600;
  background: #fff;
  color: var(--brand-strong);
}

.card-links a:hover {
  border-color: var(--brand);
  background: rgba(0, 90, 169, 0.09);
}

.kpi-list {
  margin: 6px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.kpi-list li {
  line-height: 1.35;
}

.big {
  margin: 6px 0 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--brand-strong);
}

.actions {
  margin: 14px 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-form-spaced {
  margin: 10px 0;
}

.filter-bar {
  margin: 8px 0 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 18px rgba(12, 33, 60, 0.07);
}

.filter-layout {
  display: grid;
  gap: 10px;
  width: 100%;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  width: 100%;
}

.filter-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.88);
}

.filter-section > legend {
  padding: 0 6px;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

.filter-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -4px 0 10px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--brand-strong);
  font-size: 0.8rem;
  font-weight: 600;
}

.filter-chip:hover {
  border-color: var(--brand);
  background: rgba(0, 90, 169, 0.08);
}

.filter-clear {
  border-style: dashed;
}

.inline-form > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--brand-strong);
  font-size: 0.86rem;
  font-weight: 600;
}

.inline-form > a:hover {
  border-color: var(--brand);
  background: rgba(0, 90, 169, 0.08);
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  padding: 14px;
}

.grid-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.9rem;
  color: var(--text);
  background: #fff;
}

input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

#hfcc-select-all,
.hfcc-row-checkbox {
  width: 1.2rem;
  height: 1.2rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(0, 90, 169, 0.25);
  border-color: var(--brand);
}

.checkbox {
  justify-content: center;
  color: var(--text);
}

.checkbox input {
  width: auto;
}

.actions-row {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  justify-content: flex-start;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

caption {
  text-align: left;
  padding: 10px 10px 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

th,
td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  padding: 9px 10px;
  font-size: 0.89rem;
}

th {
  background: #f1f6fb;
  color: #314a67;
  font-weight: 700;
  letter-spacing: 0.01em;
}

tr:nth-child(even) td {
  background: rgba(245, 248, 252, 0.66);
}

tr:last-child td {
  border-bottom: 0;
}

audio {
  width: 100%;
  min-width: 180px;
}

.audio-player {
  max-width: 260px;
}

.audio-player-md {
  max-width: 240px;
}

.audio-player-sm {
  max-width: 220px;
}

.input-sm {
  width: 110px;
}

.input-md {
  width: 140px;
}

.input-compact {
  width: 96px;
}

.select-md {
  width: 130px;
}

.field-range {
  min-width: 220px;
}

.summary-trigger {
  display: inline-flex;
  margin-bottom: 10px;
}

.map-surface {
  height: 520px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(480px, 96%);
  padding: 20px;
  text-align: center;
}

.auth-logo {
  width: 124px;
  height: 124px;
  max-width: 100%;
  display: block;
  margin: 0 auto 8px;
  object-fit: contain;
  border-radius: 16px;
  padding: 5px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
}

.auth-subtitle {
  margin-top: -3px;
  margin-bottom: 14px;
  color: var(--text-muted);
}

.error-msg {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(180, 58, 57, 0.35);
  background: rgba(180, 58, 57, 0.1);
  color: var(--danger);
}

code {
  border-radius: 7px;
  background: #edf2f8;
  border: 1px solid var(--border);
  padding: 1px 5px;
}

small {
  color: var(--text-muted);
}

.notice {
  margin: 8px 0 12px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f4f8fd;
}

.notice.success {
  border-color: rgba(31, 138, 91, 0.35);
  background: rgba(31, 138, 91, 0.12);
  color: #0f613e;
}

.notice.error {
  border-color: rgba(180, 58, 57, 0.35);
  background: rgba(180, 58, 57, 0.1);
  color: var(--danger);
}

.badge-pending,
.badge-complete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-weight: 700;
}

.badge-pending {
  color: #8f3f09;
  background: rgba(237, 174, 74, 0.22);
  border-color: rgba(186, 139, 0, 0.35);
}

.badge-complete {
  color: #0f613e;
  background: rgba(31, 138, 91, 0.18);
  border-color: rgba(31, 138, 91, 0.3);
}

.progress-wrap {
  min-width: 220px;
  display: grid;
  gap: 6px;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e7eef7;
  border: 1px solid #d2deec;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #1f8a5b, #2fa26f);
}

.criteria-list {
  display: grid;
  gap: 2px;
}

.tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 12px;
}

.tab-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--brand-strong);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.tab-btn[aria-selected="true"] {
  border-color: var(--brand);
  background: rgba(0, 90, 169, 0.14);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.rule-edit-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(240px, 0.7fr);
  gap: 10px;
}

.compact-note {
  margin-top: 0;
  color: var(--text-muted);
}

.range-from-right {
  direction: rtl;
}

details.card summary {
  list-style: none;
}

details.card summary::-webkit-details-marker {
  display: none;
}

.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;
}

@media (max-width: 960px) {
  .app-topbar {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
  }

  .brand {
    width: 100%;
    justify-content: center;
    min-height: 0;
    gap: 14px;
  }

  .brand-copy {
    text-align: center;
  }

  .brand-logo {
    width: 120px;
    height: 120px;
  }

  .brand-copy h1 {
    font-size: clamp(1.5rem, 6vw, 2.2rem);
  }

  .brand-copy p {
    font-size: clamp(0.9rem, 3.2vw, 1.1rem);
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar-nav {
    position: static;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    align-items: start;
  }

  .nav-group {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .rule-edit-grid {
    grid-template-columns: 1fr;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

@media (max-width: 620px) {
  .brand {
    flex-direction: column;
    gap: 10px;
  }

  .brand-logo {
    width: 96px;
    height: 96px;
  }

  .brand-copy h1 {
    font-size: clamp(1.25rem, 7vw, 1.7rem);
  }

  .brand-copy p {
    margin-top: 4px;
    font-size: clamp(0.84rem, 4vw, 1rem);
  }

  .sidebar-nav a,
  .button-like,
  button {
    width: 100%;
    text-align: center;
  }

  .account-stack,
  .account-badge,
  .season-badge {
    width: 100%;
    min-width: 0;
  }

  .account-main {
    white-space: normal;
  }

  .account-meta {
    justify-items: start;
    text-align: left;
  }

  .account-logout {
    justify-content: flex-start;
  }

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

  .inline-form {
    width: 100%;
  }

  .sidebar-nav {
    grid-template-columns: 1fr;
  }

  .inline-form input,
  .inline-form select,
  .inline-form button,
  .inline-form > a {
    width: 100%;
  }

  .filter-row {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    width: 100%;
  }

  .filter-actions > * {
    width: 100%;
  }

  th,
  td {
    padding: 8px;
    font-size: 0.84rem;
  }
}
