/* Homepage Navigation & Interactive Demonstration Deck */
.hp-navbar { gap: 24px; }
.hp-nav-links { flex-shrink: 0; }
.hp-nav-link { white-space: nowrap; }
@media (max-width: 1100px) { .hp-nav-links { display: none; } }
@media (max-width: 850px) { .hp-nav-admin-btn { display: none; } .hp-navbar { gap: 12px; } }

/* Unified Command Center-First Demo Deck */
.demo-deck {
  color: #edf3f9;
  margin: 32px auto 60px;
  max-width: 1100px;
  width: calc(100% - 48px);
  box-sizing: border-box;
}

@media (max-width: 850px) {
  .demo-deck {
    width: calc(100% - 24px);
    margin: 24px auto 48px;
  }
}

@media (max-width: 380px) {
  .demo-deck {
    width: calc(100% - 16px);
    margin: 16px auto 36px;
  }
}

.demo-deck .hp-section-header {
  max-width: 760px;
  margin: 0 auto 36px;
  text-align: center;
}

.demo-deck .hp-section-header h2 {
  font-size: clamp(1.5rem, 3.2vw, 2.25rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
  text-wrap: balance;
  margin: 8px 0 12px;
}

.demo-deck .hp-section-header p {
  color: var(--text-muted, #a8b5c5);
  font-size: 0.9375rem;
  line-height: 1.6;
  max-width: 68ch;
  margin: 0 auto;
  text-wrap: pretty;
}

.demo-deck-layout {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* Mobile Lead: Manager summary & Maya row ahead of phone card on small screens */
.demo-mobile-lead {
  display: none;
  margin-bottom: 20px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (max-width: 850px) {
  .demo-mobile-lead {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .demo-desktop-summary {
    display: none !important;
  }
}

/* Grid Layout: Desktop 2-column (~62% / ~38%) vs Mobile Column reflow */
.demo-deck-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 1fr);
  gap: 28px;
  align-items: start;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.demo-ledger-column {
  grid-column: 1 / 2;
  grid-row: 1;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.demo-companion-column {
  grid-column: 2 / 3;
  grid-row: 1;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 850px) {
  .demo-deck-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    min-width: 0;
  }
  .demo-ledger-column,
  .demo-companion-column {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
}

/* Left Column: Ledger Card */
.demo-ledger-card {
  background: linear-gradient(135deg, rgba(16, 30, 48, 0.95), rgba(11, 21, 36, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 20px;
  padding: 24px 28px;
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 600px) {
  .demo-ledger-card {
    padding: 16px 14px;
    border-radius: 16px;
  }
}

@media (max-width: 360px) {
  .demo-ledger-card {
    padding: 12px 10px;
  }
}

.demo-ledger-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (max-width: 850px) {
  .demo-ledger-topbar {
    margin-bottom: 14px;
    gap: 12px;
  }
}

/* Filter Controls - Explicit higher specificity to cleanly override polish.css cascade */
.demo-deck .preview-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.18);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
}

.demo-deck .preview-controls button {
  flex: 1 1 calc(33.333% - 4px);
  min-width: 0;
  min-height: 2.75rem; /* 44px uniform Apple tap target */
  padding: 6px 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: all 140ms ease;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  box-sizing: border-box;
  touch-action: manipulation;
}

.demo-deck .preview-controls button:hover {
  color: #f1f5f9;
}

.demo-deck .preview-controls button[aria-pressed="true"] {
  background: #27fb8a;
  color: #071b12;
  border-color: #27fb8a;
  box-shadow: 0 2px 8px rgba(39, 251, 138, 0.3);
}

@media (max-width: 375px) {
  .demo-deck .preview-controls button {
    flex: 1 1 100%;
  }
}

/* Summary Badge */
.demo-deck .demo-summary-badge {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 6px 14px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  box-sizing: border-box;
  max-width: 100%;
  text-align: center;
  word-break: break-word;
  white-space: normal;
}

/* Records Table - Reset polish.css extra borders and padding */
.demo-deck .preview-records {
  margin: 0 0 20px;
  padding: 0;
  background: transparent;
  border: none;
}

.demo-records-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Enforce strict hidden attribute rendering across demo deck to override flex author styles */
.demo-deck [hidden],
.demo-reset-wrap[hidden] {
  display: none !important;
}

.demo-filter-result-summary {
  font-size: 0.8125rem;
  color: #94a3b8;
  margin-top: 10px;
  margin-bottom: 2px;
  line-height: 1.4;
}

.demo-filter-result-summary:empty {
  display: none;
}

.demo-record-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.12);
  transition: background 160ms ease, border-color 160ms ease;
  min-width: 0;
  box-sizing: border-box;
  width: 100%;
}

.demo-staff-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}

.demo-staff-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}

.demo-staff-info strong {
  font-size: 0.9375rem;
  color: #f1f5f9;
  white-space: normal;
  word-break: break-word;
}

.demo-staff-info small {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 2px;
  white-space: normal;
  word-break: break-word;
}

.demo-status-cell {
  flex-shrink: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
}

.demo-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  box-sizing: border-box;
  white-space: normal;
  word-break: break-word;
  text-align: left;
}

/* Narrow screens reflow: staff info above full-width status badge */
@media (max-width: 600px) {
  .demo-record-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
  }
  .demo-staff-cell {
    width: 100%;
  }
  .demo-status-cell {
    width: 100%;
  }
  .demo-badge {
    width: 100%;
    justify-content: flex-start;
    padding: 6px 10px;
  }
}

.demo-badge.awaiting {
  background: rgba(100, 116, 139, 0.18);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.demo-badge.matrix-in {
  background: rgba(39, 251, 138, 0.16);
  color: #27fb8a;
  border: 1px solid rgba(39, 251, 138, 0.35);
}

.demo-badge.matrix-late {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.demo-badge.matrix-wfh {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

/* Ledger Footer */
.demo-ledger-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  flex-wrap: wrap;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.demo-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: #27fb8a;
  text-decoration: none;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  text-underline-offset: 0.2em;
}

.demo-link:hover {
  text-decoration: underline;
}

.demo-note {
  font-size: 0.75rem;
  color: #64748b;
  word-break: break-word;
}

/* Right Column: Phone Widget */
.demo-phone-frame {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  border: 1px solid #334155;
  border-radius: 28px;
  background: #091322;
  padding: 24px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  box-sizing: border-box;
  color: #edf3f9;
}

@media (max-width: 360px) {
  .demo-phone-frame {
    max-width: 100%;
    padding: 16px 12px;
    border-radius: 20px;
  }
}

.phone-top {
  display: flex;
  flex-direction: column;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  font-size: 1rem;
}

.phone-eyebrow {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #27fb8a;
}

.phone-top span {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 3px;
}

.phone-perimeter {
  border: 1px solid rgba(39, 251, 138, 0.35);
  border-radius: 999px;
  background: rgba(39, 251, 138, 0.1);
  color: #27fb8a;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  padding: 7px 10px;
  margin: 18px 0;
}

.phone-profile {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  font-size: 0.875rem;
  background: rgba(15, 23, 42, 0.5);
  margin-bottom: 20px;
}

.phone-profile small {
  display: block;
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 2px;
}

.phone-avatar {
  display: grid;
  place-items: center;
  background: rgba(39, 251, 138, 0.18);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  color: #27fb8a;
  font-size: 0.8125rem;
  font-weight: 700;
  flex: none;
}

.phone-avatar.small {
  width: 30px;
  height: 30px;
  font-size: 0.75rem;
}

.phone-action-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  text-align: center;
}

.demo-action-btn {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.5rem;
  cursor: pointer;
  touch-action: manipulation;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.phone-last {
  font-size: 0.75rem;
  color: #94a3b8;
  margin: 0;
  line-height: 1.4;
}

.demo-reset-wrap {
  width: 100%;
  margin-top: 6px;
}

.demo-reset-btn {
  width: 100%;
  min-height: 2.25rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 0.5rem;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #cbd5e1;
  cursor: pointer;
}

.demo-reset-btn:hover {
  background: rgba(51, 65, 85, 0.8);
  color: #ffffff;
}

/* 160ms Subtle Pulse Feedback (Disabled under Reduced Motion) */
.highlight-pulse {
  animation: demoPulse 160ms ease-out;
}

@keyframes demoPulse {
  0% { transform: scale(0.98); filter: brightness(1.2); }
  50% { transform: scale(1.02); filter: brightness(1.3); }
  100% { transform: scale(1); filter: brightness(1); }
}

@media (prefers-reduced-motion: reduce) {
  .highlight-pulse {
    animation: none !important;
  }
}
