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

/* CSS Variables for Theme */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --bg-tertiary: #ffffff;
  --text-primary: #333333;
  --text-secondary: #666666;
  --border-color: #e0e0e0;
  --shadow: rgba(0, 0, 0, 0.1);
  --hover-bg: #f5f5f5;
  --active-bg: #e3f2fd;
  --active-color: #2196F3;
  --member-reservation-late: #c62828;
  --member-reservation-started: #e65100;
}

[data-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-tertiary: #3a3a3a;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --border-color: #404040;
  --shadow: rgba(0, 0, 0, 0.3);
  --hover-bg: #3a3a3a;
  --active-bg: #2d4a5c;
  --active-color: #64b5f6;
  --member-reservation-late: #ff8a80;
  --member-reservation-started: #ffb74d;
}

.member-result-reservation--empty {
  color: var(--text-secondary);
}

.member-result-reservation--late {
  color: var(--member-reservation-late);
}

.member-result-reservation--started {
  color: var(--member-reservation-started);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Login Page */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
  background: var(--bg-primary);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 10px 25px var(--shadow);
  width: 100%;
  max-width: 400px;
  transition: background-color 0.3s ease;
}

.login-box h1 {
  text-align: center;
  margin-bottom: 2rem;
  color: var(--text-primary);
}

.login-box--with-version h1 {
  margin-bottom: 0.35rem;
}

.login-version {
  text-align: center;
  margin: 0 0 1.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  padding: 0.75rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.3s ease;
}

.tab-btn.active {
  color: var(--active-color);
  border-bottom-color: var(--active-color);
}

/* Settings Tab Content */
.settings-tab-content {
  padding: 1rem 0;
}

#settings-page .tabs {
  margin-bottom: 2rem;
}

.table-layout-shape-btn.active {
  background: var(--primary, #1976d2);
  color: #fff;
  border-color: var(--primary, #1976d2);
}

/* Table Layout resize handles (shown when table is selected) */
.room-layout-resize-handle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--primary, #1976d2);
  border: 1px solid var(--bg-primary);
  border-radius: 1px;
  pointer-events: auto;
  z-index: 2;
}
.room-layout-handle-se {
  bottom: 0;
  right: 0;
  cursor: nwse-resize;
}
.room-layout-handle-sw {
  bottom: 0;
  left: 0;
  cursor: nesw-resize;
}
.room-layout-handle-nw {
  top: 0;
  left: 0;
  cursor: nwse-resize;
}
.room-layout-handle-ne {
  top: 0;
  right: 0;
  cursor: nesw-resize;
}
.room-layout-handle-circle {
  right: 0;
  top: 50%;
  transform: translate(50%, -50%);
  cursor: ew-resize;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 1rem;
  min-height: 44px; /* touch-friendly */
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

/* Ensure readable font size on form controls (prevents iOS zoom, improves mobile readability) */
.form-group input,
.form-group select {
  font-size: max(1rem, 16px);
}
.form-group select option {
  font-size: inherit;
  padding: 0.5em;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--active-color);
}

.error-message {
  color: #d32f2f;
  background: #ffebee;
  padding: 0.75rem;
  border-radius: 4px;
  margin-top: 1rem;
}

[data-theme="dark"] .error-message {
  background: #4a1f1f;
  color: #ff6b6b;
}

.success-message {
  color: #2e7d32;
  background: #e8f5e9;
  padding: 0.75rem;
  border-radius: 4px;
  margin-top: 1rem;
}

[data-theme="dark"] .success-message {
  background: #1b3d1f;
  color: #81c784;
}

/* App Layout */
.app-header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.app-header h2 {
  color: var(--text-primary);
}

.header-content {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-company-name {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  justify-self: center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-self: end;
}

.header-user-menu-item:hover {
  background: var(--bg-secondary) !important;
}

.header-user-menu-item:focus {
  outline: none;
}

.header-user-menu-location-label {
  padding: 0.25rem 1rem 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-secondary, #666);
}

[data-theme="dark"] .header-user-menu-location-label {
  color: var(--text-secondary, #aaa);
}

.app-body {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 80px);
}

.sidebar {
  width: 250px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  padding: 1.5rem 0 0;
  transition: width 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
  overflow: hidden;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 80px);
}

.sidebar-version {
  margin-top: auto;
  padding: 1rem 1.5rem 1.25rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar.collapsed .sidebar-version {
  display: none;
}

.sidebar.collapsed {
  width: 60px;
}

.sidebar.collapsed .nav-item {
  padding: 0.75rem;
  text-align: center;
  position: relative;
}

.sidebar.collapsed .nav-item span {
  display: none;
}

.sidebar.collapsed .nav-item::before {
  content: attr(data-icon);
  font-size: 1.25rem;
}

.sidebar.collapsed .nav-item[title]::after {
  content: attr(title);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 0.75rem;
  background: var(--bg-tertiary);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  box-shadow: 0 2px 8px var(--shadow);
  z-index: 1000;
  border: 1px solid var(--border-color);
}

.sidebar.collapsed .nav-item:hover::after {
  opacity: 1;
}

.nav-item {
  display: block;
  padding: 0.75rem 1.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.3s ease;
}

.nav-item:hover {
  background: var(--hover-bg);
  color: var(--active-color);
}

.nav-item.active {
  background: var(--active-bg);
  color: var(--active-color);
  border-right: 3px solid var(--active-color);
}

.nav-updates-badge {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  margin-left: 0.5rem;
  vertical-align: middle;
  flex-shrink: 0;
}

.changelog-entry {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
}
.changelog-entry:last-child {
  border-bottom: none;
}
.changelog-entry-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.changelog-version {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.changelog-date {
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.changelog-content {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  font-family: inherit;
  margin: 0;
}

/* Host role: only Hostess Station visible in sidebar */
body.role-host .sidebar .nav-item:not([data-page="member"]) {
  display: none !important;
}

.main-content {
  flex: 1;
  padding: 2rem;
  background: var(--bg-secondary);
  transition: background-color 0.3s ease;
}

.content-page {
  background: var(--bg-primary);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px var(--shadow);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.content-page h1 {
  margin-bottom: 2rem;
  color: var(--text-primary);
}

#tables-canvas-wrap {
  box-sizing: border-box;
  overflow: hidden;
  width: 100%;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-primary {
  background-color: #2196F3;
  color: white;
}

.btn-primary:hover {
  background-color: #1976D2;
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--hover-bg);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-block {
  width: 100%;
}

.btn-danger {
  background-color: #d32f2f;
  color: white;
}

.btn-danger:hover {
  background-color: #c62828;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.data-table th,
.data-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.data-table th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-primary);
}

.data-table tr:hover {
  background: var(--hover-bg);
}

.data-table td {
  color: var(--text-primary);
}

/* Toast: temporary message, auto-dismisses after ~3s */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  max-width: 90%;
  font-size: 0.95rem;
  animation: toast-in 0.25s ease-out;
}
.toast.toast-success {
  background: #0f766e;
  color: #fff;
}
.toast.toast-error {
  background: #b91c1c;
  color: #fff;
}
.toast:not(.toast-success):not(.toast-error) {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(0.5rem);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Tables "Has left" button spinner */
.tables-mark-left-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid var(--border-color);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: tables-spinner-spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes tables-spinner-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: var(--bg-primary);
  border-radius: 8px;
  box-shadow: 0 4px 6px var(--shadow);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s ease;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 24px;
  border-top: 1px solid var(--border-color);
}

/* Dashboard Cards */
.dashboard-card {
  background: var(--bg-tertiary);
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px var(--shadow);
  margin-bottom: 1rem;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.dashboard-card h3 {
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

/* Reservations: dashboard-style total people */
.reservations-total-people-stat {
  margin-bottom: 1rem;
  max-width: 16rem;
}

.reservations-total-people-stat-label {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.reservations-total-people-stat-value {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* Signature Canvas */
#signature-canvas {
  cursor: crosshair;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-primary);
}

/* Settings Page */
.settings-container {
  margin-top: 2rem;
}

.settings-section {
  margin-bottom: 2rem;
}

.settings-section h2 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.theme-toggle-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-top: 1rem;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.theme-toggle-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.theme-toggle-label > span:first-child {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 1rem;
}

.theme-toggle-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* CDS (Club Display System) Styles */
#cds-page {
  --cds-tile-width: 280px;
  --cds-tile-height: 240px;
  --cds-grid-gap: 1rem;
}

/* Full-screen mode */
body.cds-fullscreen .app-header,
body.cds-fullscreen .sidebar {
  display: none !important;
}

body.cds-fullscreen .app-body {
  max-width: 100%;
  margin: 0;
}

body.cds-fullscreen .main-content {
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

body.cds-fullscreen #cds-page {
  width: 100vw;
  height: 100vh;
  padding: 0;
  margin: 0;
  display: block !important;
  background: var(--bg-secondary);
  overflow: hidden;
}

/* CDS Filter Buttons */
.cds-filter-btn {
  min-width: 120px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
}

.cds-filter-btn.active {
  background: var(--active-color);
  color: white;
}

.cds-help-icon {
  font-size: 1.25rem;
  color: var(--text-secondary);
  cursor: help;
  opacity: 0.85;
}

.cds-help-icon:hover {
  color: var(--text-primary);
  opacity: 1;
}

/* CDS loading state (spinner + message until Commerce7 data is loaded) */
.cds-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem;
  color: var(--text-secondary);
  font-size: 1rem;
}

.cds-loading-spinner {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--border-color);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: tables-spinner-spin 0.7s linear infinite;
}

.c7-login-spinner {
  width: 3rem;
  height: 3rem;
  border: 4px solid var(--border-color);
  border-top-color: #1a56db;
  border-radius: 50%;
  animation: tables-spinner-spin 0.8s linear infinite;
  margin: 0 auto;
}

/* CDS Tiles Container - page-based layout (3 rows x 4 columns per page). Fixed tile height; scroll when viewport is short. */
#cds-tiles-container.cds-pages-wrapper {
  display: flex;
  overflow-x: auto;
  overflow-y: auto;
  height: calc(100vh - 120px);
  min-height: 200px;
  padding: 1rem;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
}

#cds-tiles-container.cds-pages-wrapper::-webkit-scrollbar {
  height: 8px;
}

#cds-tiles-container.cds-pages-wrapper::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

#cds-tiles-container.cds-pages-wrapper::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.cds-page {
  width: calc(4 * var(--cds-tile-width) + 3 * var(--cds-grid-gap));
  min-width: calc(4 * var(--cds-tile-width) + 3 * var(--cds-grid-gap));
  max-width: calc(4 * var(--cds-tile-width) + 3 * var(--cds-grid-gap));
  flex-shrink: 0;
  scroll-snap-align: start;
  padding: 0 0.5rem;
  box-sizing: border-box;
  align-self: flex-start;
}

.cds-page-grid {
  display: grid;
  grid-template-columns: repeat(4, var(--cds-tile-width));
  grid-template-rows: repeat(3, var(--cds-tile-height));
  gap: var(--cds-grid-gap);
  width: calc(4 * var(--cds-tile-width) + 3 * var(--cds-grid-gap));
  min-width: calc(4 * var(--cds-tile-width) + 3 * var(--cds-grid-gap));
  max-width: calc(4 * var(--cds-tile-width) + 3 * var(--cds-grid-gap));
  min-height: 0;
}

.cds-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 100%;
  padding: 2rem;
  color: var(--text-secondary);
  text-align: center;
}

/* CDS Tile - fixed size so tiles don't resize with window */
.cds-tile {
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  width: var(--cds-tile-width);
  min-width: var(--cds-tile-width);
  max-width: var(--cds-tile-width);
  height: var(--cds-tile-height);
  min-height: var(--cds-tile-height);
  max-height: var(--cds-tile-height);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

/* Reservations list — long text columns */
#reservations-list-table .reservations-col-message,
#reservations-list-table .reservations-col-notes {
  max-width: 14rem;
  word-break: break-word;
  overflow-wrap: anywhere;
  vertical-align: top;
  font-size: 0.9rem;
  line-height: 1.35;
}

#reservations-list-table .reservations-status-select {
  max-width: 10rem;
  font-size: 0.9rem;
  padding: 0.25rem 0.35rem;
}

.cds-tile:active {
  transform: scale(0.98);
}

/* CDS Tile Header */
.cds-tile-header {
  padding: 1rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
  cursor: pointer;
  user-select: none;
  min-height: 60px;
  transition: background-color 0.3s;
}

.cds-tile-header-green {
  background: #4caf50;
}

.cds-tile-header-orange {
  background: #ff9800;
}

.cds-tile-header-red {
  background: #f44336;
}

.cds-tile-header-default {
  background: #2196f3;
}

.cds-tile-name {
  font-size: 1.1rem;
  flex: 1;
}

.cds-tile-cc-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.2rem;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  line-height: 0;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.cds-tile-cc-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.cds-tile-cc-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.95);
  outline-offset: 2px;
}

.cds-tile-cc-icon {
  display: block;
  vertical-align: middle;
}

.cds-tile-table {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* CDS Tile Body */
/* CDS Tile Body - slightly less top padding (header to Arrival Time), more bottom (below Pickup Available) */
.cds-tile-body {
  padding: 0.5rem 1rem 1.35rem;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* CDS Tile Info (new display format) - tighter gap between Table and customer name */
.cds-tile-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.cds-tile-info-item {
  font-size: 0.95rem;
  color: var(--text-primary);
  padding: 0.15rem 0;
  border-bottom: 1px solid var(--border-color);
  line-height: 1.3;
}

.cds-tile-info-item:last-child {
  border-bottom: none;
}

.cds-tile-info-item strong {
  color: var(--text-secondary);
  margin-right: 0.5rem;
}

.cds-tile-link:hover {
  opacity: 0.85;
}

.cds-customer-id {
  display: none; /* hide from tile; data still in DOM for CC Attention / Pickup links */
}

.cds-tile-notification {
  padding: 1rem;
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  border-radius: 4px;
  color: #856404;
  font-weight: 500;
}

.cds-tile-items {
  list-style: none;
  padding: 0;
  margin: 0;
}

.cds-tile-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
  color: var(--text-primary);
}

.cds-tile-item:last-child {
  border-bottom: none;
}

.cds-tile-item-hidden {
  display: none;
}

.cds-tile-more-btn {
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: background-color 0.2s;
  min-height: 44px;
}

.cds-tile-more-btn:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.cds-tile-more-btn:active {
  transform: scale(0.98);
}

/* CDS Exit Button */
#cds-exit-btn {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  min-width: 60px;
  min-height: 44px;
  font-weight: 500;
  box-shadow: 0 2px 8px var(--shadow);
}

/* CDS PIN Modal */
#cds-pin-modal .modal-content {
  max-width: 400px;
}

@keyframes cds-pin-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

#cds-pin-modal .modal-content.cds-pin-shake {
  animation: cds-pin-shake 0.5s ease-in-out;
}

/* Member Details Modal - fit content without scrolling, tighter spacing */
#member-details-modal .modal-content {
  max-height: fit-content;
  overflow-y: visible;
}
#member-details-modal .modal-body {
  padding: 1rem 1.25rem;
}
#member-details-modal .form-group {
  margin-bottom: 0.4rem;
}
#member-details-modal .form-group label {
  margin-bottom: 0.2rem;
}

/* Signature modal – theme-aware */
.signature-customer-info {
  margin-bottom: 1.5rem;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: 4px;
  color: var(--text-primary);
}

.signature-membership-message {
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--text-primary);
}

.signature-pad-wrapper {
  margin-bottom: 1.5rem;
}

.signature-pad-label {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.signature-pad-box {
  border: 2px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-secondary);
  padding: 1rem;
  position: relative;
}

.signature-pad-instruction {
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
  color: var(--text-secondary);
  text-align: center;
}

.signature-canvas {
  cursor: crosshair;
  width: 100%;
  max-width: 100%;
  height: 180px;
  display: block;
  margin: 0 auto;
  background: var(--bg-secondary);
}

[data-theme="dark"] #signature-modal .signature-modal-header {
  background: #252525;
  border-bottom-color: #404040;
}

[data-theme="dark"] #signature-modal .signature-modal-header h2 {
  color: #fff;
}

[data-theme="dark"] #signature-modal .modal-close {
  color: #e0e0e0;
}

[data-theme="dark"] #signature-modal .modal-close:hover {
  color: #fff;
}

/* Orders modal (Orders To Pickup) – theme-aware */
.orders-customer-info {
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 4px;
  color: var(--text-primary);
}

.orders-list-container .orders-section-title {
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.orders-list-container {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 2rem;
}

.orders-pickup-card {
  margin-bottom: 1rem;
}

@media (max-width: 480px) {
  .orders-pickup-card {
    padding: 0.5rem !important;
    margin-bottom: 0.75rem;
  }
  .orders-pickup-header {
    gap: 0.25rem;
  }
  #orders-modal .modal-content {
    margin: 1rem;
    max-width: calc(100% - 2rem);
    width: 100%;
  }
}

.orders-loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
}

.orders-error {
  padding: 1rem;
  color: #d32f2f;
  background: #ffebee;
  border-radius: 4px;
}

[data-theme="dark"] .orders-error {
  background: #4a1f1f;
  color: #ff6b6b;
}

/* Exchange modal – theme-aware */
.exchange-loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
}

.exchange-error {
  padding: 1rem;
  color: #d32f2f;
  background: #ffebee;
  border-radius: 4px;
}

[data-theme="dark"] .exchange-error {
  background: #4a1f1f;
  color: #ff6b6b;
}

.exchange-intro {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.exchange-cart-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.exchange-add-section {
  margin-top: 1.5rem;
}

.exchange-section-title {
  margin-bottom: 0.5rem;
  font-size: 1rem;
  color: var(--text-primary);
}

.exchange-cart-list {
  min-height: 2rem;
  color: var(--text-primary);
}

.exchange-product-search {
  width: 100%;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 1rem;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.exchange-product-results {
  max-height: 250px;
  overflow-y: auto;
  color: var(--text-primary);
}

/* Dark theme: override inline light backgrounds/text in Orders and Exchange modals */
[data-theme="dark"] #orders-modal .modal-body div[style*="background"],
[data-theme="dark"] #exchange-modal .modal-body div[style*="background"],
[data-theme="dark"] #exchange-modal .modal-body div[style*="background"] {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] #orders-modal .modal-body,
[data-theme="dark"] #orders-modal .modal-body h3,
[data-theme="dark"] #exchange-modal .modal-body,
[data-theme="dark"] #exchange-modal .modal-body h3 {
  color: var(--text-primary);
}

[data-theme="dark"] #orders-modal .modal-body [style*="color: #666"],
[data-theme="dark"] #orders-modal .modal-body [style*="color:#666"],
[data-theme="dark"] #exchange-modal .modal-body [style*="color: #666"],
[data-theme="dark"] #exchange-modal .modal-body [style*="color:#666"],
[data-theme="dark"] #exchange-modal .modal-body [style*="color: #999"],
[data-theme="dark"] #exchange-modal .modal-body [style*="color:#999"],
[data-theme="dark"] #exchange-modal .modal-body [style*="color: #333"],
[data-theme="dark"] #exchange-modal .modal-body [style*="color:#333"] {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] #orders-modal .modal-body input,
[data-theme="dark"] #exchange-modal .modal-body input {
  background: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

#cds-pin-input {
  text-align: center;
  font-size: 1.5rem;
  letter-spacing: 0.5rem;
  padding: 1rem;
  font-family: monospace;
}

/* Mobile: Guest Search and other forms readable */
@media (max-width: 768px) {
  #member-page .member-search-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  #member-page .member-search-bar {
    flex-direction: column;
    align-items: stretch;
  }
  #member-page #member-search-form .form-group {
    margin-bottom: 1rem;
  }
  #member-search-type,
  #member-search-term {
    font-size: 16px !important; /* prevents iOS zoom */
    min-height: 48px;
  }
  #member-page .data-table {
    font-size: 14px;
    display: block;
    overflow-x: auto;
  }
  #member-page .data-table th,
  #member-page .data-table td {
    padding: 0.5rem 0.25rem;
    white-space: nowrap;
  }
}

/* Touch-friendly styles */
@media (hover: none) and (pointer: coarse) {
  .cds-tile-header {
    min-height: 60px;
  }

  .cds-tile-cc-btn {
    min-width: 44px;
    min-height: 44px;
  }
  
  .cds-tile-more-btn {
    min-height: 48px;
  }
  
  #cds-exit-btn {
    min-width: 80px;
    min-height: 60px;
    font-size: 1.1rem;
  }
}

.theme-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
}

.theme-slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .theme-slider {
  background-color: #667eea;
}

input:checked + .theme-slider:before {
  transform: translateX(26px);
}

.theme-switch:hover .theme-slider {
  box-shadow: 0 0 8px rgba(102, 126, 234, 0.4);
}
