:root {
  color-scheme: dark;
  --black: #100f0e;
  --shell: #151412;
  --panel: #191816;
  --cell: #1d1b19;
  --edge: #3e3934;
  --paper: #f2ede4;
  --quiet: #c4bbb0;
  --accent: #ff563e;
  --past: #b7b1a9;
  --press-ease: cubic-bezier(.23, 1, .32, 1);
  font-family: system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--black); color: var(--paper); }
button, input, select { font: inherit; }
button {
  min-height: 44px; padding: 0 12px; cursor: pointer; border: 1px solid var(--edge); border-radius: 8px;
  background: #272421; color: var(--paper); touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: transform 130ms var(--press-ease), background-color 130ms ease, border-color 130ms ease;
}
button:active:not(:disabled) { transform: scale(.97); }
:where(button, input, select):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; z-index: 1; }
button:disabled { cursor: default; opacity: .55; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }

.top {
  min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: max(10px, env(safe-area-inset-top)) max(3vw, env(safe-area-inset-right)) 10px max(3vw, env(safe-area-inset-left));
  background: var(--shell); border-bottom: 1px solid #302c28;
}
.brand, #account-actions { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand img { display: block; object-fit: contain; }
.brand span { padding-left: 14px; border-left: 1px solid var(--edge); }
.top span { color: var(--quiet); font-size: .81rem; }
.sign-out { background: transparent; }

main {
  max-width: 1520px; margin: auto;
  padding: clamp(20px,3vw,42px) max(3vw, env(safe-area-inset-right)) max(36px, env(safe-area-inset-bottom)) max(3vw, env(safe-area-inset-left));
}
h1 { font-size: clamp(2.15rem, 4vw, 4rem); font-weight: 850; line-height: 1; letter-spacing: -.07em; }
#title { margin-bottom: clamp(16px,2vw,29px); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(245px, 23%); align-items: start; gap: 16px; }
.calendar, .events { min-width: 0; border: 1px solid var(--edge); border-radius: 14px; background: var(--panel); }

.calendar-header, .toolbar {
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  padding: 15px clamp(12px, 1.7vw, 24px);
}
.calendar-header { border-top: 3px solid var(--accent); border-radius: 13px 13px 0 0; }
.month-navigation { display: flex; flex-wrap: wrap; gap: 8px 17px; align-items: center; min-width: 0; }
#month { font-size: clamp(1.2rem, 2.3vw, 2rem); letter-spacing: -.045em; }
#month::first-letter { text-transform: uppercase; }
.pagination { display: flex; gap: 3px; align-items: center; }
.pagination button { border-color: transparent; background: transparent; font-weight: 650; }
.pagination #prev, .pagination #next { min-width: 44px; padding: 0; font-size: 1.5rem; line-height: 1; }
.primary { padding: 0 15px; background: var(--accent); color: #140d0a; border: 1px solid transparent; font-weight: 800; white-space: nowrap; }
#add { display: flex; align-items: center; justify-content: center; gap: 5px; }
#add span { font-size: 1.22rem; line-height: 1; }

.toolbar { flex-wrap: wrap; border-top: 1px solid #322e2a; padding-block: 9px; }
.artist-filters { display: flex; flex-wrap: wrap; gap: 4px; }
.artist-filters button { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; background: transparent; border-color: transparent; font-size: .76rem; font-weight: 750; }
.artist-filters button[aria-pressed="true"] { background: #302c28; border-color: #514b45; }
[data-artist="DAITX"] { --artist: #38e895; }
[data-artist="LAUX"] { --artist: #ff7855; }
[data-artist="SXBRINHX"] { --artist: #b780ff; }
[data-artist="XAN"] { --artist: #42bdff; }
[data-artist="DJ PEMO"] { --artist: #ff69bd; }
.artist-filters [data-artist]::before, .legend-past {
  content: ""; width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--artist, var(--past));
}
.status-filter { display: flex; align-items: center; gap: 7px; }
.status-filter select { width: auto; }

.week, .days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.week {
  background: #201e1b; border-block: 1px solid var(--edge); text-align: center; color: var(--quiet);
  padding-block: 9px; font-size: .69rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em;
}
.days { gap: 1px; background: var(--edge); }
.day-cell {
  min-width: 0; min-height: clamp(82px, 6.8vw, 104px); padding: 5px; background: var(--cell);
  display: flex; flex-direction: column; align-items: stretch; gap: 4px;
}
.day-cell.outside { background: #171614; }
.day-cell.is-past { background: #1a1917; }
.day-cell.is-selected { box-shadow: inset 0 0 0 1px var(--accent); background: #29201c; }
.day-number {
  display: grid; place-items: center; justify-self: start; align-self: flex-start; min-width: 44px;
  padding: 0; border: 0; background: transparent; color: var(--paper); font-size: .87rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.day-cell.is-past .day-number { color: var(--past); }
.day-number[aria-current="date"] { color: #1a0d09; background: var(--accent); }
.day-event, .day-more {
  min-width: 0; min-height: 34px; display: grid; text-align: start; align-content: center; gap: 1px;
  padding: 4px 6px; border-radius: 6px; font-size: .7rem; line-height: 1.16;
}
.day-event {
  --event-color: var(--artist, var(--past));
  color: var(--event-color); background: color-mix(in srgb, var(--event-color) 15%, #1b1917);
  border: 1px solid color-mix(in srgb, var(--event-color) 42%, #1b1917); border-left: 3px solid var(--event-color);
}
.day-event.is-past { --event-color: var(--past); }
.day-event.is-tentative { border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; }
.day-event strong, .day-event span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-event span { color: var(--paper); opacity: .85; }
.day-more { justify-content: start; border-color: transparent; color: var(--quiet); background: transparent; }
.calendar-legend {
  display: flex; align-items: center; gap: 7px; border-top: 1px solid var(--edge); padding: 11px 16px;
  color: var(--quiet); font-size: .73rem;
}

.events { padding: clamp(13px, 1.5vw, 20px); }
.events-header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.events-header h2 { font-size: 1.06rem; font-weight: 800; letter-spacing: -.028em; }
.counter { flex-shrink: 0; color: var(--quiet); font-size: .75rem; font-variant-numeric: tabular-nums; }
.subtle { margin-top: 10px; color: var(--quiet); background: transparent; }
#events { display: grid; gap: 9px; padding: 0; margin: 13px 0 0; list-style: none; }
.event {
  --event-color: var(--artist, var(--past));
  display: grid; width: 100%; min-width: 0; grid-template-columns: 2.6rem minmax(0, 1fr);
  padding: 9px; align-items: center; gap: 10px; text-align: left; background: #24211f;
}
.event.is-past { --event-color: var(--past); }
.date { display: grid; place-items: center; color: var(--event-color); border-right: 1px solid var(--edge); padding-right: 6px; }
.date strong { font-size: 1.4rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.date small { text-transform: uppercase; font-size: .62rem; }
.event-details { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; font-size: .83rem; }
.event-details small { color: var(--quiet); }
.event-details .event-artist { color: var(--event-color); font-weight: 750; }
.event-details .status { width: fit-content; border-radius: 4px; padding: 2px 5px; background: #392b22; color: #ffd5a2; }
.event-details .confirmado { background: #26392d; color: #c2ebcc; }
.event.is-past .status { color: var(--past); background: #33302c; }
#empty { color: var(--quiet); font-size: .84rem; padding: 6px 0 9px; }

.section-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.section-head h2 { font-size: 1.45rem; letter-spacing: -.04em; }
.fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
label { display: grid; gap: 5px; color: var(--quiet); font-size: .82rem; }
select, input { min-width: 0; width: 100%; min-height: 44px; border: 1px solid var(--edge); border-radius: 8px; padding: 8px; background: #211f1d; color: var(--paper); font-size: 1rem; }
dialog {
  color: var(--paper); background: var(--panel); border: 1px solid var(--edge); border-radius: 14px;
  padding: 20px; width: min(500px, calc(100% - 26px)); max-height: calc(100dvh - 28px); overscroll-behavior-y: contain;
}
dialog::backdrop { background: #000b; }
form { display: grid; gap: 12px; }
.feedback { margin-top: 12px; color: var(--quiet); }
.error { font-size: .85rem; color: #ffb3a7; }
.auth-panel { max-width: 410px; margin: 3vh auto; }
.auth-panel h1 { font-size: clamp(2.7rem, 8vw, 4.3rem); }
.auth-panel > p { margin: 15px 0 22px; color: var(--quiet); }

@media (hover: hover) and (pointer: fine) {
  button:hover:not(:disabled) { background-color: #39332d; }
  .primary:hover:not(:disabled) { background-color: #ff7663; }
  .day-number[aria-current="date"]:hover:not(:disabled) { background-color: #ff7663; }
  .day-event:hover:not(:disabled), .event:hover:not(:disabled) { border-color: var(--event-color); }
}
@media (max-width: 1060px) {
  .layout { grid-template-columns: minmax(0,1fr); }
  #events { grid-template-columns: repeat(auto-fit, minmax(min(100%, 225px), 1fr)); }
}
/* Full details stay in the list; the mobile month is an overview. */
.mobile-artist-filter, .mobile-legend, .day-indicators, .day-count { display: none; }
.desktop-legend { display: flex; align-items: center; gap: 7px; }
@media (max-width: 620px) {
  main { padding: 20px 12px 32px; }
  .top { min-height: 60px; padding: 8px 12px; gap: 8px; }
  .brand img { width: 76px; height: 35px; }
  .brand span { display: none; }
  #account-actions { gap: 8px; }
  #account { font-size: 12px; max-width: 145px; overflow-wrap: anywhere; }
  .sign-out { padding-inline: 10px; }
  #title { font-size: 28px; letter-spacing: -.045em; margin-bottom: 16px; }
  .calendar, .events { border-radius: 12px; }
  .calendar-header { display: grid; gap: 12px; padding: 12px; }
  .month-navigation { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px; width: 100%; }
  #month { font-size: 18px; letter-spacing: -.035em; line-height: 1.25; }
  .pagination { gap: 0; }
  .pagination #prev, .pagination #next { min-width: 36px; }
  .pagination #today { padding-inline: 6px; font-size: 13px; }
  #add { width: 100%; min-height: 44px; font-size: 14px; }
  .toolbar { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(0,1fr); gap: 10px; padding: 12px; }
  .artist-filters { display: none; }
  .mobile-artist-filter { display: grid; }
  .status-filter { display: grid; gap: 5px; }
  .status-filter select, .mobile-artist-filter select { width: 100%; font-size: 16px; min-height: 44px; padding: 8px; }
  .toolbar label { font-size: 12px; }
  .week { font-size: 10px; letter-spacing: .02em; padding-block: 10px; background: transparent; }
  .day-cell { gap: 0; min-height: 64px; padding: 0; position: relative; }
  .day-cell .day-number { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 5px; width: 100%; min-width: 0; min-height: 64px; padding: 7px 0 5px; font-size: 14px; border-radius: 0; }
  .day-number[aria-current="date"] { background: #38241e; color: #ff9b87; box-shadow: inset 0 2px var(--accent); }
  .day-cell.is-selected { box-shadow: inset 0 0 0 2px var(--accent); background: #39271f; }
  .day-cell.is-selected .day-number { box-shadow: inset 0 0 0 2px var(--accent); }
  .day-cell .day-event, .day-cell .day-more { display: none; }
  .day-count { display: block; font-size: 10px; line-height: 12px; color: var(--quiet); font-weight: 500; }
  .day-indicators { display: flex; justify-content: center; gap: 3px; height: 4px; }
  .day-dot { display: block; width: 4px; height: 4px; border-radius: 50%; background: var(--artist); }
  .is-past .day-dot { background: var(--past); }
  .calendar-legend { font-size: 11px; padding: 10px 12px; }
  .desktop-legend { display: none; }
  .mobile-legend { display: block; }
  .layout { gap: 16px; }
  .events { padding: 14px 12px; }
  .events-header h2 { font-size: 17px; }
  #events { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .event { padding: 12px 10px; gap: 12px; border-left: 3px solid var(--event-color); }
  .event-details { font-size: 14px; gap: 6px; line-height: 1.35; }
  .event-details small { font-size: 12px; }
  .event-details .event-artist { font-size: 11px; letter-spacing: .04em; }
  dialog { padding: 16px; max-height: calc(100dvh - 24px); overflow-y: auto; }
  .section-head h2 { font-size: 22px; }
  .test-banner { padding: 7px 12px; font-size: 10px; line-height: 1.4; }
}
@media (max-width: 359px) {
  #month { font-size: 16px; }
  .pagination #prev, .pagination #next { min-width: 30px; }
  .pagination #today { font-size: 12px; }
  .fields { grid-template-columns: minmax(0,1fr); }
}
@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
  button:active:not(:disabled) { transform: none; }
}

.test-banner { padding: 10px; text-align: center; background: #f5c64e; color: #201b0c; font-weight: 750; font-size: .8rem; }
.day-cell.drop-target { outline: 2px solid #f5c64e; outline-offset: -2px; background: #3a3320; }
[draggable="true"] { cursor: grab; }
[draggable="true"]:active { cursor: grabbing; }

@media (max-width:620px) { .test-banner { padding: 7px 12px; font-size: 10px; line-height: 1.4; } }

/* Header and account alignment, shared by mobile and desktop. */
.top { justify-content: center; min-height: 96px; }
.brand { justify-content: center; }
.brand img { width: 144px; height: 66px; }
.agenda-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: clamp(16px,2vw,29px); }
.agenda-heading #title { margin: 0; }
#account-actions { margin-left: auto; justify-content: flex-end; }
#account { color: var(--quiet); font-size: 13px; line-height: 1.3; text-align: right; }
@media (max-width:620px) {
  .top { min-height: 88px; padding: 10px 12px; }
  .brand img { width: 134px; height: 62px; }
  .agenda-heading { gap: 8px; margin-bottom: 16px; }
  #account-actions { gap: 8px; }
  #account { font-size: 11px; max-width: 112px; }
  .sign-out { font-size: 12px; min-height: 44px; padding-inline: 10px; }
  .day-dot { width: 5px; height: 5px; }
}

/* Native date/time controls in iOS must fit their grid tracks. */
.fields > label { min-width: 0; }
#event-form input, #event-form select { box-sizing: border-box; max-width: 100%; }
@media (max-width: 620px) {
  #event-form .fields { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  #event-form input[type="date"], #event-form input[type="time"] {
    display: block; width: 100%; min-width: 0; min-height: 46px;
    -webkit-appearance: none; appearance: none; text-align: left;
  }
  #event-form input::-webkit-date-and-time-value { min-height: 1.5em; text-align: left; }
  #event-form input::-webkit-datetime-edit { padding: 0; }
}

/* Separate the public entry from account activation. */
#visitor-enter { margin-top: 24px; width: 100%; }

/* Show ten complete dates, then scroll inside the list at every screen size. */
#events { grid-template-columns: minmax(0, 1fr); overflow-y: auto; scrollbar-gutter: stable; align-content: start; }
