:root {
  color-scheme: dark;
  --background: #191718;
  --surface: #231f20;
  --surface-light: #2d2829;
  --gold: #b5a16a;
  --gold-light: #d4c28e;
  --text: #f5f2eb;
  --muted: #bbb5ad;
  --border: rgba(181, 161, 106, .22);
  --green: #9bd0a9;
  --red: #eeaaaa;
  --rehearsal: #c9b778;
  --performance: #f2a16c;
  --festival: #78c8e0;
  --meeting: #b9a0e0;
  --other: #b9bbc3;
  font-family: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  line-height: 1.5;
}

body.modal-open { overflow: hidden; }
[hidden] { display: none !important; }

.svg-library {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

button:focus-visible, a:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--gold-light);
  outline-offset: 3px;
}

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.2; }

.icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-width {
  width: min(900px, calc(100% - 32px));
  margin-inline: auto;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: rgba(25, 23, 24, .97);
}

.header-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; }
.brand span {
  color: var(--gold-light);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .13em;
}

.role-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.role-selector select { width: auto; min-height: 40px; padding: 8px 10px; }

.app-main {
  padding-top: 20px;
  padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px));
}

.demo-banner, .notice {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(181, 161, 106, .06);
  color: var(--gold-light);
  font-size: 11px;
  margin-bottom: 24px;
}

.notice { font-size: 13px; }

.welcome {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 26px;
}

.avatar {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(181, 161, 106, .1);
  color: var(--gold-light);
}

.avatar .icon { width: 28px; height: 28px; }

.eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--gold-light);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.welcome h1, .page-heading h1 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 36px;
  font-weight: 400;
}

.page-heading { margin-bottom: 24px; }
.page-heading p { margin: 12px 0 0; color: var(--muted); font-size: 14px; }

.heading-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 14px;
}

.section-title h2 { margin: 0; font-size: 17px; }

.text-button {
  min-height: 44px;
  padding: 8px;
  border: 0;
  background: transparent;
  color: var(--gold-light);
  font-size: 12px;
}

.card-list { display: grid; gap: 12px; }

.panel, .event-card, .quota-card, .calendar-card, .event-widget, .shortcut-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.event-widget {
  position: relative;
  overflow: hidden;
  padding: 24px;
  margin-bottom: 16px;
}

.event-widget::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--event-color);
  content: "";
}

.event-widget-header { display: flex; align-items: flex-start; gap: 14px; }

.type-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--background);
  color: var(--event-color);
  font-size: 24px;
}

.event-widget-header > div { min-width: 0; flex: 1; }
.widget-kicker { color: var(--event-color); font-size: 11px; font-weight: 700; }
.event-widget h2 { margin: 8px 0 10px; font-size: 24px; overflow-wrap: anywhere; }

.type-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--event-color);
  font-size: 11px;
}

.type-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--event-color);
}

.event-description {
  margin: 18px 0;
  color: var(--muted);
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.widget-details {
  display: grid;
  gap: 14px;
  margin: 20px 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.widget-detail { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; }
.widget-detail .icon { width: 18px; height: 18px; color: var(--muted); }
.widget-detail span { overflow-wrap: anywhere; }

.response-title { margin: 18px 0 12px; font-size: 13px; }
.response-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

.response-button {
  min-height: 65px;
  padding: 10px 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
}

.response-button strong { display: block; font-size: 12px; }
.response-button span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }

.response-button[aria-pressed="true"] {
  border-color: var(--gold);
  background: rgba(181, 161, 106, .15);
  color: var(--gold-light);
}

.response-status { margin: 12px 0 0; color: var(--muted); font-size: 11px; }

.shortcut-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  margin-bottom: 14px;
  color: var(--text);
  text-align: left;
}

.shortcut-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 12px;
  background: rgba(181, 161, 106, .1);
  color: var(--gold-light);
}

.shortcut-copy { min-width: 0; flex: 1; }
.shortcut-copy > span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.shortcut-copy strong { display: block; font-size: 15px; }
.arrow { width: 18px; color: var(--muted); }

.is-danger { border-color: rgba(238, 170, 170, .45); }
.is-danger .shortcut-icon { color: var(--red); background: rgba(238, 170, 170, .1); }
.is-danger .shortcut-copy strong { color: var(--red); }

.is-success { border-color: rgba(155, 208, 169, .35); }
.is-success .shortcut-icon { color: var(--green); background: rgba(155, 208, 169, .1); }
.is-success .shortcut-copy strong { color: var(--green); }

.event-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-left: 4px solid var(--event-color);
  color: var(--text);
  text-align: left;
}

.event-card:hover, .shortcut-card:hover { background: var(--surface-light); }

.event-date-block {
  width: 50px;
  min-height: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--background);
  color: var(--event-color);
}

.event-date-block strong { font-size: 24px; line-height: 1.2; }
.event-date-block span { font-size: 10px; text-transform: uppercase; }
.event-card-copy { min-width: 0; flex: 1; }
.event-card-copy h3 { margin: 5px 0; font-size: 15px; overflow-wrap: anywhere; }
.event-card-copy p { margin-bottom: 7px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }

.badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(181, 161, 106, .1);
  color: var(--gold-light);
  font-size: 10px;
}

.badge.yes, .badge.paid { background: rgba(155, 208, 169, .1); color: var(--green); }
.badge.no, .badge.overdue { background: rgba(238, 170, 170, .1); color: var(--red); }

.empty-state {
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.button-gold { background: var(--gold); color: var(--background); }
.button-gold:hover { background: var(--gold-light); }
.button-outline { border-color: var(--border); background: transparent; color: var(--text); }
.button-small { min-height: 44px; padding: 8px 14px; font-size: 12px; }

.calendar-card { padding: 18px 10px 8px; }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 18px; }
.calendar-toolbar h2 { margin: 0; font-size: 16px; text-transform: capitalize; }

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--gold-light);
  font-size: 28px;
}

.calendar-weekdays, .calendar-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekdays { margin-bottom: 8px; color: var(--muted); font-size: 10px; text-align: center; }
.calendar-weekdays span { padding-block: 8px; }
.calendar-days { gap: 3px; }

.day {
  min-width: 0;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.day:hover { background: var(--surface-light); }
.day.is-today { border-color: var(--gold); }
.day.is-selected { background: rgba(181, 161, 106, .2); color: var(--gold-light); font-weight: 700; }

.day-markers {
  min-height: 6px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
  max-width: 30px;
}

.day-markers i { width: 5px; height: 5px; border-radius: 50%; background: var(--event-color); }

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 18px;
  padding: 16px 4px;
  border-top: 1px solid var(--border);
}

.legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }

.calendar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px;
}

.quota-summary { padding: 24px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.quota-summary span { color: var(--muted); font-size: 12px; }
.quota-summary strong { display: block; margin: 8px 0; font-size: 26px; }
.quota-summary p { margin: 0; color: var(--muted); font-size: 13px; }
.quota-summary.is-danger strong { color: var(--red); }
.quota-summary.is-success strong { color: var(--green); }

.quota-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px; }
.quota-card h3 { margin-bottom: 5px; font-size: 14px; text-transform: capitalize; }
.quota-card p { margin: 0; color: var(--muted); font-size: 11px; }
.quota-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.quota-actions .text-button { font-size: 11px; }

.panel { padding: 22px; }
.profile-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.profile-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.profile-identity h2 { margin-bottom: 8px; font-size: 17px; overflow-wrap: anywhere; }
.profile-identity .avatar { width: 46px; height: 46px; }
.profile-details { margin: 24px 0 0; }
.profile-details > div { padding: 16px 0; border-top: 1px solid var(--border); }
.profile-details dt { margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.profile-details dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }

.form-grid { display: grid; gap: 18px; }
.form-grid label { min-width: 0; display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 12px; }

input, select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--background);
  color: var(--text);
}

textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.exit-button { width: 100%; margin-top: 20px; }

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-top: 1px solid var(--border);
  background: rgba(35, 31, 32, .98);
  backdrop-filter: blur(16px);
}

.bottom-nav-inner {
  width: min(600px, 100%);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-inline: auto;
  padding: 8px 10px;
}

.nav-item {
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 2px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
}

.nav-item span { font-size: 10px; }
.nav-item.is-active { background: rgba(181, 161, 106, .1); color: var(--gold-light); }

.app-dialog {
  width: min(520px, calc(100% - 28px));
  max-height: calc(100dvh - 40px);
  padding: 0;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
}

.app-dialog::backdrop { background: rgba(0, 0, 0, .78); }
.dialog-inner { position: relative; padding: 40px 22px 24px; }
.dialog-inner > h2 { margin-bottom: 20px; font-size: 25px; overflow-wrap: anywhere; }

.dialog-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
}

.admin-note {
  margin-top: 24px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  left: 16px;
  z-index: 100;
  width: fit-content;
  max-width: calc(100% - 32px);
  margin-inline: auto;
  padding: 12px 18px;
  border: 1px solid var(--gold);
  border-radius: 12px;
  background: var(--surface-light);
  color: var(--gold-light);
  font-size: 13px;
  text-align: center;
}

@media (min-width: 700px) {
  .day { min-height: 72px; }
  .calendar-card { padding-inline: 24px; }
  .event-widget { padding: 30px; }
  .event-widget h2 { font-size: 30px; }
}

@media (max-width: 380px) {
  .role-selector > span { display: none; }
  .profile-identity .avatar { display: none; }
  .event-widget { padding: 20px 16px; }
  .event-widget h2 { font-size: 21px; }
  .form-row { grid-template-columns: 1fr; }
  .shortcut-card { padding: 16px; gap: 10px; }
}