/* Add CRM — mobile app shell */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 64px;
  --brand: #2AB1AF;
}

html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  min-height: 100%;
  min-height: 100dvh;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Prevent iOS zoom on focus */
@media (max-width: 1023px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
  select,
  textarea {
    font-size: 16px !important;
  }
}

.app-shell {
  min-height: 100dvh;
}

.mobile-topbar {
  /* Status bar / notch üzerinde logo+aramayı görünür bırak */
  padding-top: max(2.75rem, calc(var(--safe-top) + 1.25rem));
  padding-bottom: 0.75rem;
}

@media (min-width: 1024px) {
  .mobile-topbar {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
}

.mobile-main {
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 1.25rem);
}

@media (min-width: 1024px) {
  .mobile-main {
    padding-bottom: 2rem;
  }
}

.mobile-tabbar {
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
}

.tab-item {
  min-height: 48px;
  min-width: 56px;
}

.fab-create {
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 0.75rem);
}

/* Horizontal tables become swipeable sheets on mobile */
@media (max-width: 1023px) {
  .table-scroll {
    margin-left: -1rem;
    margin-right: -1rem;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    overflow-x: auto !important;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  .table-scroll table {
    min-width: 560px;
  }

  .kanban-board {
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 0.75rem;
    padding-bottom: 0.5rem;
  }
  .kanban-col {
    width: min(85vw, 20rem) !important;
    scroll-snap-align: start;
    max-height: calc(100dvh - 15rem) !important;
  }

  .calendar-grid {
    font-size: 10px;
  }
  .calendar-grid .min-h-\[100px\] {
    min-height: 72px;
  }
}

/* Bottom sheets */
.sheet-backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
}
.sheet-panel {
  border-radius: 1.25rem 1.25rem 0 0;
  max-height: min(85dvh, 640px);
  padding-bottom: calc(1rem + var(--safe-bottom));
}
.sheet-handle {
  width: 2.5rem;
  height: 0.25rem;
  border-radius: 999px;
  background: #3f3f46;
  margin: 0.5rem auto 0.75rem;
}

/* Search: full-screen feel on phones */
@media (max-width: 640px) {
  #search-modal .search-panel {
    margin-top: 0 !important;
    height: 100dvh;
    max-width: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }
  #search-modal .search-panel > div:first-child {
    border-radius: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  #search-results {
    flex: 1;
    max-height: none !important;
  }
}
