/* 4Sofit — Phase C premium UX (admin PWA, setup wizard) */

/* ── Admin install banner ── */
.admin-install-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin: 0 0 8px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(10, 123, 110, 0.12) 0%, rgba(201, 162, 39, 0.08) 100%);
  border: 1px solid rgba(10, 123, 110, 0.22);
  font-size: 13px;
}

.admin-install-banner[hidden] {
  display: none !important;
}

.admin-install-banner__text {
  flex: 1;
  min-width: 0;
}

.admin-install-banner__text strong {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
}

.admin-install-banner__hint {
  display: block;
  font-size: 11px;
  color: var(--text-muted, #64748b);
}

.admin-install-banner__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.admin-install-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #0d9488 0%, #0a7b6e 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.admin-install-btn:hover {
  filter: brightness(1.05);
}

.admin-install-dismiss {
  background: none;
  border: none;
  color: var(--text-muted, #64748b);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

@media (min-width: 1024px) {
  .admin-install-banner {
    display: none !important;
  }
}

/* ── Setup wizard ── */
.setup-wizard-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.setup-wizard-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: background 0.2s ease, transform 0.2s ease;
}

.setup-wizard-dot.is-active {
  background: var(--brand, #0a7b6e);
  transform: scale(1.2);
}

.setup-wizard-dot.is-done {
  background: #10b981;
}

.setup-wizard-step {
  text-align: center;
  padding: 8px 4px 4px;
}

.setup-wizard-step__icon {
  font-size: 36px;
  margin-bottom: 12px;
  line-height: 1;
}

.setup-wizard-step__title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
}

.setup-wizard-step__body {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--text-muted, #64748b);
  line-height: 1.6;
}

.setup-wizard-step__meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #f1f5f9;
  font-size: 12px;
  margin-bottom: 12px;
}

.setup-wizard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  width: 100%;
}

/* Preview panel — follow-up history */
.preview-panel__history {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.preview-panel__history-title {
  font-size: 12px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text-muted, #64748b);
}

.preview-panel__history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow: auto;
}

.preview-panel__history-item {
  padding: 8px 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 11px;
}

.preview-panel__history-item strong {
  display: block;
  font-size: 12px;
  margin-bottom: 2px;
}

@media (max-width: 767px) {
  .add-card-panel.setup-wizard-modal {
    align-self: flex-end;
    width: 100%;
    max-width: none;
    border-radius: 16px 16px 0 0;
    margin-top: auto;
  }
}

/* ── Mobile shell fixes — forms & modals stay visible on phone ── */
@media (max-width: 991px) {
  .page-content:has(> .page-form-stage) {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0 !important;
    padding-bottom: 0 !important;
  }

  .page-form-stage {
    flex: 1 1 0;
    min-height: 0;
    padding: 8px 10px 10px;
    overflow: hidden;
  }

  .page-form-stage > .page-float-card,
  .page-form-stage > .add-card-panel.page-float-card {
    flex: 1 1 0;
    width: 100%;
    max-width: 100%;
    height: auto !important;
    max-height: none !important;
    min-height: 0;
  }

  .page-float-card .add-card-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 767px) {
  .add-card-overlay {
    z-index: 1250 !important;
  }

  .add-card-overlay .add-card-panel.modal-sheet,
  .add-card-overlay .add-card-panel.modal-form-card {
    display: flex !important;
    flex-direction: column !important;
    height: min(92dvh, calc(100dvh - var(--safe-top, 0px))) !important;
    max-height: min(92dvh, calc(100dvh - var(--safe-top, 0px))) !important;
    min-height: 0 !important;
  }

  .add-card-overlay .add-card-panel .add-card-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .master-detail-panel {
    z-index: 1250 !important;
    max-height: min(85dvh, calc(100dvh - var(--safe-top, 0px) - 12px)) !important;
  }

  .master-detail-backdrop {
    z-index: 1240 !important;
  }
}

/* ── Mobile compact page header — actions in one row, search on demand ── */
.toolbar-mobile-only {
  display: none;
}

.toolbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min, 44px);
  height: var(--touch-min, 44px);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--brand-dark);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.toolbar-icon-btn.is-active {
  background: var(--brand-light);
  border-color: rgba(13, 148, 136, 0.35);
  color: var(--brand-dark);
}

@media (max-width: 767px) {
  .toolbar-mobile-only {
    display: inline-flex;
  }

  .page-toolbar:not(:has(.toolbar-search)) .toolbar-mobile-only {
    display: none !important;
  }

  .page-toolbar {
    position: relative;
    padding: 8px 12px 10px;
    margin-bottom: 6px;
  }

  .page-breadcrumbs {
    display: none;
  }

  .page-toolbar-row {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-height: 40px;
  }

  .page-toolbar-brand {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
  }

  .page-toolbar-badge {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }

  .page-toolbar-title {
    font-size: 15px !important;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .page-toolbar-subtitle-inline {
    display: none;
  }

  .page-toolbar-meta {
    margin-top: 4px;
    padding-top: 0;
    font-size: 11px;
    line-height: 1.35;
    gap: 8px;
  }

  .page-toolbar-tools {
    width: auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
  }

  .toolbar-actions-cluster {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    width: auto;
    max-width: min(48vw, 200px);
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0;
    border: none;
    background: transparent;
    border-radius: 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .toolbar-actions-cluster::-webkit-scrollbar {
    display: none;
  }

  .toolbar-actions-cluster .btn-toolbar,
  .toolbar-actions-cluster .btn-toolbar-add,
  .toolbar-actions-cluster a.btn-toolbar-add {
    width: auto;
    flex: 0 0 auto;
    min-height: 36px;
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap;
    border-radius: 10px;
  }

  .page-toolbar:not(.is-search-open) .toolbar-actions-cluster .toolbar-search {
    display: none !important;
  }

  .page-toolbar.is-search-open .toolbar-actions-cluster .toolbar-search {
    display: flex !important;
    position: absolute;
    inset-inline: 12px;
    top: calc(100% + 6px);
    z-index: 12;
    width: auto;
    max-width: none;
    grid-column: auto;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 4px;
  }

  .page-toolbar.is-search-open {
    padding-bottom: 56px;
  }

  .list-page-shell > .page-toolbar {
    flex-shrink: 0;
  }
}

/* ── Form pages — fixed action dock above bottom nav ── */
@media (max-width: 991px) {
  .app-shell:has(.page-form-stage) .quick-fab-trigger,
  .app-shell:has(.page-form-stage) .quick-fab-backdrop,
  .app-shell:has(.page-form-stage) .quick-fab-sheet {
    display: none !important;
  }

  .page-form-stage .page-float-card .add-card-header-text p {
    display: none;
  }

  .page-form-stage .page-float-card .add-card-header {
    padding: 10px 14px 8px;
  }

  .page-form-stage .page-float-card .add-card-body {
    padding-bottom: calc(var(--form-dock-h, 96px) + 12px);
  }

  .page-form-stage .page-float-card .add-card-footer {
    position: fixed;
    inset-inline: 0;
    bottom: calc(var(--mobile-bottom-nav-h, 62px) + var(--safe-bottom, 0px));
    z-index: 850;
    margin: 0;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    border-radius: 16px 16px 0 0;
    border-top: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 -12px 32px rgba(15, 23, 42, 0.14);
  }

  .page-form-stage .form-card-footer-actions--pay {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .page-form-stage .form-card-footer-actions--pay .btn-form-save {
    order: -1;
    width: 100%;
    min-height: 48px;
    font-size: 16px;
    font-weight: 700;
    justify-content: center;
  }

  .page-form-stage .form-card-footer-secondary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
  }

  .page-form-stage .form-card-footer-hint {
    font-size: 11px;
    color: var(--text-muted);
  }

  .page-form-stage .form-card-footer-actions .btn-form-cancel {
    min-height: 40px;
    padding-inline: 12px;
  }
}

/* ── Branch required notice ── */
.branch-required-notice {
  max-width: 520px;
  margin: 24px auto;
  padding: 24px 22px;
  text-align: center;
}

.branch-required-notice__icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 148, 136, 0.12);
  color: var(--brand-dark);
  font-size: 24px;
  font-weight: 700;
}

.branch-required-notice h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.branch-required-notice p {
  margin: 0 0 8px;
  color: var(--text-muted);
  line-height: 1.55;
}

.branch-required-notice__hint {
  font-size: 12px;
}

.branch-required-notice .btn {
  margin-top: 14px;
}
