/* Core layout and shared components */

:root {
  --ink: #19251f;
  --muted: #7c8780;
  --line: #e7ebe5;
  --bg: #f5f6f2;
  --paper: #fff;
  --green: #245b45;
  --green-soft: #eaf3ed;
  --lime: #d8ed75;
  --orange: #f4a85a;
  --shadow: 0 10px 34px rgba(30,50,38,.055);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'DM Sans',sans-serif;
  font-size: 14px;
}

button,input,select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 244px;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 30px 18px 18px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
  font: 800 23px Manrope,sans-serif;
  letter-spacing: -1px;
  margin: 0 0 54px 8px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--green);
  color: var(--lime);
  display: grid;
  place-items: center;
  font: 800 28px Manrope,sans-serif;
}

.brand-dot {
  color: var(--green);
}

.brand small {
  display: block;
  font: 500 10px 'DM Sans',sans-serif;
  color: #98a19b;
  letter-spacing: .7px;
  text-transform: uppercase;
  margin-top: -2px;
}

.side-label {
  font-size: 10px;
  font-weight: 700;
  color: #a3aca5;
  letter-spacing: 1.3px;
  margin: 0 0 12px 12px;
}

.sidebar nav {
  display: grid;
  gap: 5px;
}

.nav-link {
  border: 0;
  background: transparent;
  color: #647168;
  text-align: left;
  border-radius: 9px;
  padding: 12px 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
}

.nav-link:hover {
  background: #f5f7f4;
}

.nav-link.active {
  background: var(--green);
  color: white;
  box-shadow: 0 5px 14px #245b4530;
}

.nav-icon {
  font-size: 18px;
  width: 18px;
  text-align: center;
}

.nav-arrow {
  margin-left: auto;
  color: var(--lime);
}

.side-bottom {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 17px 2px 0;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #7a857e;
  font-size: 11px;
}

.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #73b787;
}

.local-pill {
  margin-left: auto;
  background: #eff5e5;
  color: #658044;
  font-size: 8px;
  letter-spacing: .5px;
  font-weight: 700;
  padding: 5px 6px;
  border-radius: 4px;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 70px;
  border-bottom: 1px solid var(--line);
  padding: 0 5.3%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff8c;
}

.crumb {
  font-size: 12px;
  color: #9aa39d;
}

.crumb span {
  margin: 0 9px;
  color: #c3c9c4;
}

.crumb b {
  font-weight: 600;
  color: #48564d;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.today {
  font-size: 11px;
  color: #849087;
}

.avatar {
  width: 31px;
  height: 31px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e8ede7;
  color: var(--green);
  font-weight: 700;
}

.content {
  max-width: 1200px;
  width: 100%;
  padding: 44px 5.3% 38px;
  margin: 0 auto;
  flex: 1;
}

.main footer {
  border-top: 1px solid var(--line);
  padding: 17px 5.3%;
  color: #a0a9a2;
  font-size: 10px;
  letter-spacing: .2px;
}

.main footer span {
  margin: 0 5px;
  color: #c5ccc6;
}

.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #94a098;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 28px;
  gap: 18px;
}

.page-head h1 {
  font: 700 30px Manrope,sans-serif;
  letter-spacing: -1.2px;
  margin: 0 0 7px;
}

.page-head p {
  margin: 0;
  color: #849087;
  font-size: 13px;
}

.button {
  border: 0;
  border-radius: 8px;
  padding: 11px 15px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: .15s;
}

.button-primary {
  background: var(--green);
  color: white;
  box-shadow: 0 4px 10px #245b4520;
}

.button-primary:hover {
  background: #1b4937;
  transform: translateY(-1px);
}

.button-light {
  background: #f0f3ef;
  color: #526057;
}

.button-light:hover {
  background: #e6ebe6;
}

.button-danger {
  background: #fbefeb;
  color: #af5944;
}

.button-small {
  padding: 7px 10px;
  font-size: 11px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 14px;
  margin: 0 0 26px;
}

.stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 17px 18px;
  display: flex;
  align-items: center;
  gap: 13px;
}

.stat-icon {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  background: #eef4ee;
  border-radius: 10px;
  color: var(--green);
  font-size: 17px;
}

.stat-label {
  font-size: 10px;
  color: #929d95;
  margin-bottom: 4px;
}

.stat-value {
  font: 700 21px Manrope,sans-serif;
  letter-spacing: -.5px;
}

.stat-note {
  font-size: 10px;
  color: #a0aaa3;
  margin-left: auto;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 28px 1px 13px;
}

.section-head h2 {
  font: 700 16px Manrope,sans-serif;
  margin: 0;
  letter-spacing: -.3px;
}

.section-head span {
  font-size: 11px;
  color: #99a29b;
}

.event-list {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 14px;
}

.event-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 3px 12px #213c2605;
  transition: .18s;
  cursor: pointer;
}

.event-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: #d6e2d8;
}

.event-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.event-symbol {
  width: 39px;
  height: 39px;
  border-radius: 10px;
  background: #edf4ef;
  display: grid;
  place-items: center;
  color: var(--green);
  font-size: 18px;
}

.tag {
  border-radius: 20px;
  padding: 5px 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .3px;
  background: #f1f4f0;
  color: #6c796f;
}

.event-card h3 {
  font: 700 17px Manrope,sans-serif;
  letter-spacing: -.4px;
  margin: 16px 0 5px;
}

.event-date {
  font-size: 11px;
  color: #929d95;
}

.event-meta {
  border-top: 1px solid #f0f2ef;
  margin-top: 16px;
  padding-top: 13px;
  display: flex;
  gap: 19px;
  color: #7f8b82;
  font-size: 10px;
}

.event-meta b {
  color: #3d5144;
  margin-right: 3px;
  font-weight: 700;
}

.empty {
  background: #fff;
  border: 1px dashed #dce3dc;
  border-radius: 12px;
  text-align: center;
  padding: 43px 20px;
}

.empty-icon {
  font-size: 28px;
  color: #a0b9a4;
  margin-bottom: 10px;
}

.empty h3 {
  font: 700 16px Manrope,sans-serif;
  margin: 0 0 6px;
}

.empty p {
  margin: 0 0 15px;
  color: #929d95;
  font-size: 12px;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
}

.panel-header {
  padding: 17px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-header h2 {
  font: 700 14px Manrope,sans-serif;
  margin: 0;
}

.panel-header span {
  font-size: 10px;
  color: #99a29b;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  background: #fbfcfa;
  color: #98a29b;
  text-transform: uppercase;
  letter-spacing: .7px;
  font-size: 9px;
  padding: 11px 17px;
  font-weight: 700;
}

.table td {
  padding: 12px 17px;
  border-top: 1px solid #f0f2ef;
  font-size: 12px;
}

.table tr:first-child td {
  border-top: 0;
}

.rank {
  font: 700 13px Manrope,sans-serif;
  color: #7c8980;
  width: 48px;
}

.rank.first {
  color: #b38122;
}

.rank.second {
  color: #82909b;
}

.rank.third {
  color: #a56f4d;
}

.name-cell {
  font-weight: 600;
}

.score-total {
  font: 700 14px Manrope,sans-serif;
}

.muted-cell {
  color: #a5ada7;
}

.medal {
  font-size: 15px;
  margin-right: 7px;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
}

.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  overflow: auto;
}

.tab {
  white-space: nowrap;
  padding: 10px 14px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: #88938b;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: -1px;
}

.tab.active {
  color: var(--green);
  border-color: var(--green);
}

.event-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 14px;
  gap: 12px;
}

.event-toolbar h2 {
  font: 700 17px Manrope,sans-serif;
  margin: 0;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.leaderboard {
  margin-bottom: 20px;
}

.leaderboard .panel-header {
  background: #fff;
}

.leaderboard .table tr:nth-child(1) td {
  background: #fffdf4;
}

.day-block {
  margin: 16px 0;
}

.day-title {
  font: 700 12px Manrope,sans-serif;
  margin: 0 0 9px;
  color: #536157;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(210px,1fr));
  gap: 11px;
}

.track-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}

.track-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 12px;
}

.track-head small {
  color: #a2aba4;
  font-size: 9px;
  font-weight: 500;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.field label {
  display: block;
  font-size: 9px;
  color: #8f9a91;
  margin: 0 0 5px;
}

.field input,.field select,.input {
  width: 100%;
  border: 1px solid #e3e9e3;
  border-radius: 6px;
  background: #fff;
  padding: 8px 9px;
  color: var(--ink);
  font-size: 11px;
  outline: none;
}

.field input:focus,.field select:focus,.input:focus {
  border-color: #86aa91;
  box-shadow: 0 0 0 3px #e9f1eb;
}

.field select {
  margin-bottom: 8px;
}

.score-result {
  background: #f4f7f2;
  color: #607166;
  border-radius: 5px;
  padding: 7px;
  font-size: 10px;
  margin-top: 9px;
}

.score-result b {
  color: var(--green);
  font-weight: 700;
}

.no-days {
  padding: 22px;
  text-align: center;
  color: #98a29b;
  font-size: 12px;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 9px;
}

.contestant-layout {
  display: grid;
  grid-template-columns: minmax(0,1.35fr) minmax(250px,.8fr);
  gap: 16px;
}

.add-box {
  background: white;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 18px;
  height: max-content;
}

.add-box h3 {
  font: 700 14px Manrope,sans-serif;
  margin: 0 0 5px;
}

.add-box p {
  font-size: 11px;
  color: #939e95;
  line-height: 1.5;
  margin: 0 0 16px;
}

.input-row {
  display: flex;
  gap: 7px;
}

.input-row .input {
  flex: 1;
  min-width: 0;
}

.hint {
  font-size: 10px;
  color: #9aa39d;
  margin-top: 11px;
  line-height: 1.4;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: #18251f66;
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 5;
  backdrop-filter: blur(2px);
}

.modal {
  width: min(100%,420px);
  background: #fff;
  border-radius: 13px;
  padding: 23px;
  box-shadow: 0 24px 70px #13241a40;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.modal h2 {
  font: 700 19px Manrope,sans-serif;
  letter-spacing: -.5px;
  margin: 0 0 6px;
}

.modal p {
  font-size: 11px;
  color: #89948c;
  margin: 0 0 20px;
  line-height: 1.5;
}

.close {
  border: 0;
  background: #f2f4f1;
  color: #718076;
  border-radius: 50%;
  width: 27px;
  height: 27px;
  font-size: 15px;
}

.modal .field {
  margin-bottom: 13px;
}

.modal .field label {
  font-size: 10px;
}

.modal .field input {
  padding: 10px;
  font-size: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translate(-50%,20px);
  opacity: 0;
  pointer-events: none;
  background: #1f3127;
  color: #fff;
  padding: 11px 16px;
  border-radius: 8px;
  box-shadow: 0 8px 25px #1c302444;
  font-size: 12px;
  transition: .2s;
  z-index: 9;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%,0);
}

.loading {
  text-align: center;
  color: #93a097;
  padding: 70px;
}

.error-box {
  padding: 12px;
  border-radius: 7px;
  background: #fbefeb;
  color: #a15340;
  font-size: 12px;
}

@media(max-width:900px) {
  .sidebar {
    width: 205px;
  }
  .content {
    padding-left: 4%;
    padding-right: 4%;
  }
  .event-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media(max-width:700px), (orientation:landscape) and (max-height:500px) {
  .sidebar {
    width: 60px;
    padding: 22px 8px 13px;
    align-items: center;
  }
  .brand {
    margin: 0 0 42px;
  }
  .brand>span:last-child,.side-label,.nav-link:not(.active),.nav-link.active {
    font-size: 0;
  }
  .nav-link {
    padding: 11px;
    justify-content: center;
    width: 42px;
    height: 42px;
  }
  .nav-icon {
    font-size: 18px;
  }
  .nav-arrow,.side-bottom span {
    display: none;
  }
  .side-bottom {
    justify-content: center;
  }
  .main {
    width: calc(100% - 60px);
  }
  .topbar {
    height: 58px;
    padding: 0 17px;
  }
  .today {
    display: none;
  }
  .content {
    padding: 29px 16px;
  }
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .page-head h1 {
    font-size: 25px;
  }
  .stats {
    gap: 7px;
  }
  .stat {
    padding: 12px 9px;
    gap: 7px;
  }
  .stat-icon {
    display: none;
  }
  .stat-value {
    font-size: 18px;
  }
  .stat-note {
    display: none;
  }
  .event-list {
    grid-template-columns: 1fr;
  }
  .contestant-layout {
    grid-template-columns: 1fr;
  }
  .table th,.table td {
    padding-left: 10px;
    padding-right: 10px;
  }
  .score-grid {
    grid-template-columns: 1fr;
  }
  .toolbar-actions .button {
    padding: 9px;
  }
  .event-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .event-card {
    padding: 15px;
  }
}
