/* ============================================================
   RESPONSIVE — All @media Queries
   ============================================================ */

/* ── P&L Modal Info Grid ── */
@media(max-width: 500px){ .pnl-modal-info-grid { grid-template-columns: repeat(2, 1fr); } }

/* ── P&L Modal Stats Row ── */
@media(max-width: 500px){ .pnl-modal-stats-row { grid-template-columns: repeat(2, 1fr); } }

/* ── Content Grid ── */
@media(max-width: 850px){ .content-grid { grid-template-columns: 1fr; } }

/* ── Stats Hero Content ── */
@media(max-width: 700px){ .stats-hero-content { flex-direction: column; padding: 1.5rem 1.25rem; text-align: center; } }

/* ── Stats Summary Grid ── */
@media(max-width: 900px){ .stats-summary-grid { grid-template-columns: repeat(2, 1fr); } }
@media(max-width: 500px){ .stats-summary-grid { grid-template-columns: 1fr; } }

/* ── Stats Extended Grid ── */
@media(max-width: 900px){ .stats-grid-extended { grid-template-columns: repeat(2, 1fr); } }
@media(max-width: 500px){ .stats-grid-extended { grid-template-columns: 1fr; } }

/* ── Stats Debt Summary ── */
@media(max-width: 700px) {
    .stats-debt-summary-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-debt-summary-item:nth-child(2)::after { display: none; }
    .stats-debt-summary-header { padding: 1.2rem 1.4rem 0.8rem; }
    .stats-debt-progress { padding: 0.75rem 1.4rem 1.2rem; }
}
@media(max-width: 500px) {
    .stats-debt-summary-grid { grid-template-columns: 1fr 1fr; }
    .stats-debt-summary-item { padding: 0.9rem 0.5rem; }
    .stats-debt-summary-val { font-size: 1.15rem; }
}

/* ── Stats Charts Grid ── */
@media(max-width: 850px){ .stats-charts-grid { grid-template-columns: 1fr; } }

/* ── P&L Detail Grid ── */
@media(max-width: 700px){ .pnl-detail-grid { grid-template-columns: repeat(2, 1fr); } }

/* ── Mobile Bottom Nav Show ── */
@media(max-width: 600px) {
    .mobile-bottom-nav { display: block; }
    body { padding-bottom: env(safe-area-inset-bottom); }
}

/* ── Desktop Nav Hide on Mobile ── */
@media(max-width: 600px) {
    .btn-nav:not(.btn-accent):not(.btn-theme) { display: none !important; }
}

/* ── Mobile Touch Improvements ── */
@media(max-width: 600px) {
    /* Tüm tıklanabilir elementler için daha büyük touch area */
    button, .btn-nav, .btn-primary, .btn-theme,
    .debt-action-btn, .settings-backup-btn {
        min-height: 44px; /* iOS minimum touch target */
    }

    /* Smooth scroll */
    html { scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }

    /* Input zoom'u önle */
    input, select, textarea {
        font-size: 16px !important; /* iOS zoom'u önler */
    }

    /* Card touch feedback */
    .stat-card, .debt-card, .card, .settings-card {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .stat-card:active, .debt-card:active {
        transform: scale(0.98);
    }
}

/* ── Debt Card Mobile ── */
@media(max-width: 600px) {
    .debt-card { border-radius: 14px; }
    .debt-card-top { flex-direction: column; gap: 10px; }
    .debt-card-amount { text-align: left; width: 100%; }
    .debt-card-amount-monthly { margin-left: 0; }
    .debt-card-actions { width: 100%; justify-content: flex-end; }
    .debt-card-bottom { flex-direction: column; align-items: stretch; gap: 10px; }
    .debt-list-toolbar { width: 100%; }
    .debt-filter-select { flex: 1; min-width: 0; }
}

/* ── Debt Card Print ── */
@media print {
    .debt-action-delete, .debt-action-pay { display: none !important; }
}

/* ============================================================
   COMPREHENSIVE 600px — Banking App Mobile Redesign
============================================================ */
@media(max-width: 600px) {
    /* Mobil Navigation - Banka Uygulaması Tarzı */
    .nav-inner {
        padding: 0 1rem; height: 56px;
        gap: 0.5rem;
    }
    .nav-brand { gap: 8px; }
    .nav-logo { width: 28px; height: 28px; }
    .nav-title { font-size: 0.9rem; }
    .nav-actions {
        gap: 4px;
        margin-left: auto;
    }
    .btn-nav {
        height: 34px; padding: 0 12px; font-size: 0.78rem;
        display: none; /* Tab'lar mobilde bottom nav'a taşınacak */
    }
    .btn-theme { height: 34px; width: 34px; }

    /* Mobil Main Area - Daha fazla alan */
    main { padding: 1rem 1rem 5rem; }
    .page-header { margin-bottom: 1rem !important; }
    .page-header-eyebrow { font-size: 0.7rem; }
    .page-header h1 { font-size: 1.5rem; line-height: 1.2 !important; }
    .page-header-sub { font-size: 0.82rem; }

    /* Stat Cards - Tek sütun, daha kompakt */
    .stat-strip {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }
    .stat-card {
        padding: 1.2rem 1.4rem;
        min-height: 120px;
        border-radius: var(--radius-md);
    }
    .stat-card-top { gap: 10px; }
    .stat-card-icon { width: 38px; height: 38px; }
    .stat-card-icon svg { width: 18px; height: 18px; }
    .stat-eyebrow { font-size: 0.68rem; }
    .stat-value { font-size: 1.8rem; margin: 0.2rem 0; }
    .stat-sub { font-size: 0.72rem; }

    /* Zekat Banner - Mobil optimize */
    .zekat-banner {
        padding: 1rem 1.2rem;
        gap: 0.8rem;
        border-radius: var(--radius-md);
        margin-bottom: 1rem;
    }
    .zekat-banner-top { gap: 0.8rem; }
    .zekat-banner-label { font-size: 0.7rem; }
    .zekat-banner-amount { font-size: 1.6rem; }
    .split-tag { font-size: 0.7rem; padding: 2px 10px; }
    .zekat-badge { padding: 5px 12px; font-size: 0.7rem; }
    .zekat-progress-area { padding-top: 0.8rem; }

    /* Cards & Panels - Daha az padding */
    .card {
        padding: 1.2rem;
        border-radius: var(--radius-md);
    }
    .card-header { margin-bottom: 1rem; }
    .card-title { font-size: 0.88rem; }
    .form-group { margin-bottom: 0.8rem; }
    .form-group label { font-size: 0.72rem; margin-bottom: 4px; }
    .input-field {
        padding: 10px 12px;
        font-size: 0.85rem;
        -webkit-appearance: none;
        appearance: none;
    }
    .btn-primary {
        height: 42px;
        font-size: 0.85rem;
        border-radius: 10px;
    }

    /* Panel & Table - Mobil optimize */
    .panel { border-radius: var(--radius-md); }
    .panel-top {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem 1.2rem;
        gap: 10px;
    }
    .panel-title { font-size: 0.88rem; }
    .panel-top .input-field { width: 100%; height: 36px; }
    .panel-footer {
        flex-direction: column;
        padding: 0.8rem 1.2rem;
    }
    .btn-pdf, .btn-csv { height: 40px; font-size: 0.82rem; }

    /* Table - Horizontal scroll */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    table { font-size: 0.8rem; }
    th {
        padding: 10px 12px;
        font-size: 0.62rem;
        position: sticky;
        top: 0;
        background: var(--bg-th);
        z-index: 1;
    }
    td { padding: 12px 12px; }
    .td-date-main { font-size: 0.78rem; }
    .td-date-sub { font-size: 0.66rem; }
    .ayar-tag { font-size: 0.68rem; padding: 3px 10px; }
    .row-value { font-size: 0.84rem; }

    /* Modals - Full screen on mobile */
    .modal-overlay { padding: 0; }
    .modal-card {
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        padding: 1.5rem;
    }
    .modal-header { margin-bottom: 1.2rem; }
    .modal-title { font-size: 1rem; }
    .price-grid-large { grid-template-columns: 1fr; gap: 0.8rem; }

    /* Content Grid - Stack on mobile */
    .content-grid { grid-template-columns: 1fr; gap: 1rem; }
    .sidebar {
        position: fixed; bottom: 0; left: 0; right: 0;
        z-index: 110; margin: 0;
        max-height: 90dvh; overflow-y: auto;
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
        border-radius: 20px 20px 0 0;
        background: var(--bg-card);
        padding: 0 0 env(safe-area-inset-bottom);
        box-shadow: 0 -8px 40px rgba(0,0,0,0.12);
        display: block !important;
    }
    .sidebar.open { transform: translateY(0); }

    .sidebar > .card:first-child,
    .sidebar > .debt-form-card:first-child {
        border-radius: 20px 20px 0 0;
        box-shadow: none;
    }
    .sidebar > .card:first-child .card-header,
    .sidebar > .debt-form-card:first-child .debt-form-header {
        padding-top: 0.5rem;
    }
    .sidebar > .card:first-child .card-header::before,
    .sidebar > .debt-form-card:first-child .debt-form-header::before {
        content: ''; display: block;
        width: 36px; height: 4px;
        border-radius: 4px;
        background: var(--text-tertiary);
        opacity: 0.3;
        margin: 8px auto 12px;
    }

    /* Settings - Mobil optimize */
    .settings-container { gap: 0.875rem; }
    .settings-card { border-radius: var(--radius-md); }
    .settings-card-header { padding: 1.1rem 1.1rem 0; gap: 9px; }
    .settings-card-icon { width: 36px; height: 36px; }
    .settings-card-title { font-size: 0.84rem; }
    .settings-card-sub { font-size: 0.68rem; }
    .settings-card-body { padding: 0.875rem 1.1rem 1.1rem; }

    /* Debt Cards - Mobil optimize */
    .debt-card {
        padding: 0.85rem 1rem;
        border-radius: var(--radius-md);
    }
    .debt-card-top { flex-direction: column; gap: 0.8rem; }
    .debt-card-amount { text-align: left; width: 100%; }
    .debt-card-name { font-size: 0.88rem; }
    .debt-card-amount-val { font-size: 1.1rem; }
    .debt-card-actions { width: 100%; justify-content: flex-end; }
    .debt-action-btn { font-size: 0.72rem; padding: 5px 12px; }
    .debt-list-toolbar { width: 100%; flex-direction: column; }
    .debt-filter-select { flex: 1; min-width: 0; width: 100%; }
    .debt-list-total { width: 100%; text-align: center; }

    /* Stats View - Mobil */
    .stats-hero-content { flex-direction: column; padding: 1.5rem 1.2rem; }
    .stats-hero-title { font-size: 1.5rem; }
    .stats-ring-wrap { width: 100px; height: 100px; }
    .stats-ring-pct { font-size: 1.3rem; }
    .stats-summary-grid { grid-template-columns: 1fr; gap: 0.8rem; }
    .stats-charts-grid { grid-template-columns: 1fr; gap: 1rem; }

    /* Debt Stats - 2 column on mobile */
    .debt-stats-strip { grid-template-columns: repeat(2, 1fr); gap: 0.8rem; }
}

/* ============================================================
   TABLET — 601px to 1050px
============================================================ */
@media(min-width: 601px) and (max-width: 1050px){
    .stat-strip { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
    .content-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   PRINT — Black & White
============================================================ */
@media print {
    /* SİYAH-BEYAZ BASKI İÇİN TÜM RENKLER KALDIRILDI */
    :root, [data-theme="light"], [data-theme="dark"] {
        --bg:           #FFFFFF;
        --bg-card:      #FFFFFF;
        --bg-input:     #FFFFFF;
        --bg-th:        #F0F0F0;
        --bg-nav:       #FFFFFF;

        --text-primary:   #000000;
        --text-secondary: #333333;
        --text-tertiary:  #555555;

        --border:        #CCCCCC;
        --border-strong: #999999;

        --teal:          #000000;
        --teal-hover:    #000000;
        --teal-light:    #F0F0F0;
        --teal-glow:     transparent;

        --gold:          #000000;
        --gold-light:    #F0F0F0;

        --green:         #000000;
        --green-light:   #F0F0F0;

        --red:           #000000;
        --red-light:     #F0F0F0;

        --progress-bg:   #E0E0E0;
        --progress-bar:  #000000;

        --shadow-sm: none;
        --shadow-md: none;
        --shadow-lg: none;
    }

    @page {
        size: A4;
        margin: 16mm 18mm 20mm 18mm;
    }

    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

    body {
        background: #fff !important;
        color: #000 !important;
        font-family: 'DM Sans', sans-serif !important;
        font-size: 9.5pt !important;
        margin: 0 !important;
        padding: 0 !important;
        line-height: 1.5 !important;
    }

    body::before { display: none !important; }

    /* Gizle */
    nav, .btn-theme, .btn-nav, .sidebar, .zekat-banner,
    .panel-footer, .modal-overlay, #stats-view, #debts-view,
    #settings-view, .stat-strip, .page-header-eyebrow,
    .page-header-sub, #searchInput, .toast { display: none !important; }

    main {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    #dashboard-view { display: block !important; }

    .content-grid {
        display: block !important;
        margin: 0 !important;
    }

    /* PDF Başlık Bloğu */
    .page-header {
        display: flex !important;
        align-items: flex-end !important;
        justify-content: space-between !important;
        border-bottom: none !important;
        padding-bottom: 0 !important;
        margin-bottom: 6pt !important;
    }
    .page-header h1 {
        font-size: 20pt !important;
        font-weight: 700 !important;
        color: #000 !important;
        letter-spacing: -0.04em !important;
        line-height: 1.15 !important;
        margin: 0 !important;
    }
    .page-header h1 em {
        font-style: italic !important;
        font-weight: 700 !important;
    }
    .pdf-meta-block {
        text-align: right;
        font-size: 8pt;
        color: #555;
        line-height: 1.8;
    }

    /* PDF Üst Çizgi */
    .pdf-accent-line {
        height: 2pt !important;
        background: #000 !important;
        margin-bottom: 14pt !important;
        border: none !important;
    }

    /* Özet Kartlar */
    .pdf-summary-strip {
        display: grid !important;
        grid-template-columns: 1fr 1fr 1fr 1fr !important;
        gap: 8pt !important;
        margin-bottom: 16pt !important;
        border: none !important;
    }
    .pdf-summary-cell {
        padding: 10pt 12pt !important;
        border: 1pt solid #ccc !important;
        border-radius: 4pt !important;
        background: #fff !important;
    }
    .pdf-summary-label {
        font-size: 6.5pt !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.1em !important;
        color: #555 !important;
        margin-bottom: 4pt !important;
    }
    .pdf-summary-value {
        font-size: 14pt !important;
        font-weight: 700 !important;
        color: #000 !important;
        line-height: 1.15 !important;
        margin-bottom: 2pt !important;
    }
    .pdf-summary-sub {
        font-size: 7pt !important;
        color: #555 !important;
    }

    /* Panel / Tablo */
    .panel {
        box-shadow: none !important;
        border: 1pt solid #ccc !important;
        border-radius: 6pt !important;
        overflow: hidden !important;
        page-break-inside: avoid;
        background: #fff !important;
    }
    .panel-top {
        padding: 8pt 12pt !important;
        border-bottom: 1pt solid #ccc !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        background: #f5f5f5 !important;
    }
    .panel-title {
        font-size: 9pt !important;
        font-weight: 700 !important;
        color: #000 !important;
    }
    .record-count {
        font-size: 7pt !important;
        font-weight: 700 !important;
        color: #000 !important;
        background: #eee !important;
        padding: 2pt 8pt !important;
        border-radius: 100pt !important;
    }

    table {
        width: 100% !important;
        border-collapse: collapse !important;
        font-size: 8.5pt !important;
    }
    th {
        background: #eee !important;
        color: #000 !important;
        font-size: 6.5pt !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.08em !important;
        padding: 6pt 10pt !important;
        border-bottom: 1.5pt solid #999 !important;
        text-align: left !important;
    }
    td {
        padding: 7pt 10pt !important;
        border-bottom: 0.5pt solid #ddd !important;
        color: #000 !important;
        vertical-align: middle !important;
        background: #fff !important;
    }
    tbody tr:last-child td { border-bottom: none !important; }
    tbody tr:nth-child(even) td { background: #f9f9f9 !important; }

    .td-date { display: flex !important; flex-direction: column !important; gap: 2px !important; }
    .td-date-main { font-size: 8pt !important; font-weight: 600 !important; color: #000 !important; }
    .td-date-sub  { font-size: 6.5pt !important; color: #555 !important; }

    .ayar-tag {
        font-size: 7pt !important;
        font-weight: 700 !important;
        color: #000 !important;
        background: #eee !important;
        padding: 2pt 8pt !important;
        border-radius: 100pt !important;
        border: 0.5pt solid #ccc !important;
    }
    .row-value {
        font-weight: 700 !important;
        font-size: 8.5pt !important;
        color: #000 !important;
    }
    .btn-delete { display: none !important; }

    /* PDF Footer */
    .pdf-footer {
        margin-top: 20pt !important;
        padding-top: 10pt !important;
        border-top: 1pt solid #ccc !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
    .pdf-footer-left {
        font-size: 7pt !important;
        color: #555 !important;
        display: flex !important;
        align-items: center !important;
        gap: 6pt !important;
    }
    .pdf-footer-dot {
        width: 4pt !important;
        height: 4pt !important;
        background: #555 !important;
        border-radius: 50% !important;
        display: inline-block !important;
    }
    .pdf-footer-right {
        font-size: 7pt !important;
        color: #555 !important;
    }
}

/* ============================================================
   LARGE SCREENS — 1200px
============================================================ */
@media(max-width: 1200px) {
    .nav-inner, main { max-width: 1120px; }
    .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-strip .stat-card:first-child { grid-column: 1 / -1; }
    .content-grid { grid-template-columns: minmax(320px, 360px) minmax(0, 1fr); gap: 1.25rem; }
}

/* ============================================================
   MEDIUM SCREENS — 900px
============================================================ */
@media(max-width: 900px) {
    .nav-inner { padding: 0 1.25rem; }
    main { padding: 1.5rem 1.25rem 6rem; }
    .stat-strip, .debt-stats-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .content-grid { grid-template-columns: 1fr; }
    .sidebar { order: 2; }
    .panel { order: 1; }
    .settings-container { grid-template-columns: 1fr !important; }
}

/* ============================================================
   MOBILE — Comprehensive 600px (Part 2)
============================================================ */
@media(max-width: 600px) {
    :root {
        --radius-xl: 18px; --radius-lg: 14px; --radius-md: 12px;
        --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
        --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
        --shadow-lg: 0 12px 40px rgba(0,0,0,0.08);
    }
    body {
        background: var(--bg);
        padding-bottom: 0;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    }
    body::before { display: none; }
    nav:not(.mobile-bottom-nav) {
        position: sticky; top: 0; z-index: 100;
        background: color-mix(in srgb, var(--bg) 80%, transparent);
        backdrop-filter: blur(24px) saturate(180%);
        -webkit-backdrop-filter: blur(24px) saturate(180%);
        border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
    }
    .nav-inner {
        height: 52px;
        padding: 0 1rem;
    }
    .nav-logo { width: 26px; height: 26px; border-radius: 7px; }
    .nav-logo svg { width: 14px; height: 14px; }
    #price-last-update { display: none; }

    /* Hide all desktop text nav buttons, show only icon buttons */
    .btn-nav:not(.btn-accent):not(.btn-theme) { display: none !important; }
    .btn-nav.btn-accent {
        display: inline-flex !important;
        width: 34px; height: 34px; padding: 0;
        justify-content: center; border-radius: 10px;
        background: var(--teal); color: #fff; border-color: transparent;
        box-shadow: 0 2px 8px rgba(0,147,158,0.2);
    }
    .btn-nav.btn-accent svg { width: 15px !important; height: 15px !important; }
    .btn-nav.btn-accent { font-size: 0; gap: 0; }
    .btn-theme { width: 34px; height: 34px; border-radius: 10px; }

    main {
        padding: 0.75rem max(14px, env(safe-area-inset-left)) calc(6rem + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-right));
    }

    /* Compact page header - banking app style */
    .page-header { margin-bottom: 0.75rem !important; }
    .page-header-eyebrow {
        font-size: 0.7rem; margin-bottom: 0 !important;
        letter-spacing: 0.04em;
    }
    .page-header h1 {
        font-size: clamp(1.2rem, 6vw, 1.5rem);
        letter-spacing: -0.02em; margin: 2px 0;
    }
    .page-header-sub { display: none; }

    /* Stat cards as banking widgets */
    .stat-strip { grid-template-columns: 1fr; gap: 0.65rem; }
    .stat-strip .stat-card:first-child { grid-column: auto; }
    .stat-card {
        min-height: 0;
        padding: 0.9rem 1rem;
        border: 1px solid var(--border);
        border-radius: 16px;
        background: var(--bg-card);
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .stat-card::before,
    .stat-card::after { display: none; }
    .stat-card:hover { transform: none; box-shadow: none; }
    .stat-card-top { gap: 10px; }
    .stat-card-icon {
        width: 36px; height: 36px; border-radius: 10px;
        background: var(--teal-light); color: var(--teal);
        backdrop-filter: none; border: none; box-shadow: none;
    }
    .stat-card-icon svg { width: 18px; height: 18px; }
    .stat-eyebrow { font-size: 0.68rem; letter-spacing: 0.04em; }
    .stat-value {
        font-size: clamp(1.4rem, 7vw, 1.7rem);
        margin: 0.25rem 0; overflow-wrap: anywhere;
    }
    .stat-sub { font-size: 0.68rem; }

    .stat-card-bg { display: none; }
    .stat-card-teal { background: var(--bg-card); box-shadow: none; }
    .stat-card-gold { background: var(--bg-card); box-shadow: none; }
    .stat-card-green { background: var(--bg-card); box-shadow: none; }

    /* Zekat banner as notification card */
    .zekat-banner {
        padding: 0.9rem 1rem;
        border: 1px solid var(--border);
        border-radius: 16px;
        box-shadow: none;
        background: var(--bg-card);
        backdrop-filter: none;
        margin-bottom: 0.75rem;
    }
    .zekat-banner::before,
    .zekat-banner::after { display: none; }
    .zekat-banner:not(.is-inactive) { animation: none; }
    .zekat-banner-top { align-items: stretch; gap: 0.5rem; }
    .zekat-banner-left { gap: 2px; }
    .zekat-banner-label { font-size: 0.65rem; }
    .zekat-banner-amount { font-size: clamp(1.3rem, 7vw, 1.6rem); overflow-wrap: anywhere; }
    .zekat-split-info { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 4px; }
    .split-tag {
        display: flex; justify-content: space-between; gap: 6px;
        font-size: 0.68rem; padding: 4px 10px; border-radius: 10px;
        background: var(--bg-input); border-color: transparent;
    }
    .zekat-badge-wrap { width: 100%; }
    .zekat-badge, .btn-pay-zakat { flex: 1; justify-content: center; text-align: center; font-size: 0.68rem; padding: 5px 12px; }
    .zekat-progress-area { padding-top: 0.8rem; gap: 6px; }
    .progress-header { font-size: 0.7rem; }
    .progress-track { height: 6px; }
    .hijri-info-box { padding: 10px 12px; border-radius: 12px; }
    .hijri-left { gap: 10px; }
    .hijri-icon { width: 30px; height: 30px; border-radius: 8px; }
    .hijri-icon svg { width: 15px; height: 15px; }
    .hijri-label { font-size: 0.62rem; }
    .hijri-date { font-size: 0.78rem; }
    .hijri-sub { font-size: 0.7rem; }
    .hijri-link { font-size: 0.72rem; width: 100%; text-align: center; padding-top: 6px; }

    /* Cards */
    .card, .panel, .settings-card, .stats-chart-card, .debt-form-card, .debt-card {
        border-radius: var(--radius-lg);
        box-shadow: none;
        border: 1px solid var(--border);
        background: var(--bg-card);
    }
    .card, .debt-form-card { padding: 0.875rem 1rem; }
    .card::before { height: 0; display: none; }
    .card:hover { transform: none; box-shadow: none; }
    .card-header { margin-bottom: 0.7rem; }
    .card-title { font-size: 0.82rem; }
    .card-subtitle { font-size: 0.68rem; }
    .card-body { padding: 0.4rem 0 0; }
    .card-icon { width: 28px; height: 28px; border-radius: 7px; }
    .card-icon svg { width: 14px; height: 14px; }
    .form-group { margin-bottom: 0.7rem; }
    .form-group label { font-size: 0.68rem; margin-bottom: 3px; }
    .input-field, .modal-input {
        border-radius: var(--radius-md);
        min-height: 42px;
        padding: 9px 13px;
        font-size: 0.82rem;
        background-color: var(--bg-input);
    }
    .btn-primary, .debt-form-submit, .settings-goal-save, .settings-danger-btn {
        height: 44px;
        border-radius: var(--radius-md);
        font-size: 0.82rem;
    }

    /* Content Grid */
    .content-grid { gap: 0.75rem; }

    /* Panel - table area */
    .panel { overflow: visible; background: transparent; border: 0; box-shadow: none; }
    .panel::before { display: none; }
    .panel-top {
        position: sticky; top: 48px; z-index: 20;
        margin: 0 0 0.5rem;
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        padding: 0.6rem 0.8rem;
        background: color-mix(in srgb, var(--bg-card) 94%, transparent);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }
    .panel-title { font-size: 0.78rem; justify-content: space-between; width: 100%; }
    .record-count { font-size: 0.6rem; padding: 2px 7px; }
    .panel-top .input-field { height: 30px; font-size: 0.72rem; padding: 5px 10px; border-radius: 100px; }
    .panel-footer {
        border: 0; background: transparent;
        padding: 0.6rem 0 0;
        flex-direction: row; gap: 8px;
    }
    .panel-footer .btn-pdf,
    .panel-footer .btn-csv {
        flex: 1; height: 38px; font-size: 0.75rem;
        border-radius: var(--radius-md); justify-content: center;
    }
    .panel-footer .btn-pdf { background: var(--teal); color: #fff; border: none; }
    .panel-footer .btn-csv { background: var(--bg-card); border: 1px solid var(--border-strong); }

    /* Tables as card list */
    .table-wrap, .inventory-table-wrapper { overflow: visible; }
    .table-wrap table, .inventory-table { border-collapse: separate; border-spacing: 0 7px; }
    .table-wrap thead, .inventory-table thead { display: none; }
    .table-wrap tbody, .inventory-table tbody { display: grid; gap: 7px; }
    .table-wrap tr, .inventory-table tr {
        display: grid;
        gap: 5px;
        padding: 10px 12px;
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        background: var(--bg-card);
        box-shadow: none;
    }
    .table-wrap tr:hover td { background: transparent; }
    .table-wrap td, .inventory-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        padding: 0 !important;
        border: 0 !important;
        text-align: right !important;
        min-width: 0;
        font-size: 0.78rem;
    }
    .table-wrap td::before, .inventory-table td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        color: var(--text-tertiary);
        font-size: 0.6rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        text-align: left;
    }
    .table-wrap td:first-child, .inventory-table td:first-child {
        align-items: flex-start;
        padding-bottom: 5px !important;
        border-bottom: 1px solid var(--border) !important;
    }
    .table-wrap td:first-child::before, .inventory-table td:first-child::before { display: none; }
    .table-wrap td:last-child, .inventory-table td:last-child { justify-content: flex-end; padding-top: 3px !important; }
    .table-wrap td:last-child::before, .inventory-table td:last-child::before { display: none; }
    .td-date-main { font-size: 0.8rem; }
    .td-date-sub { font-size: 0.62rem; }
    .row-value { font-size: 0.84rem; }
    .btn-delete, .btn-icon-danger { width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--red-light); color: var(--red); }

    /* Swipe to delete container */
    .swipe-container {
        overflow: hidden; position: relative;
        touch-action: pan-y;
    }
    .swipe-content {
        transition: transform 0.25s ease;
        will-change: transform;
    }
    .swipe-content.is-swiped {
        transform: translateX(-72px);
    }
    .swipe-delete-btn {
        position: absolute; right: 0; top: 0; bottom: 0;
        width: 72px; display: flex; align-items: center;
        justify-content: center; background: var(--red);
        color: #fff; border: none; cursor: pointer;
        font-size: 0.72rem; font-weight: 600;
        border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    }
    .swipe-delete-btn svg { width: 18px; height: 18px; }

    /* Debt stats */
    .debt-stats-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
    .debt-stat-card {
        padding: 0.7rem; border-radius: var(--radius-md);
        flex-direction: column; align-items: flex-start; gap: 5px;
        border: 1px solid var(--border); background: var(--bg-card);
        box-shadow: none;
    }
    .debt-stat-card::before, .debt-stat-card::after { display: none; }
    .debt-stat-card:hover { transform: none; box-shadow: none; }
    .debt-stat-icon { width: 34px; height: 34px; border-radius: var(--radius-sm); }
    .debt-stat-icon svg { width: 15px; height: 15px; }
    .debt-stat-label { font-size: 0.6rem; white-space: normal; }
    .debt-stat-value { max-width: 100%; font-size: 1rem; }

    .debt-stat-total { background: var(--bg-card); }
    .debt-stat-ratio { background: var(--bg-card); }
    .debt-stat-count { background: var(--bg-card); }
    .debt-stat-max { background: var(--bg-card); }

    .debt-card {
        padding: 0.85rem 1rem; border-radius: var(--radius-md);
        border: 1px solid var(--border); background: var(--bg-card);
    }
    .debt-card:hover { transform: none; box-shadow: none; }
    .debt-card::before { border-radius: var(--radius-md) var(--radius-md) 0 0; }
    .debt-card-top { flex-direction: row; align-items: flex-start; gap: 0.5rem; }
    .debt-card-name { font-size: 0.8rem; }
    .debt-card-amount { width: auto; text-align: right; }
    .debt-card-amount-val { font-size: 0.95rem; }
    .debt-card-actions { justify-content: stretch; gap: 6px; }
    .debt-action-btn, .debt-action-paid {
        flex: 1; justify-content: center; border-radius: var(--radius-sm);
        min-height: 38px; font-size: 0.7rem; padding: 4px 8px;
    }
    .debt-card-payment-row, .debt-card-payment-stats { flex-direction: column; align-items: flex-start; gap: 3px; }

    /* Stats view */
    .stats-hero { min-height: auto; border-radius: var(--radius-lg); margin-bottom: 0.7rem; }
    .stats-hero-content { padding: 1.1rem; text-align: left; align-items: stretch; gap: 0.875rem; }
    .stats-hero-eyebrow { font-size: 0.62rem; }
    .stats-hero-title { font-size: 1.15rem; }
    .stats-hero-sub { font-size: 0.72rem; }
    .stats-hero-right { align-self: center; }
    .stats-ring-wrap { width: 75px; height: 75px; }
    .stats-ring-pct { font-size: 1rem; }
    .stats-summary-grid { gap: 0.5rem; }
    .stats-summary-card {
        padding: 0.7rem; border-radius: var(--radius-md); gap: 9px;
        border: 1px solid var(--border); box-shadow: none;
    }
    .stats-summary-card:hover { transform: none; box-shadow: none; }
    .stats-summary-card::before,
    .stats-summary-card::after { display: none; }
    .stats-sc-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); }
    .stats-sc-icon svg { width: 17px; height: 17px; }
    .stats-sc-label { font-size: 0.6rem; }
    .stats-sc-value { font-size: 1.1rem; }
    .stats-charts-grid { gap: 0.7rem; }
    .stats-chart-card { padding: 0.875rem; border-radius: var(--radius-md); border: 1px solid var(--border); box-shadow: none; }
    .stats-chart-card:hover { box-shadow: none; }
    .stats-chart-body { height: 180px; }
    .stats-chart-header { margin-bottom: 0.7rem; }
    .stats-chart-header h3 { font-size: 0.82rem; }

    /* Expenses */
    .expense-summary-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .expense-stat-card { padding: 0.7rem; border-radius: var(--radius-md); border: 1px solid var(--border); }

    /* PnL Modal */
    .pnl-detail-grid, .pnl-modal-info-grid, .pnl-modal-stats-row { grid-template-columns: 1fr 1fr; gap: 4px; }
    .pnl-modal-compact-row { display: grid; grid-template-columns: 1fr; gap: 4px; }
    .pnl-modal-compact-vs { width: 100%; min-height: 22px; }
    .pnl-modal-hero { padding: 0.7rem 0.9rem; gap: 10px; }
    .pnl-modal-hero-icon { width: 38px; height: 38px; }
    .pnl-modal-hero-value { font-size: 1.2rem; }
    .pnl-modal-info-grid > div,
    .pnl-modal-stats-row > div { padding: 0.4rem 0.5rem; }

    /* Settings */
    .settings-card { border-radius: 14px; }
    .settings-row { min-height: 50px; padding: 11px 15px; gap: 12px; }
    .settings-row-icon { width: 34px; height: 34px; border-radius: 10px; }
    .settings-row-icon svg { width: 16px; height: 16px; }
    .settings-row-label { font-size: 0.84rem; }
    .settings-row-desc { font-size: 0.66rem; }
    .settings-segment-option { font-size: 0.72rem; padding: 5px 11px; }
    .settings-swatch { width: 24px; height: 24px; }
    .settings-goal-area { padding: 0 15px 14px; }
    .settings-goal-row { flex-direction: column; align-items: stretch; }
    .settings-goal-input { height: 44px; font-size: 0.88rem; border-radius: 11px; }
    .settings-goal-save { width: 100%; justify-content: center; height: 44px; border-radius: 11px; }
    .settings-container { padding: 0 0 5rem; }
    .settings-section { margin-bottom: 1.5rem; }
    .settings-section-title { padding: 0 4px 0.6rem 4px; font-size: 0.66rem; }
    .settings-section-title::before { height: 10px; }
    .settings-action-btn { min-height: 50px; padding: 11px 15px; gap: 12px; }
    .settings-note { padding: 8px 15px 12px; }
    .settings-pwa-hint { padding: 0 15px 12px; }
    .settings-danger-tags { padding: 0 15px 10px; }
    .settings-danger-tag { font-size: 0.64rem; padding: 3px 9px; }
    .settings-danger-btn { padding: 12px 15px; font-size: 0.82rem; }
    .settings-danger-divider { margin: 0; }

    /* Modals - bottom sheet style */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
        background: rgba(0,0,0,0.4);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
    .modal-card {
        width: 100%;
        max-width: 100%;
        min-height: auto;
        max-height: 92dvh;
        border-radius: 20px 20px 0 0;
        padding: 0.5rem 1rem calc(1rem + env(safe-area-inset-bottom));
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
        box-shadow: 0 -8px 40px rgba(0,0,0,0.12);
        overflow-y: auto;
        border: none;
    }
    .modal-overlay.active .modal-card {
        transform: translateY(0);
    }
    .modal-card::before {
        content: ''; display: block;
        width: 34px; height: 3.5px;
        border-radius: 4px;
        background: var(--text-tertiary);
        opacity: 0.3;
        margin: 6px auto 14px;
    }
    .modal-header { margin-bottom: 0.875rem; }
    .modal-title { font-size: 0.9rem; }
    .modal-close { width: 26px; height: 26px; }
    .modal-actions { position: sticky; bottom: 0; background: var(--bg-card); padding-top: 0.6rem; }
    .price-grid-large { grid-template-columns: 1fr; gap: 0.5rem; }
    .toast {
        bottom: calc(5rem + env(safe-area-inset-bottom));
        width: calc(100vw - 22px);
        justify-content: center;
        font-size: 0.78rem;
        padding: 9px 15px;
        border-radius: var(--radius-md);
    }

    /* Bottom Navigation - banking app style */
    .mobile-bottom-nav {
        display: block;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        padding: 5px max(7px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left));
        background: color-mix(in srgb, var(--bg-card) 92%, transparent);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        border-top: none;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.04);
    }
    .mobile-bottom-nav-inner {
        display: flex; justify-content: space-around; align-items: stretch;
        gap: 1px; padding: 2px; max-width: 600px; margin: 0 auto;
        border: none; border-radius: 0; background: transparent; box-shadow: none;
    }
    .mobile-nav-item {
        flex: 1; min-width: 0;
        min-height: 46px; border-radius: 12px;
        padding: 6px 4px 4px;
        display: flex; flex-direction: column; align-items: center;
        gap: 3px; background: transparent; border: none; cursor: pointer;
        transition: all 0.2s ease; position: relative;
        text-decoration: none; color: var(--text-tertiary);
        -webkit-tap-highlight-color: transparent;
    }
    .mobile-nav-item:active { transform: scale(0.95); }
    .mobile-nav-item.active {
        background: var(--teal); color: #fff;
    }
    .mobile-nav-item.active .mobile-nav-icon,
    .mobile-nav-item.active .mobile-nav-label { color: #fff !important; }
    .mobile-nav-item[data-target="subscriptions"].active {
        background: var(--gold) !important;
    }
    .mobile-nav-icon {
        width: 21px; height: 21px; display: flex;
        align-items: center; justify-content: center;
        transition: transform 0.2s;
    }
    .mobile-nav-icon svg { width: 17px; height: 17px; }
    .mobile-nav-item.active .mobile-nav-icon { transform: scale(1.1); }
    .mobile-nav-label {
        font-size: 0.56rem; font-weight: 600;
        letter-spacing: -0.01em; line-height: 1; white-space: nowrap;
    }

    /* Empty state */
    .empty-state { padding: 2.25rem 1rem; }
    .empty-state-icon { width: 40px; height: 40px; border-radius: var(--radius-md); margin-bottom: 0.7rem; }

    /* Install panel in settings */
    .settings-card-accent { border-color: var(--teal); }

    /* Page transitions */
    .slide-left {
        animation: slideLeft 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    .slide-right {
        animation: slideRight 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }

    #stats-view, #settings-view, #debts-view, #expenses-view {
        animation: mobileFadeIn 0.25s ease;
    }

    /* Edge-to-edge content on mobile */
    main {
        max-width: 100%;
        padding: 0.5rem max(8px, env(safe-area-inset-left)) 5rem max(8px, env(safe-area-inset-right));
    }
    .page-header { padding: 0.875rem 0 0.65rem; }
    .page-header h1 { font-size: 1.2rem; }
    .page-header-sub { font-size: 0.7rem; }
    .page-header-eyebrow { font-size: 0.6rem; margin-bottom: 2px; }
    .panel { border-radius: 0; border-left: none; border-right: none; box-shadow: none; border: none; border-top: 1px solid var(--border); }
    .panel-top { padding: 0.75rem 16px; }
    .panel-footer { padding: 0.75rem 16px; border-radius: 0; flex-direction: column; gap: 8px; }
    .panel-footer .btn-pdf { width: 100%; justify-content: center; }
    .stat-strip { grid-template-columns: 1fr; gap: 7px; padding: 0 16px; margin-bottom: 0.7rem; }
    .stat-card { padding: 11px 14px; border-radius: var(--radius-md); }
    .stat-value { font-size: 1.25rem; }
    .stat-sub { font-size: 0.66rem; }
    .record-count { font-size: 0.66rem; }
    #searchInput { width: 100%; margin-top: 7px; }
    .table-wrap { border-radius: 0; margin: 0 -16px; width: calc(100% + 32px); }
    .content-grid { gap: 0; }

    /* Zekat banner */
    .zekat-banner { margin: 0 16px 0.875rem; border-radius: var(--radius-lg); padding: 0.875rem 0.875rem 0.65rem; }
    .zekat-banner-top { flex-direction: column; gap: 7px; }
    .zekat-banner-amount { font-size: 1.2rem; }
    .zekat-badge-wrap { width: 100%; justify-content: flex-end; }

    /* Stats view cards */
    .stats-hero { border-radius: 0; }
    .stats-chart-card { border-radius: 0; border-left: none; border-right: none; }

    /* Expenses view cards */
    #expenses-view .card { border-radius: 0; border-left: none; border-right: none; box-shadow: none; }
    #expenses-view .card-header { padding: 0.75rem 16px; }
    #expenses-view .main-content { padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }
    .expense-summary-grid { padding: 0 16px; }
    #expense-list-container { padding: 0 16px 1rem; }

    /* Settings */
    .settings-container { padding: 0 14px 5rem; }
}

/* ============================================================
   EXTRA SMALL — 380px
============================================================ */
@media(max-width: 380px) {
    .nav-title { max-width: 100px; }
    .debt-stats-strip, .pnl-detail-grid, .pnl-modal-info-grid, .pnl-modal-stats-row { grid-template-columns: 1fr; }
    .debt-card-top { flex-direction: column; }
    .debt-card-amount { width: 100%; text-align: left; }
    .mobile-nav-label { font-size: 0.54rem; }
}

/* ============================================================
   TOUCH DEVICE — hover: none
============================================================ */
@media(hover: none) and (pointer: coarse) {
    .stat-card:hover { transform: none; box-shadow: var(--shadow-sm); }
    .stats-summary-card:hover { transform: none; box-shadow: var(--shadow-sm); }
    .debt-stat-card:hover { transform: none; box-shadow: var(--shadow-sm); }
    .btn-nav:hover { transform: none; background: transparent; border-color: transparent; }
    .btn-nav.active:hover { background: var(--teal-light); }
    .settings-card:hover { box-shadow: var(--shadow-sm); }
    .panel:hover { box-shadow: var(--shadow-sm); }
    .card:hover { transform: none; box-shadow: var(--shadow-sm); }
    .debt-card:hover { transform: none; box-shadow: var(--shadow-sm); }
}

/* ============================================================
   MOBILE FAB SHOW
============================================================ */
@media(max-width: 600px) {
    .mobile-fab { display: block; }
}

/* ============================================================
   SUBSCRIPTIONS MOBILE
============================================================ */
@media (max-width: 600px) {
    .sub-card {
        border-radius: var(--radius-md) !important;
        padding: 0.875rem 1rem !important;
    }
    .sub-card:hover {
        transform: none;
        box-shadow: var(--shadow-sm);
    }
}