:root {
  --club-red: #e11b22;
  --club-red-dark: #a80c12;
  --club-blue: #516988;
  --club-ink: #1d2530;
  --club-muted: #677286;
  --club-line: rgba(81, 105, 136, 0.18);
  --club-bg: #f5f5f5;
  --club-panel: rgba(255, 255, 255, 0.96);
  --club-shadow: 0 14px 36px rgba(38, 49, 65, 0.1);
  --club-radius: 22px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--club-ink);
  background: var(--club-bg);
}

button,
input,
select,
table {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100vw - 24px));
  margin: 12px auto 28px;
  position: relative;
}

.topbar,
.inactive-state,
.system-notice,
.capture-panel,
.live-panel,
.modal__dialog {
  background: var(--club-panel);
  border: 1px solid var(--club-line);
  border-radius: var(--club-radius);
  box-shadow: var(--club-shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.topbar__left,
.topbar__left > div,
.capture-panel__header,
.live-panel__header,
.modal__header,
.modal__header-actions,
.person-summary,
.action-grid,
.admin-actions,
.upload-actions,
.admin-panel__header,
.admin-users__header {
  display: flex;
  gap: 12px;
}

.topbar__left {
  align-items: center;
}

.topbar__eyebrow,
.section-kicker,
.field-label,
.selection-card__label,
.summary-card span,
.admin-summary dt,
.admin-user-list span,
.login-form span,
.admin-user-form span,
.edit-form span,
thead th {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--club-blue);
}

.topbar h1,
.inactive-state h2,
.capture-panel h2,
.live-panel h2,
.modal__header h2,
.upload-panel h3,
.admin-users h3 {
  margin: 0;
  letter-spacing: -0.04em;
}

.topbar h1 {
  font-size: clamp(26px, 4vw, 38px);
}

.status-chip,
.mini-chip,
.menu-sheet__item {
  min-height: 42px;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.status-chip,
.mini-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(81, 105, 136, 0.1);
  color: var(--club-blue);
  border: 1px solid rgba(81, 105, 136, 0.14);
}

.icon-button,
.icon-ghost-button,
.primary-button,
.secondary-button,
.ghost-button,
.menu-sheet__item {
  appearance: none;
  border: none;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    opacity 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.icon-button,
.icon-ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(81, 105, 136, 0.14);
}

.icon-button span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 2px 0;
  background: var(--club-ink);
  border-radius: 999px;
}

.icon-button {
  flex-direction: column;
}

.icon-ghost-button {
  font-size: 20px;
  color: var(--club-blue);
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 16px;
  font-weight: 800;
}

.primary-button {
  background: var(--club-red);
  color: #fff;
  box-shadow: 0 12px 22px rgba(225, 27, 34, 0.16);
}

.secondary-button,
.ghost-button,
.menu-sheet__item {
  background: #fff;
  color: var(--club-ink);
  border: 1px solid rgba(81, 105, 136, 0.18);
}

.ghost-button--danger {
  color: var(--club-red-dark);
  border-color: rgba(225, 27, 34, 0.24);
}

.icon-button:hover,
.icon-ghost-button:hover,
.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.menu-sheet__item:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  box-shadow: none;
}

.menu-sheet {
  position: absolute;
  top: 72px;
  left: 0;
  z-index: 20;
  display: grid;
  gap: 8px;
  width: min(260px, calc(100vw - 24px));
  padding: 12px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--club-line);
  border-radius: 20px;
  box-shadow: var(--club-shadow);
}

.menu-sheet__item {
  text-align: left;
}

.page-shell {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.inactive-state,
.system-notice,
.capture-panel,
.live-panel {
  padding: 24px;
}

.system-notice {
  border-color: rgba(225, 27, 34, 0.24);
  background: #fff7f7;
}

.system-notice h2 {
  color: var(--club-red-dark);
}

.inactive-state p,
.modal__subtext,
.modal__hint,
.active-meta {
  color: var(--club-muted);
  line-height: 1.5;
}

.search-box {
  position: relative;
}

.search-input,
.login-form input,
.admin-user-form input,
.admin-user-form select,
.edit-form input,
input[type="file"] {
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(81, 105, 136, 0.18);
  background: #fff;
  color: var(--club-ink);
}

.search-input {
  min-height: 118px;
  padding: 0 24px;
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.login-form input,
.admin-user-form input,
.admin-user-form select,
.edit-form input,
input[type="file"] {
  min-height: 52px;
  padding: 0 14px;
}

input[type="file"] {
  padding-top: 12px;
}

.search-input:focus,
.login-form input:focus,
.admin-user-form input:focus,
.admin-user-form select:focus,
.edit-form input:focus,
input[type="file"]:focus {
  outline: none;
  border-color: rgba(225, 27, 34, 0.45);
  box-shadow: 0 0 0 4px rgba(225, 27, 34, 0.08);
}

.search-results {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  display: none;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border: 1px solid rgba(81, 105, 136, 0.18);
  border-radius: 20px;
  box-shadow: 0 18px 36px rgba(33, 43, 56, 0.12);
  z-index: 10;
}

.search-results.is-open {
  display: grid;
}

.result-button,
.active-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(81, 105, 136, 0.12);
  background: #fff;
}

.result-button {
  cursor: pointer;
  text-align: left;
}

.result-button:hover,
.active-item:hover {
  border-color: rgba(225, 27, 34, 0.18);
  background: #fff7f7;
}

.result-button strong,
.active-name {
  display: block;
  font-size: 20px;
  font-weight: 900;
}

.result-button small,
.active-meta {
  display: block;
}

.pill,
.active-time,
.table-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.pill,
.table-tag {
  background: rgba(81, 105, 136, 0.1);
  color: var(--club-blue);
}

.pill--guest,
.table-tag.is-guest,
.active-time.is-paused {
  background: rgba(225, 27, 34, 0.08);
  color: var(--club-red-dark);
}

.active-list,
.admin-user-list {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.history-list {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.active-empty,
.empty-row td {
  color: var(--club-muted);
  text-align: center;
}

.active-empty {
  padding: 20px;
  background: #fff;
  border: 1px solid rgba(81, 105, 136, 0.12);
  border-radius: 18px;
}

.active-time {
  background: rgba(81, 105, 136, 0.1);
  color: var(--club-blue);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(245, 245, 245, 0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal__dialog {
  position: relative;
  width: min(980px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  margin: 12px auto;
  padding: 22px;
}

.modal__dialog--person {
  width: min(900px, calc(100vw - 24px));
}

.modal__dialog--users {
  width: min(820px, calc(100vw - 24px));
}

.modal__header,
.admin-panel__header,
.capture-panel__header,
.live-panel__header {
  align-items: center;
  justify-content: space-between;
}

.modal__subtext,
.modal__hint {
  margin: 8px 0 0;
}

.person-summary {
  flex-wrap: wrap;
  margin-top: 18px;
}

.summary-card {
  min-width: 150px;
  flex: 1 1 150px;
  padding: 16px;
  background: #fff;
  border: 1px solid rgba(81, 105, 136, 0.12);
  border-radius: 18px;
}

.summary-card strong {
  display: block;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.05em;
}

.action-stage {
  margin-top: 22px;
}

.hero-action {
  width: 100%;
  min-height: 74px;
  border-radius: 20px;
  border: none;
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 900;
  letter-spacing: -0.04em;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}

.hero-action:hover:not(:disabled) {
  transform: translateY(-1px);
}

.hero-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hero-action--start {
  background: var(--club-red);
  color: #fff;
  box-shadow: 0 14px 26px rgba(225, 27, 34, 0.18);
}

.hero-action--stop {
  background: var(--club-ink);
  color: #fff;
  box-shadow: 0 14px 26px rgba(29, 37, 48, 0.16);
}

.sub-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.edit-form {
  margin-top: 18px;
  padding: 18px;
  background: #f8f8f8;
  border: 1px solid rgba(81, 105, 136, 0.12);
  border-radius: 18px;
}

.edit-form__grid,
.login-form,
.admin-user-form {
  display: grid;
  gap: 14px;
}

.edit-form__grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.edit-form__actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.login-form,
.admin-user-form {
  margin-top: 16px;
}

.admin-panel {
  margin-top: 18px;
}

.admin-actions,
.upload-actions {
  flex-wrap: wrap;
  margin-top: 16px;
}

.admin-actions--tight {
  margin-top: 8px;
}

.upload-panel {
  margin-top: 20px;
  padding: 18px;
  background: #f8f8f8;
  border: 1px solid rgba(81, 105, 136, 0.12);
  border-radius: 18px;
}

.upload-panel--danger {
  background: #fcf7f7;
}

.upload-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-inline-note {
  margin: 10px 0 0;
  color: var(--club-muted);
  line-height: 1.5;
}

.admin-inline-note a {
  color: var(--club-red-dark);
  font-weight: 800;
  text-decoration: none;
}

.admin-inline-note a:hover {
  text-decoration: underline;
}

.inline-status {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  font-weight: 700;
  line-height: 1.45;
  background: rgba(81, 105, 136, 0.1);
  color: var(--club-blue);
  border: 1px solid rgba(81, 105, 136, 0.16);
}

.inline-status.is-error {
  background: rgba(225, 27, 34, 0.08);
  color: var(--club-red-dark);
  border-color: rgba(225, 27, 34, 0.18);
}

.inline-status.is-success {
  background: rgba(81, 105, 136, 0.1);
  color: var(--club-blue);
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 0;
}

.admin-summary div {
  padding: 16px;
  background: #fff;
  border: 1px solid rgba(81, 105, 136, 0.12);
  border-radius: 18px;
}

.admin-summary dd {
  margin: 0;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.05em;
}

.dropzone {
  display: block;
  margin-top: 16px;
  padding: 26px 22px;
  border: 2px dashed rgba(81, 105, 136, 0.24);
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: rgba(225, 27, 34, 0.32);
  background: #fff8f8;
  transform: translateY(-1px);
}

.dropzone input {
  display: none;
}

.dropzone__title {
  display: block;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.dropzone__text {
  display: block;
  margin-top: 8px;
  color: var(--club-muted);
  line-height: 1.5;
}

.admin-user-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid rgba(81, 105, 136, 0.12);
  border-radius: 16px;
}

.history-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid rgba(81, 105, 136, 0.12);
  border-radius: 16px;
}

.history-item-meta {
  color: var(--club-muted);
  font-size: 14px;
  line-height: 1.5;
}

.history-item-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.admin-user-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-user-actions select {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid rgba(81, 105, 136, 0.18);
  background: #fff;
}

.table-shell {
  margin-top: 18px;
  max-height: 62vh;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(81, 105, 136, 0.12);
  background: #fff;
}

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

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 16px 18px;
  background: #f3f4f6;
}

tbody td {
  padding: 18px;
  border-top: 1px solid rgba(81, 105, 136, 0.1);
  font-size: 16px;
  font-weight: 700;
}

.table-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 24px));
  z-index: 80;
}

.toast {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(29, 37, 48, 0.96);
  color: #fff;
  box-shadow: 0 14px 24px rgba(34, 43, 56, 0.14);
  font-weight: 700;
  line-height: 1.45;
}

.toast.is-error {
  background: rgba(168, 12, 18, 0.96);
}

.toast.is-success {
  background: rgba(81, 105, 136, 0.96);
}

@media (max-width: 860px) {
  .topbar,
  .topbar__left,
  .capture-panel__header,
  .live-panel__header,
  .modal__header,
  .modal__header-actions,
  .admin-panel__header,
  .edit-form__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .edit-form__grid,
  .admin-summary {
    grid-template-columns: 1fr;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .hero-action {
    width: 100%;
  }

  .search-input {
    min-height: 92px;
    font-size: clamp(24px, 8vw, 36px);
  }

  .result-button,
  .active-item,
  .admin-user-list li,
  .admin-user-actions,
  .history-list li,
  .history-item-actions {
    flex-direction: column;
    align-items: flex-start;
  }
}
