:root {
  --bg: #f7f4ef;
  --card: #fdfbf8;
  --line: #e8e2d8;
  --text: #2c2418;
  --muted: #b5aa9a;
  --accent: #8b7355;
  --dark: #2c2418;
  --ok: #5c7a5a;
  --warn: #c4713b;
  --error: #b54a4a;
}

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

html,
body {
  height: 100%;
}

body {
  font-family: "DM Sans", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font-family: inherit;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 200px;
  background: var(--dark);
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
}

.brand {
  color: var(--bg);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-bottom: 2px;
}

.sidebar > div:first-child {
  text-align: center;
  flex-shrink: 0;
}

.brand-logo {
  margin-bottom: 4px;
}

.brand-logo img {
  display: block;
  max-width: 100%;
  height: auto;
  width: 90px;
  margin-left: auto;
  margin-right: auto;
}

.brand-sub {
  color: var(--accent);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.login-brand {
  margin-bottom: 6px;
  margin-left: auto;
  margin-right: auto;
}

.login-brand img {
  width: 90px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.login-card .login-brand-sub {
  text-align: center;
}

.login-brand-sub {
  color: var(--accent);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 16px;
}

.sidebar-nav {
  margin-top: 44px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.nav-btn {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: #7a6e5e;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 2px;
  text-decoration: none;
}

.nav-btn.active {
  background: rgba(139, 115, 85, 0.12);
  color: #d4c5a9;
  font-weight: 500;
}

.sidebar-bottom {
  margin-top: auto;
  flex-shrink: 0;
}

.sidebar-date {
  color: #5a5040;
  font-size: 11px;
  padding: 0 8px;
}

.sidebar-footer {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-footer .nav-btn-footer {
  padding: 8px 12px;
  font-size: 12px;
  color: #7a6e5e;
}

.sidebar-footer .nav-btn-footer:hover {
  color: var(--bg);
}

#main {
  flex: 1;
  min-width: 0;
  overflow: auto;
  padding: 36px 40px;
}

.kicker {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.page-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 28px;
  font-weight: 400;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 32px;
}

.btn {
  border-radius: 8px;
  font-size: 13px;
  padding: 10px 20px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--accent);
}

.btn-dark {
  background: var(--dark);
  color: var(--bg);
  border-color: var(--dark);
}

.btn-xs {
  font-size: 11px;
  padding: 6px 12px;
  border-radius: 6px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  border-radius: 8px;
}

.btn-icon:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--bg);
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.card-lite {
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--line);
}

.kpi-card {
  background: var(--card);
  padding: 24px 24px 20px;
}

.kpi-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.kpi-big {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 36px;
  font-weight: 500;
}

.kpi-sub {
  font-size: 12px;
  color: var(--accent);
  margin-top: 8px;
}

.tag {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 4px;
}

.tag-member {
  color: var(--accent);
  background: #f0ebe2;
}

.type-badge {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
}

.type-coworking {
  color: var(--accent);
  background: #f0ebe2;
}

.type-meeting {
  color: #1e5c3a;
  background: #c5e1c8;
}

.type-event {
  color: var(--warn);
  background: #fdf2e6;
}

.status-ok {
  color: var(--ok);
}

.status-warn {
  color: var(--warn);
}

.status-expired {
  color: var(--error);
}

.members-filter .btn.active {
  background: var(--dark);
  color: var(--bg);
  border-color: var(--dark);
}

.link-extend {
  color: var(--accent);
  text-decoration: underline;
}

.link-extend:hover {
  color: var(--dark);
}

.split-1-2 {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1px;
  background: var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}

.split-1-1 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel {
  background: var(--card);
  padding: 24px;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.panel-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.capacity-indicator {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--line);
  color: var(--text);
  white-space: nowrap;
}

.table-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #ede9e1;
}

.booking-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.btn-cancel {
  color: #b33;
  border-color: #e8c4c4;
}

.btn-cancel:hover {
  background: rgba(180, 40, 40, 0.08);
  border-color: #c53030;
  color: #962d2d;
}

.table-row:last-child {
  border-bottom: none;
}

.table-row[data-member-id] {
  cursor: pointer;
}

.panel-customers-list {
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 12px;
}

/* Member "Last 5 visits" + Guest Profile transaction history (modals) */
.modal-history-list {
  margin-top: 6px;
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
}

.modal-history-row {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  word-break: break-word;
}

.modal-history-row:last-child {
  border-bottom: none;
}

.text-sm {
  font-size: 12px;
}

.text-muted {
  color: var(--muted);
}

.mono {
  font-family: "JetBrains Mono", monospace;
}

.copilot {
  background: #3d3428;
  color: #d4c5a9;
  border-radius: 12px;
  padding: 24px;
}

.copilot .panel-label {
  color: #a08b6e;
}

.copilot-note {
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-line;
}

.alert {
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 18px;
}

.alert-event {
  background: #fdf2e6;
  border: 1px solid #f0d9b5;
  color: var(--warn);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tabs {
  display: inline-flex;
  gap: 4px;
}

.tab-btn {
  border-radius: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  padding: 7px 14px;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--dark);
  color: var(--bg);
  border-color: var(--dark);
}

.booking-layout {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 16px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.calendar-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 22px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.dow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 4px;
}

.day-cell {
  min-height: 90px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.day-cell.out-month {
  opacity: 0.45;
}

.day-cell.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.day-cell.today .day-num {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.day-cell.event-day {
  background: #fdf2e6;
}

.day-cell.blocked {
  background: linear-gradient(135deg, #fdf2e6 0%, #fce4d0 100%);
  border-color: #f0d9b5;
  position: relative;
}

.day-cell.blocked::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 4px,
    rgba(220, 160, 80, 0.08) 4px,
    rgba(220, 160, 80, 0.08) 8px
  );
  pointer-events: none;
}

.day-num {
  font-size: 12px;
  font-weight: 600;
}

.day-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: auto;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.dot-coworking {
  background: var(--accent);
}

.dot-meeting {
  background: var(--ok);
}

.dot-event {
  background: var(--warn);
}

.dot-other {
  background: var(--muted);
}

.mini-pill {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-radius: 999px;
  padding: 2px 7px;
  border: 1px solid var(--line);
}

.mini-pill.closed {
  color: var(--warn);
  background: #fdf2e6;
  border-color: #f0d9b5;
}

.form-grid {
  display: grid;
  gap: 14px;
}

label {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1.1px;
  margin-bottom: 6px;
  display: block;
}

input,
select {
  width: 100%;
  border: 1px solid #d6cfc4;
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}

.input-nfc-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-nfc {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #d6cfc4;
  background: #fff;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-nfc:hover {
  background: #f8f4ee;
}

.field-locked {
  background: #f0ebe2;
  pointer-events: none;
  opacity: 0.85;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 25, 20, 0.35);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-card {
  width: min(560px, 92vw);
  max-height: 86vh;
  overflow: auto;
  background: var(--card);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 24px 80px rgba(30, 25, 20, 0.12);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 20px;
  font-weight: 500;
}

.member-lookup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 25, 20, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.member-lookup-card {
  width: min(480px, 92vw);
  max-height: 80vh;
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 24px 80px rgba(30, 25, 20, 0.16);
}

.member-detail-card {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
  display: grid;
  gap: 8px;
}

.visit-log-entry {
  font-size: 12px;
  color: #6b5f4f;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: var(--dark);
  color: var(--bg);
  padding: 12px 18px;
  border-radius: 8px;
  z-index: 200;
  box-shadow: 0 8px 28px rgba(30, 25, 20, 0.18);
}

.muted-note {
  font-size: 11px;
  color: var(--accent);
  line-height: 1.5;
}

.space-top {
  margin-top: 16px;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(30, 25, 20, 0.08);
  text-align: center;
}

.login-card .form-grid {
  text-align: left;
}

.login-subtitle {
  color: var(--accent);
  font-size: 13px;
  margin-top: 10px;
}

.product-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 14px;
  text-align: left;
  cursor: pointer;
}

.sticky {
  position: sticky;
  top: 36px;
}

.settings-form {
  max-width: 980px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.settings-block {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}

.settings-block-header {
  margin-bottom: 12px;
}

.settings-fields {
  display: grid;
  gap: 12px;
}

.settings-fields-2 {
  grid-template-columns: 1fr 1fr;
}

.settings-hours {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.settings-page .muted-note {
  margin-top: 8px;
}

@media (max-width: 900px) {
  .settings-fields-2,
  .settings-hours {
    grid-template-columns: 1fr;
  }
}

.price-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  background: #faf8f5;
  margin-top: 10px;
}

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  padding: 3px 0;
  color: #6b6256;
}

.price-row.price-credit span:last-child {
  color: var(--ok);
  font-weight: 500;
}

.price-row.price-total {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  border-top: 1px solid var(--line);
  margin-top: 6px;
  padding-top: 8px;
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-thumb {
  background: #d6cfc4;
  border-radius: 10px;
}

/* Toast message (Lucide) - login and app; wrapper keeps height compact */
.toast-msg-wrapper {
  position: fixed !important;
  top: 1rem !important;
  left: 50% !important;
  transform: translate(-50%, -100%) !important;
  z-index: 10000 !important;
  display: inline-flex !important;
  width: max-content !important;
  max-width: 90vw !important;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.toast-msg-wrapper.show {
  transform: translate(-50%, 0) !important;
  opacity: 1 !important;
  pointer-events: auto;
}

/* Inside wrapper: do not use .toast fixed positioning so height stays content-sized */
.toast-msg-wrapper .toast.toast-msg {
  position: relative !important;
  right: auto !important;
  bottom: auto !important;
}

.toast.toast-msg {
  display: inline-flex !important;
  align-items: center;
  gap: 0.75rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--text);
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

.toast.toast-msg .toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  border-radius: 50%;
}

.toast.toast-msg .toast-icon svg,
.toast.toast-msg .toast-icon i svg {
  width: 1rem !important;
  height: 1rem !important;
}

.toast.toast-msg .toast-icon.success {
  background: #d1fae5;
  color: #059669;
}

.toast.toast-msg .toast-icon.error {
  background: #fee2e2;
  color: #dc2626;
}

.toast.toast-msg .toast-icon.warning {
  background: #fef3c7;
  color: #d97706;
}

.toast.toast-msg .toast-icon.loading {
  background: transparent;
  color: var(--text);
}

.toast.toast-msg .toast-icon.loading i {
  font-size: 0.875rem;
}

.toast.toast-msg .toast-content {
  flex: 0 1 auto;
  min-width: 0;
}

.toast.toast-msg .toast-message {
  margin: 0;
  font-weight: 500;
}

.toast.toast-msg .toast-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
}

.toast.toast-msg .toast-close:hover {
  background: var(--line);
  color: var(--text);
}

.toast.toast-msg .toast-close svg {
  width: 0.875rem;
  height: 0.875rem;
  fill: currentColor;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 0.8s linear infinite;
}

/* PWA footer (login) */
.pwa-update-footer {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
  z-index: 40;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(253, 251, 248, 0.94);
  border: 1px solid var(--line);
  box-shadow: 0 4px 24px rgba(44, 36, 24, 0.08);
}

.pwa-update-footer .pwa-version {
  font-family: "JetBrains Mono", "DM Sans", monospace;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.pwa-update-footer .pwa-update-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-size: 11px;
  white-space: nowrap;
}

.pwa-update-footer .pwa-update-link:hover {
  text-decoration: underline;
  color: var(--dark);
}

.pwa-update-footer.pwa-update-pending .pwa-update-link {
  color: var(--warn);
}
