:root {
  --bg: oklch(0.15 0.04 290);
  --surface: oklch(0.2 0.05 285);
  --surface2: oklch(0.25 0.06 280);
  --surface3: oklch(0.3 0.06 278);
  --gold: oklch(0.83 0.16 85);
  --pink: oklch(0.58 0.22 15);
  --teal: oklch(0.78 0.14 170);
  --text: oklch(0.92 0.03 300);
  --text-dim: oklch(0.55 0.04 290);
  --danger: oklch(0.63 0.24 25);
  --border: oklch(0.3 0.06 280);
  --input-bg: oklch(0.14 0.04 285);
  --glass: oklch(0.2 0.05 285 / 0.75);
  --male: oklch(0.65 0.15 255);
  --female: oklch(0.58 0.22 15);
  --unisex: oklch(0.65 0.15 300);
  --glow-teal: 0 0 20px oklch(0.78 0.14 170 / 0.15);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Outfit", sans-serif;
  min-height: 100dvh;
  font-size: 15px;
  line-height: 1.5;

  &::before {
    content: "";
    position: fixed;
    inset: 0;
    opacity: 0.025;
    pointer-events: none;
    z-index: 9999;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  }

  &:not(.admin) .ao {
    display: none !important;
  }
}

/* Utilities */
.dim {
  font-size: 0.76rem;
  color: var(--text-dim);
}
.c-teal {
  color: var(--teal);
}
.c-pink {
  color: var(--pink);
}
.hidden {
  display: none !important;
}
.w-full {
  width: 100%;
}
.flex-2 {
  flex: 2;
}
.w-fix {
  flex: 0 0 95px;
}
.w-fix-sm {
  flex: 0 0 80px;
}

/* Layout */
.shell {
  max-width: 660px;
  margin: 0 auto;
  padding: 1rem;
  container-type: inline-size;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 14px;
  border: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.logo {
  font-family: "Space Mono", monospace;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--gold);
}

.hdr-r {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.nav-link,
.prof-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  color: var(--text);
  font-family: "Outfit", sans-serif;
  font-size: 0.83rem;
  text-decoration: none;
  transition: border-color 0.2s;
  cursor: pointer;

  &:hover {
    border-color: color-mix(in oklch, var(--gold) 50%, transparent);
  }
}

.prof-btn .al {
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adm-l {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;

  & input {
    accent-color: var(--gold);
  }
}

/* Forms */
.irow {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
  flex-wrap: wrap;
}

input,
select {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  font-family: "Outfit", sans-serif;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;

  &:focus {
    border-color: var(--gold);
  }
  &::placeholder {
    color: var(--text-dim);
  }
}

.irow input,
.irow select {
  flex: 1;
  min-width: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}
input[type="datetime-local"] {
  color-scheme: dark;
  min-width: 175px;
}
select {
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: "Outfit", sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
  user-select: none;

  &:hover {
    background: var(--surface2);
    border-color: color-mix(in oklch, var(--gold) 50%, transparent);
  }
  &:active {
    transform: scale(0.97);
  }
  &:disabled {
    opacity: 0.35;
    pointer-events: none;
  }
}

.btn-add {
  background: var(--pink);
  color: #fff;
  border: none;
  font-weight: 600;
  flex-shrink: 0;

  &:hover {
    background: color-mix(in oklch, var(--pink) 70%, black);
  }
}

.btn-sm {
  padding: 0.28rem 0.5rem;
  font-size: 0.76rem;
}

.btn-icon {
  border-color: transparent;
  color: var(--text-dim);
  padding: 0.25rem 0.4rem;

  &:hover {
    color: var(--text);
    background: var(--surface3);
  }
  &.del:hover {
    color: var(--danger);
    background: color-mix(in oklch, var(--danger) 10%, transparent);
  }
}

.btn-vote {
  border-color: color-mix(in oklch, var(--gold) 50%, transparent);
  color: var(--gold);

  &.voted {
    background: var(--gold);
    color: var(--bg);
  }
}

.btn-attend {
  border-color: color-mix(in oklch, var(--teal) 50%, transparent);
  color: var(--teal);

  &.going {
    background: var(--teal);
    color: var(--bg);
  }
}

.btn-final {
  border-color: color-mix(in oklch, var(--pink) 50%, transparent);
  color: var(--pink);

  &.finalized {
    background: var(--teal);
    color: var(--bg);
    border-color: var(--teal);
  }
}

/* Chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0;
}

.chip {
  padding: 0.28rem 0.6rem;
  border-radius: 16px;
  font-size: 0.78rem;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text-dim);
  transition: all 0.15s;
  user-select: none;

  &:hover {
    border-color: color-mix(in oklch, var(--gold) 50%, transparent);
  }
  &.on {
    background: var(--teal);
    color: var(--bg);
    border-color: var(--teal);
    font-weight: 500;
  }
}

/* Modal (native <dialog>) */
dialog.mo[open] {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 100vw;
  max-height: 100dvh;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fi 0.15s;

  &::backdrop {
    background: oklch(0 0 0 / 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
}

.md {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.4rem;
  max-width: 400px;
  width: 92%;

  & h3 {
    font-family: "Space Mono", monospace;
    color: var(--gold);
    font-size: 0.92rem;
    margin-bottom: 0.9rem;
    text-wrap: balance;
  }

  & .f {
    margin-bottom: 0.8rem;

    & label {
      display: block;
      font-size: 0.78rem;
      color: var(--text-dim);
      margin-bottom: 0.25rem;
    }
    & input,
    & select {
      width: 100%;
    }
  }

  & .acts {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.1rem;
  }
}

.pin-input {
  letter-spacing: 4px;
  text-align: center;
  font-size: 1.1rem;
}
.collision-warn {
  color: var(--danger);
  font-size: 0.82rem;
  padding: 0.5rem;
  background: color-mix(in oklch, var(--danger) 10%, transparent);
  border-radius: 6px;
}
.dlg-msg {
  margin-bottom: 1.1rem;
}

@keyframes fi {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Cards — shared base */
.card,
.exp-card,
.settle-card,
.user-row {
  background: var(--surface);
  border-radius: 8px;
  margin-bottom: 0.3rem;
}

.card {
  border-left: 3px solid var(--pink);
  padding: 0.8rem 0.95rem;
  margin-bottom: 0.45rem;
  animation: cardIn 0.22s ease-out;
  transition: box-shadow 0.2s;

  &:hover {
    box-shadow: 0 2px 12px oklch(0 0 0 / 0.25);
  }

  &.final {
    border-left-color: var(--teal);
    background: linear-gradient(
      135deg,
      var(--surface),
      oklch(0.78 0.14 170 / 0.04)
    );
    box-shadow: var(--glow-teal);
  }
}

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

.card-body {
  flex: 1;
  min-width: 0;

  & a {
    color: var(--teal);
    text-decoration: none;
    word-break: break-all;
  }
  & a:hover {
    text-decoration: underline;
  }
}

.card-meta {
  margin-top: 1px;
  display: inline;
}
.card-actions {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}
.card-btns {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.att-list {
  font-size: 0.76rem;
  color: var(--teal);
  margin-top: 0.3rem;
}

.exp-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
}

.settle-card {
  border: 1px solid var(--border);
  padding: 0.6rem 0.8rem;
  font-size: 0.86rem;

  & .ar {
    color: var(--gold);
    margin: 0 0.3rem;
  }
}

.user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.7rem;
  font-size: 0.85rem;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* Navigation tabs */
nav {
  display: flex;
  gap: 3px;
  margin-bottom: 1.15rem;
  background: var(--surface);
  border-radius: 10px;
  padding: 3px;
  overflow-x: auto;

  & button {
    flex: 1;
    min-width: 0;
    background: transparent;
    color: var(--text-dim);
    border: none;
    padding: 0.5rem 0.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: "Outfit", sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    position: relative;

    &:hover {
      color: var(--text);
      background: var(--surface2);
    }
    &.active {
      background: var(--gold);
      color: var(--bg);
      font-weight: 600;
    }
  }
}

.bdot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pink);
  position: absolute;
  top: 5px;
  right: 5px;
}

/* Filter tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 0.9rem;
}

.tab {
  background: var(--surface2);
  border: 1px solid transparent;
  color: var(--text-dim);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: "Outfit", sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.15s;

  &:hover {
    color: var(--text);
  }
  &.active {
    border-color: var(--gold);
    color: var(--gold);
    background: color-mix(in oklch, var(--gold) 6%, transparent);
  }
}

/* Costumes */
.costume-thumb {
  max-width: 100%;
  max-height: 180px;
  border-radius: 6px;
  margin-top: 0.45rem;
  display: block;
  object-fit: cover;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.2s;

  &:hover {
    border-color: color-mix(in oklch, var(--gold) 50%, transparent);
  }
}

.g-badge {
  display: inline-block;
  padding: 0.08rem 0.4rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-left: 0.25rem;

  &.male {
    background: color-mix(in oklch, var(--male) 12%, transparent);
    color: var(--male);
  }
  &.female {
    background: color-mix(in oklch, var(--female) 12%, transparent);
    color: var(--female);
  }
  &.unisex {
    background: color-mix(in oklch, var(--unisex) 12%, transparent);
    color: var(--unisex);
  }
}

/* Dropzone */
.dz {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 1.1rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.83rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 0.9rem;
  position: relative;

  &:hover,
  &.over {
    border-color: var(--gold);
    color: var(--gold);
    background: color-mix(in oklch, var(--gold) 2%, transparent);
  }

  & input[type="file"] {
    display: none;
  }
  & .prev {
    max-width: 100%;
    max-height: 130px;
    border-radius: 6px;
    margin-top: 0.4rem;
    display: block;
    margin-inline: auto;
    &[hidden] {
      display: none;
    }
  }

  & .clr {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 13px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    display: none;
  }

  &:has(.prev:not([hidden])) .clr {
    display: block;
  }
}

/* Section headings */
.sec-title,
.dash-s h3 {
  font-family: "Space Mono", monospace;
  color: var(--gold);
  text-wrap: balance;
}

.sec-title {
  font-size: 0.95rem;
  margin-bottom: 0.9rem;
}
.sec-sub {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin: 1.1rem 0 0.65rem;
  text-wrap: balance;
}
.dash-s h3 {
  font-size: 0.86rem;
  margin-bottom: 0.5rem;
}

/* Dashboard */
.dash-s {
  margin-bottom: 1.4rem;
}
.dash-hint {
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-bottom: 0.45rem;
  font-style: italic;
}

.dash-i {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: var(--surface);
  border-radius: 8px;
  margin-bottom: 0.3rem;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid var(--pink);

  &:hover {
    background: var(--surface2);
  }
  & .ic {
    font-size: 1rem;
    flex-shrink: 0;
  }

  & .tx {
    flex: 1;
    min-width: 0;
    font-size: 0.88rem;

    & small {
      color: var(--text-dim);
      font-size: 0.76rem;
    }
  }
}

.dash-em {
  color: var(--text-dim);
  font-size: 0.86rem;
  padding: 0.4rem 0;
}
.dash-recent {
  border-left-color: var(--surface3);
}

/* Lightbox */
.lb {
  position: fixed;
  inset: 0;
  background: oklch(0 0 0 / 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  cursor: pointer;
  animation: fi 0.15s;

  & img {
    max-width: 94vw;
    max-height: 92dvh;
    border-radius: 8px;
  }
}

/* Finance */
.add-box {
  background: var(--surface);
  border-radius: 10px;
  padding: 0.8rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.add-box-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0.45rem;
}

.bar-i {
  margin-bottom: 0.9rem;
}
.bar-h {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 3px;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.2rem;
}
.bar-t {
  background: var(--input-bg);
  border-radius: 4px;
  height: 16px;
  overflow: hidden;
}

.bar-f {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s;

  &.pos {
    background: var(--teal);
  }
  &.neg {
    background: var(--pink);
  }
}

.pp-link {
  font-size: 0.76rem;
  color: var(--teal);
  text-decoration: none;
  margin-left: 0.25rem;

  &:hover {
    text-decoration: underline;
  }
}

.empty {
  text-align: center;
  padding: 2.2rem 1rem;
  color: var(--text-dim);
  font-size: 0.9rem;

  & .icon {
    font-size: 1.8rem;
    margin-bottom: 0.4rem;
  }
}

.card.fh {
  display: none;
}

#songL:has(.card) ~ #songE,
#cosL:has(.card:not(.fh)) ~ #cosE,
#slL:has(.card) ~ #slE,
#pastL:has(.card) ~ #pastE {
  display: none;
}

#songL:not(:has(.card)) ~ #songE,
#cosL:not(:has(.card:not(.fh))) ~ #cosE,
#slL:not(:has(.card)) ~ #slE,
#pastL:not(:has(.card)) ~ #pastE {
  display: block;
}

@container (max-width: 400px) {
  .card-top {
    flex-direction: column;
  }
  .user-row {
    font-size: 0.8rem;
  }
  .irow {
    flex-direction: column;
  }
}
