:root {
    --kp-mobile-orange: #f97316;
    --kp-mobile-dark: #111827;
    --kp-mobile-bg: #f3f4f6;
    --kp-mobile-card: #ffffff;
    --kp-mobile-border: #e5e7eb;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    -webkit-tap-highlight-color: transparent;
}

button,
a,
input,
select,
textarea {
    touch-action: manipulation;
}

input,
select,
textarea {
    font-size: 16px;
}

/* iPhone alt güvenli alan desteği */
body {
    padding-bottom: env(safe-area-inset-bottom);
}

/* Mobil genel düzen */
@media (max-width: 768px) {
    body {
        background: var(--kp-mobile-bg);
        overflow-x: hidden;
    }

    .container,
    .kp-container,
    .page-container,
    .content,
    .main-content {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .card,
    .kp-card,
    .panel,
    .box {
        border-radius: 18px !important;
    }

    table {
        width: 100%;
    }

    .table-responsive,
    .responsive-table {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .btn,
    button,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        border-radius: 12px;
    }

    input,
    select,
    textarea {
        width: 100%;
        min-height: 44px;
        border-radius: 12px;
    }

    h1 {
        font-size: 22px !important;
        line-height: 1.2 !important;
    }

    h2 {
        font-size: 19px !important;
        line-height: 1.25 !important;
    }

    h3 {
        font-size: 17px !important;
        line-height: 1.3 !important;
    }

    .desktop-only {
        display: none !important;
    }
}

/* Dashboard kartları mobilde daha uygulama gibi dursun */
@media (max-width: 768px) {
    .dashboard-grid,
    .stats-grid,
    .quick-grid,
    .cards-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }

    .dashboard-grid > *,
    .stats-grid > *,
    .quick-grid > *,
    .cards-grid > * {
        min-width: 0 !important;
    }
}

@media (max-width: 420px) {
    .dashboard-grid,
    .stats-grid,
    .quick-grid,
    .cards-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Ürün listesi gibi tablolar mobilde taşarsa ekranı bozmasın */
@media (max-width: 768px) {
    .products-table,
    .sales-table,
    .stock-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}

/* Ana ekrana eklenmiş PWA modunda daha temiz görünüm */
@media all and (display-mode: standalone) {
    body {
        background: var(--kp-mobile-bg);
    }

    .pwa-only {
        display: block !important;
    }
}

.pwa-only {
    display: none;
}