/* RubusCRM — mobil uyumluluk (0–767 mobile, 768–1023 tablet, 1024+ desktop) */

:root {
  --mobile-bottom-nav-h: 4rem;
  --mobile-sticky-bar-h: 3.25rem;
  --mobile-touch-min: 44px;
  --mobile-safe-bottom: env(safe-area-inset-bottom, 0px);
  --mobile-keyboard-inset: 0px;
}

/* ——— Breakpoint yardımcıları ——— */
@media (max-width: 767px) {
  body.is-mobile-layout .sidebar {
    display: none !important;
  }

  body.is-mobile-layout .app {
    grid-template-columns: 1fr;
  }

  body.is-mobile-layout .workspace {
    padding-bottom: calc(var(--mobile-bottom-nav-h) + var(--mobile-safe-bottom) + 0.5rem);
  }

  body.is-mobile-layout .topbar-title .sidebar-toggle {
    display: none;
  }

  body.is-mobile-layout .topbar {
    min-height: 3rem;
    padding-inline: 0.75rem;
  }

  body.is-mobile-layout .topbar-title h1 {
    font-size: 1.05rem;
  }

  body.is-mobile-layout .view-page-actions {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  body.is-mobile-layout .view-page-actions .primary-button,
  body.is-mobile-layout .view-page-actions .ghost-button {
    min-height: var(--mobile-touch-min);
  }

  /* Teklifler: masaüstü builder mobilde gizli (sihirbaz kullanılır) */
  body.is-mobile-layout #offersView.is-mobile-wizard-active #offerBuilderSection,
  body.is-mobile-layout #offersView.is-mobile-wizard-active .offer-line-tabs,
  body.is-mobile-layout #offersView.is-mobile-wizard-active .line-section,
  body.is-mobile-layout #offersView.is-mobile-wizard-active #offerPreviewLineSection,
  body.is-mobile-layout #offersView.is-mobile-wizard-active .offer-preview-line-section iframe {
    display: none !important;
  }

  body.is-mobile-layout #newQuickOfferButton {
    display: inline-flex !important;
  }

  body.is-mobile-layout #offersView.is-quick-offer .mobile-wizard-progress {
    display: none;
  }

  body.is-mobile-layout .mobile-quick-offer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  body.is-mobile-layout .mobile-offer-total-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #f0fdfa;
    border: 1px solid #99f6e4;
    border-radius: 0.65rem;
  }

  body.is-mobile-layout .mobile-wizard-mode-badge {
    margin: 0;
    font-weight: 700;
    color: var(--accent, #0f766e);
  }

  body.is-mobile-layout .mobile-comp-chip {
    min-height: 2.25rem;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--border-subtle, #e5e7eb);
    background: #fff;
    font-size: 0.75rem;
  }

  body.is-mobile-layout .mobile-comp-chip.is-added {
    border-color: var(--accent, #0f766e);
    background: #f0fdfa;
  }

  body.is-mobile-layout .mobile-quick-send {
    margin-top: 0.5rem;
  }

  body.is-mobile-layout .mobile-send-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  body.is-mobile-layout .mobile-send-actions .primary-button,
  body.is-mobile-layout .mobile-send-actions .ghost-button {
    min-height: var(--mobile-touch-min);
  }

  body.is-mobile-layout #offersView.is-mobile-wizard-active .offer-tabs {
    display: none;
  }

  body.is-mobile-layout #offersView:not(.is-mobile-wizard-active) .mobile-offer-wizard {
    display: none !important;
  }

  body.is-mobile-layout .offer-list-table-wrap {
    display: none;
  }

  body.is-mobile-layout #pipelineView.is-board-layout .pipeline-board {
    display: none !important;
  }

  body.is-mobile-layout #pipelineView .pipeline-layout-toggle {
    display: none;
  }

  body.is-mobile-layout .pipeline-list-table {
    display: none;
  }

  body.is-mobile-layout .product-table-wrap {
    display: none;
  }

  body.is-mobile-layout #customersView .table-wrap table {
    display: none;
  }

  body.is-mobile-layout #tasksView .task-bulk-toolbar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  body.is-mobile-layout .tasks-layout {
    grid-template-columns: 1fr;
  }

  body.is-mobile-layout .task-item {
    flex-wrap: wrap;
    padding: 0.85rem;
  }

  body.is-mobile-layout .task-item .mobile-task-extra {
    width: 100%;
    margin-top: 0.5rem;
  }

  body.is-mobile-layout #settingsView.is-mobile-settings-picker .settings-v2-nav,
  body.is-mobile-layout #settingsView.is-mobile-settings-picker .settings-v2-panels {
    display: none !important;
  }

  body.is-mobile-layout #settingsView.is-mobile-settings-detail .settings-v2-nav {
    display: none !important;
  }

  body.is-mobile-layout #settingsView.is-mobile-settings-picker .mobile-settings-picker {
    display: block;
  }

  body.is-mobile-layout .deal-dialog {
    max-width: 100vw;
    width: 100%;
    margin: 0;
    max-height: 100dvh;
  }

  body.is-mobile-layout #inboxView .social-inbox-layout {
    grid-template-columns: 1fr;
  }

  body.is-mobile-layout #inboxView .social-inbox-context-panel {
    display: none;
  }

  body.is-mobile-layout #inboxView.social-detail-open .social-inbox-list-panel {
    display: none;
  }

  body.is-mobile-layout #inboxView.social-detail-open .social-inbox-detail-panel {
    display: block;
    width: 100%;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  body.is-tablet-layout .sidebar {
    width: 4.5rem;
  }
}

@media (min-width: 1024px) {
  .mobile-bottom-nav,
  .mobile-menu-sheet,
  .mobile-offer-wizard,
  .mobile-sticky-bar {
    display: none !important;
  }
}

/* ——— Bottom navigation ——— */
.mobile-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1200;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  min-height: var(--mobile-bottom-nav-h);
  padding-bottom: var(--mobile-safe-bottom);
  background: var(--surface-elevated, #fff);
  border-top: 1px solid var(--border-subtle, #e5e7eb);
  box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.06);
}

.mobile-bottom-nav__btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: var(--mobile-touch-min);
  padding: 0.35rem 0.25rem;
  border: 0;
  background: transparent;
  color: var(--text-muted, #64748b);
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
}

.mobile-bottom-nav__btn.is-active {
  color: var(--accent, #0f766e);
}

.mobile-bottom-nav__icon {
  font-size: 1.15rem;
  line-height: 1;
}

/* ——— Menü sheet ——— */
.mobile-menu-sheet {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
  visibility: hidden;
}

.mobile-menu-sheet.is-open {
  pointer-events: auto;
  visibility: visible;
}

.mobile-menu-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.mobile-menu-sheet.is-open .mobile-menu-sheet__backdrop {
  opacity: 1;
}

.mobile-menu-sheet__panel {
  position: relative;
  z-index: 1;
  max-height: 70vh;
  overflow: auto;
  padding: 1rem 1rem calc(1rem + var(--mobile-safe-bottom));
  background: var(--surface-elevated, #fff);
  border-radius: 1rem 1rem 0 0;
  transform: translateY(100%);
  transition: transform 0.25s ease;
}

.mobile-menu-sheet.is-open .mobile-menu-sheet__panel {
  transform: translateY(0);
}

.mobile-menu-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.mobile-menu-sheet__head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.mobile-menu-sheet__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.mobile-menu-sheet__item {
  min-height: var(--mobile-touch-min);
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-subtle, #e5e7eb);
  border-radius: 0.65rem;
  background: var(--surface, #f8fafc);
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

/* ——— Mobil kart listeleri ——— */
.mobile-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.mobile-card {
  border: 1px solid var(--border-subtle, #e5e7eb);
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--surface-elevated, #fff);
}

.mobile-card__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.mobile-card__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.mobile-card__meta {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
}

.mobile-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
}

.mobile-card__actions .ghost-button,
.mobile-card__actions .primary-button {
  min-height: 2.25rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.mobile-card__actions .ghost-button.is-whatsapp {
  color: #128c7e;
  border-color: #128c7e;
}

/* ——— Teklif sihirbazı ——— */
.mobile-offer-wizard {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-bottom: calc(var(--mobile-sticky-bar-h) + 1rem);
}

.mobile-wizard-progress {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  padding: 0.25rem 0;
  scrollbar-width: none;
}

.mobile-wizard-progress__step {
  flex: 0 0 auto;
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: var(--surface-muted, #f1f5f9);
  color: var(--text-muted, #64748b);
  white-space: nowrap;
}

.mobile-wizard-progress__step.is-active {
  background: var(--accent, #0f766e);
  color: #fff;
}

.mobile-wizard-progress__step.is-done {
  background: #ccfbf1;
  color: #0f766e;
}

.mobile-wizard-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mobile-wizard-panel label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.mobile-wizard-panel input,
.mobile-wizard-panel select,
.mobile-wizard-panel textarea {
  min-height: var(--mobile-touch-min);
  font-size: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-subtle, #e5e7eb);
}

.mobile-wizard-panel textarea {
  min-height: 5rem;
}

.mobile-customer-results {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 14rem;
  overflow: auto;
}

.mobile-customer-option {
  text-align: left;
  min-height: var(--mobile-touch-min);
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border-subtle, #e5e7eb);
  border-radius: 0.5rem;
  background: #fff;
  cursor: pointer;
}

.mobile-customer-option.is-selected {
  border-color: var(--accent, #0f766e);
  background: #f0fdfa;
}

.mobile-line-card {
  border: 1px solid var(--border-subtle, #e5e7eb);
  border-radius: 0.65rem;
  padding: 0.75rem;
  background: #fff;
}

.mobile-line-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
}

.mobile-line-card dt {
  color: var(--text-muted, #64748b);
  margin: 0;
}

.mobile-line-card dd {
  margin: 0;
  text-align: right;
  font-weight: 600;
}

.mobile-note-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mobile-note-check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  min-height: var(--mobile-touch-min);
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-subtle, #e5e7eb);
  border-radius: 0.5rem;
  cursor: pointer;
}

.mobile-note-check input {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.15rem;
}

.mobile-note-check.is-disabled {
  opacity: 0.55;
  cursor: default;
}

.mobile-preview-total {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent, #0f766e);
}

.mobile-complementary-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.mobile-complementary-pick button {
  min-height: var(--mobile-touch-min);
  padding: 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-subtle, #e5e7eb);
  background: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.mobile-complementary-pick button.is-added {
  border-color: var(--accent, #0f766e);
  background: #f0fdfa;
}

/* ——— Bottom sheet (ürün ekle) ——— */
.mobile-sheet {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
  visibility: hidden;
}

.mobile-sheet.is-open {
  pointer-events: auto;
  visibility: visible;
}

.mobile-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.mobile-sheet.is-open .mobile-sheet__backdrop {
  opacity: 1;
}

.mobile-sheet__panel {
  position: relative;
  z-index: 1;
  max-height: min(85vh, 85dvh);
  overflow: auto;
  padding: 1rem 1rem calc(1rem + var(--mobile-safe-bottom));
  background: #fff;
  border-radius: 1rem 1rem 0 0;
  transform: translateY(100%);
  transition: transform 0.25s ease;
}

.mobile-sheet.is-open .mobile-sheet__panel {
  transform: translateY(0);
}

.mobile-product-option {
  display: block;
  width: 100%;
  text-align: left;
  min-height: var(--mobile-touch-min);
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.35rem;
  border: 1px solid var(--border-subtle, #e5e7eb);
  border-radius: 0.5rem;
  background: #fff;
  cursor: pointer;
}

.mobile-product-option--create {
  border-style: dashed;
  color: var(--accent, #0f766e);
  font-weight: 600;
}

/* ——— Sticky aksiyon bar ——— */
.mobile-sticky-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--mobile-bottom-nav-h) + var(--mobile-safe-bottom) + var(--mobile-keyboard-inset));
  z-index: 1250;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface-elevated, #fff);
  border-top: 1px solid var(--border-subtle, #e5e7eb);
  box-shadow: 0 -2px 16px rgba(15, 23, 42, 0.08);
}

.mobile-sticky-bar .ghost-button,
.mobile-sticky-bar .primary-button {
  flex: 1;
  min-height: var(--mobile-touch-min);
  justify-content: center;
}

.mobile-sticky-bar .primary-button.is-whatsapp {
  background: #128c7e;
  border-color: #128c7e;
}

body.is-mobile-layout.is-wizard-fullscreen .mobile-bottom-nav {
  display: none;
}

body.is-mobile-layout.is-wizard-fullscreen .workspace {
  padding-bottom: calc(var(--mobile-sticky-bar-h) + var(--mobile-safe-bottom));
}

body.is-mobile-layout.is-wizard-fullscreen .mobile-sticky-bar {
  bottom: calc(var(--mobile-safe-bottom) + var(--mobile-keyboard-inset));
}

body.is-mobile-layout #inboxView.social-detail-open .workspace {
  padding-bottom: calc(var(--mobile-bottom-nav-h) + var(--mobile-safe-bottom));
}

.mobile-settings-picker {
  padding: 0.75rem 0;
}

.mobile-settings-picker__head h2 {
  margin: 0 0 0.25rem;
}

.mobile-inline-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.mobile-card.is-selected-customer {
  border-color: var(--accent, #0f766e);
  background: #f0fdfa;
}

.mobile-wizard-panel :focus-visible {
  outline: 2px solid var(--accent, #0f766e);
  outline-offset: 2px;
}

/* Mobil teklif arşiv üst araç çubuğu */
.mobile-offer-archive-toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.mobile-offer-archive-toolbar .primary-button {
  margin-left: auto;
  min-height: var(--mobile-touch-min);
}
