/* Panel de administración */
body.admin { background: #0b0b0d; }
.muted { color: var(--muted); }
.warn { color: #ffb020; font-weight: 600; font-size: .85rem; }
.hint { color: var(--muted); font-size: .9rem; background: #131317; border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: 10px; padding: 10px 14px; margin: 0 0 16px; }
.hint code { background: #222; padding: 1px 6px; border-radius: 4px; color: #fff; }
.linkbtn { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 4px; font-size: .9rem; }
.linkbtn:hover { color: #fff; }
.grow { flex: 1; }
.right { text-align: right; }
.btn--danger { background: transparent; border-color: rgba(229,72,77,.5); color: #ff7b80; }
.btn--danger:hover { background: rgba(229,72,77,.15); }
.btn:disabled { opacity: .6; cursor: wait; transform: none; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at 70% 0%, rgba(227,6,19,.3), transparent 60%), #0b0b0d; }
.login__box { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 32px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); animation: rise .6s both; }
.login__box img { width: 220px; margin: 0 auto 6px; }
.login__box h1 { text-align: center; font-size: 1.6rem; text-transform: uppercase; font-style: italic; }
.login__box label { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--muted); }
.login__box .btn { justify-content: center; }
.login__err { color: #ff7b80; min-height: 1.2em; margin: 0; font-size: .9rem; text-align: center; }
.login__demo { text-align: center; border-top: 1px dashed var(--line); padding-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.login__demo p { width: 100%; margin: 0; color: #ffcf70; font-size: .85rem; }
.login__back { text-align: center; color: var(--muted); font-size: .85rem; }
input, select, textarea { background: #0f0f12; border: 1px solid var(--line); color: var(--text); border-radius: 9px; padding: 10px 12px; font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--red); outline-offset: 0; border-color: transparent; }
textarea { resize: vertical; }

/* estructura */
.panel { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: #111114; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px; gap: 18px; }
.side__logo img { width: 170px; margin: 0 auto; }
.side__nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side__nav button { display: flex; align-items: center; gap: 10px; text-align: left; background: none; border: 0; border-radius: 10px; padding: 11px 12px; cursor: pointer; color: #c6c6ce; font-weight: 600; transition: background .2s, color .2s; }
.side__nav button span { width: 22px; text-align: center; }
.side__nav button:hover { background: #1c1c21; color: #fff; }
.side__nav button.is-active { background: var(--red); color: #fff; box-shadow: 0 6px 18px rgba(227,6,19,.35); }
body:not(.is-super) [data-super] { display: none !important; }
.side__user { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--panel); border-radius: 12px; padding: 10px 12px; }
.side__user b { display: block; font-size: .9rem; }
.side__user small { color: var(--muted); font-size: .75rem; }
.main { min-width: 0; padding: 0 clamp(14px, 3vw, 34px) 60px; }
.main__top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 16px 0; background: rgba(11,11,13,.92); backdrop-filter: blur(10px); }
.main__top h1 { flex: 1; font-size: 2rem; font-style: italic; text-transform: uppercase; }
.main__menu { display: none; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; width: 42px; height: 42px; font-size: 1.2rem; cursor: pointer; }
.demo-note { background: #2a1d00; color: #ffcf70; border: 1px solid #4a3500; border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: .9rem; }
.demo-note .linkbtn { color: #fff; }
.view { animation: rise .35s both; }

.box { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin-bottom: 16px; }
.box h2 { font-size: 1.6rem; text-transform: uppercase; font-style: italic; margin-bottom: 6px; }
.box__head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.box__head p { margin: 4px 0 0; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea { color: var(--text); font-weight: 400; font-size: .95rem; }
.field--inline { flex-direction: row; align-items: center; gap: 10px; }
.field--check { flex-direction: row; align-items: center; gap: 8px; padding-top: 22px; color: var(--text); }
.field--check input { width: 18px; height: 18px; accent-color: var(--red); }
.form { display: flex; flex-direction: column; gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form__actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }
.form__actions--left { justify-content: flex-start; }
.form__actions--sticky { position: sticky; bottom: 0; z-index: 4; background: var(--panel); border-top: 1px solid var(--line); margin: 14px -20px -20px; padding: 14px 20px; border-radius: 0 0 16px 16px; justify-content: space-between; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; justify-content: space-between; flex-wrap: wrap; }
.toolbar input { min-width: 240px; }

/* píldoras de tramos */
.pills { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 10px; }
.pills button { flex: none; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; min-width: 86px; position: relative; }
.pills button b { font-family: var(--display); font-size: 1.05rem; }
.pills button small { color: var(--muted); font-size: .7rem; max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pills button::after { content: ''; position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: #444; }
.pills button.st-celebrado::after { background: var(--si); }
.pills button.st-anulado::after { background: var(--no); }
.pills button.is-active { border-color: var(--red); background: rgba(227,6,19,.15); }

/* tablas de edición */
.tbl--edit td { vertical-align: middle; }
.tbl--edit tr.is-on td { background: rgba(63,191,106,.05); }
.tbl--edit tr.is-off td { opacity: .55; }
.tbl--edit .pv { text-align: center; font-variant-numeric: tabular-nums; min-width: 54px; }
.tbl--edit .pv.b { font: 800 1.1rem var(--display); }
.inp-time { width: 100px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.inp-time:disabled { opacity: .35; cursor: not-allowed; }
.inp-time.is-err { border-color: var(--no); background: rgba(229,72,77,.12); }
.sw { position: relative; display: inline-block; width: 46px; height: 26px; cursor: pointer; }
.sw input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.sw i { position: absolute; inset: 0; border-radius: 999px; background: #2c2c33; transition: background .2s; pointer-events: none; }
.sw i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s cubic-bezier(.3,1.4,.6,1); }
.sw input:checked + i { background: var(--si); }
.sw--blue input:checked + i { background: var(--esp); }
.sw--gold input:checked + i { background: #d9a520; }
.sw input:checked + i::after { transform: translateX(20px); }
.sw input:disabled + i { opacity: .3; }
.sw input:focus-visible + i { outline: 2px solid #fff; outline-offset: 2px; }

/* formulario ciclista */
.modal__box--form { width: min(640px, 100%); }
.modal__box--form h3 { font-size: 1.7rem; text-transform: uppercase; font-style: italic; margin-bottom: 16px; padding-right: 40px; }
.photo-edit { display: flex; align-items: center; gap: 18px; }
.photo-edit img { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; border: 3px solid var(--red); flex: none; }
.photo-edit > div { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }

/* tramos */
.tramos-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
.tramo-form { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.tramo-form__head { display: flex; justify-content: space-between; align-items: center; }
.tramo-form__head b { font: 800 1.5rem var(--display); text-transform: uppercase; font-style: italic; color: var(--red2); }
.state { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 3px 9px; border-radius: 999px; background: #2a2a30; }
.state.st-celebrado { background: rgba(63,191,106,.18); color: var(--si); }
.state.st-anulado { background: rgba(229,72,77,.18); color: var(--no); }

/* destrezas */
.dz { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.dz__list { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 8px; display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 140px); overflow: auto; position: sticky; top: 84px; }
.dz__list button { display: flex; align-items: center; gap: 10px; background: none; border: 0; border-radius: 10px; padding: 7px 8px; cursor: pointer; text-align: left; font-size: .9rem; }
.dz__list button:hover { background: #1f1f24; }
.dz__list button.is-active { background: rgba(227,6,19,.18); }
.dz__list img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.dz__list span { flex: 1; }
.dz__list i { color: #b56cf0; font-style: normal; font-size: .7rem; }
.who--big img { width: 56px; height: 56px; }
.who--big strong { font: 700 1.5rem var(--display); }
.dz__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: center; margin-top: 16px; }
.dz__inputs { display: flex; flex-direction: column; gap: 6px; }
.dzin { display: grid; grid-template-columns: 62px 1fr 74px 18px; align-items: center; gap: 10px; font-size: .9rem; font-weight: 700; }
.dzin span { padding: 3px 0; border-radius: 6px; text-align: center; font-size: .8rem; }
.dzin.g0 span { background: #1f6fe0; } .dzin.g1 span { background: #4fa52a; color: #111; } .dzin.g2 span { background: #f26f2c; color: #111; }
.dzin input[type=range] { accent-color: #9b4fe0; padding: 0; background: none; border: 0; }
.dzin input[type=number] { padding: 6px 8px; text-align: right; }
.dzin em { font-style: normal; color: var(--muted); font-weight: 500; }
.dz__prev { max-width: 460px; justify-self: center; width: 100%; }

/* avisos */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1e2a22; border: 1px solid #2f6a43; color: #b8f0c9; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); animation: rise .3s both; transition: opacity .4s, transform .4s; max-width: 360px; }
.toast--err { background: #2d1416; border-color: #7a2a2f; color: #ffb3b6; }
.toast.is-out { opacity: 0; transform: translateX(30px); }

@media (max-width: 1100px) { .dz__grid { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .panel { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .3s; box-shadow: var(--shadow); }
  .side-open .side { transform: none; }
  .main__menu { display: block; }
  .main__top h1 { font-size: 1.4rem; }
  .main__top .btn { display: none; }
  .season span { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .dz { grid-template-columns: 1fr; }
  .dz__list { position: static; flex-direction: row; overflow-x: auto; max-height: none; }
  .dz__list button { flex: none; }
  .tramos-edit { grid-template-columns: 1fr; }
}
